Skip to content

Class: PtyFramedInteractiveSession ​

Defined in: node/src/executors/internal/pty-framed-session.ts:40

Stateful ECHO-disabled OS pseudo-terminal session managing framed turn-based CLI communication (local.daemon.interact).

Spawns the interactive command inside a real node-pty pseudo-terminal (xterm-256color, 120x40) with terminal ECHO disabled (stty -echo), drains the initial startup banner until frameDelimiter matches and output settles for idleSettleMs, and serializes concurrent turns via PQueue({ concurrency: 1 }).

Constructors ​

Constructor ​

ts
new PtyFramedInteractiveSession(options): PtyFramedInteractiveSession;

Defined in: node/src/executors/internal/pty-framed-session.ts:75

Initializes a PtyFramedInteractiveSession with its command and framing configuration.

Pre-compiles the frame delimiter regular expression when configured as a regex descriptor.

Parameters ​

ParameterTypeDescription
optionsPtyFramedSessionOptionsInteractive command, delimiter, settle, and timeout options.

Returns ​

PtyFramedInteractiveSession

Methods ​

close() ​

ts
close(): Promise<void>;

Defined in: node/src/executors/internal/pty-framed-session.ts:116

Terminates the underlying node-pty pseudo-terminal and its descendant process tree.

Disposes PTY listeners, kills the PTY master/child, and reaps any surviving descendants via pidtree + fkill.

Returns ​

Promise<void>

Resolves once the interactive PTY process tree has exited.


sendTurn() ​

ts
sendTurn(input, signal?): Promise<string>;

Defined in: node/src/executors/internal/pty-framed-session.ts:99

Enqueues and executes a single serialized interactive turn on the PTY session via PQueue.

Lazily spawns the PTY process and drains its startup banner on the first turn, writes ${input}\n, and resolves once frameDelimiter matches and output settles for idleSettleMs.

Parameters ​

ParameterTypeDescription
inputstringCommand line input to send to the interactive PTY process.
signal?AbortSignalOptional abort signal cancelling the turn.

Returns ​

Promise<string>

Settled output frame with the trailing prompt delimiter stripped.

Throws ​

If signal aborts, the PTY process exits prematurely, or the turn times out.

Released under the MIT License.