import * as plugins from './plugins.js'; import type { IControllerEvent, IControllerTerminalSnapshotFrame, TControllerTerminalId, IControllerChildEvent } from './interfaces.js'; /** * Server→client pushes. The controller fires these and the web client answers them, so * no `register*Handlers` method exists for them; every other request module is named * after the controller method that registers its handlers. */ /** * Server→client push: PTY output for a terminal the client may be viewing, and the reconstructed * screen state that starts every attachment. */ export interface IReq_ControllerTerminalOutput extends plugins.typedrequestInterfaces.implementsTR { method: 'controller.terminal.output'; request: { terminalId: TControllerTerminalId; /** * Absolute byte offset of this chunk in the terminal's output stream. A frame may be * re-sent after an unacknowledged delivery, so the client discards any byte range it has * already applied and treats `offset` beyond its applied end as a lost window. On a snapshot * frame it is instead the stream position the reconstructed state is exact at, which is where * the client anchors its applied end once the snapshot is complete. */ offset: number; /** Base64-encoded output bytes; snapshot payload on a snapshot frame, empty on a control frame. */ dataBase64: string; /** * Present on every frame of a reconstructed screen state. The controller opens each * attachment with one instead of replaying raw scrollback, and sends a fresh one when the * in-flight window moved past a peer's cursor. */ snapshot?: IControllerTerminalSnapshotFrame; /** The PTY ended; no further output follows. Never combined with `snapshot`. */ ended?: boolean; }; response: Record; } /** * Server→client push: the controller stopped delivering output to this peer. Best effort by * construction — it travels over the same transport whose failure produced it — so the client * must also recover on its own from an output gap or from an explicit re-selection. */ export interface IReq_ControllerTerminalDetached extends plugins.typedrequestInterfaces.implementsTR { method: 'controller.terminal.detached'; request: { terminalId: TControllerTerminalId; /** * Only involuntary loss is announced: the bounded output retry budget was exhausted. A peer * that detached, hung up, or superseded its own attachment initiated that itself and needs * no notification. */ reason: 'delivery_failed'; }; response: { received: true; }; } export interface IReq_ControllerEvent extends plugins.typedrequestInterfaces.implementsTR { method: 'controller.event'; request: IControllerEvent; response: { received: true; }; } export interface IReq_ControllerSessionChildEvent extends plugins.typedrequestInterfaces.implementsTR { method: 'controller.session.child.event'; request: IControllerChildEvent; response: { received: true; }; }