fix: eliminate duplicate WebSocket messages during agent history priming

- Skip dispatching individual agent_stream events when replaying history
  (the snapshot is sent after priming anyway, so individual events were wasted)
- Add WebSocket message logging on client (type, size, id) for debugging
- Change default daemon URL from dev to localhost
- Clean up unused imports in session.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2025-11-28 17:44:07 +00:00
co-authored by Claude
parent 3dc517366d
commit ae4678bca8
4 changed files with 24 additions and 8 deletions
@@ -707,7 +707,11 @@ export class AgentManager {
break;
}
this.dispatchStream(agent.id, event);
// Skip dispatching individual stream events during history replay.
// The caller will send a batched agent_stream_snapshot after priming.
if (!options?.fromHistory) {
this.dispatchStream(agent.id, event);
}
}
private recordTimeline(agent: ManagedAgent, item: AgentTimelineItem): void {
+1 -1
View File
@@ -1,6 +1,6 @@
import { v4 as uuidv4 } from "uuid";
import { readFile, mkdir, writeFile } from "fs/promises";
import { exec, spawn } from "child_process";
import { exec } from "child_process";
import { promisify, inspect } from "util";
import { join } from "path";
import invariant from "tiny-invariant";