agentgui 1.0.500 → 1.0.502
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 +6 -1
- package/package.json +1 -1
- package/static/js/tools-manager.js +28 -0
package/lib/tool-manager.js
CHANGED
|
@@ -121,7 +121,12 @@ const checkToolInstalled = (pkg) => {
|
|
|
121
121
|
try {
|
|
122
122
|
const nodeModulesPath = getNodeModulesPath();
|
|
123
123
|
const nodeModulesPackagePath = path.join(nodeModulesPath, pkg);
|
|
124
|
-
|
|
124
|
+
if (fs.existsSync(nodeModulesPackagePath)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
const homeDir = os.homedir();
|
|
128
|
+
const pluginPath = path.join(homeDir, '.claude', 'plugins', pkg);
|
|
129
|
+
return fs.existsSync(pluginPath);
|
|
125
130
|
} catch (_) {
|
|
126
131
|
return false;
|
|
127
132
|
}
|
package/package.json
CHANGED
|
@@ -69,34 +69,62 @@
|
|
|
69
69
|
function install(toolId) {
|
|
70
70
|
if (operationInProgress.has(toolId)) return;
|
|
71
71
|
operationInProgress.add(toolId);
|
|
72
|
+
var tool = tools.find(t => t.id === toolId);
|
|
73
|
+
if (tool) {
|
|
74
|
+
tool.status = 'installing';
|
|
75
|
+
tool.progress = 0;
|
|
76
|
+
render();
|
|
77
|
+
}
|
|
72
78
|
fetch(`/gm/api/tools/${toolId}/install`, { method: 'POST' })
|
|
73
79
|
.then(r => r.json())
|
|
74
80
|
.then(d => {
|
|
75
81
|
if (!d.success) {
|
|
76
82
|
alert(`Install failed: ${d.error || 'Unknown error'}`);
|
|
77
83
|
operationInProgress.delete(toolId);
|
|
84
|
+
if (tool) {
|
|
85
|
+
tool.status = 'failed';
|
|
86
|
+
render();
|
|
87
|
+
}
|
|
78
88
|
}
|
|
79
89
|
})
|
|
80
90
|
.catch(e => {
|
|
81
91
|
alert(`Install failed: ${e.message}`);
|
|
82
92
|
operationInProgress.delete(toolId);
|
|
93
|
+
if (tool) {
|
|
94
|
+
tool.status = 'failed';
|
|
95
|
+
render();
|
|
96
|
+
}
|
|
83
97
|
});
|
|
84
98
|
}
|
|
85
99
|
|
|
86
100
|
function update(toolId) {
|
|
87
101
|
if (operationInProgress.has(toolId)) return;
|
|
88
102
|
operationInProgress.add(toolId);
|
|
103
|
+
var tool = tools.find(t => t.id === toolId);
|
|
104
|
+
if (tool) {
|
|
105
|
+
tool.status = 'updating';
|
|
106
|
+
tool.progress = 0;
|
|
107
|
+
render();
|
|
108
|
+
}
|
|
89
109
|
fetch(`/gm/api/tools/${toolId}/update`, { method: 'POST' })
|
|
90
110
|
.then(r => r.json())
|
|
91
111
|
.then(d => {
|
|
92
112
|
if (!d.success) {
|
|
93
113
|
alert(`Update failed: ${d.error || 'Unknown error'}`);
|
|
94
114
|
operationInProgress.delete(toolId);
|
|
115
|
+
if (tool) {
|
|
116
|
+
tool.status = 'failed';
|
|
117
|
+
render();
|
|
118
|
+
}
|
|
95
119
|
}
|
|
96
120
|
})
|
|
97
121
|
.catch(e => {
|
|
98
122
|
alert(`Update failed: ${e.message}`);
|
|
99
123
|
operationInProgress.delete(toolId);
|
|
124
|
+
if (tool) {
|
|
125
|
+
tool.status = 'failed';
|
|
126
|
+
render();
|
|
127
|
+
}
|
|
100
128
|
});
|
|
101
129
|
}
|
|
102
130
|
|