agentgui 1.0.786 → 1.0.788

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/database.js CHANGED
@@ -289,7 +289,7 @@ function migrateFromJson() {
289
289
  // Ensure value is always valid JSON string
290
290
  const valueStr = typeof entry.value === 'string' ? entry.value : JSON.stringify(entry.value || {});
291
291
  // Ensure ttl is a number
292
- const ttl = typeof entry.ttl === 'number' ? entry.ttl : (entry.ttl ? parseInt(entry.ttl) : null);
292
+ const ttl = typeof entry.ttl === 'number' ? entry.ttl : (entry.ttl ? parseInt(entry.ttl) : 0);
293
293
  db.prepare(
294
294
  `INSERT OR REPLACE INTO idempotencyKeys (key, value, created_at, ttl) VALUES (?, ?, ?, ?)`
295
295
  ).run(key, valueStr, entry.created_at, ttl);
@@ -99,11 +99,11 @@ class AgentRunner {
99
99
  console.log(`[${this.id}] Spawned PID ${proc.pid} closeStdin=${this.closeStdin}`);
100
100
 
101
101
  if (config.onPid) {
102
- try { config.onPid(proc.pid); } catch (e) {}
102
+ try { config.onPid(proc.pid); } catch (e) { console.error(`[${this.id}] onPid callback failed:`, e.message); }
103
103
  }
104
104
 
105
105
  if (config.onProcess) {
106
- try { config.onProcess(proc); } catch (e) {}
106
+ try { config.onProcess(proc); } catch (e) { console.error(`[${this.id}] onProcess callback failed:`, e.message); }
107
107
  }
108
108
 
109
109
  let jsonBuffer = '';
@@ -298,11 +298,11 @@ class AgentRunner {
298
298
  const proc = spawn(cmd, args, spawnOpts);
299
299
 
300
300
  if (config.onPid) {
301
- try { config.onPid(proc.pid); } catch (e) {}
301
+ try { config.onPid(proc.pid); } catch (e) { console.error(`[${this.id}] onPid callback failed:`, e.message); }
302
302
  }
303
303
 
304
304
  if (config.onProcess) {
305
- try { config.onProcess(proc); } catch (e) {}
305
+ try { config.onProcess(proc); } catch (e) { console.error(`[${this.id}] onProcess callback failed:`, e.message); }
306
306
  }
307
307
 
308
308
  const outputs = [];
@@ -77,9 +77,10 @@ class ClientQueue {
77
77
  }
78
78
  const allowedCount = 100 - this.messageCount;
79
79
  if (allowedCount <= 0) {
80
- // Put everything back and reschedule don't drop events
80
+ // Put everything back and wait for next 1-second window
81
81
  this.normalPriority.unshift(...batch);
82
- this.scheduleFlush();
82
+ const msUntilReset = Math.max(50, 1000 - (now - this.windowStart));
83
+ this.timer = setTimeout(() => { this.timer = null; this.flush(); }, msUntilReset);
83
84
  return;
84
85
  }
85
86
  // Return overflow to front of queue for next flush cycle
@@ -43,7 +43,8 @@ class WsRouter {
43
43
  let parsed;
44
44
  try {
45
45
  parsed = decode(rawData);
46
- } catch {
46
+ } catch (err) {
47
+ console.warn(`[ws-protocol] Decode failed for client ${ws.clientId}:`, err.message);
47
48
  sendBinary(ws, { r: null, e: { c: 400, m: 'Invalid message' } });
48
49
  return;
49
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.786",
3
+ "version": "1.0.788",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "electron/main.js",
@@ -2837,6 +2837,7 @@ class AgentGUIClient {
2837
2837
  }
2838
2838
 
2839
2839
  const cached = this.conversationCache.get(conversationId);
2840
+ if (cached) { this.conversationCache.delete(conversationId); this.conversationCache.set(conversationId, cached); }
2840
2841
  if (cached && (Date.now() - cached.timestamp) < 300000) {
2841
2842
  const outputEl = document.getElementById('output');
2842
2843
  if (outputEl) {