agentgui 1.0.708 → 1.0.709

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.
@@ -36,6 +36,31 @@ export class JsonlWatcher {
36
36
  for (const t of this._timers.values()) clearTimeout(t);
37
37
  }
38
38
 
39
+ removeConversation(conversationId) {
40
+ const sids = [...this._convMap.entries()].filter(([, cid]) => cid === conversationId).map(([sid]) => sid);
41
+ for (const sid of sids) {
42
+ this._convMap.delete(sid);
43
+ this._seqs.delete(sid);
44
+ for (const key of [...this._frags.keys()]) if (key.startsWith(`${sid}:`)) this._frags.delete(key);
45
+ const fp = path.join(PROJECTS_DIR, sid + '.jsonl');
46
+ const s = this._tails.get(fp);
47
+ if (s?.fd !== null) try { fs.closeSync(s.fd); } catch (_) {}
48
+ this._tails.delete(fp);
49
+ const t = this._timers.get(fp);
50
+ if (t) { clearTimeout(t); this._timers.delete(fp); }
51
+ }
52
+ }
53
+
54
+ removeAllConversations() {
55
+ for (const s of this._tails.values()) if (s.fd !== null) try { fs.closeSync(s.fd); } catch (_) {}
56
+ for (const t of this._timers.values()) clearTimeout(t);
57
+ this._tails.clear();
58
+ this._convMap.clear();
59
+ this._frags.clear();
60
+ this._timers.clear();
61
+ this._seqs.clear();
62
+ }
63
+
39
64
  _scan() {
40
65
  try {
41
66
  for (const d of fs.readdirSync(PROJECTS_DIR, { withFileTypes: true })) {
@@ -41,7 +41,8 @@ const ConvSteerSchema = z.object({
41
41
 
42
42
  export function register(router, deps) {
43
43
  const { queries, activeExecutions, messageQueues, rateLimitState,
44
- broadcastSync, processMessageWithStreaming, cleanupExecution, logError = () => {} } = deps;
44
+ broadcastSync, processMessageWithStreaming, cleanupExecution, logError = () => {},
45
+ getJsonlWatcher = () => null } = deps;
45
46
 
46
47
  // Per-conversation queue seq counter for event ordering
47
48
  const queueSeqByConv = new Map();
@@ -88,12 +89,14 @@ export function register(router, deps) {
88
89
 
89
90
  router.handle('conv.del', (p) => {
90
91
  if (!queries.deleteConversation(p.id)) notFound();
92
+ getJsonlWatcher()?.removeConversation(p.id);
91
93
  broadcastSync({ type: 'conversation_deleted', conversationId: p.id });
92
94
  return { deleted: true };
93
95
  });
94
96
 
95
97
  router.handle('conv.del.all', (p) => {
96
98
  if (!queries.deleteAllConversations()) fail(500, 'Failed to delete all conversations');
99
+ getJsonlWatcher()?.removeAllConversations();
97
100
  broadcastSync({ type: 'all_conversations_deleted', timestamp: Date.now() });
98
101
  return { deleted: true, message: 'All conversations deleted' };
99
102
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.708",
3
+ "version": "1.0.709",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -4518,7 +4518,8 @@ const wsRouter = new WsRouter();
4518
4518
 
4519
4519
  registerConvHandlers(wsRouter, {
4520
4520
  queries, activeExecutions, messageQueues, rateLimitState,
4521
- broadcastSync, processMessageWithStreaming, cleanupExecution, logError
4521
+ broadcastSync, processMessageWithStreaming, cleanupExecution, logError,
4522
+ getJsonlWatcher: () => jsonlWatcher
4522
4523
  });
4523
4524
 
4524
4525
  console.log('[INIT] About to call registerSessionHandlers, discoveredAgents.length:', discoveredAgents.length);