agentgui 1.0.612 → 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 +21 -24
- package/static/index.html +46 -46
- package/static/js/tools-manager.js +1 -1
- package/static/theme.js +2 -0
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
|
@@ -39,7 +39,13 @@ process.on('unhandledRejection', (reason, promise) => {
|
|
|
39
39
|
if (reason instanceof Error) console.error(reason.stack);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
process.on('SIGINT', () => {
|
|
42
|
+
process.on('SIGINT', () => {
|
|
43
|
+
console.log('[SIGNAL] SIGINT received - graceful shutdown');
|
|
44
|
+
try { pm2Manager.disconnect(); } catch (_) {}
|
|
45
|
+
stopACPTools().catch(() => {}).finally(() => {
|
|
46
|
+
try { wss.close(() => server.close(() => process.exit(0))); } catch (_) { process.exit(0); }
|
|
47
|
+
});
|
|
48
|
+
});
|
|
43
49
|
process.on('SIGHUP', () => { console.log('[SIGNAL] SIGHUP received (ignored - uncrashable)'); });
|
|
44
50
|
process.on('beforeExit', (code) => { console.log('[PROCESS] beforeExit with code:', code); });
|
|
45
51
|
process.on('exit', (code) => { console.log('[PROCESS] exit with code:', code); });
|
|
@@ -4493,18 +4499,8 @@ if (watch) {
|
|
|
4493
4499
|
process.on('SIGTERM', () => {
|
|
4494
4500
|
console.log('[SIGNAL] SIGTERM received - graceful shutdown');
|
|
4495
4501
|
try { pm2Manager.disconnect(); } catch (_) {}
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
wss.close(() => server.close(() => process.exit(0)));
|
|
4499
|
-
}).catch(() => {
|
|
4500
|
-
wss.close(() => server.close(() => process.exit(0)));
|
|
4501
|
-
});
|
|
4502
|
-
}).catch(() => {
|
|
4503
|
-
stopACPTools().then(() => {
|
|
4504
|
-
wss.close(() => server.close(() => process.exit(0)));
|
|
4505
|
-
}).catch(() => {
|
|
4506
|
-
wss.close(() => server.close(() => process.exit(0)));
|
|
4507
|
-
});
|
|
4502
|
+
stopACPTools().catch(() => {}).finally(() => {
|
|
4503
|
+
try { wss.close(() => server.close(() => process.exit(0))); } catch (_) { process.exit(0); }
|
|
4508
4504
|
});
|
|
4509
4505
|
});
|
|
4510
4506
|
|
|
@@ -4772,17 +4768,18 @@ function onServerReady() {
|
|
|
4772
4768
|
|
|
4773
4769
|
const toolIds = ['gm-oc', 'gm-gc', 'gm-kilo', 'gm-cc', 'codex'];
|
|
4774
4770
|
queries.initializeToolInstallations(toolIds.map(id => ({ id })));
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
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));
|
|
4786
4783
|
|
|
4787
4784
|
ensureModelsDownloaded().then(async ok => {
|
|
4788
4785
|
if (ok) console.log('[MODELS] Speech models ready');
|
package/static/index.html
CHANGED
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
html.dark {
|
|
46
|
-
--color-bg-primary: #
|
|
47
|
-
--color-bg-secondary: #
|
|
48
|
-
--color-text-primary: #
|
|
49
|
-
--color-text-secondary: #
|
|
50
|
-
--color-border: #
|
|
51
|
-
--color-primary: #
|
|
52
|
-
--color-primary-dark: #
|
|
46
|
+
--color-bg-primary: #1a1a1a;
|
|
47
|
+
--color-bg-secondary: #242424;
|
|
48
|
+
--color-text-primary: #e5e5e5;
|
|
49
|
+
--color-text-secondary: #a3a3a3;
|
|
50
|
+
--color-border: #333333;
|
|
51
|
+
--color-primary: #737373;
|
|
52
|
+
--color-primary-dark: #525252;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
html, body {
|
|
@@ -1007,7 +1007,7 @@
|
|
|
1007
1007
|
overflow-x: auto;
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
|
-
html.dark .html-content { background: #
|
|
1010
|
+
html.dark .html-content { background: #262626; }
|
|
1011
1011
|
|
|
1012
1012
|
.html-content table { border-collapse: collapse; width: 100%; margin: 0.5rem 0; }
|
|
1013
1013
|
.html-content th, .html-content td { padding: 0.5rem 0.75rem; text-align: left; font-size: 0.875rem; }
|
|
@@ -1777,7 +1777,7 @@
|
|
|
1777
1777
|
background: #f3f4f6;
|
|
1778
1778
|
}
|
|
1779
1779
|
html.dark .folded-tool {
|
|
1780
|
-
background: #
|
|
1780
|
+
background: #262626;
|
|
1781
1781
|
}
|
|
1782
1782
|
.folded-tool-bar {
|
|
1783
1783
|
display: flex;
|
|
@@ -1793,7 +1793,7 @@
|
|
|
1793
1793
|
transition: background 0.15s;
|
|
1794
1794
|
}
|
|
1795
1795
|
html.dark .folded-tool-bar {
|
|
1796
|
-
background: #
|
|
1796
|
+
background: #404040;
|
|
1797
1797
|
}
|
|
1798
1798
|
.folded-tool-bar::-webkit-details-marker { display: none; }
|
|
1799
1799
|
.folded-tool-bar::marker { display: none; content: ''; }
|
|
@@ -1806,10 +1806,10 @@
|
|
|
1806
1806
|
color: #6b7280;
|
|
1807
1807
|
flex-shrink: 0;
|
|
1808
1808
|
}
|
|
1809
|
-
html.dark .folded-tool-bar::before { color: #
|
|
1809
|
+
html.dark .folded-tool-bar::before { color: #a3a3a3; }
|
|
1810
1810
|
.folded-tool[open] > .folded-tool-bar::before { transform: rotate(90deg); }
|
|
1811
1811
|
.folded-tool-bar:hover { background: #d1d5db; }
|
|
1812
|
-
html.dark .folded-tool-bar:hover { background: #
|
|
1812
|
+
html.dark .folded-tool-bar:hover { background: #525252; }
|
|
1813
1813
|
.folded-tool-icon {
|
|
1814
1814
|
display: flex;
|
|
1815
1815
|
align-items: center;
|
|
@@ -1818,7 +1818,7 @@
|
|
|
1818
1818
|
height: 1rem;
|
|
1819
1819
|
flex-shrink: 0;
|
|
1820
1820
|
}
|
|
1821
|
-
html.dark .folded-tool-icon { color: #
|
|
1821
|
+
html.dark .folded-tool-icon { color: #a3a3a3; }
|
|
1822
1822
|
.folded-tool-icon svg { width: 1rem; height: 1rem; }
|
|
1823
1823
|
.folded-tool-name {
|
|
1824
1824
|
font-weight: 600;
|
|
@@ -1827,7 +1827,7 @@
|
|
|
1827
1827
|
font-size: 0.8rem;
|
|
1828
1828
|
flex-shrink: 0;
|
|
1829
1829
|
}
|
|
1830
|
-
html.dark .folded-tool-name { color: #
|
|
1830
|
+
html.dark .folded-tool-name { color: #d4d4d4; }
|
|
1831
1831
|
.folded-tool-desc {
|
|
1832
1832
|
color: #6b7280;
|
|
1833
1833
|
font-family: 'Monaco','Menlo','Ubuntu Mono', monospace;
|
|
@@ -1839,13 +1839,13 @@
|
|
|
1839
1839
|
min-width: 0;
|
|
1840
1840
|
opacity: 0.8;
|
|
1841
1841
|
}
|
|
1842
|
-
html.dark .folded-tool-desc { color: #
|
|
1842
|
+
html.dark .folded-tool-desc { color: #a3a3a3; }
|
|
1843
1843
|
.folded-tool-body {
|
|
1844
1844
|
padding: 0.5rem 0.75rem;
|
|
1845
1845
|
font-size: 0.75rem;
|
|
1846
1846
|
border-top: 1px solid #d1d5db;
|
|
1847
1847
|
}
|
|
1848
|
-
html.dark .folded-tool-body { border-top-color: #
|
|
1848
|
+
html.dark .folded-tool-body { border-top-color: #525252; }
|
|
1849
1849
|
.folded-tool-body .tool-input-pre {
|
|
1850
1850
|
margin: 0;
|
|
1851
1851
|
padding: 0.375rem 0.5rem;
|
|
@@ -2126,9 +2126,9 @@
|
|
|
2126
2126
|
.block-type-tool_result .folded-tool-icon { color: #16a34a; }
|
|
2127
2127
|
html.dark .block-type-tool_result .folded-tool-icon { color: #4ade80; }
|
|
2128
2128
|
.block-type-tool_result .folded-tool-name { color: #374151; }
|
|
2129
|
-
html.dark .block-type-tool_result .folded-tool-name { color: #
|
|
2129
|
+
html.dark .block-type-tool_result .folded-tool-name { color: #d4d4d4; }
|
|
2130
2130
|
.block-type-tool_result > .folded-tool-body { border-top-color: #d1d5db; }
|
|
2131
|
-
html.dark .block-type-tool_result > .folded-tool-body { border-top-color: #
|
|
2131
|
+
html.dark .block-type-tool_result > .folded-tool-body { border-top-color: #525252; }
|
|
2132
2132
|
.block-type-tool_result.tool-result-error { }
|
|
2133
2133
|
html.dark .block-type-tool_result.tool-result-error { }
|
|
2134
2134
|
.block-type-tool_result.tool-result-error .tool-result-status { }
|
|
@@ -2136,7 +2136,7 @@
|
|
|
2136
2136
|
.block-type-tool_result.tool-result-error .folded-tool-icon { color: #dc2626; }
|
|
2137
2137
|
html.dark .block-type-tool_result.tool-result-error .folded-tool-icon { color: #f87171; }
|
|
2138
2138
|
.block-type-tool_result.tool-result-error .folded-tool-name { color: #374151; }
|
|
2139
|
-
html.dark .block-type-tool_result.tool-result-error .folded-tool-name { color: #
|
|
2139
|
+
html.dark .block-type-tool_result.tool-result-error .folded-tool-name { color: #d4d4d4; }
|
|
2140
2140
|
|
|
2141
2141
|
|
|
2142
2142
|
|
|
@@ -2230,12 +2230,12 @@
|
|
|
2230
2230
|
padding: 0.4rem 0.75rem;
|
|
2231
2231
|
}
|
|
2232
2232
|
html.dark .tool-result-success .tool-result-status {
|
|
2233
|
-
background: #
|
|
2233
|
+
background: #404040;
|
|
2234
2234
|
}
|
|
2235
2235
|
.tool-result-success .folded-tool-icon { color: #16a34a; }
|
|
2236
2236
|
html.dark .tool-result-success .folded-tool-icon { color: #4ade80; }
|
|
2237
2237
|
.tool-result-success .folded-tool-name { color: #374151; font-weight: 600; }
|
|
2238
|
-
html.dark .tool-result-success .folded-tool-name { color: #
|
|
2238
|
+
html.dark .tool-result-success .folded-tool-name { color: #d4d4d4; }
|
|
2239
2239
|
|
|
2240
2240
|
/* --- Tool_use parent: has-success / has-error indicators (icon/arrow only, preserves tool colors) --- */
|
|
2241
2241
|
.folded-tool.has-success > .folded-tool-bar::before { color: #16a34a; }
|
|
@@ -3007,31 +3007,31 @@
|
|
|
3007
3007
|
.toast-success { background: var(--color-success); color: white; }
|
|
3008
3008
|
.toast-error { background: var(--color-error); color: white; }
|
|
3009
3009
|
.toast-warning { background: var(--color-warning); color: white; }
|
|
3010
|
-
|
|
3011
|
-
.inline-code {
|
|
3012
|
-
background: #f3f4f6;
|
|
3013
|
-
padding: 0.125rem 0.375rem;
|
|
3014
|
-
border-radius: 0.25rem;
|
|
3015
|
-
font-size: 0.875rem;
|
|
3016
|
-
font-family: ui-monospace, monospace;
|
|
3017
|
-
color: #dc2626;
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
html.dark .inline-code {
|
|
3021
|
-
background: #
|
|
3022
|
-
color: #f87171;
|
|
3023
|
-
}
|
|
3024
|
-
|
|
3025
|
-
.html-rendered-container {
|
|
3026
|
-
border-radius: 0.5rem;
|
|
3027
|
-
overflow: hidden;
|
|
3028
|
-
border: 1px solid #e5e7eb;
|
|
3029
|
-
}
|
|
3030
|
-
|
|
3031
|
-
html.dark .html-rendered-container {
|
|
3032
|
-
border-color: #
|
|
3033
|
-
}
|
|
3034
|
-
|
|
3010
|
+
|
|
3011
|
+
.inline-code {
|
|
3012
|
+
background: #f3f4f6;
|
|
3013
|
+
padding: 0.125rem 0.375rem;
|
|
3014
|
+
border-radius: 0.25rem;
|
|
3015
|
+
font-size: 0.875rem;
|
|
3016
|
+
font-family: ui-monospace, monospace;
|
|
3017
|
+
color: #dc2626;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
html.dark .inline-code {
|
|
3021
|
+
background: #262626;
|
|
3022
|
+
color: #f87171;
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
.html-rendered-container {
|
|
3026
|
+
border-radius: 0.5rem;
|
|
3027
|
+
overflow: hidden;
|
|
3028
|
+
border: 1px solid #e5e7eb;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
html.dark .html-rendered-container {
|
|
3032
|
+
border-color: #262626;
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
3035
|
</style>
|
|
3036
3036
|
<link rel="stylesheet" href="/gm/css/tools-popup.css">
|
|
3037
3037
|
</head>
|
|
@@ -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>' +
|
package/static/theme.js
CHANGED
|
@@ -40,6 +40,8 @@ class ThemeManager {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
document.documentElement.setAttribute('data-theme', theme);
|
|
43
|
+
document.documentElement.classList.remove('light', 'dark');
|
|
44
|
+
document.documentElement.classList.add(theme);
|
|
43
45
|
localStorage.setItem(this.THEME_KEY, theme);
|
|
44
46
|
this.updateThemeIcon(theme);
|
|
45
47
|
}
|