@d86e/hive-panel 1.0.25 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d86e/hive-panel",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "A read-only board for a Hive swarm: agents, task lanes and the event tail, served from the refs and files you already have.",
5
5
  "type": "module",
6
6
  "bin": {
package/public/panel.css CHANGED
@@ -1374,7 +1374,4 @@ 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
1377
 
package/public/panel.js CHANGED
@@ -2187,9 +2187,6 @@ 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; }
2193
2190
  `;
2194
2191
 
2195
2192
  const LANE_LABEL_KEYS = Object.freeze({
@@ -2412,12 +2409,6 @@ export const messages = Object.freeze({
2412
2409
  "supervisor.tooltipError": "Last error: {error}",
2413
2410
  "supervisor.scopeBlockedTitle": "Cross-repository call blocked",
2414
2411
  "supervisor.scopeBlocked": "{tool} asked for repository {repo}, but this Session only controls {cwd}. The call was rejected.",
2415
- "supervisor.pause": "pause",
2416
- "supervisor.resume": "resume",
2417
- "supervisor.pauseAria": "Pause the supervisor for {repo}",
2418
- "supervisor.resumeAria": "Resume the supervisor for {repo}",
2419
- "supervisor.pauseFailed": "Could not pause the supervisor",
2420
- "supervisor.resumeFailed": "Could not resume the supervisor",
2421
2412
  "limits.open": "Settings",
2422
2413
  "limits.openAria": "Open agent concurrency settings",
2423
2414
  "limits.title": "Agent concurrency",
@@ -2527,6 +2518,19 @@ export const messages = Object.freeze({
2527
2518
  "queen.dismissAria": "Close this notice; it does not change Queen mode",
2528
2519
  "help.queen": "Queen mode",
2529
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}",
2530
2534
  "queen.status.active": "Queen active",
2531
2535
  "queen.status.inactive": "Queen not active",
2532
2536
  "queen.source.auto": "auto",
@@ -2793,12 +2797,6 @@ export const messages = Object.freeze({
2793
2797
  "supervisor.tooltipError": "最近错误:{error}",
2794
2798
  "supervisor.scopeBlockedTitle": "跨仓库调用被拒绝",
2795
2799
  "supervisor.scopeBlocked": "{tool} 发起跨仓库请求:仓库 {repo},但本会话只允许操作 {cwd};该调用已被拒绝。",
2796
- "supervisor.pause": "暂停",
2797
- "supervisor.resume": "恢复",
2798
- "supervisor.pauseAria": "暂停 {repo} 的 supervisor",
2799
- "supervisor.resumeAria": "恢复 {repo} 的 supervisor",
2800
- "supervisor.pauseFailed": "暂停 supervisor 失败",
2801
- "supervisor.resumeFailed": "恢复 supervisor 失败",
2802
2800
  "limits.open": "设置",
2803
2801
  "limits.openAria": "打开智能体并发上限设置",
2804
2802
  "limits.title": "智能体的并发上限",
@@ -2908,6 +2906,19 @@ export const messages = Object.freeze({
2908
2906
  "queen.dismissAria": "关闭提示,不影响女王状态",
2909
2907
  "help.queen": "女王模式",
2910
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}",
2911
2922
  "queen.status.active": "女王已接管",
2912
2923
  "queen.status.inactive": "女王未接管",
2913
2924
  "queen.source.auto": "自动",
@@ -3342,6 +3353,24 @@ export function renderModel(snapshot) {
3342
3353
  const initialised = source.initialised !== false;
3343
3354
  const rawQueen = isRecord(source.queen) ? source.queen : null;
3344
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
+ };
3345
3374
  const queen =
3346
3375
  rawQueen === null
3347
3376
  ? null
@@ -3352,6 +3381,7 @@ export function renderModel(snapshot) {
3352
3381
  ? rawQueen.source
3353
3382
  : null,
3354
3383
  repo: typeof rawQueen.repo === "string" ? rawQueen.repo : "",
3384
+ exit: queenExit,
3355
3385
  };
3356
3386
  const rawRoles = isRecord(source.roles) ? source.roles : null;
3357
3387
  const rolesLimits = {};
@@ -4253,12 +4283,14 @@ export function mount(root, options = {}) {
4253
4283
  let initRequestSeq = 0;
4254
4284
  let queenNotice = false;
4255
4285
  let queenBusy = false;
4286
+ let queenSeen = false;
4287
+ let queenWasActive = false;
4288
+ let queenExitSignature = "";
4256
4289
  const queenDismissedFallback = new Set();
4257
4290
  let supervisorData = [];
4258
4291
  let supervisorMeta = { count: 0, last: null };
4259
4292
  let supervisorScopeSignature = null;
4260
4293
  let supervisorRequest = null;
4261
- let supervisorInlineRow = null;
4262
4294
  let limitsOverlay = null;
4263
4295
  let limitsDialogNode = null;
4264
4296
  let limitsState = null;
@@ -4291,21 +4323,9 @@ export function mount(root, options = {}) {
4291
4323
  const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
4292
4324
  const supervisorInlineSep = element(doc, "span", "hive-supervisor-inline-sep", "·");
4293
4325
  const supervisorInlineState = element(doc, "span", "hive-supervisor-inline-state", "");
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
- }
4304
- });
4305
4326
  supervisorInline.appendChild(supervisorInlineLabel);
4306
4327
  supervisorInline.appendChild(supervisorInlineSep);
4307
4328
  supervisorInline.appendChild(supervisorInlineState);
4308
- supervisorInline.appendChild(supervisorInlineToggle);
4309
4329
  bar.appendChild(supervisorInline);
4310
4330
 
4311
4331
  const statsNode = element(doc, "div", "hive-stats");
@@ -7223,9 +7243,49 @@ function renderMarkdownInto(doc, host, source) {
7223
7243
  if (!destroyed && lastModel) renderQueenHint(lastModel);
7224
7244
  }
7225
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
+
7226
7285
  function renderQueenHint(model) {
7227
7286
  const initialised = Boolean(model && model.initialised !== false);
7228
7287
  const state = model && isRecord(model.queen) ? model.queen : null;
7288
+ maybeShowQueenExit(state);
7229
7289
  const active = state ? state.active === true : Boolean(queenNotice);
7230
7290
  const dismissed = active && isQueenNoticeDismissed(model ? model.repo : "");
7231
7291
  const show = initialised && Boolean(state || queenNotice) && !dismissed;
@@ -7286,7 +7346,6 @@ function renderMarkdownInto(doc, host, source) {
7286
7346
  renderSupervisorContent();
7287
7347
  } catch {
7288
7348
  supervisorData = [];
7289
- supervisorInlineRow = null;
7290
7349
  try {
7291
7350
  supervisorInline.className = "hive-supervisor-inline is-hidden";
7292
7351
  } catch {
@@ -7296,12 +7355,9 @@ function renderMarkdownInto(doc, host, source) {
7296
7355
  }
7297
7356
 
7298
7357
  function renderSupervisorContent() {
7299
- supervisorInlineRow = null;
7300
7358
  supervisorInline.className = "hive-supervisor-inline is-hidden";
7301
7359
  supervisorInlineState.className = "hive-supervisor-inline-state";
7302
7360
  supervisorInlineState.textContent = "";
7303
- supervisorInlineToggle.className = "hive-btn hive-supervisor-inline-toggle is-hidden";
7304
- setAttr(supervisorInlineToggle, "data-next-action", "pause");
7305
7361
  supervisorInlineLabel.textContent = translate("supervisor.label");
7306
7362
  supervisorInlineSep.textContent = "·";
7307
7363
  if (!lastModel) return;
@@ -7322,7 +7378,6 @@ function renderMarkdownInto(doc, host, source) {
7322
7378
  : translate("supervisor.unresponsive");
7323
7379
 
7324
7380
  supervisorInline.className = "hive-supervisor-inline";
7325
- supervisorInlineRow = row || null;
7326
7381
  supervisorInlineState.className = "hive-supervisor-inline-state is-" + status;
7327
7382
  supervisorInlineState.textContent = label;
7328
7383
 
@@ -7351,15 +7406,6 @@ function renderMarkdownInto(doc, host, source) {
7351
7406
  setAttr(supervisorInline, "title", tooltip);
7352
7407
  setAttr(supervisorInline, "aria-label", tooltip);
7353
7408
 
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);
7362
- }
7363
7409
  }
7364
7410
  function setSupervisorData(rows) {
7365
7411
  supervisorData = Array.isArray(rows) ? rows : [];
@@ -7431,58 +7477,6 @@ function renderMarkdownInto(doc, host, source) {
7431
7477
  }
7432
7478
  }
7433
7479
 
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
-
7460
- async function resumeSupervisor(row, button) {
7461
- if (destroyed || !fetchImpl) return;
7462
- if (button) button.disabled = true;
7463
- try {
7464
- const response = await fetchImpl(supervisorEndpoint("resume"), {
7465
- method: "POST",
7466
- headers: { "content-type": "application/json", accept: "application/json" },
7467
- body: JSON.stringify({ repo: row.repo }),
7468
- });
7469
- if (!response || response.ok === false) throw new Error("supervisor resume failed");
7470
- let payload = null;
7471
- try {
7472
- payload = await response.json();
7473
- } catch {
7474
- payload = null;
7475
- }
7476
- if (payload && payload.ok === false) throw new Error("supervisor resume failed");
7477
- await refreshSupervisor(true);
7478
- } catch (error) {
7479
- if (button) button.disabled = false;
7480
- if (!destroyed) {
7481
- showToast("error", translate("supervisor.resumeFailed"), actionErrorDetail(error) || translate("supervisor.resumeFailed"));
7482
- }
7483
- }
7484
- }
7485
-
7486
7480
  function durationLabel(count, singularKey, pluralKey) {
7487
7481
  const key = count === 1 ? singularKey : pluralKey;
7488
7482
  return translate(key).replace("{count}", String(count));