@d86e/hive-panel 1.0.12 → 1.0.13
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 +24 -2
- package/public/panel.js +337 -130
package/package.json
CHANGED
package/public/panel.css
CHANGED
|
@@ -1094,7 +1094,7 @@ dialog.hive-dialog {
|
|
|
1094
1094
|
dialog.hive-dialog .hive-dialog-head,
|
|
1095
1095
|
dialog.hive-dialog .hive-dialog-foot { flex: 0 0 auto; }
|
|
1096
1096
|
dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
|
|
1097
|
-
.hive-card-run-output {
|
|
1097
|
+
.hive-card-run-output { overflow: visible; overflow-wrap: anywhere; word-break: break-word; }
|
|
1098
1098
|
.hive-card-actions { flex-wrap: wrap; justify-content: flex-end; }
|
|
1099
1099
|
|
|
1100
1100
|
/* Virtual lanes: fixed 26px cards, 2px gaps, 28px stride. */
|
|
@@ -1163,7 +1163,7 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1163
1163
|
.hive-markdown .hive-md-list { margin: 0 0 8px; padding-left: 20px; }
|
|
1164
1164
|
.hive-markdown .hive-md-list li { margin: 2px 0; }
|
|
1165
1165
|
.hive-markdown .hive-md-code-inline { padding: 1px 4px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 11px; }
|
|
1166
|
-
.hive-markdown .hive-md-code-block { max-width: 100%; margin: 8px 0; padding: 10px; overflow-x: auto; border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 11px; line-height: 1.55; white-space: pre; scrollbar-color: var(--hive-line) transparent; scrollbar-width: thin; }
|
|
1166
|
+
.hive-markdown .hive-md-code-block { max-width: 100%; margin: 8px 0; padding: 10px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 11px; line-height: 1.55; white-space: pre; scrollbar-color: var(--hive-line) transparent; scrollbar-width: thin; }
|
|
1167
1167
|
.hive-markdown .hive-md-code-block code { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; white-space: pre; }
|
|
1168
1168
|
.hive-markdown .hive-md-quote { margin: 8px 0; padding: 2px 0 2px 10px; border-left: 2px solid var(--hive-line); color: var(--hive-fg-soft); }
|
|
1169
1169
|
.hive-markdown .hive-md-link { color: var(--hive-accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
@@ -1220,3 +1220,25 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1220
1220
|
.hive-section-content > :first-child { margin-top: 0; }
|
|
1221
1221
|
.hive-section-content > :last-child { margin-bottom: 0; }
|
|
1222
1222
|
|
|
1223
|
+
/* Shared-experience block in the task dialog. */
|
|
1224
|
+
.hive-exp-count { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.6; }
|
|
1225
|
+
.hive-exp-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; min-width: 0; }
|
|
1226
|
+
.hive-exp-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; font-size: 11px; line-height: 1.5; }
|
|
1227
|
+
.hive-exp-scope { max-width: 100%; padding: 1px 5px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 10.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1228
|
+
.hive-exp-text { color: var(--hive-fg-soft); overflow-wrap: anywhere; }
|
|
1229
|
+
.hive-exp-more { align-self: flex-start; padding: 2px 6px; font-size: 10.5px; }
|
|
1230
|
+
|
|
1231
|
+
/* The run section uses the same outer structure as every other section; the
|
|
1232
|
+
content surface comes from .hive-section-content, so the legacy run box is
|
|
1233
|
+
intentionally transparent. */
|
|
1234
|
+
.hive-card-run { display: block; margin: 0 0 12px; padding: 0; border: 0; border-radius: 0; background: transparent; overflow: visible; }
|
|
1235
|
+
.hive-section-meta { margin: 0 0 6px; padding: 0; overflow-wrap: anywhere; color: var(--hive-fg-soft); font-family: var(--hive-mono); font-size: 11px; line-height: 1.5; }
|
|
1236
|
+
.hive-card-run-empty { margin: 0; }
|
|
1237
|
+
.hive-card-run-output { margin: 0; padding: 0; overflow: visible; border: 0; background: transparent; font-family: var(--hive-mono); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; word-break: break-word; }
|
|
1238
|
+
.hive-card-run-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0; border: 0; }
|
|
1239
|
+
|
|
1240
|
+
.hive-run-files { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 8px; min-width: 0; }
|
|
1241
|
+
.hive-run-field-label { flex: 0 0 auto; color: var(--hive-fg-faint); font-size: 11px; font-weight: 600; line-height: 1.5; }
|
|
1242
|
+
.hive-run-failure { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hive-line-2); }
|
|
1243
|
+
.hive-run-failure-text { margin-top: 2px; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
|
|
1244
|
+
|
package/public/panel.js
CHANGED
|
@@ -1476,58 +1476,7 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1476
1476
|
overflow: auto;
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
|
-
.hive-card-run {
|
|
1480
|
-
border: 1px solid var(--hive-line);
|
|
1481
|
-
border-radius: var(--hive-radius-md);
|
|
1482
|
-
background: var(--hive-surface);
|
|
1483
|
-
overflow: hidden;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
.hive-card-run-title {
|
|
1487
|
-
padding: 8px 10px;
|
|
1488
|
-
color: var(--hive-fg-soft);
|
|
1489
|
-
font-size: 12px;
|
|
1490
|
-
font-weight: 650;
|
|
1491
|
-
letter-spacing: 0.08em;
|
|
1492
|
-
line-height: 1.5;
|
|
1493
|
-
text-transform: uppercase;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
.hive-card-run-meta {
|
|
1497
|
-
padding: 0 10px 8px;
|
|
1498
|
-
overflow-wrap: anywhere;
|
|
1499
|
-
color: var(--hive-fg-soft);
|
|
1500
|
-
font-family: var(--hive-mono);
|
|
1501
|
-
font-size: 12px;
|
|
1502
|
-
line-height: 1.5;
|
|
1503
|
-
}
|
|
1504
1479
|
|
|
1505
|
-
.hive-card-run-empty {
|
|
1506
|
-
margin: 0 10px 10px;
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
.hive-card-run-output {
|
|
1510
|
-
max-height: 360px;
|
|
1511
|
-
max-height: 20lh; /* longer output scrolls inside the pre */
|
|
1512
|
-
margin: 0;
|
|
1513
|
-
padding: 10px;
|
|
1514
|
-
overflow: auto;
|
|
1515
|
-
border-top: 1px solid var(--hive-line);
|
|
1516
|
-
background: var(--hive-surface);
|
|
1517
|
-
font-family: var(--hive-mono);
|
|
1518
|
-
font-size: 12px;
|
|
1519
|
-
line-height: 1.5;
|
|
1520
|
-
white-space: pre-wrap;
|
|
1521
|
-
overflow-wrap: anywhere;
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
.hive-card-run-foot {
|
|
1525
|
-
display: flex;
|
|
1526
|
-
justify-content: flex-end;
|
|
1527
|
-
gap: 8px;
|
|
1528
|
-
padding: 8px 10px;
|
|
1529
|
-
border-top: 1px solid var(--hive-line);
|
|
1530
|
-
}
|
|
1531
1480
|
|
|
1532
1481
|
.hive-card-actions {
|
|
1533
1482
|
justify-content: flex-end;
|
|
@@ -1983,7 +1932,7 @@ dialog.hive-dialog {
|
|
|
1983
1932
|
dialog.hive-dialog .hive-dialog-head,
|
|
1984
1933
|
dialog.hive-dialog .hive-dialog-foot { flex: 0 0 auto; }
|
|
1985
1934
|
dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
|
|
1986
|
-
.hive-card-run-output {
|
|
1935
|
+
.hive-card-run-output { overflow: visible; overflow-wrap: anywhere; word-break: break-word; }
|
|
1987
1936
|
.hive-card-actions { flex-wrap: wrap; justify-content: flex-end; }
|
|
1988
1937
|
/* Virtual lanes: fixed 26px cards, 2px gaps, 28px stride. */
|
|
1989
1938
|
.hive-lane-cards {
|
|
@@ -2047,7 +1996,7 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2047
1996
|
.hive-markdown .hive-md-list { margin: 0 0 8px; padding-left: 20px; }
|
|
2048
1997
|
.hive-markdown .hive-md-list li { margin: 2px 0; }
|
|
2049
1998
|
.hive-markdown .hive-md-code-inline { padding: 1px 4px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 11px; }
|
|
2050
|
-
.hive-markdown .hive-md-code-block { max-width: 100%; margin: 8px 0; padding: 10px; overflow-x: auto; border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 11px; line-height: 1.55; white-space: pre; scrollbar-color: var(--hive-line) transparent; scrollbar-width: thin; }
|
|
1999
|
+
.hive-markdown .hive-md-code-block { max-width: 100%; margin: 8px 0; padding: 10px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 11px; line-height: 1.55; white-space: pre; scrollbar-color: var(--hive-line) transparent; scrollbar-width: thin; }
|
|
2051
2000
|
.hive-markdown .hive-md-code-block code { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; white-space: pre; }
|
|
2052
2001
|
.hive-markdown .hive-md-quote { margin: 8px 0; padding: 2px 0 2px 10px; border-left: 2px solid var(--hive-line); color: var(--hive-fg-soft); }
|
|
2053
2002
|
.hive-markdown .hive-md-link { color: var(--hive-accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
@@ -2099,6 +2048,25 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2099
2048
|
.hive-section-content { padding: 10px; border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); }
|
|
2100
2049
|
.hive-section-content > :first-child { margin-top: 0; }
|
|
2101
2050
|
.hive-section-content > :last-child { margin-bottom: 0; }
|
|
2051
|
+
/* Shared-experience block in the task dialog. */
|
|
2052
|
+
.hive-exp-count { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.6; }
|
|
2053
|
+
.hive-exp-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; min-width: 0; }
|
|
2054
|
+
.hive-exp-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; font-size: 11px; line-height: 1.5; }
|
|
2055
|
+
.hive-exp-scope { max-width: 100%; padding: 1px 5px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); background: var(--hive-bg-layer-1); color: var(--hive-fg); font-family: var(--hive-mono); font-size: 10.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
2056
|
+
.hive-exp-text { color: var(--hive-fg-soft); overflow-wrap: anywhere; }
|
|
2057
|
+
.hive-exp-more { align-self: flex-start; padding: 2px 6px; font-size: 10.5px; }
|
|
2058
|
+
/* The run section uses the same outer structure as every other section; the
|
|
2059
|
+
content surface comes from .hive-section-content, so the legacy run box is
|
|
2060
|
+
intentionally transparent. */
|
|
2061
|
+
.hive-card-run { display: block; margin: 0 0 12px; padding: 0; border: 0; border-radius: 0; background: transparent; overflow: visible; }
|
|
2062
|
+
.hive-section-meta { margin: 0 0 6px; padding: 0; overflow-wrap: anywhere; color: var(--hive-fg-soft); font-family: var(--hive-mono); font-size: 11px; line-height: 1.5; }
|
|
2063
|
+
.hive-card-run-empty { margin: 0; }
|
|
2064
|
+
.hive-card-run-output { margin: 0; padding: 0; overflow: visible; border: 0; background: transparent; font-family: var(--hive-mono); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; word-break: break-word; }
|
|
2065
|
+
.hive-card-run-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0; border: 0; }
|
|
2066
|
+
.hive-run-files { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 8px; min-width: 0; }
|
|
2067
|
+
.hive-run-field-label { flex: 0 0 auto; color: var(--hive-fg-faint); font-size: 11px; font-weight: 600; line-height: 1.5; }
|
|
2068
|
+
.hive-run-failure { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hive-line-2); }
|
|
2069
|
+
.hive-run-failure-text { margin-top: 2px; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
|
|
2102
2070
|
`;
|
|
2103
2071
|
|
|
2104
2072
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2192,9 +2160,28 @@ export const messages = Object.freeze({
|
|
|
2192
2160
|
"drawer.removeClaimed": "A claimed task must be released or reopened before it can be deleted.",
|
|
2193
2161
|
"drawer.rawJson": "raw json",
|
|
2194
2162
|
"drawer.lastRun": "Last run",
|
|
2163
|
+
"drawer.runningTitle": "Running",
|
|
2164
|
+
"drawer.resultTitle": "Execution result",
|
|
2165
|
+
"drawer.claimedWaiting": "Claimed; waiting for the first heartbeat",
|
|
2166
|
+
"drawer.agent": "Agent {agent}",
|
|
2167
|
+
"drawer.startedAt": "Started {time}",
|
|
2168
|
+
"drawer.elapsed": "Elapsed {duration}",
|
|
2169
|
+
"drawer.lastHeartbeat": "Last heartbeat {time}",
|
|
2170
|
+
"drawer.status": "Status {status}",
|
|
2171
|
+
"drawer.duration": "Duration {duration}",
|
|
2172
|
+
"drawer.commit": "Commit {commit}",
|
|
2173
|
+
"drawer.files": "Files",
|
|
2174
|
+
"drawer.failureReason": "Failure reason",
|
|
2175
|
+
"drawer.outputTail": "Output tail",
|
|
2195
2176
|
"drawer.noOutput": "(no output)",
|
|
2196
2177
|
"drawer.scopeTitle": "Work scope",
|
|
2197
|
-
"drawer.dependenciesTitle": "
|
|
2178
|
+
"drawer.dependenciesTitle": "Dependency relationships",
|
|
2179
|
+
"drawer.dependenciesHint": "What this task depends on, and what depends on it.",
|
|
2180
|
+
"drawer.experienceTitle": "Experience",
|
|
2181
|
+
"drawer.experienceHint": "Shared experience this task read and wrote.",
|
|
2182
|
+
"drawer.experienceRead": "Read {count}",
|
|
2183
|
+
"drawer.experienceWritten": "Wrote {count}",
|
|
2184
|
+
"drawer.experienceMore": "+{count} more",
|
|
2198
2185
|
"drawer.dependsOn": "Depends on",
|
|
2199
2186
|
"drawer.requiredBy": "Required by",
|
|
2200
2187
|
"drawer.scopeHint": "Directories/files this task changes.",
|
|
@@ -2470,9 +2457,28 @@ export const messages = Object.freeze({
|
|
|
2470
2457
|
"drawer.removeClaimed": "已认领的任务必须先释放或重开才能删除。",
|
|
2471
2458
|
"drawer.rawJson": "原始 JSON",
|
|
2472
2459
|
"drawer.lastRun": "最近一次执行",
|
|
2460
|
+
"drawer.runningTitle": "正在执行",
|
|
2461
|
+
"drawer.resultTitle": "执行结果",
|
|
2462
|
+
"drawer.claimedWaiting": "已认领,等待首次心跳",
|
|
2463
|
+
"drawer.agent": "智能体 {agent}",
|
|
2464
|
+
"drawer.startedAt": "开始 {time}",
|
|
2465
|
+
"drawer.elapsed": "已运行 {duration}",
|
|
2466
|
+
"drawer.lastHeartbeat": "最后心跳 {time}",
|
|
2467
|
+
"drawer.status": "状态 {status}",
|
|
2468
|
+
"drawer.duration": "耗时 {duration}",
|
|
2469
|
+
"drawer.commit": "提交 {commit}",
|
|
2470
|
+
"drawer.files": "涉及文件",
|
|
2471
|
+
"drawer.failureReason": "失败原因",
|
|
2472
|
+
"drawer.outputTail": "输出尾部",
|
|
2473
2473
|
"drawer.noOutput": "(无输出)",
|
|
2474
2474
|
"drawer.scopeTitle": "工作范围",
|
|
2475
|
-
"drawer.dependenciesTitle": "
|
|
2475
|
+
"drawer.dependenciesTitle": "依赖关系",
|
|
2476
|
+
"drawer.dependenciesHint": "这个任务依赖谁、谁依赖它",
|
|
2477
|
+
"drawer.experienceTitle": "经验",
|
|
2478
|
+
"drawer.experienceHint": "这个任务读取与写入的共享经验",
|
|
2479
|
+
"drawer.experienceRead": "读取 {count} 条",
|
|
2480
|
+
"drawer.experienceWritten": "写入 {count} 条",
|
|
2481
|
+
"drawer.experienceMore": "+{count} 条",
|
|
2476
2482
|
"drawer.dependsOn": "依赖",
|
|
2477
2483
|
"drawer.requiredBy": "被依赖",
|
|
2478
2484
|
"drawer.scopeHint": "这个任务改动的目录/文件",
|
|
@@ -2766,6 +2772,8 @@ function normalizeLastRun(value) {
|
|
|
2766
2772
|
endedAt: asString(value.endedAt),
|
|
2767
2773
|
status,
|
|
2768
2774
|
commit: asString(value.commit),
|
|
2775
|
+
lastHeartbeat: asString(value.lastHeartbeat || value.heartbeat || value.lastOutputAt || value.updatedAt),
|
|
2776
|
+
reason: asString(value.reason || value.failureReason || value.error),
|
|
2769
2777
|
exitCode: typeof value.exitCode === "number" && Number.isFinite(value.exitCode) ? value.exitCode : null,
|
|
2770
2778
|
// Hive-runner records the worker activation's Session id; a host that can
|
|
2771
2779
|
// navigate can open that conversation, an older record simply has none.
|
|
@@ -2778,6 +2786,71 @@ function normalizeLastRun(value) {
|
|
|
2778
2786
|
};
|
|
2779
2787
|
}
|
|
2780
2788
|
|
|
2789
|
+
function normalizeExperienceItem(value) {
|
|
2790
|
+
if (typeof value === "string") {
|
|
2791
|
+
const scope = value.trim();
|
|
2792
|
+
return scope ? { scope, text: "" } : null;
|
|
2793
|
+
}
|
|
2794
|
+
if (!isRecord(value)) return null;
|
|
2795
|
+
const scope = asString(value.scope || value.path || value.key || value.file);
|
|
2796
|
+
const text = asString(value.text || value.summary || value.lesson || value.title);
|
|
2797
|
+
if (!scope && !text) return null;
|
|
2798
|
+
return { scope, text };
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
function normalizeExperienceSide(value, fallbackCount, fallbackItems) {
|
|
2802
|
+
let count = asCount(fallbackCount, 0);
|
|
2803
|
+
let items = Array.isArray(fallbackItems) ? fallbackItems : [];
|
|
2804
|
+
if (typeof value === "number" && Number.isFinite(value)) count = value;
|
|
2805
|
+
else if (Array.isArray(value)) {
|
|
2806
|
+
items = value;
|
|
2807
|
+
count = value.length;
|
|
2808
|
+
} else if (isRecord(value)) {
|
|
2809
|
+
count = asCount(value.count, count);
|
|
2810
|
+
const rawItems = value.items || value.list || value.lessons || value.entries;
|
|
2811
|
+
if (Array.isArray(rawItems)) items = rawItems;
|
|
2812
|
+
}
|
|
2813
|
+
const normalized = items
|
|
2814
|
+
.map(normalizeExperienceItem)
|
|
2815
|
+
.filter(Boolean);
|
|
2816
|
+
if (count === 0 && normalized.length > 0) count = normalized.length;
|
|
2817
|
+
return { count, items: normalized };
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
function normalizeExperience(task) {
|
|
2821
|
+
const source = isRecord(task && task.experience) ? task.experience : {};
|
|
2822
|
+
const lessons = isRecord(task && task.lessons) ? task.lessons : {};
|
|
2823
|
+
const runLessons =
|
|
2824
|
+
isRecord(task) && isRecord(task.lastRun) && isRecord(task.lastRun.lessons)
|
|
2825
|
+
? task.lastRun.lessons
|
|
2826
|
+
: {};
|
|
2827
|
+
const readSource = source.read !== undefined ? source.read : lessons.read !== undefined ? lessons.read : undefined;
|
|
2828
|
+
const writeSource =
|
|
2829
|
+
source.written !== undefined
|
|
2830
|
+
? source.written
|
|
2831
|
+
: source.write !== undefined
|
|
2832
|
+
? source.write
|
|
2833
|
+
: lessons.written !== undefined
|
|
2834
|
+
? lessons.written
|
|
2835
|
+
: lessons.write !== undefined
|
|
2836
|
+
? lessons.write
|
|
2837
|
+
: undefined;
|
|
2838
|
+
const read = normalizeExperienceSide(
|
|
2839
|
+
readSource,
|
|
2840
|
+
asCount(source.readCount, asCount(lessons.readCount, asCount(lessons.count, asCount(runLessons.count, 0)))),
|
|
2841
|
+
Array.isArray(lessons.items) ? lessons.items : [],
|
|
2842
|
+
);
|
|
2843
|
+
const written = normalizeExperienceSide(
|
|
2844
|
+
writeSource,
|
|
2845
|
+
asCount(
|
|
2846
|
+
source.writtenCount,
|
|
2847
|
+
asCount(source.writeCount, asCount(lessons.writtenCount, asCount(lessons.writeCount, 0))),
|
|
2848
|
+
),
|
|
2849
|
+
Array.isArray(lessons.writtenItems) ? lessons.writtenItems : [],
|
|
2850
|
+
);
|
|
2851
|
+
return { read, written };
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2781
2854
|
function normalizeCard(task) {
|
|
2782
2855
|
return {
|
|
2783
2856
|
id: asString(task.id),
|
|
@@ -2791,6 +2864,7 @@ function normalizeCard(task) {
|
|
|
2791
2864
|
stateChangedAt: asString(task.stateChangedAt),
|
|
2792
2865
|
createdAt: asString(task.createdAt),
|
|
2793
2866
|
updatedAt: asString(task.updatedAt),
|
|
2867
|
+
experience: normalizeExperience(task),
|
|
2794
2868
|
lastRun: normalizeLastRun(task.lastRun),
|
|
2795
2869
|
};
|
|
2796
2870
|
}
|
|
@@ -5793,11 +5867,13 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
5793
5867
|
return { section, content, title, head };
|
|
5794
5868
|
}
|
|
5795
5869
|
|
|
5796
|
-
function buildRunSection(
|
|
5870
|
+
function buildRunSection(card, lane, actionHost) {
|
|
5871
|
+
if (lane === "pending") return null;
|
|
5872
|
+
const claimed = lane === "claimed";
|
|
5873
|
+
const run = card.lastRun;
|
|
5797
5874
|
const part = createSection({
|
|
5798
|
-
title: translate("drawer.
|
|
5875
|
+
title: claimed ? translate("drawer.runningTitle") : translate("drawer.resultTitle"),
|
|
5799
5876
|
className: "hive-card-run",
|
|
5800
|
-
titleClass: "hive-card-run-title",
|
|
5801
5877
|
});
|
|
5802
5878
|
const section = part.section;
|
|
5803
5879
|
const content = part.content;
|
|
@@ -5806,82 +5882,130 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
5806
5882
|
else if (actionHost && typeof actionHost.appendChild === "function") actionHost.appendChild(node);
|
|
5807
5883
|
else section.appendChild(node);
|
|
5808
5884
|
};
|
|
5885
|
+
|
|
5809
5886
|
if (!run) {
|
|
5810
|
-
content.appendChild(element(doc, "div", "hive-note hive-card-run-empty", translate("drawer.noRuns")));
|
|
5811
|
-
return section;
|
|
5812
|
-
}
|
|
5813
|
-
const started = formatRunStamp(run.startedAt);
|
|
5814
|
-
const ended = formatRunStamp(run.endedAt);
|
|
5815
|
-
const metaParts = [run.status, run.agent];
|
|
5816
|
-
if (started || ended) metaParts.push(started + (ended ? " → " + ended : ""));
|
|
5817
|
-
if (run.commit) metaParts.push(shortCommit(run.commit));
|
|
5818
|
-
const metaPartsText = metaParts.filter(Boolean).join(" · ");
|
|
5819
|
-
const meta = element(doc, "div", "hive-card-run-meta", metaPartsText);
|
|
5820
|
-
setAttr(meta, "title", metaPartsText);
|
|
5821
|
-
content.appendChild(meta);
|
|
5822
|
-
// Consensus announcements: the other agents that announced the same paths. Invalid
|
|
5823
|
-
// entries are dropped by normalizeLastRun, duplicates collapse to one name,
|
|
5824
|
-
// and no overlapping writer means no row at all.
|
|
5825
|
-
const writers = [];
|
|
5826
|
-
for (const overlap of run.overlaps) {
|
|
5827
|
-
const agent = asString(overlap.agent);
|
|
5828
|
-
if (agent !== "" && !writers.includes(agent)) writers.push(agent);
|
|
5829
|
-
}
|
|
5830
|
-
if (writers.length > 0) {
|
|
5831
|
-
const overlapsLabel = translate("drawer.runOverlaps");
|
|
5832
|
-
// The zh dictionary copy uses the full-width colon elsewhere in the panel.
|
|
5833
|
-
const separator = /[\u4e00-\u9fff]/.test(overlapsLabel) ? ":" : ": ";
|
|
5834
5887
|
content.appendChild(
|
|
5835
|
-
element(
|
|
5888
|
+
element(
|
|
5889
|
+
doc,
|
|
5890
|
+
"div",
|
|
5891
|
+
"hive-note hive-card-run-empty",
|
|
5892
|
+
claimed ? translate("drawer.claimedWaiting") : translate("drawer.noRuns"),
|
|
5893
|
+
),
|
|
5836
5894
|
);
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
const chat = element(doc, "button", "hive-btn hive-btn-ghost hive-card-run-open", translate("drawer.openChat"));
|
|
5871
|
-
setAttr(chat, "type", "button");
|
|
5872
|
-
setAttr(chat, "title", translate("drawer.openChat"));
|
|
5873
|
-
setAttr(chat, "aria-label", translate("drawer.openChat"));
|
|
5874
|
-
chat.addEventListener("click", () => {
|
|
5875
|
-
try {
|
|
5876
|
-
openSession(run.sessionId);
|
|
5877
|
-
} catch (error) {
|
|
5878
|
-
reportError(error);
|
|
5895
|
+
if (claimed) return section;
|
|
5896
|
+
}
|
|
5897
|
+
|
|
5898
|
+
if (run) {
|
|
5899
|
+
const appendMeta = (text) => {
|
|
5900
|
+
if (!text) return;
|
|
5901
|
+
const meta = element(doc, "div", "hive-section-meta", text);
|
|
5902
|
+
setAttr(meta, "title", text);
|
|
5903
|
+
content.appendChild(meta);
|
|
5904
|
+
};
|
|
5905
|
+
if (claimed) {
|
|
5906
|
+
const started = formatRunStamp(run.startedAt);
|
|
5907
|
+
const heartbeat = formatRunStamp(run.lastHeartbeat);
|
|
5908
|
+
const elapsed = durationBetween(run.startedAt, null);
|
|
5909
|
+
appendMeta(
|
|
5910
|
+
[
|
|
5911
|
+
run.agent ? translate("drawer.agent").replace("{agent}", run.agent) : "",
|
|
5912
|
+
started ? translate("drawer.startedAt").replace("{time}", started) : "",
|
|
5913
|
+
elapsed ? translate("drawer.elapsed").replace("{duration}", elapsed) : "",
|
|
5914
|
+
translate("drawer.lastHeartbeat").replace("{time}", heartbeat || "—"),
|
|
5915
|
+
]
|
|
5916
|
+
.filter(Boolean)
|
|
5917
|
+
.join(" · "),
|
|
5918
|
+
);
|
|
5919
|
+
if (Array.isArray(card.scope) && card.scope.length > 0) {
|
|
5920
|
+
const files = element(doc, "div", "hive-run-files");
|
|
5921
|
+
files.appendChild(element(doc, "span", "hive-run-field-label", translate("drawer.files")));
|
|
5922
|
+
for (const scope of card.scope) {
|
|
5923
|
+
const path = element(doc, "code", "hive-scope-path", asString(scope));
|
|
5924
|
+
setAttr(path, "title", asString(scope));
|
|
5925
|
+
files.appendChild(path);
|
|
5926
|
+
}
|
|
5927
|
+
content.appendChild(files);
|
|
5879
5928
|
}
|
|
5880
|
-
}
|
|
5881
|
-
|
|
5882
|
-
|
|
5929
|
+
} else {
|
|
5930
|
+
const duration = durationBetween(run.startedAt, run.endedAt);
|
|
5931
|
+
appendMeta(
|
|
5932
|
+
[
|
|
5933
|
+
translate("drawer.status").replace("{status}", laneLabel(run.status || lane)),
|
|
5934
|
+
duration ? translate("drawer.duration").replace("{duration}", duration) : "",
|
|
5935
|
+
run.commit ? translate("drawer.commit").replace("{commit}", shortCommit(run.commit)) : "",
|
|
5936
|
+
]
|
|
5937
|
+
.filter(Boolean)
|
|
5938
|
+
.join(" · "),
|
|
5939
|
+
);
|
|
5940
|
+
}
|
|
5941
|
+
|
|
5942
|
+
// Consensus announcements: the other agents that announced the same paths.
|
|
5943
|
+
const writers = [];
|
|
5944
|
+
for (const overlap of run.overlaps) {
|
|
5945
|
+
const agent = asString(overlap.agent);
|
|
5946
|
+
if (agent !== "" && !writers.includes(agent)) writers.push(agent);
|
|
5947
|
+
}
|
|
5948
|
+
if (writers.length > 0) {
|
|
5949
|
+
const overlapsLabel = translate("drawer.runOverlaps");
|
|
5950
|
+
const separator = /[\u4e00-\u9fff]/.test(overlapsLabel) ? ":" : ": ";
|
|
5951
|
+
appendMeta(overlapsLabel + separator + writers.join(", "));
|
|
5952
|
+
}
|
|
5953
|
+
|
|
5954
|
+
const outputText = asString(run.output);
|
|
5955
|
+
if (claimed) {
|
|
5956
|
+
content.appendChild(
|
|
5957
|
+
element(doc, "div", "hive-run-field-label", translate("drawer.outputTail")),
|
|
5958
|
+
);
|
|
5959
|
+
}
|
|
5960
|
+
const output = element(doc, "div", "hive-card-run-output hive-markdown");
|
|
5961
|
+
const shownOutput = claimed ? outputText.split("\n").slice(-30).join("\n") : outputText;
|
|
5962
|
+
if (shownOutput.trim() === "") {
|
|
5963
|
+
output.appendChild(element(doc, "div", "hive-markdown-empty", translate("drawer.noOutput")));
|
|
5964
|
+
} else {
|
|
5965
|
+
renderMarkdownInto(doc, output, shownOutput);
|
|
5966
|
+
}
|
|
5967
|
+
content.appendChild(output);
|
|
5968
|
+
|
|
5969
|
+
if (lane === "failed") {
|
|
5970
|
+
const reason = asString(run.reason) || asString(card.reason);
|
|
5971
|
+
if (reason) {
|
|
5972
|
+
const failure = element(doc, "div", "hive-run-failure");
|
|
5973
|
+
failure.appendChild(element(doc, "div", "hive-run-field-label", translate("drawer.failureReason")));
|
|
5974
|
+
failure.appendChild(element(doc, "div", "hive-run-failure-text", reason));
|
|
5975
|
+
content.appendChild(failure);
|
|
5976
|
+
}
|
|
5977
|
+
}
|
|
5978
|
+
|
|
5979
|
+
const foot = element(doc, "div", "hive-card-run-foot");
|
|
5980
|
+
if (outputText.trim() !== "") {
|
|
5981
|
+
const copy = element(doc, "button", "hive-btn hive-btn-ghost hive-card-run-copy", translate("drawer.copyOutput"));
|
|
5982
|
+
setAttr(copy, "type", "button");
|
|
5983
|
+
setAttr(copy, "title", translate("drawer.copyOutput"));
|
|
5984
|
+
setAttr(copy, "aria-label", translate("drawer.copyOutput"));
|
|
5985
|
+
copy.addEventListener("click", () => {
|
|
5986
|
+
copyToClipboard(doc, run.output);
|
|
5987
|
+
});
|
|
5988
|
+
if (Array.isArray(actionHost) || actionHost) addAction(copy);
|
|
5989
|
+
else foot.appendChild(copy);
|
|
5990
|
+
}
|
|
5991
|
+
const canOpenChat = asString(run.sessionId) !== "" && typeof openSession === "function";
|
|
5992
|
+
if (canOpenChat) {
|
|
5993
|
+
const chat = element(doc, "button", "hive-btn hive-btn-ghost hive-card-run-open", translate("drawer.openChat"));
|
|
5994
|
+
setAttr(chat, "type", "button");
|
|
5995
|
+
setAttr(chat, "title", translate("drawer.openChat"));
|
|
5996
|
+
setAttr(chat, "aria-label", translate("drawer.openChat"));
|
|
5997
|
+
chat.addEventListener("click", () => {
|
|
5998
|
+
try {
|
|
5999
|
+
openSession(run.sessionId);
|
|
6000
|
+
} catch (error) {
|
|
6001
|
+
reportError(error);
|
|
6002
|
+
}
|
|
6003
|
+
});
|
|
6004
|
+
if (Array.isArray(actionHost) || actionHost) addAction(chat);
|
|
6005
|
+
else foot.appendChild(chat);
|
|
6006
|
+
}
|
|
6007
|
+
if (!actionHost && foot.children.length > 0) section.appendChild(foot);
|
|
5883
6008
|
}
|
|
5884
|
-
if (!actionHost) section.appendChild(foot);
|
|
5885
6009
|
return section;
|
|
5886
6010
|
}
|
|
5887
6011
|
|
|
@@ -5903,6 +6027,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
5903
6027
|
|
|
5904
6028
|
const part = createSection({
|
|
5905
6029
|
title: translate("drawer.dependenciesTitle"),
|
|
6030
|
+
hint: translate("drawer.dependenciesHint"),
|
|
5906
6031
|
className: "hive-deps",
|
|
5907
6032
|
});
|
|
5908
6033
|
const block = part.section;
|
|
@@ -5942,6 +6067,73 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
5942
6067
|
if (content.children.length > 0) body.appendChild(block);
|
|
5943
6068
|
}
|
|
5944
6069
|
|
|
6070
|
+
function renderExperience(card, body) {
|
|
6071
|
+
const experience = card.experience;
|
|
6072
|
+
if (!experience) return;
|
|
6073
|
+
const readCount = experience.read.count;
|
|
6074
|
+
const writtenCount = experience.written.count;
|
|
6075
|
+
if (readCount === 0 && writtenCount === 0) return;
|
|
6076
|
+
const part = createSection({
|
|
6077
|
+
title: translate("drawer.experienceTitle"),
|
|
6078
|
+
hint: translate("drawer.experienceHint"),
|
|
6079
|
+
className: "hive-experience",
|
|
6080
|
+
});
|
|
6081
|
+
if (readCount > 0) {
|
|
6082
|
+
part.content.appendChild(
|
|
6083
|
+
element(
|
|
6084
|
+
doc,
|
|
6085
|
+
"div",
|
|
6086
|
+
"hive-exp-count",
|
|
6087
|
+
translate("drawer.experienceRead").replace("{count}", String(readCount)),
|
|
6088
|
+
),
|
|
6089
|
+
);
|
|
6090
|
+
}
|
|
6091
|
+
if (writtenCount > 0) {
|
|
6092
|
+
part.content.appendChild(
|
|
6093
|
+
element(
|
|
6094
|
+
doc,
|
|
6095
|
+
"div",
|
|
6096
|
+
"hive-exp-count",
|
|
6097
|
+
translate("drawer.experienceWritten").replace("{count}", String(writtenCount)),
|
|
6098
|
+
),
|
|
6099
|
+
);
|
|
6100
|
+
}
|
|
6101
|
+
const items = [
|
|
6102
|
+
...experience.read.items.map((item) => ({ ...item, side: "read" })),
|
|
6103
|
+
...experience.written.items.map((item) => ({ ...item, side: "written" })),
|
|
6104
|
+
];
|
|
6105
|
+
if (items.length > 0) {
|
|
6106
|
+
const list = element(doc, "div", "hive-exp-list");
|
|
6107
|
+
const appendItem = (item) => {
|
|
6108
|
+
const row = element(doc, "div", "hive-exp-item");
|
|
6109
|
+
if (item.scope) row.appendChild(element(doc, "code", "hive-exp-scope", item.scope));
|
|
6110
|
+
if (item.text) row.appendChild(element(doc, "span", "hive-exp-text", item.text));
|
|
6111
|
+
list.appendChild(row);
|
|
6112
|
+
};
|
|
6113
|
+
for (const item of items.slice(0, 3)) appendItem(item);
|
|
6114
|
+
const hidden = items.slice(3);
|
|
6115
|
+
if (hidden.length > 0) {
|
|
6116
|
+
const more = element(
|
|
6117
|
+
doc,
|
|
6118
|
+
"button",
|
|
6119
|
+
"hive-btn hive-btn-ghost hive-exp-more",
|
|
6120
|
+
translate("drawer.experienceMore").replace("{count}", String(hidden.length)),
|
|
6121
|
+
);
|
|
6122
|
+
setAttr(more, "type", "button");
|
|
6123
|
+
const moreLabel = translate("drawer.experienceMore").replace("{count}", String(hidden.length));
|
|
6124
|
+
setAttr(more, "title", moreLabel);
|
|
6125
|
+
setAttr(more, "aria-label", moreLabel);
|
|
6126
|
+
more.addEventListener("click", () => {
|
|
6127
|
+
for (const item of hidden) appendItem(item);
|
|
6128
|
+
more.parentNode.removeChild(more);
|
|
6129
|
+
});
|
|
6130
|
+
list.appendChild(more);
|
|
6131
|
+
}
|
|
6132
|
+
part.content.appendChild(list);
|
|
6133
|
+
}
|
|
6134
|
+
body.appendChild(part.section);
|
|
6135
|
+
}
|
|
6136
|
+
|
|
5945
6137
|
function openDrawer(card, lane, trigger) {
|
|
5946
6138
|
closeHelp(false);
|
|
5947
6139
|
closePlanDialog(false);
|
|
@@ -6019,8 +6211,10 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
6019
6211
|
}
|
|
6020
6212
|
|
|
6021
6213
|
renderDependencies(card, body);
|
|
6214
|
+
renderExperience(card, body);
|
|
6022
6215
|
const runActions = [];
|
|
6023
|
-
|
|
6216
|
+
const runSection = buildRunSection(card, lane, runActions);
|
|
6217
|
+
if (runSection) body.appendChild(runSection);
|
|
6024
6218
|
dialog.appendChild(body);
|
|
6025
6219
|
|
|
6026
6220
|
const actions = actionsForState(lane, lastModel ? lastModel.writable : false);
|
|
@@ -6649,6 +6843,19 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
6649
6843
|
return translate(key).replace("{count}", String(count));
|
|
6650
6844
|
}
|
|
6651
6845
|
|
|
6846
|
+
function durationBetween(start, end) {
|
|
6847
|
+
const from = parseDate(start);
|
|
6848
|
+
if (!from) return "";
|
|
6849
|
+
const to = parseDate(end) || new Date();
|
|
6850
|
+
const seconds = Math.max(0, Math.floor((to.getTime() - from.getTime()) / 1000));
|
|
6851
|
+
if (seconds < 60) return translate("stats.duration.justNow");
|
|
6852
|
+
const minutes = Math.floor(seconds / 60);
|
|
6853
|
+
if (minutes < 60) return durationLabel(minutes, "stats.duration.minute", "stats.duration.minutes");
|
|
6854
|
+
const hours = Math.floor(minutes / 60);
|
|
6855
|
+
if (hours < 24) return durationLabel(hours, "stats.duration.hour", "stats.duration.hours");
|
|
6856
|
+
return durationLabel(Math.floor(hours / 24), "stats.duration.day", "stats.duration.days");
|
|
6857
|
+
}
|
|
6858
|
+
|
|
6652
6859
|
function elapsedLabel(createdAt) {
|
|
6653
6860
|
const date = parseDate(createdAt);
|
|
6654
6861
|
if (!date) return "";
|