@monotykamary/localterm-server 2.66.8 → 2.66.10
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/agent-git-status.d.ts +3 -0
- package/dist/agent-git-status.d.ts.map +1 -0
- package/dist/agent-git-status.js +46 -0
- package/dist/agent-git-status.js.map +1 -0
- package/dist/agent-log-utils.d.ts +18 -0
- package/dist/agent-log-utils.d.ts.map +1 -0
- package/dist/agent-log-utils.js +123 -0
- package/dist/agent-log-utils.js.map +1 -0
- package/dist/agent-models.d.ts +4 -0
- package/dist/agent-models.d.ts.map +1 -0
- package/dist/agent-models.js +100 -0
- package/dist/agent-models.js.map +1 -0
- package/dist/agent-runner.d.ts +3 -5
- package/dist/agent-runner.d.ts.map +1 -1
- package/dist/agent-runner.js +8 -522
- package/dist/agent-runner.js.map +1 -1
- package/dist/agent-session-reader.d.ts +3 -0
- package/dist/agent-session-reader.d.ts.map +1 -0
- package/dist/agent-session-reader.js +113 -0
- package/dist/agent-session-reader.js.map +1 -0
- package/dist/build-pty-environment.d.ts +8 -0
- package/dist/build-pty-environment.d.ts.map +1 -0
- package/dist/build-pty-environment.js +44 -0
- package/dist/build-pty-environment.js.map +1 -0
- package/dist/caffeinate-automatic-detector.d.ts +57 -0
- package/dist/caffeinate-automatic-detector.d.ts.map +1 -0
- package/dist/caffeinate-automatic-detector.js +275 -0
- package/dist/caffeinate-automatic-detector.js.map +1 -0
- package/dist/caffeinate-battery-guard.d.ts +35 -0
- package/dist/caffeinate-battery-guard.d.ts.map +1 -0
- package/dist/caffeinate-battery-guard.js +190 -0
- package/dist/caffeinate-battery-guard.js.map +1 -0
- package/dist/caffeinate-manager.d.ts +5 -31
- package/dist/caffeinate-manager.d.ts.map +1 -1
- package/dist/caffeinate-manager.js +55 -400
- package/dist/caffeinate-manager.js.map +1 -1
- package/dist/cdp/cdp-client.d.ts +4 -70
- package/dist/cdp/cdp-client.d.ts.map +1 -1
- package/dist/cdp/cdp-client.js +58 -418
- package/dist/cdp/cdp-client.js.map +1 -1
- package/dist/cdp/cdp-connection.d.ts +72 -0
- package/dist/cdp/cdp-connection.d.ts.map +1 -0
- package/dist/cdp/cdp-connection.js +272 -0
- package/dist/cdp/cdp-connection.js.map +1 -0
- package/dist/cdp/constants.d.ts +6 -0
- package/dist/cdp/constants.d.ts.map +1 -0
- package/dist/cdp/constants.js +9 -0
- package/dist/cdp/constants.js.map +1 -0
- package/dist/cdp/target-registry.d.ts +41 -0
- package/dist/cdp/target-registry.d.ts.map +1 -0
- package/dist/cdp/target-registry.js +118 -0
- package/dist/cdp/target-registry.js.map +1 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -1
- package/dist/git-branch-metadata.d.ts +11 -0
- package/dist/git-branch-metadata.d.ts.map +1 -0
- package/dist/git-branch-metadata.js +85 -0
- package/dist/git-branch-metadata.js.map +1 -0
- package/dist/git-diff-cache.d.ts +13 -0
- package/dist/git-diff-cache.d.ts.map +1 -0
- package/dist/git-diff-cache.js +32 -0
- package/dist/git-diff-cache.js.map +1 -0
- package/dist/git-diff-parser.d.ts +15 -0
- package/dist/git-diff-parser.d.ts.map +1 -0
- package/dist/git-diff-parser.js +196 -0
- package/dist/git-diff-parser.js.map +1 -0
- package/dist/git-diff-service.d.ts +10 -0
- package/dist/git-diff-service.d.ts.map +1 -0
- package/dist/git-diff-service.js +395 -0
- package/dist/git-diff-service.js.map +1 -0
- package/dist/git-diff.d.ts +8 -41
- package/dist/git-diff.d.ts.map +1 -1
- package/dist/git-diff.js +5 -944
- package/dist/git-diff.js.map +1 -1
- package/dist/github-pr.d.ts +32 -0
- package/dist/github-pr.d.ts.map +1 -0
- package/dist/github-pr.js +266 -0
- package/dist/github-pr.js.map +1 -0
- package/dist/pi-binary-resolver.d.ts +6 -0
- package/dist/pi-binary-resolver.d.ts.map +1 -0
- package/dist/pi-binary-resolver.js +70 -0
- package/dist/pi-binary-resolver.js.map +1 -0
- package/dist/pi-rpc-client.d.ts +14 -0
- package/dist/pi-rpc-client.d.ts.map +1 -0
- package/dist/pi-rpc-client.js +87 -0
- package/dist/pi-rpc-client.js.map +1 -0
- package/dist/session-client-hub.d.ts +57 -0
- package/dist/session-client-hub.d.ts.map +1 -0
- package/dist/session-client-hub.js +435 -0
- package/dist/session-client-hub.js.map +1 -0
- package/dist/session-command-executor.d.ts +14 -0
- package/dist/session-command-executor.d.ts.map +1 -0
- package/dist/session-command-executor.js +207 -0
- package/dist/session-command-executor.js.map +1 -0
- package/dist/session-git-event-bridge.d.ts +16 -0
- package/dist/session-git-event-bridge.d.ts.map +1 -0
- package/dist/session-git-event-bridge.js +56 -0
- package/dist/session-git-event-bridge.js.map +1 -0
- package/dist/session-lifecycle-policy.d.ts +15 -0
- package/dist/session-lifecycle-policy.d.ts.map +1 -0
- package/dist/session-lifecycle-policy.js +105 -0
- package/dist/session-lifecycle-policy.js.map +1 -0
- package/dist/session-manager.d.ts +11 -42
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +72 -987
- package/dist/session-manager.js.map +1 -1
- package/dist/session-output-coordinator.d.ts +21 -0
- package/dist/session-output-coordinator.d.ts.map +1 -0
- package/dist/session-output-coordinator.js +134 -0
- package/dist/session-output-coordinator.js.map +1 -0
- package/dist/session-output-transport.d.ts +22 -0
- package/dist/session-output-transport.d.ts.map +1 -0
- package/dist/session-output-transport.js +160 -0
- package/dist/session-output-transport.js.map +1 -0
- package/dist/session.d.ts +0 -4
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +11 -258
- package/dist/session.js.map +1 -1
- package/dist/shell-hook-builder.d.ts +16 -0
- package/dist/shell-hook-builder.d.ts.map +1 -0
- package/dist/shell-hook-builder.js +230 -0
- package/dist/shell-hook-builder.js.map +1 -0
- package/package.json +1 -1
package/dist/session.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
|
-
import {
|
|
3
|
+
import { rmSync } from "node:fs";
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { spawn } from "node-pty";
|
|
7
|
-
import { ALT_SCREEN_FOREGROUND,
|
|
7
|
+
import { ALT_SCREEN_FOREGROUND, DEFAULT_COLS, DEFAULT_ROWS, HOOKED_SHELL_NAMES, MAX_NOTIFICATION_LENGTH, MAX_PENDING_PARSE_BYTES, SESSION_SCROLLBACK_REPLAY_BYTES, TERM_TYPE, } from "./constants.js";
|
|
8
8
|
// Titles are emitted on a dedicated `title` event so they travel as a separate
|
|
9
9
|
// WebSocket frame. We deliberately do NOT splice OSC sequences into the PTY
|
|
10
10
|
// output stream — doing so corrupts in-flight escape sequences from modern
|
|
11
11
|
// TUIs (e.g. Cursor Agent / Claude Code use DECSET 2026 synchronized output
|
|
12
12
|
// mode and any byte landing inside that frame breaks the parser state).
|
|
13
|
+
import { buildPtyEnvironment } from "./build-pty-environment.js";
|
|
13
14
|
import { ensureSpawnHelperExecutable } from "./ensure-spawn-helper-executable.js";
|
|
14
15
|
import { getDefaultShell } from "./default-shell.js";
|
|
15
|
-
import {
|
|
16
|
-
import { shellPathForUserShell } from "./utils/shell-path.js";
|
|
16
|
+
import { ShellHookBuilder } from "./shell-hook-builder.js";
|
|
17
17
|
import { formatWorkingDirectoryTitle } from "./utils/format-working-directory-title.js";
|
|
18
18
|
import { parseAltScreenFromChunk } from "./utils/parse-alt-screen.js";
|
|
19
19
|
import { parseOsc7FromChunk } from "./utils/parse-osc7.js";
|
|
@@ -91,45 +91,13 @@ export class Session extends EventEmitter {
|
|
|
91
91
|
this.id = randomUUID();
|
|
92
92
|
this.reportInitialCommandExit = Boolean(input.initialCommand);
|
|
93
93
|
this.shimsDir = input.shimsDir;
|
|
94
|
-
const env = {};
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// user-set ZDOTDIR (e.g. dotfiles managed via custom ZDOTDIR). ZDOTDIR
|
|
102
|
-
// takes priority over __LOCALTERM_ORIG_ZDOTDIR because it reflects the
|
|
103
|
-
// user's current environment.
|
|
104
|
-
const inheritedZdotdir = process.env.ZDOTDIR;
|
|
105
|
-
const inheritedOrigZdotdir = process.env.__LOCALTERM_ORIG_ZDOTDIR;
|
|
106
|
-
const userZdotdirFromEnv = inheritedZdotdir && !isLocaltermPath(inheritedZdotdir)
|
|
107
|
-
? inheritedZdotdir
|
|
108
|
-
: inheritedOrigZdotdir && !isLocaltermPath(inheritedOrigZdotdir)
|
|
109
|
-
? inheritedOrigZdotdir
|
|
110
|
-
: undefined;
|
|
111
|
-
for (const [key, value] of Object.entries(process.env)) {
|
|
112
|
-
if (denied.has(key))
|
|
113
|
-
continue;
|
|
114
|
-
if (typeof value === "string")
|
|
115
|
-
env[key] = value;
|
|
116
|
-
}
|
|
117
|
-
if (userZdotdirFromEnv)
|
|
118
|
-
env.__LOCALTERM_ORIG_ZDOTDIR = userZdotdirFromEnv;
|
|
119
|
-
else
|
|
120
|
-
delete env.__LOCALTERM_ORIG_ZDOTDIR;
|
|
121
|
-
// User shells bootstrap their own PATH via rc files; don't leak the daemon's.
|
|
122
|
-
env.PATH = shellPathForUserShell();
|
|
123
|
-
if (input.env) {
|
|
124
|
-
for (const [key, value] of Object.entries(input.env)) {
|
|
125
|
-
env[key] = value;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
env.TERM = TERM_TYPE;
|
|
129
|
-
env.COLORTERM = COLORTERM_VALUE;
|
|
130
|
-
env.LOCALTERM = LOCALTERM_VALUE;
|
|
131
|
-
env.LOCALTERM_SESSION_ID = this.id;
|
|
132
|
-
const [shellArgs, shellEnv] = this.prepareOsc7Hook(this.shellName, env);
|
|
94
|
+
const env = buildPtyEnvironment({ input, sessionId: this.id });
|
|
95
|
+
const shellHookBuilder = new ShellHookBuilder({
|
|
96
|
+
shimsDir: this.shimsDir,
|
|
97
|
+
reportInitialCommandExit: this.reportInitialCommandExit,
|
|
98
|
+
});
|
|
99
|
+
const [shellArgs, shellEnv] = shellHookBuilder.prepare(this.shellName, env);
|
|
100
|
+
this.hookCleanupPaths.push(...shellHookBuilder.hookCleanupPaths);
|
|
133
101
|
if (shellEnv) {
|
|
134
102
|
for (const [key, value] of Object.entries(shellEnv)) {
|
|
135
103
|
env[key] = value;
|
|
@@ -412,221 +380,6 @@ export class Session extends EventEmitter {
|
|
|
412
380
|
return false;
|
|
413
381
|
return tail.indexOf("\x07", 2) === -1 && tail.indexOf("\x1b\\", 2) === -1;
|
|
414
382
|
}
|
|
415
|
-
prepareOsc7Hook(shellName, env) {
|
|
416
|
-
const hookId = `${process.pid}-${Date.now()}`;
|
|
417
|
-
switch (shellName) {
|
|
418
|
-
case "zsh": {
|
|
419
|
-
const hookDir = path.join(os.tmpdir(), `localterm-zdot-${hookId}`);
|
|
420
|
-
mkdirSync(hookDir, { recursive: true, mode: 0o700 });
|
|
421
|
-
this.hookCleanupPaths.push(hookDir);
|
|
422
|
-
const hookScript = this.zshOsc7ChpwdFunction();
|
|
423
|
-
const userZdotdir = env.__LOCALTERM_ORIG_ZDOTDIR || env.ZDOTDIR || os.homedir();
|
|
424
|
-
const shimsPrepend = shimPathPrependLine(this.shimsDir ?? path.join(os.homedir(), LOCALTERM_STATE_DIRNAME, SECRETS_SHIMS_DIRNAME));
|
|
425
|
-
const escapedZdotdir = userZdotdir.replace(/'/g, "'\\''");
|
|
426
|
-
const lines = [
|
|
427
|
-
`source '${escapedZdotdir}/.zshenv' 2>/dev/null`,
|
|
428
|
-
'__localterm_saved_zdotdir="${ZDOTDIR}"',
|
|
429
|
-
`ZDOTDIR='${escapedZdotdir}'`,
|
|
430
|
-
// Source the zsh login file before .zshrc (matching `zsh -l`'s
|
|
431
|
-
// .zshenv → .zprofile → .zshrc order) so PATH/env a user set in
|
|
432
|
-
// .zprofile is visible in the interactive session. zsh users keep
|
|
433
|
-
// interactive setup in .zshrc, so cross-sourcing is rare here and a
|
|
434
|
-
// double-source risk is low (unlike bash's .profile→.bashrc).
|
|
435
|
-
`source '${escapedZdotdir}/.zprofile' 2>/dev/null`,
|
|
436
|
-
`source '${escapedZdotdir}/.zshrc' 2>/dev/null`,
|
|
437
|
-
'ZDOTDIR="${__localterm_saved_zdotdir}"',
|
|
438
|
-
// Prepend the secrets shims dir AFTER the user's .zshrc ran, so the
|
|
439
|
-
// shims reliably shadow the real binaries despite rc PATH
|
|
440
|
-
// manipulation (e.g. `export PATH=/opt/homebrew/bin:$PATH`). The line
|
|
441
|
-
// is a no-op when the shims dir is absent (feature not configured).
|
|
442
|
-
shimsPrepend,
|
|
443
|
-
// zsh's PROMPT_SP (on by default) prints the EOL mark (bold+reverse %
|
|
444
|
-
// by default — the "white-background %") AND a fill-to-end-of-line
|
|
445
|
-
// space burst before each prompt when the prior line had no trailing
|
|
446
|
-
// newline. localterm's precmd/chpwd hooks emit OSC sequences with no
|
|
447
|
-
// newline, so PROMPT_SP fires on every prompt and zle's redraw
|
|
448
|
-
// normally erases both. localterm resizes xterm before the server's
|
|
449
|
-
// PTY catches up (async over a high-latency relay), so during a shell
|
|
450
|
-
// redraw — and especially at spawn, where the PTY starts at the wide
|
|
451
|
-
// DEFAULT_COLS while the mobile xterm is still its narrow viewport —
|
|
452
|
-
// the mark and the fill spaces (sized for the wider PTY) wrap in the
|
|
453
|
-
// narrower xterm and zle's clear-to-end-of-screen erases from the
|
|
454
|
-
// wrapped line, leaving the mark as a stray `%` and the spaces as a
|
|
455
|
-
// blank line above the prompt. Emptying PROMPT_EOL_MARK only kills the
|
|
456
|
-
// visible mark; the fill spaces still wrap. Disabling PROMPT_SP kills
|
|
457
|
-
// both. The cost is the standard non-zsh behavior: a command whose
|
|
458
|
-
// output lacks a trailing newline gets the prompt on the same line
|
|
459
|
-
// instead of a fresh one — fine here, since the only unterminated
|
|
460
|
-
// output in this setup is localterm's own OSC hooks (invisible).
|
|
461
|
-
"unsetopt PROMPT_SP",
|
|
462
|
-
hookScript,
|
|
463
|
-
"chpwd_functions=(${chpwd_functions[@]} __localterm_osc7_chpwd)",
|
|
464
|
-
"__localterm_osc7_chpwd",
|
|
465
|
-
"__localterm_git_dirty() { printf '\\e]7777;git-dirty\\a'; }",
|
|
466
|
-
"precmd_functions=(${precmd_functions[@]} __localterm_git_dirty)",
|
|
467
|
-
"__localterm_fg_preexec() { printf '\\e]7777;fg;%s\\a' \"${1%% *}\"; }",
|
|
468
|
-
"preexec_functions=(${preexec_functions[@]} __localterm_fg_preexec)",
|
|
469
|
-
"__localterm_fg_precmd() { printf '\\e]7777;fg-idle\\a'; }",
|
|
470
|
-
"precmd_functions=(__localterm_fg_precmd ${precmd_functions[@]})",
|
|
471
|
-
...(this.reportInitialCommandExit
|
|
472
|
-
? [
|
|
473
|
-
...this.automationExitHookFunctionLines("__localterm_automation_exit_precmd"),
|
|
474
|
-
"precmd_functions=(__localterm_automation_exit_precmd ${precmd_functions[@]})",
|
|
475
|
-
]
|
|
476
|
-
: []),
|
|
477
|
-
];
|
|
478
|
-
writeFileSync(path.join(hookDir, ".zshrc"), lines.join("\n") + "\n", {
|
|
479
|
-
mode: 0o600,
|
|
480
|
-
});
|
|
481
|
-
return [[], { ZDOTDIR: hookDir, __LOCALTERM_ORIG_ZDOTDIR: userZdotdir }];
|
|
482
|
-
}
|
|
483
|
-
case "bash": {
|
|
484
|
-
const hookDir = path.join(os.tmpdir(), `localterm-bash-${hookId}`);
|
|
485
|
-
mkdirSync(hookDir, { recursive: true, mode: 0o700 });
|
|
486
|
-
const hookPath = path.join(hookDir, "bashrc");
|
|
487
|
-
this.hookCleanupPaths.push(hookDir);
|
|
488
|
-
const hookScript = this.bashOsc7Function();
|
|
489
|
-
const shimsPrepend = shimPathPrependLine(this.shimsDir ?? path.join(os.homedir(), LOCALTERM_STATE_DIRNAME, SECRETS_SHIMS_DIRNAME));
|
|
490
|
-
const lines = [
|
|
491
|
-
// Login-shell env (mimic `bash -l`): /etc/profile then the first
|
|
492
|
-
// existing login file. ~/.bashrc is sourced only when NO login file
|
|
493
|
-
// exists, so a login file that already sources .bashrc (the common
|
|
494
|
-
// Ubuntu .profile pattern: `if [ -n "$BASH_VERSION" ]; then . ~/.bashrc; fi`)
|
|
495
|
-
// doesn't get .bashrc twice — which would duplicate PATH prepends
|
|
496
|
-
// (Ubuntu's .profile adds $HOME/.local/bin and .bashrc adds $HOME/bin).
|
|
497
|
-
// The system interactive files /etc/bashrc + /etc/bash.bashrc stay
|
|
498
|
-
// (the original behavior) so macOS's /etc/bashrc prompt setup and
|
|
499
|
-
// Debian's /etc/bash.bashrc are preserved even with a login file.
|
|
500
|
-
"source /etc/profile 2>/dev/null",
|
|
501
|
-
"__localterm_login_loaded=0",
|
|
502
|
-
'for __localterm_f in ~/.bash_profile ~/.bash_login ~/.profile; do [ -f "$__localterm_f" ] && . "$__localterm_f" && __localterm_login_loaded=1 && break; done',
|
|
503
|
-
"source /etc/bashrc 2>/dev/null",
|
|
504
|
-
"source /etc/bash.bashrc 2>/dev/null",
|
|
505
|
-
'[ "$__localterm_login_loaded" != 1 ] && source ~/.bashrc 2>/dev/null',
|
|
506
|
-
// Prepend the secrets shims dir AFTER the user's rc ran (see the
|
|
507
|
-
// zsh case for why the ordering matters).
|
|
508
|
-
shimsPrepend,
|
|
509
|
-
hookScript,
|
|
510
|
-
'PROMPT_COMMAND="__localterm_prompt_start;${PROMPT_COMMAND:+${PROMPT_COMMAND};}__localterm_osc7_prompt;__localterm_git_dirty;__localterm_fg_precmd"',
|
|
511
|
-
"__localterm_osc7_prompt",
|
|
512
|
-
"__localterm_git_dirty() { printf '\\e]7777;git-dirty\\a'; }",
|
|
513
|
-
"__localterm_fg_precmd() { printf '\\e]7777;fg-idle\\a'; __localterm_in_prompt=0; }",
|
|
514
|
-
"__localterm_prompt_start() { __localterm_in_prompt=1; }",
|
|
515
|
-
"__localterm_in_prompt=0",
|
|
516
|
-
'__localterm_fg_debug() { [ "$__localterm_in_prompt" = 1 ] && return; case "$BASH_COMMAND" in __localterm_*) return ;; esac; printf \'\\e]7777;fg;%s\\a\' "${BASH_COMMAND%% *}"; }',
|
|
517
|
-
"__localterm_prev_debug_body=",
|
|
518
|
-
'__localterm_capture_debug() { local __t; __t=$(trap -p DEBUG); [ -z "$__t" ] && return; __t=${__t#trap -- }; __t=${__t% DEBUG}; __localterm_prev_debug_body=$__t; }',
|
|
519
|
-
"__localterm_capture_debug",
|
|
520
|
-
'if [ -n "$__localterm_prev_debug_body" ]; then trap \'__localterm_fg_debug; eval "$__localterm_prev_debug_body"\' DEBUG; else trap __localterm_fg_debug DEBUG; fi',
|
|
521
|
-
...(this.reportInitialCommandExit
|
|
522
|
-
? [
|
|
523
|
-
...this.automationExitHookFunctionLines("__localterm_automation_exit_prompt"),
|
|
524
|
-
'PROMPT_COMMAND="__localterm_automation_exit_prompt${PROMPT_COMMAND:+;${PROMPT_COMMAND}}"',
|
|
525
|
-
]
|
|
526
|
-
: []),
|
|
527
|
-
];
|
|
528
|
-
writeFileSync(hookPath, lines.join("\n") + "\n", { mode: 0o600 });
|
|
529
|
-
return [["--rcfile", hookPath], null];
|
|
530
|
-
}
|
|
531
|
-
case "fish": {
|
|
532
|
-
// fish's `-C` / `--init-command` runs AFTER ~/.config/fish/config.fish
|
|
533
|
-
// and the conf.d snippets load, so the user's config (including
|
|
534
|
-
// conf.d PATH manipulation) runs first and the shims prepend below
|
|
535
|
-
// shadows it — see the zsh case for why the ordering matters. Unlike
|
|
536
|
-
// zsh/bash this needs no temp rcfile: -C injects the setup directly
|
|
537
|
-
// and the event-bound functions persist for the session.
|
|
538
|
-
const shimsDir = this.shimsDir ?? path.join(os.homedir(), LOCALTERM_STATE_DIRNAME, SECRETS_SHIMS_DIRNAME);
|
|
539
|
-
// fish escapes a single quote inside single quotes as `\'` (not the
|
|
540
|
-
// `\''` POSIX idiom).
|
|
541
|
-
const escapedShimsDir = shimsDir.replace(/'/g, "\\'");
|
|
542
|
-
const shimsPrepend = `test -d '${escapedShimsDir}' && set -gx PATH '${escapedShimsDir}' $PATH`;
|
|
543
|
-
// The fish_prompt handler emits the git-dirty signal, and (when an
|
|
544
|
-
// initial command is staged) copies LOCALTERM_INITIAL_COMMAND into a
|
|
545
|
-
// local, clears the env var, evals the local, and emits the
|
|
546
|
-
// automation-exit OSC with the eval's $status. See
|
|
547
|
-
// automationExitHookFunctionLines for the security rationale (copy +
|
|
548
|
-
// unset before eval, PTY_ENV_DENYLIST) and why this runs the command
|
|
549
|
-
// instead of typing it into the PTY.
|
|
550
|
-
const lines = [
|
|
551
|
-
"function __localterm_osc7 --on-variable PWD",
|
|
552
|
-
" printf '\\e]7;file://%s%s\\a' (hostname 2>/dev/null || echo localhost) $PWD",
|
|
553
|
-
"end",
|
|
554
|
-
"__localterm_osc7",
|
|
555
|
-
shimsPrepend,
|
|
556
|
-
"function __localterm_fg_preexec --on-event fish_preexec",
|
|
557
|
-
" printf '\\e]7777;fg;%s\\a' (string split ' ' -- $argv[1])[1]",
|
|
558
|
-
"end",
|
|
559
|
-
"function __localterm_prompt_hook --on-event fish_prompt",
|
|
560
|
-
" printf '\\e]7777;git-dirty\\a'",
|
|
561
|
-
...(this.reportInitialCommandExit
|
|
562
|
-
? [
|
|
563
|
-
' if test -n "$LOCALTERM_INITIAL_COMMAND"',
|
|
564
|
-
" set -l __localterm_initial_command $LOCALTERM_INITIAL_COMMAND",
|
|
565
|
-
" set -e LOCALTERM_INITIAL_COMMAND",
|
|
566
|
-
" printf '+ %s\\n' $__localterm_initial_command",
|
|
567
|
-
" printf '\\e]7777;fg;%s\\a' (string split ' ' -- $__localterm_initial_command)[1]",
|
|
568
|
-
" eval $__localterm_initial_command",
|
|
569
|
-
" printf '\\e]7777;automation-exit;%d\\a' $status",
|
|
570
|
-
" end",
|
|
571
|
-
]
|
|
572
|
-
: []),
|
|
573
|
-
" printf '\\e]7777;fg-idle\\a'",
|
|
574
|
-
"end",
|
|
575
|
-
];
|
|
576
|
-
return [["-C", lines.join("\n")], null];
|
|
577
|
-
}
|
|
578
|
-
default:
|
|
579
|
-
return [[], null];
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
// The initial command for a hooked shell (zsh/bash/fish) is run by this hook
|
|
583
|
-
// via `eval`, instead of being typed into the PTY — so it never goes through
|
|
584
|
-
// the line editor's typed-input path and can't race ECHO or double-echo. The
|
|
585
|
-
// command arrives through the LOCALTERM_INITIAL_COMMAND env var (set in the
|
|
586
|
-
// constructor). The hook copies it into a local and unsets the env var
|
|
587
|
-
// BEFORE eval, so the command string isn't inherited by child processes the
|
|
588
|
-
// command spawns and the hook runs once; then prints it (prefixed `+`),
|
|
589
|
-
// emits a git-dirty signal before the eval so the ambient overlay updates
|
|
590
|
-
// as the command begins (the regular __localterm_git_dirty runs after this
|
|
591
|
-
// hook in the prompt chain — without this the first git-dirty only fires
|
|
592
|
-
// once the command finishes), evals the local, and emits the
|
|
593
|
-
// automation-exit OSC with the eval's exit status. Prepended first in the
|
|
594
|
-
// prompt chain; unhooked shells don't reach here (they take the at-spawn
|
|
595
|
-
// PTY write).
|
|
596
|
-
// LOCALTERM_INITIAL_COMMAND is on PTY_ENV_DENYLIST so a stale or inherited
|
|
597
|
-
// value from the daemon env can't reach the hook — the constructor's set is
|
|
598
|
-
// the only source.
|
|
599
|
-
automationExitHookFunctionLines(functionName) {
|
|
600
|
-
return [
|
|
601
|
-
`${functionName}() {`,
|
|
602
|
-
' if [ -n "${LOCALTERM_INITIAL_COMMAND:-}" ]; then',
|
|
603
|
-
" local __localterm_command_exit __localterm_initial_command",
|
|
604
|
-
' __localterm_initial_command="$LOCALTERM_INITIAL_COMMAND"',
|
|
605
|
-
" unset LOCALTERM_INITIAL_COMMAND",
|
|
606
|
-
" printf '+ %s\\n' \"$__localterm_initial_command\"",
|
|
607
|
-
" printf '\\e]7777;git-dirty\\a'",
|
|
608
|
-
" printf '\\e]7777;fg;%s\\a' \"${__localterm_initial_command%% *}\"",
|
|
609
|
-
' eval "$__localterm_initial_command"',
|
|
610
|
-
" __localterm_command_exit=$?",
|
|
611
|
-
" printf '\\e]7777;automation-exit;%d\\a' \"$__localterm_command_exit\"",
|
|
612
|
-
" fi",
|
|
613
|
-
"}",
|
|
614
|
-
];
|
|
615
|
-
}
|
|
616
|
-
zshOsc7ChpwdFunction() {
|
|
617
|
-
return [
|
|
618
|
-
"__localterm_osc7_chpwd() {",
|
|
619
|
-
' printf \'\\e]7;file://%s%s\\a\' "${HOSTNAME:-localhost}" "${PWD}"',
|
|
620
|
-
"}",
|
|
621
|
-
].join("\n");
|
|
622
|
-
}
|
|
623
|
-
bashOsc7Function() {
|
|
624
|
-
return [
|
|
625
|
-
"__localterm_osc7_prompt() {",
|
|
626
|
-
' printf \'\\e]7;file://%s%s\\a\' "${HOSTNAME:-localhost}" "${PWD}"',
|
|
627
|
-
"}",
|
|
628
|
-
].join("\n");
|
|
629
|
-
}
|
|
630
383
|
handleForegroundChange(next) {
|
|
631
384
|
this.foregroundFromHook = next;
|
|
632
385
|
this.emitEffectiveForeground();
|
package/dist/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAa,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,+BAA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AE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACrD,CAAC;YAAC,MAAM,CAAC;gBACP,uDAAuD;YACzD,CAAC;QACH,CAAC;QACD,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ShellHookBuilderOptions {
|
|
2
|
+
shimsDir: string | undefined;
|
|
3
|
+
reportInitialCommandExit: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare class ShellHookBuilder {
|
|
6
|
+
readonly hookCleanupPaths: string[];
|
|
7
|
+
private readonly shimsDir;
|
|
8
|
+
private readonly reportInitialCommandExit;
|
|
9
|
+
constructor({ shimsDir, reportInitialCommandExit }: ShellHookBuilderOptions);
|
|
10
|
+
prepare(shellName: string, env: Record<string, string>): [string[], Record<string, string> | null];
|
|
11
|
+
private automationExitHookFunctionLines;
|
|
12
|
+
private zshOsc7ChpwdFunction;
|
|
13
|
+
private bashOsc7Function;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=shell-hook-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-hook-builder.d.ts","sourceRoot":"","sources":["../src/shell-hook-builder.ts"],"names":[],"mappings":"AAMA,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAED,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAM;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAU;IAEnD,YAAY,EAAE,QAAQ,EAAE,wBAAwB,EAAE,EAAE,uBAAuB,EAG1E;IAED,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CA2K3C;IAmBD,OAAO,CAAC,+BAA+B;IAkBvC,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,gBAAgB;CAOzB"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { LOCALTERM_STATE_DIRNAME, SECRETS_SHIMS_DIRNAME } from "./constants.js";
|
|
5
|
+
import { shimPathPrependLine } from "./secret-shims.js";
|
|
6
|
+
export class ShellHookBuilder {
|
|
7
|
+
hookCleanupPaths = [];
|
|
8
|
+
shimsDir;
|
|
9
|
+
reportInitialCommandExit;
|
|
10
|
+
constructor({ shimsDir, reportInitialCommandExit }) {
|
|
11
|
+
this.shimsDir = shimsDir;
|
|
12
|
+
this.reportInitialCommandExit = reportInitialCommandExit;
|
|
13
|
+
}
|
|
14
|
+
prepare(shellName, env) {
|
|
15
|
+
const hookId = `${process.pid}-${Date.now()}`;
|
|
16
|
+
switch (shellName) {
|
|
17
|
+
case "zsh": {
|
|
18
|
+
const hookDir = path.join(os.tmpdir(), `localterm-zdot-${hookId}`);
|
|
19
|
+
mkdirSync(hookDir, { recursive: true, mode: 0o700 });
|
|
20
|
+
this.hookCleanupPaths.push(hookDir);
|
|
21
|
+
const hookScript = this.zshOsc7ChpwdFunction();
|
|
22
|
+
const userZdotdir = env.__LOCALTERM_ORIG_ZDOTDIR || env.ZDOTDIR || os.homedir();
|
|
23
|
+
const shimsPrepend = shimPathPrependLine(this.shimsDir ?? path.join(os.homedir(), LOCALTERM_STATE_DIRNAME, SECRETS_SHIMS_DIRNAME));
|
|
24
|
+
const escapedZdotdir = userZdotdir.replace(/'/g, "'\\''");
|
|
25
|
+
const lines = [
|
|
26
|
+
`source '${escapedZdotdir}/.zshenv' 2>/dev/null`,
|
|
27
|
+
'__localterm_saved_zdotdir="${ZDOTDIR}"',
|
|
28
|
+
`ZDOTDIR='${escapedZdotdir}'`,
|
|
29
|
+
// Source the zsh login file before .zshrc (matching `zsh -l`'s
|
|
30
|
+
// .zshenv → .zprofile → .zshrc order) so PATH/env a user set in
|
|
31
|
+
// .zprofile is visible in the interactive session. zsh users keep
|
|
32
|
+
// interactive setup in .zshrc, so cross-sourcing is rare here and a
|
|
33
|
+
// double-source risk is low (unlike bash's .profile→.bashrc).
|
|
34
|
+
`source '${escapedZdotdir}/.zprofile' 2>/dev/null`,
|
|
35
|
+
`source '${escapedZdotdir}/.zshrc' 2>/dev/null`,
|
|
36
|
+
'ZDOTDIR="${__localterm_saved_zdotdir}"',
|
|
37
|
+
// Prepend the secrets shims dir AFTER the user's .zshrc ran, so the
|
|
38
|
+
// shims reliably shadow the real binaries despite rc PATH
|
|
39
|
+
// manipulation (e.g. `export PATH=/opt/homebrew/bin:$PATH`). The line
|
|
40
|
+
// is a no-op when the shims dir is absent (feature not configured).
|
|
41
|
+
shimsPrepend,
|
|
42
|
+
// zsh's PROMPT_SP (on by default) prints the EOL mark (bold+reverse %
|
|
43
|
+
// by default — the "white-background %") AND a fill-to-end-of-line
|
|
44
|
+
// space burst before each prompt when the prior line had no trailing
|
|
45
|
+
// newline. localterm's precmd/chpwd hooks emit OSC sequences with no
|
|
46
|
+
// newline, so PROMPT_SP fires on every prompt and zle's redraw
|
|
47
|
+
// normally erases both. localterm resizes xterm before the server's
|
|
48
|
+
// PTY catches up (async over a high-latency relay), so during a shell
|
|
49
|
+
// redraw — and especially at spawn, where the PTY starts at the wide
|
|
50
|
+
// DEFAULT_COLS while the mobile xterm is still its narrow viewport —
|
|
51
|
+
// the mark and the fill spaces (sized for the wider PTY) wrap in the
|
|
52
|
+
// narrower xterm and zle's clear-to-end-of-screen erases from the
|
|
53
|
+
// wrapped line, leaving the mark as a stray `%` and the spaces as a
|
|
54
|
+
// blank line above the prompt. Emptying PROMPT_EOL_MARK only kills the
|
|
55
|
+
// visible mark; the fill spaces still wrap. Disabling PROMPT_SP kills
|
|
56
|
+
// both. The cost is the standard non-zsh behavior: a command whose
|
|
57
|
+
// output lacks a trailing newline gets the prompt on the same line
|
|
58
|
+
// instead of a fresh one — fine here, since the only unterminated
|
|
59
|
+
// output in this setup is localterm's own OSC hooks (invisible).
|
|
60
|
+
"unsetopt PROMPT_SP",
|
|
61
|
+
hookScript,
|
|
62
|
+
"chpwd_functions=(${chpwd_functions[@]} __localterm_osc7_chpwd)",
|
|
63
|
+
"__localterm_osc7_chpwd",
|
|
64
|
+
"__localterm_git_dirty() { printf '\\e]7777;git-dirty\\a'; }",
|
|
65
|
+
"precmd_functions=(${precmd_functions[@]} __localterm_git_dirty)",
|
|
66
|
+
"__localterm_fg_preexec() { printf '\\e]7777;fg;%s\\a' \"${1%% *}\"; }",
|
|
67
|
+
"preexec_functions=(${preexec_functions[@]} __localterm_fg_preexec)",
|
|
68
|
+
"__localterm_fg_precmd() { printf '\\e]7777;fg-idle\\a'; }",
|
|
69
|
+
"precmd_functions=(__localterm_fg_precmd ${precmd_functions[@]})",
|
|
70
|
+
...(this.reportInitialCommandExit
|
|
71
|
+
? [
|
|
72
|
+
...this.automationExitHookFunctionLines("__localterm_automation_exit_precmd"),
|
|
73
|
+
"precmd_functions=(__localterm_automation_exit_precmd ${precmd_functions[@]})",
|
|
74
|
+
]
|
|
75
|
+
: []),
|
|
76
|
+
];
|
|
77
|
+
writeFileSync(path.join(hookDir, ".zshrc"), lines.join("\n") + "\n", {
|
|
78
|
+
mode: 0o600,
|
|
79
|
+
});
|
|
80
|
+
return [[], { ZDOTDIR: hookDir, __LOCALTERM_ORIG_ZDOTDIR: userZdotdir }];
|
|
81
|
+
}
|
|
82
|
+
case "bash": {
|
|
83
|
+
const hookDir = path.join(os.tmpdir(), `localterm-bash-${hookId}`);
|
|
84
|
+
mkdirSync(hookDir, { recursive: true, mode: 0o700 });
|
|
85
|
+
const hookPath = path.join(hookDir, "bashrc");
|
|
86
|
+
this.hookCleanupPaths.push(hookDir);
|
|
87
|
+
const hookScript = this.bashOsc7Function();
|
|
88
|
+
const shimsPrepend = shimPathPrependLine(this.shimsDir ?? path.join(os.homedir(), LOCALTERM_STATE_DIRNAME, SECRETS_SHIMS_DIRNAME));
|
|
89
|
+
const lines = [
|
|
90
|
+
// Login-shell env (mimic `bash -l`): /etc/profile then the first
|
|
91
|
+
// existing login file. ~/.bashrc is sourced only when NO login file
|
|
92
|
+
// exists, so a login file that already sources .bashrc (the common
|
|
93
|
+
// Ubuntu .profile pattern: `if [ -n "$BASH_VERSION" ]; then . ~/.bashrc; fi`)
|
|
94
|
+
// doesn't get .bashrc twice — which would duplicate PATH prepends
|
|
95
|
+
// (Ubuntu's .profile adds $HOME/.local/bin and .bashrc adds $HOME/bin).
|
|
96
|
+
// The system interactive files /etc/bashrc + /etc/bash.bashrc stay
|
|
97
|
+
// (the original behavior) so macOS's /etc/bashrc prompt setup and
|
|
98
|
+
// Debian's /etc/bash.bashrc are preserved even with a login file.
|
|
99
|
+
"source /etc/profile 2>/dev/null",
|
|
100
|
+
"__localterm_login_loaded=0",
|
|
101
|
+
'for __localterm_f in ~/.bash_profile ~/.bash_login ~/.profile; do [ -f "$__localterm_f" ] && . "$__localterm_f" && __localterm_login_loaded=1 && break; done',
|
|
102
|
+
"source /etc/bashrc 2>/dev/null",
|
|
103
|
+
"source /etc/bash.bashrc 2>/dev/null",
|
|
104
|
+
'[ "$__localterm_login_loaded" != 1 ] && source ~/.bashrc 2>/dev/null',
|
|
105
|
+
// Prepend the secrets shims dir AFTER the user's rc ran (see the
|
|
106
|
+
// zsh case for why the ordering matters).
|
|
107
|
+
shimsPrepend,
|
|
108
|
+
hookScript,
|
|
109
|
+
'PROMPT_COMMAND="__localterm_prompt_start;${PROMPT_COMMAND:+${PROMPT_COMMAND};}__localterm_osc7_prompt;__localterm_git_dirty;__localterm_fg_precmd"',
|
|
110
|
+
"__localterm_osc7_prompt",
|
|
111
|
+
"__localterm_git_dirty() { printf '\\e]7777;git-dirty\\a'; }",
|
|
112
|
+
"__localterm_fg_precmd() { printf '\\e]7777;fg-idle\\a'; __localterm_in_prompt=0; }",
|
|
113
|
+
"__localterm_prompt_start() { __localterm_in_prompt=1; }",
|
|
114
|
+
"__localterm_in_prompt=0",
|
|
115
|
+
'__localterm_fg_debug() { [ "$__localterm_in_prompt" = 1 ] && return; case "$BASH_COMMAND" in __localterm_*) return ;; esac; printf \'\\e]7777;fg;%s\\a\' "${BASH_COMMAND%% *}"; }',
|
|
116
|
+
"__localterm_prev_debug_body=",
|
|
117
|
+
'__localterm_capture_debug() { local __t; __t=$(trap -p DEBUG); [ -z "$__t" ] && return; __t=${__t#trap -- }; __t=${__t% DEBUG}; __localterm_prev_debug_body=$__t; }',
|
|
118
|
+
"__localterm_capture_debug",
|
|
119
|
+
'if [ -n "$__localterm_prev_debug_body" ]; then trap \'__localterm_fg_debug; eval "$__localterm_prev_debug_body"\' DEBUG; else trap __localterm_fg_debug DEBUG; fi',
|
|
120
|
+
...(this.reportInitialCommandExit
|
|
121
|
+
? [
|
|
122
|
+
...this.automationExitHookFunctionLines("__localterm_automation_exit_prompt"),
|
|
123
|
+
'PROMPT_COMMAND="__localterm_automation_exit_prompt${PROMPT_COMMAND:+;${PROMPT_COMMAND}}"',
|
|
124
|
+
]
|
|
125
|
+
: []),
|
|
126
|
+
];
|
|
127
|
+
writeFileSync(hookPath, lines.join("\n") + "\n", { mode: 0o600 });
|
|
128
|
+
return [["--rcfile", hookPath], null];
|
|
129
|
+
}
|
|
130
|
+
case "fish": {
|
|
131
|
+
// fish's `-C` / `--init-command` runs AFTER ~/.config/fish/config.fish
|
|
132
|
+
// and the conf.d snippets load, so the user's config (including
|
|
133
|
+
// conf.d PATH manipulation) runs first and the shims prepend below
|
|
134
|
+
// shadows it — see the zsh case for why the ordering matters. Unlike
|
|
135
|
+
// zsh/bash this needs no temp rcfile: -C injects the setup directly
|
|
136
|
+
// and the event-bound functions persist for the session.
|
|
137
|
+
const shimsDir = this.shimsDir ?? path.join(os.homedir(), LOCALTERM_STATE_DIRNAME, SECRETS_SHIMS_DIRNAME);
|
|
138
|
+
// fish escapes a single quote inside single quotes as `\'` (not the
|
|
139
|
+
// `\''` POSIX idiom).
|
|
140
|
+
const escapedShimsDir = shimsDir.replace(/'/g, "\\'");
|
|
141
|
+
const shimsPrepend = `test -d '${escapedShimsDir}' && set -gx PATH '${escapedShimsDir}' $PATH`;
|
|
142
|
+
// The fish_prompt handler emits the git-dirty signal, and (when an
|
|
143
|
+
// initial command is staged) copies LOCALTERM_INITIAL_COMMAND into a
|
|
144
|
+
// local, clears the env var, evals the local, and emits the
|
|
145
|
+
// automation-exit OSC with the eval's $status. See
|
|
146
|
+
// automationExitHookFunctionLines for the security rationale (copy +
|
|
147
|
+
// unset before eval, PTY_ENV_DENYLIST) and why this runs the command
|
|
148
|
+
// instead of typing it into the PTY.
|
|
149
|
+
const lines = [
|
|
150
|
+
"function __localterm_osc7 --on-variable PWD",
|
|
151
|
+
" printf '\\e]7;file://%s%s\\a' (hostname 2>/dev/null || echo localhost) $PWD",
|
|
152
|
+
"end",
|
|
153
|
+
"__localterm_osc7",
|
|
154
|
+
shimsPrepend,
|
|
155
|
+
"function __localterm_fg_preexec --on-event fish_preexec",
|
|
156
|
+
" printf '\\e]7777;fg;%s\\a' (string split ' ' -- $argv[1])[1]",
|
|
157
|
+
"end",
|
|
158
|
+
"function __localterm_prompt_hook --on-event fish_prompt",
|
|
159
|
+
" printf '\\e]7777;git-dirty\\a'",
|
|
160
|
+
...(this.reportInitialCommandExit
|
|
161
|
+
? [
|
|
162
|
+
' if test -n "$LOCALTERM_INITIAL_COMMAND"',
|
|
163
|
+
" set -l __localterm_initial_command $LOCALTERM_INITIAL_COMMAND",
|
|
164
|
+
" set -e LOCALTERM_INITIAL_COMMAND",
|
|
165
|
+
" printf '+ %s\\n' $__localterm_initial_command",
|
|
166
|
+
" printf '\\e]7777;fg;%s\\a' (string split ' ' -- $__localterm_initial_command)[1]",
|
|
167
|
+
" eval $__localterm_initial_command",
|
|
168
|
+
" printf '\\e]7777;automation-exit;%d\\a' $status",
|
|
169
|
+
" end",
|
|
170
|
+
]
|
|
171
|
+
: []),
|
|
172
|
+
" printf '\\e]7777;fg-idle\\a'",
|
|
173
|
+
"end",
|
|
174
|
+
];
|
|
175
|
+
return [["-C", lines.join("\n")], null];
|
|
176
|
+
}
|
|
177
|
+
default:
|
|
178
|
+
return [[], null];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// The initial command for a hooked shell (zsh/bash/fish) is run by this hook
|
|
182
|
+
// via `eval`, instead of being typed into the PTY — so it never goes through
|
|
183
|
+
// the line editor's typed-input path and can't race ECHO or double-echo. The
|
|
184
|
+
// command arrives through the LOCALTERM_INITIAL_COMMAND env var (set in the
|
|
185
|
+
// constructor). The hook copies it into a local and unsets the env var
|
|
186
|
+
// BEFORE eval, so the command string isn't inherited by child processes the
|
|
187
|
+
// command spawns and the hook runs once; then prints it (prefixed `+`),
|
|
188
|
+
// emits a git-dirty signal before the eval so the ambient overlay updates
|
|
189
|
+
// as the command begins (the regular __localterm_git_dirty runs after this
|
|
190
|
+
// hook in the prompt chain — without this the first git-dirty only fires
|
|
191
|
+
// once the command finishes), evals the local, and emits the
|
|
192
|
+
// automation-exit OSC with the eval's exit status. Prepended first in the
|
|
193
|
+
// prompt chain; unhooked shells don't reach here (they take the at-spawn
|
|
194
|
+
// PTY write).
|
|
195
|
+
// LOCALTERM_INITIAL_COMMAND is on PTY_ENV_DENYLIST so a stale or inherited
|
|
196
|
+
// value from the daemon env can't reach the hook — the constructor's set is
|
|
197
|
+
// the only source.
|
|
198
|
+
automationExitHookFunctionLines(functionName) {
|
|
199
|
+
return [
|
|
200
|
+
`${functionName}() {`,
|
|
201
|
+
' if [ -n "${LOCALTERM_INITIAL_COMMAND:-}" ]; then',
|
|
202
|
+
" local __localterm_command_exit __localterm_initial_command",
|
|
203
|
+
' __localterm_initial_command="$LOCALTERM_INITIAL_COMMAND"',
|
|
204
|
+
" unset LOCALTERM_INITIAL_COMMAND",
|
|
205
|
+
" printf '+ %s\\n' \"$__localterm_initial_command\"",
|
|
206
|
+
" printf '\\e]7777;git-dirty\\a'",
|
|
207
|
+
" printf '\\e]7777;fg;%s\\a' \"${__localterm_initial_command%% *}\"",
|
|
208
|
+
' eval "$__localterm_initial_command"',
|
|
209
|
+
" __localterm_command_exit=$?",
|
|
210
|
+
" printf '\\e]7777;automation-exit;%d\\a' \"$__localterm_command_exit\"",
|
|
211
|
+
" fi",
|
|
212
|
+
"}",
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
zshOsc7ChpwdFunction() {
|
|
216
|
+
return [
|
|
217
|
+
"__localterm_osc7_chpwd() {",
|
|
218
|
+
' printf \'\\e]7;file://%s%s\\a\' "${HOSTNAME:-localhost}" "${PWD}"',
|
|
219
|
+
"}",
|
|
220
|
+
].join("\n");
|
|
221
|
+
}
|
|
222
|
+
bashOsc7Function() {
|
|
223
|
+
return [
|
|
224
|
+
"__localterm_osc7_prompt() {",
|
|
225
|
+
' printf \'\\e]7;file://%s%s\\a\' "${HOSTNAME:-localhost}" "${PWD}"',
|
|
226
|
+
"}",
|
|
227
|
+
].join("\n");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=shell-hook-builder.js.map
|