@yemi33/minions 0.1.1929 → 0.1.1930
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.
|
@@ -182,24 +182,45 @@ async function _ccDashboardHealth() {
|
|
|
182
182
|
// Triggered by the CC "Restart Minions" recovery button when a stale dashboard
|
|
183
183
|
// connection is killing CC streams with "Failed to fetch". Spawns the same
|
|
184
184
|
// `minions restart` flow as the CLI command (kills + respawns engine AND
|
|
185
|
-
// dashboard).
|
|
186
|
-
//
|
|
187
|
-
//
|
|
185
|
+
// dashboard). Then polls /api/health until the new dashboard is online before
|
|
186
|
+
// reloading — fixed timers either fired too early (reload hits dead port) or
|
|
187
|
+
// fired after the fetch threw (dashboard killed mid-response → 500ms reload
|
|
188
|
+
// to nothing).
|
|
188
189
|
async function ccRestartMinions(btn) {
|
|
189
190
|
if (btn) { try { btn.disabled = true; btn.textContent = 'Restarting...'; } catch {} }
|
|
191
|
+
// Fire and forget the POST. We do NOT await it — the dashboard often kills
|
|
192
|
+
// its own process before the response is flushed, so the fetch throws even
|
|
193
|
+
// though the restart child is happily running. Whatever the POST does, the
|
|
194
|
+
// next step (wait-for-healthy) is the truth.
|
|
190
195
|
try {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
fetch('/api/dashboard/restart', { method: 'POST', headers: { 'Content-Type': 'application/json' } })
|
|
197
|
+
.catch(function() { /* dashboard process likely killed mid-response — expected */ });
|
|
198
|
+
} catch { /* network layer threw before fetch even queued — also expected */ }
|
|
199
|
+
if (btn) { try { btn.textContent = 'Restarting Minions — waiting for new dashboard...'; } catch {} }
|
|
200
|
+
var startedAt = Date.now();
|
|
201
|
+
var DEADLINE_MS = 60000;
|
|
202
|
+
var INTERVAL_MS = 500;
|
|
203
|
+
function pollHealth() {
|
|
204
|
+
fetch('/api/health', { cache: 'no-store' }).then(function(res) {
|
|
205
|
+
if (res && res.ok) {
|
|
206
|
+
if (btn) { try { btn.textContent = 'Dashboard online — reloading...'; } catch {} }
|
|
207
|
+
try { location.reload(); } catch {}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
throw new Error('not ok');
|
|
211
|
+
}).catch(function() {
|
|
212
|
+
if (Date.now() - startedAt > DEADLINE_MS) {
|
|
213
|
+
if (btn) { try { btn.textContent = 'Restart timed out — reloading...'; } catch {} }
|
|
214
|
+
try { location.reload(); } catch {}
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
setTimeout(pollHealth, INTERVAL_MS);
|
|
218
|
+
});
|
|
202
219
|
}
|
|
220
|
+
// Don't poll immediately — give the restart child a moment to actually kill
|
|
221
|
+
// the old dashboard. If we polled at t=0 we'd hit the OLD (dying) dashboard
|
|
222
|
+
// and prematurely reload before the new one is up.
|
|
223
|
+
setTimeout(pollHealth, 2000);
|
|
203
224
|
}
|
|
204
225
|
|
|
205
226
|
function _ccIsReconnectableStreamError(err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1930",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|