@cloudflare/workers-types 5.20261110.1 → 5.20261113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -813,7 +813,10 @@ interface DurableObjectStorage {
813
813
  snapshot(
814
814
  options?: DurableObjectSnapshotOptions,
815
815
  ): Promise<DurableObjectSnapshot>;
816
- onNextSessionRestore(target: DurableObjectSnapshot | string): Promise<string>;
816
+ onNextSessionRestore(
817
+ target: DurableObjectSnapshot | string,
818
+ options?: DurableObjectRestoreOptions,
819
+ ): Promise<string>;
817
820
  /** @deprecated Use `ctx.configureReadReplication()` instead. */
818
821
  ensureReplicas(): void;
819
822
  /** @deprecated Use `ctx.configureReadReplication()` instead. */
@@ -828,6 +831,9 @@ interface DurableObjectReadReplicationOptions {
828
831
  interface DurableObjectSnapshotOptions {
829
832
  bookmark?: string;
830
833
  }
834
+ interface DurableObjectRestoreOptions {
835
+ kvData?: Record<string, any>;
836
+ }
831
837
  interface DurableObjectListOptions {
832
838
  start?: string;
833
839
  startAfter?: string;
@@ -3568,1812 +3574,1457 @@ interface TraceMetrics {
3568
3574
  interface UnsafeTraceMetrics {
3569
3575
  fromTrace(item: TraceItem): TraceMetrics;
3570
3576
  }
3577
+ type WebSocketEventMap = {
3578
+ close: CloseEvent;
3579
+ message: MessageEvent;
3580
+ open: Event;
3581
+ error: ErrorEvent;
3582
+ };
3571
3583
  /**
3572
- * 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.
3584
+ * 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.
3573
3585
  *
3574
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
3586
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3575
3587
  */
3576
- declare class URL {
3577
- constructor(url: string | URL, base?: string | URL);
3578
- /**
3579
- * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
3580
- *
3581
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
3582
- */
3583
- get origin(): string;
3584
- /**
3585
- * The **`href`** property of the URL interface is a string containing the whole URL.
3586
- *
3587
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
3588
- */
3589
- get href(): string;
3590
- /**
3591
- * The **`href`** property of the URL interface is a string containing the whole URL.
3592
- *
3593
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
3594
- */
3595
- set href(value: string);
3596
- /**
3597
- * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".
3598
- *
3599
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
3600
- */
3601
- get protocol(): string;
3602
- /**
3603
- * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".
3604
- *
3605
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
3606
- */
3607
- set protocol(value: string);
3608
- /**
3609
- * 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, "".
3610
- *
3611
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
3612
- */
3613
- get username(): string;
3614
- /**
3615
- * 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, "".
3616
- *
3617
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
3618
- */
3619
- set username(value: string);
3620
- /**
3621
- * 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, "".
3622
- *
3623
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
3624
- */
3625
- get password(): string;
3626
- /**
3627
- * 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, "".
3628
- *
3629
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
3630
- */
3631
- set password(value: string);
3632
- /**
3633
- * 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, "".
3634
- *
3635
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
3636
- */
3637
- get host(): string;
3638
- /**
3639
- * 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, "".
3640
- *
3641
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
3642
- */
3643
- set host(value: string);
3588
+ declare var WebSocket: {
3589
+ prototype: WebSocket;
3590
+ new (url: string, protocols?: string[] | string): WebSocket;
3591
+ readonly READY_STATE_CONNECTING: number;
3592
+ readonly CONNECTING: number;
3593
+ readonly READY_STATE_OPEN: number;
3594
+ readonly OPEN: number;
3595
+ readonly READY_STATE_CLOSING: number;
3596
+ readonly CLOSING: number;
3597
+ readonly READY_STATE_CLOSED: number;
3598
+ readonly CLOSED: number;
3599
+ };
3600
+ /**
3601
+ * 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.
3602
+ *
3603
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3604
+ */
3605
+ interface WebSocket extends EventTarget<WebSocketEventMap> {
3606
+ accept(options?: WebSocketAcceptOptions): void;
3644
3607
  /**
3645
- * 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.
3608
+ * 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.
3646
3609
  *
3647
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
3610
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
3648
3611
  */
3649
- get hostname(): string;
3612
+ send(message: (ArrayBuffer | ArrayBufferView) | string): void;
3650
3613
  /**
3651
- * 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.
3614
+ * The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
3652
3615
  *
3653
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
3616
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
3654
3617
  */
3655
- set hostname(value: string);
3618
+ close(code?: number, reason?: string): void;
3619
+ serializeAttachment(attachment: any): void;
3620
+ deserializeAttachment(): any | null;
3656
3621
  /**
3657
- * 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, "".
3622
+ * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.
3658
3623
  *
3659
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
3624
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
3660
3625
  */
3661
- get port(): string;
3626
+ readyState: number;
3662
3627
  /**
3663
- * 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, "".
3628
+ * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
3664
3629
  *
3665
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
3630
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
3666
3631
  */
3667
- set port(value: string);
3632
+ url: string | null;
3668
3633
  /**
3669
- * 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.
3634
+ * 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.
3670
3635
  *
3671
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
3636
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
3672
3637
  */
3673
- get pathname(): string;
3638
+ protocol: string | null;
3674
3639
  /**
3675
- * 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.
3640
+ * 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.
3676
3641
  *
3677
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
3642
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
3678
3643
  */
3679
- set pathname(value: string);
3644
+ extensions: string | null;
3680
3645
  /**
3681
- * 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, "".
3646
+ * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.
3682
3647
  *
3683
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
3648
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)
3684
3649
  */
3685
- get search(): string;
3650
+ binaryType: "blob" | "arraybuffer";
3651
+ }
3652
+ interface WebSocketAcceptOptions {
3686
3653
  /**
3687
- * 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, "".
3688
- *
3689
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
3654
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3655
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3656
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3657
+ * both sides independently. Defaults to `false` when the
3658
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3690
3659
  */
3691
- set search(value: string);
3660
+ allowHalfOpen?: boolean;
3661
+ }
3662
+ declare const WebSocketPair: {
3663
+ new (): {
3664
+ 0: WebSocket;
3665
+ 1: WebSocket;
3666
+ };
3667
+ };
3668
+ interface SqlStorage {
3669
+ exec<T extends Record<string, SqlStorageValue>>(
3670
+ query: string,
3671
+ ...bindings: any[]
3672
+ ): SqlStorageCursor<T>;
3673
+ prepare(query: string): SqlStorageStatement;
3674
+ ingest(query: string): SqlStorageIngestResult;
3675
+ setMaxPageCountForTest(count: number): void;
3676
+ get databaseSize(): number;
3677
+ Cursor: typeof SqlStorageCursor;
3678
+ Statement: typeof SqlStorageStatement;
3679
+ }
3680
+ declare abstract class SqlStorageStatement {}
3681
+ type SqlStorageValue = ArrayBuffer | string | number | null;
3682
+ declare abstract class SqlStorageCursor<
3683
+ T extends Record<string, SqlStorageValue>,
3684
+ > {
3685
+ next(): IteratorResult<T, undefined>;
3686
+ toArray(): T[];
3687
+ one(): T;
3688
+ raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
3689
+ columnNames: string[];
3690
+ get rowsRead(): number;
3691
+ get rowsWritten(): number;
3692
+ get reusedCachedQueryForTest(): boolean;
3693
+ [Symbol.iterator](): IterableIterator<T>;
3694
+ }
3695
+ interface SqlStorageIngestResult {
3696
+ remainder: string;
3697
+ rowsRead: number;
3698
+ rowsWritten: number;
3699
+ statementCount: number;
3700
+ }
3701
+ interface Socket {
3702
+ get readable(): ReadableStream;
3703
+ get writable(): WritableStream;
3704
+ get closed(): Promise<void>;
3705
+ get opened(): Promise<SocketInfo>;
3706
+ get upgraded(): boolean;
3707
+ get secureTransport(): "on" | "off" | "starttls";
3708
+ get protocol(): "tcp" | "udp";
3709
+ close(): Promise<void>;
3710
+ startTls(options?: TlsOptions): Socket;
3711
+ proxyTo(sock: Socket, options?: StreamPipeOptions): Promise<void>;
3712
+ }
3713
+ interface SocketOptions {
3714
+ secureTransport?: string;
3715
+ allowHalfOpen: boolean;
3716
+ highWaterMark?: number | bigint;
3717
+ }
3718
+ interface SocketAddress {
3719
+ hostname: string;
3720
+ port: number;
3721
+ }
3722
+ interface TlsOptions {
3723
+ expectedServerHostname?: string;
3724
+ }
3725
+ interface SocketInfo {
3726
+ remoteAddress?: string;
3727
+ localAddress?: string;
3728
+ }
3729
+ declare class Datagram {
3730
+ constructor(data: Uint8Array);
3731
+ get data(): Uint8Array;
3732
+ }
3733
+ /**
3734
+ * The **`EventSource`** interface is web content's interface to server-sent events.
3735
+ *
3736
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
3737
+ */
3738
+ declare class EventSource extends EventTarget {
3739
+ constructor(url: string, init?: EventSourceEventSourceInit);
3692
3740
  /**
3693
- * 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, "".
3741
+ * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).
3694
3742
  *
3695
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
3743
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
3696
3744
  */
3697
- get hash(): string;
3745
+ close(): void;
3698
3746
  /**
3699
- * 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, "".
3747
+ * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
3700
3748
  *
3701
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
3749
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
3702
3750
  */
3703
- set hash(value: string);
3751
+ get url(): string;
3704
3752
  /**
3705
- * 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.
3753
+ * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
3706
3754
  *
3707
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
3755
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
3708
3756
  */
3709
- get searchParams(): URLSearchParams;
3757
+ get withCredentials(): boolean;
3710
3758
  /**
3711
- * 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().
3759
+ * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
3712
3760
  *
3713
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
3761
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
3714
3762
  */
3715
- toJSON(): string;
3716
- /*function toString() { [native code] }*/
3717
- toString(): string;
3718
- /**
3719
- * 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.
3720
- *
3721
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)
3722
- */
3723
- static canParse(url: string, base?: string): boolean;
3763
+ get readyState(): number;
3764
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3765
+ get onopen(): any | null;
3766
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3767
+ set onopen(value: any | null);
3768
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3769
+ get onmessage(): any | null;
3770
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3771
+ set onmessage(value: any | null);
3772
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3773
+ get onerror(): any | null;
3774
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3775
+ set onerror(value: any | null);
3776
+ static readonly CONNECTING: number;
3777
+ static readonly OPEN: number;
3778
+ static readonly CLOSED: number;
3779
+ static from(stream: ReadableStream): EventSource;
3780
+ }
3781
+ interface EventSourceEventSourceInit {
3782
+ withCredentials?: boolean;
3783
+ fetcher?: Fetcher;
3784
+ }
3785
+ interface ExecOutput {
3786
+ readonly stdout: ArrayBuffer;
3787
+ readonly stderr: ArrayBuffer;
3788
+ readonly exitCode: number;
3789
+ }
3790
+ interface ContainerExecOptions {
3791
+ cwd?: string;
3792
+ env?: Record<string, string>;
3793
+ user?: string;
3794
+ signal?: AbortSignal;
3795
+ pty?: boolean | ContainerExecPtyOptions;
3796
+ stdin?: ReadableStream | "pipe";
3797
+ stdout?: "pipe" | "ignore";
3798
+ stderr?: "pipe" | "ignore" | "combined";
3799
+ }
3800
+ interface ContainerExecPtyOptions {
3801
+ cols?: number;
3802
+ rows?: number;
3803
+ }
3804
+ interface ExecProcess {
3805
+ readonly stdin: WritableStream | null;
3806
+ readonly stdout: ReadableStream | null;
3807
+ readonly stderr: ReadableStream | null;
3808
+ readonly pid: number;
3809
+ readonly isPty: boolean;
3810
+ readonly exitCode: Promise<number>;
3811
+ output(): Promise<ExecOutput>;
3812
+ kill(signal?: number): void;
3813
+ resize(cols: number, rows: number): void;
3814
+ }
3815
+ interface Container {
3816
+ get running(): boolean;
3817
+ get images(): Record<string, string>;
3818
+ start(options?: ContainerStartupOptions): void;
3819
+ monitor(): Promise<void>;
3820
+ destroy(error?: any): Promise<void>;
3821
+ signal(signo: number): void;
3822
+ getTcpPort(port: number): Fetcher;
3823
+ setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3824
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3825
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3826
+ snapshotContainer(
3827
+ options?: ContainerSnapshotOptions,
3828
+ ): Promise<ContainerSnapshot>;
3829
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3830
+ exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;
3831
+ inspect(): Promise<ContainerInfo | null>;
3832
+ interceptOutboundTcp(addr: string, binding: Fetcher): Promise<void>;
3833
+ snapshotDirectory(
3834
+ options: ContainerDirectorySnapshotOptions,
3835
+ ): Promise<ContainerDirectorySnapshot>;
3836
+ setLabels(labels: Record<string, string>): Promise<void>;
3837
+ }
3838
+ interface ContainerDirectorySnapshot {
3839
+ id: string;
3840
+ size: number;
3841
+ dir: string;
3842
+ name?: string;
3843
+ }
3844
+ interface ContainerDirectorySnapshotOptions {
3845
+ dir: string;
3846
+ name?: string;
3847
+ }
3848
+ type ContainerDirectorySnapshotRestoreParams =
3849
+ | {
3850
+ snapshot: ContainerDirectorySnapshot;
3851
+ mountPoint?: string;
3852
+ }
3853
+ | {
3854
+ snapshot?: undefined;
3855
+ mountPoint: string;
3856
+ };
3857
+ interface ContainerSnapshot {
3858
+ id: string;
3859
+ size: number;
3860
+ name?: string;
3861
+ }
3862
+ interface ContainerSnapshotRestoreParams {
3863
+ id: string;
3864
+ }
3865
+ interface ContainerSnapshotOptions {
3866
+ name?: string;
3867
+ }
3868
+ type ContainerStartupOptions = {
3869
+ entrypoint?: string[];
3870
+ enableInternet?: boolean;
3871
+ env?: Record<string, string>;
3872
+ hardTimeout?: number | bigint;
3873
+ instance?:
3874
+ | "lite"
3875
+ | "basic"
3876
+ | "standard-1"
3877
+ | "standard-2"
3878
+ | "standard-3"
3879
+ | "standard-4"
3880
+ | ContainerStartResources;
3881
+ labels?: Record<string, string>;
3882
+ directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3883
+ } & (
3884
+ | {
3885
+ image: string;
3886
+ containerSnapshot?: never;
3887
+ }
3888
+ | {
3889
+ image?: never;
3890
+ containerSnapshot?: ContainerSnapshotRestoreParams;
3891
+ }
3892
+ );
3893
+ interface ContainerInfo {
3894
+ labels: Record<string, string>;
3895
+ image: string;
3896
+ }
3897
+ interface ContainerStartResources {
3898
+ vcpu: number;
3899
+ memoryMib: number;
3900
+ diskMb: number;
3901
+ }
3902
+ /**
3903
+ * The **`FileSystemHandle`** interface of the File System API is an object which represents a file or directory entry. Multiple handles can represent the same entry. For the most part you do not work with FileSystemHandle directly but rather its child interfaces FileSystemFileHandle and FileSystemDirectoryHandle.
3904
+ * Available only in secure contexts.
3905
+ *
3906
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle)
3907
+ */
3908
+ declare abstract class FileSystemHandle {
3724
3909
  /**
3725
- * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.
3910
+ * The **`kind`** read-only property of the FileSystemHandle interface returns the type of entry. This is 'file' if the associated entry is a file or 'directory'. It is used to distinguish files from directories when iterating over the contents of a directory.
3726
3911
  *
3727
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)
3912
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/kind)
3728
3913
  */
3729
- static parse(url: string, base?: string): URL | null;
3914
+ get kind(): string;
3730
3915
  /**
3731
- * The **`createObjectURL()`** static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter.
3916
+ * The **`name`** read-only property of the FileSystemHandle interface returns the name of the entry represented by handle.
3732
3917
  *
3733
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
3918
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/name)
3734
3919
  */
3735
- static createObjectURL(object: File | Blob): string;
3920
+ get name(): string;
3736
3921
  /**
3737
- * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
3922
+ * The **`isSameEntry()`** method of the FileSystemHandle interface compares two handles to see if the associated entries (either a file or directory) match.
3738
3923
  *
3739
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
3924
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/isSameEntry)
3740
3925
  */
3741
- static revokeObjectURL(object_url: string): void;
3926
+ isSameEntry(other: FileSystemHandle): Promise<boolean>;
3927
+ getUniqueId(): Promise<string>;
3928
+ remove(options?: FileSystemHandleRemoveOptions): Promise<void>;
3742
3929
  }
3743
3930
  /**
3744
- * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
3931
+ * The **`FileSystemFileHandle`** interface of the File System API represents a handle to a file system entry. The interface is accessed through the window.showOpenFilePicker() method.
3932
+ * Available only in secure contexts.
3745
3933
  *
3746
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
3934
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle)
3747
3935
  */
3748
- declare class URLSearchParams {
3749
- constructor(
3750
- init?: Iterable<Iterable<string>> | Record<string, string> | string,
3751
- );
3752
- /**
3753
- * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
3754
- *
3755
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)
3756
- */
3757
- get size(): number;
3758
- /**
3759
- * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
3760
- *
3761
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
3762
- */
3763
- append(name: string, value: string): void;
3936
+ declare abstract class FileSystemFileHandle extends FileSystemHandle {
3764
3937
  /**
3765
- * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.
3938
+ * The **`getFile()`** method of the FileSystemFileHandle interface returns a Promise which resolves to a File object representing the state on disk of the entry represented by the handle.
3766
3939
  *
3767
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
3940
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/getFile)
3768
3941
  */
3769
- delete(name: string, value?: string): void;
3942
+ getFile(): Promise<File>;
3770
3943
  /**
3771
- * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.
3944
+ * The **`createWritable()`** method of the FileSystemFileHandle interface creates a FileSystemWritableFileStream that can be used to write to a file. The method returns a Promise which resolves to this created stream.
3772
3945
  *
3773
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
3946
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/createWritable)
3774
3947
  */
3775
- get(name: string): string | null;
3948
+ createWritable(
3949
+ options?: FileSystemFileHandleFileSystemCreateWritableOptions,
3950
+ ): Promise<FileSystemWritableFileStream>;
3951
+ }
3952
+ /**
3953
+ * The **`FileSystemDirectoryHandle`** interface of the File System API provides a handle to a file system directory.
3954
+ * Available only in secure contexts.
3955
+ *
3956
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle)
3957
+ */
3958
+ declare abstract class FileSystemDirectoryHandle extends FileSystemHandle {
3776
3959
  /**
3777
- * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
3960
+ * The **`getFileHandle()`** method of the FileSystemDirectoryHandle interface returns a FileSystemFileHandle for a file with the specified name, within the directory the method is called.
3778
3961
  *
3779
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
3962
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getFileHandle)
3780
3963
  */
3781
- getAll(name: string): string[];
3964
+ getFileHandle(
3965
+ name: string,
3966
+ options?: FileSystemDirectoryHandleFileSystemGetFileOptions,
3967
+ ): Promise<FileSystemFileHandle>;
3782
3968
  /**
3783
- * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.
3969
+ * The **`getDirectoryHandle()`** method of the FileSystemDirectoryHandle interface returns a FileSystemDirectoryHandle for a subdirectory with the specified name within the directory handle on which the method is called.
3784
3970
  *
3785
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
3971
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle)
3786
3972
  */
3787
- has(name: string, value?: string): boolean;
3973
+ getDirectoryHandle(
3974
+ name: string,
3975
+ options?: FileSystemDirectoryHandleFileSystemGetDirectoryOptions,
3976
+ ): Promise<FileSystemDirectoryHandle>;
3788
3977
  /**
3789
- * 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.
3978
+ * The **`removeEntry()`** method of the FileSystemDirectoryHandle interface attempts to remove an entry if the directory handle contains a file or directory called the name specified.
3790
3979
  *
3791
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
3980
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/removeEntry)
3792
3981
  */
3793
- set(name: string, value: string): void;
3982
+ removeEntry(
3983
+ name: string,
3984
+ options?: FileSystemDirectoryHandleFileSystemRemoveOptions,
3985
+ ): Promise<void>;
3794
3986
  /**
3795
- * 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).
3987
+ * The **`resolve()`** method of the FileSystemDirectoryHandle interface returns an Array of directory names from the parent handle to the specified child entry, with the name of the child entry as the last array item.
3796
3988
  *
3797
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
3989
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/resolve)
3798
3990
  */
3799
- sort(): void;
3800
- entries(): IterableIterator<[key: string, value: string]>;
3801
- keys(): IterableIterator<string>;
3802
- values(): IterableIterator<string>;
3803
- forEach<This = unknown>(
3804
- callback: (
3805
- this: This,
3806
- value: string,
3807
- key: string,
3808
- parent: URLSearchParams,
3991
+ resolve(possibleDescendant: FileSystemHandle): Promise<string[]>;
3992
+ entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
3993
+ keys(): AsyncIterableIterator<string>;
3994
+ values(): AsyncIterableIterator<FileSystemHandle>;
3995
+ forEach(
3996
+ callback: (
3997
+ param0: string,
3998
+ param1: FileSystemHandle,
3999
+ param2: FileSystemDirectoryHandle,
3809
4000
  ) => void,
3810
- thisArg?: This,
4001
+ thisArg?: any,
3811
4002
  ): void;
3812
- /*function toString() { [native code] }*/
3813
- toString(): string;
3814
- [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
4003
+ [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
3815
4004
  }
3816
4005
  /**
3817
- * 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.
4006
+ * The **`FileSystemWritableFileStream`** interface of the File System API is a WritableStream object with additional convenience methods, which operates on a single file on disk. The interface is accessed through the FileSystemFileHandle.createWritable() method.
4007
+ * Available only in secure contexts.
3818
4008
  *
3819
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
4009
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream)
3820
4010
  */
3821
- declare class URLPattern {
3822
- constructor(
3823
- input?: string | URLPatternInit,
3824
- baseURL?: string | URLPatternOptions,
3825
- patternOptions?: URLPatternOptions,
3826
- );
3827
- /**
3828
- * The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
3829
- *
3830
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
3831
- */
3832
- get protocol(): string;
3833
- /**
3834
- * The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
3835
- *
3836
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
3837
- */
3838
- get username(): string;
3839
- /**
3840
- * The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
3841
- *
3842
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
3843
- */
3844
- get password(): string;
3845
- /**
3846
- * The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
3847
- *
3848
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
3849
- */
3850
- get hostname(): string;
3851
- /**
3852
- * The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
3853
- *
3854
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
3855
- */
3856
- get port(): string;
3857
- /**
3858
- * The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
3859
- *
3860
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
3861
- */
3862
- get pathname(): string;
3863
- /**
3864
- * The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
3865
- *
3866
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
3867
- */
3868
- get search(): string;
4011
+ declare abstract class FileSystemWritableFileStream extends WritableStream {
3869
4012
  /**
3870
- * The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
4013
+ * The **`write()`** method of the FileSystemWritableFileStream interface writes content into the file the method is called on, at the current file cursor offset.
3871
4014
  *
3872
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
4015
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/write)
3873
4016
  */
3874
- get hash(): string;
4017
+ write(
4018
+ data:
4019
+ | Blob
4020
+ | (ArrayBuffer | ArrayBufferView)
4021
+ | string
4022
+ | FileSystemFileWriteParams,
4023
+ ): Promise<void>;
3875
4024
  /**
3876
- * 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.
4025
+ * The **`seek()`** method of the FileSystemWritableFileStream interface updates the current file cursor offset to the position (in bytes) specified when calling the method.
3877
4026
  *
3878
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups)
4027
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/seek)
3879
4028
  */
3880
- get hasRegExpGroups(): boolean;
4029
+ seek(position: number): Promise<void>;
3881
4030
  /**
3882
- * 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.
4031
+ * The **`truncate()`** method of the FileSystemWritableFileStream interface resizes the file associated with the stream to the specified size in bytes.
3883
4032
  *
3884
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
4033
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/truncate)
3885
4034
  */
3886
- test(input?: string | URLPatternInit, baseURL?: string): boolean;
4035
+ truncate(size: number): Promise<void>;
4036
+ }
4037
+ /**
4038
+ * The **`StorageManager`** interface of the Storage API provides an interface for managing persistence permissions and estimating available storage. You can get a reference to this interface using either navigator.storage or WorkerNavigator.storage.
4039
+ * Available only in secure contexts.
4040
+ *
4041
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/StorageManager)
4042
+ */
4043
+ declare abstract class StorageManager {
3887
4044
  /**
3888
- * 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.
4045
+ * The **`getDirectory()`** method of the StorageManager interface is used to obtain a reference to a FileSystemDirectoryHandle object allowing access to a directory and its contents, stored in the origin private file system (OPFS).
3889
4046
  *
3890
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
4047
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/StorageManager/getDirectory)
3891
4048
  */
3892
- exec(
3893
- input?: string | URLPatternInit,
3894
- baseURL?: string,
3895
- ): URLPatternResult | null;
4049
+ getDirectory(): Promise<FileSystemDirectoryHandle>;
3896
4050
  }
3897
- interface URLPatternInit {
3898
- protocol?: string;
3899
- username?: string;
3900
- password?: string;
3901
- hostname?: string;
3902
- port?: string;
3903
- pathname?: string;
3904
- search?: string;
3905
- hash?: string;
3906
- baseURL?: string;
4051
+ interface FileSystemFileHandleFileSystemCreateWritableOptions {
4052
+ keepExistingData?: boolean;
3907
4053
  }
3908
- interface URLPatternComponentResult {
3909
- input: string;
3910
- groups: Record<string, string>;
4054
+ interface FileSystemDirectoryHandleFileSystemGetFileOptions {
4055
+ create: boolean;
3911
4056
  }
3912
- interface URLPatternResult {
3913
- inputs: (string | URLPatternInit)[];
3914
- protocol: URLPatternComponentResult;
3915
- username: URLPatternComponentResult;
3916
- password: URLPatternComponentResult;
3917
- hostname: URLPatternComponentResult;
3918
- port: URLPatternComponentResult;
3919
- pathname: URLPatternComponentResult;
3920
- search: URLPatternComponentResult;
3921
- hash: URLPatternComponentResult;
4057
+ interface FileSystemDirectoryHandleFileSystemGetDirectoryOptions {
4058
+ create: boolean;
3922
4059
  }
3923
- interface URLPatternOptions {
3924
- ignoreCase?: boolean;
4060
+ interface FileSystemDirectoryHandleFileSystemRemoveOptions {
4061
+ recursive: boolean;
4062
+ }
4063
+ interface FileSystemFileWriteParams {
4064
+ type: string;
4065
+ size?: number;
4066
+ position?: number;
4067
+ data?: (Blob | (ArrayBuffer | ArrayBufferView) | string) | null;
4068
+ }
4069
+ interface FileSystemHandleRemoveOptions {
4070
+ recursive?: boolean;
3925
4071
  }
3926
- type WebSocketEventMap = {
3927
- close: CloseEvent;
3928
- message: MessageEvent;
3929
- open: Event;
3930
- error: ErrorEvent;
3931
- };
3932
- /**
3933
- * 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.
3934
- *
3935
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3936
- */
3937
- declare var WebSocket: {
3938
- prototype: WebSocket;
3939
- new (url: string, protocols?: string[] | string): WebSocket;
3940
- readonly READY_STATE_CONNECTING: number;
3941
- readonly CONNECTING: number;
3942
- readonly READY_STATE_OPEN: number;
3943
- readonly OPEN: number;
3944
- readonly READY_STATE_CLOSING: number;
3945
- readonly CLOSING: number;
3946
- readonly READY_STATE_CLOSED: number;
3947
- readonly CLOSED: number;
3948
- };
3949
4072
  /**
3950
- * 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.
4073
+ * 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.
3951
4074
  *
3952
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
4075
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
3953
4076
  */
3954
- interface WebSocket extends EventTarget<WebSocketEventMap> {
3955
- accept(options?: WebSocketAcceptOptions): void;
3956
- /**
3957
- * 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.
3958
- *
3959
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
3960
- */
3961
- send(message: (ArrayBuffer | ArrayBufferView) | string): void;
3962
- /**
3963
- * The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
3964
- *
3965
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
3966
- */
3967
- close(code?: number, reason?: string): void;
3968
- serializeAttachment(attachment: any): void;
3969
- deserializeAttachment(): any | null;
4077
+ declare abstract class MessagePort extends EventTarget {
3970
4078
  /**
3971
- * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.
4079
+ * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
3972
4080
  *
3973
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
4081
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
3974
4082
  */
3975
- readyState: number;
4083
+ postMessage(
4084
+ data?: any,
4085
+ options?: any[] | MessagePortPostMessageOptions,
4086
+ ): void;
3976
4087
  /**
3977
- * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
4088
+ * 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.
3978
4089
  *
3979
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
4090
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
3980
4091
  */
3981
- url: string | null;
4092
+ close(): void;
3982
4093
  /**
3983
- * 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.
4094
+ * 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.
3984
4095
  *
3985
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
4096
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
3986
4097
  */
3987
- protocol: string | null;
4098
+ start(): void;
4099
+ get onmessage(): any | null;
4100
+ set onmessage(value: any | null);
4101
+ }
4102
+ /**
4103
+ * 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.
4104
+ *
4105
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
4106
+ */
4107
+ declare class MessageChannel {
4108
+ constructor();
3988
4109
  /**
3989
- * 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.
4110
+ * 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.
3990
4111
  *
3991
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
4112
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
3992
4113
  */
3993
- extensions: string | null;
4114
+ readonly port1: MessagePort;
3994
4115
  /**
3995
- * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.
4116
+ * 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.
3996
4117
  *
3997
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)
4118
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
3998
4119
  */
3999
- binaryType: "blob" | "arraybuffer";
4120
+ readonly port2: MessagePort;
4000
4121
  }
4001
- interface WebSocketAcceptOptions {
4002
- /**
4003
- * When set to `true`, receiving a server-initiated WebSocket Close frame will not
4004
- * automatically send a reciprocal Close frame, leaving the connection in a half-open
4005
- * state. This is useful for proxying scenarios where you need to coordinate closing
4006
- * both sides independently. Defaults to `false` when the
4007
- * `no_web_socket_half_open_by_default` compatibility flag is enabled.
4008
- */
4009
- allowHalfOpen?: boolean;
4122
+ interface MessagePortPostMessageOptions {
4123
+ transfer?: any[];
4010
4124
  }
4011
- declare const WebSocketPair: {
4012
- new (): {
4013
- 0: WebSocket;
4014
- 1: WebSocket;
4015
- };
4016
- };
4017
- interface SqlStorage {
4018
- exec<T extends Record<string, SqlStorageValue>>(
4019
- query: string,
4020
- ...bindings: any[]
4021
- ): SqlStorageCursor<T>;
4022
- prepare(query: string): SqlStorageStatement;
4023
- ingest(query: string): SqlStorageIngestResult;
4024
- setMaxPageCountForTest(count: number): void;
4025
- get databaseSize(): number;
4026
- Cursor: typeof SqlStorageCursor;
4027
- Statement: typeof SqlStorageStatement;
4028
- }
4029
- declare abstract class SqlStorageStatement {}
4030
- type SqlStorageValue = ArrayBuffer | string | number | null;
4031
- declare abstract class SqlStorageCursor<
4032
- T extends Record<string, SqlStorageValue>,
4033
- > {
4034
- next(): IteratorResult<T, undefined>;
4035
- toArray(): T[];
4036
- one(): T;
4037
- raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
4038
- columnNames: string[];
4039
- get rowsRead(): number;
4040
- get rowsWritten(): number;
4041
- get reusedCachedQueryForTest(): boolean;
4042
- [Symbol.iterator](): IterableIterator<T>;
4125
+ type LoopbackForExport<
4126
+ T extends
4127
+ | (new (...args: any[]) => Rpc.EntrypointBranded)
4128
+ | ExportedHandler<any, any, any>
4129
+ | undefined = undefined,
4130
+ > = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
4131
+ ? LoopbackServiceStub<InstanceType<T>>
4132
+ : T extends new (...args: any[]) => Rpc.DurableObjectBranded
4133
+ ? LoopbackDurableObjectClass<InstanceType<T>>
4134
+ : T extends new (
4135
+ ...args: any[]
4136
+ ) => CloudflareWorkersModule.WorkflowEntrypoint<any, infer Params>
4137
+ ? Workflow<Params>
4138
+ : T extends ExportedHandler<any, any, any>
4139
+ ? LoopbackServiceStub<undefined>
4140
+ : undefined;
4141
+ type LoopbackServiceStub<
4142
+ T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
4143
+ > = Fetcher<T> &
4144
+ (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props>
4145
+ ? (opts: {
4146
+ props?: Props;
4147
+ version?: {
4148
+ cohort?: string | null;
4149
+ };
4150
+ }) => Fetcher<T>
4151
+ : (opts: {
4152
+ props?: any;
4153
+ version?: {
4154
+ cohort?: string | null;
4155
+ };
4156
+ }) => Fetcher<T>);
4157
+ type LoopbackDurableObjectClass<
4158
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
4159
+ > = DurableObjectClass<T> &
4160
+ (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
4161
+ ? (opts: { props?: Props }) => DurableObjectClass<T>
4162
+ : (opts: { props?: any }) => DurableObjectClass<T>);
4163
+ interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
4164
+ interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
4165
+ interface SyncKvStorage {
4166
+ get<T = unknown>(key: string): T | undefined;
4167
+ list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
4168
+ put<T>(key: string, value: T): void;
4169
+ delete(key: string): boolean;
4043
4170
  }
4044
- interface SqlStorageIngestResult {
4045
- remainder: string;
4046
- rowsRead: number;
4047
- rowsWritten: number;
4048
- statementCount: number;
4171
+ interface SyncKvListOptions {
4172
+ start?: string;
4173
+ startAfter?: string;
4174
+ end?: string;
4175
+ prefix?: string;
4176
+ reverse?: boolean;
4177
+ limit?: number;
4049
4178
  }
4050
- interface Socket {
4051
- get readable(): ReadableStream;
4052
- get writable(): WritableStream;
4053
- get closed(): Promise<void>;
4054
- get opened(): Promise<SocketInfo>;
4055
- get upgraded(): boolean;
4056
- get secureTransport(): "on" | "off" | "starttls";
4057
- get protocol(): "tcp" | "udp";
4058
- close(): Promise<void>;
4059
- startTls(options?: TlsOptions): Socket;
4060
- proxyTo(sock: Socket, options?: StreamPipeOptions): Promise<void>;
4179
+ interface WorkerStub {
4180
+ getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(
4181
+ name?: string,
4182
+ options?: WorkerStubEntrypointOptions,
4183
+ ): Fetcher<T>;
4184
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
4185
+ name?: string,
4186
+ options?: WorkerStubEntrypointOptions,
4187
+ ): DurableObjectClass<T>;
4061
4188
  }
4062
- interface SocketOptions {
4063
- secureTransport?: string;
4064
- allowHalfOpen: boolean;
4065
- highWaterMark?: number | bigint;
4189
+ interface WorkerStubEntrypointOptions {
4190
+ props?: any;
4191
+ limits?: workerdResourceLimits;
4066
4192
  }
4067
- interface SocketAddress {
4068
- hostname: string;
4069
- port: number;
4193
+ interface WorkerLoader {
4194
+ get(
4195
+ name: string | null,
4196
+ getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>,
4197
+ ): WorkerStub;
4198
+ load(code: WorkerLoaderWorkerCode): WorkerStub;
4070
4199
  }
4071
- interface TlsOptions {
4072
- expectedServerHostname?: string;
4200
+ interface WorkerLoaderModule {
4201
+ js?: string;
4202
+ cjs?: string;
4203
+ text?: string;
4204
+ data?: ArrayBuffer;
4205
+ json?: any;
4206
+ py?: string;
4207
+ wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
4073
4208
  }
4074
- interface SocketInfo {
4075
- remoteAddress?: string;
4076
- localAddress?: string;
4209
+ interface WorkerLoaderWorkerCode {
4210
+ compatibilityDate: string;
4211
+ compatibilityFlags?: string[];
4212
+ allowExperimental?: boolean;
4213
+ limits?: workerdResourceLimits;
4214
+ mainModule: string;
4215
+ modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
4216
+ env?: any;
4217
+ globalOutbound?: Fetcher | null;
4218
+ tails?: Fetcher[];
4219
+ streamingTails?: Fetcher[];
4077
4220
  }
4078
- declare class Datagram {
4079
- constructor(data: Uint8Array);
4080
- get data(): Uint8Array;
4221
+ interface workerdResourceLimits {
4222
+ cpuMs?: number;
4223
+ subRequests?: number;
4081
4224
  }
4082
4225
  /**
4083
- * The **`EventSource`** interface is web content's interface to server-sent events.
4226
+ * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
4227
+ * as well as timing of subrequests and other operations.
4084
4228
  *
4085
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
4229
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
4086
4230
  */
4087
- declare class EventSource extends EventTarget {
4088
- constructor(url: string, init?: EventSourceEventSourceInit);
4231
+ declare abstract class Performance extends EventTarget {
4232
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
4233
+ get timeOrigin(): number;
4234
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
4235
+ now(): number;
4236
+ get eventCounts(): EventCounts;
4089
4237
  /**
4090
- * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).
4238
+ * The **`clearMarks()`** method removes all or specific PerformanceMark objects from the browser's performance timeline.
4091
4239
  *
4092
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
4240
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMarks)
4093
4241
  */
4094
- close(): void;
4242
+ clearMarks(name?: string): void;
4095
4243
  /**
4096
- * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
4244
+ * The **`clearMeasures()`** method removes all or specific PerformanceMeasure objects from the browser's performance timeline.
4097
4245
  *
4098
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
4246
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMeasures)
4099
4247
  */
4100
- get url(): string;
4248
+ clearMeasures(name?: string): void;
4101
4249
  /**
4102
- * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
4250
+ * The **`clearResourceTimings()`** method removes all performance entries with an entryType of "resource" from the browser's performance timeline and sets the size of the performance resource data buffer to zero.
4103
4251
  *
4104
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
4252
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearResourceTimings)
4105
4253
  */
4106
- get withCredentials(): boolean;
4254
+ clearResourceTimings(): void;
4107
4255
  /**
4108
- * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
4256
+ * The **`getEntries()`** method returns an array of all PerformanceEntry objects currently present in the performance timeline.
4109
4257
  *
4110
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
4258
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntries)
4111
4259
  */
4112
- get readyState(): number;
4113
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
4114
- get onopen(): any | null;
4115
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
4116
- set onopen(value: any | null);
4117
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
4118
- get onmessage(): any | null;
4119
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
4120
- set onmessage(value: any | null);
4121
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
4122
- get onerror(): any | null;
4123
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
4124
- set onerror(value: any | null);
4125
- static readonly CONNECTING: number;
4126
- static readonly OPEN: number;
4127
- static readonly CLOSED: number;
4128
- static from(stream: ReadableStream): EventSource;
4260
+ getEntries(): PerformanceEntry[];
4261
+ /**
4262
+ * The **`getEntriesByName()`** method returns an array of PerformanceEntry objects currently present in the performance timeline with the given name and type.
4263
+ *
4264
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByName)
4265
+ */
4266
+ getEntriesByName(name: string, type?: string): PerformanceEntry[];
4267
+ /**
4268
+ * The **`getEntriesByType()`** method returns an array of PerformanceEntry objects currently present in the performance timeline for a given type.
4269
+ *
4270
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByType)
4271
+ */
4272
+ getEntriesByType(type: string): PerformanceEntry[];
4273
+ /**
4274
+ * The **`mark()`** method creates a named PerformanceMark object representing a high resolution timestamp marker in the browser's performance timeline.
4275
+ *
4276
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/mark)
4277
+ */
4278
+ mark(name: string, options?: PerformanceMarkOptions): PerformanceMark;
4279
+ /**
4280
+ * The **`measure()`** method creates a named PerformanceMeasure object representing a time measurement between two marks in the browser's performance timeline.
4281
+ *
4282
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/measure)
4283
+ */
4284
+ measure(
4285
+ measureName: string,
4286
+ measureOptionsOrStartMark?: PerformanceMeasureOptions | string,
4287
+ maybeEndMark?: string,
4288
+ ): PerformanceMeasure;
4289
+ /**
4290
+ * The **`setResourceTimingBufferSize()`** method sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries.
4291
+ *
4292
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize)
4293
+ */
4294
+ setResourceTimingBufferSize(size: number): void;
4295
+ /**
4296
+ * The **`toJSON()`** method of the Performance interface is a serializer; it returns a JSON representation of the Performance object.
4297
+ *
4298
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
4299
+ */
4300
+ toJSON(): object;
4301
+ get nodeTiming(): PerformanceNodeTiming;
4302
+ eventLoopUtilization(): PerformanceEventLoopUtilization;
4303
+ markResourceTiming(): void;
4304
+ timerify(fn: () => void): () => void;
4129
4305
  }
4130
- interface EventSourceEventSourceInit {
4131
- withCredentials?: boolean;
4132
- fetcher?: Fetcher;
4306
+ interface PerformanceEventLoopUtilization {
4307
+ idle: number;
4308
+ active: number;
4309
+ utilization: number;
4133
4310
  }
4134
- interface ExecOutput {
4135
- readonly stdout: ArrayBuffer;
4136
- readonly stderr: ArrayBuffer;
4137
- readonly exitCode: number;
4138
- }
4139
- interface ContainerExecOptions {
4140
- cwd?: string;
4141
- env?: Record<string, string>;
4142
- user?: string;
4143
- signal?: AbortSignal;
4144
- pty?: boolean | ContainerExecPtyOptions;
4145
- stdin?: ReadableStream | "pipe";
4146
- stdout?: "pipe" | "ignore";
4147
- stderr?: "pipe" | "ignore" | "combined";
4148
- }
4149
- interface ContainerExecPtyOptions {
4150
- cols?: number;
4151
- rows?: number;
4152
- }
4153
- interface ExecProcess {
4154
- readonly stdin: WritableStream | null;
4155
- readonly stdout: ReadableStream | null;
4156
- readonly stderr: ReadableStream | null;
4157
- readonly pid: number;
4158
- readonly isPty: boolean;
4159
- readonly exitCode: Promise<number>;
4160
- output(): Promise<ExecOutput>;
4161
- kill(signal?: number): void;
4162
- resize(cols: number, rows: number): void;
4163
- }
4164
- interface Container {
4165
- get running(): boolean;
4166
- get images(): Record<string, string>;
4167
- start(options?: ContainerStartupOptions): void;
4168
- monitor(): Promise<void>;
4169
- destroy(error?: any): Promise<void>;
4170
- signal(signo: number): void;
4171
- getTcpPort(port: number): Fetcher;
4172
- setInactivityTimeout(durationMs: number | bigint): Promise<void>;
4173
- interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
4174
- interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
4175
- snapshotContainer(
4176
- options?: ContainerSnapshotOptions,
4177
- ): Promise<ContainerSnapshot>;
4178
- interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
4179
- exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;
4180
- inspect(): Promise<ContainerInfo | null>;
4181
- interceptOutboundTcp(addr: string, binding: Fetcher): Promise<void>;
4182
- snapshotDirectory(
4183
- options: ContainerDirectorySnapshotOptions,
4184
- ): Promise<ContainerDirectorySnapshot>;
4185
- setLabels(labels: Record<string, string>): Promise<void>;
4186
- }
4187
- interface ContainerDirectorySnapshot {
4188
- id: string;
4189
- size: number;
4190
- dir: string;
4191
- name?: string;
4192
- }
4193
- interface ContainerDirectorySnapshotOptions {
4194
- dir: string;
4195
- name?: string;
4311
+ interface PerformanceNodeTiming extends PerformanceEntry {
4312
+ readonly nodeStart: number;
4313
+ readonly v8Start: number;
4314
+ readonly bootstrapComplete: number;
4315
+ readonly environment: number;
4316
+ readonly loopStart: number;
4317
+ readonly loopExit: number;
4318
+ readonly idleTime: number;
4319
+ readonly uvMetricsInfo: UvMetricsInfo;
4320
+ toJSON(): object;
4196
4321
  }
4197
- type ContainerDirectorySnapshotRestoreParams =
4198
- | {
4199
- snapshot: ContainerDirectorySnapshot;
4200
- mountPoint?: string;
4201
- }
4202
- | {
4203
- snapshot?: undefined;
4204
- mountPoint: string;
4205
- };
4206
- interface ContainerSnapshot {
4207
- id: string;
4208
- size: number;
4209
- name?: string;
4322
+ interface UvMetricsInfo {
4323
+ loopCount: number;
4324
+ events: number;
4325
+ eventsWaiting: number;
4210
4326
  }
4211
- interface ContainerSnapshotRestoreParams {
4212
- id: string;
4327
+ /**
4328
+ * **`PerformanceMark`** is an interface for PerformanceEntry objects with an entryType of "mark".
4329
+ *
4330
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark)
4331
+ */
4332
+ declare class PerformanceMark extends PerformanceEntry {
4333
+ constructor(name: string, maybeOptions?: PerformanceMarkOptions);
4334
+ /**
4335
+ * The read-only **`detail`** property returns arbitrary metadata that was included in the mark upon construction (either when using performance.mark() or the PerformanceMark() constructor).
4336
+ *
4337
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark/detail)
4338
+ */
4339
+ get detail(): any;
4340
+ toJSON(): object;
4213
4341
  }
4214
- interface ContainerSnapshotOptions {
4215
- name?: string;
4342
+ /**
4343
+ * **`PerformanceMeasure`** is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline.
4344
+ *
4345
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure)
4346
+ */
4347
+ declare abstract class PerformanceMeasure extends PerformanceEntry {
4348
+ /**
4349
+ * The read-only **`detail`** property returns arbitrary metadata that was included in the mark upon construction (when using performance.measure().
4350
+ *
4351
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure/detail)
4352
+ */
4353
+ get detail(): any;
4354
+ toJSON(): object;
4216
4355
  }
4217
- type ContainerStartupOptions = {
4218
- entrypoint?: string[];
4219
- enableInternet?: boolean;
4220
- env?: Record<string, string>;
4221
- hardTimeout?: number | bigint;
4222
- instance?:
4223
- | "lite"
4224
- | "basic"
4225
- | "standard-1"
4226
- | "standard-2"
4227
- | "standard-3"
4228
- | "standard-4"
4229
- | ContainerStartResources;
4230
- labels?: Record<string, string>;
4231
- directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
4232
- } & (
4233
- | {
4234
- image: string;
4235
- containerSnapshot?: never;
4236
- }
4237
- | {
4238
- image?: never;
4239
- containerSnapshot?: ContainerSnapshotRestoreParams;
4240
- }
4241
- );
4242
- interface ContainerInfo {
4243
- labels: Record<string, string>;
4244
- image: string;
4356
+ interface PerformanceMarkOptions {
4357
+ detail?: any;
4358
+ startTime?: number;
4245
4359
  }
4246
- interface ContainerStartResources {
4247
- vcpu: number;
4248
- memoryMib: number;
4249
- diskMb: number;
4360
+ interface PerformanceMeasureOptions {
4361
+ detail?: any;
4362
+ start?: number;
4363
+ duration?: number;
4364
+ end?: number;
4250
4365
  }
4251
4366
  /**
4252
- * The **`FileSystemHandle`** interface of the File System API is an object which represents a file or directory entry. Multiple handles can represent the same entry. For the most part you do not work with FileSystemHandle directly but rather its child interfaces FileSystemFileHandle and FileSystemDirectoryHandle.
4253
- * Available only in secure contexts.
4367
+ * The **`PerformanceObserverEntryList`** interface is a list of performance events that were explicitly observed via the observe() method.
4254
4368
  *
4255
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle)
4369
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList)
4256
4370
  */
4257
- declare abstract class FileSystemHandle {
4371
+ declare abstract class PerformanceObserverEntryList {
4258
4372
  /**
4259
- * The **`kind`** read-only property of the FileSystemHandle interface returns the type of entry. This is 'file' if the associated entry is a file or 'directory'. It is used to distinguish files from directories when iterating over the contents of a directory.
4373
+ * The **`getEntries()`** method of the PerformanceObserverEntryList interface returns a list of explicitly observed performance entry objects. The list's members are determined by the set of entry types specified in the call to the observe() method. The list is available in the observer's callback function (as the first parameter in the callback).
4260
4374
  *
4261
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/kind)
4375
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntries)
4262
4376
  */
4263
- get kind(): string;
4377
+ getEntries(): PerformanceEntry[];
4264
4378
  /**
4265
- * The **`name`** read-only property of the FileSystemHandle interface returns the name of the entry represented by handle.
4379
+ * The **`getEntriesByType()`** method of the PerformanceObserverEntryList returns a list of explicitly observed performance entry objects for a given performance entry type. The list's members are determined by the set of entry types specified in the call to the observe() method. The list is available in the observer's callback function (as the first parameter in the callback).
4266
4380
  *
4267
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/name)
4381
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntriesByType)
4268
4382
  */
4269
- get name(): string;
4383
+ getEntriesByType(type: string): PerformanceEntry[];
4270
4384
  /**
4271
- * The **`isSameEntry()`** method of the FileSystemHandle interface compares two handles to see if the associated entries (either a file or directory) match.
4385
+ * The **`getEntriesByName()`** method of the PerformanceObserverEntryList interface returns a list of explicitly observed PerformanceEntry objects for a given name and entryType. The list's members are determined by the set of entry types specified in the call to the observe() method. The list is available in the observer's callback function (as the first parameter in the callback).
4272
4386
  *
4273
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/isSameEntry)
4387
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntriesByName)
4274
4388
  */
4275
- isSameEntry(other: FileSystemHandle): Promise<boolean>;
4276
- getUniqueId(): Promise<string>;
4277
- remove(options?: FileSystemHandleRemoveOptions): Promise<void>;
4389
+ getEntriesByName(name: string, type?: string): PerformanceEntry[];
4278
4390
  }
4279
4391
  /**
4280
- * The **`FileSystemFileHandle`** interface of the File System API represents a handle to a file system entry. The interface is accessed through the window.showOpenFilePicker() method.
4281
- * Available only in secure contexts.
4392
+ * The **`PerformanceEntry`** object encapsulates a single performance metric that is part of the browser's performance timeline.
4282
4393
  *
4283
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle)
4394
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry)
4284
4395
  */
4285
- declare abstract class FileSystemFileHandle extends FileSystemHandle {
4396
+ declare abstract class PerformanceEntry {
4286
4397
  /**
4287
- * The **`getFile()`** method of the FileSystemFileHandle interface returns a Promise which resolves to a File object representing the state on disk of the entry represented by the handle.
4398
+ * The read-only **`name`** property of the PerformanceEntry interface is a string representing the name for a performance entry. It acts as an identifier, but it does not have to be unique. The value depends on the subclass.
4288
4399
  *
4289
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/getFile)
4400
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/name)
4290
4401
  */
4291
- getFile(): Promise<File>;
4402
+ get name(): string;
4292
4403
  /**
4293
- * The **`createWritable()`** method of the FileSystemFileHandle interface creates a FileSystemWritableFileStream that can be used to write to a file. The method returns a Promise which resolves to this created stream.
4404
+ * The read-only **`entryType`** property returns a string representing the type of performance metric that this entry represents.
4294
4405
  *
4295
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/createWritable)
4406
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/entryType)
4296
4407
  */
4297
- createWritable(
4298
- options?: FileSystemFileHandleFileSystemCreateWritableOptions,
4299
- ): Promise<FileSystemWritableFileStream>;
4408
+ get entryType(): string;
4409
+ /**
4410
+ * The read-only **`startTime`** property returns the first timestamp recorded for this PerformanceEntry. The meaning of this property depends on the value of this entry's entryType.
4411
+ *
4412
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/startTime)
4413
+ */
4414
+ get startTime(): number;
4415
+ /**
4416
+ * The read-only **`duration`** property returns a timestamp that is the duration of the performance entry. The meaning of this property depends on the value of this entry's entryType.
4417
+ *
4418
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/duration)
4419
+ */
4420
+ get duration(): number;
4421
+ /**
4422
+ * The **`toJSON()`** method is a serializer; it returns a JSON representation of the PerformanceEntry object.
4423
+ *
4424
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/toJSON)
4425
+ */
4426
+ toJSON(): object;
4300
4427
  }
4301
4428
  /**
4302
- * The **`FileSystemDirectoryHandle`** interface of the File System API provides a handle to a file system directory.
4303
- * Available only in secure contexts.
4429
+ * The **`PerformanceResourceTiming`** interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script.
4304
4430
  *
4305
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle)
4431
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming)
4306
4432
  */
4307
- declare abstract class FileSystemDirectoryHandle extends FileSystemHandle {
4433
+ declare abstract class PerformanceResourceTiming extends PerformanceEntry {
4308
4434
  /**
4309
- * The **`getFileHandle()`** method of the FileSystemDirectoryHandle interface returns a FileSystemFileHandle for a file with the specified name, within the directory the method is called.
4435
+ * The **`connectEnd`** read-only property returns the timestamp immediately after the browser finishes establishing the connection to the server to retrieve the resource. The timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as TLS handshake and SOCKS authentication.
4310
4436
  *
4311
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getFileHandle)
4437
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/connectEnd)
4312
4438
  */
4313
- getFileHandle(
4314
- name: string,
4315
- options?: FileSystemDirectoryHandleFileSystemGetFileOptions,
4316
- ): Promise<FileSystemFileHandle>;
4439
+ get connectEnd(): number;
4317
4440
  /**
4318
- * The **`getDirectoryHandle()`** method of the FileSystemDirectoryHandle interface returns a FileSystemDirectoryHandle for a subdirectory with the specified name within the directory handle on which the method is called.
4441
+ * The **`connectStart`** read-only property returns the timestamp immediately before the user agent starts establishing the connection to the server to retrieve the resource.
4319
4442
  *
4320
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle)
4443
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/connectStart)
4321
4444
  */
4322
- getDirectoryHandle(
4323
- name: string,
4324
- options?: FileSystemDirectoryHandleFileSystemGetDirectoryOptions,
4325
- ): Promise<FileSystemDirectoryHandle>;
4445
+ get connectStart(): number;
4326
4446
  /**
4327
- * The **`removeEntry()`** method of the FileSystemDirectoryHandle interface attempts to remove an entry if the directory handle contains a file or directory called the name specified.
4447
+ * The **`decodedBodySize`** read-only property returns the size (in octets) received from the fetch (HTTP or cache) of the message body after removing any applied content encoding (like gzip or Brotli). If the resource is retrieved from an application cache or local resources, it returns the size of the payload after removing any applied content encoding.
4328
4448
  *
4329
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/removeEntry)
4449
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/decodedBodySize)
4330
4450
  */
4331
- removeEntry(
4332
- name: string,
4333
- options?: FileSystemDirectoryHandleFileSystemRemoveOptions,
4334
- ): Promise<void>;
4451
+ get decodedBodySize(): number;
4335
4452
  /**
4336
- * The **`resolve()`** method of the FileSystemDirectoryHandle interface returns an Array of directory names from the parent handle to the specified child entry, with the name of the child entry as the last array item.
4453
+ * The **`domainLookupEnd`** read-only property returns the timestamp immediately after the browser finishes the domain-name lookup for the resource.
4337
4454
  *
4338
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/resolve)
4455
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/domainLookupEnd)
4339
4456
  */
4340
- resolve(possibleDescendant: FileSystemHandle): Promise<string[]>;
4341
- entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
4342
- keys(): AsyncIterableIterator<string>;
4343
- values(): AsyncIterableIterator<FileSystemHandle>;
4344
- forEach(
4345
- callback: (
4346
- param0: string,
4347
- param1: FileSystemHandle,
4348
- param2: FileSystemDirectoryHandle,
4349
- ) => void,
4350
- thisArg?: any,
4351
- ): void;
4352
- [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
4353
- }
4354
- /**
4355
- * The **`FileSystemWritableFileStream`** interface of the File System API is a WritableStream object with additional convenience methods, which operates on a single file on disk. The interface is accessed through the FileSystemFileHandle.createWritable() method.
4356
- * Available only in secure contexts.
4357
- *
4358
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream)
4359
- */
4360
- declare abstract class FileSystemWritableFileStream extends WritableStream {
4457
+ get domainLookupEnd(): number;
4361
4458
  /**
4362
- * The **`write()`** method of the FileSystemWritableFileStream interface writes content into the file the method is called on, at the current file cursor offset.
4459
+ * The **`domainLookupStart`** read-only property returns the timestamp immediately before the browser starts the domain name lookup for the resource.
4363
4460
  *
4364
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/write)
4461
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/domainLookupStart)
4365
4462
  */
4366
- write(
4367
- data:
4368
- | Blob
4369
- | (ArrayBuffer | ArrayBufferView)
4370
- | string
4371
- | FileSystemFileWriteParams,
4372
- ): Promise<void>;
4463
+ get domainLookupStart(): number;
4373
4464
  /**
4374
- * The **`seek()`** method of the FileSystemWritableFileStream interface updates the current file cursor offset to the position (in bytes) specified when calling the method.
4465
+ * The **`encodedBodySize`** read-only property represents the size (in octets) received from the fetch (HTTP or cache) of the payload body before removing any applied content encodings (like gzip or Brotli). If the resource is retrieved from an application cache or a local resource, it must return the size of the payload body before removing any applied content encoding.
4375
4466
  *
4376
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/seek)
4467
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/encodedBodySize)
4377
4468
  */
4378
- seek(position: number): Promise<void>;
4469
+ get encodedBodySize(): number;
4379
4470
  /**
4380
- * The **`truncate()`** method of the FileSystemWritableFileStream interface resizes the file associated with the stream to the specified size in bytes.
4471
+ * The **`fetchStart`** read-only property represents a timestamp immediately before the browser starts to fetch the resource.
4381
4472
  *
4382
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/truncate)
4473
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/fetchStart)
4383
4474
  */
4384
- truncate(size: number): Promise<void>;
4385
- }
4386
- /**
4387
- * The **`StorageManager`** interface of the Storage API provides an interface for managing persistence permissions and estimating available storage. You can get a reference to this interface using either navigator.storage or WorkerNavigator.storage.
4388
- * Available only in secure contexts.
4389
- *
4390
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/StorageManager)
4391
- */
4392
- declare abstract class StorageManager {
4475
+ get fetchStart(): number;
4393
4476
  /**
4394
- * The **`getDirectory()`** method of the StorageManager interface is used to obtain a reference to a FileSystemDirectoryHandle object allowing access to a directory and its contents, stored in the origin private file system (OPFS).
4477
+ * The **`initiatorType`** read-only property is a string representing web platform feature that initiated the resource load.
4395
4478
  *
4396
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/StorageManager/getDirectory)
4479
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/initiatorType)
4397
4480
  */
4398
- getDirectory(): Promise<FileSystemDirectoryHandle>;
4399
- }
4400
- interface FileSystemFileHandleFileSystemCreateWritableOptions {
4401
- keepExistingData?: boolean;
4402
- }
4403
- interface FileSystemDirectoryHandleFileSystemGetFileOptions {
4404
- create: boolean;
4405
- }
4406
- interface FileSystemDirectoryHandleFileSystemGetDirectoryOptions {
4407
- create: boolean;
4408
- }
4409
- interface FileSystemDirectoryHandleFileSystemRemoveOptions {
4410
- recursive: boolean;
4411
- }
4412
- interface FileSystemFileWriteParams {
4413
- type: string;
4414
- size?: number;
4415
- position?: number;
4416
- data?: (Blob | (ArrayBuffer | ArrayBufferView) | string) | null;
4417
- }
4418
- interface FileSystemHandleRemoveOptions {
4419
- recursive?: boolean;
4420
- }
4421
- /**
4422
- * 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.
4423
- *
4424
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
4425
- */
4426
- declare abstract class MessagePort extends EventTarget {
4481
+ get initiatorType(): string;
4427
4482
  /**
4428
- * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
4483
+ * The **`nextHopProtocol`** read-only property is a string representing the network protocol used to fetch the resource, as identified by the ALPN Protocol ID (RFC7301).
4429
4484
  *
4430
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
4485
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/nextHopProtocol)
4431
4486
  */
4432
- postMessage(
4433
- data?: any,
4434
- options?: any[] | MessagePortPostMessageOptions,
4435
- ): void;
4487
+ get nextHopProtocol(): string;
4436
4488
  /**
4437
- * 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.
4489
+ * The **`redirectEnd`** read-only property returns a timestamp immediately after receiving the last byte of the response of the last redirect.
4438
4490
  *
4439
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
4491
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/redirectEnd)
4440
4492
  */
4441
- close(): void;
4493
+ get redirectEnd(): number;
4442
4494
  /**
4443
- * 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.
4495
+ * The **`redirectStart`** read-only property returns a timestamp representing the start time of the fetch which that initiates the redirect.
4444
4496
  *
4445
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
4497
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/redirectStart)
4446
4498
  */
4447
- start(): void;
4448
- get onmessage(): any | null;
4449
- set onmessage(value: any | null);
4499
+ get redirectStart(): number;
4500
+ /**
4501
+ * The **`requestStart`** read-only property returns a timestamp of the time immediately before the browser starts requesting the resource from the server, cache, or local resource. If the transport connection fails and the browser retries the request, the value returned will be the start of the retry request.
4502
+ *
4503
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/requestStart)
4504
+ */
4505
+ get requestStart(): number;
4506
+ /**
4507
+ * The **`responseEnd`** read-only property returns a timestamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first.
4508
+ *
4509
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseEnd)
4510
+ */
4511
+ get responseEnd(): number;
4512
+ /**
4513
+ * The **`responseStart`** read-only property returns a timestamp immediately after the browser receives the first byte of the response from the server, cache, or local resource.
4514
+ *
4515
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseStart)
4516
+ */
4517
+ get responseStart(): number;
4518
+ /**
4519
+ * The **`responseStatus`** read-only property represents the HTTP response status code returned when fetching the resource.
4520
+ *
4521
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseStatus)
4522
+ */
4523
+ get responseStatus(): number;
4524
+ /**
4525
+ * The **`secureConnectionStart`** read-only property returns a timestamp immediately before the browser starts the handshake process to secure the current connection. If a secure connection is not used, the property returns zero.
4526
+ *
4527
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/secureConnectionStart)
4528
+ */
4529
+ get secureConnectionStart(): number | undefined;
4530
+ /**
4531
+ * The **`transferSize`** read-only property represents the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body (as defined by RFC7230).
4532
+ *
4533
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/transferSize)
4534
+ */
4535
+ get transferSize(): number;
4536
+ /**
4537
+ * The **`workerStart`** read-only property of the PerformanceResourceTiming interface returns a DOMHighResTimeStamp immediately before dispatching the FetchEvent if a Service Worker thread is already running, or immediately before starting the Service Worker thread if it is not already running. If the resource is not intercepted by a Service Worker the property will always return 0.
4538
+ *
4539
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/workerStart)
4540
+ */
4541
+ get workerStart(): number;
4450
4542
  }
4451
4543
  /**
4452
- * 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.
4544
+ * The **`PerformanceObserver`** interface is used to observe performance measurement events and be notified of new performance entries as they are recorded in the browser's performance timeline.
4453
4545
  *
4454
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
4546
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver)
4455
4547
  */
4456
- declare class MessageChannel {
4457
- constructor();
4548
+ declare class PerformanceObserver {
4549
+ constructor(callback: any);
4458
4550
  /**
4459
- * 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.
4551
+ * The **`disconnect()`** method of the PerformanceObserver interface is used to stop the performance observer from receiving any performance entry events.
4460
4552
  *
4461
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
4553
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/disconnect)
4462
4554
  */
4463
- readonly port1: MessagePort;
4555
+ disconnect(): void;
4464
4556
  /**
4465
- * 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.
4557
+ * The **`observe()`** method of the PerformanceObserver interface is used to specify the set of performance entry types to observe.
4466
4558
  *
4467
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
4559
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/observe)
4468
4560
  */
4469
- readonly port2: MessagePort;
4470
- }
4471
- interface MessagePortPostMessageOptions {
4472
- transfer?: any[];
4561
+ observe(options?: PerformanceObserverObserveOptions): void;
4562
+ /**
4563
+ * The **`takeRecords()`** method of the PerformanceObserver interface returns the current list of PerformanceEntry objects stored in the performance observer, emptying it out.
4564
+ *
4565
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/takeRecords)
4566
+ */
4567
+ takeRecords(): PerformanceEntry[];
4568
+ readonly supportedEntryTypes: string[];
4473
4569
  }
4474
- type LoopbackForExport<
4475
- T extends
4476
- | (new (...args: any[]) => Rpc.EntrypointBranded)
4477
- | ExportedHandler<any, any, any>
4478
- | undefined = undefined,
4479
- > = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
4480
- ? LoopbackServiceStub<InstanceType<T>>
4481
- : T extends new (...args: any[]) => Rpc.DurableObjectBranded
4482
- ? LoopbackDurableObjectClass<InstanceType<T>>
4483
- : T extends new (
4484
- ...args: any[]
4485
- ) => CloudflareWorkersModule.WorkflowEntrypoint<any, infer Params>
4486
- ? Workflow<Params>
4487
- : T extends ExportedHandler<any, any, any>
4488
- ? LoopbackServiceStub<undefined>
4489
- : undefined;
4490
- type LoopbackServiceStub<
4491
- T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
4492
- > = Fetcher<T> &
4493
- (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props>
4494
- ? (opts: {
4495
- props?: Props;
4496
- version?: {
4497
- cohort?: string | null;
4498
- };
4499
- }) => Fetcher<T>
4500
- : (opts: {
4501
- props?: any;
4502
- version?: {
4503
- cohort?: string | null;
4504
- };
4505
- }) => Fetcher<T>);
4506
- type LoopbackDurableObjectClass<
4507
- T extends Rpc.DurableObjectBranded | undefined = undefined,
4508
- > = DurableObjectClass<T> &
4509
- (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
4510
- ? (opts: { props?: Props }) => DurableObjectClass<T>
4511
- : (opts: { props?: any }) => DurableObjectClass<T>);
4512
- interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
4513
- interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
4514
- interface SyncKvStorage {
4515
- get<T = unknown>(key: string): T | undefined;
4516
- list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
4517
- put<T>(key: string, value: T): void;
4518
- delete(key: string): boolean;
4570
+ interface PerformanceObserverObserveOptions {
4571
+ buffered?: boolean;
4572
+ durationThreshold?: number;
4573
+ entryTypes?: string[];
4574
+ type?: string;
4519
4575
  }
4520
- interface SyncKvListOptions {
4521
- start?: string;
4522
- startAfter?: string;
4523
- end?: string;
4524
- prefix?: string;
4525
- reverse?: boolean;
4526
- limit?: number;
4576
+ interface EventCounts {
4577
+ get size(): number;
4578
+ get(eventType: string): number | undefined;
4579
+ has(eventType: string): boolean;
4580
+ entries(): IterableIterator<string[]>;
4581
+ keys(): IterableIterator<string>;
4582
+ values(): IterableIterator<number>;
4583
+ forEach(
4584
+ param1: (param0: number, param1: string, param2: EventCounts) => void,
4585
+ param2?: any,
4586
+ ): void;
4587
+ [Symbol.iterator](): IterableIterator<string[]>;
4527
4588
  }
4528
- interface WorkerStub {
4529
- getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(
4530
- name?: string,
4531
- options?: WorkerStubEntrypointOptions,
4532
- ): Fetcher<T>;
4533
- getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
4534
- name?: string,
4535
- options?: WorkerStubEntrypointOptions,
4536
- ): DurableObjectClass<T>;
4537
- }
4538
- interface WorkerStubEntrypointOptions {
4539
- props?: any;
4540
- limits?: workerdResourceLimits;
4541
- }
4542
- interface WorkerLoader {
4543
- get(
4544
- name: string | null,
4545
- getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>,
4546
- ): WorkerStub;
4547
- load(code: WorkerLoaderWorkerCode): WorkerStub;
4589
+ interface Tracing {
4590
+ enterSpan<T, A extends unknown[]>(
4591
+ name: string,
4592
+ callback: (span: Span, ...args: A) => T,
4593
+ ...args: A
4594
+ ): T;
4595
+ startActiveSpan<T, A extends unknown[]>(
4596
+ name: string,
4597
+ callback: (span: Span, ...args: A) => T,
4598
+ ...args: A
4599
+ ): T;
4600
+ startSpan(name: string): Span;
4601
+ getActiveSpan(): Span | undefined;
4602
+ withActiveSpan<T, A extends unknown[]>(
4603
+ span: Span,
4604
+ callback: (...args: A) => T,
4605
+ ...args: A
4606
+ ): T;
4607
+ Span: typeof Span;
4548
4608
  }
4549
- interface WorkerLoaderModule {
4550
- js?: string;
4551
- cjs?: string;
4552
- text?: string;
4553
- data?: ArrayBuffer;
4554
- json?: any;
4555
- py?: string;
4556
- wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
4609
+ declare abstract class Span {
4610
+ get isTraced(): boolean;
4611
+ spanContext(): TracingSpanContext;
4612
+ setAttribute(key: string, value: boolean | number | string): this;
4613
+ setAttributes(
4614
+ attributes: Record<string, boolean | number | string | undefined>,
4615
+ ): this;
4616
+ recordException(
4617
+ exception:
4618
+ | string
4619
+ | {
4620
+ code: string | number;
4621
+ name?: string;
4622
+ message?: string;
4623
+ stack?: string;
4624
+ }
4625
+ | {
4626
+ code?: string | number;
4627
+ name: string;
4628
+ message?: string;
4629
+ stack?: string;
4630
+ }
4631
+ | {
4632
+ code?: string | number;
4633
+ name?: string;
4634
+ message: string;
4635
+ stack?: string;
4636
+ },
4637
+ ): void;
4638
+ updateName(name: string): this;
4639
+ setStatus(status: TracingSpanStatus): this;
4640
+ end(): void;
4557
4641
  }
4558
- interface WorkerLoaderWorkerCode {
4559
- compatibilityDate: string;
4560
- compatibilityFlags?: string[];
4561
- allowExperimental?: boolean;
4562
- limits?: workerdResourceLimits;
4563
- mainModule: string;
4564
- modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
4565
- env?: any;
4566
- globalOutbound?: Fetcher | null;
4567
- tails?: Fetcher[];
4568
- streamingTails?: Fetcher[];
4642
+ type TracingSpanStatusCode = "unset" | "ok" | "error";
4643
+ interface TracingSpanStatus {
4644
+ code: TracingSpanStatusCode;
4645
+ message?: string;
4569
4646
  }
4570
- interface workerdResourceLimits {
4571
- cpuMs?: number;
4572
- subRequests?: number;
4647
+ interface TracingSpanContext {
4648
+ traceId: string;
4649
+ spanId: string;
4650
+ traceFlags: number;
4573
4651
  }
4574
4652
  /**
4575
- * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
4576
- * as well as timing of subrequests and other operations.
4653
+ * Represents the identity of a user authenticated via Cloudflare Access.
4654
+ * This matches the result of calling /cdn-cgi/access/get-identity.
4577
4655
  *
4578
- * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
4656
+ * The exact structure of the returned object depends on the identity provider
4657
+ * configuration for the Access application. The fields below represent commonly
4658
+ * available properties, but additional provider-specific fields may be present.
4579
4659
  */
4580
- declare abstract class Performance extends EventTarget {
4581
- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
4582
- get timeOrigin(): number;
4583
- /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
4584
- now(): number;
4585
- get eventCounts(): EventCounts;
4586
- /**
4587
- * The **`clearMarks()`** method removes all or specific PerformanceMark objects from the browser's performance timeline.
4588
- *
4589
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMarks)
4590
- */
4591
- clearMarks(name?: string): void;
4592
- /**
4593
- * The **`clearMeasures()`** method removes all or specific PerformanceMeasure objects from the browser's performance timeline.
4594
- *
4595
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMeasures)
4596
- */
4597
- clearMeasures(name?: string): void;
4598
- /**
4599
- * The **`clearResourceTimings()`** method removes all performance entries with an entryType of "resource" from the browser's performance timeline and sets the size of the performance resource data buffer to zero.
4600
- *
4601
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearResourceTimings)
4602
- */
4603
- clearResourceTimings(): void;
4604
- /**
4605
- * The **`getEntries()`** method returns an array of all PerformanceEntry objects currently present in the performance timeline.
4606
- *
4607
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntries)
4608
- */
4609
- getEntries(): PerformanceEntry[];
4610
- /**
4611
- * The **`getEntriesByName()`** method returns an array of PerformanceEntry objects currently present in the performance timeline with the given name and type.
4612
- *
4613
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByName)
4614
- */
4615
- getEntriesByName(name: string, type?: string): PerformanceEntry[];
4616
- /**
4617
- * The **`getEntriesByType()`** method returns an array of PerformanceEntry objects currently present in the performance timeline for a given type.
4618
- *
4619
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByType)
4620
- */
4621
- getEntriesByType(type: string): PerformanceEntry[];
4622
- /**
4623
- * The **`mark()`** method creates a named PerformanceMark object representing a high resolution timestamp marker in the browser's performance timeline.
4624
- *
4625
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/mark)
4626
- */
4627
- mark(name: string, options?: PerformanceMarkOptions): PerformanceMark;
4628
- /**
4629
- * The **`measure()`** method creates a named PerformanceMeasure object representing a time measurement between two marks in the browser's performance timeline.
4630
- *
4631
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/measure)
4632
- */
4633
- measure(
4634
- measureName: string,
4635
- measureOptionsOrStartMark?: PerformanceMeasureOptions | string,
4636
- maybeEndMark?: string,
4637
- ): PerformanceMeasure;
4638
- /**
4639
- * The **`setResourceTimingBufferSize()`** method sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries.
4640
- *
4641
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize)
4642
- */
4643
- setResourceTimingBufferSize(size: number): void;
4644
- /**
4645
- * The **`toJSON()`** method of the Performance interface is a serializer; it returns a JSON representation of the Performance object.
4646
- *
4647
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
4648
- */
4649
- toJSON(): object;
4650
- get nodeTiming(): PerformanceNodeTiming;
4651
- eventLoopUtilization(): PerformanceEventLoopUtilization;
4652
- markResourceTiming(): void;
4653
- timerify(fn: () => void): () => void;
4660
+ interface CloudflareAccessIdentity extends Record<string, unknown> {
4661
+ /** The user's email address, if available from the identity provider. */
4662
+ email?: string;
4663
+ /** The user's display name. */
4664
+ name?: string;
4665
+ /** The user's unique identifier. */
4666
+ user_uuid?: string;
4667
+ /** The Cloudflare account ID. */
4668
+ account_id?: string;
4669
+ /** Login timestamp (Unix epoch seconds). */
4670
+ iat?: number;
4671
+ /** The user's IP address at authentication time. */
4672
+ ip?: string;
4673
+ /** Authentication methods used (e.g., "pwd"). */
4674
+ amr?: string[];
4675
+ /** Identity provider information. */
4676
+ idp?: {
4677
+ id: string;
4678
+ type: string;
4679
+ };
4680
+ /** Geographic information about where the user authenticated. */
4681
+ geo?: {
4682
+ country: string;
4683
+ };
4684
+ /** Group memberships from the identity provider. */
4685
+ groups?: Array<{
4686
+ id: string;
4687
+ name: string;
4688
+ email?: string;
4689
+ }>;
4690
+ /** Device posture check results, keyed by check ID. */
4691
+ devicePosture?: Record<string, unknown>;
4692
+ /** True if the user connected via Cloudflare WARP. */
4693
+ is_warp?: boolean;
4694
+ /** True if the user is authenticated via Cloudflare Gateway. */
4695
+ is_gateway?: boolean;
4654
4696
  }
4655
- interface PerformanceEventLoopUtilization {
4656
- idle: number;
4657
- active: number;
4658
- utilization: number;
4697
+ // ============================================================================
4698
+ // Agent Memory
4699
+ //
4700
+ // Public type surface for user Workers binding to an Agent Memory namespace.
4701
+ // ============================================================================
4702
+ /** Memory type — every memory is classified into exactly one. */
4703
+ type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";
4704
+ /** Search intensity for recall. */
4705
+ type AgentMemoryThinkingLevel = "low" | "medium" | "high";
4706
+ /** Response verbosity for recall. */
4707
+ type AgentMemoryResponseLength = "short" | "medium" | "long";
4708
+ /** A conversation message passed to ingest(). */
4709
+ interface AgentMemoryMessage {
4710
+ role: "system" | "user" | "assistant";
4711
+ content: string;
4712
+ /** Optional message timestamp. */
4713
+ timestamp?: Date;
4659
4714
  }
4660
- interface PerformanceNodeTiming extends PerformanceEntry {
4661
- readonly nodeStart: number;
4662
- readonly v8Start: number;
4663
- readonly bootstrapComplete: number;
4664
- readonly environment: number;
4665
- readonly loopStart: number;
4666
- readonly loopExit: number;
4667
- readonly idleTime: number;
4668
- readonly uvMetricsInfo: UvMetricsInfo;
4669
- toJSON(): object;
4715
+ /** Raw memory content passed to remember(). */
4716
+ interface AgentMemoryIncomingMemory {
4717
+ /** Raw memory content. The service classifies and summarizes automatically. */
4718
+ content: string;
4719
+ /** Optional session identifier to associate with this memory. */
4720
+ sessionId?: string | null | undefined;
4670
4721
  }
4671
- interface UvMetricsInfo {
4672
- loopCount: number;
4673
- events: number;
4674
- eventsWaiting: number;
4722
+ /** A stored memory returned from remember(), get(), and delete(). */
4723
+ interface AgentMemoryMemory {
4724
+ /** Memory ID. */
4725
+ id: string;
4726
+ /** Memory type. */
4727
+ type: AgentMemoryMemoryType;
4728
+ /** Text summary. */
4729
+ summary: string;
4730
+ /** Memory text. */
4731
+ content: string;
4732
+ /** Session that created this memory. */
4733
+ sessionId: string | null;
4734
+ /** Memory creation time. */
4735
+ createdAt: Date;
4736
+ /** Memory last-update time. */
4737
+ updatedAt: Date;
4738
+ }
4739
+ /** Single entry in a list() response. Same shape as Memory minus full content. */
4740
+ type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;
4741
+ /** A scored memory candidate in a recall result. */
4742
+ interface AgentMemoryScoredCandidate {
4743
+ /** Candidate ID. */
4744
+ id: string;
4745
+ /** Text summary. */
4746
+ summary: string;
4747
+ /** Session that created this candidate, when known. */
4748
+ sessionId: string | null;
4749
+ /** Relevance score (higher is better). Comparable only within a single query. */
4750
+ score: number;
4751
+ }
4752
+ /** Options for the ingest() method. */
4753
+ interface AgentMemoryIngestOptions {
4754
+ /** Session identifier to associate with memories created during ingestion. */
4755
+ sessionId?: string | null | undefined;
4756
+ }
4757
+ /** Options for the getSummary() method. */
4758
+ interface AgentMemoryGetSummaryOptions {
4759
+ /** Session identifier to retrieve session summary for. */
4760
+ sessionId?: string | null | undefined;
4761
+ }
4762
+ /** Response from the getSummary() method. */
4763
+ interface AgentMemoryGetSummaryResponse {
4764
+ /** Markdown summary. */
4765
+ summary: string;
4675
4766
  }
4676
4767
  /**
4677
- * **`PerformanceMark`** is an interface for PerformanceEntry objects with an entryType of "mark".
4768
+ * Options for the recall() method.
4678
4769
  *
4679
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark)
4770
+ * `referenceDate` accepts a Date object, an ISO-8601 date string
4771
+ * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this
4772
+ * date is used as "today" for resolving relative time references
4773
+ * ("how many days ago", "last week") instead of the server's wall-clock time.
4680
4774
  */
4681
- declare class PerformanceMark extends PerformanceEntry {
4682
- constructor(name: string, maybeOptions?: PerformanceMarkOptions);
4683
- /**
4684
- * The read-only **`detail`** property returns arbitrary metadata that was included in the mark upon construction (either when using performance.mark() or the PerformanceMark() constructor).
4685
- *
4686
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark/detail)
4687
- */
4688
- get detail(): any;
4689
- toJSON(): object;
4775
+ interface AgentMemoryRecallOptions {
4776
+ /** Recall intensity: "low" (default), "medium", or "high". */
4777
+ thinkingLevel?: AgentMemoryThinkingLevel;
4778
+ /** Response verbosity: "short", "medium" (default), or "long". */
4779
+ responseLength?: AgentMemoryResponseLength;
4780
+ /** Temporal anchor for date arithmetic. */
4781
+ referenceDate?: Date | string;
4782
+ }
4783
+ /** Response from the recall() method. */
4784
+ interface AgentMemoryRecallResult {
4785
+ /** Number of memories retrieved. */
4786
+ count: number;
4787
+ /** LLM-generated answer synthesizing the matching memories. */
4788
+ answer: string;
4789
+ /** Matching memories ranked by relevance. */
4790
+ candidates: AgentMemoryScoredCandidate[];
4690
4791
  }
4691
4792
  /**
4692
- * **`PerformanceMeasure`** is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline.
4793
+ * Options for the list() method.
4693
4794
  *
4694
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure)
4795
+ * `cursor` is the opaque continuation token returned by the previous page;
4796
+ * pass it back unchanged to fetch the next page. `sessionId` and `type`
4797
+ * are exact-match filters; combining them is allowed.
4695
4798
  */
4696
- declare abstract class PerformanceMeasure extends PerformanceEntry {
4697
- /**
4698
- * The read-only **`detail`** property returns arbitrary metadata that was included in the mark upon construction (when using performance.measure().
4699
- *
4700
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure/detail)
4701
- */
4702
- get detail(): any;
4703
- toJSON(): object;
4704
- }
4705
- interface PerformanceMarkOptions {
4706
- detail?: any;
4707
- startTime?: number;
4799
+ interface AgentMemoryListMemoriesOptions {
4800
+ /** Maximum number of memories to return. Default 20, max 500. */
4801
+ limit?: number;
4802
+ /** Opaque cursor from a previous page. */
4803
+ cursor?: string;
4804
+ /** Exact-match session filter. */
4805
+ sessionId?: string;
4806
+ /** Exact-match memory-type filter. */
4807
+ type?: AgentMemoryMemoryType;
4708
4808
  }
4709
- interface PerformanceMeasureOptions {
4710
- detail?: any;
4711
- start?: number;
4712
- duration?: number;
4713
- end?: number;
4809
+ /** Response from the list() method. */
4810
+ interface AgentMemoryListMemoriesResult {
4811
+ memories: AgentMemoryMemoryListEntry[];
4812
+ /** Continuation cursor; absent when this page exhausted the result set. */
4813
+ cursor?: string;
4714
4814
  }
4715
4815
  /**
4716
- * The **`PerformanceObserverEntryList`** interface is a list of performance events that were explicitly observed via the observe() method.
4816
+ * A single Agent Memory profile, scoped to a profile name.
4717
4817
  *
4718
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList)
4818
+ * Returned by {@link AgentMemoryNamespace.getProfile}.
4719
4819
  */
4720
- declare abstract class PerformanceObserverEntryList {
4820
+ declare abstract class AgentMemoryProfile {
4721
4821
  /**
4722
- * The **`getEntries()`** method of the PerformanceObserverEntryList interface returns a list of explicitly observed performance entry objects. The list's members are determined by the set of entry types specified in the call to the observe() method. The list is available in the observer's callback function (as the first parameter in the callback).
4822
+ * Retrieve a memory by ID.
4723
4823
  *
4724
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntries)
4824
+ * @param memoryId - ULID of the memory to retrieve.
4825
+ * @throws if the memory does not exist.
4725
4826
  */
4726
- getEntries(): PerformanceEntry[];
4827
+ get(memoryId: string): Promise<AgentMemoryMemory>;
4727
4828
  /**
4728
- * The **`getEntriesByType()`** method of the PerformanceObserverEntryList returns a list of explicitly observed performance entry objects for a given performance entry type. The list's members are determined by the set of entry types specified in the call to the observe() method. The list is available in the observer's callback function (as the first parameter in the callback).
4829
+ * Delete a memory by ID.
4729
4830
  *
4730
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntriesByType)
4831
+ * Removes the memory and any source messages linked by the memory's
4832
+ * source message IDs.
4833
+ *
4834
+ * @param memoryId - ULID of the memory to delete.
4835
+ * @throws if the memory does not exist.
4731
4836
  */
4732
- getEntriesByType(type: string): PerformanceEntry[];
4837
+ delete(memoryId: string): Promise<AgentMemoryMemory>;
4733
4838
  /**
4734
- * The **`getEntriesByName()`** method of the PerformanceObserverEntryList interface returns a list of explicitly observed PerformanceEntry objects for a given name and entryType. The list's members are determined by the set of entry types specified in the call to the observe() method. The list is available in the observer's callback function (as the first parameter in the callback).
4839
+ * Store a memory in this profile. The content is automatically classified,
4840
+ * summarized, and indexed.
4735
4841
  *
4736
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserverEntryList/getEntriesByName)
4842
+ * @param memory - Raw memory content to persist.
4737
4843
  */
4738
- getEntriesByName(name: string, type?: string): PerformanceEntry[];
4739
- }
4740
- /**
4741
- * The **`PerformanceEntry`** object encapsulates a single performance metric that is part of the browser's performance timeline.
4742
- *
4743
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry)
4744
- */
4745
- declare abstract class PerformanceEntry {
4844
+ remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;
4746
4845
  /**
4747
- * The read-only **`name`** property of the PerformanceEntry interface is a string representing the name for a performance entry. It acts as an identifier, but it does not have to be unique. The value depends on the subclass.
4846
+ * Extract memories from a conversation.
4748
4847
  *
4749
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/name)
4848
+ * @param messages - Conversation messages to extract memories from.
4849
+ * @param options - Optional ingest options.
4750
4850
  */
4751
- get name(): string;
4851
+ ingest(
4852
+ messages: Iterable<AgentMemoryMessage>,
4853
+ options?: AgentMemoryIngestOptions,
4854
+ ): Promise<void>;
4752
4855
  /**
4753
- * The read-only **`entryType`** property returns a string representing the type of performance metric that this entry represents.
4856
+ * Get a profile summary.
4754
4857
  *
4755
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/entryType)
4858
+ * @param options - Optional getSummary options.
4756
4859
  */
4757
- get entryType(): string;
4860
+ getSummary(
4861
+ options?: AgentMemoryGetSummaryOptions,
4862
+ ): Promise<AgentMemoryGetSummaryResponse>;
4758
4863
  /**
4759
- * The read-only **`startTime`** property returns the first timestamp recorded for this PerformanceEntry. The meaning of this property depends on the value of this entry's entryType.
4864
+ * Recall memories in this profile.
4760
4865
  *
4761
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/startTime)
4866
+ * @param query - Recall query matched against memory content and keywords.
4867
+ * @param options - Optional recall parameters.
4868
+ * @returns Matching memories with relevance scores and a synthesized answer.
4762
4869
  */
4763
- get startTime(): number;
4870
+ recall(
4871
+ query: string,
4872
+ options?: AgentMemoryRecallOptions,
4873
+ ): Promise<AgentMemoryRecallResult>;
4764
4874
  /**
4765
- * The read-only **`duration`** property returns a timestamp that is the duration of the performance entry. The meaning of this property depends on the value of this entry's entryType.
4875
+ * List active memories in this profile.
4766
4876
  *
4767
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/duration)
4877
+ * Returns a paginated, filterable view of stored memories. Superseded
4878
+ * versions are excluded. Use the returned `cursor` (when present) to
4879
+ * fetch the next page.
4880
+ *
4881
+ * @param options - Optional pagination and filter options.
4768
4882
  */
4769
- get duration(): number;
4883
+ list(
4884
+ options?: AgentMemoryListMemoriesOptions,
4885
+ ): Promise<AgentMemoryListMemoriesResult>;
4770
4886
  /**
4771
- * The **`toJSON()`** method is a serializer; it returns a JSON representation of the PerformanceEntry object.
4887
+ * Soft-delete every memory and message in this profile that is tagged
4888
+ * with `sessionId`.
4772
4889
  *
4773
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/toJSON)
4890
+ * Idempotent: deleting a sessionId that has no rows is a no-op.
4891
+ *
4892
+ * @param sessionId - Session to delete.
4774
4893
  */
4775
- toJSON(): object;
4894
+ deleteSession(sessionId: string): Promise<void>;
4776
4895
  }
4777
4896
  /**
4778
- * The **`PerformanceResourceTiming`** interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script.
4897
+ * Namespace-level Agent Memory binding.
4779
4898
  *
4780
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming)
4899
+ * Used as the type of an `env.MEMORY`-style binding backed by the Agent
4900
+ * Memory product.
4901
+ *
4902
+ * @example
4903
+ * ```ts
4904
+ * export default {
4905
+ * async fetch(_request: Request, env: Env): Promise<Response> {
4906
+ * const profile = await env.MEMORY.getProfile("wrangler-e2e");
4907
+ * const summary = await profile.getSummary();
4908
+ * return Response.json(summary);
4909
+ * },
4910
+ * };
4911
+ * ```
4781
4912
  */
4782
- declare abstract class PerformanceResourceTiming extends PerformanceEntry {
4783
- /**
4784
- * The **`connectEnd`** read-only property returns the timestamp immediately after the browser finishes establishing the connection to the server to retrieve the resource. The timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as TLS handshake and SOCKS authentication.
4785
- *
4786
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/connectEnd)
4787
- */
4788
- get connectEnd(): number;
4789
- /**
4790
- * The **`connectStart`** read-only property returns the timestamp immediately before the user agent starts establishing the connection to the server to retrieve the resource.
4791
- *
4792
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/connectStart)
4793
- */
4794
- get connectStart(): number;
4795
- /**
4796
- * The **`decodedBodySize`** read-only property returns the size (in octets) received from the fetch (HTTP or cache) of the message body after removing any applied content encoding (like gzip or Brotli). If the resource is retrieved from an application cache or local resources, it returns the size of the payload after removing any applied content encoding.
4797
- *
4798
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/decodedBodySize)
4799
- */
4800
- get decodedBodySize(): number;
4913
+ declare abstract class AgentMemoryNamespace {
4801
4914
  /**
4802
- * The **`domainLookupEnd`** read-only property returns the timestamp immediately after the browser finishes the domain-name lookup for the resource.
4915
+ * Get a memory profile by name. Profiles are isolated by namespace and
4916
+ * addressed by a compound key (namespaceId:profileName).
4803
4917
  *
4804
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/domainLookupEnd)
4918
+ * @param profileName - Profile name (validated against naming rules).
4919
+ * @returns RPC target for interacting with the profile.
4805
4920
  */
4806
- get domainLookupEnd(): number;
4921
+ getProfile(profileName: string): Promise<AgentMemoryProfile>;
4807
4922
  /**
4808
- * The **`domainLookupStart`** read-only property returns the timestamp immediately before the browser starts the domain name lookup for the resource.
4923
+ * Soft-delete a profile and schedule deferred purge. Marks all
4924
+ * memories and messages as deleted.
4809
4925
  *
4810
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/domainLookupStart)
4926
+ * @param profileName - Name of the profile to delete.
4811
4927
  */
4812
- get domainLookupStart(): number;
4813
- /**
4814
- * The **`encodedBodySize`** read-only property represents the size (in octets) received from the fetch (HTTP or cache) of the payload body before removing any applied content encodings (like gzip or Brotli). If the resource is retrieved from an application cache or a local resource, it must return the size of the payload body before removing any applied content encoding.
4815
- *
4816
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/encodedBodySize)
4817
- */
4818
- get encodedBodySize(): number;
4819
- /**
4820
- * The **`fetchStart`** read-only property represents a timestamp immediately before the browser starts to fetch the resource.
4821
- *
4822
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/fetchStart)
4823
- */
4824
- get fetchStart(): number;
4825
- /**
4826
- * The **`initiatorType`** read-only property is a string representing web platform feature that initiated the resource load.
4827
- *
4828
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/initiatorType)
4829
- */
4830
- get initiatorType(): string;
4831
- /**
4832
- * The **`nextHopProtocol`** read-only property is a string representing the network protocol used to fetch the resource, as identified by the ALPN Protocol ID (RFC7301).
4833
- *
4834
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/nextHopProtocol)
4835
- */
4836
- get nextHopProtocol(): string;
4837
- /**
4838
- * The **`redirectEnd`** read-only property returns a timestamp immediately after receiving the last byte of the response of the last redirect.
4839
- *
4840
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/redirectEnd)
4841
- */
4842
- get redirectEnd(): number;
4843
- /**
4844
- * The **`redirectStart`** read-only property returns a timestamp representing the start time of the fetch which that initiates the redirect.
4845
- *
4846
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/redirectStart)
4847
- */
4848
- get redirectStart(): number;
4849
- /**
4850
- * The **`requestStart`** read-only property returns a timestamp of the time immediately before the browser starts requesting the resource from the server, cache, or local resource. If the transport connection fails and the browser retries the request, the value returned will be the start of the retry request.
4851
- *
4852
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/requestStart)
4853
- */
4854
- get requestStart(): number;
4855
- /**
4856
- * The **`responseEnd`** read-only property returns a timestamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first.
4857
- *
4858
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseEnd)
4859
- */
4860
- get responseEnd(): number;
4861
- /**
4862
- * The **`responseStart`** read-only property returns a timestamp immediately after the browser receives the first byte of the response from the server, cache, or local resource.
4863
- *
4864
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseStart)
4865
- */
4866
- get responseStart(): number;
4867
- /**
4868
- * The **`responseStatus`** read-only property represents the HTTP response status code returned when fetching the resource.
4869
- *
4870
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/responseStatus)
4871
- */
4872
- get responseStatus(): number;
4873
- /**
4874
- * The **`secureConnectionStart`** read-only property returns a timestamp immediately before the browser starts the handshake process to secure the current connection. If a secure connection is not used, the property returns zero.
4875
- *
4876
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/secureConnectionStart)
4877
- */
4878
- get secureConnectionStart(): number | undefined;
4879
- /**
4880
- * The **`transferSize`** read-only property represents the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body (as defined by RFC7230).
4881
- *
4882
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/transferSize)
4883
- */
4884
- get transferSize(): number;
4885
- /**
4886
- * The **`workerStart`** read-only property of the PerformanceResourceTiming interface returns a DOMHighResTimeStamp immediately before dispatching the FetchEvent if a Service Worker thread is already running, or immediately before starting the Service Worker thread if it is not already running. If the resource is not intercepted by a Service Worker the property will always return 0.
4887
- *
4888
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/workerStart)
4889
- */
4890
- get workerStart(): number;
4891
- }
4892
- /**
4893
- * The **`PerformanceObserver`** interface is used to observe performance measurement events and be notified of new performance entries as they are recorded in the browser's performance timeline.
4894
- *
4895
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver)
4896
- */
4897
- declare class PerformanceObserver {
4898
- constructor(callback: any);
4899
- /**
4900
- * The **`disconnect()`** method of the PerformanceObserver interface is used to stop the performance observer from receiving any performance entry events.
4901
- *
4902
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/disconnect)
4903
- */
4904
- disconnect(): void;
4905
- /**
4906
- * The **`observe()`** method of the PerformanceObserver interface is used to specify the set of performance entry types to observe.
4907
- *
4908
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/observe)
4909
- */
4910
- observe(options?: PerformanceObserverObserveOptions): void;
4911
- /**
4912
- * The **`takeRecords()`** method of the PerformanceObserver interface returns the current list of PerformanceEntry objects stored in the performance observer, emptying it out.
4913
- *
4914
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/takeRecords)
4915
- */
4916
- takeRecords(): PerformanceEntry[];
4917
- readonly supportedEntryTypes: string[];
4918
- }
4919
- interface PerformanceObserverObserveOptions {
4920
- buffered?: boolean;
4921
- durationThreshold?: number;
4922
- entryTypes?: string[];
4923
- type?: string;
4924
- }
4925
- interface EventCounts {
4926
- get size(): number;
4927
- get(eventType: string): number | undefined;
4928
- has(eventType: string): boolean;
4929
- entries(): IterableIterator<string[]>;
4930
- keys(): IterableIterator<string>;
4931
- values(): IterableIterator<number>;
4932
- forEach(
4933
- param1: (param0: number, param1: string, param2: EventCounts) => void,
4934
- param2?: any,
4935
- ): void;
4936
- [Symbol.iterator](): IterableIterator<string[]>;
4937
- }
4938
- interface Tracing {
4939
- enterSpan<T, A extends unknown[]>(
4940
- name: string,
4941
- callback: (span: Span, ...args: A) => T,
4942
- ...args: A
4943
- ): T;
4944
- startActiveSpan<T, A extends unknown[]>(
4945
- name: string,
4946
- callback: (span: Span, ...args: A) => T,
4947
- ...args: A
4948
- ): T;
4949
- startSpan(name: string): Span;
4950
- getActiveSpan(): Span | undefined;
4951
- withActiveSpan<T, A extends unknown[]>(
4952
- span: Span,
4953
- callback: (...args: A) => T,
4954
- ...args: A
4955
- ): T;
4956
- Span: typeof Span;
4957
- }
4958
- declare abstract class Span {
4959
- get isTraced(): boolean;
4960
- spanContext(): TracingSpanContext;
4961
- setAttribute(key: string, value: boolean | number | string): this;
4962
- setAttributes(
4963
- attributes: Record<string, boolean | number | string | undefined>,
4964
- ): this;
4965
- recordException(
4966
- exception:
4967
- | string
4968
- | {
4969
- code: string | number;
4970
- name?: string;
4971
- message?: string;
4972
- stack?: string;
4973
- }
4974
- | {
4975
- code?: string | number;
4976
- name: string;
4977
- message?: string;
4978
- stack?: string;
4979
- }
4980
- | {
4981
- code?: string | number;
4982
- name?: string;
4983
- message: string;
4984
- stack?: string;
4985
- },
4986
- ): void;
4987
- updateName(name: string): this;
4988
- setStatus(status: TracingSpanStatus): this;
4989
- end(): void;
4990
- }
4991
- type TracingSpanStatusCode = "unset" | "ok" | "error";
4992
- interface TracingSpanStatus {
4993
- code: TracingSpanStatusCode;
4994
- message?: string;
4995
- }
4996
- interface TracingSpanContext {
4997
- traceId: string;
4998
- spanId: string;
4999
- traceFlags: number;
4928
+ deleteProfile(profileName: string): Promise<void>;
5000
4929
  }
4930
+ // ============ AI Search Error Interfaces ============
4931
+ interface AiSearchInternalError extends Error {}
4932
+ interface AiSearchNotFoundError extends Error {}
4933
+ // ============ AI Search Common Types ============
4934
+ /** A single message in a conversation-style search or chat request. */
4935
+ type AiSearchMessage = {
4936
+ role: "system" | "developer" | "user" | "assistant" | "tool";
4937
+ content: string | null;
4938
+ };
5001
4939
  /**
5002
- * Represents the identity of a user authenticated via Cloudflare Access.
5003
- * This matches the result of calling /cdn-cgi/access/get-identity.
5004
- *
5005
- * The exact structure of the returned object depends on the identity provider
5006
- * configuration for the Access application. The fields below represent commonly
5007
- * available properties, but additional provider-specific fields may be present.
4940
+ * Common shape for `ai_search_options` used by both single-instance and multi-instance requests.
4941
+ * Contains retrieval, query rewrite, reranking, and cache sub-options.
5008
4942
  */
5009
- interface CloudflareAccessIdentity extends Record<string, unknown> {
5010
- /** The user's email address, if available from the identity provider. */
5011
- email?: string;
5012
- /** The user's display name. */
5013
- name?: string;
5014
- /** The user's unique identifier. */
5015
- user_uuid?: string;
5016
- /** The Cloudflare account ID. */
5017
- account_id?: string;
5018
- /** Login timestamp (Unix epoch seconds). */
5019
- iat?: number;
5020
- /** The user's IP address at authentication time. */
5021
- ip?: string;
5022
- /** Authentication methods used (e.g., "pwd"). */
5023
- amr?: string[];
5024
- /** Identity provider information. */
5025
- idp?: {
5026
- id: string;
5027
- type: string;
4943
+ type AiSearchOptions = {
4944
+ retrieval?: {
4945
+ /** Which retrieval backend to use. Defaults to the instance's configured index_method. */
4946
+ retrieval_type?: "vector" | "keyword" | "hybrid";
4947
+ /** Fusion method for combining vector + keyword results. */
4948
+ fusion_method?: "max" | "rrf";
4949
+ /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */
4950
+ keyword_match_mode?: "and" | "or";
4951
+ /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */
4952
+ match_threshold?: number;
4953
+ /** Maximum number of results to return (1-50). Default 10. */
4954
+ max_num_results?: number;
4955
+ /** Vectorize metadata filters applied to the search. */
4956
+ filters?: VectorizeVectorMetadataFilter;
4957
+ /** Number of surrounding chunks to include for context (0-3). Default 0. */
4958
+ context_expansion?: number;
4959
+ /** If true, return only item metadata without chunk text. */
4960
+ metadata_only?: boolean;
4961
+ /** If true (default), return empty results on retrieval failure instead of throwing. */
4962
+ return_on_failure?: boolean;
4963
+ /** Boost results by metadata field values. Max 3 entries. */
4964
+ boost_by?: Array<{
4965
+ field: string;
4966
+ direction?: "asc" | "desc" | "exists" | "not_exists";
4967
+ }>;
4968
+ [key: string]: unknown;
5028
4969
  };
5029
- /** Geographic information about where the user authenticated. */
5030
- geo?: {
5031
- country: string;
4970
+ query_rewrite?: {
4971
+ enabled?: boolean;
4972
+ model?: string;
4973
+ rewrite_prompt?: string;
4974
+ [key: string]: unknown;
5032
4975
  };
5033
- /** Group memberships from the identity provider. */
5034
- groups?: Array<{
5035
- id: string;
5036
- name: string;
5037
- email?: string;
5038
- }>;
5039
- /** Device posture check results, keyed by check ID. */
5040
- devicePosture?: Record<string, unknown>;
5041
- /** True if the user connected via Cloudflare WARP. */
5042
- is_warp?: boolean;
5043
- /** True if the user is authenticated via Cloudflare Gateway. */
5044
- is_gateway?: boolean;
5045
- }
5046
- // ============================================================================
5047
- // Agent Memory
5048
- //
5049
- // Public type surface for user Workers binding to an Agent Memory namespace.
5050
- // ============================================================================
5051
- /** Memory type — every memory is classified into exactly one. */
5052
- type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";
5053
- /** Search intensity for recall. */
5054
- type AgentMemoryThinkingLevel = "low" | "medium" | "high";
5055
- /** Response verbosity for recall. */
5056
- type AgentMemoryResponseLength = "short" | "medium" | "long";
5057
- /** A conversation message passed to ingest(). */
5058
- interface AgentMemoryMessage {
5059
- role: "system" | "user" | "assistant";
5060
- content: string;
5061
- /** Optional message timestamp. */
5062
- timestamp?: Date;
5063
- }
5064
- /** Raw memory content passed to remember(). */
5065
- interface AgentMemoryIncomingMemory {
5066
- /** Raw memory content. The service classifies and summarizes automatically. */
5067
- content: string;
5068
- /** Optional session identifier to associate with this memory. */
5069
- sessionId?: string | null | undefined;
5070
- }
5071
- /** A stored memory returned from remember(), get(), and delete(). */
5072
- interface AgentMemoryMemory {
5073
- /** Memory ID. */
5074
- id: string;
5075
- /** Memory type. */
5076
- type: AgentMemoryMemoryType;
5077
- /** Text summary. */
5078
- summary: string;
5079
- /** Memory text. */
5080
- content: string;
5081
- /** Session that created this memory. */
5082
- sessionId: string | null;
5083
- /** Memory creation time. */
5084
- createdAt: Date;
5085
- /** Memory last-update time. */
5086
- updatedAt: Date;
5087
- }
5088
- /** Single entry in a list() response. Same shape as Memory minus full content. */
5089
- type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;
5090
- /** A scored memory candidate in a recall result. */
5091
- interface AgentMemoryScoredCandidate {
5092
- /** Candidate ID. */
5093
- id: string;
5094
- /** Text summary. */
5095
- summary: string;
5096
- /** Session that created this candidate, when known. */
5097
- sessionId: string | null;
5098
- /** Relevance score (higher is better). Comparable only within a single query. */
5099
- score: number;
5100
- }
5101
- /** Options for the ingest() method. */
5102
- interface AgentMemoryIngestOptions {
5103
- /** Session identifier to associate with memories created during ingestion. */
5104
- sessionId?: string | null | undefined;
5105
- }
5106
- /** Options for the getSummary() method. */
5107
- interface AgentMemoryGetSummaryOptions {
5108
- /** Session identifier to retrieve session summary for. */
5109
- sessionId?: string | null | undefined;
5110
- }
5111
- /** Response from the getSummary() method. */
5112
- interface AgentMemoryGetSummaryResponse {
5113
- /** Markdown summary. */
5114
- summary: string;
5115
- }
5116
- /**
5117
- * Options for the recall() method.
5118
- *
5119
- * `referenceDate` accepts a Date object, an ISO-8601 date string
5120
- * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this
5121
- * date is used as "today" for resolving relative time references
5122
- * ("how many days ago", "last week") instead of the server's wall-clock time.
5123
- */
5124
- interface AgentMemoryRecallOptions {
5125
- /** Recall intensity: "low" (default), "medium", or "high". */
5126
- thinkingLevel?: AgentMemoryThinkingLevel;
5127
- /** Response verbosity: "short", "medium" (default), or "long". */
5128
- responseLength?: AgentMemoryResponseLength;
5129
- /** Temporal anchor for date arithmetic. */
5130
- referenceDate?: Date | string;
5131
- }
5132
- /** Response from the recall() method. */
5133
- interface AgentMemoryRecallResult {
5134
- /** Number of memories retrieved. */
5135
- count: number;
5136
- /** LLM-generated answer synthesizing the matching memories. */
5137
- answer: string;
5138
- /** Matching memories ranked by relevance. */
5139
- candidates: AgentMemoryScoredCandidate[];
5140
- }
4976
+ reranking?: {
4977
+ enabled?: boolean;
4978
+ model?: string;
4979
+ /** Match threshold (0-1, default 0.4) */
4980
+ match_threshold?: number;
4981
+ [key: string]: unknown;
4982
+ };
4983
+ cache?: {
4984
+ enabled?: boolean;
4985
+ cache_threshold?:
4986
+ | "super_strict_match"
4987
+ | "close_enough"
4988
+ | "flexible_friend"
4989
+ | "anything_goes";
4990
+ };
4991
+ [key: string]: unknown;
4992
+ };
4993
+ // ============ AI Search Request Types ============
5141
4994
  /**
5142
- * Options for the list() method.
5143
- *
5144
- * `cursor` is the opaque continuation token returned by the previous page;
5145
- * pass it back unchanged to fetch the next page. `sessionId` and `type`
5146
- * are exact-match filters; combining them is allowed.
4995
+ * Request body for single-instance search.
4996
+ * Exactly one of `query` or `messages` must be provided.
5147
4997
  */
5148
- interface AgentMemoryListMemoriesOptions {
5149
- /** Maximum number of memories to return. Default 20, max 500. */
5150
- limit?: number;
5151
- /** Opaque cursor from a previous page. */
5152
- cursor?: string;
5153
- /** Exact-match session filter. */
5154
- sessionId?: string;
5155
- /** Exact-match memory-type filter. */
5156
- type?: AgentMemoryMemoryType;
5157
- }
5158
- /** Response from the list() method. */
5159
- interface AgentMemoryListMemoriesResult {
5160
- memories: AgentMemoryMemoryListEntry[];
5161
- /** Continuation cursor; absent when this page exhausted the result set. */
5162
- cursor?: string;
5163
- }
4998
+ type AiSearchSearchRequest =
4999
+ | {
5000
+ /** Simple query string. */
5001
+ query: string;
5002
+ messages?: never;
5003
+ ai_search_options?: AiSearchOptions;
5004
+ }
5005
+ | {
5006
+ query?: never;
5007
+ /** Conversation-style input. At least one user message with non-empty content is required. */
5008
+ messages: AiSearchMessage[];
5009
+ ai_search_options?: AiSearchOptions;
5010
+ };
5011
+ type AiSearchChatCompletionsRequest = {
5012
+ messages: AiSearchMessage[];
5013
+ model?: string;
5014
+ stream?: boolean;
5015
+ ai_search_options?: AiSearchOptions;
5016
+ [key: string]: unknown;
5017
+ };
5018
+ // ============ AI Search Multi-Instance Types (Namespace-Scoped) ============
5019
+ /** `ai_search_options` shape for multi-instance requests — requires `instance_ids`. */
5020
+ type AiSearchMultiSearchOptions = AiSearchOptions & {
5021
+ /** Instance IDs to search across (1-10). */
5022
+ instance_ids: string[];
5023
+ };
5164
5024
  /**
5165
- * A single Agent Memory profile, scoped to a profile name.
5166
- *
5167
- * Returned by {@link AgentMemoryNamespace.getProfile}.
5168
- */
5169
- declare abstract class AgentMemoryProfile {
5170
- /**
5171
- * Retrieve a memory by ID.
5172
- *
5173
- * @param memoryId - ULID of the memory to retrieve.
5174
- * @throws if the memory does not exist.
5175
- */
5176
- get(memoryId: string): Promise<AgentMemoryMemory>;
5177
- /**
5178
- * Delete a memory by ID.
5179
- *
5180
- * Removes the memory and any source messages linked by the memory's
5181
- * source message IDs.
5182
- *
5183
- * @param memoryId - ULID of the memory to delete.
5184
- * @throws if the memory does not exist.
5185
- */
5186
- delete(memoryId: string): Promise<AgentMemoryMemory>;
5187
- /**
5188
- * Store a memory in this profile. The content is automatically classified,
5189
- * summarized, and indexed.
5190
- *
5191
- * @param memory - Raw memory content to persist.
5192
- */
5193
- remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;
5194
- /**
5195
- * Extract memories from a conversation.
5196
- *
5197
- * @param messages - Conversation messages to extract memories from.
5198
- * @param options - Optional ingest options.
5199
- */
5200
- ingest(
5201
- messages: Iterable<AgentMemoryMessage>,
5202
- options?: AgentMemoryIngestOptions,
5203
- ): Promise<void>;
5204
- /**
5205
- * Get a profile summary.
5206
- *
5207
- * @param options - Optional getSummary options.
5208
- */
5209
- getSummary(
5210
- options?: AgentMemoryGetSummaryOptions,
5211
- ): Promise<AgentMemoryGetSummaryResponse>;
5212
- /**
5213
- * Recall memories in this profile.
5214
- *
5215
- * @param query - Recall query matched against memory content and keywords.
5216
- * @param options - Optional recall parameters.
5217
- * @returns Matching memories with relevance scores and a synthesized answer.
5218
- */
5219
- recall(
5220
- query: string,
5221
- options?: AgentMemoryRecallOptions,
5222
- ): Promise<AgentMemoryRecallResult>;
5223
- /**
5224
- * List active memories in this profile.
5225
- *
5226
- * Returns a paginated, filterable view of stored memories. Superseded
5227
- * versions are excluded. Use the returned `cursor` (when present) to
5228
- * fetch the next page.
5229
- *
5230
- * @param options - Optional pagination and filter options.
5231
- */
5232
- list(
5233
- options?: AgentMemoryListMemoriesOptions,
5234
- ): Promise<AgentMemoryListMemoriesResult>;
5235
- /**
5236
- * Soft-delete every memory and message in this profile that is tagged
5237
- * with `sessionId`.
5238
- *
5239
- * Idempotent: deleting a sessionId that has no rows is a no-op.
5240
- *
5241
- * @param sessionId - Session to delete.
5242
- */
5243
- deleteSession(sessionId: string): Promise<void>;
5244
- }
5245
- /**
5246
- * Namespace-level Agent Memory binding.
5247
- *
5248
- * Used as the type of an `env.MEMORY`-style binding backed by the Agent
5249
- * Memory product.
5250
- *
5251
- * @example
5252
- * ```ts
5253
- * export default {
5254
- * async fetch(_request: Request, env: Env): Promise<Response> {
5255
- * const profile = await env.MEMORY.getProfile("wrangler-e2e");
5256
- * const summary = await profile.getSummary();
5257
- * return Response.json(summary);
5258
- * },
5259
- * };
5260
- * ```
5261
- */
5262
- declare abstract class AgentMemoryNamespace {
5263
- /**
5264
- * Get a memory profile by name. Profiles are isolated by namespace and
5265
- * addressed by a compound key (namespaceId:profileName).
5266
- *
5267
- * @param profileName - Profile name (validated against naming rules).
5268
- * @returns RPC target for interacting with the profile.
5269
- */
5270
- getProfile(profileName: string): Promise<AgentMemoryProfile>;
5271
- /**
5272
- * Soft-delete a profile and schedule deferred purge. Marks all
5273
- * memories and messages as deleted.
5274
- *
5275
- * @param profileName - Name of the profile to delete.
5276
- */
5277
- deleteProfile(profileName: string): Promise<void>;
5278
- }
5279
- // ============ AI Search Error Interfaces ============
5280
- interface AiSearchInternalError extends Error {}
5281
- interface AiSearchNotFoundError extends Error {}
5282
- // ============ AI Search Common Types ============
5283
- /** A single message in a conversation-style search or chat request. */
5284
- type AiSearchMessage = {
5285
- role: "system" | "developer" | "user" | "assistant" | "tool";
5286
- content: string | null;
5287
- };
5288
- /**
5289
- * Common shape for `ai_search_options` used by both single-instance and multi-instance requests.
5290
- * Contains retrieval, query rewrite, reranking, and cache sub-options.
5291
- */
5292
- type AiSearchOptions = {
5293
- retrieval?: {
5294
- /** Which retrieval backend to use. Defaults to the instance's configured index_method. */
5295
- retrieval_type?: "vector" | "keyword" | "hybrid";
5296
- /** Fusion method for combining vector + keyword results. */
5297
- fusion_method?: "max" | "rrf";
5298
- /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */
5299
- keyword_match_mode?: "and" | "or";
5300
- /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */
5301
- match_threshold?: number;
5302
- /** Maximum number of results to return (1-50). Default 10. */
5303
- max_num_results?: number;
5304
- /** Vectorize metadata filters applied to the search. */
5305
- filters?: VectorizeVectorMetadataFilter;
5306
- /** Number of surrounding chunks to include for context (0-3). Default 0. */
5307
- context_expansion?: number;
5308
- /** If true, return only item metadata without chunk text. */
5309
- metadata_only?: boolean;
5310
- /** If true (default), return empty results on retrieval failure instead of throwing. */
5311
- return_on_failure?: boolean;
5312
- /** Boost results by metadata field values. Max 3 entries. */
5313
- boost_by?: Array<{
5314
- field: string;
5315
- direction?: "asc" | "desc" | "exists" | "not_exists";
5316
- }>;
5317
- [key: string]: unknown;
5318
- };
5319
- query_rewrite?: {
5320
- enabled?: boolean;
5321
- model?: string;
5322
- rewrite_prompt?: string;
5323
- [key: string]: unknown;
5324
- };
5325
- reranking?: {
5326
- enabled?: boolean;
5327
- model?: string;
5328
- /** Match threshold (0-1, default 0.4) */
5329
- match_threshold?: number;
5330
- [key: string]: unknown;
5331
- };
5332
- cache?: {
5333
- enabled?: boolean;
5334
- cache_threshold?:
5335
- | "super_strict_match"
5336
- | "close_enough"
5337
- | "flexible_friend"
5338
- | "anything_goes";
5339
- };
5340
- [key: string]: unknown;
5341
- };
5342
- // ============ AI Search Request Types ============
5343
- /**
5344
- * Request body for single-instance search.
5345
- * Exactly one of `query` or `messages` must be provided.
5346
- */
5347
- type AiSearchSearchRequest =
5348
- | {
5349
- /** Simple query string. */
5350
- query: string;
5351
- messages?: never;
5352
- ai_search_options?: AiSearchOptions;
5353
- }
5354
- | {
5355
- query?: never;
5356
- /** Conversation-style input. At least one user message with non-empty content is required. */
5357
- messages: AiSearchMessage[];
5358
- ai_search_options?: AiSearchOptions;
5359
- };
5360
- type AiSearchChatCompletionsRequest = {
5361
- messages: AiSearchMessage[];
5362
- model?: string;
5363
- stream?: boolean;
5364
- ai_search_options?: AiSearchOptions;
5365
- [key: string]: unknown;
5366
- };
5367
- // ============ AI Search Multi-Instance Types (Namespace-Scoped) ============
5368
- /** `ai_search_options` shape for multi-instance requests — requires `instance_ids`. */
5369
- type AiSearchMultiSearchOptions = AiSearchOptions & {
5370
- /** Instance IDs to search across (1-10). */
5371
- instance_ids: string[];
5372
- };
5373
- /**
5374
- * Request for searching across multiple instances within a namespace.
5375
- * `ai_search_options` is required and must include `instance_ids`.
5376
- * Exactly one of `query` or `messages` must be provided.
5025
+ * Request for searching across multiple instances within a namespace.
5026
+ * `ai_search_options` is required and must include `instance_ids`.
5027
+ * Exactly one of `query` or `messages` must be provided.
5377
5028
  */
5378
5029
  type AiSearchMultiSearchRequest =
5379
5030
  | {
@@ -15516,6 +15167,10 @@ interface ForwardableEmailMessage extends EmailMessage {
15516
15167
  * Size of the email message content.
15517
15168
  */
15518
15169
  readonly rawSize: number;
15170
+ /**
15171
+ * Whether this email message can be forwarded with `forward()`.
15172
+ */
15173
+ readonly canBeForwarded: boolean;
15519
15174
  /**
15520
15175
  * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
15521
15176
  * @param reason The reject reason.
@@ -18172,6 +17827,365 @@ declare namespace TailStream {
18172
17827
  };
18173
17828
  type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
18174
17829
  }
17830
+ // URL and URLSearchParams, as WHATWG URL declares them, at every compatibility
17831
+ // date. Without the urlsearchparams_delete_has_value_arg compatibility flag
17832
+ // (the default from 2023-07-01), delete() and has() ignore `value`.
17833
+ /**
17834
+ * 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.
17835
+ *
17836
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
17837
+ */
17838
+ declare class URL {
17839
+ constructor(url: string | URL, base?: string | URL);
17840
+ /**
17841
+ * The **`href`** property of the URL interface is a string containing the whole URL.
17842
+ *
17843
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
17844
+ */
17845
+ get href(): string;
17846
+ /**
17847
+ * The **`href`** property of the URL interface is a string containing the whole URL.
17848
+ *
17849
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
17850
+ */
17851
+ set href(value: string);
17852
+ /**
17853
+ * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
17854
+ *
17855
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
17856
+ */
17857
+ get origin(): string;
17858
+ /**
17859
+ * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".
17860
+ *
17861
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
17862
+ */
17863
+ get protocol(): string;
17864
+ /**
17865
+ * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".
17866
+ *
17867
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
17868
+ */
17869
+ set protocol(value: string);
17870
+ /**
17871
+ * 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, "".
17872
+ *
17873
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
17874
+ */
17875
+ get username(): string;
17876
+ /**
17877
+ * 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, "".
17878
+ *
17879
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
17880
+ */
17881
+ set username(value: string);
17882
+ /**
17883
+ * 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, "".
17884
+ *
17885
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
17886
+ */
17887
+ get password(): string;
17888
+ /**
17889
+ * 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, "".
17890
+ *
17891
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
17892
+ */
17893
+ set password(value: string);
17894
+ /**
17895
+ * 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, "".
17896
+ *
17897
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
17898
+ */
17899
+ get host(): string;
17900
+ /**
17901
+ * 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, "".
17902
+ *
17903
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
17904
+ */
17905
+ set host(value: string);
17906
+ /**
17907
+ * 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.
17908
+ *
17909
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
17910
+ */
17911
+ get hostname(): string;
17912
+ /**
17913
+ * 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.
17914
+ *
17915
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
17916
+ */
17917
+ set hostname(value: string);
17918
+ /**
17919
+ * 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, "".
17920
+ *
17921
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
17922
+ */
17923
+ get port(): string;
17924
+ /**
17925
+ * 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, "".
17926
+ *
17927
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
17928
+ */
17929
+ set port(value: string);
17930
+ /**
17931
+ * 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.
17932
+ *
17933
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
17934
+ */
17935
+ get pathname(): string;
17936
+ /**
17937
+ * 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.
17938
+ *
17939
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
17940
+ */
17941
+ set pathname(value: string);
17942
+ /**
17943
+ * 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, "".
17944
+ *
17945
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
17946
+ */
17947
+ get search(): string;
17948
+ /**
17949
+ * 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, "".
17950
+ *
17951
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
17952
+ */
17953
+ set search(value: string);
17954
+ /**
17955
+ * 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.
17956
+ *
17957
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
17958
+ */
17959
+ get searchParams(): URLSearchParams;
17960
+ /**
17961
+ * 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, "".
17962
+ *
17963
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
17964
+ */
17965
+ get hash(): string;
17966
+ /**
17967
+ * 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, "".
17968
+ *
17969
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
17970
+ */
17971
+ set hash(value: string);
17972
+ /**
17973
+ * 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().
17974
+ *
17975
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
17976
+ */
17977
+ toJSON(): string;
17978
+ toString(): string;
17979
+ /**
17980
+ * 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.
17981
+ *
17982
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)
17983
+ */
17984
+ static canParse(url: string | URL, base?: string | URL): boolean;
17985
+ /**
17986
+ * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.
17987
+ *
17988
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)
17989
+ */
17990
+ static parse(url: string | URL, base?: string | URL): URL | null;
17991
+ /**
17992
+ * The **`createObjectURL()`** static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter.
17993
+ *
17994
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
17995
+ */
17996
+ static createObjectURL(object: File | Blob): string;
17997
+ /**
17998
+ * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
17999
+ *
18000
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
18001
+ */
18002
+ static revokeObjectURL(object_url: string): void;
18003
+ }
18004
+ /**
18005
+ * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
18006
+ *
18007
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
18008
+ */
18009
+ declare class URLSearchParams {
18010
+ constructor(
18011
+ init?: Iterable<Iterable<string>> | Record<string, string> | string,
18012
+ );
18013
+ /**
18014
+ * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
18015
+ *
18016
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)
18017
+ */
18018
+ get size(): number;
18019
+ /**
18020
+ * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
18021
+ *
18022
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
18023
+ */
18024
+ append(name: string, value: string): void;
18025
+ /**
18026
+ * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.
18027
+ *
18028
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
18029
+ */
18030
+ delete(name: string, value?: string): void;
18031
+ /**
18032
+ * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.
18033
+ *
18034
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
18035
+ */
18036
+ get(name: string): string | null;
18037
+ /**
18038
+ * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
18039
+ *
18040
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
18041
+ */
18042
+ getAll(name: string): string[];
18043
+ /**
18044
+ * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.
18045
+ *
18046
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
18047
+ */
18048
+ has(name: string, value?: string): boolean;
18049
+ /**
18050
+ * 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.
18051
+ *
18052
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
18053
+ */
18054
+ set(name: string, value: string): void;
18055
+ /**
18056
+ * 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).
18057
+ *
18058
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
18059
+ */
18060
+ sort(): void;
18061
+ entries(): IterableIterator<[key: string, value: string]>;
18062
+ keys(): IterableIterator<string>;
18063
+ values(): IterableIterator<string>;
18064
+ forEach<This = unknown>(
18065
+ callback: (
18066
+ this: This,
18067
+ value: string,
18068
+ key: string,
18069
+ parent: URLSearchParams,
18070
+ ) => void,
18071
+ thisArg?: This,
18072
+ ): void;
18073
+ toString(): string;
18074
+ [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
18075
+ }
18076
+ // URLPattern, as the URLPattern standard declares it, for both parsers.
18077
+ // The legacy parser (the urlpattern_original compatibility flag, the
18078
+ // default before 2025-05-01) has no hasRegExpGroups.
18079
+ /**
18080
+ * 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.
18081
+ *
18082
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
18083
+ */
18084
+ declare class URLPattern {
18085
+ constructor(
18086
+ input?: string | URLPatternInit,
18087
+ baseURL?: string | URLPatternOptions,
18088
+ patternOptions?: URLPatternOptions,
18089
+ );
18090
+ /**
18091
+ * The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
18092
+ *
18093
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
18094
+ */
18095
+ get protocol(): string;
18096
+ /**
18097
+ * The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
18098
+ *
18099
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
18100
+ */
18101
+ get username(): string;
18102
+ /**
18103
+ * The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
18104
+ *
18105
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
18106
+ */
18107
+ get password(): string;
18108
+ /**
18109
+ * The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
18110
+ *
18111
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
18112
+ */
18113
+ get hostname(): string;
18114
+ /**
18115
+ * The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
18116
+ *
18117
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
18118
+ */
18119
+ get port(): string;
18120
+ /**
18121
+ * The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
18122
+ *
18123
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
18124
+ */
18125
+ get pathname(): string;
18126
+ /**
18127
+ * The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
18128
+ *
18129
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
18130
+ */
18131
+ get search(): string;
18132
+ /**
18133
+ * The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
18134
+ *
18135
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
18136
+ */
18137
+ get hash(): string;
18138
+ /**
18139
+ * 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.
18140
+ *
18141
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups)
18142
+ */
18143
+ get hasRegExpGroups(): boolean;
18144
+ /**
18145
+ * 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.
18146
+ *
18147
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
18148
+ */
18149
+ test(input?: string | URLPatternInit, baseURL?: string): boolean;
18150
+ /**
18151
+ * 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.
18152
+ *
18153
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
18154
+ */
18155
+ exec(
18156
+ input?: string | URLPatternInit,
18157
+ baseURL?: string,
18158
+ ): URLPatternResult | null;
18159
+ }
18160
+ interface URLPatternInit {
18161
+ protocol?: string;
18162
+ username?: string;
18163
+ password?: string;
18164
+ hostname?: string;
18165
+ port?: string;
18166
+ pathname?: string;
18167
+ search?: string;
18168
+ hash?: string;
18169
+ baseURL?: string;
18170
+ }
18171
+ interface URLPatternComponentResult {
18172
+ input: string;
18173
+ groups: Record<string, string | undefined>;
18174
+ }
18175
+ interface URLPatternResult {
18176
+ inputs: (string | URLPatternInit)[];
18177
+ protocol: URLPatternComponentResult;
18178
+ username: URLPatternComponentResult;
18179
+ password: URLPatternComponentResult;
18180
+ hostname: URLPatternComponentResult;
18181
+ port: URLPatternComponentResult;
18182
+ pathname: URLPatternComponentResult;
18183
+ search: URLPatternComponentResult;
18184
+ hash: URLPatternComponentResult;
18185
+ }
18186
+ interface URLPatternOptions {
18187
+ ignoreCase?: boolean;
18188
+ }
18175
18189
  // Copyright (c) 2022-2023 Cloudflare, Inc.
18176
18190
  // Licensed under the Apache 2.0 license found in the LICENSE file or at:
18177
18191
  // https://opensource.org/licenses/Apache-2.0