agentgui 1.0.732 → 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
 
@@ -1,6 +1,7 @@
1
1
  import os from 'os';
2
2
  import fs from 'fs';
3
3
  import path from 'path';
4
+ import https from 'https';
4
5
  import { execSync } from 'child_process';
5
6
 
6
7
  const isWindows = os.platform() === 'win32';
@@ -15,10 +16,28 @@ const BIN_MAP = {
15
16
  'agent-browser': 'agent-browser',
16
17
  };
17
18
 
19
+ function getClaudeInstalledPluginPath(pluginId) {
20
+ try {
21
+ const installedPluginsPath = path.join(homeDir, '.claude', 'plugins', 'installed_plugins.json');
22
+ if (!fs.existsSync(installedPluginsPath)) return null;
23
+ const data = JSON.parse(fs.readFileSync(installedPluginsPath, 'utf-8'));
24
+ const plugins = data.plugins || {};
25
+ const key = Object.keys(plugins).find(k => k.endsWith('@' + pluginId));
26
+ if (!key) return null;
27
+ const entries = plugins[key];
28
+ if (!entries || !entries.length) return null;
29
+ return entries[0].installPath || null;
30
+ } catch (_) {}
31
+ return null;
32
+ }
33
+
18
34
  const FRAMEWORK_PATHS = {
19
35
  claude: {
20
- pluginDir: (pluginId) => path.join(homeDir, '.claude', 'plugins', pluginId),
21
- versionFile: (pluginId) => path.join(homeDir, '.claude', 'plugins', pluginId, 'plugin.json'),
36
+ pluginDir: (pluginId) => getClaudeInstalledPluginPath(pluginId) || path.join(homeDir, '.claude', 'plugins', pluginId),
37
+ versionFile: (pluginId) => {
38
+ const installPath = getClaudeInstalledPluginPath(pluginId);
39
+ return installPath ? path.join(installPath, 'plugin.json') : path.join(homeDir, '.claude', 'plugins', pluginId, 'plugin.json');
40
+ },
22
41
  parseVersion: (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8')).version,
23
42
  },
24
43
  opencode: {
@@ -164,9 +183,32 @@ const versionCache = new Map();
164
183
  export function getPublishedVersion(pkg) {
165
184
  const cacheKey = `published-${pkg}`;
166
185
  const cached = versionCache.get(cacheKey);
167
- if (cached && Date.now() - cached.timestamp < 86400000) {
186
+ if (cached && Date.now() - cached.timestamp < 3600000) {
187
+ return cached.version;
188
+ }
189
+ return null;
190
+ }
191
+
192
+ export async function fetchPublishedVersion(pkg) {
193
+ const cacheKey = `published-${pkg}`;
194
+ const cached = versionCache.get(cacheKey);
195
+ if (cached && Date.now() - cached.timestamp < 3600000) {
168
196
  return cached.version;
169
197
  }
198
+ try {
199
+ const version = await new Promise((resolve, reject) => {
200
+ const url = `https://registry.npmjs.org/${pkg}/latest`;
201
+ https.get(url, { headers: { 'User-Agent': 'agentgui-version-check/1.0' } }, (res) => {
202
+ let data = '';
203
+ res.on('data', chunk => { data += chunk; });
204
+ res.on('end', () => {
205
+ try { resolve(JSON.parse(data).version || null); } catch (e) { reject(e); }
206
+ });
207
+ }).on('error', reject);
208
+ });
209
+ if (version) versionCache.set(cacheKey, { version, timestamp: Date.now() });
210
+ return version;
211
+ } catch (_) {}
170
212
  return null;
171
213
  }
172
214
 
@@ -181,7 +223,7 @@ export async function checkToolViaBunx(pkg, pluginId = null, category = 'plugin'
181
223
  const installedVersion = isCli ? getCliVersion(pkg) : getInstalledVersion(pkg, pluginId, frameWork, tools);
182
224
  let publishedVersion = null;
183
225
  if (!skipPublishedVersion) {
184
- publishedVersion = getPublishedVersion(pkg);
226
+ publishedVersion = await fetchPublishedVersion(pkg);
185
227
  }
186
228
  const needsUpdate = installed && publishedVersion && compareVersions(installedVersion, publishedVersion);
187
229
  const isUpToDate = installed && !needsUpdate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.732",
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) {