Session manager — the PuTTY-style session config & lifecycle for nero-terminal, in the main process.
Opens either a remote SSH session (SshHost / ssh2) or a local shell (PtyHost / node-pty); both implement the same host interface, so the same terminal-lib IPC bridge (attachPtyToIpc) serves either backend. Also detects local shells and persists "Saved Sessions" to userData/sessions.json.
Extracted from module:main/main so it can be exercised headlessly by scripts/session-smoke.js.
Methods
(inner) buildJumpList(execPath, profiles, iconPathopt) → {Array.<object>}
Build a Windows taskbar jump list from saved session profiles, for app.setJumpList(). Each entry relaunches the app with --open-profile="<name>" so the running instance opens that saved session. Returns an empty array when there are no profiles (which clears the list).
| Name | Type | Attributes | Description |
|---|---|---|---|
execPath | string | Path to the app executable ( | |
profiles | Array.<SessionProfile> | Saved profiles to list. | |
iconPath | string | <optional> | Icon shown for each jump-list entry. |
Categories for app.setJumpList().
- Type:
- Array.<object>
(inner) createSessionManager(deps) → {SessionManager}
Create a session manager bound to a single window. Holds at most one live session (a host + its IPC bridge) at a time.
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deps | object | Properties
|
- Type:
- SessionManager
(inner) detectShells() → {Array.<ShellDescriptor>}
Detect the local shells available on this machine (for the "Local" connection type). On Windows: PowerShell, pwsh 7 (if present), Command Prompt, WSL (if present), Git Bash (if present). Elsewhere: $SHELL plus common alternatives.
- Type:
- Array.<ShellDescriptor>
(inner) firstExisting(paths) → {string|null}
Return the first path in paths that exists, else null.
| Name | Type | Description |
|---|---|---|
paths | Array.<string> |
- Type:
- string |
null
Type Definitions
SessionManager
The object returned by createSessionManager.
- object
| Name | Type | Description |
|---|---|---|
register | function | Register all |
openSession | function | Open a session directly (used by smokes). |
closeSession | function | Dispose the active session. |
detectShells | function | |
loadProfiles | function | Read the saved profiles. |
SessionOptions
Options accepted by openSession (and window.sessionAPI.open).
- object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
type | 'ssh' | | <optional> | 'ssh' | Connection type. |
cols | number | <optional> | 120 | |
rows | number | <optional> | 32 | |
host | string | <optional> | SSH: host name or IP. | |
port | number | <optional> | 22 | SSH: port. |
username | string | <optional> | SSH: login user (else prompted in-terminal). | |
password | string | <optional> | SSH: password (else prompted in-terminal). | |
keyPath | string | <optional> | SSH: path to a private key file, read by main. | |
passphrase | string | <optional> | SSH: key passphrase. | |
term | string | <optional> | 'xterm-256color' | SSH: TERM string. |
shell | string | <optional> | Local: executable to spawn. | |
args | Array.<string> | <optional> | Local: shell arguments. | |
cwd | string | <optional> | Local: working directory (defaults to home). | |
env | Object.<string, string> | <optional> | Local: extra environment variables. |
SessionProfile
A saved session (PuTTY "Saved Sessions"). A superset of SessionOptions plus presentation fields; secrets (password, passphrase) are never persisted.
- object
| Name | Type | Attributes | Description |
|---|---|---|---|
name | string | ||
type | 'ssh' | | ||
host | string | <optional> | |
port | number | <optional> | |
username | string | <optional> | |
keyPath | string | <optional> | |
shellId | string | <optional> | |
cols | number | <optional> | |
rows | number | <optional> | |
scrollback | number | <optional> | |
fontFamily | string | <optional> | |
fontSize | number | <optional> | |
theme | string | <optional> |
SessionResult
Result of openSession.
- object
| Name | Type | Description |
|---|---|---|
pid | number | | OS process id for a local PTY; |
type | 'ssh' | | The connection type that was opened. |
ShellDescriptor
A local shell offered under the "Local" connection type.
- object
| Name | Type | Description |
|---|---|---|
id | string | Stable identifier (e.g. |
label | string | Human-readable name shown in the dropdown. |
shell | string | Executable to spawn. |
args | Array.<string> | Default arguments for that shell. |