agentgui 1.0.728 → 1.0.730
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/CLAUDE.md +19 -8
- package/lib/tool-install-machine.js +157 -0
- package/lib/tool-manager.js +1 -2
- package/lib/tool-provisioner.js +6 -1
- package/lib/tool-spawner.js +24 -11
- package/lib/ws-handlers-util.js +5 -1
- package/package.json +1 -1
- package/server.js +24 -5
- package/static/index.html +5 -0
- package/static/js/client.js +5 -30
- package/static/js/conv-list-machine.js +137 -0
- package/static/js/conversations.js +39 -74
- package/static/js/prompt-machine.js +108 -0
- package/static/js/tool-install-machine.js +155 -0
- package/static/js/tools-manager-ui.js +119 -0
- package/static/js/tools-manager.js +164 -435
- package/static/js/voice-machine.js +145 -0
- package/static/js/voice.js +132 -119
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
window.toolsManagerUI = {
|
|
3
|
+
getStatusColor: function(tool) {
|
|
4
|
+
var ms = window.toolInstallMachineAPI ? window.toolInstallMachineAPI.getState(tool.id) : null;
|
|
5
|
+
if (ms === 'installing' || ms === 'updating') return '#3b82f6';
|
|
6
|
+
if (ms === 'needs_update') return '#f59e0b';
|
|
7
|
+
if (ms === 'installed') return '#10b981';
|
|
8
|
+
if (ms === 'failed') return '#ef4444';
|
|
9
|
+
if (tool.status === 'installing' || tool.status === 'updating') return '#3b82f6';
|
|
10
|
+
if (tool.status === 'needs_update' || (tool.status === 'installed' && tool.hasUpdate)) return '#f59e0b';
|
|
11
|
+
if (tool.status === 'installed') return '#10b981';
|
|
12
|
+
if (tool.status === 'failed') return '#ef4444';
|
|
13
|
+
return '#6b7280';
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
getStatusText: function(tool) {
|
|
17
|
+
var ms = window.toolInstallMachineAPI ? window.toolInstallMachineAPI.getState(tool.id) : null;
|
|
18
|
+
if (ms === 'installing') return 'Installing...';
|
|
19
|
+
if (ms === 'updating') return 'Updating...';
|
|
20
|
+
if (ms === 'needs_update') return 'Update available';
|
|
21
|
+
if (ms === 'installed') return tool.hasUpdate ? 'Update available' : 'Up-to-date';
|
|
22
|
+
if (ms === 'failed') return 'Installation failed';
|
|
23
|
+
if (tool.status === 'installing') return 'Installing...';
|
|
24
|
+
if (tool.status === 'updating') return 'Updating...';
|
|
25
|
+
if (tool.status === 'needs_update') return 'Update available';
|
|
26
|
+
if (tool.status === 'installed') return tool.hasUpdate ? 'Update available' : 'Up-to-date';
|
|
27
|
+
if (tool.status === 'failed') return 'Installation failed';
|
|
28
|
+
return 'Not installed';
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
getStatusClass: function(tool) {
|
|
32
|
+
var ms = window.toolInstallMachineAPI ? window.toolInstallMachineAPI.getState(tool.id) : null;
|
|
33
|
+
if (ms === 'installing' || ms === 'updating') return 'installing';
|
|
34
|
+
if (ms === 'needs_update') return 'updating';
|
|
35
|
+
if (ms === 'installed') return 'installed';
|
|
36
|
+
if (ms === 'failed') return 'failed';
|
|
37
|
+
if (tool.status === 'installing' || tool.status === 'updating') return 'installing';
|
|
38
|
+
if (tool.status === 'needs_update' || (tool.status === 'installed' && tool.hasUpdate)) return 'updating';
|
|
39
|
+
if (tool.status === 'installed') return 'installed';
|
|
40
|
+
if (tool.status === 'failed') return 'failed';
|
|
41
|
+
return 'not-installed';
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
renderToolCard: function(tool, isRefreshing) {
|
|
45
|
+
var ui = window.toolsManagerUI;
|
|
46
|
+
var statusClass = ui.getStatusClass(tool);
|
|
47
|
+
var ms = window.toolInstallMachineAPI ? window.toolInstallMachineAPI.getState(tool.id) : null;
|
|
48
|
+
var isInstalling = ms === 'installing' || ms === 'updating';
|
|
49
|
+
var snap = window.__toolInstallMachines && window.__toolInstallMachines.get(tool.id) ? window.__toolInstallMachines.get(tool.id).getSnapshot() : null;
|
|
50
|
+
var progress = snap ? snap.context.progress : 0;
|
|
51
|
+
var locked = window.toolInstallMachineAPI ? window.toolInstallMachineAPI.isLocked(tool.id) : false;
|
|
52
|
+
var canInstall = ms === 'idle' || ms === 'failed' || tool.status === 'not_installed' || tool.status === 'failed';
|
|
53
|
+
var canUpdate = ms === 'needs_update' || tool.hasUpdate || tool.status === 'needs_update';
|
|
54
|
+
var iv = (snap && snap.context.installedVersion) || tool.installedVersion;
|
|
55
|
+
var pv = (snap && snap.context.publishedVersion) || tool.publishedVersion;
|
|
56
|
+
var versionInfo = '';
|
|
57
|
+
if (iv || pv) {
|
|
58
|
+
versionInfo = '<div class="tool-versions">';
|
|
59
|
+
if (iv) versionInfo += '<span class="tool-version-item">v' + ui.esc(iv) + '</span>';
|
|
60
|
+
if (pv && iv !== pv) versionInfo += '<span class="tool-version-item">(v' + ui.esc(pv) + ' available)</span>';
|
|
61
|
+
versionInfo += '</div>';
|
|
62
|
+
}
|
|
63
|
+
return '<div class="tool-item">' +
|
|
64
|
+
'<div style="display: flex; flex-direction: column; gap: 0.3rem;">' +
|
|
65
|
+
'<div class="tool-header"><span class="tool-name">' + ui.esc(tool.name || tool.id) + '</span></div>' +
|
|
66
|
+
'<div class="tool-status-indicator ' + statusClass + '"><span class="tool-status-dot"></span><span>' + ui.getStatusText(tool) + '</span></div>' +
|
|
67
|
+
versionInfo +
|
|
68
|
+
(isInstalling && progress !== undefined ? '<div class="tool-progress-container"><div class="tool-progress-bar"><div class="tool-progress-fill" style="width:' + Math.min(progress, 100) + '%"></div></div></div>' : '') +
|
|
69
|
+
(tool.error_message ? '<div class="tool-error-message">Error: ' + ui.esc(tool.error_message.substring(0, 40)) + '</div>' : '') +
|
|
70
|
+
'</div>' +
|
|
71
|
+
'<div class="tool-actions">' +
|
|
72
|
+
(canInstall ? '<button class="tool-btn tool-btn-primary" onclick="window.toolsManager.install(\'' + tool.id + '\')" ' + (locked ? 'disabled' : '') + '>Install</button>' :
|
|
73
|
+
canUpdate ? '<button class="tool-btn tool-btn-primary" onclick="window.toolsManager.update(\'' + tool.id + '\')" ' + (locked ? 'disabled' : '') + '>Update</button>' :
|
|
74
|
+
'<button class="tool-btn tool-btn-secondary" onclick="window.toolsManager.refresh()" ' + (isRefreshing ? 'disabled' : '') + '>✓</button>') +
|
|
75
|
+
'</div></div>';
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
esc: function(s) {
|
|
79
|
+
var d = document.createElement('div');
|
|
80
|
+
d.textContent = s;
|
|
81
|
+
return d.innerHTML;
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
updateVoiceSelector: function(voices) {
|
|
85
|
+
var voiceSelector = document.getElementById('toolsVoiceSelector');
|
|
86
|
+
if (!voiceSelector || !voices || !Array.isArray(voices)) return;
|
|
87
|
+
var currentValue = voiceSelector.value || localStorage.getItem('toolsVoice') || 'default';
|
|
88
|
+
voiceSelector.innerHTML = '';
|
|
89
|
+
var builtIn = voices.filter(function(v) { return !v.isCustom; });
|
|
90
|
+
var custom = voices.filter(function(v) { return v.isCustom; });
|
|
91
|
+
if (builtIn.length) {
|
|
92
|
+
var grp1 = document.createElement('optgroup');
|
|
93
|
+
grp1.label = 'Built-in Voices';
|
|
94
|
+
builtIn.forEach(function(voice) {
|
|
95
|
+
var opt = document.createElement('option');
|
|
96
|
+
opt.value = voice.id;
|
|
97
|
+
var parts = [];
|
|
98
|
+
if (voice.gender && voice.gender !== 'custom') parts.push(voice.gender);
|
|
99
|
+
if (voice.accent && voice.accent !== 'custom') parts.push(voice.accent);
|
|
100
|
+
opt.textContent = voice.name + (parts.length ? ' (' + parts.join(', ') + ')' : '');
|
|
101
|
+
grp1.appendChild(opt);
|
|
102
|
+
});
|
|
103
|
+
voiceSelector.appendChild(grp1);
|
|
104
|
+
}
|
|
105
|
+
if (custom.length) {
|
|
106
|
+
var grp2 = document.createElement('optgroup');
|
|
107
|
+
grp2.label = 'Custom Voices';
|
|
108
|
+
custom.forEach(function(voice) {
|
|
109
|
+
var opt = document.createElement('option');
|
|
110
|
+
opt.value = voice.id;
|
|
111
|
+
opt.textContent = voice.name;
|
|
112
|
+
grp2.appendChild(opt);
|
|
113
|
+
});
|
|
114
|
+
voiceSelector.appendChild(grp2);
|
|
115
|
+
}
|
|
116
|
+
if (voiceSelector.querySelector('option[value="' + currentValue + '"]')) voiceSelector.value = currentValue;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
})();
|