@d86e/hive-panel 1.0.20 → 1.0.22
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 +7 -3
- package/public/panel.js +219 -79
package/package.json
CHANGED
package/public/panel.css
CHANGED
|
@@ -1015,7 +1015,7 @@
|
|
|
1015
1015
|
width: 100%;
|
|
1016
1016
|
max-width: 100%;
|
|
1017
1017
|
min-width: 0;
|
|
1018
|
-
grid-template-columns: minmax(0, 1fr)
|
|
1018
|
+
grid-template-columns: minmax(0, 1fr) 88px 68px 44px 44px 28px;
|
|
1019
1019
|
}
|
|
1020
1020
|
.hive-portal .hive-limits-cell,
|
|
1021
1021
|
.hive-portal .hive-limits-role,
|
|
@@ -1077,7 +1077,7 @@ dialog.hive-dialog .hive-limits-row {
|
|
|
1077
1077
|
width: 100%;
|
|
1078
1078
|
max-width: 100%;
|
|
1079
1079
|
min-width: 0;
|
|
1080
|
-
grid-template-columns: minmax(0, 1fr)
|
|
1080
|
+
grid-template-columns: minmax(0, 1fr) 88px 68px 44px 44px 28px;
|
|
1081
1081
|
}
|
|
1082
1082
|
dialog.hive-dialog .hive-limits-cell,
|
|
1083
1083
|
dialog.hive-dialog .hive-limits-role,
|
|
@@ -1327,8 +1327,12 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1327
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
1328
|
.hive-event-raw { position: static; flex: 0 0 auto; }
|
|
1329
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-
|
|
1330
|
+
.hive-event-details { display: flex; flex-direction: column; gap: 3px; width: 100%; margin: 6px 0 2px; padding: 7px 10px 7px 20px; border-left: 3px solid color-mix(in srgb, var(--hive-accent) 68%, transparent); border-radius: 0 var(--hive-radius-sm) var(--hive-radius-sm) 0; background: var(--hive-bg-layer-1); font-size: 10px; }
|
|
1331
|
+
.hive-event-detail { display: flex; align-items: flex-start; gap: 6px; }
|
|
1332
|
+
.hive-event-label { flex: 0 0 auto; color: var(--hive-fg-faint); }
|
|
1333
|
+
.hive-event-value { min-width: 0; color: var(--hive-fg-soft); overflow-wrap: anywhere; }
|
|
1331
1334
|
.hive-event.is-expanded { flex-wrap: wrap; align-items: flex-start; height: auto; min-height: 28px; padding: 5px 7px; overflow: visible; }
|
|
1332
1335
|
.hive-event.is-expanded .hive-event-sentence { flex-basis: 100%; white-space: normal; }
|
|
1333
1336
|
.hive-event.is-expanded .hive-event-raw { flex-basis: 100%; }
|
|
1334
1337
|
|
|
1338
|
+
.hive-limits-source { color: var(--hive-fg-faint); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
|
package/public/panel.js
CHANGED
|
@@ -982,7 +982,7 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
982
982
|
|
|
983
983
|
.hive-limits-row {
|
|
984
984
|
display: grid;
|
|
985
|
-
grid-template-columns: minmax(0, 1fr)
|
|
985
|
+
grid-template-columns: minmax(0, 1fr) 88px 68px 44px 44px 28px;
|
|
986
986
|
align-items: center;
|
|
987
987
|
gap: 6px;
|
|
988
988
|
min-width: 0;
|
|
@@ -1859,7 +1859,7 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1859
1859
|
width: 100%;
|
|
1860
1860
|
max-width: 100%;
|
|
1861
1861
|
min-width: 0;
|
|
1862
|
-
grid-template-columns: minmax(0, 1fr)
|
|
1862
|
+
grid-template-columns: minmax(0, 1fr) 88px 68px 44px 44px 28px;
|
|
1863
1863
|
}
|
|
1864
1864
|
.hive-portal .hive-limits-cell,
|
|
1865
1865
|
.hive-portal .hive-limits-role,
|
|
@@ -1919,7 +1919,7 @@ dialog.hive-dialog .hive-limits-row {
|
|
|
1919
1919
|
width: 100%;
|
|
1920
1920
|
max-width: 100%;
|
|
1921
1921
|
min-width: 0;
|
|
1922
|
-
grid-template-columns: minmax(0, 1fr)
|
|
1922
|
+
grid-template-columns: minmax(0, 1fr) 88px 68px 44px 44px 28px;
|
|
1923
1923
|
}
|
|
1924
1924
|
dialog.hive-dialog .hive-limits-cell,
|
|
1925
1925
|
dialog.hive-dialog .hive-limits-role,
|
|
@@ -2146,10 +2146,14 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2146
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
2147
|
.hive-event-raw { position: static; flex: 0 0 auto; }
|
|
2148
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-
|
|
2149
|
+
.hive-event-details { display: flex; flex-direction: column; gap: 3px; width: 100%; margin: 6px 0 2px; padding: 7px 10px 7px 20px; border-left: 3px solid color-mix(in srgb, var(--hive-accent) 68%, transparent); border-radius: 0 var(--hive-radius-sm) var(--hive-radius-sm) 0; background: var(--hive-bg-layer-1); font-size: 10px; }
|
|
2150
|
+
.hive-event-detail { display: flex; align-items: flex-start; gap: 6px; }
|
|
2151
|
+
.hive-event-label { flex: 0 0 auto; color: var(--hive-fg-faint); }
|
|
2152
|
+
.hive-event-value { min-width: 0; color: var(--hive-fg-soft); overflow-wrap: anywhere; }
|
|
2150
2153
|
.hive-event.is-expanded { flex-wrap: wrap; align-items: flex-start; height: auto; min-height: 28px; padding: 5px 7px; overflow: visible; }
|
|
2151
2154
|
.hive-event.is-expanded .hive-event-sentence { flex-basis: 100%; white-space: normal; }
|
|
2152
2155
|
.hive-event.is-expanded .hive-event-raw { flex-basis: 100%; }
|
|
2156
|
+
.hive-limits-source { color: var(--hive-fg-faint); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
|
|
2153
2157
|
`;
|
|
2154
2158
|
|
|
2155
2159
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2295,6 +2299,14 @@ export const messages = Object.freeze({
|
|
|
2295
2299
|
"events.recycled": "Recycled {count} older events",
|
|
2296
2300
|
"events.loadFailed": "Could not load events",
|
|
2297
2301
|
"events.details": "Details",
|
|
2302
|
+
"events.field.time": "Time",
|
|
2303
|
+
"events.field.actor": "Who",
|
|
2304
|
+
"events.field.action": "What",
|
|
2305
|
+
"events.field.task": "Task",
|
|
2306
|
+
"events.field.files": "Files",
|
|
2307
|
+
"events.field.resultReason": "Result or reason",
|
|
2308
|
+
"events.result.pass": "passed",
|
|
2309
|
+
"events.result.reject": "rejected",
|
|
2298
2310
|
"events.actor.queen": "Queen",
|
|
2299
2311
|
"events.actor.supervisor": "Supervisor",
|
|
2300
2312
|
"events.unknown": "Other event: {kind}",
|
|
@@ -2350,6 +2362,10 @@ export const messages = Object.freeze({
|
|
|
2350
2362
|
"limits.description": "Max agents working at the same time, per role; 0 pauses the role",
|
|
2351
2363
|
"limits.role": "Role",
|
|
2352
2364
|
"limits.limit": "Concurrency limit",
|
|
2365
|
+
"limits.source": "Source",
|
|
2366
|
+
"limits.source.config": "Config",
|
|
2367
|
+
"limits.source.limits": "limits.json",
|
|
2368
|
+
"limits.source.default": "Default",
|
|
2353
2369
|
"limits.inFlight": "Running",
|
|
2354
2370
|
"limits.queued": "Waiting",
|
|
2355
2371
|
"limits.defaultHint": "0-999, default 5",
|
|
@@ -2637,6 +2653,14 @@ export const messages = Object.freeze({
|
|
|
2637
2653
|
"events.recycled": "已回收更早的 {count} 条",
|
|
2638
2654
|
"events.loadFailed": "事件加载失败",
|
|
2639
2655
|
"events.details": "详情",
|
|
2656
|
+
"events.field.time": "时间",
|
|
2657
|
+
"events.field.actor": "谁",
|
|
2658
|
+
"events.field.action": "做了什么",
|
|
2659
|
+
"events.field.task": "任务",
|
|
2660
|
+
"events.field.files": "涉及文件",
|
|
2661
|
+
"events.field.resultReason": "结果或原因",
|
|
2662
|
+
"events.result.pass": "通过",
|
|
2663
|
+
"events.result.reject": "驳回",
|
|
2640
2664
|
"events.actor.queen": "女王",
|
|
2641
2665
|
"events.actor.supervisor": "监督器",
|
|
2642
2666
|
"events.unknown": "其它事件:{kind}",
|
|
@@ -2692,6 +2716,10 @@ export const messages = Object.freeze({
|
|
|
2692
2716
|
"limits.description": "同时干活的智能体数量上限,按角色分别设置;0 表示暂停该角色",
|
|
2693
2717
|
"limits.role": "角色",
|
|
2694
2718
|
"limits.limit": "并发上限",
|
|
2719
|
+
"limits.source": "来源",
|
|
2720
|
+
"limits.source.config": "配置",
|
|
2721
|
+
"limits.source.limits": "limits.json",
|
|
2722
|
+
"limits.source.default": "默认",
|
|
2695
2723
|
"limits.inFlight": "运行",
|
|
2696
2724
|
"limits.queued": "等待",
|
|
2697
2725
|
"limits.defaultHint": "0–999,默认 5",
|
|
@@ -4936,51 +4964,77 @@ export function mount(root, options = {}) {
|
|
|
4936
4964
|
}
|
|
4937
4965
|
|
|
4938
4966
|
function roleRowsForCurrentRepo(row) {
|
|
4939
|
-
const
|
|
4967
|
+
const roles = new Map();
|
|
4968
|
+
const ensure = (name) => {
|
|
4969
|
+
if (!roles.has(name)) roles.set(name, { role: name, limit: null, inFlight: null, queued: null, source: "default", adapter: null, model: null, modelLimit: false });
|
|
4970
|
+
return roles.get(name);
|
|
4971
|
+
};
|
|
4972
|
+
|
|
4940
4973
|
if (row && Array.isArray(row.roles)) {
|
|
4941
4974
|
for (const role of row.roles) {
|
|
4942
4975
|
if (!isRecord(role)) continue;
|
|
4943
4976
|
const name = asString(role.role);
|
|
4944
|
-
if (name)
|
|
4977
|
+
if (!name) continue;
|
|
4978
|
+
const entry = ensure(name);
|
|
4979
|
+
entry.inFlight = supervisorNumber(role.inFlight);
|
|
4980
|
+
entry.queued = supervisorNumber(role.queued);
|
|
4981
|
+
const limit = supervisorNumber(role.limit);
|
|
4982
|
+
if (limit !== null) entry.limit = limit;
|
|
4945
4983
|
}
|
|
4946
4984
|
}
|
|
4985
|
+
|
|
4947
4986
|
const modelRoles = lastModel && lastModel.roles && Array.isArray(lastModel.roles.list) ? lastModel.roles.list : [];
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
const effective = supervisorRoles.get(name);
|
|
4960
|
-
return {
|
|
4961
|
-
role: name,
|
|
4962
|
-
adapter: entry.adapter,
|
|
4963
|
-
model: entry.model,
|
|
4964
|
-
limit,
|
|
4965
|
-
inFlight: effective ? effective.inFlight : null,
|
|
4966
|
-
queued: effective ? effective.queued : null,
|
|
4967
|
-
};
|
|
4968
|
-
})
|
|
4969
|
-
.filter(Boolean)
|
|
4970
|
-
.sort((left, right) => left.role.localeCompare(right.role));
|
|
4987
|
+
for (const modelRole of modelRoles) {
|
|
4988
|
+
const name = asString(modelRole && modelRole.name);
|
|
4989
|
+
if (!name) continue;
|
|
4990
|
+
const entry = ensure(name);
|
|
4991
|
+
if (modelRole.adapter) entry.adapter = modelRole.adapter;
|
|
4992
|
+
if (modelRole.model) entry.model = modelRole.model;
|
|
4993
|
+
const limit = supervisorNumber(modelRole.limit);
|
|
4994
|
+
if (limit !== null) {
|
|
4995
|
+
entry.limit = limit;
|
|
4996
|
+
entry.modelLimit = true;
|
|
4997
|
+
}
|
|
4971
4998
|
}
|
|
4972
4999
|
|
|
4973
|
-
const
|
|
4974
|
-
for (const [name,
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
5000
|
+
const savedLimits = lastModel && lastModel.roles && isRecord(lastModel.roles.limits) ? lastModel.roles.limits : {};
|
|
5001
|
+
for (const [name, rawLimit] of Object.entries(savedLimits)) {
|
|
5002
|
+
if (!name) continue;
|
|
5003
|
+
const entry = ensure(name);
|
|
5004
|
+
const limit = supervisorNumber(rawLimit);
|
|
5005
|
+
if (limit !== null) entry.limit = limit;
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5008
|
+
const addTaskRole = (role) => {
|
|
5009
|
+
const name = asString(role);
|
|
5010
|
+
if (name) ensure(name);
|
|
5011
|
+
};
|
|
5012
|
+
if (lastModel) {
|
|
5013
|
+
for (const task of lastModel.taskList || []) addTaskRole(task.role);
|
|
5014
|
+
for (const cards of Object.values(lastModel.lanes || {})) {
|
|
5015
|
+
for (const card of cards || []) addTaskRole(card.role);
|
|
4981
5016
|
}
|
|
4982
|
-
for (const name of Object.keys(lastModel.stats.byRole || {}))
|
|
4983
|
-
|
|
5017
|
+
for (const name of Object.keys((lastModel.stats && lastModel.stats.byRole) || {})) addTaskRole(name);
|
|
5018
|
+
}
|
|
5019
|
+
|
|
5020
|
+
for (const entry of roles.values()) {
|
|
5021
|
+
const persisted = lastModel && lastModel.roles && isRecord(lastModel.roles.limits)
|
|
5022
|
+
? supervisorNumber(lastModel.roles.limits[entry.role])
|
|
5023
|
+
: null;
|
|
5024
|
+
const supervisorRole = row && Array.isArray(row.roles)
|
|
5025
|
+
? row.roles.find((candidate) => isRecord(candidate) && asString(candidate.role) === entry.role)
|
|
5026
|
+
: null;
|
|
5027
|
+
const supervisorLimit = supervisorRole ? supervisorNumber(supervisorRole.limit) : null;
|
|
5028
|
+
if (persisted !== null) {
|
|
5029
|
+
entry.limit = persisted;
|
|
5030
|
+
entry.source = "limits";
|
|
5031
|
+
} else if (supervisorLimit !== null) {
|
|
5032
|
+
entry.limit = supervisorLimit;
|
|
5033
|
+
entry.source = "config";
|
|
5034
|
+
} else if (entry.modelLimit) {
|
|
5035
|
+
entry.source = "limits";
|
|
5036
|
+
} else {
|
|
5037
|
+
entry.source = "default";
|
|
4984
5038
|
}
|
|
4985
5039
|
}
|
|
4986
5040
|
return [...roles.values()].sort((left, right) => left.role.localeCompare(right.role));
|
|
@@ -5164,6 +5218,7 @@ export function mount(root, options = {}) {
|
|
|
5164
5218
|
const header = element(doc, "div", "hive-limits-row is-head");
|
|
5165
5219
|
header.appendChild(element(doc, "span", "hive-limits-cell", translate("limits.role")));
|
|
5166
5220
|
header.appendChild(element(doc, "span", "hive-limits-cell is-number", translate("limits.limit")));
|
|
5221
|
+
header.appendChild(element(doc, "span", "hive-limits-cell", translate("limits.source")));
|
|
5167
5222
|
header.appendChild(element(doc, "span", "hive-limits-cell is-number", translate("limits.inFlight")));
|
|
5168
5223
|
header.appendChild(element(doc, "span", "hive-limits-cell is-number", translate("limits.queued")));
|
|
5169
5224
|
header.appendChild(element(doc, "span", "hive-limits-cell is-action", ""));
|
|
@@ -5182,6 +5237,8 @@ export function mount(root, options = {}) {
|
|
|
5182
5237
|
input.value = supervisorNumber(role.limit) === null ? "5" : String(supervisorNumber(role.limit));
|
|
5183
5238
|
input.disabled = !writable || !supervisorAvailable;
|
|
5184
5239
|
roleRow.appendChild(input);
|
|
5240
|
+
const sourceKey = role.source === "limits" ? "limits.source.limits" : role.source === "config" ? "limits.source.config" : "limits.source.default";
|
|
5241
|
+
roleRow.appendChild(element(doc, "span", "hive-limits-cell hive-limits-source", translate(sourceKey)));
|
|
5185
5242
|
roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.inFlight)));
|
|
5186
5243
|
roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.queued)));
|
|
5187
5244
|
if (writable) {
|
|
@@ -5482,6 +5539,13 @@ export function mount(root, options = {}) {
|
|
|
5482
5539
|
throw error;
|
|
5483
5540
|
}
|
|
5484
5541
|
if (destroyed) return;
|
|
5542
|
+
if (lastModel) {
|
|
5543
|
+
if (!lastModel.roles || !isRecord(lastModel.roles)) lastModel.roles = { list: [], limits: {}, error: null };
|
|
5544
|
+
lastModel.roles.limits = {
|
|
5545
|
+
...(isRecord(lastModel.roles.limits) ? lastModel.roles.limits : {}),
|
|
5546
|
+
...roleLimits,
|
|
5547
|
+
};
|
|
5548
|
+
}
|
|
5485
5549
|
closeLimitsDialog(false);
|
|
5486
5550
|
showToast("success", translate("limits.saved"), state.repo);
|
|
5487
5551
|
await refreshSupervisor(true);
|
|
@@ -7897,7 +7961,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7897
7961
|
return pad(date.getHours()) + ":" + pad(date.getMinutes());
|
|
7898
7962
|
}
|
|
7899
7963
|
|
|
7900
|
-
function
|
|
7964
|
+
function eventActionText(event) {
|
|
7901
7965
|
const raw = event.raw || {};
|
|
7902
7966
|
const kind = event.kind || asString(raw.kind);
|
|
7903
7967
|
const title = eventTaskTitle(event);
|
|
@@ -8001,7 +8065,89 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8001
8065
|
action = say("events.unknown", { kind: kind || "?" });
|
|
8002
8066
|
break;
|
|
8003
8067
|
}
|
|
8004
|
-
return
|
|
8068
|
+
return action;
|
|
8069
|
+
}
|
|
8070
|
+
|
|
8071
|
+
function eventSentence(event) {
|
|
8072
|
+
return eventClock(event.ts) + " · " + eventActor(event) + " · " + eventActionText(event);
|
|
8073
|
+
}
|
|
8074
|
+
|
|
8075
|
+
function eventFiles(event) {
|
|
8076
|
+
const raw = event.raw || {};
|
|
8077
|
+
const paths = [];
|
|
8078
|
+
for (const value of [raw.paths, raw.files, raw.keys]) {
|
|
8079
|
+
if (!Array.isArray(value)) continue;
|
|
8080
|
+
for (const item of value) {
|
|
8081
|
+
const path = asString(item && typeof item === "object" ? item.key || item.file || item.path : item);
|
|
8082
|
+
if (path && !paths.includes(path)) paths.push(path);
|
|
8083
|
+
}
|
|
8084
|
+
}
|
|
8085
|
+
if (Array.isArray(raw.overlaps)) {
|
|
8086
|
+
for (const overlap of raw.overlaps) {
|
|
8087
|
+
const path = asString(overlap && (overlap.key || overlap.file || overlap.path));
|
|
8088
|
+
if (path && !paths.includes(path)) paths.push(path);
|
|
8089
|
+
}
|
|
8090
|
+
}
|
|
8091
|
+
return paths;
|
|
8092
|
+
}
|
|
8093
|
+
|
|
8094
|
+
function eventResultText(event) {
|
|
8095
|
+
const raw = event.raw || {};
|
|
8096
|
+
const kind = event.kind || asString(raw.kind);
|
|
8097
|
+
if (kind === "arch_review") {
|
|
8098
|
+
const verdict = asString(raw.verdict);
|
|
8099
|
+
const label = verdict === "reject" ? translate("events.result.reject") : translate("events.result.pass");
|
|
8100
|
+
const findings = Array.isArray(raw.findings) ? raw.findings.map((finding) => asString(finding)).filter(Boolean) : [];
|
|
8101
|
+
const summary = asString(raw.summary);
|
|
8102
|
+
return [label, findings.join(";"), summary].filter(Boolean).join(" · ");
|
|
8103
|
+
}
|
|
8104
|
+
if (kind === "commit_announce" || kind === "guard") {
|
|
8105
|
+
const overlaps = Array.isArray(raw.overlaps) ? raw.overlaps : [];
|
|
8106
|
+
if (overlaps.length > 0) {
|
|
8107
|
+
return overlaps
|
|
8108
|
+
.slice(0, 5)
|
|
8109
|
+
.map((overlap) => {
|
|
8110
|
+
const path = asString(overlap && (overlap.key || overlap.file || overlap.path));
|
|
8111
|
+
const agent = asString(overlap && overlap.agent);
|
|
8112
|
+
return agent ? path + "(" + agent + ")" : path;
|
|
8113
|
+
})
|
|
8114
|
+
.filter(Boolean)
|
|
8115
|
+
.join("、");
|
|
8116
|
+
}
|
|
8117
|
+
}
|
|
8118
|
+
const value = raw.reason || raw.detail || raw.error || raw.message || raw.summary;
|
|
8119
|
+
if (Array.isArray(value)) return value.map((item) => asString(item)).filter(Boolean).join(";");
|
|
8120
|
+
if (typeof value === "string") return value;
|
|
8121
|
+
return "";
|
|
8122
|
+
}
|
|
8123
|
+
|
|
8124
|
+
function eventDetailEntries(event) {
|
|
8125
|
+
const raw = event.raw || {};
|
|
8126
|
+
const kind = event.kind || asString(raw.kind);
|
|
8127
|
+
const entries = [
|
|
8128
|
+
{ label: translate("events.field.time"), value: eventClock(event.ts) },
|
|
8129
|
+
{ label: translate("events.field.actor"), value: eventActor(event) },
|
|
8130
|
+
{ label: translate("events.field.action"), value: eventActionText(event) },
|
|
8131
|
+
];
|
|
8132
|
+
const known = new Set([
|
|
8133
|
+
"task_add", "add", "task_claim", "claim", "task_done", "done", "task_fail", "fail",
|
|
8134
|
+
"task_edit", "edit", "task_split", "split", "task_supersede", "supersede", "reopen",
|
|
8135
|
+
"task_reopen", "task_delete", "rm", "task_plan", "commit_announce", "guard", "lesson",
|
|
8136
|
+
"arch_review", "queen_intervention", "queen_boundary_violation", "service_down",
|
|
8137
|
+
"service_started", "mode", "checkpoint", "renew", "claim_overlap",
|
|
8138
|
+
]);
|
|
8139
|
+
if (!known.has(kind)) return entries;
|
|
8140
|
+
const title = eventTaskTitle(event);
|
|
8141
|
+
if (title) entries.push({ label: translate("events.field.task"), value: title });
|
|
8142
|
+
const files = eventFiles(event);
|
|
8143
|
+
if (files.length > 0) {
|
|
8144
|
+
const visible = files.slice(0, 5);
|
|
8145
|
+
const suffix = files.length > visible.length ? " +" + String(files.length - visible.length) : "";
|
|
8146
|
+
entries.push({ label: translate("events.field.files"), value: visible.join("、") + suffix });
|
|
8147
|
+
}
|
|
8148
|
+
const result = eventResultText(event);
|
|
8149
|
+
if (result) entries.push({ label: translate("events.field.resultReason"), value: result });
|
|
8150
|
+
return entries;
|
|
8005
8151
|
}
|
|
8006
8152
|
|
|
8007
8153
|
function eventRowHeight(row) {
|
|
@@ -8013,41 +8159,32 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8013
8159
|
return 28;
|
|
8014
8160
|
}
|
|
8015
8161
|
|
|
8016
|
-
function eventRowViewportOffset(row) {
|
|
8017
|
-
if (typeof row.getBoundingClientRect === "function") {
|
|
8018
|
-
const rowRect = row.getBoundingClientRect();
|
|
8019
|
-
const listRect = typeof eventsList.getBoundingClientRect === "function"
|
|
8020
|
-
? eventsList.getBoundingClientRect()
|
|
8021
|
-
: null;
|
|
8022
|
-
if (rowRect && listRect && Number.isFinite(Number(rowRect.top)) && Number.isFinite(Number(listRect.top))) {
|
|
8023
|
-
return Number(rowRect.top) - Number(listRect.top);
|
|
8024
|
-
}
|
|
8025
|
-
}
|
|
8026
|
-
if (Number.isFinite(Number(row.offsetTop))) return Number(row.offsetTop) - (Number(eventsList.scrollTop) || 0);
|
|
8027
|
-
let offset = -(Number(eventsList.scrollTop) || 0);
|
|
8028
|
-
for (const child of eventsList.children || []) {
|
|
8029
|
-
if (child === row) break;
|
|
8030
|
-
offset += eventRowHeight(child);
|
|
8031
|
-
}
|
|
8032
|
-
return offset;
|
|
8033
|
-
}
|
|
8034
|
-
|
|
8035
8162
|
function captureEventAnchor() {
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
for (const entry of
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8163
|
+
const scrollTop = Number(eventsList.scrollTop) || 0;
|
|
8164
|
+
if (scrollTop <= 0) return { atTop: true, scrollTop: 0 };
|
|
8165
|
+
const rowKeys = new Map();
|
|
8166
|
+
for (const entry of eventState.rowNodes.values()) rowKeys.set(entry.row, entry.key);
|
|
8167
|
+
const listRect = typeof eventsList.getBoundingClientRect === "function"
|
|
8168
|
+
? eventsList.getBoundingClientRect()
|
|
8169
|
+
: null;
|
|
8170
|
+
let fallbackOffset = -scrollTop;
|
|
8171
|
+
for (const child of eventsList.children || []) {
|
|
8172
|
+
const key = rowKeys.get(child);
|
|
8173
|
+
if (key === undefined) continue;
|
|
8174
|
+
let offset = fallbackOffset;
|
|
8175
|
+
if (typeof child.getBoundingClientRect === "function" && listRect) {
|
|
8176
|
+
const rowRect = child.getBoundingClientRect();
|
|
8177
|
+
if (rowRect && Number.isFinite(Number(rowRect.top)) && Number.isFinite(Number(listRect.top))) {
|
|
8178
|
+
offset = Number(rowRect.top) - Number(listRect.top);
|
|
8179
|
+
}
|
|
8048
8180
|
}
|
|
8181
|
+
const height = eventRowHeight(child);
|
|
8182
|
+
if (offset + height > 0) {
|
|
8183
|
+
return { atTop: false, key, offset, scrollTop };
|
|
8184
|
+
}
|
|
8185
|
+
fallbackOffset += height;
|
|
8049
8186
|
}
|
|
8050
|
-
return { atTop: false, key: null, offset: 0, scrollTop
|
|
8187
|
+
return { atTop: false, key: null, offset: 0, scrollTop };
|
|
8051
8188
|
}
|
|
8052
8189
|
|
|
8053
8190
|
function restoreEventAnchor(anchor) {
|
|
@@ -8121,9 +8258,14 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8121
8258
|
row.appendChild(element(doc, "span", "hive-event-sentence", eventSentence(event)));
|
|
8122
8259
|
const details = element(doc, "details", "hive-event-raw");
|
|
8123
8260
|
details.appendChild(element(doc, "summary", "hive-event-summary", translate("events.details")));
|
|
8124
|
-
details
|
|
8125
|
-
|
|
8126
|
-
|
|
8261
|
+
const detailBox = element(doc, "div", "hive-event-details");
|
|
8262
|
+
for (const entry of eventDetailEntries(event)) {
|
|
8263
|
+
const line = element(doc, "div", "hive-event-detail");
|
|
8264
|
+
line.appendChild(element(doc, "span", "hive-event-label", entry.label));
|
|
8265
|
+
line.appendChild(element(doc, "span", "hive-event-value", entry.value));
|
|
8266
|
+
detailBox.appendChild(line);
|
|
8267
|
+
}
|
|
8268
|
+
details.appendChild(detailBox);
|
|
8127
8269
|
if (eventState.expanded.has(key)) {
|
|
8128
8270
|
details.open = true;
|
|
8129
8271
|
setAttr(details, "open", "");
|
|
@@ -8192,9 +8334,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8192
8334
|
entry = createEventRow(event);
|
|
8193
8335
|
eventState.rowNodes.set(key, entry);
|
|
8194
8336
|
}
|
|
8195
|
-
if (entry.row.parentNode !== eventsList
|
|
8196
|
-
insertEventRow(entry.row, cursor);
|
|
8197
|
-
}
|
|
8337
|
+
if (entry.row.parentNode !== eventsList) insertEventRow(entry.row, cursor);
|
|
8198
8338
|
cursor = entry.row;
|
|
8199
8339
|
}
|
|
8200
8340
|
restoreEventAnchor(anchor);
|