Skip to main content

Module SerializeTerminalState

Module SerializeTerminalState 

Source
Expand description

Serialise all active terminals to the ISerializedTerminalState[] shape that VS Code’s ILocalPtyService.serializeTerminalProcesses contract requires.

VS Code calls this immediately before a window reload to snapshot running PTY state. The result is written to storage and later passed back via localPty:reviveTerminalProcesses so the workbench can restore the panel without the user losing their shell sessions.

§Output shape per terminal

{
  "id": 1,
  "shellLaunchConfig": { "name": "zsh", "executable": "/bin/zsh", "args": [] },
  "processDetails":    { "cwd": "/...", "pid": 1234, "title": "zsh" },
  "orphanQuestionReply": false,
  "replayEvent":        { "events": [] },
  "timestamp":          1716134400000
}

Runtime handles (PTYMaster, PTYInputTransmitter, task JoinHandles) are #[serde(skip)] in TerminalStateDTO and are intentionally absent from the wire payload - only the configuration fields needed to respawn the shell are serialised.

Functions§

Fn