agentgui 1.0.733 → 1.0.734

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
@@ -1523,22 +1523,31 @@ export const queries = {
1523
1523
  },
1524
1524
 
1525
1525
  getRecentConversationChunks(conversationId, limit = 500) {
1526
- const stmt = prep(
1526
+ // Always include the complete latest session so tool_use/tool_result pairs are intact.
1527
+ // Then fill remaining capacity with older chunks.
1528
+ const latestSession = prep(
1529
+ `SELECT sessionId FROM chunks WHERE conversationId = ? ORDER BY created_at DESC LIMIT 1`
1530
+ ).get(conversationId);
1531
+ if (!latestSession) return [];
1532
+ const latestSid = latestSession.sessionId;
1533
+ const latestRows = prep(
1527
1534
  `SELECT id, sessionId, conversationId, sequence, type, data, created_at
1528
- FROM chunks WHERE conversationId = ?
1529
- ORDER BY created_at DESC LIMIT ?`
1530
- );
1531
- const rows = stmt.all(conversationId, limit);
1532
- rows.reverse();
1533
- return rows.map(row => {
1534
- try {
1535
- return {
1536
- ...row,
1537
- data: typeof row.data === 'string' ? JSON.parse(row.data) : row.data
1538
- };
1539
- } catch (e) {
1540
- return row;
1541
- }
1535
+ FROM chunks WHERE conversationId = ? AND sessionId = ? ORDER BY created_at ASC`
1536
+ ).all(conversationId, latestSid);
1537
+ const remaining = limit - latestRows.length;
1538
+ let olderRows = [];
1539
+ if (remaining > 0) {
1540
+ const oldestLatest = latestRows.length ? latestRows[0].created_at : Date.now();
1541
+ olderRows = prep(
1542
+ `SELECT id, sessionId, conversationId, sequence, type, data, created_at
1543
+ FROM chunks WHERE conversationId = ? AND sessionId != ? AND created_at < ?
1544
+ ORDER BY created_at DESC LIMIT ?`
1545
+ ).all(conversationId, latestSid, oldestLatest, remaining);
1546
+ olderRows.reverse();
1547
+ }
1548
+ return [...olderRows, ...latestRows].map(row => {
1549
+ try { return { ...row, data: typeof row.data === 'string' ? JSON.parse(row.data) : row.data }; }
1550
+ catch (e) { return row; }
1542
1551
  });
1543
1552
  },
1544
1553
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.733",
3
+ "version": "1.0.734",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "electron/main.js",
@@ -2706,7 +2706,7 @@ class AgentGUIClient {
2706
2706
 
2707
2707
  let fullData;
2708
2708
  try {
2709
- fullData = await window.wsClient.rpc('conv.full', { id: conversationId, chunkLimit: 50 });
2709
+ fullData = await window.wsClient.rpc('conv.full', { id: conversationId });
2710
2710
  if (convSignal.aborted) return;
2711
2711
  } catch (wsErr) {
2712
2712
  if (wsErr.code === 404) {