/** * @license * MIT License * * Copyright (c) 2025 OmniacDev * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ export declare namespace PROTO { interface Serializable { serialize(value: T, stream: ByteQueue): Generator; deserialize(stream: ByteQueue): Generator; } class ByteQueue { private _buffer; private _data_view; private _length; private _offset; get end(): number; get front(): number; get data_view(): DataView; constructor(size?: number); write(...values: number[]): void; read(amount?: number): number[]; ensure_capacity(size: number): void; static from_uint8array(array: Uint8Array): ByteQueue; to_uint8array(): Uint8Array; } namespace MIPS { function serialize(byte_queue: PROTO.ByteQueue): Generator; function deserialize(str: string): Generator; } const Void: PROTO.Serializable; const Null: PROTO.Serializable; const Undefined: PROTO.Serializable; const Int8: PROTO.Serializable; const Int16: PROTO.Serializable; const Int32: PROTO.Serializable; const UInt8: PROTO.Serializable; const UInt16: PROTO.Serializable; const UInt32: PROTO.Serializable; const UVarInt32: PROTO.Serializable; const Float32: PROTO.Serializable; const Float64: PROTO.Serializable; const String: PROTO.Serializable; const Boolean: PROTO.Serializable; const UInt8Array: PROTO.Serializable; const Date: PROTO.Serializable; function Object(obj: { [K in keyof T]: PROTO.Serializable; }): PROTO.Serializable; function Array(value: PROTO.Serializable): PROTO.Serializable; function Tuple(...values: { [K in keyof T]: PROTO.Serializable; }): PROTO.Serializable; function Optional(value: PROTO.Serializable): PROTO.Serializable; function Map(key: PROTO.Serializable, value: PROTO.Serializable): PROTO.Serializable>; function Set(value: PROTO.Serializable): PROTO.Serializable>; type Endpoint = string; type Header = { guid: string; encoding: string; index: number; final: boolean; }; const Endpoint: PROTO.Serializable; const Header: PROTO.Serializable
; } export declare namespace NET { function serialize(byte_queue: PROTO.ByteQueue, max_size?: number): Generator; function deserialize(strings: string[]): Generator; function emit, T>(endpoint: string, serializer: S & PROTO.Serializable, value: T): Generator; function listen>(endpoint: string, serializer: S & PROTO.Serializable, callback: (value: T) => Generator): () => void; } export declare namespace IPC { /** Sends a message with `args` to `channel` */ function send, T>(channel: string, serializer: S & PROTO.Serializable, value: T): void; /** Sends an `invoke` message through IPC, and expects a result asynchronously. */ function invoke, T, RS extends PROTO.Serializable, R>(channel: string, serializer: TS & PROTO.Serializable, value: T, deserializer: RS & PROTO.Serializable): Promise; /** Listens to `channel`. When a new message arrives, `listener` will be called with `listener(args)`. */ function on, T>(channel: string, deserializer: S & PROTO.Serializable, listener: (value: T) => void): () => void; /** Listens to `channel` once. When a new message arrives, `listener` will be called with `listener(args)`, and then removed. */ function once, T>(channel: string, deserializer: S & PROTO.Serializable, listener: (value: T) => void): () => void; /** Adds a handler for an `invoke` IPC. This handler will be called whenever `invoke(channel, ...args)` is called */ function handle, T, RS extends PROTO.Serializable, R>(channel: string, deserializer: TS & PROTO.Serializable, serializer: RS & PROTO.Serializable, listener: (value: T) => R): () => void; } export default IPC;