/** A terminal color palette. */ export interface TerminalPalette { id: string; name: string; /** true = dark background, false = light background. */ dark: boolean; /** Default foreground color as [r, g, b] (0–255). */ fg: [number, number, number]; /** Default background color as [r, g, b] (0–255). */ bg: [number, number, number]; /** ANSI 16-color entries, indexed 0–15. */ ansi: Array<[number, number, number]>; } export interface BlitDebug { log(msg: string, ...args: unknown[]): void; warn(msg: string, ...args: unknown[]): void; error(msg: string, ...args: unknown[]): void; } /** Silent {@link BlitDebug} that discards everything. */ export declare const noopDebug: BlitDebug; /** Connection lifecycle states. */ export type ConnectionStatus = "connecting" | "authenticating" | "connected" | "disconnected" | "closed" | "error"; export type ConnectionId = string; export type SessionId = string; /** * Transport abstraction for blit server communication. * Implementations handle the underlying protocol (WebSocket, WebTransport, etc.) * while consumers only deal with binary messages and status changes. */ /** Binary transport payload. Multiplexed transports use a borrowed * Uint8Array view so stripping their channel prefix does not copy every video * frame. Listeners must consume or copy the view synchronously. */ export type BlitTransportMessage = ArrayBuffer | Uint8Array; /** Backward-compatible name retained for transports compiled against the * pre-view API. */ export type BlitTransportData = BlitTransportMessage; export type BlitTransportEventMap = { message: BlitTransportMessage; statuschange: ConnectionStatus; }; export interface BlitTransportOptions { /** Enable automatic reconnection on disconnect. Default: true. */ reconnect?: boolean; /** Initial reconnect delay in ms. Default: 500. */ reconnectDelay?: number; /** Maximum reconnect delay in ms. Default: 10000. */ maxReconnectDelay?: number; /** Backoff multiplier for reconnect delay. Default: 1.5. */ reconnectBackoff?: number; /** Timeout in ms to wait for the connection to be established. Default: none for WebSocket, 10000 for others. */ connectTimeoutMs?: number; } export interface BlitTransport { /** Start connecting. Safe to call repeatedly. Call after registering listeners. */ connect(): void; /** Send binary data to the server. */ send(data: Uint8Array): void; /** Close the transport connection. */ close(): void; /** Stop the active connection and automatic retries without disposing it. */ suspend?(): void; /** Tear down the current connection and reconnect from scratch. */ reconnect?(): void; /** Current connection status. */ readonly status: ConnectionStatus; /** * Bytes handed to `send` that have not yet reached the network, when the * transport can say. * * This is the only honest congestion signal a browser gets: the socket * drains at whatever rate the uplink allows, so a queue that keeps growing * *is* a link too slow for what is being sent. Realtime senders — the * camera above all — should drop rather than add to it, because every * queued byte is delay in front of the frame they are about to capture. * * `undefined` where the transport cannot report it (a worker-hosted mux * that has not sampled recently, say). Callers must treat that as "no * backpressure known" and fall back to their own flow control rather than * stalling. */ readonly bufferedAmount?: number; /** True when the server explicitly rejected authentication. */ readonly authRejected: boolean; /** Last error message, if any. Cleared on successful connection. */ readonly lastError: string | null; /** Register a listener for transport events. */ addEventListener(type: "message", listener: (data: BlitTransportMessage) => void): void; addEventListener(type: "statuschange", listener: (status: ConnectionStatus) => void): void; /** Remove a previously registered listener. */ removeEventListener(type: "message", listener: (data: BlitTransportMessage) => void): void; removeEventListener(type: "statuschange", listener: (status: ConnectionStatus) => void): void; } /** A tracked terminal session. */ export type BlitSession = { id: SessionId; connectionId: ConnectionId; ptyId: number; tag: string; title: string | null; /** Highest visible terminal row reached since the last terminal reset. */ usedRows: number; command: string | null; state: "creating" | "active" | "exited" | "closed"; /** * Raw exit status from the server once the process has exited (the * `exit_status` field of `S2C_EXITED`), or `null` while running. * * `>= 0` is the normal exit code, `< 0` is the negated terminating * signal, and {@link EXIT_STATUS_UNKNOWN} means "not yet collected". * Use `exitCodeFromStatus` to map it to a conventional shell exit code. */ exitStatus: number | null; }; /** An active terminal subscription held by another server connection. */ export interface BlitClientTerminalSubscription { ptyId: number; /** Null when the client subscribed before advertising a view size. */ rows: number | null; /** Null when the client subscribed before advertising a view size. */ cols: number | null; } /** An active Wayland surface subscription held by another connection. */ export interface BlitClientSurfaceSubscription { surfaceId: number; /** Encoded pixel dimensions requested by the client, if reported. */ width: number | null; height: number | null; /** Fractional scale in 120ths (120 = 1x), if reported. */ scale120: number | null; } /** A non-terminal, non-surface subscription held by a connection. */ export interface BlitClientAuxSubscription { /** One of the `CLIENT_SUBSCRIPTION_*` constants; unknown values are retained. */ kind: number; /** Resource identifier within that protocol family. Audio uses zero. */ id: number; } /** What opened a connection, as the server accounts for it. */ export type BlitClientOrigin = { kind: "network"; } | { kind: "extension"; extensionId: bigint; definitionRevision: bigint; attempt: bigint; taskId: number; /** The durable name of a persistent definition, the label a transient * `ext run` carried, or empty when it had neither. */ name: string; } /** A kind this build has no name for. Still worth showing as "not an * ordinary client" — it is one thing to not know what a connection is, and * another to call it a browser. */ | { kind: "unknown"; originKind: number; }; export interface BlitClientInfo { id: bigint; /** Whole seconds since the server accepted the connection. */ ageSeconds: number; /** Actual framed bytes written by the server to this client per second. */ outboundBytesPerSecond: number; /** The same, for framed bytes the server read from this client. Both are * measured by the server, so they are comparable across client kinds. */ inboundBytesPerSecond: number; /** Audio, filesystem, Git, LSP, KV and network subscriptions. */ subscriptions: readonly BlitClientAuxSubscription[]; terminals: readonly BlitClientTerminalSubscription[]; surfaces: readonly BlitClientSurfaceSubscription[]; /** Null when the server predates `FEATURE_CLIENT_ORIGIN`, which is not the * same as an ordinary client: nothing was asked, so nothing is claimed. */ origin: BlitClientOrigin | null; } /** Snapshot returned by listClients or a live subscribeClients callback. */ export interface BlitClientList { selfId: bigint; /** Every currently connected client, including the requester. */ clients: readonly BlitClientInfo[]; } export interface BlitConnectionSnapshot { id: ConnectionId; status: ConnectionStatus; ready: boolean; supportsRestart: boolean; supportsCopyRange: boolean; supportsCompositor: boolean; /** Server accepts direct touchscreen contacts for Wayland surfaces. */ supportsSurfaceTouch: boolean; /** Server forwards Wayland text-input requests to surface viewers. */ supportsSurfaceTextInput: boolean; supportsAudio: boolean; /** Server supports enumerating and kicking other connections. */ supportsClientControl: boolean; supportsFsSync: boolean; /** Server advertises `FEATURE_GIT` (git introspection, docs/git.md). */ supportsGit: boolean; /** Server advertises `FEATURE_LSP` (language intelligence, docs/design/lsp.md). */ supportsLsp: boolean; /** Server advertises the KV store family (docs/design/kv.md). */ supportsKv: boolean; /** Server bridges tray items and desktop notifications. */ supportsDesktop: boolean; /** Server supports process-global named bidirectional channels. */ supportsChannels: boolean; /** Server pushes which channel names have a listener, so a client can watch * an extension appear and go away rather than probe for it once. */ supportsChannelWatch: boolean; /** The server admits Wasmi extensions (docs/design/extensions.md). */ supportsExtensions: boolean; /** Server understands viewer media, portals, and MPRIS runtime state. */ supportsDesktopMedia: boolean; /** A terminal can be started the way a process is: an exact argv exec'd * without a login shell, plus environment overrides. Must be checked * before asking — an older server ignores those fields rather than * refusing them, and quietly starts something else. */ supportsCreateExec: boolean; /** Server can create a terminal without automatically subscribing the * requesting client to its frame stream. */ supportsCreateNoSubscribe: boolean; retryCount: number; /** Opaque 64-bit identifier for the current server process, or `null` for * servers predating the extended HELLO. */ bootGeneration: bigint | null; /** The remote blit server's release, e.g. `"0.40.1"` — `null` for servers * predating the field in HELLO. */ serverVersion: string | null; /** Bumped on every connection reset (transport drop AND server * re-establish), so views holding fs/git handles can re-open them — those * don't survive a reset even when the transport stays up. */ generation: number; /** Non-null when the last connection attempt failed with an explicit error message. */ error: string | null; sessions: readonly BlitSession[]; focusedSessionId: SessionId | null; } export interface BlitWorkspaceSnapshot { connections: readonly BlitConnectionSnapshot[]; sessions: readonly BlitSession[]; focusedSessionId: SessionId | null; ready: boolean; } export interface CopyRangeResult { /** Copied text. Soft-wrapped rows are joined without a separator. */ text: string; /** * Rows the PTY held when the copy ran (scrollback plus screen), so a caller * that asked for a bounded window can tell whether rows were left above it. */ totalLines: number; } export interface BlitSearchResult { sessionId: SessionId; connectionId: ConnectionId; score: number; primarySource: number; matchedSources: number; scrollOffset: number | null; context: string; } export type TransportConfig = { type: "websocket"; url: string; passphrase: string; options?: BlitTransportOptions; } | { type: "webtransport"; url: string; passphrase: string; options?: BlitTransportOptions & { certHash?: string; }; } | { type: "share"; hubUrl: string; passphrase: string; debug?: BlitDebug; } | { type: "custom"; transport: BlitTransport; }; export declare const DEFAULT_FONT = "ui-monospace, monospace"; export declare const DEFAULT_FONT_SIZE = 13; /** * Coverage gamma for glyph antialiasing (1 = untouched, higher = thinner * light-on-dark text). * * Glyph coverage is blended into an sRGB-encoded framebuffer, which overstates * partial coverage and makes light-on-dark stems read bolder than the font * intends. Apple platforms are where that lands hardest — the system's own * text rendering is the reference users compare against, and it thins stems * the same way — so they get a correction by default and everyone else opts * in. Same reasoning, and roughly the same value, as kitty's * `text_gamma_adjustment`. */ export declare const DEFAULT_TEXT_GAMMA: number; /** Wire protocol constants: client-to-server message types. */ export declare const C2S_INPUT = 0; /** Desired viewport size(s): repeated [pty_id:2][rows:2][cols:2] entries. `0x0` clears one. */ export declare const C2S_RESIZE = 1; export declare const C2S_SCROLL = 2; export declare const C2S_ACK = 3; export declare const C2S_DISPLAY_RATE = 4; export declare const C2S_CLIENT_METRICS = 5; export declare const C2S_MOUSE = 6; export declare const C2S_RESTART = 7; /** Enumerate server connections: [nonce:2]. */ export declare const C2S_CLIENT_LIST = 9; /** Kick another connection: [nonce:2][client_id:8][reason:N]. */ export declare const C2S_KICK = 10; /** Start streaming connection-catalog snapshots under this nonce. */ export declare const C2S_CLIENT_WATCH = 11; /** Stop the connection-catalog stream under this nonce. */ export declare const C2S_CLIENT_UNWATCH = 12; export declare const C2S_CREATE = 16; export declare const C2S_FOCUS = 17; export declare const C2S_CLOSE = 18; export declare const C2S_SUBSCRIBE = 19; export declare const C2S_UNSUBSCRIBE = 20; export declare const C2S_SEARCH = 21; export declare const C2S_CREATE_AT = 22; export declare const C2S_CREATE_N = 23; export declare const C2S_CREATE2 = 24; export declare const C2S_KILL = 26; /** Optional trailing flag on `C2S_KILL`: signal the session leader alone * instead of the child's process group. Needs {@link FEATURE_KILL_MODE}; * an older server is leader-only anyway, since it ignores the byte. */ export declare const KILL_LEADER_ONLY: number; export declare const C2S_COPY_RANGE = 27; export declare const C2S_TERM_CWD = 28; /** Move a scrolled view by a signed number of lines relative to wherever the * server holds it: `[pty_id:2][delta:4 i32]`. * * `C2S_SCROLL`'s offset is measured from the live bottom, and under a * chatty app that bottom moves while the message is in flight — so an * absolute request computed from what the user was looking at lands short * by however many lines scrolled in between. A notch, a page key and a * drag are relative motions anyway. Needs {@link FEATURE_SCROLL_BY}. */ export declare const C2S_SCROLL_BY = 30; export declare const CREATE2_HAS_SRC_PTY: number; export declare const CREATE2_HAS_COMMAND: number; export declare const CREATE2_HAS_CWD: number; /** Ask for exactly one correlated outcome — `S2C_CREATED_N` on success or * {@link S2C_CREATE_FAILED} on refusal. Adds no trailing field. Only set * it when HELLO advertised {@link FEATURE_CREATE_STATUS}: an older server * ignores the bit and answers a refusal with nothing at all, leaving the * create pending forever. */ export declare const CREATE2_WANT_STATUS: number; /** Arm a server-enforced deadline at creation: `[ms:4]`, after any cwd and * before any command bytes. Only set it when HELLO advertised * {@link FEATURE_PTY_DEADLINE} — an older server does not know to skip the * four bytes and reads them as the start of the command. */ export declare const CREATE2_HAS_DEADLINE: number; /** Environment overrides for the child: `[count:2]` then `count` records of * `[key_len:2][key:N][value_len:4][value:N]`, applied on top of everything * the server derives. Needs {@link FEATURE_CREATE_EXEC}: an older server * ignores the bit, does not skip the block, and runs it as command text. */ export declare const CREATE2_HAS_ENV: number; /** Exec an argv directly, no shell: `[argc:2]` then `argc` records of * `[len:4][arg:N]`. Mutually exclusive with {@link CREATE2_HAS_COMMAND}. * Needs {@link FEATURE_CREATE_EXEC}: an older server ignores the bit, finds * no command, and spawns a plain interactive shell instead. */ export declare const CREATE2_HAS_ARGV: number; /** Do not automatically subscribe the creating client to terminal frame * updates. Adds no trailing field and does not suppress lifecycle/control * messages. Only set when HELLO advertised * {@link FEATURE_CREATE_NO_SUBSCRIBE}; an older server ignores the bit and * subscribes the creator anyway. */ export declare const CREATE2_NO_SUBSCRIBE: number; /** Wire protocol constants: server-to-client message types. */ export declare const S2C_UPDATE = 0; export declare const S2C_CREATED = 1; export declare const S2C_CLOSED = 2; export declare const S2C_LIST = 3; export declare const S2C_TITLE = 4; export declare const S2C_TERM_CWD = 14; /** Unsolicited push when a pty's OSC 7-reported cwd changes * (docs/protocol.md `TERM_CWD_EVENT`): [pty_id:2][cwd:N], no length * prefix — the S2C_TITLE convention. */ export declare const S2C_TERM_CWD_EVENT = 15; export declare const S2C_SEARCH_RESULTS = 5; export declare const S2C_CREATED_N = 6; export declare const S2C_HELLO = 7; export declare const S2C_EXITED = 8; export declare const S2C_READY = 9; export declare const S2C_TEXT = 10; export declare const S2C_PING = 11; export declare const S2C_QUIT = 12; export declare const S2C_USED_ROWS = 13; /** Correlated creation refusal: [nonce:2][status:1][detail:N]. `status` is * from the common registry below, `detail` is diagnostic UTF-8 and may be * empty. Only sent for a `C2S_CREATE2` that set * {@link CREATE2_WANT_STATUS}. */ export declare const S2C_CREATE_FAILED = 16; /** A scrolled-back view was re-anchored: [pty_id:2][offset:4]. * * A scroll offset is a distance from the live bottom, so output from the * app slides the text under a client reading its scrollback. The server * holds that client still by growing the offset as lines scroll away and * reports the result here, so both ends keep naming the same rows. Sent * only while scrolled back, and only when the offset actually moved. */ export declare const S2C_SCROLL_OFFSET = 17; /** Client catalog. Each client record carries its active terminal and surface * subscriptions and their most recently advertised view sizes. */ export declare const S2C_CLIENT_LIST = 18; /** The same catalog with an `[origin_kind:1][origin_len:2][origin:N]` block on * every record, sent only in answer to a request carrying * {@link CLIENT_LIST_WANT_ORIGIN}. A distinct opcode because the shipped * parsers on both sides reject a catalog with bytes left over. */ export declare const S2C_CLIENT_LIST2 = 21; /** Correlated COPY_RANGE refusal: [nonce:2][status:1][detail:N]. */ export declare const S2C_COPY_FAILED = 22; /** Bit 0 of the optional flags byte on `C2S_CLIENT_LIST` / `C2S_CLIENT_WATCH`: * answer with {@link S2C_CLIENT_LIST2}. */ export declare const CLIENT_LIST_WANT_ORIGIN: number; /** An ordinary client of the server: a browser, a CLI, a forwarder. */ export declare const CLIENT_ORIGIN_NETWORK = 0; /** A running extension attempt's own connection. */ export declare const CLIENT_ORIGIN_EXTENSION = 1; /** Correlated kick outcome: [nonce:2][status:1][detail:N]. */ export declare const S2C_KICK_RESULT = 19; /** This connection was kicked: [reason:N]. The server closes it next. */ export declare const S2C_KICKED = 20; /** Auxiliary subscription kinds in client-catalog records. */ export declare const CLIENT_SUBSCRIPTION_AUDIO = 1; export declare const CLIENT_SUBSCRIPTION_FS = 2; export declare const CLIENT_SUBSCRIPTION_GIT = 3; export declare const CLIENT_SUBSCRIPTION_LSP = 4; export declare const CLIENT_SUBSCRIPTION_KV = 5; export declare const CLIENT_SUBSCRIPTION_NET = 6; export declare const C2S_PING = 8; export declare const C2S_QUIT = 15; export declare const C2S_SURFACE_INPUT = 32; export declare const C2S_SURFACE_POINTER = 33; export declare const C2S_SURFACE_POINTER_AXIS = 34; /** * Scroll with both axes, a device source and discrete detents: * [0x32][surface_id:2][flags:1][dx_x100:4][dy_x100:4][v120_x:2][v120_y:2] * * Deltas are in the composited frame's pixel space, like * {@link C2S_SURFACE_POINTER}; the server converts to surface-logical * pixels. `v120` counts wheel detents in 120ths. */ export declare const C2S_SURFACE_POINTER_AXIS2 = 50; /** `wl_pointer.axis_source` values, carried in the AXIS2 flags byte. */ export declare const AXIS_SOURCE_WHEEL = 0; export declare const AXIS_SOURCE_FINGER = 1; export declare const AXIS_SOURCE_CONTINUOUS = 2; /** Set when the source bits mean anything. */ export declare const AXIS_FLAG_SOURCE_KNOWN: number; /** Set when this event ends a scroll sequence. */ export declare const AXIS_FLAG_STOP: number; export declare const C2S_SURFACE_RESIZE = 35; export declare const C2S_SURFACE_FOCUS = 36; export declare const C2S_CLIPBOARD_SET = 37; /** Take ownership of PRIMARY — what a middle click pastes. */ export declare const C2S_PRIMARY_SET = 51; export declare const C2S_SURFACE_SUBSCRIBE = 40; export declare const C2S_SURFACE_UNSUBSCRIBE = 41; export declare const C2S_SURFACE_ACK = 42; export declare const C2S_SURFACE_CLOSE = 43; /** Request the MIME types on the compositor clipboard. */ export declare const C2S_CLIPBOARD_LIST = 44; export declare const C2S_CLIENT_FEATURES = 45; /** Read one MIME type from the compositor clipboard: * [0x2E][mime_len:2][mime:N]. */ export declare const C2S_CLIPBOARD_GET = 46; /** Composed text input for a Wayland surface (UTF-8): [0x2F][surface_id:2][text:N] */ export declare const C2S_SURFACE_TEXT = 47; /** Composition in progress (UTF-8): [0x34][surface_id:2][cursor:2][text:N]. * `cursor` is a byte offset into `text`; empty text withdraws it. */ export declare const C2S_SURFACE_PREEDIT = 52; /** Browser-source drag entered a surface: * [0x35][surface_id:2][x:2][y:2][mime_count:2][mime entries], mime entry * [len:2][bytes]. Starts the compositor's wl_data_device drag session. */ export declare const C2S_SURFACE_DRAG_ENTER = 53; /** Drag pointer moved: [0x36][surface_id:2][x:2][y:2] */ export declare const C2S_SURFACE_DRAG_MOTION = 54; /** Drag left the surface without dropping: [0x37][surface_id:2] */ export declare const C2S_SURFACE_DRAG_LEAVE = 55; /** Dropped on the surface: * [0x38][surface_id:2][x:2][y:2][item_count:2][items], item * [mime_len:2][mime][name_len:2][name][data_len:4][data]. Rides a single * transport frame, so the whole message must fit the 16 MiB frame cap. */ export declare const C2S_SURFACE_DRAG_DROP = 56; /** Drag aborted before a drop (source read failed, session dangled): * opcode only. */ export declare const C2S_SURFACE_DRAG_CANCEL = 57; /** Direct touchscreen contacts. One message is one `wl_touch.frame`: * [0x3A][surface_id:2][phase:1][count:1][id:4,x_x100:4,y_x100:4]*. */ export declare const C2S_SURFACE_TOUCH = 58; export declare const SURFACE_TOUCH_DOWN = 0; export declare const SURFACE_TOUCH_UP = 1; export declare const SURFACE_TOUCH_MOTION = 2; export declare const SURFACE_TOUCH_CANCEL = 3; export declare const SURFACE_TOUCH_ENABLE = 4; export declare const SURFACE_TOUCH_DISABLE = 5; export declare const S2C_SURFACE_CREATED = 32; export declare const S2C_SURFACE_DESTROYED = 33; export declare const S2C_SURFACE_FRAME = 34; export declare const S2C_SURFACE_TITLE = 35; export declare const S2C_SURFACE_RESIZED = 36; export declare const S2C_CLIPBOARD_CONTENT = 37; /** MIME types on the compositor clipboard: * [0x2C][count:2] repeated{ [mime_len:2][mime:N] }. */ export declare const S2C_CLIPBOARD_LIST = 44; /** Clipboard authority: [0x2E][wayland:1]. When true, Ctrl/Cmd+V must * preserve the compositor's client-owned selection instead of importing * the browser clipboard over it. */ export declare const S2C_CLIPBOARD_OWNER = 46; /** Committed Wayland text-input state: * [0x2F][surface_id:2][flags:1][content_hint:4][content_purpose:4], with an * optional [cursor_x:2i][cursor_y:2i][cursor_w:2i][cursor_h:2i] tail naming * where the app draws the text under edit, in surface pixels. */ export declare const S2C_SURFACE_TEXT_INPUT = 47; export declare const SURFACE_TEXT_INPUT_ENABLED: number; /** A fresh committed enable, rather than metadata/reconnect state. */ export declare const SURFACE_TEXT_INPUT_REQUESTED: number; export declare const S2C_SURFACE_APP_ID = 40; /** Stamped identity for a surface: * [0x32][surface_id:2][engine_len:2][engine][app_len:2][app][inst_len:2][inst]. */ export declare const S2C_SURFACE_ORIGIN = 50; /** The Wayland client asked for its toplevel to be activated * (xdg_activation_v1): [0x2D][surface_id:2] — raise and focus the pane. */ export declare const S2C_SURFACE_ACTIVATED = 45; export declare const S2C_SURFACE_CURSOR = 41; /** Encoder backend info for a surface: [0x2A][surface_id:2][name:N] */ export declare const S2C_SURFACE_ENCODER = 42; /** Where another viewer is touching or pointing at a surface: * [0x31][surface_id:2][kind:1][count:1][x:2,y:2]*. * `count = 0` retires the marks and is what the driving viewer receives. */ export declare const S2C_SURFACE_REMOTE_INPUT = 49; /** One mouse/trackpad position. */ export declare const REMOTE_INPUT_POINTER = 0; /** Live touchscreen contacts (one point per finger on the glass). */ export declare const REMOTE_INPUT_TOUCH = 1; /** * Fragment of a larger S2C message: [0x2B][flags:1][chunk:N]. * Bulk messages above the server's chunk threshold are split into * fragments so audio frames can interleave on the shared TCP stream. * Receiver concatenates fragment chunks (in order; no reordering on * the same stream) until a fragment with FRAGMENT_FLAG_LAST set, then * dispatches the reassembled buffer as the original message. */ export declare const S2C_FRAGMENT = 43; export declare const FRAGMENT_FLAG_LAST: number; /** Maximum encoded transport frame, shared with the Rust protocol reader. */ export declare const MAX_FRAME_SIZE: number; /** Fragment payload capacity after the opcode and flags bytes. */ export declare const MAX_FRAGMENT_CHUNK: number; /** Maximum fragments in one logical message. */ export declare const MAX_FRAGMENT_COUNT = 16384; /** Maximum reassembled logical message. */ export declare const MAX_LOGICAL_MESSAGE: number; export declare const SURFACE_FRAME_FLAG_KEYFRAME: number; export declare const SURFACE_FRAME_CODEC_MASK = 6; export declare const SURFACE_FRAME_CODEC_H264: number; export declare const SURFACE_FRAME_CODEC_AV1: number; export declare const SURFACE_FRAME_CODEC_PNG: number; /** A u16 microseconds-within-the-ms field follows the base frame header. */ export declare const SURFACE_FRAME_FLAG_TIMESTAMP_SUB_US: number; /** Optional byte 6 of C2S_CLIENT_FEATURES. */ export declare const CLIENT_FEATURE_SURFACE_TIMESTAMP_SUB_US: number; /** Bitmask for client-supported codecs in C2S_SURFACE_RESIZE / C2S_SURFACE_SUBSCRIBE. 0 = accept anything. */ export declare const CODEC_SUPPORT_H264: number; export declare const CODEC_SUPPORT_AV1: number; export declare const CODEC_SUPPORT_H264_444: number; export declare const CODEC_SUPPORT_AV1_444: number; /** Bandwidth values for C2S_SURFACE_SUBSCRIBE. 0 = server default. * 10–255 = custom AV1 quantizer (wire value IS the quantizer). */ export declare const SURFACE_BANDWIDTH_DEFAULT = 0; export declare const SURFACE_BANDWIDTH_LOW = 1; export declare const SURFACE_BANDWIDTH_MEDIUM = 2; export declare const SURFACE_BANDWIDTH_HIGH = 3; export declare const SURFACE_BANDWIDTH_ULTRA = 4; /** Encoder speed values for C2S_SURFACE_SUBSCRIBE. 0 = server default. * 10–255 = custom (10 = slowest/best compression, 255 = fastest). */ export declare const SURFACE_SPEED_DEFAULT = 0; export declare const SURFACE_SPEED_SLOW = 1; export declare const SURFACE_SPEED_MEDIUM = 2; export declare const SURFACE_SPEED_FAST = 3; export declare const SURFACE_SPEED_REALTIME = 4; export declare const PROTOCOL_VERSION = 1; export declare const FEATURE_CREATE_NONCE: number; export declare const FEATURE_RESTART: number; export declare const FEATURE_RESIZE_BATCH: number; export declare const FEATURE_COPY_RANGE: number; export declare const FEATURE_COMPOSITOR: number; export declare const FEATURE_AUDIO: number; /** The server answers a `C2S_CREATE2` carrying {@link CREATE2_WANT_STATUS} * with exactly one of `S2C_CREATED_N` or {@link S2C_CREATE_FAILED}. * * Bits 6–13 belong to the per-family modules, which declare them beside * their own wire constants (`fs.ts`, `git.ts`, `lsp.ts`, `kv.ts`, `net.ts`). */ export declare const FEATURE_CREATE_STATUS: number; /** `C2S_KILL` and `C2S_CLOSE` reach the child's process group rather than the * session leader alone, and `C2S_KILL` accepts a trailing * {@link KILL_LEADER_ONLY} byte to opt back out. */ export declare const FEATURE_KILL_MODE: number; /** Server-enforced terminal deadlines. */ export declare const FEATURE_PTY_DEADLINE: number; /** Scrollback that holds still under output: the server re-anchors a * scrolled client and reports it with {@link S2C_SCROLL_OFFSET}, and * accepts the relative {@link C2S_SCROLL_BY} that goes with it. */ export declare const FEATURE_SCROLL_BY: number; /** Direct browser touch contacts delivered through core Wayland `wl_touch`. */ export declare const FEATURE_SURFACE_TOUCH: number; /** Wayland text-input enable/disable and content purpose forwarding. */ export declare const FEATURE_SURFACE_TEXT_INPUT: number; /** Server connections can be enumerated and another connection kicked. */ export declare const FEATURE_CLIENT_CONTROL: number; /** The client catalog can say which connections are extension attempts: * `C2S_CLIENT_LIST` / `C2S_CLIENT_WATCH` accept {@link CLIENT_LIST_WANT_ORIGIN} * and answer it with {@link S2C_CLIENT_LIST2}. Implies * {@link FEATURE_CLIENT_CONTROL}. */ export declare const FEATURE_CLIENT_ORIGIN: number; /** `C2S_CREATE2` accepts {@link CREATE2_HAS_ARGV} and {@link CREATE2_HAS_ENV}, * so a terminal can be started the way a native process is: an exact argv * exec'd without a shell, plus environment overrides. * * Neither flag is probeable — an older server does not refuse an unknown * `features` bit, it ignores the bit and misreads the bytes that follow — so * this has to be negotiated rather than discovered. Not advertised on * Windows servers, where the pseudoconsole path can honor neither. */ export declare const FEATURE_CREATE_EXEC: number; /** `C2S_CREATE2` accepts {@link CREATE2_NO_SUBSCRIBE}. */ export declare const FEATURE_CREATE_NO_SUBSCRIBE: number; export declare const STATUS_OK = 0; export declare const STATUS_UNKNOWN_ID = 1; export declare const STATUS_NOT_FOUND = 2; export declare const STATUS_WRONG_TYPE = 3; export declare const STATUS_PERMISSION = 4; export declare const STATUS_TOO_LARGE = 5; export declare const STATUS_BUDGET = 6; export declare const STATUS_INVALID = 7; export declare const STATUS_CANCELLED = 8; export declare const STATUS_OTHER = 9; export declare const STATUS_WARMING = 10; export declare const STATUS_CONFLICT = 11; export declare const STATUS_NO_MERGE_BASE = 12; /** Human-readable common-registry status. An unallocated value reads * distinctly from {@link STATUS_OTHER} so a newer server's status is not * mistaken for a generic backend failure. */ export declare function statusText(status: number): string; export declare const C2S_AUDIO_SUBSCRIBE = 48; export declare const C2S_AUDIO_UNSUBSCRIBE = 49; export declare const S2C_AUDIO_FRAME = 48; export declare const AUDIO_FRAME_CODEC_MASK = 6; export declare const AUDIO_FRAME_CODEC_OPUS: number; /** Server-stamped identity of the socket a Wayland surface arrived on. */ export type BlitSurfaceOrigin = { sandboxEngine: string; appId: string; instanceId: string; }; export type BlitSurface = { connectionId: ConnectionId; surfaceId: u16; parentId: u16; title: string; appId: string; /** * Trusted application identity supplied by the server, when the surface * arrived on a stamped app socket. This is distinct from `appId`, which is * self-reported by the Wayland client. * * Optional so callers constructing surface-shaped fixtures remain source * compatible; surfaces created by SurfaceStore set it explicitly. */ origin?: BlitSurfaceOrigin | null; /** Composited size in physical pixels — what the video stream carries. */ width: number; height: number; /** * The same size in surface-logical pixels: the window as its Wayland * client measures it, before the mediated output scale. The server * mediates one surface across every viewer at the *highest* DPR any of * them asked for, so on a 1x viewer watching a surface a 3x viewer * sized, `width` is three times `logicalWidth` and presenting the frame * to fill the pane would show the window at 3x zoom. * * 0 until the server reports one (or from a server that predates the * field), which callers must read as "unknown", not as an empty window. */ logicalWidth: number; logicalHeight: number; }; type u16 = number; export {}; //# sourceMappingURL=types.d.ts.map