agentgui 1.0.531 → 1.0.532

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
@@ -1389,7 +1389,7 @@ export const queries = {
1389
1389
  });
1390
1390
  },
1391
1391
 
1392
- getRecentConversationChunks(conversationId, limit) {
1392
+ getRecentConversationChunks(conversationId, limit = 500) {
1393
1393
  const stmt = prep(
1394
1394
  `SELECT id, sessionId, conversationId, sequence, type, data, created_at
1395
1395
  FROM chunks WHERE conversationId = ?
@@ -1409,6 +1409,31 @@ export const queries = {
1409
1409
  });
1410
1410
  },
1411
1411
 
1412
+ getRecentMessages(conversationId, limit = 20) {
1413
+ const countStmt = prep('SELECT COUNT(*) as count FROM messages WHERE conversationId = ?');
1414
+ const total = countStmt.get(conversationId).count;
1415
+
1416
+ const stmt = prep(
1417
+ 'SELECT * FROM messages WHERE conversationId = ? ORDER BY created_at DESC LIMIT ? '
1418
+ );
1419
+ const messages = stmt.all(conversationId, limit).reverse();
1420
+
1421
+ return {
1422
+ messages: messages.map(msg => {
1423
+ if (typeof msg.content === 'string') {
1424
+ try {
1425
+ msg.content = JSON.parse(msg.content);
1426
+ } catch (_) {}
1427
+ }
1428
+ return msg;
1429
+ }),
1430
+ total,
1431
+ limit,
1432
+ offset: Math.max(0, total - limit),
1433
+ hasMore: total > limit
1434
+ };
1435
+ },
1436
+
1412
1437
  getChunksSince(sessionId, timestamp) {
1413
1438
  const stmt = prep(
1414
1439
  `SELECT id, sessionId, conversationId, sequence, type, data, created_at
@@ -47,13 +47,21 @@ export function register(router, deps) {
47
47
  const conv = queries.getConversation(p.id);
48
48
  if (!conv) notFound();
49
49
  const chunkLimit = Math.min(p.chunkLimit || 500, 5000);
50
+ const messageLimit = Math.min(p.messageLimit || 20, 100);
50
51
  const totalChunks = queries.getConversationChunkCount(p.id);
51
52
  const chunks = (p.allChunks || totalChunks <= chunkLimit)
52
53
  ? queries.getConversationChunks(p.id) : queries.getRecentConversationChunks(p.id, chunkLimit);
54
+ const messagesResult = queries.getRecentMessages(p.id, messageLimit);
53
55
  return {
54
- conversation: conv, isActivelyStreaming: activeExecutions.has(p.id),
55
- latestSession: queries.getLatestSession(p.id), chunks, totalChunks,
56
- messages: queries.getPaginatedMessages(p.id, 100, 0).messages,
56
+ conversation: conv,
57
+ isActivelyStreaming: activeExecutions.has(p.id),
58
+ latestSession: queries.getLatestSession(p.id),
59
+ chunks,
60
+ totalChunks,
61
+ hasMoreChunks: totalChunks > chunkLimit,
62
+ messages: messagesResult.messages,
63
+ totalMessages: messagesResult.total,
64
+ hasMoreMessages: messagesResult.hasMore,
57
65
  rateLimitInfo: rateLimitState.get(p.id) || null
58
66
  };
59
67
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.531",
3
+ "version": "1.0.532",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",