@d86e/hive-panel 1.0.24 → 1.0.25
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/package.json +1 -1
- package/public/panel.css +4 -0
- package/public/panel.js +76 -24
package/package.json
CHANGED
package/public/panel.css
CHANGED
|
@@ -1374,3 +1374,7 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1374
1374
|
.hive-events-page-error-reason { color: var(--hive-fg-faint); }
|
|
1375
1375
|
.hive-events-page-retry { padding: 1px 6px; font-size: 10px; }
|
|
1376
1376
|
|
|
1377
|
+
.hive-supervisor-inline-toggle { height: auto; min-height: 0; padding: 0 2px; border: 0; background: transparent; color: var(--hive-fg-soft); font-size: 12px; line-height: 1; }
|
|
1378
|
+
.hive-supervisor-inline-toggle:hover { background: transparent; color: var(--hive-fg); }
|
|
1379
|
+
.hive-supervisor-inline-toggle.is-hidden { display: none; }
|
|
1380
|
+
|
package/public/panel.js
CHANGED
|
@@ -2187,6 +2187,9 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2187
2187
|
.hive-events-page-error { display: flex; align-items: center; gap: 6px; padding: 6px 2px; color: var(--hive-danger); font-size: 10px; }
|
|
2188
2188
|
.hive-events-page-error-reason { color: var(--hive-fg-faint); }
|
|
2189
2189
|
.hive-events-page-retry { padding: 1px 6px; font-size: 10px; }
|
|
2190
|
+
.hive-supervisor-inline-toggle { height: auto; min-height: 0; padding: 0 2px; border: 0; background: transparent; color: var(--hive-fg-soft); font-size: 12px; line-height: 1; }
|
|
2191
|
+
.hive-supervisor-inline-toggle:hover { background: transparent; color: var(--hive-fg); }
|
|
2192
|
+
.hive-supervisor-inline-toggle.is-hidden { display: none; }
|
|
2190
2193
|
`;
|
|
2191
2194
|
|
|
2192
2195
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2409,8 +2412,11 @@ export const messages = Object.freeze({
|
|
|
2409
2412
|
"supervisor.tooltipError": "Last error: {error}",
|
|
2410
2413
|
"supervisor.scopeBlockedTitle": "Cross-repository call blocked",
|
|
2411
2414
|
"supervisor.scopeBlocked": "{tool} asked for repository {repo}, but this Session only controls {cwd}. The call was rejected.",
|
|
2415
|
+
"supervisor.pause": "pause",
|
|
2412
2416
|
"supervisor.resume": "resume",
|
|
2417
|
+
"supervisor.pauseAria": "Pause the supervisor for {repo}",
|
|
2413
2418
|
"supervisor.resumeAria": "Resume the supervisor for {repo}",
|
|
2419
|
+
"supervisor.pauseFailed": "Could not pause the supervisor",
|
|
2414
2420
|
"supervisor.resumeFailed": "Could not resume the supervisor",
|
|
2415
2421
|
"limits.open": "Settings",
|
|
2416
2422
|
"limits.openAria": "Open agent concurrency settings",
|
|
@@ -2787,8 +2793,11 @@ export const messages = Object.freeze({
|
|
|
2787
2793
|
"supervisor.tooltipError": "最近错误:{error}",
|
|
2788
2794
|
"supervisor.scopeBlockedTitle": "跨仓库调用被拒绝",
|
|
2789
2795
|
"supervisor.scopeBlocked": "{tool} 发起跨仓库请求:仓库 {repo},但本会话只允许操作 {cwd};该调用已被拒绝。",
|
|
2796
|
+
"supervisor.pause": "暂停",
|
|
2790
2797
|
"supervisor.resume": "恢复",
|
|
2798
|
+
"supervisor.pauseAria": "暂停 {repo} 的 supervisor",
|
|
2791
2799
|
"supervisor.resumeAria": "恢复 {repo} 的 supervisor",
|
|
2800
|
+
"supervisor.pauseFailed": "暂停 supervisor 失败",
|
|
2792
2801
|
"supervisor.resumeFailed": "恢复 supervisor 失败",
|
|
2793
2802
|
"limits.open": "设置",
|
|
2794
2803
|
"limits.openAria": "打开智能体并发上限设置",
|
|
@@ -3655,6 +3664,10 @@ function normalizeSupervisorStatus(payload) {
|
|
|
3655
3664
|
lastError,
|
|
3656
3665
|
roles: roleRows,
|
|
3657
3666
|
workers: normalizeSupervisorWorkers(source),
|
|
3667
|
+
workersKnown: Array.isArray(source.workers),
|
|
3668
|
+
unmanaged: source.unmanaged === true || source.waiting === "no-queen-session",
|
|
3669
|
+
waiting: asString(source.waiting),
|
|
3670
|
+
queenSessionId: asString(source.queenSessionId),
|
|
3658
3671
|
});
|
|
3659
3672
|
}
|
|
3660
3673
|
const result = [...rows.values()].sort((left, right) => left.repo.localeCompare(right.repo));
|
|
@@ -4278,15 +4291,21 @@ export function mount(root, options = {}) {
|
|
|
4278
4291
|
const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
|
|
4279
4292
|
const supervisorInlineSep = element(doc, "span", "hive-supervisor-inline-sep", "·");
|
|
4280
4293
|
const supervisorInlineState = element(doc, "span", "hive-supervisor-inline-state", "");
|
|
4281
|
-
const
|
|
4282
|
-
setAttr(
|
|
4283
|
-
|
|
4284
|
-
|
|
4294
|
+
const supervisorInlineToggle = element(doc, "button", "hive-btn hive-supervisor-inline-toggle is-hidden", "");
|
|
4295
|
+
setAttr(supervisorInlineToggle, "type", "button");
|
|
4296
|
+
setAttr(supervisorInlineToggle, "data-next-action", "pause");
|
|
4297
|
+
supervisorInlineToggle.addEventListener("click", () => {
|
|
4298
|
+
if (!supervisorInlineRow) return;
|
|
4299
|
+
if (supervisorInlineToggle.getAttribute("data-next-action") === "resume") {
|
|
4300
|
+
void resumeSupervisor(supervisorInlineRow, supervisorInlineToggle);
|
|
4301
|
+
} else {
|
|
4302
|
+
void pauseSupervisor(supervisorInlineRow, supervisorInlineToggle);
|
|
4303
|
+
}
|
|
4285
4304
|
});
|
|
4286
4305
|
supervisorInline.appendChild(supervisorInlineLabel);
|
|
4287
4306
|
supervisorInline.appendChild(supervisorInlineSep);
|
|
4288
4307
|
supervisorInline.appendChild(supervisorInlineState);
|
|
4289
|
-
supervisorInline.appendChild(
|
|
4308
|
+
supervisorInline.appendChild(supervisorInlineToggle);
|
|
4290
4309
|
bar.appendChild(supervisorInline);
|
|
4291
4310
|
|
|
4292
4311
|
const statsNode = element(doc, "div", "hive-stats");
|
|
@@ -7281,7 +7300,8 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7281
7300
|
supervisorInline.className = "hive-supervisor-inline is-hidden";
|
|
7282
7301
|
supervisorInlineState.className = "hive-supervisor-inline-state";
|
|
7283
7302
|
supervisorInlineState.textContent = "";
|
|
7284
|
-
|
|
7303
|
+
supervisorInlineToggle.className = "hive-btn hive-supervisor-inline-toggle is-hidden";
|
|
7304
|
+
setAttr(supervisorInlineToggle, "data-next-action", "pause");
|
|
7285
7305
|
supervisorInlineLabel.textContent = translate("supervisor.label");
|
|
7286
7306
|
supervisorInlineSep.textContent = "·";
|
|
7287
7307
|
if (!lastModel) return;
|
|
@@ -7331,11 +7351,14 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7331
7351
|
setAttr(supervisorInline, "title", tooltip);
|
|
7332
7352
|
setAttr(supervisorInline, "aria-label", tooltip);
|
|
7333
7353
|
|
|
7334
|
-
if (
|
|
7335
|
-
const
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
setAttr(
|
|
7354
|
+
if (row) {
|
|
7355
|
+
const nextAction = paused ? "resume" : "pause";
|
|
7356
|
+
supervisorInlineToggle.className = "hive-btn hive-supervisor-inline-toggle";
|
|
7357
|
+
supervisorInlineToggle.textContent = translate(paused ? "supervisor.resume" : "supervisor.pause");
|
|
7358
|
+
setAttr(supervisorInlineToggle, "data-next-action", nextAction);
|
|
7359
|
+
const aria = translate(paused ? "supervisor.resumeAria" : "supervisor.pauseAria").replace("{repo}", row.repo);
|
|
7360
|
+
setAttr(supervisorInlineToggle, "title", aria);
|
|
7361
|
+
setAttr(supervisorInlineToggle, "aria-label", aria);
|
|
7339
7362
|
}
|
|
7340
7363
|
}
|
|
7341
7364
|
function setSupervisorData(rows) {
|
|
@@ -7408,6 +7431,32 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7408
7431
|
}
|
|
7409
7432
|
}
|
|
7410
7433
|
|
|
7434
|
+
async function pauseSupervisor(row, button) {
|
|
7435
|
+
if (destroyed || !fetchImpl) return;
|
|
7436
|
+
if (button) button.disabled = true;
|
|
7437
|
+
try {
|
|
7438
|
+
const response = await fetchImpl(supervisorEndpoint("pause"), {
|
|
7439
|
+
method: "POST",
|
|
7440
|
+
headers: { "content-type": "application/json", accept: "application/json" },
|
|
7441
|
+
body: JSON.stringify({ repo: row.repo }),
|
|
7442
|
+
});
|
|
7443
|
+
if (!response || response.ok === false) throw new Error("supervisor pause failed");
|
|
7444
|
+
let payload = null;
|
|
7445
|
+
try {
|
|
7446
|
+
payload = await response.json();
|
|
7447
|
+
} catch {
|
|
7448
|
+
payload = null;
|
|
7449
|
+
}
|
|
7450
|
+
if (payload && payload.ok === false) throw new Error("supervisor pause failed");
|
|
7451
|
+
await refreshSupervisor(true);
|
|
7452
|
+
} catch (error) {
|
|
7453
|
+
if (button) button.disabled = false;
|
|
7454
|
+
if (!destroyed) {
|
|
7455
|
+
showToast("error", translate("supervisor.pauseFailed"), actionErrorDetail(error) || translate("supervisor.pauseFailed"));
|
|
7456
|
+
}
|
|
7457
|
+
}
|
|
7458
|
+
}
|
|
7459
|
+
|
|
7411
7460
|
async function resumeSupervisor(row, button) {
|
|
7412
7461
|
if (destroyed || !fetchImpl) return;
|
|
7413
7462
|
if (button) button.disabled = true;
|
|
@@ -7519,31 +7568,34 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7519
7568
|
function renderAgents(model) {
|
|
7520
7569
|
if (model.initialised === false) {
|
|
7521
7570
|
agentsCount.className = "hive-stat hive-agent-count is-hidden";
|
|
7522
|
-
agentsCount.textContent =
|
|
7571
|
+
agentsCount.textContent = "0";
|
|
7523
7572
|
agentsCount._agent = null;
|
|
7524
7573
|
agentsCount.disabled = true;
|
|
7525
7574
|
return;
|
|
7526
7575
|
}
|
|
7527
7576
|
const identities = model.agents.length;
|
|
7528
7577
|
const row = currentSupervisorRow();
|
|
7529
|
-
const
|
|
7530
|
-
const
|
|
7578
|
+
const managed = Boolean(row && row.unmanaged !== true && row.waiting !== "no-queen-session");
|
|
7579
|
+
const hasWorkers = Boolean(managed && row.workersKnown === true && Array.isArray(row.workers));
|
|
7580
|
+
const workers = hasWorkers ? row.workers.length : null;
|
|
7531
7581
|
const claimed = asCount(model.stats.byState.claimed, (model.lanes.claimed || []).length);
|
|
7532
7582
|
const waitingToReclaim = workers === 0 && claimed > 0;
|
|
7533
7583
|
agentsCount.className = "hive-stat hive-agent-count";
|
|
7534
|
-
agentsCount.textContent = waitingToReclaim
|
|
7535
|
-
? translate("agents.waitingReclaim").replace("{count}", String(claimed))
|
|
7536
|
-
: translate("pane.agents") + " " + String(running);
|
|
7537
|
-
const first = identities > 0 ? model.agents[0] : null;
|
|
7538
|
-
agentsCount._agent = first;
|
|
7539
7584
|
agentsCount.disabled = false;
|
|
7585
|
+
agentsCount._agent = identities > 0 ? model.agents[0] : null;
|
|
7586
|
+
if (!hasWorkers) {
|
|
7587
|
+
agentsCount.textContent = "—";
|
|
7588
|
+
const label = model.boardError ? model.boardError : "";
|
|
7589
|
+
setAttr(agentsCount, "title", label);
|
|
7590
|
+
setAttr(agentsCount, "aria-label", label);
|
|
7591
|
+
return;
|
|
7592
|
+
}
|
|
7593
|
+
agentsCount.textContent = String(workers);
|
|
7540
7594
|
const message = waitingToReclaim
|
|
7541
7595
|
? translate("agents.waitingReclaimTooltip").replace("{count}", String(claimed))
|
|
7542
|
-
:
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
.replace("{identities}", String(identities))
|
|
7546
|
-
: translate("agents.fallbackTooltip").replace("{identities}", String(identities));
|
|
7596
|
+
: translate("agents.runningTooltip")
|
|
7597
|
+
.replace("{running}", String(workers))
|
|
7598
|
+
.replace("{identities}", String(identities));
|
|
7547
7599
|
const label = model.boardError ? message + " · " + model.boardError : message;
|
|
7548
7600
|
setAttr(agentsCount, "title", label);
|
|
7549
7601
|
setAttr(agentsCount, "aria-label", label);
|