@d86e/hive-panel 1.0.25 → 1.0.27
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 +0 -3
- package/public/panel.js +96 -97
package/package.json
CHANGED
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",
|
|
@@ -2437,6 +2428,7 @@ export const messages = Object.freeze({
|
|
|
2437
2428
|
"limits.saveAria": "Save agent concurrency for {repo}",
|
|
2438
2429
|
"limits.saving": "Saving...",
|
|
2439
2430
|
"limits.saved": "Agent concurrency saved.",
|
|
2431
|
+
"limits.noChanges": "No limit changes to save.",
|
|
2440
2432
|
"limits.failed": "Could not save agent concurrency",
|
|
2441
2433
|
"limits.invalid": "Every limit must be an integer from 0 to 999.",
|
|
2442
2434
|
"limits.none": "No role data for this repository.",
|
|
@@ -2527,6 +2519,19 @@ export const messages = Object.freeze({
|
|
|
2527
2519
|
"queen.dismissAria": "Close this notice; it does not change Queen mode",
|
|
2528
2520
|
"help.queen": "Queen mode",
|
|
2529
2521
|
"help.queenDesc": "Type /queen off in the chat box to leave Queen mode; this session then returns to normal coding mode.",
|
|
2522
|
+
"queen.exited": "Queen mode is off",
|
|
2523
|
+
"queen.exitSupervisor": "Supervisor queen: {state}",
|
|
2524
|
+
"queen.exitSupervisorCleared": "cleared",
|
|
2525
|
+
"queen.exitSupervisorStopped": "stopped",
|
|
2526
|
+
"queen.exitSupervisorNotCleared": "not cleared",
|
|
2527
|
+
"queen.exitInterrupted": "Current turn: {state}",
|
|
2528
|
+
"queen.exitInterruptedYes": "interrupted",
|
|
2529
|
+
"queen.exitInterruptedNo": "not interrupted",
|
|
2530
|
+
"queen.exitInterruptUnsupported": "interrupt not supported",
|
|
2531
|
+
"queen.exitMessage": "Stop message: {state}",
|
|
2532
|
+
"queen.exitMessageYes": "delivered",
|
|
2533
|
+
"queen.exitMessageNo": "not delivered",
|
|
2534
|
+
"queen.exitNotices": "Notices: {notices}",
|
|
2530
2535
|
"queen.status.active": "Queen active",
|
|
2531
2536
|
"queen.status.inactive": "Queen not active",
|
|
2532
2537
|
"queen.source.auto": "auto",
|
|
@@ -2793,12 +2798,6 @@ export const messages = Object.freeze({
|
|
|
2793
2798
|
"supervisor.tooltipError": "最近错误:{error}",
|
|
2794
2799
|
"supervisor.scopeBlockedTitle": "跨仓库调用被拒绝",
|
|
2795
2800
|
"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
2801
|
"limits.open": "设置",
|
|
2803
2802
|
"limits.openAria": "打开智能体并发上限设置",
|
|
2804
2803
|
"limits.title": "智能体的并发上限",
|
|
@@ -2818,6 +2817,7 @@ export const messages = Object.freeze({
|
|
|
2818
2817
|
"limits.saveAria": "保存 {repo} 的智能体并发上限",
|
|
2819
2818
|
"limits.saving": "正在保存…",
|
|
2820
2819
|
"limits.saved": "智能体的并发上限已保存。",
|
|
2820
|
+
"limits.noChanges": "没有需要保存的限额改动。",
|
|
2821
2821
|
"limits.failed": "保存智能体的并发上限失败",
|
|
2822
2822
|
"limits.invalid": "每个上限都必须是 0–999 的整数。",
|
|
2823
2823
|
"limits.none": "这个仓库没有角色数据。",
|
|
@@ -2908,6 +2908,19 @@ export const messages = Object.freeze({
|
|
|
2908
2908
|
"queen.dismissAria": "关闭提示,不影响女王状态",
|
|
2909
2909
|
"help.queen": "女王模式",
|
|
2910
2910
|
"help.queenDesc": "在对话框输入 /queen off 退出女王模式,退出后本会话恢复普通编码模式。",
|
|
2911
|
+
"queen.exited": "女王模式已关闭",
|
|
2912
|
+
"queen.exitSupervisor": "监督器女王:{state}",
|
|
2913
|
+
"queen.exitSupervisorCleared": "已注销",
|
|
2914
|
+
"queen.exitSupervisorStopped": "已停止投递",
|
|
2915
|
+
"queen.exitSupervisorNotCleared": "未注销",
|
|
2916
|
+
"queen.exitInterrupted": "当前回合:{state}",
|
|
2917
|
+
"queen.exitInterruptedYes": "已中断",
|
|
2918
|
+
"queen.exitInterruptedNo": "未中断",
|
|
2919
|
+
"queen.exitInterruptUnsupported": "宿主不支持中断",
|
|
2920
|
+
"queen.exitMessage": "停止消息:{state}",
|
|
2921
|
+
"queen.exitMessageYes": "已送达",
|
|
2922
|
+
"queen.exitMessageNo": "未送达",
|
|
2923
|
+
"queen.exitNotices": "提示:{notices}",
|
|
2911
2924
|
"queen.status.active": "女王已接管",
|
|
2912
2925
|
"queen.status.inactive": "女王未接管",
|
|
2913
2926
|
"queen.source.auto": "自动",
|
|
@@ -3342,6 +3355,24 @@ export function renderModel(snapshot) {
|
|
|
3342
3355
|
const initialised = source.initialised !== false;
|
|
3343
3356
|
const rawQueen = isRecord(source.queen) ? source.queen : null;
|
|
3344
3357
|
const queenActive = rawQueen !== null && rawQueen.active === true;
|
|
3358
|
+
const rawExit = rawQueen && !queenActive && isRecord(rawQueen.exit) ? rawQueen.exit : null;
|
|
3359
|
+
const queenExit = rawExit === null
|
|
3360
|
+
? null
|
|
3361
|
+
: {
|
|
3362
|
+
at: asString(rawExit.at),
|
|
3363
|
+
supervisor: isRecord(rawExit.supervisor)
|
|
3364
|
+
? {
|
|
3365
|
+
cleared: rawExit.supervisor.cleared === true,
|
|
3366
|
+
method: asString(rawExit.supervisor.method),
|
|
3367
|
+
stoppedDelivery: rawExit.supervisor.stoppedDelivery === true,
|
|
3368
|
+
error: asString(rawExit.supervisor.error) || null,
|
|
3369
|
+
}
|
|
3370
|
+
: null,
|
|
3371
|
+
interrupted: rawExit.interrupted === true,
|
|
3372
|
+
interruptSupported: rawExit.interruptSupported !== false,
|
|
3373
|
+
messageDelivered: rawExit.messageDelivered === true,
|
|
3374
|
+
notices: Array.isArray(rawExit.notices) ? rawExit.notices.map(asString).filter(Boolean) : [],
|
|
3375
|
+
};
|
|
3345
3376
|
const queen =
|
|
3346
3377
|
rawQueen === null
|
|
3347
3378
|
? null
|
|
@@ -3352,6 +3383,7 @@ export function renderModel(snapshot) {
|
|
|
3352
3383
|
? rawQueen.source
|
|
3353
3384
|
: null,
|
|
3354
3385
|
repo: typeof rawQueen.repo === "string" ? rawQueen.repo : "",
|
|
3386
|
+
exit: queenExit,
|
|
3355
3387
|
};
|
|
3356
3388
|
const rawRoles = isRecord(source.roles) ? source.roles : null;
|
|
3357
3389
|
const rolesLimits = {};
|
|
@@ -4253,12 +4285,14 @@ export function mount(root, options = {}) {
|
|
|
4253
4285
|
let initRequestSeq = 0;
|
|
4254
4286
|
let queenNotice = false;
|
|
4255
4287
|
let queenBusy = false;
|
|
4288
|
+
let queenSeen = false;
|
|
4289
|
+
let queenWasActive = false;
|
|
4290
|
+
let queenExitSignature = "";
|
|
4256
4291
|
const queenDismissedFallback = new Set();
|
|
4257
4292
|
let supervisorData = [];
|
|
4258
4293
|
let supervisorMeta = { count: 0, last: null };
|
|
4259
4294
|
let supervisorScopeSignature = null;
|
|
4260
4295
|
let supervisorRequest = null;
|
|
4261
|
-
let supervisorInlineRow = null;
|
|
4262
4296
|
let limitsOverlay = null;
|
|
4263
4297
|
let limitsDialogNode = null;
|
|
4264
4298
|
let limitsState = null;
|
|
@@ -4291,21 +4325,9 @@ export function mount(root, options = {}) {
|
|
|
4291
4325
|
const supervisorInlineLabel = element(doc, "span", "hive-supervisor-inline-label", translate("supervisor.label"));
|
|
4292
4326
|
const supervisorInlineSep = element(doc, "span", "hive-supervisor-inline-sep", "·");
|
|
4293
4327
|
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
4328
|
supervisorInline.appendChild(supervisorInlineLabel);
|
|
4306
4329
|
supervisorInline.appendChild(supervisorInlineSep);
|
|
4307
4330
|
supervisorInline.appendChild(supervisorInlineState);
|
|
4308
|
-
supervisorInline.appendChild(supervisorInlineToggle);
|
|
4309
4331
|
bar.appendChild(supervisorInline);
|
|
4310
4332
|
|
|
4311
4333
|
const statsNode = element(doc, "div", "hive-stats");
|
|
@@ -5457,7 +5479,9 @@ export function mount(root, options = {}) {
|
|
|
5457
5479
|
setAttr(input, "step", "1");
|
|
5458
5480
|
setAttr(input, "inputmode", "numeric");
|
|
5459
5481
|
setAttr(input, "aria-label", translate("limits.limitAria").replace("{role}", role.role));
|
|
5460
|
-
|
|
5482
|
+
const effectiveLimit = supervisorNumber(role.limit);
|
|
5483
|
+
input.value = effectiveLimit === null ? "" : String(effectiveLimit);
|
|
5484
|
+
if (effectiveLimit === null) setAttr(input, "placeholder", "—");
|
|
5461
5485
|
input.disabled = !writable || !supervisorAvailable;
|
|
5462
5486
|
roleRow.appendChild(input);
|
|
5463
5487
|
const sourceKey = role.source === "limits" ? "limits.source.limits" : role.source === "config" ? "limits.source.config" : "limits.source.default";
|
|
@@ -5478,7 +5502,7 @@ export function mount(root, options = {}) {
|
|
|
5478
5502
|
roleRow.appendChild(element(doc, "span", "hive-limits-cell is-action", ""));
|
|
5479
5503
|
}
|
|
5480
5504
|
table.appendChild(roleRow);
|
|
5481
|
-
rowNodes.push({ role: role.role, input });
|
|
5505
|
+
rowNodes.push({ role: role.role, input, initial: String(input.value) });
|
|
5482
5506
|
}
|
|
5483
5507
|
limitsSection.appendChild(table);
|
|
5484
5508
|
limitsSection.appendChild(element(doc, "div", "hive-limits-hint", translate("limits.defaultHint")));
|
|
@@ -5717,6 +5741,7 @@ export function mount(root, options = {}) {
|
|
|
5717
5741
|
let invalid = false;
|
|
5718
5742
|
for (const entry of state.rows) {
|
|
5719
5743
|
const raw = String(entry.input.value === null || entry.input.value === undefined ? "" : entry.input.value).trim();
|
|
5744
|
+
if (raw === String(entry.initial ?? "")) continue;
|
|
5720
5745
|
const number = Number(raw);
|
|
5721
5746
|
if (!/^\d+$/.test(raw) || !Number.isInteger(number) || number < 0 || number > 999) {
|
|
5722
5747
|
invalid = true;
|
|
@@ -5730,7 +5755,7 @@ export function mount(root, options = {}) {
|
|
|
5730
5755
|
return;
|
|
5731
5756
|
}
|
|
5732
5757
|
if (Object.keys(roleLimits).length === 0) {
|
|
5733
|
-
setLimitsError(translate("limits.
|
|
5758
|
+
setLimitsError(translate("limits.noChanges"));
|
|
5734
5759
|
return;
|
|
5735
5760
|
}
|
|
5736
5761
|
if (!fetchImpl) {
|
|
@@ -7223,9 +7248,49 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7223
7248
|
if (!destroyed && lastModel) renderQueenHint(lastModel);
|
|
7224
7249
|
}
|
|
7225
7250
|
|
|
7251
|
+
function maybeShowQueenExit(queen) {
|
|
7252
|
+
if (!queen) return;
|
|
7253
|
+
const active = queen.active === true;
|
|
7254
|
+
if (!queenSeen) {
|
|
7255
|
+
queenSeen = true;
|
|
7256
|
+
queenWasActive = active;
|
|
7257
|
+
return;
|
|
7258
|
+
}
|
|
7259
|
+
if (queenWasActive && !active && queen.exit) {
|
|
7260
|
+
const exit = queen.exit;
|
|
7261
|
+
const signature = [exit.at, exit.supervisor && exit.supervisor.cleared, exit.interrupted, exit.messageDelivered].join("|");
|
|
7262
|
+
if (signature !== queenExitSignature) {
|
|
7263
|
+
queenExitSignature = signature;
|
|
7264
|
+
const supervisorState = exit.supervisor && exit.supervisor.cleared
|
|
7265
|
+
? translate("queen.exitSupervisorCleared")
|
|
7266
|
+
: translate("queen.exitSupervisorNotCleared");
|
|
7267
|
+
const interruptState = exit.interrupted
|
|
7268
|
+
? translate("queen.exitInterruptedYes")
|
|
7269
|
+
: exit.interruptSupported === false
|
|
7270
|
+
? translate("queen.exitInterruptUnsupported")
|
|
7271
|
+
: translate("queen.exitInterruptedNo");
|
|
7272
|
+
const messageState = exit.messageDelivered
|
|
7273
|
+
? translate("queen.exitMessageYes")
|
|
7274
|
+
: translate("queen.exitMessageNo");
|
|
7275
|
+
const parts = [
|
|
7276
|
+
translate("queen.exitSupervisor").replace("{state}", supervisorState),
|
|
7277
|
+
translate("queen.exitInterrupted").replace("{state}", interruptState),
|
|
7278
|
+
translate("queen.exitMessage").replace("{state}", messageState),
|
|
7279
|
+
];
|
|
7280
|
+
if (Array.isArray(exit.notices) && exit.notices.length > 0) {
|
|
7281
|
+
parts.push(translate("queen.exitNotices").replace("{notices}", exit.notices.join("; ")));
|
|
7282
|
+
}
|
|
7283
|
+
const ok = Boolean(exit.supervisor && exit.supervisor.cleared && exit.interrupted && exit.messageDelivered);
|
|
7284
|
+
showToast(ok ? "success" : "error", translate("queen.exited"), parts.join(" · "));
|
|
7285
|
+
}
|
|
7286
|
+
}
|
|
7287
|
+
queenWasActive = active;
|
|
7288
|
+
}
|
|
7289
|
+
|
|
7226
7290
|
function renderQueenHint(model) {
|
|
7227
7291
|
const initialised = Boolean(model && model.initialised !== false);
|
|
7228
7292
|
const state = model && isRecord(model.queen) ? model.queen : null;
|
|
7293
|
+
maybeShowQueenExit(state);
|
|
7229
7294
|
const active = state ? state.active === true : Boolean(queenNotice);
|
|
7230
7295
|
const dismissed = active && isQueenNoticeDismissed(model ? model.repo : "");
|
|
7231
7296
|
const show = initialised && Boolean(state || queenNotice) && !dismissed;
|
|
@@ -7286,7 +7351,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7286
7351
|
renderSupervisorContent();
|
|
7287
7352
|
} catch {
|
|
7288
7353
|
supervisorData = [];
|
|
7289
|
-
supervisorInlineRow = null;
|
|
7290
7354
|
try {
|
|
7291
7355
|
supervisorInline.className = "hive-supervisor-inline is-hidden";
|
|
7292
7356
|
} catch {
|
|
@@ -7296,12 +7360,9 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7296
7360
|
}
|
|
7297
7361
|
|
|
7298
7362
|
function renderSupervisorContent() {
|
|
7299
|
-
supervisorInlineRow = null;
|
|
7300
7363
|
supervisorInline.className = "hive-supervisor-inline is-hidden";
|
|
7301
7364
|
supervisorInlineState.className = "hive-supervisor-inline-state";
|
|
7302
7365
|
supervisorInlineState.textContent = "";
|
|
7303
|
-
supervisorInlineToggle.className = "hive-btn hive-supervisor-inline-toggle is-hidden";
|
|
7304
|
-
setAttr(supervisorInlineToggle, "data-next-action", "pause");
|
|
7305
7366
|
supervisorInlineLabel.textContent = translate("supervisor.label");
|
|
7306
7367
|
supervisorInlineSep.textContent = "·";
|
|
7307
7368
|
if (!lastModel) return;
|
|
@@ -7322,7 +7383,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7322
7383
|
: translate("supervisor.unresponsive");
|
|
7323
7384
|
|
|
7324
7385
|
supervisorInline.className = "hive-supervisor-inline";
|
|
7325
|
-
supervisorInlineRow = row || null;
|
|
7326
7386
|
supervisorInlineState.className = "hive-supervisor-inline-state is-" + status;
|
|
7327
7387
|
supervisorInlineState.textContent = label;
|
|
7328
7388
|
|
|
@@ -7351,15 +7411,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7351
7411
|
setAttr(supervisorInline, "title", tooltip);
|
|
7352
7412
|
setAttr(supervisorInline, "aria-label", tooltip);
|
|
7353
7413
|
|
|
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
7414
|
}
|
|
7364
7415
|
function setSupervisorData(rows) {
|
|
7365
7416
|
supervisorData = Array.isArray(rows) ? rows : [];
|
|
@@ -7431,58 +7482,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7431
7482
|
}
|
|
7432
7483
|
}
|
|
7433
7484
|
|
|
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
7485
|
function durationLabel(count, singularKey, pluralKey) {
|
|
7487
7486
|
const key = count === 1 ? singularKey : pluralKey;
|
|
7488
7487
|
return translate(key).replace("{count}", String(count));
|