/** * @license * MIT License * * Copyright (c) 2026 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 Serializer { serialize(value: T, stream: Buffer): Generator; } interface Deserializer { deserialize(stream: Buffer): Generator; } interface Serializable extends Serializer, Deserializer { } class Buffer { private _buffer; private _data_view; private _length; private _offset; get end(): number; get front(): number; get data_view(): DataView; constructor(size?: number); reserve(amount: number): number; consume(amount: number): number; write(byte: number): void; write(bytes: Uint8Array): void; read(): number; read(amount: number): Uint8Array; ensure_capacity(size: number): void; static from_uint8array(array: Uint8Array): Buffer; to_uint8array(): Uint8Array; } namespace MIPS { function is_valid(str: string): boolean; function serialize(stream: PROTO.Buffer): 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 VarInt32: 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(s: { [K in keyof T]: PROTO.Serializable; }): PROTO.Serializable; function Array(s: PROTO.Serializable): PROTO.Serializable; function Tuple(...s: { [K in keyof T]: PROTO.Serializable; }): PROTO.Serializable; function Optional(s: PROTO.Serializable): PROTO.Serializable; function Map(kS: PROTO.Serializable, vS: PROTO.Serializable): PROTO.Serializable>; function Set(s: PROTO.Serializable): PROTO.Serializable>; function Cached(s: PROTO.Serializable, depth?: number): PROTO.Serializable; } export declare namespace NET { type Meta = { guid: string; signature: string; }; const Meta: PROTO.Serializable; export const SIGNATURE: string; export let FRAG_MAX: number; export function serialize(buffer: PROTO.Buffer, max_size?: number): Generator; export function deserialize(strings: string[]): Generator; export interface EmitOptions { metaOverride?: Partial; } export function emit(endpoint: string, serializer: PROTO.Serializer, value: NoInfer, options?: EmitOptions): Generator; export interface ListenOptions { filter?: (meta: Meta) => boolean; } export function listen(endpoint: string, deserializer: PROTO.Deserializer, callback: (value: NoInfer, meta: Meta) => Generator, options?: ListenOptions): () => void; export {}; } export declare namespace IPC { /** Sends a message with `args` to `channel` */ function send(channel: string, serializer: PROTO.Serializer, value: NoInfer): void; /** Sends an `invoke` message through IPC, and expects a result asynchronously. */ function invoke(channel: string, serializer: PROTO.Serializer, value: NoInfer, deserializer: PROTO.Deserializer): Promise>; /** Listens to `channel`. When a new message arrives, `listener` will be called with `listener(args)`. */ function on(channel: string, deserializer: PROTO.Deserializer, listener: (value: NoInfer) => void): () => void; /** Listens to `channel` once. When a new message arrives, `listener` will be called with `listener(args)`, and then removed. */ function once(channel: string, deserializer: PROTO.Deserializer, listener: (value: NoInfer) => void): () => void; /** Adds a handler for an `invoke` IPC. This handler will be called whenever `invoke(channel, ...args)` is called */ function handle(channel: string, deserializer: PROTO.Deserializer, serializer: PROTO.Serializer, listener: (value: NoInfer) => NoInfer): () => void; } export default IPC;