agentgui 1.0.731 → 1.0.733
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/tool-version.js +46 -4
- package/package.json +1 -1
- package/scripts/copy-vendor.js +1 -1
- package/static/js/conversations.js +1 -1
- package/static/lib/webjsx.js +26 -0
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/scripts/copy-vendor.js
CHANGED
|
@@ -22,7 +22,7 @@ for (const [src, dest] of copies) {
|
|
|
22
22
|
// Build webjsx IIFE bundle from ESM dist files
|
|
23
23
|
const webjsxDist = path.join(root, 'node_modules/webjsx/dist');
|
|
24
24
|
if (fs.existsSync(webjsxDist)) {
|
|
25
|
-
const ORDER = ['constants', 'elementTags', 'utils', 'attributes', 'createDOMElement', 'createElement', 'applyDiff', 'types'];
|
|
25
|
+
const ORDER = ['constants', 'elementTags', 'utils', 'renderSuspension', 'attributes', 'createDOMElement', 'createElement', 'applyDiff', 'types'];
|
|
26
26
|
|
|
27
27
|
function stripModule(src) {
|
|
28
28
|
return src
|
|
@@ -156,7 +156,7 @@ class ConversationManager {
|
|
|
156
156
|
|
|
157
157
|
async fetchHomePath() {
|
|
158
158
|
try {
|
|
159
|
-
const res = await fetch(`${window.
|
|
159
|
+
const res = await fetch(`${window.__BASE_URL || '/gm'}/api/home`);
|
|
160
160
|
const data = await res.json();
|
|
161
161
|
this.folderBrowser.homePath = data.home || '~';
|
|
162
162
|
this.folderBrowser.cwdPath = data.cwd || null;
|
package/static/lib/webjsx.js
CHANGED
|
@@ -206,6 +206,32 @@ function getWebJSXChildNodeCache(element) {
|
|
|
206
206
|
return element.__webjsx_childNodes;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
// === renderSuspension.js ===
|
|
210
|
+
function definesRenderSuspension(el) {
|
|
211
|
+
return !!el.__webjsx_suspendRendering;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Executes a callback with render suspension handling.
|
|
215
|
+
* @param el Element that may have render suspension
|
|
216
|
+
* @param callback Function to execute during suspension
|
|
217
|
+
* @returns Result of the callback
|
|
218
|
+
*/
|
|
219
|
+
function withRenderSuspension(el, callback) {
|
|
220
|
+
const isRenderingSuspended = !!el
|
|
221
|
+
.__webjsx_suspendRendering;
|
|
222
|
+
if (isRenderingSuspended) {
|
|
223
|
+
el.__webjsx_suspendRendering();
|
|
224
|
+
}
|
|
225
|
+
try {
|
|
226
|
+
return callback();
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
if (isRenderingSuspended) {
|
|
230
|
+
el.__webjsx_resumeRendering();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
209
235
|
// === attributes.js ===
|
|
210
236
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
211
237
|
|