@d86e/hive-panel 1.0.16 → 1.0.18
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 +12 -1
- package/public/panel.js +436 -28
package/package.json
CHANGED
package/public/panel.css
CHANGED
|
@@ -1310,7 +1310,7 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1310
1310
|
}
|
|
1311
1311
|
|
|
1312
1312
|
/* Bottom events strip: fixed height, header fixed, list owns the scrollbar. */
|
|
1313
|
-
.hive-events-drawer { display: flex; flex: 0 0 auto; flex-direction: column; height: max(
|
|
1313
|
+
.hive-events-drawer { display: flex; flex: 0 0 auto; flex-direction: column; height: max(400px, 45vh); min-height: 400px; overflow: hidden; }
|
|
1314
1314
|
.hive-events-head { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--hive-line); }
|
|
1315
1315
|
.hive-events-title { min-width: 0; color: var(--hive-fg-soft); font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
|
|
1316
1316
|
.hive-events-count { color: var(--hive-fg-faint); font-family: var(--hive-mono); font-size: 11px; white-space: nowrap; }
|
|
@@ -1321,3 +1321,14 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1321
1321
|
.hive-event-error { color: var(--hive-danger); font-size: 11px; line-height: 1.5; }
|
|
1322
1322
|
|
|
1323
1323
|
|
|
1324
|
+
|
|
1325
|
+
/* Human-readable event rows with collapsed raw details. */
|
|
1326
|
+
.hive-event { display: flex; flex-direction: row; align-items: center; gap: 8px; height: 28px; min-height: 28px; padding: 0 7px; overflow: hidden; font-size: 11px; line-height: 1.5; }
|
|
1327
|
+
.hive-event-sentence { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--hive-fg-soft); text-overflow: ellipsis; white-space: nowrap; }
|
|
1328
|
+
.hive-event-raw { flex: 0 0 auto; }
|
|
1329
|
+
.hive-event-summary { width: fit-content; color: var(--hive-fg-faint); font-size: 10px; line-height: 1.5; cursor: pointer; white-space: nowrap; }
|
|
1330
|
+
.hive-event-json { max-height: 180px; margin: 4px 0 0; padding: 6px; overflow: auto; font-size: 10px; }
|
|
1331
|
+
.hive-event:has(.hive-event-raw[open]) { flex-wrap: wrap; align-items: flex-start; height: auto; min-height: 28px; padding: 5px 7px; overflow: visible; }
|
|
1332
|
+
.hive-event:has(.hive-event-raw[open]) .hive-event-sentence { flex-basis: 100%; white-space: normal; }
|
|
1333
|
+
.hive-event:has(.hive-event-raw[open]) .hive-event-raw { flex-basis: 100%; }
|
|
1334
|
+
|
package/public/panel.js
CHANGED
|
@@ -2132,7 +2132,7 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2132
2132
|
.hive-card-dialog.is-entering { animation: none; }
|
|
2133
2133
|
}
|
|
2134
2134
|
/* Bottom events strip: fixed height, header fixed, list owns the scrollbar. */
|
|
2135
|
-
.hive-events-drawer { display: flex; flex: 0 0 auto; flex-direction: column; height: max(
|
|
2135
|
+
.hive-events-drawer { display: flex; flex: 0 0 auto; flex-direction: column; height: max(400px, 45vh); min-height: 400px; overflow: hidden; }
|
|
2136
2136
|
.hive-events-head { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--hive-line); }
|
|
2137
2137
|
.hive-events-title { min-width: 0; color: var(--hive-fg-soft); font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
|
|
2138
2138
|
.hive-events-count { color: var(--hive-fg-faint); font-family: var(--hive-mono); font-size: 11px; white-space: nowrap; }
|
|
@@ -2141,6 +2141,15 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2141
2141
|
.hive-events-recycle.is-hidden { display: none; }
|
|
2142
2142
|
.hive-event-list { flex: 1 1 auto; min-height: 0; max-height: none; padding: 8px 10px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: auto; }
|
|
2143
2143
|
.hive-event-error { color: var(--hive-danger); font-size: 11px; line-height: 1.5; }
|
|
2144
|
+
/* Human-readable event rows with collapsed raw details. */
|
|
2145
|
+
.hive-event { display: flex; flex-direction: row; align-items: center; gap: 8px; height: 28px; min-height: 28px; padding: 0 7px; overflow: hidden; font-size: 11px; line-height: 1.5; }
|
|
2146
|
+
.hive-event-sentence { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--hive-fg-soft); text-overflow: ellipsis; white-space: nowrap; }
|
|
2147
|
+
.hive-event-raw { flex: 0 0 auto; }
|
|
2148
|
+
.hive-event-summary { width: fit-content; color: var(--hive-fg-faint); font-size: 10px; line-height: 1.5; cursor: pointer; white-space: nowrap; }
|
|
2149
|
+
.hive-event-json { max-height: 180px; margin: 4px 0 0; padding: 6px; overflow: auto; font-size: 10px; }
|
|
2150
|
+
.hive-event:has(.hive-event-raw[open]) { flex-wrap: wrap; align-items: flex-start; height: auto; min-height: 28px; padding: 5px 7px; overflow: visible; }
|
|
2151
|
+
.hive-event:has(.hive-event-raw[open]) .hive-event-sentence { flex-basis: 100%; white-space: normal; }
|
|
2152
|
+
.hive-event:has(.hive-event-raw[open]) .hive-event-raw { flex-basis: 100%; }
|
|
2144
2153
|
`;
|
|
2145
2154
|
|
|
2146
2155
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2285,6 +2294,41 @@ export const messages = Object.freeze({
|
|
|
2285
2294
|
"events.filterAll": "All kinds",
|
|
2286
2295
|
"events.recycled": "Recycled {count} older events",
|
|
2287
2296
|
"events.loadFailed": "Could not load events",
|
|
2297
|
+
"events.details": "Details",
|
|
2298
|
+
"events.actor.queen": "Queen",
|
|
2299
|
+
"events.actor.supervisor": "Supervisor",
|
|
2300
|
+
"events.role.coder": "Coder agent",
|
|
2301
|
+
"events.role.tester": "Tester agent",
|
|
2302
|
+
"events.role.reviewer": "Reviewer agent",
|
|
2303
|
+
"events.role.architect": "Architect agent",
|
|
2304
|
+
"events.role.worker": "Executor agent",
|
|
2305
|
+
"events.role.service": "Service agent",
|
|
2306
|
+
"events.actor.role": "Agent",
|
|
2307
|
+
"events.unknown": "Other event: {kind}",
|
|
2308
|
+
"events.say.task_add": "created task \"{title}\"",
|
|
2309
|
+
"events.say.task_claim": "claimed task \"{title}\"",
|
|
2310
|
+
"events.say.task_done": "completed task \"{title}\"",
|
|
2311
|
+
"events.say.task_fail": "task failed \"{title}\"",
|
|
2312
|
+
"events.say.task_edit": "edited task \"{title}\"",
|
|
2313
|
+
"events.say.task_split": "split task \"{title}\"",
|
|
2314
|
+
"events.say.task_supersede": "superseded task \"{title}\"",
|
|
2315
|
+
"events.say.reopen": "reopened task \"{title}\"",
|
|
2316
|
+
"events.say.task_delete": "deleted task \"{title}\"",
|
|
2317
|
+
"events.say.task_plan": "planned {count} tasks",
|
|
2318
|
+
"events.say.commit": "committed {count} files ({path})",
|
|
2319
|
+
"events.say.guard": "guarded {count} paths",
|
|
2320
|
+
"events.say.lesson": "recorded a lesson ({scope})",
|
|
2321
|
+
"events.say.arch_pass": "approved the review of \"{title}\"",
|
|
2322
|
+
"events.say.arch_reject": "rejected the review of \"{title}\"",
|
|
2323
|
+
"events.say.arch_detail": "required changes: {detail}",
|
|
2324
|
+
"events.say.intervention": "intervened on \"{title}\": {action}",
|
|
2325
|
+
"events.say.boundary": "blocked a cross-repository call: {tool}",
|
|
2326
|
+
"events.say.service_down": "service down: {service}",
|
|
2327
|
+
"events.say.service_started": "service started: {service}",
|
|
2328
|
+
"events.say.mode": "switched mode: {mode}",
|
|
2329
|
+
"events.say.checkpoint": "progress checkpoint",
|
|
2330
|
+
"events.say.renew": "renewed a claim",
|
|
2331
|
+
"events.say.overlap": "announced overlapping paths",
|
|
2288
2332
|
"events.collapse": "Collapse events",
|
|
2289
2333
|
"supervisor.aria": "Supervisor status",
|
|
2290
2334
|
"supervisor.label": "supervisor",
|
|
@@ -2599,6 +2643,41 @@ export const messages = Object.freeze({
|
|
|
2599
2643
|
"events.filterAll": "全部事件",
|
|
2600
2644
|
"events.recycled": "已回收更早的 {count} 条",
|
|
2601
2645
|
"events.loadFailed": "事件加载失败",
|
|
2646
|
+
"events.details": "详情",
|
|
2647
|
+
"events.actor.queen": "女王",
|
|
2648
|
+
"events.actor.supervisor": "监督器",
|
|
2649
|
+
"events.role.coder": "编码智能体",
|
|
2650
|
+
"events.role.tester": "测试智能体",
|
|
2651
|
+
"events.role.reviewer": "评审智能体",
|
|
2652
|
+
"events.role.architect": "架构智能体",
|
|
2653
|
+
"events.role.worker": "执行智能体",
|
|
2654
|
+
"events.role.service": "服务智能体",
|
|
2655
|
+
"events.actor.role": "智能体",
|
|
2656
|
+
"events.unknown": "其它事件:{kind}",
|
|
2657
|
+
"events.say.task_add": "创建了任务《{title}》",
|
|
2658
|
+
"events.say.task_claim": "认领了任务《{title}》",
|
|
2659
|
+
"events.say.task_done": "完成了任务《{title}》",
|
|
2660
|
+
"events.say.task_fail": "任务失败《{title}》",
|
|
2661
|
+
"events.say.task_edit": "修改了任务《{title}》",
|
|
2662
|
+
"events.say.task_split": "拆分了任务《{title}》",
|
|
2663
|
+
"events.say.task_supersede": "废弃了任务《{title}》",
|
|
2664
|
+
"events.say.reopen": "重新打开了任务《{title}》",
|
|
2665
|
+
"events.say.task_delete": "删除了任务《{title}》",
|
|
2666
|
+
"events.say.task_plan": "规划了 {count} 个任务",
|
|
2667
|
+
"events.say.commit": "提交了 {count} 个文件({path})",
|
|
2668
|
+
"events.say.guard": "申报了 {count} 个路径",
|
|
2669
|
+
"events.say.lesson": "记录了经验({scope})",
|
|
2670
|
+
"events.say.arch_pass": "通过了任务《{title}》的评审",
|
|
2671
|
+
"events.say.arch_reject": "驳回了任务《{title}》的评审",
|
|
2672
|
+
"events.say.arch_detail": "要求修改 {detail}",
|
|
2673
|
+
"events.say.intervention": "介入任务《{title}》:{action}",
|
|
2674
|
+
"events.say.boundary": "触发了跨仓库边界限制:{tool}",
|
|
2675
|
+
"events.say.service_down": "服务停止:{service}",
|
|
2676
|
+
"events.say.service_started": "服务启动:{service}",
|
|
2677
|
+
"events.say.mode": "切换模式:{mode}",
|
|
2678
|
+
"events.say.checkpoint": "进度检查点",
|
|
2679
|
+
"events.say.renew": "续期了认领",
|
|
2680
|
+
"events.say.overlap": "申报了重叠路径",
|
|
2602
2681
|
"events.collapse": "收起事件",
|
|
2603
2682
|
"supervisor.aria": "Supervisor 状态",
|
|
2604
2683
|
"supervisor.label": "监督器",
|
|
@@ -3093,6 +3172,7 @@ function normalizeEvents(events) {
|
|
|
3093
3172
|
kind: asString(event.kind),
|
|
3094
3173
|
task: asString(event.task),
|
|
3095
3174
|
actor: asString(event.actor),
|
|
3175
|
+
raw: event,
|
|
3096
3176
|
}));
|
|
3097
3177
|
}
|
|
3098
3178
|
|
|
@@ -4042,6 +4122,8 @@ export function mount(root, options = {}) {
|
|
|
4042
4122
|
initialized: false,
|
|
4043
4123
|
paged: false,
|
|
4044
4124
|
signature: "",
|
|
4125
|
+
expanded: new Set(),
|
|
4126
|
+
rowNodes: new Map(),
|
|
4045
4127
|
};
|
|
4046
4128
|
let initBusy = false;
|
|
4047
4129
|
let initOutput = null;
|
|
@@ -4295,6 +4377,8 @@ export function mount(root, options = {}) {
|
|
|
4295
4377
|
eventState.total = 0;
|
|
4296
4378
|
eventState.recycled = 0;
|
|
4297
4379
|
eventState.signature = "";
|
|
4380
|
+
eventState.expanded.clear();
|
|
4381
|
+
eventState.rowNodes.clear();
|
|
4298
4382
|
eventsList.scrollTop = 0;
|
|
4299
4383
|
void loadEventPage(true);
|
|
4300
4384
|
});
|
|
@@ -6470,6 +6554,40 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
6470
6554
|
return closeButton;
|
|
6471
6555
|
}
|
|
6472
6556
|
|
|
6557
|
+
function drawerContentSignature(card, lane) {
|
|
6558
|
+
return JSON.stringify(card) +
|
|
6559
|
+
"|" + String(lane) +
|
|
6560
|
+
"|" + translate("pane.events") +
|
|
6561
|
+
"|" + String(lastModel && lastModel.writable);
|
|
6562
|
+
}
|
|
6563
|
+
|
|
6564
|
+
function findDrawerBody(dialog) {
|
|
6565
|
+
for (const child of dialog.children || []) {
|
|
6566
|
+
if (String(child.className).split(/\s+/).includes("hive-dialog-body")) return child;
|
|
6567
|
+
}
|
|
6568
|
+
return null;
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6571
|
+
function refreshDrawerContent(card, lane) {
|
|
6572
|
+
if (!drawerNode || !drawerState || drawerState.kind !== "card") return;
|
|
6573
|
+
const signature = drawerContentSignature(card, lane);
|
|
6574
|
+
if (drawerState.signature === signature) return;
|
|
6575
|
+
const oldBody = findDrawerBody(drawerNode);
|
|
6576
|
+
const oldTop = oldBody ? Number(oldBody.scrollTop) || 0 : 0;
|
|
6577
|
+
const oldHeight = oldBody ? Number(oldBody.scrollHeight) || 0 : 0;
|
|
6578
|
+
const oldClient = oldBody ? Number(oldBody.clientHeight) || 0 : 0;
|
|
6579
|
+
const atBottom = oldBody && oldTop + oldClient >= oldHeight - 1;
|
|
6580
|
+
renderDrawerContent(drawerNode, card, lane);
|
|
6581
|
+
drawerState = { kind: "card", card, lane, signature };
|
|
6582
|
+
const body = findDrawerBody(drawerNode);
|
|
6583
|
+
if (body && oldTop > 0) {
|
|
6584
|
+
const oldMax = Math.max(0, oldHeight - oldClient);
|
|
6585
|
+
const newMax = Math.max(0, (Number(body.scrollHeight) || 0) - (Number(body.clientHeight) || 0));
|
|
6586
|
+
const target = atBottom ? (newMax > 0 ? newMax : oldMax) : oldTop;
|
|
6587
|
+
body.scrollTop = target;
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
|
|
6473
6591
|
function openDrawer(card, lane, trigger) {
|
|
6474
6592
|
if (
|
|
6475
6593
|
drawerNode &&
|
|
@@ -6479,8 +6597,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
6479
6597
|
card.id &&
|
|
6480
6598
|
drawerState.card.id === card.id
|
|
6481
6599
|
) {
|
|
6482
|
-
|
|
6483
|
-
drawerState = { kind: "card", card, lane };
|
|
6600
|
+
refreshDrawerContent(card, lane);
|
|
6484
6601
|
return;
|
|
6485
6602
|
}
|
|
6486
6603
|
closeHelp(false);
|
|
@@ -6494,7 +6611,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
6494
6611
|
const closeButton = renderDrawerContent(dialog, card, lane);
|
|
6495
6612
|
showModalDialog(dialog);
|
|
6496
6613
|
drawerNode = dialog;
|
|
6497
|
-
drawerState = { kind: "card", card, lane };
|
|
6614
|
+
drawerState = { kind: "card", card, lane, signature: drawerContentSignature(card, lane) };
|
|
6498
6615
|
if (typeof doc.addEventListener === "function") {
|
|
6499
6616
|
doc.addEventListener("keydown", onDrawerKeydown);
|
|
6500
6617
|
}
|
|
@@ -7768,36 +7885,334 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7768
7885
|
eventsFilter.value = eventState.filter;
|
|
7769
7886
|
}
|
|
7770
7887
|
|
|
7888
|
+
function eventTaskTitle(event) {
|
|
7889
|
+
const raw = event.raw || event;
|
|
7890
|
+
const id = asString(raw.task || raw.card || raw.cardId || raw.id || event.task);
|
|
7891
|
+
if (!id) return "";
|
|
7892
|
+
const tasks = lastModel && Array.isArray(lastModel.taskList) ? lastModel.taskList : [];
|
|
7893
|
+
const task = tasks.find((entry) => entry.id === id);
|
|
7894
|
+
return task && task.title ? task.title : id;
|
|
7895
|
+
}
|
|
7896
|
+
|
|
7897
|
+
function eventRoleName(role) {
|
|
7898
|
+
const name = asString(role);
|
|
7899
|
+
const key = "events.role." + name;
|
|
7900
|
+
const translated = translate(key);
|
|
7901
|
+
if (translated !== key) return translated;
|
|
7902
|
+
return translate("events.actor.role");
|
|
7903
|
+
}
|
|
7904
|
+
|
|
7905
|
+
function eventActor(event) {
|
|
7906
|
+
const actor = asString(event.actor || (event.raw && event.raw.actor));
|
|
7907
|
+
if (!actor) return "—";
|
|
7908
|
+
if (actor === "queen") return translate("events.actor.queen");
|
|
7909
|
+
if (actor === "supervisor") return translate("events.actor.supervisor");
|
|
7910
|
+
if (actor === "worker") return eventRoleName("worker");
|
|
7911
|
+
const worker = /^worker:(.+)$/.exec(actor);
|
|
7912
|
+
if (worker) return eventRoleName(worker[1]);
|
|
7913
|
+
if (["coder", "tester", "reviewer", "architect", "service"].includes(actor)) {
|
|
7914
|
+
return eventRoleName(actor);
|
|
7915
|
+
}
|
|
7916
|
+
return actor;
|
|
7917
|
+
}
|
|
7918
|
+
|
|
7919
|
+
function eventClock(ts) {
|
|
7920
|
+
const date = parseDate(ts);
|
|
7921
|
+
if (!date) return asString(ts);
|
|
7922
|
+
const pad = (number) => String(number).padStart(2, "0");
|
|
7923
|
+
return pad(date.getHours()) + ":" + pad(date.getMinutes());
|
|
7924
|
+
}
|
|
7925
|
+
|
|
7926
|
+
function eventSentence(event) {
|
|
7927
|
+
const raw = event.raw || {};
|
|
7928
|
+
const kind = event.kind || asString(raw.kind);
|
|
7929
|
+
const title = eventTaskTitle(event);
|
|
7930
|
+
const say = (key, values = {}) => {
|
|
7931
|
+
let text = translate(key);
|
|
7932
|
+
for (const [name, value] of Object.entries(values)) {
|
|
7933
|
+
text = text.replace("{" + name + "}", String(value === undefined || value === null ? "" : value));
|
|
7934
|
+
}
|
|
7935
|
+
return text;
|
|
7936
|
+
};
|
|
7937
|
+
let action = "";
|
|
7938
|
+
switch (kind) {
|
|
7939
|
+
case "task_add":
|
|
7940
|
+
case "add":
|
|
7941
|
+
action = say("events.say.task_add", { title });
|
|
7942
|
+
break;
|
|
7943
|
+
case "task_claim":
|
|
7944
|
+
case "claim":
|
|
7945
|
+
action = say("events.say.task_claim", { title });
|
|
7946
|
+
break;
|
|
7947
|
+
case "task_done":
|
|
7948
|
+
case "done":
|
|
7949
|
+
action = say("events.say.task_done", { title });
|
|
7950
|
+
break;
|
|
7951
|
+
case "task_fail":
|
|
7952
|
+
case "fail":
|
|
7953
|
+
action = say("events.say.task_fail", { title });
|
|
7954
|
+
break;
|
|
7955
|
+
case "task_edit":
|
|
7956
|
+
case "edit":
|
|
7957
|
+
action = say("events.say.task_edit", { title });
|
|
7958
|
+
break;
|
|
7959
|
+
case "task_split":
|
|
7960
|
+
case "split":
|
|
7961
|
+
action = say("events.say.task_split", { title });
|
|
7962
|
+
break;
|
|
7963
|
+
case "task_supersede":
|
|
7964
|
+
case "supersede":
|
|
7965
|
+
action = say("events.say.task_supersede", { title });
|
|
7966
|
+
break;
|
|
7967
|
+
case "reopen":
|
|
7968
|
+
case "task_reopen":
|
|
7969
|
+
action = say("events.say.reopen", { title });
|
|
7970
|
+
break;
|
|
7971
|
+
case "task_delete":
|
|
7972
|
+
case "rm":
|
|
7973
|
+
action = say("events.say.task_delete", { title });
|
|
7974
|
+
break;
|
|
7975
|
+
case "task_plan":
|
|
7976
|
+
action = say("events.say.task_plan", { count: asCount(raw.count, 0) });
|
|
7977
|
+
break;
|
|
7978
|
+
case "commit_announce": {
|
|
7979
|
+
const paths = Array.isArray(raw.paths) ? raw.paths : [];
|
|
7980
|
+
const first = paths.length > 0 ? String(paths[0]) + (paths.length > 1 ? "…" : "") : "";
|
|
7981
|
+
action = say("events.say.commit", { count: paths.length, path: first });
|
|
7982
|
+
break;
|
|
7983
|
+
}
|
|
7984
|
+
case "guard": {
|
|
7985
|
+
const keys = Array.isArray(raw.keys) ? raw.keys : [];
|
|
7986
|
+
action = say("events.say.guard", { count: keys.length });
|
|
7987
|
+
break;
|
|
7988
|
+
}
|
|
7989
|
+
case "lesson":
|
|
7990
|
+
action = say("events.say.lesson", { scope: asString(raw.scope || raw.id) });
|
|
7991
|
+
break;
|
|
7992
|
+
case "arch_review": {
|
|
7993
|
+
const verdict = asString(raw.verdict);
|
|
7994
|
+
action = say(verdict === "reject" ? "events.say.arch_reject" : "events.say.arch_pass", { title });
|
|
7995
|
+
if (verdict === "reject") {
|
|
7996
|
+
const findings = Array.isArray(raw.findings) ? raw.findings : [];
|
|
7997
|
+
const detail = asString(findings[0] || raw.summary);
|
|
7998
|
+
if (detail) action += " · " + say("events.say.arch_detail", { detail });
|
|
7999
|
+
}
|
|
8000
|
+
break;
|
|
8001
|
+
}
|
|
8002
|
+
case "queen_intervention":
|
|
8003
|
+
action = say("events.say.intervention", { title, action: asString(raw.action) });
|
|
8004
|
+
break;
|
|
8005
|
+
case "queen_boundary_violation":
|
|
8006
|
+
action = say("events.say.boundary", { tool: asString(raw.tool) });
|
|
8007
|
+
break;
|
|
8008
|
+
case "service_down":
|
|
8009
|
+
action = say("events.say.service_down", { service: asString(raw.service) });
|
|
8010
|
+
break;
|
|
8011
|
+
case "service_started":
|
|
8012
|
+
action = say("events.say.service_started", { service: asString(raw.service) });
|
|
8013
|
+
break;
|
|
8014
|
+
case "mode":
|
|
8015
|
+
action = say("events.say.mode", { mode: asString(raw.mode || raw.to) });
|
|
8016
|
+
break;
|
|
8017
|
+
case "checkpoint":
|
|
8018
|
+
action = say("events.say.checkpoint");
|
|
8019
|
+
break;
|
|
8020
|
+
case "renew":
|
|
8021
|
+
action = say("events.say.renew");
|
|
8022
|
+
break;
|
|
8023
|
+
case "claim_overlap":
|
|
8024
|
+
action = say("events.say.overlap");
|
|
8025
|
+
break;
|
|
8026
|
+
default:
|
|
8027
|
+
action = say("events.unknown", { kind: kind || "?" });
|
|
8028
|
+
break;
|
|
8029
|
+
}
|
|
8030
|
+
return eventClock(event.ts) + " · " + eventActor(event) + " · " + action;
|
|
8031
|
+
}
|
|
8032
|
+
|
|
8033
|
+
function eventRowHeight(row) {
|
|
8034
|
+
if (typeof row.getBoundingClientRect === "function") {
|
|
8035
|
+
const rect = row.getBoundingClientRect();
|
|
8036
|
+
if (rect && Number(rect.height) > 0) return Number(rect.height);
|
|
8037
|
+
}
|
|
8038
|
+
return 28;
|
|
8039
|
+
}
|
|
8040
|
+
|
|
8041
|
+
function eventRowViewportOffset(row) {
|
|
8042
|
+
if (typeof row.getBoundingClientRect === "function") {
|
|
8043
|
+
const rowRect = row.getBoundingClientRect();
|
|
8044
|
+
const listRect = typeof eventsList.getBoundingClientRect === "function"
|
|
8045
|
+
? eventsList.getBoundingClientRect()
|
|
8046
|
+
: null;
|
|
8047
|
+
if (rowRect && listRect && Number.isFinite(Number(rowRect.top)) && Number.isFinite(Number(listRect.top))) {
|
|
8048
|
+
return Number(rowRect.top) - Number(listRect.top);
|
|
8049
|
+
}
|
|
8050
|
+
}
|
|
8051
|
+
const index = (eventsList.children || []).indexOf(row);
|
|
8052
|
+
if (Number.isFinite(Number(row.offsetTop))) return Number(row.offsetTop) - (Number(eventsList.scrollTop) || 0);
|
|
8053
|
+
return index * 28 - (Number(eventsList.scrollTop) || 0);
|
|
8054
|
+
}
|
|
8055
|
+
|
|
8056
|
+
function captureEventAnchor() {
|
|
8057
|
+
if ((Number(eventsList.scrollTop) || 0) <= 0) return { atTop: true, scrollTop: 0 };
|
|
8058
|
+
const rows = [...eventState.rowNodes.values()].filter((entry) => entry.row.parentNode === eventsList);
|
|
8059
|
+
rows.sort((left, right) => eventRowViewportOffset(left.row) - eventRowViewportOffset(right.row));
|
|
8060
|
+
for (const entry of rows) {
|
|
8061
|
+
const offset = eventRowViewportOffset(entry.row);
|
|
8062
|
+
if (offset + eventRowHeight(entry.row) > 0) {
|
|
8063
|
+
return {
|
|
8064
|
+
atTop: false,
|
|
8065
|
+
key: entry.key,
|
|
8066
|
+
offset,
|
|
8067
|
+
scrollTop: Number(eventsList.scrollTop) || 0,
|
|
8068
|
+
};
|
|
8069
|
+
}
|
|
8070
|
+
}
|
|
8071
|
+
return { atTop: false, key: null, offset: 0, scrollTop: Number(eventsList.scrollTop) || 0 };
|
|
8072
|
+
}
|
|
8073
|
+
|
|
8074
|
+
function restoreEventAnchor(anchor) {
|
|
8075
|
+
if (!anchor) return;
|
|
8076
|
+
if (anchor.atTop) {
|
|
8077
|
+
eventsList.scrollTop = 0;
|
|
8078
|
+
return;
|
|
8079
|
+
}
|
|
8080
|
+
if (!anchor.key) {
|
|
8081
|
+
eventsList.scrollTop = anchor.scrollTop;
|
|
8082
|
+
return;
|
|
8083
|
+
}
|
|
8084
|
+
const entry = eventState.rowNodes.get(anchor.key);
|
|
8085
|
+
if (!entry || entry.row.parentNode !== eventsList) {
|
|
8086
|
+
eventsList.scrollTop = anchor.scrollTop;
|
|
8087
|
+
return;
|
|
8088
|
+
}
|
|
8089
|
+
let contentTop = null;
|
|
8090
|
+
if (typeof entry.row.getBoundingClientRect === "function") {
|
|
8091
|
+
const rowRect = entry.row.getBoundingClientRect();
|
|
8092
|
+
const listRect = typeof eventsList.getBoundingClientRect === "function"
|
|
8093
|
+
? eventsList.getBoundingClientRect()
|
|
8094
|
+
: null;
|
|
8095
|
+
if (rowRect && listRect && Number.isFinite(Number(rowRect.top)) && Number.isFinite(Number(listRect.top))) {
|
|
8096
|
+
contentTop = Number(rowRect.top) - Number(listRect.top) + (Number(eventsList.scrollTop) || 0);
|
|
8097
|
+
}
|
|
8098
|
+
}
|
|
8099
|
+
if (contentTop === null && Number.isFinite(Number(entry.row.offsetTop))) contentTop = Number(entry.row.offsetTop);
|
|
8100
|
+
if (contentTop === null) {
|
|
8101
|
+
const index = (eventsList.children || []).indexOf(entry.row);
|
|
8102
|
+
contentTop = index * 28;
|
|
8103
|
+
}
|
|
8104
|
+
eventsList.scrollTop = Math.max(0, contentTop - anchor.offset);
|
|
8105
|
+
}
|
|
8106
|
+
|
|
8107
|
+
function insertEventRow(row, before) {
|
|
8108
|
+
if (row.parentNode) {
|
|
8109
|
+
const current = row.parentNode.children ? row.parentNode.children.indexOf(row) : -1;
|
|
8110
|
+
if (current >= 0) row.parentNode.children.splice(current, 1);
|
|
8111
|
+
row.parentNode = null;
|
|
8112
|
+
}
|
|
8113
|
+
if (before) {
|
|
8114
|
+
if (typeof eventsList.insertBefore === "function") {
|
|
8115
|
+
eventsList.insertBefore(row, before);
|
|
8116
|
+
return;
|
|
8117
|
+
}
|
|
8118
|
+
const index = eventsList.children.indexOf(before);
|
|
8119
|
+
if (index >= 0) {
|
|
8120
|
+
row.parentNode = eventsList;
|
|
8121
|
+
eventsList.children.splice(index, 0, row);
|
|
8122
|
+
return;
|
|
8123
|
+
}
|
|
8124
|
+
}
|
|
8125
|
+
eventsList.appendChild(row);
|
|
8126
|
+
}
|
|
8127
|
+
|
|
8128
|
+
function eventRowNext(row) {
|
|
8129
|
+
const index = (eventsList.children || []).indexOf(row);
|
|
8130
|
+
return index >= 0 ? eventsList.children[index + 1] || null : null;
|
|
8131
|
+
}
|
|
8132
|
+
|
|
8133
|
+
function eventKey(event) {
|
|
8134
|
+
const raw = event.raw || {};
|
|
8135
|
+
const ref = raw.task || raw.card || raw.cardId || raw.id || event.task || "";
|
|
8136
|
+
return [event.ts, event.kind, event.actor || raw.actor || "", ref].join("|");
|
|
8137
|
+
}
|
|
8138
|
+
|
|
8139
|
+
function createEventRow(event) {
|
|
8140
|
+
const key = eventKey(event);
|
|
8141
|
+
const row = element(doc, "div", "hive-event");
|
|
8142
|
+
row.appendChild(element(doc, "span", "hive-event-sentence", eventSentence(event)));
|
|
8143
|
+
const details = element(doc, "details", "hive-event-raw");
|
|
8144
|
+
details.appendChild(element(doc, "summary", "hive-event-summary", translate("events.details")));
|
|
8145
|
+
details.appendChild(
|
|
8146
|
+
element(doc, "pre", "hive-json hive-event-json", JSON.stringify(event.raw || event, null, 2)),
|
|
8147
|
+
);
|
|
8148
|
+
if (eventState.expanded.has(key)) {
|
|
8149
|
+
details.open = true;
|
|
8150
|
+
setAttr(details, "open", "");
|
|
8151
|
+
}
|
|
8152
|
+
details.addEventListener("toggle", () => {
|
|
8153
|
+
if (details.open) eventState.expanded.add(key);
|
|
8154
|
+
else eventState.expanded.delete(key);
|
|
8155
|
+
});
|
|
8156
|
+
row.appendChild(details);
|
|
8157
|
+
return { row, details, key };
|
|
8158
|
+
}
|
|
8159
|
+
|
|
7771
8160
|
function renderEventRows() {
|
|
7772
8161
|
const signature =
|
|
7773
8162
|
eventState.filter +
|
|
7774
8163
|
"|" + String(eventState.items.length) +
|
|
7775
8164
|
"|" + String(eventState.recycled) +
|
|
8165
|
+
"|" + String(eventState.error ? 1 : 0) +
|
|
7776
8166
|
"|" + (eventState.items[0] ? eventState.items[0].ts : "") +
|
|
7777
8167
|
"|" + (eventState.items[eventState.items.length - 1] ? eventState.items[eventState.items.length - 1].ts : "");
|
|
7778
8168
|
if (signature === eventState.signature) return;
|
|
7779
8169
|
eventState.signature = signature;
|
|
7780
|
-
|
|
8170
|
+
const anchor = captureEventAnchor();
|
|
8171
|
+
const keptTop = Number(eventsList.scrollTop) || 0;
|
|
8172
|
+
|
|
7781
8173
|
if (eventState.error) {
|
|
8174
|
+
eventState.rowNodes.clear();
|
|
8175
|
+
clearNode(eventsList);
|
|
7782
8176
|
eventsList.appendChild(element(doc, "div", "hive-event-error", eventState.error));
|
|
8177
|
+
eventsList.scrollTop = keptTop;
|
|
7783
8178
|
return;
|
|
7784
8179
|
}
|
|
7785
8180
|
if (eventState.items.length === 0) {
|
|
8181
|
+
eventState.rowNodes.clear();
|
|
8182
|
+
clearNode(eventsList);
|
|
7786
8183
|
eventsList.appendChild(emptyState(translate("events.empty")));
|
|
8184
|
+
eventsList.scrollTop = keptTop;
|
|
7787
8185
|
return;
|
|
7788
8186
|
}
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
8187
|
+
|
|
8188
|
+
const mappedRows = new Set([...eventState.rowNodes.values()].map((entry) => entry.row));
|
|
8189
|
+
for (const child of [...(eventsList.children || [])]) {
|
|
8190
|
+
if (String(child.className).split(/\s+/).includes("hive-event") && !mappedRows.has(child)) {
|
|
8191
|
+
eventsList.removeChild(child);
|
|
8192
|
+
}
|
|
8193
|
+
}
|
|
8194
|
+
const desired = new Set(eventState.items.map((event) => eventKey(event)));
|
|
8195
|
+
for (const [key, entry] of eventState.rowNodes) {
|
|
8196
|
+
if (desired.has(key)) continue;
|
|
8197
|
+
if (entry.row.parentNode) entry.row.parentNode.removeChild(entry.row);
|
|
8198
|
+
eventState.rowNodes.delete(key);
|
|
8199
|
+
}
|
|
8200
|
+
|
|
8201
|
+
let cursor = null;
|
|
8202
|
+
for (let index = eventState.items.length - 1; index >= 0; index -= 1) {
|
|
8203
|
+
const event = eventState.items[index];
|
|
8204
|
+
const key = eventKey(event);
|
|
8205
|
+
let entry = eventState.rowNodes.get(key);
|
|
8206
|
+
if (!entry) {
|
|
8207
|
+
entry = createEventRow(event);
|
|
8208
|
+
eventState.rowNodes.set(key, entry);
|
|
8209
|
+
}
|
|
8210
|
+
if (entry.row.parentNode !== eventsList || eventRowNext(entry.row) !== cursor) {
|
|
8211
|
+
insertEventRow(entry.row, cursor);
|
|
8212
|
+
}
|
|
8213
|
+
cursor = entry.row;
|
|
7800
8214
|
}
|
|
8215
|
+
restoreEventAnchor(anchor);
|
|
7801
8216
|
}
|
|
7802
8217
|
|
|
7803
8218
|
function maybeLoadEventPage() {
|
|
@@ -7813,7 +8228,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7813
8228
|
eventState.loading = true;
|
|
7814
8229
|
eventState.error = "";
|
|
7815
8230
|
eventState.paged = true;
|
|
7816
|
-
const beforeTop = Number(eventsList.scrollTop) || 0;
|
|
7817
8231
|
const cursor = reset ? 0 : eventState.cursor;
|
|
7818
8232
|
try {
|
|
7819
8233
|
const response = await fetchImpl(eventPageUrl(cursor), {
|
|
@@ -7822,7 +8236,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7822
8236
|
});
|
|
7823
8237
|
if (!response || response.ok === false) throw new Error("events page failed");
|
|
7824
8238
|
const payload = await response.json();
|
|
7825
|
-
const items = Array.isArray(payload && payload.items) ? payload.items : [];
|
|
8239
|
+
const items = normalizeEvents(Array.isArray(payload && payload.items) ? payload.items : []);
|
|
7826
8240
|
const total = asCount(payload && payload.total, eventState.total);
|
|
7827
8241
|
const next = asCount(payload && payload.cursor, cursor + items.length);
|
|
7828
8242
|
if (reset) {
|
|
@@ -7841,7 +8255,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7841
8255
|
eventState.total = total;
|
|
7842
8256
|
eventState.signature = "";
|
|
7843
8257
|
if (!destroyed && lastModel) renderEvents(lastModel);
|
|
7844
|
-
if (!reset) eventsList.scrollTop = beforeTop;
|
|
7845
8258
|
} catch (error) {
|
|
7846
8259
|
eventState.error = translate("events.loadFailed");
|
|
7847
8260
|
reportError(error);
|
|
@@ -7858,6 +8271,8 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7858
8271
|
eventState.initialized = false;
|
|
7859
8272
|
eventState.items = [];
|
|
7860
8273
|
eventState.signature = "";
|
|
8274
|
+
eventState.expanded.clear();
|
|
8275
|
+
eventState.rowNodes.clear();
|
|
7861
8276
|
eventsCount.textContent = "0";
|
|
7862
8277
|
clearNode(eventsFilter);
|
|
7863
8278
|
eventsRecycle.className = "hive-events-recycle is-hidden";
|
|
@@ -7936,6 +8351,8 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7936
8351
|
eventState.error = "";
|
|
7937
8352
|
eventState.paged = false;
|
|
7938
8353
|
eventState.signature = "";
|
|
8354
|
+
eventState.expanded.clear();
|
|
8355
|
+
eventState.rowNodes.clear();
|
|
7939
8356
|
eventsList.scrollTop = 0;
|
|
7940
8357
|
planTriggerButton = null;
|
|
7941
8358
|
closeHelp(false);
|
|
@@ -7965,15 +8382,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7965
8382
|
closeHelp(false);
|
|
7966
8383
|
openHelp();
|
|
7967
8384
|
}
|
|
7968
|
-
if (
|
|
7969
|
-
drawerState &&
|
|
7970
|
-
drawerState.kind === "card" &&
|
|
7971
|
-
!drawerActionBusy &&
|
|
7972
|
-
Array.isArray(model.taskList)
|
|
7973
|
-
) {
|
|
7974
|
-
const updated = model.taskList.find((task) => task.id === drawerState.card.id);
|
|
7975
|
-
if (updated) openDrawer(updated, updated.state || drawerState.lane);
|
|
7976
|
-
}
|
|
7977
8385
|
return model;
|
|
7978
8386
|
}
|
|
7979
8387
|
|