@exreve/exk 1.0.72 → 1.0.73
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/cli/agentSession.js +1 -1
- package/dist/cli/claudeBackend.js +30 -19
- package/dist/ttc-cli.tar.gz +0 -0
- package/package.json +1 -1
package/dist/cli/agentSession.js
CHANGED
|
@@ -1051,7 +1051,7 @@ export class AgentSessionManager {
|
|
|
1051
1051
|
// Delegate to backend if it supports process killing (ClaudeBackend)
|
|
1052
1052
|
if (session.backend instanceof claudeBackend.constructor) {
|
|
1053
1053
|
;
|
|
1054
|
-
session.backend.killProcesses();
|
|
1054
|
+
session.backend.killProcesses(sessionId);
|
|
1055
1055
|
return;
|
|
1056
1056
|
}
|
|
1057
1057
|
// Fallback: generic process cleanup
|
|
@@ -113,16 +113,19 @@ function lookupToolNameFromHistory(messages, toolUseId) {
|
|
|
113
113
|
// ============ Claude Backend Class ============
|
|
114
114
|
export class ClaudeBackend {
|
|
115
115
|
id = 'claude';
|
|
116
|
-
/** Tracked child processes for force-kill on emergency stop */
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
/** Tracked child processes per-session for force-kill on emergency stop */
|
|
117
|
+
childProcessesBySession = new Map();
|
|
118
|
+
processGroupIdsBySession = new Map();
|
|
119
119
|
/**
|
|
120
|
-
* Kill
|
|
120
|
+
* Kill tracked child processes for a specific session.
|
|
121
121
|
* Called by the queue manager during emergency stop.
|
|
122
122
|
*/
|
|
123
|
-
killProcesses() {
|
|
123
|
+
killProcesses(sessionId) {
|
|
124
124
|
const isWin = process.platform === 'win32';
|
|
125
|
-
|
|
125
|
+
const processes = this.childProcessesBySession.get(sessionId);
|
|
126
|
+
if (!processes)
|
|
127
|
+
return;
|
|
128
|
+
for (const child of processes) {
|
|
126
129
|
if (!child.killed) {
|
|
127
130
|
try {
|
|
128
131
|
if (isWin && child.pid) {
|
|
@@ -139,7 +142,7 @@ export class ClaudeBackend {
|
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
// Force kill after a brief grace period (sync — caller should handle timing)
|
|
142
|
-
for (const child of
|
|
145
|
+
for (const child of processes) {
|
|
143
146
|
if (!child.killed) {
|
|
144
147
|
try {
|
|
145
148
|
if (!isWin && child.pid) {
|
|
@@ -149,13 +152,14 @@ export class ClaudeBackend {
|
|
|
149
152
|
catch { /* already dead */ }
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
|
-
this.
|
|
153
|
-
|
|
155
|
+
this.childProcessesBySession.delete(sessionId);
|
|
156
|
+
const pgid = this.processGroupIdsBySession.get(sessionId);
|
|
157
|
+
if (!isWin && pgid) {
|
|
154
158
|
try {
|
|
155
|
-
process.kill(-
|
|
159
|
+
process.kill(-pgid, 'SIGKILL');
|
|
156
160
|
}
|
|
157
161
|
catch { /* already dead */ }
|
|
158
|
-
this.
|
|
162
|
+
this.processGroupIdsBySession.delete(sessionId);
|
|
159
163
|
}
|
|
160
164
|
}
|
|
161
165
|
/**
|
|
@@ -187,7 +191,7 @@ export class ClaudeBackend {
|
|
|
187
191
|
mcpServers: { 'claude-voice-modules': mcpServer },
|
|
188
192
|
...(pathToClaudeCodeExecutable ? { pathToClaudeCodeExecutable } : {}),
|
|
189
193
|
spawnClaudeCodeProcess: (spawnOptions) => {
|
|
190
|
-
return this.spawnProcess(spawnOptions, signal);
|
|
194
|
+
return this.spawnProcess(spawnOptions, signal, routingSessionId);
|
|
191
195
|
},
|
|
192
196
|
env: env || {},
|
|
193
197
|
hooks: {
|
|
@@ -473,7 +477,7 @@ export class ClaudeBackend {
|
|
|
473
477
|
/**
|
|
474
478
|
* Spawn a Claude Code child process with proper environment.
|
|
475
479
|
*/
|
|
476
|
-
spawnProcess(spawnOptions, signal) {
|
|
480
|
+
spawnProcess(spawnOptions, signal, sessionId) {
|
|
477
481
|
const { command, args, cwd, env } = spawnOptions;
|
|
478
482
|
console.log(`[ClaudeBackend] Spawn ANTHROPIC_BASE_URL:`, env?.ANTHROPIC_BASE_URL || '(not set)');
|
|
479
483
|
console.log(`[ClaudeBackend] Spawn ANTHROPIC_API_KEY:`, env?.ANTHROPIC_API_KEY ? '(set)' : '(not set)');
|
|
@@ -521,13 +525,20 @@ export class ClaudeBackend {
|
|
|
521
525
|
windowsHide: true,
|
|
522
526
|
detached: !isWin,
|
|
523
527
|
});
|
|
524
|
-
// Track for cleanup
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
+
// Track for cleanup (per-session)
|
|
529
|
+
if (sessionId) {
|
|
530
|
+
let set = this.childProcessesBySession.get(sessionId);
|
|
531
|
+
if (!set) {
|
|
532
|
+
set = new Set();
|
|
533
|
+
this.childProcessesBySession.set(sessionId, set);
|
|
534
|
+
}
|
|
535
|
+
set.add(child);
|
|
536
|
+
if (!isWin && child.pid) {
|
|
537
|
+
this.processGroupIdsBySession.set(sessionId, child.pid);
|
|
538
|
+
}
|
|
539
|
+
child.on('exit', () => { set.delete(child); });
|
|
540
|
+
child.on('error', () => { set.delete(child); });
|
|
528
541
|
}
|
|
529
|
-
child.on('exit', () => { this.childProcesses.delete(child); });
|
|
530
|
-
child.on('error', () => { this.childProcesses.delete(child); });
|
|
531
542
|
return child;
|
|
532
543
|
}
|
|
533
544
|
}
|
package/dist/ttc-cli.tar.gz
CHANGED
|
Binary file
|