type ResizeEntry = { ptyId: number; rows: number; cols: number; }; export declare function buildAckMessage(): Uint8Array; /** * Request the server's connection catalog. * * `wantOrigin` adds the flags byte that asks for `S2C_CLIENT_LIST2`, whose * entries say where each connection came from. Only send it to a server * advertising `FEATURE_CLIENT_ORIGIN`: every server answers a client-control * request with unexpected trailing bytes with `INVALID`, so asking blindly * costs the catalog rather than the extra field. */ export declare function buildClientListMessage(nonce: number, wantOrigin?: boolean): Uint8Array; /** Start streaming the server's connection catalog. */ export declare function buildClientWatchMessage(nonce: number, wantOrigin?: boolean): Uint8Array; /** Stop a connection-catalog stream. */ export declare function buildClientUnwatchMessage(nonce: number): Uint8Array; /** Longest UTF-8 kick reason the server will accept (`KICK_REASON_MAX`). */ export declare const KICK_REASON_MAX = 1024; /** UTF-8 byte length of a kick reason, for validating before sending. */ export declare function kickReasonByteLength(reason: string): number; /** Request that another server connection be disconnected. */ export declare function buildKickClientMessage(nonce: number, clientId: bigint, reason?: string): Uint8Array; export declare function buildClientMetricsMessage(backlogFrames: number, ackAheadFrames: number, applyMsX10: number): Uint8Array; export declare function buildDisplayRateMessage(fps: number): Uint8Array; export declare function buildInputMessage(ptyId: number, data: Uint8Array): Uint8Array; export declare function buildResizeMessage(ptyId: number, rows: number, cols: number): Uint8Array; export declare function buildResizeBatchMessage(entries: ReadonlyArray): Uint8Array; export declare function buildClearResizeMessage(ptyId: number): Uint8Array; export declare function buildClearResizeBatchMessage(ptyIds: ReadonlyArray): Uint8Array; /** Move a scrolled view by `lines` from wherever the server holds it * (negative = back toward the live bottom). See {@link C2S_SCROLL_BY}. */ export declare function buildScrollByMessage(ptyId: number, lines: number): Uint8Array; export declare function buildScrollMessage(ptyId: number, offset: number): Uint8Array; export declare function buildFocusMessage(ptyId: number): Uint8Array; export declare function buildCloseMessage(ptyId: number): Uint8Array; export declare function buildSubscribeMessage(ptyId: number): Uint8Array; export declare function buildUnsubscribeMessage(ptyId: number): Uint8Array; export declare function buildSearchMessage(requestId: number, query: string): Uint8Array; export type Create2Options = { tag?: string; /** Run this through the server's login shell. Mutually exclusive with * {@link argv}. */ command?: string; /** Exec this argv directly, no shell. Only pass it when the server * advertised `FEATURE_CREATE_EXEC`; an older one ignores the flag and * spawns a plain interactive shell instead of what was asked for. */ argv?: readonly string[]; srcPtyId?: number; cwd?: string; /** Environment overrides, applied on top of everything the server derives. * Only pass this when the server advertised `FEATURE_CREATE_EXEC`. */ env?: Readonly> | readonly (readonly [string, string])[]; /** Only pass this when the server advertised `FEATURE_PTY_DEADLINE`. */ deadlineMs?: number; /** Only pass this when the server advertised `FEATURE_CREATE_STATUS`. */ wantStatus?: boolean; /** Set false to skip the creating client's automatic terminal-frame * subscription. Only pass this when the server advertised * `FEATURE_CREATE_NO_SUBSCRIBE`. */ subscribe?: boolean; }; /** Encode a `C2S_CREATE2`. * * Field order is load-bearing and matches the server's parser: tag, * `src_pty_id`, cwd, deadline, env, argv, then the command — which has no * length prefix and therefore has to be last. * * Every optional field past the cwd needs its feature bit negotiated first. * An older server does not reject an unknown `features` bit; it ignores the * bit, does not skip the bytes, and reads them as the start of the command. * See the constants in `types.ts` for what each one does when unsupported. */ export declare function buildCreate2Message(nonce: number, rows: number, cols: number, options?: Create2Options): Uint8Array; /** Mouse event types for C2S_MOUSE. */ export declare const MOUSE_DOWN = 0; export declare const MOUSE_UP = 1; export declare const MOUSE_MOVE = 2; export declare function buildMouseMessage(ptyId: number, type: number, button: number, col: number, row: number): Uint8Array; export declare function buildRestartMessage(ptyId: number): Uint8Array; /** * Signals a terminal. The server's default reaches the child's process group, * which is what "stop this terminal" means and what the kernel does for a * real `^C`. Pass `leaderOnly` to address the session leader alone; that * needs `FEATURE_KILL_MODE`, and an older server is leader-only regardless * because it ignores the trailing byte. */ export declare function buildKillMessage(ptyId: number, signal: number, leaderOnly?: boolean): Uint8Array; /** [0x1C][nonce:2][pty_id:2] — request a pty's live cwd. */ export declare function buildTermCwdMessage(nonce: number, ptyId: number): Uint8Array; /** [0x0E][nonce:2][cwd_len:2][cwd:N] → { nonce, cwd } (empty cwd = unknown). */ export declare function parseTermCwdReply(data: Uint8Array): { nonce: number; cwd: string; } | null; /** [0x0F][pty_id:2][cwd:N] → { ptyId, cwd } — unsolicited push when the * OSC 7-reported cwd changes (docs/protocol.md `TERM_CWD_EVENT`). `cwd` * is the remainder of the message, no length prefix (the S2C_TITLE * convention): a non-empty UTF-8 absolute path of at most 4096 bytes. * Null = malformed. */ export declare function parseTermCwdEvent(data: Uint8Array): { ptyId: number; cwd: string; } | null; export declare function buildCopyRangeMessage(nonce: number, ptyId: number, startTail: number, startCol: number, endTail: number, endCol: number): Uint8Array; export declare function buildSurfaceInputMessage(surfaceId: number, keycode: number, pressed: boolean, timeMs?: number): Uint8Array; export declare function buildSurfaceTextMessage(surfaceId: number, text: string): Uint8Array; /** * Composition in progress: [0x34][surface_id:2][cursor:2][text:N]. * * `cursorUtf16` is a UTF-16 offset (what the DOM counts in) and goes on the * wire as a byte offset, which is what zwp_text_input_v3 wants — the two * disagree for exactly the characters a composition is usually made of. */ export declare function buildSurfacePreeditMessage(surfaceId: number, text: string, cursorUtf16: number): Uint8Array; export declare const SURFACE_POINTER_DOWN = 0; export declare const SURFACE_POINTER_UP = 1; export declare const SURFACE_POINTER_MOVE = 2; /** The pointer left the surface's drawn area. Carries no position, and older * servers ignore the type, so it needs no feature bit: they simply keep the * pre-existing behaviour of never retiring the shared-pointer overlay. */ export declare const SURFACE_POINTER_LEAVE = 3; export declare function buildSurfacePointerMessage(surfaceId: number, type: number, button: number, x: number, y: number, timeMs?: number): Uint8Array; /** One dropped payload: the bytes, the MIME they are offered under, and * the file name when the drag source had one. */ export interface SurfaceDragItem { mime: string; name: string; data: Uint8Array; } /** Drag session messages mirror C2S_SURFACE_POINTER's field encoding: * surface_id, x and y are little-endian u16. An ENTER may carry an * optional item trailer — `[item_count:2]` then per item * `[mime_len:2][mime]`, one MIME per dragged file in item order. The * trailer is append-only: no `items` arg builds bytes identical to the * pre-trailer form. Chromium fetches the drag offer's data at * wl_data_device.enter, so the server uses the list to pre-create the * planned staging files and serve a real text/uri-list during hover. */ export declare function buildSurfaceDragEnterMessage(surfaceId: number, x: number, y: number, mimes: string[], items?: string[]): Uint8Array; export declare function buildSurfaceDragMotionMessage(surfaceId: number, x: number, y: number): Uint8Array; export declare function buildSurfaceDragLeaveMessage(surfaceId: number): Uint8Array; export declare function buildSurfaceDragDropMessage(surfaceId: number, x: number, y: number, items: SurfaceDragItem[]): Uint8Array; export declare function buildSurfaceDragCancelMessage(): Uint8Array; export declare function buildSurfaceAxisMessage(surfaceId: number, axis: number, valueX100: number): Uint8Array; /** One scroll event: both axes, the device that produced it, and whether * the gesture has ended. */ export interface SurfaceAxisEvent { /** Horizontal distance in composited-frame pixels, positive = right. */ dx: number; /** Vertical distance in composited-frame pixels, positive = down. */ dy: number; /** Horizontal wheel travel in 120ths of a detent. */ v120x: number; /** Vertical wheel travel in 120ths of a detent. */ v120y: number; /** An AXIS_SOURCE_* value, or null when the device is unclassified. */ source: number | null; /** True when this ends the scroll sequence; deltas are ignored. */ stop: boolean; /** The browser wheel event's own `timeStamp`, in ms. Toolkits integrate axis * deltas against these timestamps for kinetic scrolling, so the spacing must * be the browser's and not the server's arrival time. */ timeMs?: number; } export declare function buildSurfaceAxis2Message(surfaceId: number, ev: SurfaceAxisEvent): Uint8Array; export interface SurfaceTouchPoint { identifier: number; /** Horizontal position in the composited frame's pixel space. */ x: number; /** Vertical position in the composited frame's pixel space. */ y: number; } /** Build one direct-touch event. Its message boundary becomes * `wl_touch.frame`, preserving contacts that changed together. */ export declare function buildSurfaceTouchMessage(surfaceId: number, phase: number, contacts?: readonly SurfaceTouchPoint[], timeMs?: number): Uint8Array; /** * @param scale120 Requested presentation scale in 1/120th units: * 60 = 0.5×, 120 = 1×, 180 = 1.5×, 240 = 2×. * 0 means unspecified (server defaults to 1×). * @param codecSupport Bitmask of CODEC_SUPPORT_* flags. 0 = accept anything. */ export declare function buildSurfaceResizeMessage(surfaceId: number, width: number, height: number, scale120?: number): Uint8Array; export declare function buildSurfaceFocusMessage(surfaceId: number): Uint8Array; export declare function buildSurfaceCloseMessage(surfaceId: number): Uint8Array; /** * Build a surface subscribe message with optional codec, bandwidth and * speed overrides, and an optional fixed encode size. * * @param codecSupport - CODEC_SUPPORT_* bitmask (0 = use connection default from sendClientFeatures) * @param bandwidth - SURFACE_BANDWIDTH_* constant (0 = use server default) * @param speed - SURFACE_SPEED_* constant (0 = use server default) * @param width - fixed encode width in pixels (0 = participate in mediation) * @param height - fixed encode height in pixels (0 = participate in mediation) * @param maxFps - per-surface frame-rate ceiling (0 = client display rate) * * Asking for a size opts this subscription out of surface-size mediation: * the server encodes a downscale of the surface for this client alone * instead of pulling the compositor surface down to fit it. Contract — * see the C2S_SURFACE_SUBSCRIBE arm in crates/server. */ export declare function buildSurfaceSubscribeMessage(surfaceId: number, codecSupport?: number, bandwidth?: number, speed?: number, width?: number, height?: number, maxFps?: number): Uint8Array; export declare function buildSurfaceUnsubscribeMessage(surfaceId: number): Uint8Array; export declare function buildSurfaceAckMessage(surfaceId: number, decoderQueueDepth?: number): Uint8Array; export declare function buildClipboardMessage(mimeType: string, data: Uint8Array): Uint8Array; /** Request the MIME types currently offered by the compositor clipboard. */ export declare function buildClipboardListMessage(): Uint8Array; /** Read one MIME type from the compositor clipboard. */ export declare function buildClipboardGetMessage(mimeType: string): Uint8Array; /** * Take ownership of PRIMARY, the selection a middle click pastes. * * Sent just before the middle button reaches the surface rather than * whenever the page selection changes: the compositor serves these bytes * itself, so owning PRIMARY continuously would mean permanently displacing * whichever Wayland client the user last selected text in. */ export declare function buildPrimaryMessage(mimeType: string, data: Uint8Array): Uint8Array; /** * Build a C2S_CLIENT_FEATURES message. * * `maxDecodeW`/`maxDecodeH` are the largest frame this browser's video * decoder was confirmed to handle, as little-endian u16s. `0` means "not * determined"; the server then holds the client to the H.264 ceiling rather * than assume a decoder that advertises AV1 will take a 5K frame. Servers * predating the field ignore the extra bytes. `clientFeatures` negotiates * optional frame extensions; bit 0 requests precise surface timestamps. */ export declare function buildClientFeaturesMessage(codecSupport: number, maxDecodeW?: number, maxDecodeH?: number, clientFeatures?: number): Uint8Array; /** * Build a C2S_AUDIO_SUBSCRIBE message. * `bitrateKbps`: 0 = server default, otherwise the desired Opus bitrate * in kbps (e.g. 64 for 64 kbps). Sent as a little-endian u16. * Can be sent repeatedly to adjust bitrate without unsubscribing first. */ export declare function buildAudioSubscribeMessage(bitrateKbps?: number): Uint8Array; export declare function buildAudioUnsubscribeMessage(): Uint8Array; export {}; //# sourceMappingURL=protocol.d.ts.map