@d86e/hive-panel 1.0.24 → 1.0.26
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 +1 -0
- package/public/panel.js +108 -62
package/package.json
CHANGED
package/public/panel.css
CHANGED
package/public/panel.js
CHANGED
|
@@ -2409,9 +2409,6 @@ export const messages = Object.freeze({
|
|
|
2409
2409
|
"supervisor.tooltipError": "Last error: {error}",
|
|
2410
2410
|
"supervisor.scopeBlockedTitle": "Cross-repository call blocked",
|
|
2411
2411
|
"supervisor.scopeBlocked": "{tool} asked for repository {repo}, but this Session only controls {cwd}. The call was rejected.",
|
|
2412
|
-
"supervisor.resume": "resume",
|
|
2413
|
-
"supervisor.resumeAria": "Resume the supervisor for {repo}",
|
|
2414
|
-
"supervisor.resumeFailed": "Could not resume the supervisor",
|
|
2415
2412
|
"limits.open": "Settings",
|
|
2416
2413
|
"limits.openAria": "Open agent concurrency settings",
|
|
2417
2414
|
"limits.title": "Agent concurrency",
|
|
@@ -2521,6 +2518,19 @@ export const messages = Object.freeze({
|
|
|
2521
2518
|
"queen.dismissAria": "Close this notice; it does not change Queen mode",
|
|
2522
2519
|
"help.queen": "Queen mode",
|
|
2523
2520
|
"help.queenDesc": "Type /queen off in the chat box to leave Queen mode; this session then returns to normal coding mode.",
|
|
2521
|
+
"queen.exited": "Queen mode is off",
|
|
2522
|
+
"queen.exitSupervisor": "Supervisor queen: {state}",
|
|
2523
|
+
"queen.exitSupervisorCleared": "cleared",
|
|
2524
|
+
"queen.exitSupervisorStopped": "stopped",
|
|
2525
|
+
"queen.exitSupervisorNotCleared": "not cleared",
|
|
2526
|
+
"queen.exitInterrupted": "Current turn: {state}",
|
|
2527
|
+
"queen.exitInterruptedYes": "interrupted",
|
|
2528
|
+
"queen.exitInterruptedNo": "not interrupted",
|
|
2529
|
+
"queen.exitInterruptUnsupported": "interrupt not supported",
|
|
2530
|
+
"queen.exitMessage": "Stop message: {state}",
|
|
2531
|
+
"queen.exitMessageYes": "delivered",
|
|
2532
|
+
"queen.exitMessageNo": "not delivered",
|
|
2533
|
+
"queen.exitNotices": "Notices: {notices}",
|
|
2524
2534
|
"queen.status.active": "Queen active",
|
|
2525
2535
|
"queen.status.inactive": "Queen not active",
|
|
2526
2536
|
"queen.source.auto": "auto",
|
|
@@ -2787,9 +2797,6 @@ export const messages = Object.freeze({
|
|
|
2787
2797
|
"supervisor.tooltipError": "最近错误:{error}",
|
|
2788
2798
|
"supervisor.scopeBlockedTitle": "跨仓库调用被拒绝",
|
|
2789
2799
|
"supervisor.scopeBlocked": "{tool} 发起跨仓库请求:仓库 {repo},但本会话只允许操作 {cwd};该调用已被拒绝。",
|
|
2790
|
-
"supervisor.resume": "恢复",
|
|
2791
|
-
"supervisor.resumeAria": "恢复 {repo} 的 supervisor",
|
|
2792
|
-
"supervisor.resumeFailed": "恢复 supervisor 失败",
|
|
2793
2800
|
"limits.open": "设置",
|
|
2794
2801
|
"limits.openAria": "打开智能体并发上限设置",
|
|
2795
2802
|
"limits.title": "智能体的并发上限",
|
|
@@ -2899,6 +2906,19 @@ export const messages = Object.freeze({
|
|
|
2899
2906
|
"queen.dismissAria": "关闭提示,不影响女王状态",
|
|
2900
2907
|
"help.queen": "女王模式",
|
|
2901
2908
|
"help.queenDesc": "在对话框输入 /queen off 退出女王模式,退出后本会话恢复普通编码模式。",
|
|
2909
|
+
"queen.exited": "女王模式已关闭",
|
|
2910
|
+
"queen.exitSupervisor": "监督器女王:{state}",
|
|
2911
|
+
"queen.exitSupervisorCleared": "已注销",
|
|
2912
|
+
"queen.exitSupervisorStopped": "已停止投递",
|
|
2913
|
+
"queen.exitSupervisorNotCleared": "未注销",
|
|
2914
|
+
"queen.exitInterrupted": "当前回合:{state}",
|
|
2915
|
+
"queen.exitInterruptedYes": "已中断",
|
|
2916
|
+
"queen.exitInterruptedNo": "未中断",
|
|
2917
|
+
"queen.exitInterruptUnsupported": "宿主不支持中断",
|
|
2918
|
+
"queen.exitMessage": "停止消息:{state}",
|
|
2919
|
+
"queen.exitMessageYes": "已送达",
|
|
2920
|
+
"queen.exitMessageNo": "未送达",
|
|
2921
|
+
"queen.exitNotices": "提示:{notices}",
|
|
2902
2922
|
"queen.status.active": "女王已接管",
|
|
2903
2923
|
"queen.status.inactive": "女王未接管",
|
|
2904
2924
|
"queen.source.auto": "自动",
|
|
@@ -3333,6 +3353,24 @@ export function renderModel(snapshot) {
|
|
|
3333
3353
|
const initialised = source.initialised !== false;
|
|
3334
3354
|
const rawQueen = isRecord(source.queen) ? source.queen : null;
|
|
3335
3355
|
const queenActive = rawQueen !== null && rawQueen.active === true;
|
|
3356
|
+
const rawExit = rawQueen && !queenActive && isRecord(rawQueen.exit) ? rawQueen.exit : null;
|
|
3357
|
+
const queenExit = rawExit === null
|
|
3358
|
+
? null
|
|
3359
|
+
: {
|
|
3360
|
+
at: asString(rawExit.at),
|
|
3361
|
+
supervisor: isRecord(rawExit.supervisor)
|
|
3362
|
+
? {
|
|
3363
|
+
cleared: rawExit.supervisor.cleared === true,
|
|
3364
|
+
method: asString(rawExit.supervisor.method),
|
|
3365
|
+
stoppedDelivery: rawExit.supervisor.stoppedDelivery === true,
|
|
3366
|
+
error: asString(rawExit.supervisor.error) || null,
|
|
3367
|
+
}
|
|
3368
|
+
: null,
|
|
3369
|
+
interrupted: rawExit.interrupted === true,
|
|
3370
|
+
interruptSupported: rawExit.interruptSupported !== false,
|
|
3371
|
+
messageDelivered: rawExit.messageDelivered === true,
|
|
3372
|
+
notices: Array.isArray(rawExit.notices) ? rawExit.notices.map(asString).filter(Boolean) : [],
|
|
3373
|
+
};
|
|
3336
3374
|
const queen =
|
|
3337
3375
|
rawQueen === null
|
|
3338
3376
|
? null
|
|
@@ -3343,6 +3381,7 @@ export function renderModel(snapshot) {
|
|
|
3343
3381
|
? rawQueen.source
|
|
3344
3382
|
: null,
|
|
3345
3383
|
repo: typeof rawQueen.repo === "string" ? rawQueen.repo : "",
|
|
3384
|
+
exit: queenExit,
|
|
3346
3385
|
};
|
|
3347
3386
|
const rawRoles = isRecord(source.roles) ? source.roles : null;
|
|
3348
3387
|
const rolesLimits = {};
|
|
@@ -3655,6 +3694,10 @@ function normalizeSupervisorStatus(payload) {
|
|
|
3655
3694
|
lastError,
|
|
3656
3695
|
roles: roleRows,
|
|
3657
3696
|
workers: normalizeSupervisorWorkers(source),
|
|
3697
|
+
workersKnown: Array.isArray(source.workers),
|
|
3698
|
+
unmanaged: source.unmanaged === true || source.waiting === "no-queen-session",
|
|
3699
|
+
waiting: asString(source.waiting),
|
|
3700
|
+
queenSessionId: asString(source.queenSessionId),
|
|
3658
3701
|
});
|
|
3659
3702
|
}
|
|
3660
3703
|
const result = [...rows.values()].sort((left, right) => left.repo.localeCompare(right.repo));
|
|
@@ -4240,12 +4283,14 @@ export function mount(root, options = {}) {
|
|
|
4240
4283
|
let initRequestSeq = 0;
|
|
4241
4284
|
let queenNotice = false;
|
|
4242
4285
|
let queenBusy = false;
|
|
4286
|
+
let queenSeen = false;
|
|
4287
|
+
let queenWasActive = false;
|
|
4288
|
+
let queenExitSignature = "";
|
|
4243
4289
|
const queenDismissedFallback = new Set();
|
|
4244
4290
|
let supervisorData = [];
|
|
4245
4291
|
let supervisorMeta = { count: 0, last: null };
|
|
4246
4292
|
let supervisorScopeSignature = null;
|
|
4247
4293
|
let supervisorRequest = null;
|
|
4248
|
-
let supervisorInlineRow = null;
|
|
4249
4294
|
let limitsOverlay = null;
|
|
4250
4295
|
let limitsDialogNode = null;
|
|
4251
4296
|
let limitsState = null;
|
|
@@ -4278,15 +4323,9 @@ export function mount(root, options = {}) {
|
|
|
4278
4323
|
const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
|
|
4279
4324
|
const supervisorInlineSep = element(doc, "span", "hive-supervisor-inline-sep", "·");
|
|
4280
4325
|
const supervisorInlineState = element(doc, "span", "hive-supervisor-inline-state", "");
|
|
4281
|
-
const supervisorInlineResume = element(doc, "button", "hive-btn hive-supervisor-inline-resume is-hidden", translate("supervisor.resume"));
|
|
4282
|
-
setAttr(supervisorInlineResume, "type", "button");
|
|
4283
|
-
supervisorInlineResume.addEventListener("click", () => {
|
|
4284
|
-
if (supervisorInlineRow) void resumeSupervisor(supervisorInlineRow, supervisorInlineResume);
|
|
4285
|
-
});
|
|
4286
4326
|
supervisorInline.appendChild(supervisorInlineLabel);
|
|
4287
4327
|
supervisorInline.appendChild(supervisorInlineSep);
|
|
4288
4328
|
supervisorInline.appendChild(supervisorInlineState);
|
|
4289
|
-
supervisorInline.appendChild(supervisorInlineResume);
|
|
4290
4329
|
bar.appendChild(supervisorInline);
|
|
4291
4330
|
|
|
4292
4331
|
const statsNode = element(doc, "div", "hive-stats");
|
|
@@ -7204,9 +7243,49 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7204
7243
|
if (!destroyed && lastModel) renderQueenHint(lastModel);
|
|
7205
7244
|
}
|
|
7206
7245
|
|
|
7246
|
+
function maybeShowQueenExit(queen) {
|
|
7247
|
+
if (!queen) return;
|
|
7248
|
+
const active = queen.active === true;
|
|
7249
|
+
if (!queenSeen) {
|
|
7250
|
+
queenSeen = true;
|
|
7251
|
+
queenWasActive = active;
|
|
7252
|
+
return;
|
|
7253
|
+
}
|
|
7254
|
+
if (queenWasActive && !active && queen.exit) {
|
|
7255
|
+
const exit = queen.exit;
|
|
7256
|
+
const signature = [exit.at, exit.supervisor && exit.supervisor.cleared, exit.interrupted, exit.messageDelivered].join("|");
|
|
7257
|
+
if (signature !== queenExitSignature) {
|
|
7258
|
+
queenExitSignature = signature;
|
|
7259
|
+
const supervisorState = exit.supervisor && exit.supervisor.cleared
|
|
7260
|
+
? translate("queen.exitSupervisorCleared")
|
|
7261
|
+
: translate("queen.exitSupervisorNotCleared");
|
|
7262
|
+
const interruptState = exit.interrupted
|
|
7263
|
+
? translate("queen.exitInterruptedYes")
|
|
7264
|
+
: exit.interruptSupported === false
|
|
7265
|
+
? translate("queen.exitInterruptUnsupported")
|
|
7266
|
+
: translate("queen.exitInterruptedNo");
|
|
7267
|
+
const messageState = exit.messageDelivered
|
|
7268
|
+
? translate("queen.exitMessageYes")
|
|
7269
|
+
: translate("queen.exitMessageNo");
|
|
7270
|
+
const parts = [
|
|
7271
|
+
translate("queen.exitSupervisor").replace("{state}", supervisorState),
|
|
7272
|
+
translate("queen.exitInterrupted").replace("{state}", interruptState),
|
|
7273
|
+
translate("queen.exitMessage").replace("{state}", messageState),
|
|
7274
|
+
];
|
|
7275
|
+
if (Array.isArray(exit.notices) && exit.notices.length > 0) {
|
|
7276
|
+
parts.push(translate("queen.exitNotices").replace("{notices}", exit.notices.join("; ")));
|
|
7277
|
+
}
|
|
7278
|
+
const ok = Boolean(exit.supervisor && exit.supervisor.cleared && exit.interrupted && exit.messageDelivered);
|
|
7279
|
+
showToast(ok ? "success" : "error", translate("queen.exited"), parts.join(" · "));
|
|
7280
|
+
}
|
|
7281
|
+
}
|
|
7282
|
+
queenWasActive = active;
|
|
7283
|
+
}
|
|
7284
|
+
|
|
7207
7285
|
function renderQueenHint(model) {
|
|
7208
7286
|
const initialised = Boolean(model && model.initialised !== false);
|
|
7209
7287
|
const state = model && isRecord(model.queen) ? model.queen : null;
|
|
7288
|
+
maybeShowQueenExit(state);
|
|
7210
7289
|
const active = state ? state.active === true : Boolean(queenNotice);
|
|
7211
7290
|
const dismissed = active && isQueenNoticeDismissed(model ? model.repo : "");
|
|
7212
7291
|
const show = initialised && Boolean(state || queenNotice) && !dismissed;
|
|
@@ -7267,7 +7346,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7267
7346
|
renderSupervisorContent();
|
|
7268
7347
|
} catch {
|
|
7269
7348
|
supervisorData = [];
|
|
7270
|
-
supervisorInlineRow = null;
|
|
7271
7349
|
try {
|
|
7272
7350
|
supervisorInline.className = "hive-supervisor-inline is-hidden";
|
|
7273
7351
|
} catch {
|
|
@@ -7277,11 +7355,9 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7277
7355
|
}
|
|
7278
7356
|
|
|
7279
7357
|
function renderSupervisorContent() {
|
|
7280
|
-
supervisorInlineRow = null;
|
|
7281
7358
|
supervisorInline.className = "hive-supervisor-inline is-hidden";
|
|
7282
7359
|
supervisorInlineState.className = "hive-supervisor-inline-state";
|
|
7283
7360
|
supervisorInlineState.textContent = "";
|
|
7284
|
-
supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume is-hidden";
|
|
7285
7361
|
supervisorInlineLabel.textContent = translate("supervisor.label");
|
|
7286
7362
|
supervisorInlineSep.textContent = "·";
|
|
7287
7363
|
if (!lastModel) return;
|
|
@@ -7302,7 +7378,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7302
7378
|
: translate("supervisor.unresponsive");
|
|
7303
7379
|
|
|
7304
7380
|
supervisorInline.className = "hive-supervisor-inline";
|
|
7305
|
-
supervisorInlineRow = row || null;
|
|
7306
7381
|
supervisorInlineState.className = "hive-supervisor-inline-state is-" + status;
|
|
7307
7382
|
supervisorInlineState.textContent = label;
|
|
7308
7383
|
|
|
@@ -7331,12 +7406,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7331
7406
|
setAttr(supervisorInline, "title", tooltip);
|
|
7332
7407
|
setAttr(supervisorInline, "aria-label", tooltip);
|
|
7333
7408
|
|
|
7334
|
-
if (paused && row) {
|
|
7335
|
-
const aria = translate("supervisor.resumeAria").replace("{repo}", row.repo);
|
|
7336
|
-
supervisorInlineResume.className = "hive-btn hive-supervisor-inline-resume";
|
|
7337
|
-
setAttr(supervisorInlineResume, "title", aria);
|
|
7338
|
-
setAttr(supervisorInlineResume, "aria-label", aria);
|
|
7339
|
-
}
|
|
7340
7409
|
}
|
|
7341
7410
|
function setSupervisorData(rows) {
|
|
7342
7411
|
supervisorData = Array.isArray(rows) ? rows : [];
|
|
@@ -7408,32 +7477,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7408
7477
|
}
|
|
7409
7478
|
}
|
|
7410
7479
|
|
|
7411
|
-
async function resumeSupervisor(row, button) {
|
|
7412
|
-
if (destroyed || !fetchImpl) return;
|
|
7413
|
-
if (button) button.disabled = true;
|
|
7414
|
-
try {
|
|
7415
|
-
const response = await fetchImpl(supervisorEndpoint("resume"), {
|
|
7416
|
-
method: "POST",
|
|
7417
|
-
headers: { "content-type": "application/json", accept: "application/json" },
|
|
7418
|
-
body: JSON.stringify({ repo: row.repo }),
|
|
7419
|
-
});
|
|
7420
|
-
if (!response || response.ok === false) throw new Error("supervisor resume failed");
|
|
7421
|
-
let payload = null;
|
|
7422
|
-
try {
|
|
7423
|
-
payload = await response.json();
|
|
7424
|
-
} catch {
|
|
7425
|
-
payload = null;
|
|
7426
|
-
}
|
|
7427
|
-
if (payload && payload.ok === false) throw new Error("supervisor resume failed");
|
|
7428
|
-
await refreshSupervisor(true);
|
|
7429
|
-
} catch (error) {
|
|
7430
|
-
if (button) button.disabled = false;
|
|
7431
|
-
if (!destroyed) {
|
|
7432
|
-
showToast("error", translate("supervisor.resumeFailed"), actionErrorDetail(error) || translate("supervisor.resumeFailed"));
|
|
7433
|
-
}
|
|
7434
|
-
}
|
|
7435
|
-
}
|
|
7436
|
-
|
|
7437
7480
|
function durationLabel(count, singularKey, pluralKey) {
|
|
7438
7481
|
const key = count === 1 ? singularKey : pluralKey;
|
|
7439
7482
|
return translate(key).replace("{count}", String(count));
|
|
@@ -7519,31 +7562,34 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7519
7562
|
function renderAgents(model) {
|
|
7520
7563
|
if (model.initialised === false) {
|
|
7521
7564
|
agentsCount.className = "hive-stat hive-agent-count is-hidden";
|
|
7522
|
-
agentsCount.textContent =
|
|
7565
|
+
agentsCount.textContent = "0";
|
|
7523
7566
|
agentsCount._agent = null;
|
|
7524
7567
|
agentsCount.disabled = true;
|
|
7525
7568
|
return;
|
|
7526
7569
|
}
|
|
7527
7570
|
const identities = model.agents.length;
|
|
7528
7571
|
const row = currentSupervisorRow();
|
|
7529
|
-
const
|
|
7530
|
-
const
|
|
7572
|
+
const managed = Boolean(row && row.unmanaged !== true && row.waiting !== "no-queen-session");
|
|
7573
|
+
const hasWorkers = Boolean(managed && row.workersKnown === true && Array.isArray(row.workers));
|
|
7574
|
+
const workers = hasWorkers ? row.workers.length : null;
|
|
7531
7575
|
const claimed = asCount(model.stats.byState.claimed, (model.lanes.claimed || []).length);
|
|
7532
7576
|
const waitingToReclaim = workers === 0 && claimed > 0;
|
|
7533
7577
|
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
7578
|
agentsCount.disabled = false;
|
|
7579
|
+
agentsCount._agent = identities > 0 ? model.agents[0] : null;
|
|
7580
|
+
if (!hasWorkers) {
|
|
7581
|
+
agentsCount.textContent = "—";
|
|
7582
|
+
const label = model.boardError ? model.boardError : "";
|
|
7583
|
+
setAttr(agentsCount, "title", label);
|
|
7584
|
+
setAttr(agentsCount, "aria-label", label);
|
|
7585
|
+
return;
|
|
7586
|
+
}
|
|
7587
|
+
agentsCount.textContent = String(workers);
|
|
7540
7588
|
const message = waitingToReclaim
|
|
7541
7589
|
? translate("agents.waitingReclaimTooltip").replace("{count}", String(claimed))
|
|
7542
|
-
:
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
.replace("{identities}", String(identities))
|
|
7546
|
-
: translate("agents.fallbackTooltip").replace("{identities}", String(identities));
|
|
7590
|
+
: translate("agents.runningTooltip")
|
|
7591
|
+
.replace("{running}", String(workers))
|
|
7592
|
+
.replace("{identities}", String(identities));
|
|
7547
7593
|
const label = model.boardError ? message + " · " + model.boardError : message;
|
|
7548
7594
|
setAttr(agentsCount, "title", label);
|
|
7549
7595
|
setAttr(agentsCount, "aria-label", label);
|