mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-31 05:32:58 +00:00
Restore configured terminal history on reconnect, retaining 10,000 rows plus the screen. Serialize the worker-owned xterm buffer directly to ANSI and forward negotiated bounded replay chunks while preserving ANSI-era clients and per-viewer live ordering. Preserve captured geometry through replay, bound pressure recovery to 500 rows, and keep the omitted visible-history default at 200. Remove the full cell-grid copy and obsolete JSON rendering. All 21 CI checks pass. Real browser, native Debug emulator/simulator and Linux Electron coverage and platform limits are documented in the PR. The Android Debug invalid native delegate dispatch also reproduces on upstream main; its cause and any change in frequency remain unproven. Credit Manav Dhindsa (DrakenKor), #6139 and #6148, and Lennart Schoch, #6743, for prior ANSI replay and retention work informing this change. Closes #6137. Closes #6147.
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { HOST_ROUTE_OPCODE, decodeHostRouteFrame, type HostRouteFrame } from "./host-route.js";
|
|
import {
|
|
decodeFileTransferFrame,
|
|
FileTransferOpcode,
|
|
type FileTransferFrame,
|
|
} from "./file-transfer.js";
|
|
import {
|
|
decodeTerminalStreamFrame,
|
|
TerminalStreamOpcode,
|
|
type TerminalStreamFrame,
|
|
} from "./terminal.js";
|
|
|
|
export type BinaryFrame =
|
|
| { kind: "host_route"; frame: HostRouteFrame }
|
|
| { kind: "terminal"; frame: TerminalStreamFrame }
|
|
| { kind: "file_transfer"; frame: FileTransferFrame };
|
|
|
|
export function decodeBinaryFrame(bytes: Uint8Array): BinaryFrame | null {
|
|
switch (bytes[0]) {
|
|
case HOST_ROUTE_OPCODE: {
|
|
const frame = decodeHostRouteFrame(bytes);
|
|
return frame ? { kind: "host_route", frame } : null;
|
|
}
|
|
case TerminalStreamOpcode.Output:
|
|
case TerminalStreamOpcode.Input:
|
|
case TerminalStreamOpcode.Resize:
|
|
case TerminalStreamOpcode.Snapshot:
|
|
case TerminalStreamOpcode.ReplayBegin:
|
|
case TerminalStreamOpcode.ReplayData:
|
|
case TerminalStreamOpcode.ReplayEnd:
|
|
case TerminalStreamOpcode.Restore: {
|
|
const frame = decodeTerminalStreamFrame(bytes);
|
|
return frame ? { kind: "terminal", frame } : null;
|
|
}
|
|
case FileTransferOpcode.FileBegin:
|
|
case FileTransferOpcode.FileChunk:
|
|
case FileTransferOpcode.FileEnd: {
|
|
const frame = decodeFileTransferFrame(bytes);
|
|
return frame ? { kind: "file_transfer", frame } : null;
|
|
}
|
|
default:
|
|
return null;
|
|
}
|
|
}
|