@dmsdc-ai/aigentry-telepty 0.0.16 → 0.0.18
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/cli.js +2 -0
- package/daemon.js +14 -1
- package/package.json +1 -1
package/cli.js
CHANGED
package/daemon.js
CHANGED
|
@@ -48,12 +48,25 @@ app.post('/api/sessions/spawn', (req, res) => {
|
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
50
|
console.log(`[SPAWN] Spawning ${shell} with args:`, shellArgs, "in cwd:", cwd);
|
|
51
|
+
|
|
52
|
+
// Create a custom prompt for Linux/Mac so the user sees the session ID.
|
|
53
|
+
// For bash/zsh, we can inject a custom PS1 variable.
|
|
54
|
+
let customEnv = { ...process.env, TERM: isWin ? undefined : 'xterm-256color', TELEPTY_SESSION_ID: session_id };
|
|
55
|
+
|
|
56
|
+
if (!isWin) {
|
|
57
|
+
if (command.includes('bash')) {
|
|
58
|
+
customEnv.PS1 = `\\[\\e[36m\\][telepty: ${session_id}]\\[\\e[0m\\] \\w \\$ `;
|
|
59
|
+
} else if (command.includes('zsh')) {
|
|
60
|
+
customEnv.PROMPT = `%F{cyan}[telepty: ${session_id}]%f %~ %# `;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
51
64
|
const ptyProcess = pty.spawn(shell, shellArgs, {
|
|
52
65
|
name: isWin ? 'Windows Terminal' : 'xterm-256color',
|
|
53
66
|
cols: parseInt(cols),
|
|
54
67
|
rows: parseInt(rows),
|
|
55
68
|
cwd,
|
|
56
|
-
env:
|
|
69
|
+
env: customEnv
|
|
57
70
|
});
|
|
58
71
|
|
|
59
72
|
sessions[session_id] = {
|