@bytespell/amux 0.0.23 → 0.0.25
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/package.json +1 -1
- package/src/session.ts +15 -2
package/package.json
CHANGED
package/src/session.ts
CHANGED
|
@@ -314,7 +314,20 @@ export class AgentSession extends EventEmitter {
|
|
|
314
314
|
* @param sessionId Optional session ID to restore
|
|
315
315
|
*/
|
|
316
316
|
async spawnAgent(cwd?: string, sessionId?: string): Promise<void> {
|
|
317
|
-
|
|
317
|
+
console.log(`[amux] spawnAgent called with cwd=${cwd}, sessionId=${sessionId}`);
|
|
318
|
+
|
|
319
|
+
// If agent is already running, handle session switch if requested
|
|
320
|
+
if (this.agentProcess) {
|
|
321
|
+
if (sessionId && sessionId !== this._sessionId) {
|
|
322
|
+
console.log(`[amux] Agent already running, switching to session: ${sessionId}`);
|
|
323
|
+
try {
|
|
324
|
+
await this.switchSession(sessionId);
|
|
325
|
+
} catch (err) {
|
|
326
|
+
console.error('[amux] Failed to switch session:', err);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
318
331
|
|
|
319
332
|
// If cwd or sessionId provided, update before spawning
|
|
320
333
|
if (cwd) {
|
|
@@ -353,7 +366,7 @@ export class AgentSession extends EventEmitter {
|
|
|
353
366
|
return;
|
|
354
367
|
}
|
|
355
368
|
|
|
356
|
-
console.log(`[amux] Spawning ${agent.name} agent in cwd:`, this._cwd);
|
|
369
|
+
console.log(`[amux] Spawning ${agent.name} agent in cwd:`, this._cwd, 'sessionId:', this._sessionId);
|
|
357
370
|
this.emit('connecting', {});
|
|
358
371
|
|
|
359
372
|
// Spawn using the resolved absolute path to the ACP binary
|