@moxxy/plugin-terminal 0.41.3 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pty.d.ts +19 -1
- package/dist/pty.d.ts.map +1 -1
- package/dist/pty.js +52 -7
- package/dist/pty.js.map +1 -1
- package/dist/shell-hooks.d.ts +37 -0
- package/dist/shell-hooks.d.ts.map +1 -0
- package/dist/shell-hooks.js +113 -0
- package/dist/shell-hooks.js.map +1 -0
- package/dist/terminal.d.ts +9 -8
- package/dist/terminal.d.ts.map +1 -1
- package/dist/terminal.js +146 -24
- package/dist/terminal.js.map +1 -1
- package/package.json +4 -4
- package/src/pty.test.ts +6 -4
- package/src/pty.ts +60 -6
- package/src/shell-hooks.test.ts +65 -0
- package/src/shell-hooks.ts +139 -0
- package/src/terminal.shell.test.ts +182 -0
- package/src/terminal.test.ts +200 -2
- package/src/terminal.ts +161 -28
package/dist/terminal.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { randomBytes } from 'node:crypto';
|
|
2
|
-
import {
|
|
2
|
+
import { rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { defineSurface, defineTool, waitFor, z } from '@moxxy/sdk';
|
|
3
6
|
import { createTerminalProcess } from './pty.js';
|
|
4
7
|
/**
|
|
5
8
|
* Shared terminal processes, keyed by cwd. The surface and the `terminal` tool
|
|
@@ -186,11 +189,11 @@ const terminalInputSchema = z.object({
|
|
|
186
189
|
.describe('Max time to wait for the command to finish (default 30s).'),
|
|
187
190
|
});
|
|
188
191
|
/**
|
|
189
|
-
* The `terminal` tool runs a command in the SHARED terminal the user sees
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* can take over at any time.
|
|
192
|
+
* The `terminal` tool runs a command in the SHARED terminal the user sees and
|
|
193
|
+
* reads its output until the shell is back at its prompt. zsh and bash report
|
|
194
|
+
* that themselves (shell-hooks.ts); any other shell is typed a unique sentinel
|
|
195
|
+
* that echoes the exit code. The command and its output stay visible to the
|
|
196
|
+
* user, who can take over at any time.
|
|
194
197
|
*/
|
|
195
198
|
export function buildTerminalTool() {
|
|
196
199
|
return defineTool({
|
|
@@ -264,9 +267,30 @@ const MAX_ACC = 1_000_000;
|
|
|
264
267
|
*/
|
|
265
268
|
const commandTails = new WeakMap();
|
|
266
269
|
/**
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
|
|
270
|
+
* How long a starting shell gets to show its first prompt before its commands
|
|
271
|
+
* are typed with a sentinel instead (its own start files replaced the hook).
|
|
272
|
+
*/
|
|
273
|
+
const PROMPT_REPORT_DEADLINE_MS = 5_000;
|
|
274
|
+
/** Shells that showed no prompt before the deadline: their later commands do not wait for one again. */
|
|
275
|
+
const silent = new WeakSet();
|
|
276
|
+
/** Resolves once the shell has shown a prompt; false when it reports none in time. */
|
|
277
|
+
async function reportsPrompt(proc, prompt, signal) {
|
|
278
|
+
if (silent.has(proc))
|
|
279
|
+
return false;
|
|
280
|
+
const outcome = await waitFor(() => (prompt.seen ? true : undefined), {
|
|
281
|
+
wakeOn: [(wake) => prompt.onPrompt(wake)],
|
|
282
|
+
timeoutMs: PROMPT_REPORT_DEADLINE_MS,
|
|
283
|
+
signal,
|
|
284
|
+
});
|
|
285
|
+
if (outcome.status === 'timeout')
|
|
286
|
+
silent.add(proc);
|
|
287
|
+
return outcome.status === 'ready';
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Write `command` to a shared shell and collect output until the shell reports
|
|
291
|
+
* its prompt, or, in a shell that reports none, until the sentinel `printf`
|
|
292
|
+
* typed after the command prints. Returns the captured output (best-effort
|
|
293
|
+
* stripped of the echoed command) + the exit code.
|
|
270
294
|
*
|
|
271
295
|
* Serialized per shared process: a command writes only once the previous one on
|
|
272
296
|
* the same shell finishes, so concurrent callers never interleave their writes
|
|
@@ -300,16 +324,32 @@ signal) {
|
|
|
300
324
|
return new Promise((resolve) => {
|
|
301
325
|
let acc = '';
|
|
302
326
|
let settled = false;
|
|
327
|
+
let typed;
|
|
303
328
|
const finish = (exitCode, timedOut) => {
|
|
304
329
|
if (settled)
|
|
305
330
|
return;
|
|
306
331
|
settled = true;
|
|
307
332
|
unsubData();
|
|
308
333
|
unsubExit();
|
|
334
|
+
unsubPrompt();
|
|
309
335
|
clearTimeout(timer);
|
|
310
336
|
if (onAbort)
|
|
311
337
|
signal?.removeEventListener('abort', onAbort);
|
|
312
|
-
|
|
338
|
+
typed?.remove();
|
|
339
|
+
const output = cleanOutput(acc, `${command}\n${typed?.line ?? ''}`, marker);
|
|
340
|
+
const waiting = timedOut ? unfinishedPrompt(acc) : undefined;
|
|
341
|
+
if (waiting === undefined) {
|
|
342
|
+
resolve({ output, exitCode, timedOut });
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
// The shell sits at a continuation prompt (`heredoc>`): every later command
|
|
346
|
+
// would be swallowed as more of this one. Ctrl-C drops only that input.
|
|
347
|
+
proc.write('\u0003');
|
|
348
|
+
resolve({
|
|
349
|
+
output: `${output}\n[the shell was waiting for the rest of an unfinished command (${waiting}); cancelled it with Ctrl-C]`,
|
|
350
|
+
exitCode,
|
|
351
|
+
timedOut,
|
|
352
|
+
});
|
|
313
353
|
};
|
|
314
354
|
// Already aborted before we even start? Finish immediately — don't write to
|
|
315
355
|
// the shell, don't arm a timeout. The command never runs; null exit.
|
|
@@ -389,14 +429,18 @@ signal) {
|
|
|
389
429
|
// immediately with the shell's exit code rather than hanging to the full
|
|
390
430
|
// timeout (up to 600s) on a known-dead process.
|
|
391
431
|
const unsubExit = proc.onExit((code) => finish(code, false));
|
|
432
|
+
let unsubPrompt = () => { };
|
|
392
433
|
let timer;
|
|
393
434
|
// Two writes to the interactive shell: the command, then the sentinel whose
|
|
394
435
|
// $? reflects the command's exit. A leading newline before the printf
|
|
395
436
|
// terminates any dangling/unterminated command line (trailing backslash,
|
|
396
437
|
// unbalanced quote) so the sentinel is always emitted rather than consumed
|
|
397
|
-
// as a continuation — otherwise such a command would always time out.
|
|
398
|
-
//
|
|
399
|
-
|
|
438
|
+
// as a continuation — otherwise such a command would always time out. The
|
|
439
|
+
// printf starts its own output with a newline too: shell hooks (zsh
|
|
440
|
+
// `preexec` setting the window title) print right before it, and the
|
|
441
|
+
// sentinel is only recognized at the start of a line. On a non-PTY pipe the
|
|
442
|
+
// shell still runs both sequentially.
|
|
443
|
+
const writeAndArm = (hooked) => {
|
|
400
444
|
if (settled)
|
|
401
445
|
return; // shell died (or we were torn down) before our turn
|
|
402
446
|
// The shell is ALREADY dead at write time (it exited before our turn, or
|
|
@@ -410,18 +454,98 @@ signal) {
|
|
|
410
454
|
return;
|
|
411
455
|
}
|
|
412
456
|
timer = setTimeout(() => finish(null, true), timeoutMs);
|
|
413
|
-
|
|
414
|
-
|
|
457
|
+
typed = typeable(command, marker);
|
|
458
|
+
if (hooked && proc.prompt) {
|
|
459
|
+
// Nothing follows the command on the terminal's input, where the
|
|
460
|
+
// program it starts could read it: the shell says when it is done. A
|
|
461
|
+
// prompt drawn again for anything else (an empty Enter, a Ctrl-C, the
|
|
462
|
+
// end of a command the user typed) started no command since, so it is
|
|
463
|
+
// not this one's; a blank line starts none, and any prompt ends it.
|
|
464
|
+
const before = proc.prompt.commands;
|
|
465
|
+
const blank = command.trim() === '';
|
|
466
|
+
unsubPrompt = proc.prompt.onPrompt((exitCode, commands) => {
|
|
467
|
+
if (blank || commands > before)
|
|
468
|
+
finish(exitCode, false);
|
|
469
|
+
});
|
|
470
|
+
proc.write(`${typed.line}\n`);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
proc.write(`${typed.line}\n`);
|
|
474
|
+
proc.write(`\n${sentinelPrintf(marker)}\n`);
|
|
475
|
+
};
|
|
476
|
+
// A shell with no prompt report, or one that has shown its prompt already,
|
|
477
|
+
// is decided on the spot, which keeps the single-command path synchronous.
|
|
478
|
+
const start = () => {
|
|
479
|
+
if (!proc.prompt || proc.prompt.seen)
|
|
480
|
+
writeAndArm(proc.prompt !== undefined);
|
|
481
|
+
else
|
|
482
|
+
void reportsPrompt(proc, proc.prompt, signal).then(writeAndArm);
|
|
415
483
|
};
|
|
416
|
-
// Idle shell → write now
|
|
417
|
-
//
|
|
418
|
-
//
|
|
484
|
+
// Idle shell → write now. Busy shell → wait our turn; the timeout clock only
|
|
485
|
+
// starts when we write, so a command queued behind a slow predecessor
|
|
486
|
+
// doesn't burn its budget waiting.
|
|
419
487
|
if (startWrites)
|
|
420
|
-
void startWrites.then(
|
|
488
|
+
void startWrites.then(start);
|
|
421
489
|
else
|
|
422
|
-
|
|
490
|
+
start();
|
|
423
491
|
});
|
|
424
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* A terminal takes typed input through a buffer of about a kilobyte, and the
|
|
495
|
+
* shell redraws the line as each character arrives. A long or multi-line
|
|
496
|
+
* command typed in can lose characters, and a lost heredoc end line leaves the
|
|
497
|
+
* shell waiting forever. Such a command goes to a file the shell sources, so
|
|
498
|
+
* only one short line is typed and what it changes (cd, exports) stays, as if
|
|
499
|
+
* typed. Windows shells keep the typed form: `.` sourcing is POSIX.
|
|
500
|
+
*/
|
|
501
|
+
const TYPED_LIMIT = 512;
|
|
502
|
+
function typeable(command, marker) {
|
|
503
|
+
// A trailing backslash joins the next typed line to the command; in a file it ends with it.
|
|
504
|
+
const oneShortLine = !command.includes('\n') && command.length <= TYPED_LIMIT && !command.endsWith('\\');
|
|
505
|
+
if (process.platform === 'win32' || oneShortLine) {
|
|
506
|
+
return { line: command, remove: () => { } };
|
|
507
|
+
}
|
|
508
|
+
const file = join(tmpdir(), `moxxy-command-${marker}.sh`);
|
|
509
|
+
writeFileSync(file, `${command}\n`, { mode: 0o600 });
|
|
510
|
+
return {
|
|
511
|
+
line: `. '${file.replace(/'/g, `'\\''`)}'`,
|
|
512
|
+
remove: () => rmSync(file, { force: true }),
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
/** zsh's continuation prompt (`heredoc> `, `dquote> `, `for if> `) as the last line shown. */
|
|
516
|
+
const CONTINUATION_PROMPT = /^((?:[a-z]+ )*[a-z]+)>$/u;
|
|
517
|
+
function unfinishedPrompt(raw) {
|
|
518
|
+
const last = plainText(raw).split('\n').filter((line) => line.trim() !== '').at(-1) ?? '';
|
|
519
|
+
return CONTINUATION_PROMPT.exec(last.trimEnd())?.[1];
|
|
520
|
+
}
|
|
521
|
+
/** The shell command that prints `<marker> <exit code>` on a line of its own. */
|
|
522
|
+
function sentinelPrintf(marker) {
|
|
523
|
+
return `printf '\\n%s %s\\n' "${marker}" "$?"`;
|
|
524
|
+
}
|
|
525
|
+
// Terminal control sequences an interactive shell mixes into its output: OSC
|
|
526
|
+
// (window title, cwd), CSI (colors, cursor, bracketed paste) and the remaining
|
|
527
|
+
// two-byte escapes (keypad mode).
|
|
528
|
+
const CONTROL_SEQUENCE = /\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)|\u001b\[[0-?]*[ -/]*[@-~]|\u001b[ -/]*[0-~]/gu;
|
|
529
|
+
const OVERSTRUCK = /[^\n\u0008]\u0008/gu;
|
|
530
|
+
/**
|
|
531
|
+
* What the terminal shows as text: control sequences dropped, backspaced
|
|
532
|
+
* characters erased, and a line rewritten after a carriage return (a prompt
|
|
533
|
+
* redraw, a progress bar) reduced to what it ends up as.
|
|
534
|
+
*/
|
|
535
|
+
function plainText(raw) {
|
|
536
|
+
let text = raw.replace(CONTROL_SEQUENCE, '');
|
|
537
|
+
for (let before = ''; before !== text;) {
|
|
538
|
+
before = text;
|
|
539
|
+
text = text.replace(OVERSTRUCK, '');
|
|
540
|
+
}
|
|
541
|
+
return text
|
|
542
|
+
.split('\n')
|
|
543
|
+
.map((line) => {
|
|
544
|
+
const shown = line.replace(/\r+$/u, '');
|
|
545
|
+
return shown.slice(shown.lastIndexOf('\r') + 1);
|
|
546
|
+
})
|
|
547
|
+
.join('\n');
|
|
548
|
+
}
|
|
425
549
|
/** Strip the echoed command + sentinel lines so the model sees just the output. */
|
|
426
550
|
function cleanOutput(acc, command, marker) {
|
|
427
551
|
// A multi-line command is echoed by an echo-on PTY one line at a time; none of
|
|
@@ -431,11 +555,9 @@ function cleanOutput(acc, command, marker) {
|
|
|
431
555
|
.split('\n')
|
|
432
556
|
.map((l) => l.trim())
|
|
433
557
|
.filter((l) => l.length > 0));
|
|
434
|
-
return acc
|
|
558
|
+
return plainText(acc)
|
|
435
559
|
.split('\n')
|
|
436
|
-
.filter((line) => !line.includes(marker) &&
|
|
437
|
-
!commandLines.has(line.trim()) &&
|
|
438
|
-
!line.includes(`printf '%s %s\\n' "${marker}"`))
|
|
560
|
+
.filter((line) => !line.includes(marker) && !commandLines.has(line.trim()))
|
|
439
561
|
.join('\n')
|
|
440
562
|
.trim();
|
|
441
563
|
}
|
package/dist/terminal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../src/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,EAAwB,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAwB,MAAM,UAAU,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;AAClD;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoC,CAAC;AAC5D;;;;;;;;;;;;;;GAcG;AACH,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,GAAW,EACX,SAAoD,qBAAqB;IAEzE,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK;QAAE,OAAO,QAAQ,CAAC;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V,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxxy/plugin-terminal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "A shared terminal surface for moxxy: an embedded PTY the user and the agent drive together (the `terminal` tool runs commands; the desktop renders the live session).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"moxxy",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@moxxy/sdk": "0.
|
|
45
|
+
"@moxxy/sdk": "0.42.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"node-pty": "^1.0.0"
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/node": "^22.
|
|
56
|
+
"@types/node": "^22.20.5",
|
|
57
57
|
"typescript": "^6.0.3",
|
|
58
|
-
"vitest": "^
|
|
58
|
+
"vitest": "^5.0.3",
|
|
59
59
|
"@moxxy/vitest-preset": "0.0.0",
|
|
60
60
|
"@moxxy/tsconfig": "0.0.0"
|
|
61
61
|
},
|
package/src/pty.test.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { mkdtempSync,
|
|
2
|
+
import { mkdtempSync, statSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { posixFileModes } from '@moxxy/vitest-preset/platform';
|
|
6
7
|
import { makeExecutable, resolveNodePtyModule, TerminalProcessImpl } from './pty.js';
|
|
8
|
+
import { removeDirSync } from '@moxxy/vitest-preset/fs';
|
|
7
9
|
|
|
8
10
|
const MAX_SCROLLBACK = 200_000;
|
|
9
11
|
|
|
@@ -64,11 +66,11 @@ describe('resolveNodePtyModule (degrade on a malformed optional dep)', () => {
|
|
|
64
66
|
describe('makeExecutable (node-pty spawn-helper repair)', () => {
|
|
65
67
|
let dir: string | null = null;
|
|
66
68
|
afterEach(() => {
|
|
67
|
-
if (dir)
|
|
69
|
+
if (dir) removeDirSync(dir);
|
|
68
70
|
dir = null;
|
|
69
71
|
});
|
|
70
72
|
|
|
71
|
-
it('adds the executable bit to a file that lacks it', () => {
|
|
73
|
+
it.skipIf(!posixFileModes)('adds the executable bit to a file that lacks it', () => {
|
|
72
74
|
dir = mkdtempSync(join(tmpdir(), 'moxxy-pty-'));
|
|
73
75
|
const file = join(dir, 'spawn-helper');
|
|
74
76
|
writeFileSync(file, 'binary');
|
|
@@ -80,7 +82,7 @@ describe('makeExecutable (node-pty spawn-helper repair)', () => {
|
|
|
80
82
|
expect(statSync(file).mode & 0o111).not.toBe(0);
|
|
81
83
|
});
|
|
82
84
|
|
|
83
|
-
it('is idempotent on an already-executable file', () => {
|
|
85
|
+
it.skipIf(!posixFileModes)('is idempotent on an already-executable file', () => {
|
|
84
86
|
dir = mkdtempSync(join(tmpdir(), 'moxxy-pty-'));
|
|
85
87
|
const file = join(dir, 'spawn-helper');
|
|
86
88
|
writeFileSync(file, 'binary', { mode: 0o755 });
|
package/src/pty.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { type ChildProcessWithoutNullStreams, spawn } from 'node:child_process';
|
|
|
19
19
|
import { chmodSync, existsSync, statSync } from 'node:fs';
|
|
20
20
|
import { createRequire } from 'node:module';
|
|
21
21
|
import * as nodePath from 'node:path';
|
|
22
|
+
import { ShellMarks, installShellHooks, type ShellHooks } from './shell-hooks.js';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Upper bound on output/exit listeners on a single shared process. A surface
|
|
@@ -184,8 +185,20 @@ function clampDimension(n: number): number {
|
|
|
184
185
|
|
|
185
186
|
export type TerminalBackend = 'pty' | 'pipe';
|
|
186
187
|
|
|
188
|
+
/** A shell that reports its commands and each return to its prompt (see shell-hooks.ts). */
|
|
189
|
+
export interface PromptSignal {
|
|
190
|
+
/** False until the shell has shown its first prompt: it is still starting. */
|
|
191
|
+
readonly seen: boolean;
|
|
192
|
+
/** How many commands the shell has started, the one running now included. */
|
|
193
|
+
readonly commands: number;
|
|
194
|
+
/** Called each time the prompt is back, with the last command's exit code and that count. */
|
|
195
|
+
onPrompt(cb: (exitCode: number, commands: number) => void): () => void;
|
|
196
|
+
}
|
|
197
|
+
|
|
187
198
|
export interface TerminalProcess {
|
|
188
199
|
readonly backend: TerminalBackend;
|
|
200
|
+
/** Absent for a shell that cannot report its prompt (cmd, PowerShell, fish). */
|
|
201
|
+
readonly prompt?: PromptSignal;
|
|
189
202
|
/** When `backend === 'pipe'`, the reason the real PTY couldn't start (so the
|
|
190
203
|
* surface can show an honest "degraded" status instead of a silently-dead
|
|
191
204
|
* box). Null when a real PTY is in use. */
|
|
@@ -207,6 +220,11 @@ export interface TerminalProcess {
|
|
|
207
220
|
export class TerminalProcessImpl implements TerminalProcess {
|
|
208
221
|
private readonly dataListeners = new Set<(d: string) => void>();
|
|
209
222
|
private readonly exitListeners = new Set<(c: number) => void>();
|
|
223
|
+
private readonly promptListeners = new Set<(exitCode: number, commands: number) => void>();
|
|
224
|
+
private readonly marks: ShellMarks | null;
|
|
225
|
+
private promptSeen = false;
|
|
226
|
+
private commands = 0;
|
|
227
|
+
readonly prompt?: PromptSignal;
|
|
210
228
|
private buffer = '';
|
|
211
229
|
private warnedListenerLeak = false;
|
|
212
230
|
alive = true;
|
|
@@ -216,7 +234,25 @@ export class TerminalProcessImpl implements TerminalProcess {
|
|
|
216
234
|
private readonly pty: NodePtyProcess | null,
|
|
217
235
|
private readonly child: ChildProcessWithoutNullStreams | null,
|
|
218
236
|
readonly ptyError: string | null = null,
|
|
237
|
+
private readonly hooks: ShellHooks | null = null,
|
|
219
238
|
) {
|
|
239
|
+
this.marks = hooks ? new ShellMarks(hooks.key) : null;
|
|
240
|
+
if (hooks) {
|
|
241
|
+
const seen = (): boolean => this.promptSeen;
|
|
242
|
+
const commands = (): number => this.commands;
|
|
243
|
+
this.prompt = {
|
|
244
|
+
get seen() {
|
|
245
|
+
return seen();
|
|
246
|
+
},
|
|
247
|
+
get commands() {
|
|
248
|
+
return commands();
|
|
249
|
+
},
|
|
250
|
+
onPrompt: (cb) => {
|
|
251
|
+
this.promptListeners.add(cb);
|
|
252
|
+
return () => this.promptListeners.delete(cb);
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
}
|
|
220
256
|
if (pty) {
|
|
221
257
|
pty.onData((d) => this.emitData(d));
|
|
222
258
|
pty.onExit((e) => this.emitExit(e.exitCode));
|
|
@@ -273,11 +309,26 @@ export class TerminalProcessImpl implements TerminalProcess {
|
|
|
273
309
|
/* a bad viewer must not break the stream */
|
|
274
310
|
}
|
|
275
311
|
}
|
|
312
|
+
// After the data listeners, so a command's reader holds its last output
|
|
313
|
+
// before it learns the prompt is back.
|
|
314
|
+
for (const report of this.marks?.read(d) ?? []) {
|
|
315
|
+
this.commands = report.commands;
|
|
316
|
+
if (report.exitCode === null) continue;
|
|
317
|
+
this.promptSeen = true;
|
|
318
|
+
for (const cb of [...this.promptListeners]) {
|
|
319
|
+
try {
|
|
320
|
+
cb(report.exitCode, report.commands);
|
|
321
|
+
} catch {
|
|
322
|
+
/* ignore */
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
276
326
|
}
|
|
277
327
|
|
|
278
328
|
private emitExit(code: number): void {
|
|
279
329
|
if (!this.alive) return;
|
|
280
330
|
this.alive = false;
|
|
331
|
+
this.hooks?.remove();
|
|
281
332
|
for (const cb of this.exitListeners) {
|
|
282
333
|
try {
|
|
283
334
|
cb(code);
|
|
@@ -404,21 +455,24 @@ export async function createTerminalProcess(cwd: string): Promise<TerminalProces
|
|
|
404
455
|
// strip vars here (it would silently break legitimate commands); gate any
|
|
405
456
|
// scrubbing behind an explicit opt-in if ever needed.
|
|
406
457
|
const env: NodeJS.ProcessEnv = { ...process.env, TERM: 'xterm-256color' };
|
|
458
|
+
const hooks = installShellHooks(shell, env);
|
|
459
|
+
const shellArgs = hooks ? hooks.args : [];
|
|
460
|
+
const shellEnv = hooks ? hooks.env : env;
|
|
407
461
|
const pty = await loadNodePty();
|
|
408
462
|
let ptyError: string | null = pty ? null : 'node-pty is not installed';
|
|
409
463
|
if (pty) {
|
|
410
464
|
const trySpawn = (): NodePtyProcess =>
|
|
411
|
-
pty.spawn(shell,
|
|
465
|
+
pty.spawn(shell, shellArgs, { name: 'xterm-256color', cols, rows, cwd, env: shellEnv });
|
|
412
466
|
// Make sure the prebuilt spawn-helper is executable, then spawn. If the first
|
|
413
467
|
// spawn still fails (e.g. the bit was only just lost), repair + retry ONCE
|
|
414
468
|
// before giving up — most "posix_spawnp failed" cases clear on the retry.
|
|
415
469
|
ensureSpawnHelperExecutable();
|
|
416
470
|
try {
|
|
417
|
-
return new TerminalProcessImpl('pty', trySpawn(), null);
|
|
471
|
+
return new TerminalProcessImpl('pty', trySpawn(), null, null, hooks);
|
|
418
472
|
} catch {
|
|
419
473
|
ensureSpawnHelperExecutable();
|
|
420
474
|
try {
|
|
421
|
-
return new TerminalProcessImpl('pty', trySpawn(), null);
|
|
475
|
+
return new TerminalProcessImpl('pty', trySpawn(), null, null, hooks);
|
|
422
476
|
} catch (err2) {
|
|
423
477
|
// Don't swallow it: record WHY so the surface can show an honest status
|
|
424
478
|
// instead of a silently-dead piped terminal.
|
|
@@ -432,15 +486,15 @@ export async function createTerminalProcess(cwd: string): Promise<TerminalProces
|
|
|
432
486
|
// viewer's `\r` is never turned into `\n`, nothing echoes), so it is NOT a
|
|
433
487
|
// usable interactive terminal — `ptyError` is surfaced to the user so the pane
|
|
434
488
|
// reports the degraded state rather than appearing to ignore every keystroke.
|
|
435
|
-
const args = process.platform === 'win32' ? [] : ['-i'];
|
|
489
|
+
const args = process.platform === 'win32' ? [] : [...shellArgs, '-i'];
|
|
436
490
|
const child = spawn(shell, args, {
|
|
437
491
|
cwd,
|
|
438
|
-
env: { ...
|
|
492
|
+
env: { ...shellEnv, PS1: '$ ' },
|
|
439
493
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
440
494
|
// Own process group (POSIX) so kill() can signal the WHOLE tree by negative
|
|
441
495
|
// pid — otherwise grandchildren (a dev server, a `tail -f`, a build) outlive
|
|
442
496
|
// the session. No-op semantics on Windows; node-pty handles its own tree.
|
|
443
497
|
detached: process.platform !== 'win32',
|
|
444
498
|
});
|
|
445
|
-
return new TerminalProcessImpl('pipe', null, child, ptyError);
|
|
499
|
+
return new TerminalProcessImpl('pipe', null, child, ptyError, hooks);
|
|
446
500
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { ShellMarks, installShellHooks, shellMark } from './shell-hooks.js';
|
|
5
|
+
|
|
6
|
+
describe('ShellMarks', () => {
|
|
7
|
+
it('reads every report in a chunk: a command started, then the prompt back with its exit code', () => {
|
|
8
|
+
const marks = new ShellMarks('k1');
|
|
9
|
+
const stream = `~ % ls\n${shellMark('k1', { commands: 3, exitCode: null })}a.txt\n${shellMark('k1', { commands: 3, exitCode: 127 })}`;
|
|
10
|
+
|
|
11
|
+
expect(marks.read(stream)).toEqual([
|
|
12
|
+
{ commands: 3, exitCode: null },
|
|
13
|
+
{ commands: 3, exitCode: 127 },
|
|
14
|
+
]);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('reads a report split across two chunks, once', () => {
|
|
18
|
+
const marks = new ShellMarks('k1');
|
|
19
|
+
const mark = shellMark('k1', { commands: 1, exitCode: 42 });
|
|
20
|
+
|
|
21
|
+
expect(marks.read(mark.slice(0, 9))).toEqual([]);
|
|
22
|
+
expect(marks.read(mark.slice(9))).toEqual([{ commands: 1, exitCode: 42 }]);
|
|
23
|
+
expect(marks.read('more output')).toEqual([]);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('ignores a report made with another key, so printed text cannot end a command', () => {
|
|
27
|
+
const marks = new ShellMarks('k1');
|
|
28
|
+
|
|
29
|
+
expect(marks.read(shellMark('guess', { commands: 9, exitCode: 0 }))).toEqual([]);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('installShellHooks', () => {
|
|
34
|
+
it('leaves a shell it has no start files for alone', () => {
|
|
35
|
+
expect(installShellHooks('/usr/bin/fish', {})).toBeNull();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it.skipIf(process.platform === 'win32')('starts zsh from its own start files, which run the user\'s', () => {
|
|
39
|
+
const hooks = installShellHooks('/bin/zsh', { ZDOTDIR: '/home/me/dots' });
|
|
40
|
+
if (!hooks) throw new Error('expected hooks for zsh');
|
|
41
|
+
try {
|
|
42
|
+
const dir = hooks.env['ZDOTDIR'] ?? '';
|
|
43
|
+
expect(dir).not.toBe('/home/me/dots');
|
|
44
|
+
expect(readFileSync(path.join(dir, '.zshenv'), 'utf8')).toContain("'/home/me/dots'");
|
|
45
|
+
expect(readFileSync(path.join(dir, '.zshrc'), 'utf8')).toContain(hooks.key);
|
|
46
|
+
expect(hooks.args).toEqual([]);
|
|
47
|
+
} finally {
|
|
48
|
+
hooks.remove();
|
|
49
|
+
}
|
|
50
|
+
expect(existsSync(hooks.env['ZDOTDIR'] ?? '')).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it.skipIf(process.platform === 'win32')('starts bash from an init file, which runs the user\'s', () => {
|
|
54
|
+
const hooks = installShellHooks('/bin/bash', {});
|
|
55
|
+
if (!hooks) throw new Error('expected hooks for bash');
|
|
56
|
+
try {
|
|
57
|
+
expect(hooks.args[0]).toBe('--init-file');
|
|
58
|
+
const init = readFileSync(hooks.args[1] ?? '', 'utf8');
|
|
59
|
+
expect(init).toContain('.bashrc');
|
|
60
|
+
expect(init).toContain(hooks.key);
|
|
61
|
+
} finally {
|
|
62
|
+
hooks.remove();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|