MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / constructor

Method constructor

src/workspaces/persistent-session.ts:112–134  ·  view source on GitHub ↗
(opts: PersistentSessionOptions)

Source from the content-addressed store, hash-verified

110 private exitWaiters: Set<(info: { code: number; signal: number | null }) => void> = new Set();
111
112 constructor(opts: PersistentSessionOptions) {
113 this.opts = opts;
114 this.log = opts.logger.child({
115 wsId: opts.wsId,
116 recordId: opts.recordId,
117 name: opts.name,
118 });
119 this.buffer = new ReplayBuffer(opts.replayBufferBytes);
120 if (opts.initialReplayBytes && opts.initialReplayBytes.length > 0) {
121 // Seed the buffer so the very first WebSocket attach replays this as
122 // scrollback. Subsequent PTY output appends below.
123 this.buffer.append(opts.initialReplayBytes);
124 }
125 this.currentCols = clamp(opts.initialCols, 1, MAX_DIM);
126 this.currentRows = clamp(opts.initialRows, 1, MAX_DIM);
127
128 this.term = this.spawnChild();
129 this.log.info('session.spawned', {
130 pid: this.term.pid,
131 command: opts.command,
132 cwd: opts.cwd,
133 });
134 }
135
136 private spawnChild(): pty.IPty {
137 if (this.opts.command.length === 0) {

Callers

nothing calls this directly

Calls 5

spawnChildMethod · 0.95
childMethod · 0.80
infoMethod · 0.80
clampFunction · 0.70
appendMethod · 0.65

Tested by

no test coverage detected