agentgui 1.0.808 → 1.0.809

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/lib/db-queries.js CHANGED
@@ -598,18 +598,24 @@ export function createQueries(db, prep, generateId) {
598
598
  }
599
599
  },
600
600
 
601
- cleanup() {
602
- const thirtyDaysAgo = Date.now() - (30 * 24 * 60 * 60 * 1000);
603
- const now = Date.now();
604
-
605
- const cleanupStmt = db.transaction(() => {
606
- prep('DELETE FROM events WHERE created_at < ?').run(thirtyDaysAgo);
607
- prep('DELETE FROM sessions WHERE completed_at IS NOT NULL AND completed_at < ?').run(thirtyDaysAgo);
608
- prep('DELETE FROM idempotencyKeys WHERE (created_at + ttl) < ?').run(now);
609
- });
610
-
611
- cleanupStmt();
612
- },
601
+ cleanup() {
602
+ const thirtyDaysAgo = Date.now() - (30 * 24 * 60 * 60 * 1000);
603
+ const sevenDaysAgo = Date.now() - (7 * 24 * 60 * 60 * 1000);
604
+ const now = Date.now();
605
+
606
+ const cleanupStmt = db.transaction(() => {
607
+ prep('DELETE FROM events WHERE created_at < ?').run(thirtyDaysAgo);
608
+ prep('DELETE FROM sessions WHERE completed_at IS NOT NULL AND completed_at < ?').run(thirtyDaysAgo);
609
+ prep('DELETE FROM idempotencyKeys WHERE (created_at + ttl) < ?').run(now);
610
+ // Prune chunks and stream_updates for completed sessions older than 7 days
611
+ prep('DELETE FROM chunks WHERE sessionId IN (SELECT id FROM sessions WHERE completed_at IS NOT NULL AND completed_at < ?)').run(sevenDaysAgo);
612
+ prep('DELETE FROM stream_updates WHERE sessionId IN (SELECT id FROM sessions WHERE completed_at IS NOT NULL AND completed_at < ?)').run(sevenDaysAgo);
613
+ // Clean expired voice cache
614
+ prep('DELETE FROM voice_cache WHERE expires_at <= ?').run(now);
615
+ });
616
+
617
+ cleanupStmt();
618
+ },
613
619
 
614
620
  setIdempotencyKey(key, value) {
615
621
  const now = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.808",
3
+ "version": "1.0.809",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "electron/main.js",
package/server.js CHANGED
@@ -3171,6 +3171,12 @@ function onServerReady() {
3171
3171
  recoverStaleSessions();
3172
3172
  warmAssetCache();
3173
3173
 
3174
+ // Run DB cleanup on startup and every 6 hours
3175
+ try { queries.cleanup(); console.log('[cleanup] Initial DB cleanup complete'); } catch (e) { console.error('[cleanup] Error:', e.message); }
3176
+ setInterval(() => {
3177
+ try { queries.cleanup(); console.log('[cleanup] Scheduled DB cleanup complete'); } catch (e) { console.error('[cleanup] Error:', e.message); }
3178
+ }, 6 * 60 * 60 * 1000);
3179
+
3174
3180
  try {
3175
3181
  jsonlWatcher = new JsonlWatcher({ broadcastSync, queries, ownedSessionIds });
3176
3182
  jsonlWatcher.start();