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 +24 -15
- package/lib/tool-version.js +46 -4
- package/package.json +1 -1
- package/static/js/client.js +1 -1
package/database.js
CHANGED
|
@@ -1523,22 +1523,31 @@ export const queries = {
|
|
|
1523
1523
|
},
|
|
1524
1524
|
|
|
1525
1525
|
getRecentConversationChunks(conversationId, limit = 500) {
|
|
1526
|
-
|
|
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
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
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/lib/tool-version.js
CHANGED
|
@@ -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) =>
|
|
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 <
|
|
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 =
|
|
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
package/static/js/client.js
CHANGED
|
@@ -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
|
|
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) {
|