@myrialabs/clopen 0.4.5 → 0.4.7
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/backend/auth/permissions.ts +14 -1
- package/backend/auth/session-invalidation.test.ts +17 -21
- package/backend/auth/session-invalidation.ts +10 -11
- package/backend/database/migrations/044_create_skills_table.ts +29 -0
- package/backend/database/migrations/index.ts +7 -0
- package/backend/database/queries/index.ts +3 -1
- package/backend/database/queries/skill-queries.ts +105 -0
- package/backend/engine/adapters/claude/models.ts +46 -3
- package/backend/engine/adapters/claude/stream.ts +5 -0
- package/backend/engine/adapters/codex/credential.ts +114 -13
- package/backend/engine/adapters/codex/stream.ts +34 -8
- package/backend/engine/adapters/copilot/stream.ts +4 -0
- package/backend/engine/adapters/opencode/stream.ts +4 -0
- package/backend/engine/adapters/qwen/stream.ts +3 -0
- package/backend/engine/docs/lessons-learned.md +54 -50
- package/backend/files/file-archive.test.ts +86 -26
- package/backend/files/file-archive.ts +214 -134
- package/backend/index.ts +10 -1
- package/backend/mcp/README.md +77 -24
- package/backend/mcp/external/config.ts +82 -101
- package/backend/mcp/external/proxy.ts +202 -0
- package/backend/mcp/index.ts +4 -3
- package/backend/mcp/internal/remote-server.ts +103 -55
- package/backend/skills/index.ts +21 -0
- package/backend/skills/marketplace.ts +172 -0
- package/backend/skills/service.ts +245 -0
- package/backend/skills/spec.ts +214 -0
- package/backend/skills/store.ts +99 -0
- package/backend/skills/sync.ts +187 -0
- package/backend/terminal/index.ts +2 -5
- package/backend/terminal/ptykit.ts +64 -0
- package/backend/tunnel/tunnel-config.ts +1 -1
- package/backend/utils/ws.ts +14 -0
- package/backend/ws/files/write.ts +23 -7
- package/backend/ws/index.ts +5 -1
- package/backend/ws/projects/crud.ts +4 -4
- package/backend/ws/skills/catalog.ts +79 -0
- package/backend/ws/skills/crud.ts +123 -0
- package/backend/ws/skills/index.ts +15 -0
- package/backend/ws/system/operations.ts +23 -0
- package/backend/ws/terminal/index.ts +6 -33
- package/backend/ws/terminal/tunnel.ts +76 -0
- package/dist/assets/index-xrB3zcfA.js +1 -0
- package/dist/assets/main-BXS8bjJ6.css +1 -0
- package/dist/assets/{main-zXKH_C5O.js → main-LBI3a0n5.js} +304 -261
- package/dist/index.html +2 -2
- package/package.json +7 -11
- package/shared/constants/engines.ts +4 -4
- package/shared/utils/logger.ts +1 -0
- package/backend/terminal/helpers.ts +0 -14
- package/backend/terminal/pty-manager.ts +0 -4
- package/backend/terminal/pty-session-manager.ts +0 -349
- package/backend/terminal/stream-manager.ts +0 -300
- package/backend/ws/terminal/access.ts +0 -56
- package/backend/ws/terminal/persistence.ts +0 -145
- package/backend/ws/terminal/session.ts +0 -470
- package/backend/ws/terminal/stream.ts +0 -82
- package/dist/assets/main-gNUEJAC5.css +0 -1
package/dist/index.html
CHANGED
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
})();
|
|
60
60
|
</script>
|
|
61
|
-
<script type="module" crossorigin src="/assets/main-
|
|
62
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
61
|
+
<script type="module" crossorigin src="/assets/main-LBI3a0n5.js"></script>
|
|
62
|
+
<link rel="stylesheet" crossorigin href="/assets/main-BXS8bjJ6.css">
|
|
63
63
|
</head>
|
|
64
64
|
<body
|
|
65
65
|
class="min-h-dvh bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100 transition-colors duration-200"
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrialabs/clopen",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "All-in-one web workspace for Claude Code & OpenCode — chat, terminal, git, browser preview, checkpoints, and real-time collaboration",
|
|
5
5
|
"author": "Myria Labs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
8
11
|
"bin": {
|
|
9
12
|
"clopen": "./bin/clopen.ts"
|
|
10
13
|
},
|
|
@@ -96,22 +99,16 @@
|
|
|
96
99
|
"@iconify-json/material-icon-theme": "^1.2.16",
|
|
97
100
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
98
101
|
"@monaco-editor/loader": "^1.5.0",
|
|
102
|
+
"@myrialabs/ptykit": "^0.0.5",
|
|
103
|
+
"@myrialabs/tunnelkit": "^0.0.15",
|
|
104
|
+
"@myrialabs/zipkit": "^0.0.11",
|
|
99
105
|
"@openai/codex-sdk": "0.135.0",
|
|
100
106
|
"@opencode-ai/sdk": "1.15.12",
|
|
101
107
|
"@qwen-code/sdk": "0.1.7",
|
|
102
108
|
"@sinclair/typebox": "0.34.48",
|
|
103
|
-
"@xterm/addon-clipboard": "^0.2.0",
|
|
104
|
-
"@xterm/addon-fit": "^0.11.0",
|
|
105
|
-
"@xterm/addon-ligatures": "^0.10.0",
|
|
106
|
-
"@xterm/addon-serialize": "^0.14.0",
|
|
107
|
-
"@xterm/addon-unicode11": "^0.9.0",
|
|
108
|
-
"@xterm/addon-web-links": "^0.12.0",
|
|
109
|
-
"@xterm/headless": "^6.0.0",
|
|
110
|
-
"@xterm/xterm": "^6.0.0",
|
|
111
109
|
"bun-pty": "^0.4.2",
|
|
112
110
|
"dompurify": "^3.4.9",
|
|
113
111
|
"elysia": "^1.4.19",
|
|
114
|
-
"fflate": "^0.8.3",
|
|
115
112
|
"file-type": "^21.0.0",
|
|
116
113
|
"is-text-path": "^3.0.0",
|
|
117
114
|
"marked": "^16.1.1",
|
|
@@ -124,7 +121,6 @@
|
|
|
124
121
|
"qrcode": "^1.5.4",
|
|
125
122
|
"sharp": "^0.34.5",
|
|
126
123
|
"ssh2": "^1.17.0",
|
|
127
|
-
"tunnelkit": "^0.0.13",
|
|
128
124
|
"xz-decompress": "^0.2.3"
|
|
129
125
|
},
|
|
130
126
|
"trustedDependencies": [
|
|
@@ -92,13 +92,13 @@ export const getAllModels = (): EngineModel[] => [...modelRegistry];
|
|
|
92
92
|
// Defaults
|
|
93
93
|
//
|
|
94
94
|
// Hardcoded so the shared module has no dependency on the per-adapter model
|
|
95
|
-
// catalogs. The chosen default (`claude-sonnet-
|
|
96
|
-
//
|
|
95
|
+
// catalogs. The chosen default (`claude-sonnet-5`) is the current recommended
|
|
96
|
+
// Sonnet model; claude-sonnet-4-6 moved to legacy.
|
|
97
97
|
// ============================================================================
|
|
98
98
|
|
|
99
99
|
export const DEFAULT_ENGINE: EngineType = 'claude-code';
|
|
100
|
-
export const DEFAULT_MODEL_ID = 'claude-sonnet-
|
|
101
|
-
export const DEFAULT_MODEL_NAME = 'Claude Sonnet
|
|
100
|
+
export const DEFAULT_MODEL_ID = 'claude-sonnet-5';
|
|
101
|
+
export const DEFAULT_MODEL_NAME = 'Claude Sonnet 5';
|
|
102
102
|
|
|
103
103
|
// ============================================================================
|
|
104
104
|
// Lookup Helpers
|
package/shared/utils/logger.ts
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal domain helper functions
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Bun-compatible existsSync implementation
|
|
6
|
-
export async function existsSync(filePath: string): Promise<boolean> {
|
|
7
|
-
try {
|
|
8
|
-
const file = Bun.file(filePath);
|
|
9
|
-
await file.stat();
|
|
10
|
-
return true;
|
|
11
|
-
} catch {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persistent PTY Session Manager
|
|
3
|
-
* Manages long-running interactive PTY sessions (one per terminal tab)
|
|
4
|
-
* Supports true TTY interaction with stdin/stdout streaming
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { IPty } from 'bun-pty';
|
|
8
|
-
import { spawn } from 'bun-pty';
|
|
9
|
-
import { debug } from '$shared/utils/logger';
|
|
10
|
-
import { createCleanPtyEnv } from './shell-utils';
|
|
11
|
-
|
|
12
|
-
export interface PtySession {
|
|
13
|
-
sessionId: string;
|
|
14
|
-
pty: IPty;
|
|
15
|
-
cwd: string;
|
|
16
|
-
userId: string;
|
|
17
|
-
projectId?: string;
|
|
18
|
-
createdAt: Date;
|
|
19
|
-
lastActivityAt: Date;
|
|
20
|
-
// Stream listeners
|
|
21
|
-
dataListeners: Set<(data: string) => void>;
|
|
22
|
-
exitListeners: Set<(event: { exitCode: number; signal?: number | string }) => void>;
|
|
23
|
-
// Output batching (performance optimization)
|
|
24
|
-
pendingOutput: string;
|
|
25
|
-
flushScheduled: boolean;
|
|
26
|
-
// Monotonically increasing sequence number for deduplication
|
|
27
|
-
outputSeq: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
class PtySessionManager {
|
|
31
|
-
private sessions = new Map<string, PtySession>();
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
// Sessions stay alive indefinitely until user closes the terminal tab
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Create or get existing PTY session
|
|
39
|
-
*/
|
|
40
|
-
async createSession(
|
|
41
|
-
sessionId: string,
|
|
42
|
-
cwd: string,
|
|
43
|
-
userId: string,
|
|
44
|
-
projectId?: string,
|
|
45
|
-
terminalSize?: { cols: number; rows: number }
|
|
46
|
-
): Promise<PtySession> {
|
|
47
|
-
// Return existing session if already created
|
|
48
|
-
const existing = this.sessions.get(sessionId);
|
|
49
|
-
if (existing && existing.pty) {
|
|
50
|
-
debug.log('terminal', `♻️ Reusing existing PTY session: ${sessionId}`);
|
|
51
|
-
existing.lastActivityAt = new Date();
|
|
52
|
-
return existing;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
debug.log('terminal', `🚀 Creating new interactive PTY session: ${sessionId}`);
|
|
56
|
-
|
|
57
|
-
// Determine shell based on platform
|
|
58
|
-
const isWindows = process.platform === 'win32';
|
|
59
|
-
let shell: string;
|
|
60
|
-
let shellArgs: string[] = [];
|
|
61
|
-
|
|
62
|
-
if (isWindows) {
|
|
63
|
-
// Windows: Use PowerShell in interactive mode
|
|
64
|
-
shell = 'powershell.exe';
|
|
65
|
-
shellArgs = ['-NoLogo']; // Interactive mode, no -Command
|
|
66
|
-
} else {
|
|
67
|
-
// Unix: Use user's default shell or bash
|
|
68
|
-
shell = process.env.SHELL || '/bin/bash';
|
|
69
|
-
shellArgs = []; // Interactive mode, no -c
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Use clean environment (no Bun/npm/Vite pollution)
|
|
73
|
-
const ptyEnv = createCleanPtyEnv(terminalSize);
|
|
74
|
-
|
|
75
|
-
// Terminal size
|
|
76
|
-
const cols = terminalSize?.cols || 80;
|
|
77
|
-
const rows = terminalSize?.rows || 24;
|
|
78
|
-
|
|
79
|
-
// Spawn interactive PTY
|
|
80
|
-
const pty = spawn(shell, shellArgs, {
|
|
81
|
-
name: 'xterm-256color',
|
|
82
|
-
cols,
|
|
83
|
-
rows,
|
|
84
|
-
cwd,
|
|
85
|
-
env: ptyEnv
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
debug.log('terminal', `✅ PTY spawned with PID: ${pty.pid}`);
|
|
89
|
-
let receivedInitialOutput = false;
|
|
90
|
-
|
|
91
|
-
// Create session
|
|
92
|
-
const session: PtySession = {
|
|
93
|
-
sessionId,
|
|
94
|
-
pty,
|
|
95
|
-
cwd,
|
|
96
|
-
userId,
|
|
97
|
-
projectId,
|
|
98
|
-
createdAt: new Date(),
|
|
99
|
-
lastActivityAt: new Date(),
|
|
100
|
-
dataListeners: new Set(),
|
|
101
|
-
exitListeners: new Set(),
|
|
102
|
-
// Initialize batching state
|
|
103
|
-
pendingOutput: '',
|
|
104
|
-
flushScheduled: false,
|
|
105
|
-
outputSeq: 0
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// Setup PTY event handlers with micro-task batching
|
|
109
|
-
pty.onData((data: string) => {
|
|
110
|
-
receivedInitialOutput = true;
|
|
111
|
-
session.lastActivityAt = new Date();
|
|
112
|
-
|
|
113
|
-
// IMPORTANT: Always persist output to stream manager FIRST
|
|
114
|
-
// This ensures output is saved even if there are no active listeners
|
|
115
|
-
try {
|
|
116
|
-
const { terminalStreamManager } = require('./stream-manager');
|
|
117
|
-
const stream = terminalStreamManager.getStreamBySession(sessionId);
|
|
118
|
-
if (stream) {
|
|
119
|
-
terminalStreamManager.addOutput(stream.streamId, data);
|
|
120
|
-
}
|
|
121
|
-
} catch (error) {
|
|
122
|
-
// Stream manager not available yet, skip buffering
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Batch output for high-frequency data (micro-task batching)
|
|
126
|
-
session.pendingOutput += data;
|
|
127
|
-
|
|
128
|
-
if (!session.flushScheduled) {
|
|
129
|
-
session.flushScheduled = true;
|
|
130
|
-
|
|
131
|
-
// Use queueMicrotask for minimal latency batching
|
|
132
|
-
queueMicrotask(() => {
|
|
133
|
-
const output = session.pendingOutput;
|
|
134
|
-
session.pendingOutput = '';
|
|
135
|
-
session.flushScheduled = false;
|
|
136
|
-
|
|
137
|
-
// Increment sequence number for deduplication
|
|
138
|
-
session.outputSeq++;
|
|
139
|
-
|
|
140
|
-
// Broadcast batched output to all listeners
|
|
141
|
-
session.dataListeners.forEach(listener => {
|
|
142
|
-
try {
|
|
143
|
-
listener(output);
|
|
144
|
-
} catch (error) {
|
|
145
|
-
debug.error('terminal', 'Error in data listener:', error);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// Some shells do not paint the first prompt until they receive input.
|
|
153
|
-
// Only send a fallback newline if the PTY stayed completely silent after
|
|
154
|
-
// spawn; otherwise it duplicates the initial prompt on normal shells.
|
|
155
|
-
setTimeout(() => {
|
|
156
|
-
if (receivedInitialOutput) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
try {
|
|
161
|
-
pty.write('\r');
|
|
162
|
-
debug.log('terminal', '📝 Sent fallback newline to trigger prompt');
|
|
163
|
-
} catch (error) {
|
|
164
|
-
debug.error('terminal', 'Failed to send fallback newline:', error);
|
|
165
|
-
}
|
|
166
|
-
}, 350);
|
|
167
|
-
|
|
168
|
-
pty.onExit((event: { exitCode: number; signal?: number | string }) => {
|
|
169
|
-
debug.log('terminal', `🏁 PTY session ${sessionId} exited with code: ${event.exitCode}`);
|
|
170
|
-
// Broadcast to all listeners
|
|
171
|
-
session.exitListeners.forEach(listener => {
|
|
172
|
-
try {
|
|
173
|
-
listener(event);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
debug.error('terminal', 'Error in exit listener:', error);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
// Remove session
|
|
179
|
-
this.sessions.delete(sessionId);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// Store session
|
|
183
|
-
this.sessions.set(sessionId, session);
|
|
184
|
-
|
|
185
|
-
return session;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Get existing session
|
|
190
|
-
*/
|
|
191
|
-
getSession(sessionId: string): PtySession | undefined {
|
|
192
|
-
return this.sessions.get(sessionId);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Write data to PTY (stdin)
|
|
197
|
-
*/
|
|
198
|
-
write(sessionId: string, data: string): boolean {
|
|
199
|
-
const session = this.sessions.get(sessionId);
|
|
200
|
-
if (!session || !session.pty) {
|
|
201
|
-
debug.error('terminal', `❌ Cannot write to session ${sessionId}: session not found`);
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
try {
|
|
206
|
-
session.pty.write(data);
|
|
207
|
-
session.lastActivityAt = new Date();
|
|
208
|
-
return true;
|
|
209
|
-
} catch (error) {
|
|
210
|
-
debug.error('terminal', `❌ Error writing to PTY ${sessionId}:`, error);
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Resize PTY
|
|
217
|
-
*/
|
|
218
|
-
resize(sessionId: string, cols: number, rows: number): boolean {
|
|
219
|
-
const session = this.sessions.get(sessionId);
|
|
220
|
-
if (!session || !session.pty) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
try {
|
|
225
|
-
session.pty.resize(cols, rows);
|
|
226
|
-
debug.log('terminal', `🔧 PTY ${sessionId} resized to ${cols}x${rows}`);
|
|
227
|
-
return true;
|
|
228
|
-
} catch (error) {
|
|
229
|
-
debug.error('terminal', `❌ Error resizing PTY ${sessionId}:`, error);
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Kill PTY session
|
|
236
|
-
*/
|
|
237
|
-
killSession(sessionId: string, signal?: string): boolean {
|
|
238
|
-
const session = this.sessions.get(sessionId);
|
|
239
|
-
if (!session || !session.pty) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
try {
|
|
244
|
-
debug.log('terminal', `💀 Killing PTY session ${sessionId}`);
|
|
245
|
-
|
|
246
|
-
if (signal === 'SIGKILL' || signal === '9') {
|
|
247
|
-
session.pty.kill('SIGKILL');
|
|
248
|
-
} else if (signal === 'SIGTERM' || signal === '15') {
|
|
249
|
-
session.pty.kill('SIGTERM');
|
|
250
|
-
} else {
|
|
251
|
-
// Send Ctrl+C first for graceful termination
|
|
252
|
-
session.pty.write('\x03');
|
|
253
|
-
|
|
254
|
-
// Follow up with SIGKILL after delay
|
|
255
|
-
setTimeout(() => {
|
|
256
|
-
if (this.sessions.has(sessionId)) {
|
|
257
|
-
try {
|
|
258
|
-
session.pty.kill('SIGKILL');
|
|
259
|
-
} catch {
|
|
260
|
-
// Already dead, ignore
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}, 1000);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
this.sessions.delete(sessionId);
|
|
267
|
-
return true;
|
|
268
|
-
} catch (error) {
|
|
269
|
-
debug.error('terminal', `❌ Error killing PTY ${sessionId}:`, error);
|
|
270
|
-
this.sessions.delete(sessionId); // Remove anyway
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Add data listener
|
|
277
|
-
*/
|
|
278
|
-
addDataListener(sessionId: string, listener: (data: string) => void): boolean {
|
|
279
|
-
const session = this.sessions.get(sessionId);
|
|
280
|
-
if (!session) {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
session.dataListeners.add(listener);
|
|
284
|
-
return true;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Remove data listener
|
|
289
|
-
*/
|
|
290
|
-
removeDataListener(sessionId: string, listener: (data: string) => void): boolean {
|
|
291
|
-
const session = this.sessions.get(sessionId);
|
|
292
|
-
if (!session) {
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
return session.dataListeners.delete(listener);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Add exit listener
|
|
300
|
-
*/
|
|
301
|
-
addExitListener(
|
|
302
|
-
sessionId: string,
|
|
303
|
-
listener: (event: { exitCode: number; signal?: number | string }) => void
|
|
304
|
-
): boolean {
|
|
305
|
-
const session = this.sessions.get(sessionId);
|
|
306
|
-
if (!session) {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
session.exitListeners.add(listener);
|
|
310
|
-
return true;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Remove exit listener
|
|
315
|
-
*/
|
|
316
|
-
removeExitListener(
|
|
317
|
-
sessionId: string,
|
|
318
|
-
listener: (event: { exitCode: number; signal?: number | string }) => void
|
|
319
|
-
): boolean {
|
|
320
|
-
const session = this.sessions.get(sessionId);
|
|
321
|
-
if (!session) {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
return session.exitListeners.delete(listener);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Get all active sessions
|
|
329
|
-
*/
|
|
330
|
-
getAllSessions(): PtySession[] {
|
|
331
|
-
return Array.from(this.sessions.values());
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Cleanup all sessions (on shutdown)
|
|
336
|
-
*/
|
|
337
|
-
dispose() {
|
|
338
|
-
debug.log('terminal', '🧹 Disposing all PTY sessions');
|
|
339
|
-
|
|
340
|
-
for (const sessionId of this.sessions.keys()) {
|
|
341
|
-
this.killSession(sessionId, 'SIGKILL');
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
this.sessions.clear();
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// Export singleton instance
|
|
349
|
-
export const ptySessionManager = new PtySessionManager();
|