Preload script — the only bridge between the sandboxed renderer and the main process. Runs with Node access but contextIsolation on, and exposes three frozen API objects on window:

  • window.terminalAPI — raw PTY/SSH byte flow (provided by the terminal lib's exposeTerminalBridge): sendInput, resize, onData, onExit;
  • window.windowAPI — see WindowAPI;
  • window.sessionAPI — see SessionAPI.

Everything the renderer can ask the main process to do is enumerated here.

Type Definitions

ProfilesAPI

Saved-session (PuTTY "Saved Sessions") persistence.

Type:
  • object
Properties
NameTypeDescription
listfunction

List all saved profiles.

savefunction

Upsert by name; returns the new list.

deletefunction

Remove by name; returns the new list.

SessionAPI

Session configuration & lifecycle exposed to the renderer.

Type:
  • object
Properties
NameTypeDescription
detectShellsfunction

Local shells found on this machine.

browseDirfunction

Pick a start directory (dialog); null if cancelled.

browseKeyfunction

Pick a private-key file (dialog); null if cancelled.

openfunction

Open a session and wire it to the terminal.

closefunction

Dispose the active session.

profilesProfilesAPI

Saved-session persistence.

onOpenProfilefunction

Register a callback invoked with a saved-session name when the app is asked to open one (Windows jump-list entry or --open-profile launch argument). An early request that arrives before the renderer listens is buffered and delivered as soon as the callback is registered.

WindowAPI

Frameless title-bar controls.

Type:
  • object
Properties
NameTypeDescription
setTitleBarThemefunction

Recolour the native window-control overlay for the dark (true) or light theme.