agentgui 1.0.613 → 1.0.614
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-manager.js +48 -5
- package/package.json +1 -1
- package/server.js +12 -11
- package/static/js/tools-manager.js +1 -1
package/lib/tool-manager.js
CHANGED
|
@@ -5,11 +5,11 @@ import path from 'path';
|
|
|
5
5
|
|
|
6
6
|
const isWindows = os.platform() === 'win32';
|
|
7
7
|
const TOOLS = [
|
|
8
|
-
{ id: 'gm-cc', name: '
|
|
9
|
-
{ id: 'gm-oc', name: '
|
|
10
|
-
{ id: 'gm-gc', name: '
|
|
11
|
-
{ id: 'gm-kilo', name: '
|
|
12
|
-
{ id: 'codex', name: '
|
|
8
|
+
{ id: 'gm-cc', name: 'Claude Code', pkg: 'gm-cc', pluginId: 'gm-cc' },
|
|
9
|
+
{ id: 'gm-oc', name: 'OpenCode', pkg: 'gm-oc', pluginId: 'gm-oc' },
|
|
10
|
+
{ id: 'gm-gc', name: 'Gemini CLI', pkg: 'gm-gc', pluginId: 'gm' },
|
|
11
|
+
{ id: 'gm-kilo', name: 'Kilo', pkg: 'gm-kilo', pluginId: 'gm-kilo' },
|
|
12
|
+
{ id: 'codex', name: 'Codex CLI', pkg: '@openai/codex', pluginId: 'codex' },
|
|
13
13
|
];
|
|
14
14
|
|
|
15
15
|
const statusCache = new Map();
|
|
@@ -389,3 +389,46 @@ export async function getAllToolsAsync() {
|
|
|
389
389
|
export function getToolConfig(toolId) {
|
|
390
390
|
return getTool(toolId) || null;
|
|
391
391
|
}
|
|
392
|
+
|
|
393
|
+
export async function autoProvision(broadcast) {
|
|
394
|
+
const log = (msg) => console.log('[TOOLS-AUTO] ' + msg);
|
|
395
|
+
log('Starting background tool provisioning...');
|
|
396
|
+
for (const tool of TOOLS) {
|
|
397
|
+
try {
|
|
398
|
+
const status = await checkToolViaBunx(tool.pkg, tool.pluginId);
|
|
399
|
+
statusCache.set(tool.id, { ...status, toolId: tool.id, timestamp: Date.now() });
|
|
400
|
+
if (!status.installed) {
|
|
401
|
+
log(`${tool.id} not installed, installing...`);
|
|
402
|
+
broadcast({ type: 'tool_install_started', toolId: tool.id });
|
|
403
|
+
const result = await install(tool.id, (msg) => {
|
|
404
|
+
broadcast({ type: 'tool_install_progress', toolId: tool.id, data: msg });
|
|
405
|
+
});
|
|
406
|
+
if (result.success) {
|
|
407
|
+
log(`${tool.id} installed v${result.version}`);
|
|
408
|
+
broadcast({ type: 'tool_install_complete', toolId: tool.id, data: result });
|
|
409
|
+
} else {
|
|
410
|
+
log(`${tool.id} install failed: ${result.error}`);
|
|
411
|
+
broadcast({ type: 'tool_install_failed', toolId: tool.id, data: result });
|
|
412
|
+
}
|
|
413
|
+
} else if (status.upgradeNeeded) {
|
|
414
|
+
log(`${tool.id} needs update (${status.installedVersion} -> ${status.publishedVersion})`);
|
|
415
|
+
broadcast({ type: 'tool_install_started', toolId: tool.id });
|
|
416
|
+
const result = await update(tool.id, (msg) => {
|
|
417
|
+
broadcast({ type: 'tool_update_progress', toolId: tool.id, data: msg });
|
|
418
|
+
});
|
|
419
|
+
if (result.success) {
|
|
420
|
+
log(`${tool.id} updated to v${result.version}`);
|
|
421
|
+
broadcast({ type: 'tool_update_complete', toolId: tool.id, data: result });
|
|
422
|
+
} else {
|
|
423
|
+
log(`${tool.id} update failed: ${result.error}`);
|
|
424
|
+
broadcast({ type: 'tool_update_failed', toolId: tool.id, data: result });
|
|
425
|
+
}
|
|
426
|
+
} else {
|
|
427
|
+
log(`${tool.id} v${status.installedVersion} up-to-date`);
|
|
428
|
+
}
|
|
429
|
+
} catch (err) {
|
|
430
|
+
log(`${tool.id} error: ${err.message}`);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
log('Provisioning complete');
|
|
434
|
+
}
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -4768,17 +4768,18 @@ function onServerReady() {
|
|
|
4768
4768
|
|
|
4769
4769
|
const toolIds = ['gm-oc', 'gm-gc', 'gm-kilo', 'gm-cc', 'codex'];
|
|
4770
4770
|
queries.initializeToolInstallations(toolIds.map(id => ({ id })));
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4771
|
+
console.log('[TOOLS] Starting background provisioning...');
|
|
4772
|
+
toolManager.autoProvision((evt) => {
|
|
4773
|
+
broadcastSync(evt);
|
|
4774
|
+
if (evt.type === 'tool_install_complete' || evt.type === 'tool_update_complete') {
|
|
4775
|
+
const d = evt.data || {};
|
|
4776
|
+
queries.updateToolStatus(evt.toolId, { status: 'installed', version: d.version || null, installed_at: Date.now() });
|
|
4777
|
+
queries.addToolInstallHistory(evt.toolId, evt.type.includes('update') ? 'update' : 'install', 'success', null);
|
|
4778
|
+
} else if (evt.type === 'tool_install_failed' || evt.type === 'tool_update_failed') {
|
|
4779
|
+
queries.updateToolStatus(evt.toolId, { status: 'failed', error_message: evt.data?.error });
|
|
4780
|
+
queries.addToolInstallHistory(evt.toolId, evt.type.includes('update') ? 'update' : 'install', 'failed', evt.data?.error);
|
|
4781
|
+
}
|
|
4782
|
+
}).catch(err => console.error('[TOOLS] Auto-provision error:', err.message));
|
|
4782
4783
|
|
|
4783
4784
|
ensureModelsDownloaded().then(async ok => {
|
|
4784
4785
|
if (ok) console.log('[MODELS] Speech models ready');
|
|
@@ -322,7 +322,7 @@
|
|
|
322
322
|
return '<div class="tool-item">' +
|
|
323
323
|
'<div style="display: flex; flex-direction: column; gap: 0.3rem;">' +
|
|
324
324
|
'<div class="tool-header">' +
|
|
325
|
-
'<span class="tool-name">' + esc(tool.id) + '</span>' +
|
|
325
|
+
'<span class="tool-name">' + esc(tool.name || tool.id) + '</span>' +
|
|
326
326
|
'</div>' +
|
|
327
327
|
'<div class="tool-status-indicator ' + statusClass + '">' +
|
|
328
328
|
'<span class="tool-status-dot"></span>' +
|