@d86e/hive-panel 1.0.28 → 1.0.30
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 -42
- package/public/panel.js +116 -390
- package/src/cache.js +49 -24
- package/src/data.js +67 -19
- package/src/event-store.js +41 -15
- package/src/server.js +23 -2
package/public/panel.js
CHANGED
|
@@ -325,7 +325,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
325
325
|
min-height: 0;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
.hive-agents-strip {
|
|
329
328
|
display: flex;
|
|
330
329
|
flex: 0 0 auto;
|
|
331
330
|
flex-wrap: wrap;
|
|
@@ -345,9 +344,7 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
345
344
|
text-transform: uppercase;
|
|
346
345
|
}
|
|
347
346
|
|
|
348
|
-
.hive-agents-strip .hive-count { margin-left: 0; }
|
|
349
347
|
|
|
350
|
-
.hive-agent-pills {
|
|
351
348
|
display: flex;
|
|
352
349
|
flex: 1 1 auto;
|
|
353
350
|
flex-wrap: wrap;
|
|
@@ -355,7 +352,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
355
352
|
min-width: 0;
|
|
356
353
|
}
|
|
357
354
|
|
|
358
|
-
.hive-agent-pill {
|
|
359
355
|
display: inline-flex;
|
|
360
356
|
align-items: center;
|
|
361
357
|
gap: 6px;
|
|
@@ -371,17 +367,14 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
371
367
|
cursor: pointer;
|
|
372
368
|
}
|
|
373
369
|
|
|
374
|
-
.hive-agent-pill:hover {
|
|
375
370
|
border-color: color-mix(in srgb, var(--hive-accent) 50%, var(--hive-line));
|
|
376
371
|
background: var(--hive-surface-hover);
|
|
377
372
|
}
|
|
378
373
|
|
|
379
|
-
.hive-agent-pill:focus-visible {
|
|
380
374
|
outline: 2px solid var(--hive-accent);
|
|
381
375
|
outline-offset: 1px;
|
|
382
376
|
}
|
|
383
377
|
|
|
384
|
-
.hive-agent-pill-name {
|
|
385
378
|
max-width: 150px;
|
|
386
379
|
overflow: hidden;
|
|
387
380
|
font-weight: 600;
|
|
@@ -389,12 +382,10 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
389
382
|
white-space: nowrap;
|
|
390
383
|
}
|
|
391
384
|
|
|
392
|
-
.hive-agent-pill .hive-dot {
|
|
393
385
|
width: 6px;
|
|
394
386
|
height: 6px;
|
|
395
387
|
}
|
|
396
388
|
|
|
397
|
-
.hive-agent-pill-task {
|
|
398
389
|
max-width: 160px;
|
|
399
390
|
overflow: hidden;
|
|
400
391
|
color: var(--hive-fg-soft);
|
|
@@ -404,12 +395,10 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
404
395
|
white-space: nowrap;
|
|
405
396
|
}
|
|
406
397
|
|
|
407
|
-
.hive-agents-empty {
|
|
408
398
|
color: var(--hive-fg-faint);
|
|
409
399
|
font-size: 12px;
|
|
410
400
|
}
|
|
411
401
|
|
|
412
|
-
.hive-agents-error {
|
|
413
402
|
min-width: 0;
|
|
414
403
|
overflow-wrap: anywhere;
|
|
415
404
|
color: var(--hive-danger);
|
|
@@ -622,7 +611,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
622
611
|
|
|
623
612
|
.hive.is-uninitialised .hive-init-pane { display: flex; }
|
|
624
613
|
|
|
625
|
-
.hive.is-uninitialised .hive-agents-strip,
|
|
626
614
|
.hive.is-uninitialised .hive-board,
|
|
627
615
|
.hive.is-uninitialised .hive-events-drawer,
|
|
628
616
|
.hive.is-uninitialised .hive-freeze-slot,
|
|
@@ -1199,7 +1187,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1199
1187
|
.hive-main { gap: 8px; }
|
|
1200
1188
|
.hive-supervisor { padding: 10px 16px; }
|
|
1201
1189
|
.hive-freeze-banner { padding: 10px 16px; }
|
|
1202
|
-
.hive-agents-strip { padding: 10px 16px; }
|
|
1203
1190
|
.hive-stage-chips { padding: 10px 16px 0; }
|
|
1204
1191
|
.hive-lanes { gap: 10px; padding: 12px 16px; }
|
|
1205
1192
|
.hive-lane-cards { gap: 9px; }
|
|
@@ -1227,7 +1214,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1227
1214
|
|
|
1228
1215
|
.hive-empty,
|
|
1229
1216
|
.hive-filter-empty,
|
|
1230
|
-
.hive-agents-empty {
|
|
1231
1217
|
padding: 12px 14px;
|
|
1232
1218
|
border: 1px solid var(--hive-line);
|
|
1233
1219
|
border-radius: var(--hive-radius-md);
|
|
@@ -1306,7 +1292,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1306
1292
|
.hive-supervisor,
|
|
1307
1293
|
.hive-freeze-banner,
|
|
1308
1294
|
.hive-queen-hint,
|
|
1309
|
-
.hive-agents-strip,
|
|
1310
1295
|
.hive-events-toggle,
|
|
1311
1296
|
.hive-dialog-head,
|
|
1312
1297
|
.hive-dialog-body,
|
|
@@ -1536,7 +1521,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1536
1521
|
.hive-settings-form-actions .hive-btn,
|
|
1537
1522
|
.hive-settings-tab,
|
|
1538
1523
|
.hive-stage-chip,
|
|
1539
|
-
.hive-agent-pill,
|
|
1540
1524
|
.hive-events-toggle,
|
|
1541
1525
|
.hive-supervisor-resume,
|
|
1542
1526
|
.hive-queen-takeover,
|
|
@@ -1561,7 +1545,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1561
1545
|
.hive-plan-error,
|
|
1562
1546
|
.hive-init-description,
|
|
1563
1547
|
.hive-queen-text,
|
|
1564
|
-
.hive-agent-empty,
|
|
1565
1548
|
.hive-card-meta,
|
|
1566
1549
|
.hive-card-reason,
|
|
1567
1550
|
.hive-card-scope,
|
|
@@ -1620,7 +1603,6 @@ const PANEL_STYLES = `.hive { position: relative; }
|
|
|
1620
1603
|
.hive-bar { background: var(--hive-bg-layer-1); border-bottom-color: var(--hive-line); gap: 8px; }
|
|
1621
1604
|
.hive-main,
|
|
1622
1605
|
.hive-board { background: var(--hive-bg); }
|
|
1623
|
-
.hive-agents,
|
|
1624
1606
|
.hive-events { background: var(--hive-bg-layer-1); border-color: var(--hive-line); }
|
|
1625
1607
|
.hive-lane { background: var(--hive-bg-layer-1); border-color: var(--hive-line); border-radius: var(--hive-radius-md); }
|
|
1626
1608
|
.hive-card { background: var(--hive-bg-layer-1); border: 1px solid var(--hive-line); border-radius: var(--hive-radius-md); box-shadow: none; }
|
|
@@ -1968,24 +1950,7 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1968
1950
|
text-overflow: ellipsis;
|
|
1969
1951
|
white-space: nowrap;
|
|
1970
1952
|
}
|
|
1971
|
-
.hive-agent-count { font: inherit; cursor: pointer; }
|
|
1972
|
-
.hive-agent-count:disabled { cursor: default; }
|
|
1973
1953
|
/* Agents dialog */
|
|
1974
|
-
.hive-agents-dialog { width: min(560px, 92vw); max-height: 80vh; }
|
|
1975
|
-
.hive-agents-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
|
|
1976
|
-
.hive-agents-empty-note { padding: 10px 0; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; }
|
|
1977
|
-
.hive-agent-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
1978
|
-
.hive-agent-row-main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
|
|
1979
|
-
.hive-agent-row-name { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1980
|
-
.hive-agent-row-task { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1981
|
-
.hive-agent-row-meta { color: var(--hive-fg-faint); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1982
|
-
.hive-agents-workers-title { padding-top: 4px; color: var(--hive-fg); font-size: 14px; font-weight: 700; line-height: 1.5; }
|
|
1983
|
-
.hive-agent-worker-row { padding: 8px 0; border-bottom: 1px solid var(--hive-line-2); }
|
|
1984
|
-
.hive-agent-worker-task { color: var(--hive-fg); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1985
|
-
.hive-agent-worker-meta { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1986
|
-
.hive-agents-technical { border-top: 1px solid var(--hive-line-2); padding-top: 8px; }
|
|
1987
|
-
.hive-agents-technical-summary { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; cursor: pointer; }
|
|
1988
|
-
.hive-agents-technical-json { max-height: 220px; margin-top: 8px; }
|
|
1989
1954
|
.hive-supervisor-inline-sep { color: var(--hive-fg-faint); }
|
|
1990
1955
|
.hive-supervisor-inline-state.is-normal::before { background: var(--hive-ok); }
|
|
1991
1956
|
.hive-supervisor-inline-state.is-paused::before { background: var(--hive-warn); }
|
|
@@ -2093,22 +2058,6 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2093
2058
|
.hive-lane-cards { min-height: 480px; max-height: none; }
|
|
2094
2059
|
.hive-skeleton { grid-template-columns: 1fr; min-height: 0; }
|
|
2095
2060
|
}
|
|
2096
|
-
/* Task search and per-lane pagination controls. */
|
|
2097
|
-
.hive-search { flex: 0 0 auto; padding: 8px 10px 0; }
|
|
2098
|
-
.hive-search-input { box-sizing: border-box; width: 100%; padding: 5px 8px; border: 1px solid var(--hive-line); border-radius: var(--hive-radius-sm); background: var(--hive-bg-layer-1); color: var(--hive-fg); font: inherit; font-size: 12px; }
|
|
2099
|
-
.hive-search-input:focus { outline: 1px solid var(--hive-selected); outline-offset: 0; }
|
|
2100
|
-
.hive-search-results { margin-top: 6px; padding: 6px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); }
|
|
2101
|
-
.hive-search-results.is-hidden { display: none; }
|
|
2102
|
-
.hive-search-summary, .hive-search-empty { color: var(--hive-fg-faint); font-size: 11px; line-height: 1.5; }
|
|
2103
|
-
.hive-search-result { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 6px; border: 0; background: transparent; color: var(--hive-fg); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
|
|
2104
|
-
.hive-search-result:hover { background: var(--hive-hover); }
|
|
2105
|
-
.hive-search-status { flex: 0 0 auto; font-size: 10px; }
|
|
2106
|
-
.hive-search-status.is-done { color: var(--hive-ok); }
|
|
2107
|
-
.hive-search-status.is-failed { color: var(--hive-danger); }
|
|
2108
|
-
.hive-search-status.is-claimed { color: var(--hive-accent); }
|
|
2109
|
-
.hive-search-status.is-pending { color: var(--hive-fg-faint); }
|
|
2110
|
-
.hive-search-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2111
|
-
.hive-search-id { flex: 0 0 auto; color: var(--hive-fg-faint); font-family: var(--hive-mono); font-size: 10.5px; }
|
|
2112
2061
|
.hive-lane-paging { flex: 0 0 auto; padding: 0 7px 7px; }
|
|
2113
2062
|
.hive-lane-more { width: 100%; padding: 3px 6px; font-size: 11px; }
|
|
2114
2063
|
.hive-lane-page-error { margin-top: 4px; color: var(--hive-danger); font-size: 10.5px; line-height: 1.4; overflow-wrap: anywhere; }
|
|
@@ -2214,7 +2163,6 @@ export const messages = Object.freeze({
|
|
|
2214
2163
|
"action.remove": "Delete task",
|
|
2215
2164
|
"action.retry": "retry",
|
|
2216
2165
|
"action.unfreeze": "Resume",
|
|
2217
|
-
"pane.agents": "agents",
|
|
2218
2166
|
"pane.board": "Task board",
|
|
2219
2167
|
"pane.events": "events",
|
|
2220
2168
|
"board.filtersAria": "Filter by state",
|
|
@@ -2244,10 +2192,6 @@ export const messages = Object.freeze({
|
|
|
2244
2192
|
"board.loading": "Loading…",
|
|
2245
2193
|
"board.loadFailed": "Could not load more",
|
|
2246
2194
|
"board.retry": "Retry",
|
|
2247
|
-
"board.searchPlaceholder": "Search task id or title",
|
|
2248
|
-
"board.searchAria": "Search tasks by id or title",
|
|
2249
|
-
"board.searchEmpty": "No matching tasks",
|
|
2250
|
-
"board.searchResults": "{count} matching tasks",
|
|
2251
2195
|
"board.all": "all",
|
|
2252
2196
|
"board.showAll": "Show all tasks",
|
|
2253
2197
|
"board.filterChip": "Show {lane} tasks ({count})",
|
|
@@ -2283,21 +2227,6 @@ export const messages = Object.freeze({
|
|
|
2283
2227
|
"loading.events": "Loading…",
|
|
2284
2228
|
"loading.retryAria": "Retry loading the board",
|
|
2285
2229
|
"loading.aria": "Loading the board",
|
|
2286
|
-
"agents.openAria": "Open agent",
|
|
2287
|
-
"agents.runningTooltip": "Running {running} / board identities {identities}",
|
|
2288
|
-
"agents.fallbackTooltip": "Board identities {identities} (supervisor disconnected or repository not registered)",
|
|
2289
|
-
"agents.modalEmpty": "No agents.",
|
|
2290
|
-
"agents.fileCount": "{count} files",
|
|
2291
|
-
"agents.workersTitle": "Active work units",
|
|
2292
|
-
"agents.workerStarted": "Started {time}",
|
|
2293
|
-
"agents.workerElapsed": "Running for {duration}",
|
|
2294
|
-
"agents.technical": "Technical details",
|
|
2295
|
-
"agents.waitingReclaim": "Waiting to reclaim {count}",
|
|
2296
|
-
"agents.waitingReclaimTooltip": "{count} tasks are claimed but no agent is running (waiting to be reclaimed after a process restart)",
|
|
2297
|
-
"agent.idle": "idle",
|
|
2298
|
-
"agent.task": "task",
|
|
2299
|
-
"agent.unknown": "unknown",
|
|
2300
|
-
"agent.seen": "seen",
|
|
2301
2230
|
"card.untitled": "(untitled)",
|
|
2302
2231
|
"card.noId": "no id",
|
|
2303
2232
|
"card.openAria": "Open task",
|
|
@@ -2353,6 +2282,8 @@ export const messages = Object.freeze({
|
|
|
2353
2282
|
"events.actor.legacy": "Agent",
|
|
2354
2283
|
"events.recycled": "Recycled {count} older events",
|
|
2355
2284
|
"events.loadFailed": "Could not load events",
|
|
2285
|
+
"events.missed": "Event stream gap",
|
|
2286
|
+
"events.missedReloaded": "Reloaded the latest events.",
|
|
2356
2287
|
"events.pageFailed": "Older events failed to load",
|
|
2357
2288
|
"events.retry": "Retry",
|
|
2358
2289
|
"events.details": "Details",
|
|
@@ -2603,7 +2534,6 @@ export const messages = Object.freeze({
|
|
|
2603
2534
|
"action.remove": "删除任务",
|
|
2604
2535
|
"action.retry": "重试",
|
|
2605
2536
|
"action.unfreeze": "恢复",
|
|
2606
|
-
"pane.agents": "智能体",
|
|
2607
2537
|
"pane.board": "任务看板",
|
|
2608
2538
|
"pane.events": "事件",
|
|
2609
2539
|
"board.filtersAria": "按状态筛选",
|
|
@@ -2633,10 +2563,6 @@ export const messages = Object.freeze({
|
|
|
2633
2563
|
"board.loading": "加载中…",
|
|
2634
2564
|
"board.loadFailed": "加载失败",
|
|
2635
2565
|
"board.retry": "重试",
|
|
2636
|
-
"board.searchPlaceholder": "搜索任务 ID 或标题",
|
|
2637
|
-
"board.searchAria": "按 ID 或标题搜索任务",
|
|
2638
|
-
"board.searchEmpty": "没有匹配任务",
|
|
2639
|
-
"board.searchResults": "{count} 个匹配任务",
|
|
2640
2566
|
"board.all": "全部",
|
|
2641
2567
|
"board.showAll": "显示全部任务",
|
|
2642
2568
|
"board.filterChip": "只看{lane}任务({count})",
|
|
@@ -2672,21 +2598,6 @@ export const messages = Object.freeze({
|
|
|
2672
2598
|
"loading.events": "加载中…",
|
|
2673
2599
|
"loading.retryAria": "重试读取看板",
|
|
2674
2600
|
"loading.aria": "正在读取看板",
|
|
2675
|
-
"agents.openAria": "打开智能体",
|
|
2676
|
-
"agents.runningTooltip": "运行中 {running} / 公告板身份 {identities}",
|
|
2677
|
-
"agents.fallbackTooltip": "公告板身份 {identities}(监督器未连接或未注册该仓库)",
|
|
2678
|
-
"agents.modalEmpty": "暂无智能体。",
|
|
2679
|
-
"agents.fileCount": "{count} 个文件",
|
|
2680
|
-
"agents.workersTitle": "运行中的工作单元",
|
|
2681
|
-
"agents.workerStarted": "开始于 {time}",
|
|
2682
|
-
"agents.workerElapsed": "已运行 {duration}",
|
|
2683
|
-
"agents.technical": "技术详情",
|
|
2684
|
-
"agents.waitingReclaim": "等待回收 {count}",
|
|
2685
|
-
"agents.waitingReclaimTooltip": "有 {count} 个任务被认领但当前没有运行中的工作单元(进程重启后等待回收)",
|
|
2686
|
-
"agent.idle": "空闲",
|
|
2687
|
-
"agent.task": "任务",
|
|
2688
|
-
"agent.unknown": "未知",
|
|
2689
|
-
"agent.seen": "上次活跃",
|
|
2690
2601
|
"card.untitled": "(无标题)",
|
|
2691
2602
|
"card.noId": "无 ID",
|
|
2692
2603
|
"card.openAria": "打开任务",
|
|
@@ -2742,6 +2653,8 @@ export const messages = Object.freeze({
|
|
|
2742
2653
|
"events.actor.legacy": "智能体",
|
|
2743
2654
|
"events.recycled": "已回收更早的 {count} 条",
|
|
2744
2655
|
"events.loadFailed": "事件加载失败",
|
|
2656
|
+
"events.missed": "事件流存在缺口",
|
|
2657
|
+
"events.missedReloaded": "已重新加载最新事件。",
|
|
2745
2658
|
"events.pageFailed": "更早的事件加载失败",
|
|
2746
2659
|
"events.retry": "重试",
|
|
2747
2660
|
"events.details": "详情",
|
|
@@ -3248,22 +3161,6 @@ function normalizeStats(stats, tasks) {
|
|
|
3248
3161
|
return { total, byState, byRole, oldestPending };
|
|
3249
3162
|
}
|
|
3250
3163
|
|
|
3251
|
-
function normalizeAgents(board) {
|
|
3252
|
-
const agents = [];
|
|
3253
|
-
for (const rawEntry of asArray(board)) {
|
|
3254
|
-
const entry = isRecord(rawEntry) && isRecord(rawEntry.value) ? rawEntry.value : rawEntry;
|
|
3255
|
-
if (!isRecord(entry)) continue;
|
|
3256
|
-
agents.push({
|
|
3257
|
-
agent: asString(entry.agent || entry.key || entry.name),
|
|
3258
|
-
state: asString(entry.state),
|
|
3259
|
-
task: asString(entry.task),
|
|
3260
|
-
files: asArray(entry.files).map((file) => asString(file)).filter(Boolean),
|
|
3261
|
-
updatedAt: asString(entry.updatedAt),
|
|
3262
|
-
});
|
|
3263
|
-
}
|
|
3264
|
-
return agents;
|
|
3265
|
-
}
|
|
3266
|
-
|
|
3267
3164
|
function normalizeEventKinds(value) {
|
|
3268
3165
|
const rows = [];
|
|
3269
3166
|
for (const entry of asArray(value)) {
|
|
@@ -3289,6 +3186,7 @@ function normalizeEvents(events) {
|
|
|
3289
3186
|
kind: asString(event.kind),
|
|
3290
3187
|
task: asString(event.task),
|
|
3291
3188
|
actor: asString(event.actor),
|
|
3189
|
+
key: asString(event.key),
|
|
3292
3190
|
raw: event,
|
|
3293
3191
|
}));
|
|
3294
3192
|
}
|
|
@@ -3325,8 +3223,6 @@ function toolbarActions(writable, mode) {
|
|
|
3325
3223
|
* lanes: Record<string, Array<{id:string,title:string,role:string,owner:string,scope:string[],reason:string}>>,
|
|
3326
3224
|
* laneOrder: string[],
|
|
3327
3225
|
* stats: {total:number, byState:Record<string,number>, byRole:Record<string,number>, oldestPending:{id:string,createdAt:string}|null},
|
|
3328
|
-
* agents: Array<{agent:string,state:string,task:string,files:string[],updatedAt:string}>,
|
|
3329
|
-
* boardError: string|null,
|
|
3330
3226
|
* events: Array<{ts:string,kind:string,task:string,actor:string}>,
|
|
3331
3227
|
* actions: Array<{name:string,labelKey:string,body?:object}>
|
|
3332
3228
|
* }}
|
|
@@ -3405,6 +3301,7 @@ export function renderModel(snapshot) {
|
|
|
3405
3301
|
prompt: typeof entry.prompt === "string" ? entry.prompt : null,
|
|
3406
3302
|
promptExists: entry.promptExists === true,
|
|
3407
3303
|
limit: typeof entry.limit === "number" && Number.isFinite(entry.limit) ? entry.limit : null,
|
|
3304
|
+
source: normalizeLimitSource(entry.source || entry.limitSource || entry.limit_source),
|
|
3408
3305
|
}))
|
|
3409
3306
|
.filter((entry) => entry.name)
|
|
3410
3307
|
: [],
|
|
@@ -3418,7 +3315,7 @@ export function renderModel(snapshot) {
|
|
|
3418
3315
|
const rows = lanes[state];
|
|
3419
3316
|
const raw = rawLanePages && isRecord(rawLanePages[state]) ? rawLanePages[state] : null;
|
|
3420
3317
|
const total = raw ? asCount(raw.total, rows.length) : rows.length;
|
|
3421
|
-
const cursor = raw ?
|
|
3318
|
+
const cursor = raw && raw.cursor !== undefined && raw.cursor !== null ? String(raw.cursor) : "";
|
|
3422
3319
|
lanePages[state] = {
|
|
3423
3320
|
loaded: rows.length,
|
|
3424
3321
|
total,
|
|
@@ -3440,10 +3337,8 @@ export function renderModel(snapshot) {
|
|
|
3440
3337
|
lanePages,
|
|
3441
3338
|
taskList: tasks.map(normalizeCard),
|
|
3442
3339
|
stats: normalizeStats(source.stats, tasks),
|
|
3443
|
-
agents: normalizeAgents(source.board),
|
|
3444
3340
|
// A board read that failed is not the same as an idle swarm: keep the
|
|
3445
3341
|
// diagnostic so the agents strip can show it instead of "no agents".
|
|
3446
|
-
boardError: asString(source.boardError) || null,
|
|
3447
3342
|
events: normalizeEvents(source.events),
|
|
3448
3343
|
eventTotal: asCount(source.eventTotal, normalizeEvents(source.events).length),
|
|
3449
3344
|
eventKinds: normalizeEventKinds(source.eventKinds),
|
|
@@ -3469,13 +3364,21 @@ function supervisorNumber(value) {
|
|
|
3469
3364
|
return null;
|
|
3470
3365
|
}
|
|
3471
3366
|
|
|
3367
|
+
function normalizeLimitSource(value) {
|
|
3368
|
+
const text = asString(value).trim().toLowerCase();
|
|
3369
|
+
if (text === "limits" || text === "limits.json") return "limits";
|
|
3370
|
+
if (text === "config") return "config";
|
|
3371
|
+
if (text === "default") return "default";
|
|
3372
|
+
return null;
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3472
3375
|
function normalizeSupervisorRoles(source) {
|
|
3473
3376
|
if (!isRecord(source)) return [];
|
|
3474
3377
|
const rows = new Map();
|
|
3475
3378
|
const ensure = (role) => {
|
|
3476
3379
|
const name = asString(role).trim();
|
|
3477
3380
|
if (!name) return null;
|
|
3478
|
-
if (!rows.has(name)) rows.set(name, { role: name, limit: null, live: null, inFlight: null, queued: null });
|
|
3381
|
+
if (!rows.has(name)) rows.set(name, { role: name, limit: null, live: null, inFlight: null, queued: null, source: null });
|
|
3479
3382
|
return rows.get(name);
|
|
3480
3383
|
};
|
|
3481
3384
|
const setLimit = (role, value) => {
|
|
@@ -3497,6 +3400,8 @@ function normalizeSupervisorRoles(source) {
|
|
|
3497
3400
|
const role = asString(raw.role || raw.name || raw.key || raw.id || fallbackRole);
|
|
3498
3401
|
const row = ensure(role);
|
|
3499
3402
|
if (!row) return;
|
|
3403
|
+
const declaredSource = normalizeLimitSource(raw.source || raw.limitSource || raw.limit_source);
|
|
3404
|
+
if (declaredSource !== null) row.source = declaredSource;
|
|
3500
3405
|
for (const field of ["limit", "max", "concurrency", "concurrencyLimit", "maxConcurrency", "max_concurrency", "concurrency_limit", "maxInFlight", "max_in_flight", "cap", "capacity", "value", "n"]) {
|
|
3501
3406
|
if (supervisorNumber(raw[field]) !== null) {
|
|
3502
3407
|
row.limit = supervisorNumber(raw[field]);
|
|
@@ -4333,13 +4238,6 @@ export function mount(root, options = {}) {
|
|
|
4333
4238
|
const statsNode = element(doc, "div", "hive-stats");
|
|
4334
4239
|
bar.appendChild(statsNode);
|
|
4335
4240
|
|
|
4336
|
-
const agentsCount = element(doc, "button", "hive-stat hive-agent-count");
|
|
4337
|
-
setAttr(agentsCount, "type", "button");
|
|
4338
|
-
agentsCount.addEventListener("click", () => {
|
|
4339
|
-
openAgentsDialog();
|
|
4340
|
-
});
|
|
4341
|
-
bar.appendChild(agentsCount);
|
|
4342
|
-
|
|
4343
4241
|
const queenBadge = element(doc, "span", "hive-queen-badge is-hidden", "");
|
|
4344
4242
|
bar.appendChild(queenBadge);
|
|
4345
4243
|
|
|
@@ -4456,21 +4354,6 @@ export function mount(root, options = {}) {
|
|
|
4456
4354
|
const stage = element(doc, "div", "hive-stage");
|
|
4457
4355
|
const stageChips = element(doc, "div", "hive-stage-chips");
|
|
4458
4356
|
setAttr(stageChips, "aria-label", translate("board.filtersAria"));
|
|
4459
|
-
const searchBox = element(doc, "div", "hive-search");
|
|
4460
|
-
const searchInput = element(doc, "input", "hive-search-input");
|
|
4461
|
-
setAttr(searchInput, "type", "search");
|
|
4462
|
-
setAttr(searchInput, "placeholder", translate("board.searchPlaceholder"));
|
|
4463
|
-
setAttr(searchInput, "aria-label", translate("board.searchAria"));
|
|
4464
|
-
const searchResults = element(doc, "div", "hive-search-results is-hidden");
|
|
4465
|
-
searchBox.appendChild(searchInput);
|
|
4466
|
-
searchBox.appendChild(searchResults);
|
|
4467
|
-
stage.appendChild(searchBox);
|
|
4468
|
-
searchInput.addEventListener("input", () => {
|
|
4469
|
-
void runSearch(searchInput.value);
|
|
4470
|
-
});
|
|
4471
|
-
searchInput.addEventListener("keydown", (event) => {
|
|
4472
|
-
if (event && event.key === "Enter") void runSearch(searchInput.value);
|
|
4473
|
-
});
|
|
4474
4357
|
|
|
4475
4358
|
const lanesNode = element(doc, "div", "hive-lanes");
|
|
4476
4359
|
const filterEmpty = element(doc, "div", "hive-filter-empty", "");
|
|
@@ -4593,29 +4476,64 @@ export function mount(root, options = {}) {
|
|
|
4593
4476
|
const time = Date.parse(value);
|
|
4594
4477
|
return Number.isFinite(time) ? time : null;
|
|
4595
4478
|
};
|
|
4479
|
+
let pruneCountSeq = 0;
|
|
4480
|
+
const pruneCountText = (count, time) => translate("events.pruneCount")
|
|
4481
|
+
.replace("{count}", String(count))
|
|
4482
|
+
.replace("{time}", time === null ? "—" : new Date(time).toLocaleString());
|
|
4596
4483
|
pruneInput.addEventListener("input", () => {
|
|
4597
4484
|
const time = pruneBefore();
|
|
4485
|
+
pruneCountSeq += 1;
|
|
4486
|
+
const seq = pruneCountSeq;
|
|
4598
4487
|
if (time === null) {
|
|
4599
|
-
pruneCount.textContent =
|
|
4488
|
+
pruneCount.textContent = pruneCountText(0, null);
|
|
4600
4489
|
return;
|
|
4601
4490
|
}
|
|
4602
|
-
const
|
|
4491
|
+
const localCount = eventState.items.filter((event) => {
|
|
4603
4492
|
const ts = Date.parse(event.ts);
|
|
4604
4493
|
return Number.isFinite(ts) && ts < time;
|
|
4605
4494
|
}).length;
|
|
4606
|
-
pruneCount.textContent =
|
|
4495
|
+
pruneCount.textContent = pruneCountText(localCount, time);
|
|
4496
|
+
if (!fetchImpl) return;
|
|
4497
|
+
const before = new Date(time).toISOString();
|
|
4498
|
+
void (async () => {
|
|
4499
|
+
try {
|
|
4500
|
+
const url = eventsUrl + (eventsUrl.includes("?") ? "&" : "?") + "before=" + encodeURIComponent(before);
|
|
4501
|
+
const response = await fetchImpl(url, { cache: "no-store", headers: { accept: "application/json" } });
|
|
4502
|
+
if (!response || response.ok === false) return;
|
|
4503
|
+
const payload = await response.json();
|
|
4504
|
+
const count = asCount(payload && payload.count, -1);
|
|
4505
|
+
if (seq === pruneCountSeq && count >= 0 && !destroyed) pruneCount.textContent = pruneCountText(count, time);
|
|
4506
|
+
} catch {
|
|
4507
|
+
// The local count stays visible when the count route is unavailable.
|
|
4508
|
+
}
|
|
4509
|
+
})();
|
|
4607
4510
|
});
|
|
4608
|
-
pruneConfirm.addEventListener("click", () => {
|
|
4511
|
+
pruneConfirm.addEventListener("click", async () => {
|
|
4609
4512
|
const time = pruneBefore();
|
|
4610
4513
|
if (time === null) return;
|
|
4611
|
-
const
|
|
4514
|
+
const before = new Date(time).toISOString();
|
|
4515
|
+
let count = eventState.items.filter((event) => {
|
|
4612
4516
|
const ts = Date.parse(event.ts);
|
|
4613
4517
|
return Number.isFinite(ts) && ts < time;
|
|
4614
4518
|
}).length;
|
|
4519
|
+
if (fetchImpl) {
|
|
4520
|
+
try {
|
|
4521
|
+
const url = eventsUrl + (eventsUrl.includes("?") ? "&" : "?") + "before=" + encodeURIComponent(before);
|
|
4522
|
+
const response = await fetchImpl(url, { cache: "no-store", headers: { accept: "application/json" } });
|
|
4523
|
+
if (response && response.ok !== false) {
|
|
4524
|
+
const payload = await response.json();
|
|
4525
|
+
const serverCount = asCount(payload && payload.count, -1);
|
|
4526
|
+
if (serverCount >= 0) count = serverCount;
|
|
4527
|
+
}
|
|
4528
|
+
} catch {
|
|
4529
|
+
// The loaded count remains a safe fallback when the count route is unavailable.
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
if (destroyed) return;
|
|
4615
4533
|
const message = translate("events.pruneConfirm").replace("{count}", String(count)).replace("{time}", new Date(time).toLocaleString());
|
|
4616
4534
|
if (!confirmImpl || !confirmImpl(message)) return;
|
|
4617
4535
|
eventsPrune.className = "hive-event-prune is-hidden";
|
|
4618
|
-
void runBatch("events-prune", { before
|
|
4536
|
+
void runBatch("events-prune", { before });
|
|
4619
4537
|
});
|
|
4620
4538
|
eventsHead.appendChild(eventsMenu);
|
|
4621
4539
|
const eventsList = element(doc, "div", "hive-scroll hive-event-list");
|
|
@@ -4766,18 +4684,6 @@ export function mount(root, options = {}) {
|
|
|
4766
4684
|
return element(doc, "div", "hive-empty", text);
|
|
4767
4685
|
}
|
|
4768
4686
|
|
|
4769
|
-
function findRawAgent(agent) {
|
|
4770
|
-
const board = lastSnapshot && Array.isArray(lastSnapshot.board) ? lastSnapshot.board : [];
|
|
4771
|
-
for (const rawEntry of board) {
|
|
4772
|
-
const entry = isRecord(rawEntry) && isRecord(rawEntry.value) ? rawEntry.value : rawEntry;
|
|
4773
|
-
if (!isRecord(entry)) continue;
|
|
4774
|
-
if (asString(entry.agent || entry.key || entry.name) === agent.agent) return entry;
|
|
4775
|
-
}
|
|
4776
|
-
return null;
|
|
4777
|
-
}
|
|
4778
|
-
|
|
4779
|
-
// --- help popover --------------------------------------------------------
|
|
4780
|
-
|
|
4781
4687
|
function helpSignatureOf(model) {
|
|
4782
4688
|
if (!model) return "none";
|
|
4783
4689
|
return (
|
|
@@ -5223,6 +5129,8 @@ export function mount(root, options = {}) {
|
|
|
5223
5129
|
const entry = ensure(name);
|
|
5224
5130
|
entry.inFlight = supervisorNumber(role.inFlight);
|
|
5225
5131
|
entry.queued = supervisorNumber(role.queued);
|
|
5132
|
+
const supervisorSource = normalizeLimitSource(role.source || role.limitSource || role.limit_source);
|
|
5133
|
+
if (supervisorSource !== null) entry.supervisorSource = supervisorSource;
|
|
5226
5134
|
const limit = supervisorNumber(role.limit);
|
|
5227
5135
|
if (limit !== null) entry.limit = limit;
|
|
5228
5136
|
}
|
|
@@ -5235,6 +5143,8 @@ export function mount(root, options = {}) {
|
|
|
5235
5143
|
const entry = ensure(name);
|
|
5236
5144
|
if (modelRole.adapter) entry.adapter = modelRole.adapter;
|
|
5237
5145
|
if (modelRole.model) entry.model = modelRole.model;
|
|
5146
|
+
const modelSource = normalizeLimitSource(modelRole.source || modelRole.limitSource || modelRole.limit_source);
|
|
5147
|
+
if (modelSource !== null) entry.modelSource = modelSource;
|
|
5238
5148
|
const limit = supervisorNumber(modelRole.limit);
|
|
5239
5149
|
if (limit !== null) {
|
|
5240
5150
|
entry.limit = limit;
|
|
@@ -5275,9 +5185,9 @@ export function mount(root, options = {}) {
|
|
|
5275
5185
|
entry.source = "limits";
|
|
5276
5186
|
} else if (supervisorLimit !== null) {
|
|
5277
5187
|
entry.limit = supervisorLimit;
|
|
5278
|
-
entry.source = "config";
|
|
5188
|
+
entry.source = entry.supervisorSource || "config";
|
|
5279
5189
|
} else if (entry.modelLimit) {
|
|
5280
|
-
entry.source = "limits";
|
|
5190
|
+
entry.source = entry.modelSource || "limits";
|
|
5281
5191
|
} else {
|
|
5282
5192
|
entry.source = "default";
|
|
5283
5193
|
}
|
|
@@ -6135,114 +6045,6 @@ export function mount(root, options = {}) {
|
|
|
6135
6045
|
return body;
|
|
6136
6046
|
}
|
|
6137
6047
|
|
|
6138
|
-
function taskTitleForId(id) {
|
|
6139
|
-
const wanted = asString(id);
|
|
6140
|
-
if (!wanted || !lastModel) return "";
|
|
6141
|
-
for (const lane of LANE_ORDER) {
|
|
6142
|
-
for (const card of lastModel.lanes[lane] || []) {
|
|
6143
|
-
if (asString(card.id) === wanted) return card.title || wanted;
|
|
6144
|
-
}
|
|
6145
|
-
}
|
|
6146
|
-
return wanted;
|
|
6147
|
-
}
|
|
6148
|
-
|
|
6149
|
-
function openAgentsDialog() {
|
|
6150
|
-
closeHelp(false);
|
|
6151
|
-
closePlanDialog(false);
|
|
6152
|
-
closeAddDialog(false);
|
|
6153
|
-
closeDrawer(false);
|
|
6154
|
-
closeLimitsDialog(false);
|
|
6155
|
-
|
|
6156
|
-
const dialog = element(doc, "dialog", "hive-dialog hive-agents-dialog");
|
|
6157
|
-
setAttr(dialog, "role", "dialog");
|
|
6158
|
-
setAttr(dialog, "aria-modal", "true");
|
|
6159
|
-
setAttr(dialog, "aria-label", translate("pane.agents"));
|
|
6160
|
-
bindDialogDismiss(dialog, () => {
|
|
6161
|
-
closeModalDialog(dialog);
|
|
6162
|
-
if (!destroyed) focusNode(agentsCount);
|
|
6163
|
-
});
|
|
6164
|
-
|
|
6165
|
-
const head = element(doc, "div", "hive-dialog-head");
|
|
6166
|
-
const titleBox = element(doc, "div", "hive-dialog-head-title");
|
|
6167
|
-
titleBox.appendChild(element(doc, "h2", "hive-dialog-title", translate("pane.agents")));
|
|
6168
|
-
head.appendChild(titleBox);
|
|
6169
|
-
const closeButton = dialogCloseButton(() => {
|
|
6170
|
-
closeModalDialog(dialog);
|
|
6171
|
-
if (!destroyed) focusNode(agentsCount);
|
|
6172
|
-
});
|
|
6173
|
-
head.appendChild(closeButton);
|
|
6174
|
-
dialog.appendChild(head);
|
|
6175
|
-
|
|
6176
|
-
const body = element(doc, "div", "hive-dialog-body hive-agents-body");
|
|
6177
|
-
const agents = lastModel && Array.isArray(lastModel.agents) ? lastModel.agents : [];
|
|
6178
|
-
if (agents.length === 0) {
|
|
6179
|
-
body.appendChild(element(doc, "div", "hive-agents-empty-note", translate("agents.modalEmpty")));
|
|
6180
|
-
}
|
|
6181
|
-
for (const agent of agents) {
|
|
6182
|
-
const row = element(doc, "div", "hive-agent-row");
|
|
6183
|
-
const dot = element(doc, "span", "hive-dot is-" + safeClassToken(agent.state));
|
|
6184
|
-
setAttr(dot, "title", agent.state || translate("agent.idle"));
|
|
6185
|
-
row.appendChild(dot);
|
|
6186
|
-
const content = element(doc, "div", "hive-agent-row-main");
|
|
6187
|
-
content.appendChild(element(doc, "div", "hive-agent-row-name", agent.agent || translate("agent.unknown")));
|
|
6188
|
-
const task = taskTitleForId(agent.task);
|
|
6189
|
-
content.appendChild(
|
|
6190
|
-
element(doc, "div", "hive-agent-row-task", task || translate("agent.idle")),
|
|
6191
|
-
);
|
|
6192
|
-
const meta = [translate("agents.fileCount").replace("{count}", String((agent.files || []).length))];
|
|
6193
|
-
const activity = elapsedLabel(agent.updatedAt);
|
|
6194
|
-
if (activity) meta.push(activity);
|
|
6195
|
-
const metaNode = element(doc, "div", "hive-agent-row-meta", meta.join(" · "));
|
|
6196
|
-
if (agent.updatedAt) setAttr(metaNode, "title", agent.updatedAt);
|
|
6197
|
-
content.appendChild(metaNode);
|
|
6198
|
-
row.appendChild(content);
|
|
6199
|
-
body.appendChild(row);
|
|
6200
|
-
}
|
|
6201
|
-
|
|
6202
|
-
const supervisor = currentSupervisorRow();
|
|
6203
|
-
const workers = supervisor && Array.isArray(supervisor.workers) ? supervisor.workers : [];
|
|
6204
|
-
if (workers.length > 0) {
|
|
6205
|
-
body.appendChild(element(doc, "div", "hive-agents-workers-title", translate("agents.workersTitle")));
|
|
6206
|
-
for (const worker of workers) {
|
|
6207
|
-
const row = element(doc, "div", "hive-agent-worker-row");
|
|
6208
|
-
row.appendChild(
|
|
6209
|
-
element(doc, "div", "hive-agent-worker-task", taskTitleForId(worker.cardId) || worker.cardId),
|
|
6210
|
-
);
|
|
6211
|
-
const meta = [];
|
|
6212
|
-
if (worker.role) meta.push(worker.role);
|
|
6213
|
-
if (worker.startedAt) meta.push(translate("agents.workerStarted").replace("{time}", formatRunStamp(worker.startedAt)));
|
|
6214
|
-
const elapsed = elapsedLabel(worker.startedAt);
|
|
6215
|
-
if (elapsed) meta.push(translate("agents.workerElapsed").replace("{duration}", elapsed));
|
|
6216
|
-
row.appendChild(element(doc, "div", "hive-agent-worker-meta", meta.join(" · ") || worker.agentName || worker.agent || ""));
|
|
6217
|
-
body.appendChild(row);
|
|
6218
|
-
}
|
|
6219
|
-
}
|
|
6220
|
-
|
|
6221
|
-
const technical = element(doc, "details", "hive-agents-technical");
|
|
6222
|
-
technical.appendChild(element(doc, "summary", "hive-agents-technical-summary", translate("agents.technical")));
|
|
6223
|
-
technical.appendChild(
|
|
6224
|
-
element(doc, "pre", "hive-json hive-agents-technical-json", JSON.stringify({ agents, workers }, null, 2)),
|
|
6225
|
-
);
|
|
6226
|
-
body.appendChild(technical);
|
|
6227
|
-
dialog.appendChild(body);
|
|
6228
|
-
|
|
6229
|
-
showModalDialog(dialog);
|
|
6230
|
-
focusNode(closeButton);
|
|
6231
|
-
}
|
|
6232
|
-
|
|
6233
|
-
function openAgentDrawer(agent) {
|
|
6234
|
-
const raw = findRawAgent(agent) || { ...agent };
|
|
6235
|
-
const title = agent.agent || translate("agent.unknown");
|
|
6236
|
-
const body = mountDrawer(
|
|
6237
|
-
agent.state || translate("agent.idle"),
|
|
6238
|
-
title,
|
|
6239
|
-
translate("agents.openAria") + " " + title,
|
|
6240
|
-
);
|
|
6241
|
-
drawerState = { kind: "agent", agent };
|
|
6242
|
-
body.appendChild(element(doc, "div", "hive-section-label", translate("drawer.rawJson")));
|
|
6243
|
-
body.appendChild(element(doc, "pre", "hive-json", JSON.stringify(raw, null, 2)));
|
|
6244
|
-
}
|
|
6245
|
-
|
|
6246
6048
|
/**
|
|
6247
6049
|
* The card drawer's "Last run" block. With no record it is one muted line;
|
|
6248
6050
|
* with a record it shows status, agent, timestamps and the short commit above
|
|
@@ -6574,7 +6376,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
6574
6376
|
const byId = new Map();
|
|
6575
6377
|
for (const task of tasks) if (task && task.id) byId.set(task.id, task);
|
|
6576
6378
|
const dependsOn = (Array.isArray(card.after) ? card.after : [])
|
|
6577
|
-
.map((id) => byId.get(id))
|
|
6379
|
+
.map((id) => byId.get(id) || { id, title: id, state: "unknown", missing: true })
|
|
6578
6380
|
.filter(Boolean);
|
|
6579
6381
|
const requiredBy = tasks.filter(
|
|
6580
6382
|
(task) =>
|
|
@@ -7415,7 +7217,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7415
7217
|
function setSupervisorData(rows) {
|
|
7416
7218
|
supervisorData = Array.isArray(rows) ? rows : [];
|
|
7417
7219
|
renderSupervisor();
|
|
7418
|
-
if (lastModel) renderAgents(lastModel);
|
|
7419
7220
|
}
|
|
7420
7221
|
|
|
7421
7222
|
|
|
@@ -7564,42 +7365,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7564
7365
|
}
|
|
7565
7366
|
}
|
|
7566
7367
|
|
|
7567
|
-
function renderAgents(model) {
|
|
7568
|
-
if (model.initialised === false) {
|
|
7569
|
-
agentsCount.className = "hive-stat hive-agent-count is-hidden";
|
|
7570
|
-
agentsCount.textContent = "0";
|
|
7571
|
-
agentsCount._agent = null;
|
|
7572
|
-
agentsCount.disabled = true;
|
|
7573
|
-
return;
|
|
7574
|
-
}
|
|
7575
|
-
const identities = model.agents.length;
|
|
7576
|
-
const row = currentSupervisorRow();
|
|
7577
|
-
const managed = Boolean(row && row.unmanaged !== true && row.waiting !== "no-queen-session");
|
|
7578
|
-
const hasWorkers = Boolean(managed && row.workersKnown === true && Array.isArray(row.workers));
|
|
7579
|
-
const workers = hasWorkers ? row.workers.length : null;
|
|
7580
|
-
const claimed = asCount(model.stats.byState.claimed, (model.lanes.claimed || []).length);
|
|
7581
|
-
const waitingToReclaim = workers === 0 && claimed > 0;
|
|
7582
|
-
agentsCount.className = "hive-stat hive-agent-count";
|
|
7583
|
-
agentsCount.disabled = false;
|
|
7584
|
-
agentsCount._agent = identities > 0 ? model.agents[0] : null;
|
|
7585
|
-
if (!hasWorkers) {
|
|
7586
|
-
agentsCount.textContent = "—";
|
|
7587
|
-
const label = model.boardError ? model.boardError : "";
|
|
7588
|
-
setAttr(agentsCount, "title", label);
|
|
7589
|
-
setAttr(agentsCount, "aria-label", label);
|
|
7590
|
-
return;
|
|
7591
|
-
}
|
|
7592
|
-
agentsCount.textContent = String(workers);
|
|
7593
|
-
const message = waitingToReclaim
|
|
7594
|
-
? translate("agents.waitingReclaimTooltip").replace("{count}", String(claimed))
|
|
7595
|
-
: translate("agents.runningTooltip")
|
|
7596
|
-
.replace("{running}", String(workers))
|
|
7597
|
-
.replace("{identities}", String(identities));
|
|
7598
|
-
const label = model.boardError ? message + " · " + model.boardError : message;
|
|
7599
|
-
setAttr(agentsCount, "title", label);
|
|
7600
|
-
setAttr(agentsCount, "aria-label", label);
|
|
7601
|
-
}
|
|
7602
|
-
|
|
7603
7368
|
function selectedCount() {
|
|
7604
7369
|
return selectedTasks.size + selectedEvents.size;
|
|
7605
7370
|
}
|
|
@@ -7621,11 +7386,15 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7621
7386
|
|
|
7622
7387
|
async function readBatchResponse(response) {
|
|
7623
7388
|
const status = Number(response && response.status) || 0;
|
|
7389
|
+
if (status === 204 || status === 205) {
|
|
7390
|
+
return { status, data: { ok: true, results: [] } };
|
|
7391
|
+
}
|
|
7624
7392
|
const contentType = response && response.headers && typeof response.headers.get === "function"
|
|
7625
7393
|
? String(response.headers.get("content-type") || "")
|
|
7626
7394
|
: "";
|
|
7395
|
+
const hasText = Boolean(response && typeof response.text === "function");
|
|
7627
7396
|
let text = "";
|
|
7628
|
-
if (
|
|
7397
|
+
if (hasText) {
|
|
7629
7398
|
try {
|
|
7630
7399
|
text = await response.text();
|
|
7631
7400
|
} catch {
|
|
@@ -7642,7 +7411,11 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7642
7411
|
return { status, text, invalid: true };
|
|
7643
7412
|
}
|
|
7644
7413
|
}
|
|
7645
|
-
if (
|
|
7414
|
+
if (hasText && status >= 200 && status < 300) {
|
|
7415
|
+
// 204/205 and empty 2xx bodies have no result list: success, never replay a delete.
|
|
7416
|
+
return { status, data: { ok: true, results: [] } };
|
|
7417
|
+
}
|
|
7418
|
+
if (!hasText && response && typeof response.json === "function") {
|
|
7646
7419
|
try {
|
|
7647
7420
|
return { status, data: await response.json() };
|
|
7648
7421
|
} catch {
|
|
@@ -8111,74 +7884,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8111
7884
|
if (!next.has(key) && entry.node.parentNode) entry.node.parentNode.removeChild(entry.node);
|
|
8112
7885
|
}
|
|
8113
7886
|
state.visible = next;
|
|
8114
|
-
state.count.textContent = String(total);
|
|
8115
|
-
}
|
|
8116
|
-
|
|
8117
|
-
let searchSeq = 0;
|
|
8118
|
-
|
|
8119
|
-
function taskSearchUrl(query) {
|
|
8120
|
-
const params = ["search=" + encodeURIComponent(query), "limit=200"];
|
|
8121
|
-
return tasksUrl + (tasksUrl.includes("?") ? "&" : "?") + params.join("&");
|
|
8122
|
-
}
|
|
8123
|
-
|
|
8124
|
-
function renderSearchResults(items, total) {
|
|
8125
|
-
clearNode(searchResults);
|
|
8126
|
-
searchResults.className = "hive-search-results";
|
|
8127
|
-
if (!Array.isArray(items) || items.length === 0) {
|
|
8128
|
-
searchResults.appendChild(element(doc, "div", "hive-search-empty", translate("board.searchEmpty")));
|
|
8129
|
-
return;
|
|
8130
|
-
}
|
|
8131
|
-
searchResults.appendChild(
|
|
8132
|
-
element(
|
|
8133
|
-
doc,
|
|
8134
|
-
"div",
|
|
8135
|
-
"hive-search-summary",
|
|
8136
|
-
translate("board.searchResults").replace("{count}", String(asCount(total, items.length))),
|
|
8137
|
-
),
|
|
8138
|
-
);
|
|
8139
|
-
for (const taskData of items) {
|
|
8140
|
-
const task = normalizeCard(taskData);
|
|
8141
|
-
const button = element(doc, "button", "hive-search-result");
|
|
8142
|
-
setAttr(button, "type", "button");
|
|
8143
|
-
button.appendChild(element(doc, "span", "hive-search-status is-" + safeClassToken(task.state), "●"));
|
|
8144
|
-
button.appendChild(element(doc, "span", "hive-search-title", task.title || task.id));
|
|
8145
|
-
button.appendChild(element(doc, "span", "hive-search-id", task.id));
|
|
8146
|
-
button.addEventListener("click", () => {
|
|
8147
|
-
void openCardDetail(task, task.state, null);
|
|
8148
|
-
});
|
|
8149
|
-
searchResults.appendChild(button);
|
|
8150
|
-
}
|
|
8151
|
-
}
|
|
8152
|
-
|
|
8153
|
-
async function runSearch(rawQuery) {
|
|
8154
|
-
const query = asString(rawQuery).trim();
|
|
8155
|
-
resetLaneScroll();
|
|
8156
|
-
searchSeq += 1;
|
|
8157
|
-
const seq = searchSeq;
|
|
8158
|
-
if (!query) {
|
|
8159
|
-
clearNode(searchResults);
|
|
8160
|
-
searchResults.className = "hive-search-results is-hidden";
|
|
8161
|
-
return;
|
|
8162
|
-
}
|
|
8163
|
-
if (!fetchImpl) return;
|
|
8164
|
-
try {
|
|
8165
|
-
const response = await fetchImpl(taskSearchUrl(query), {
|
|
8166
|
-
cache: "no-store",
|
|
8167
|
-
headers: { accept: "application/json" },
|
|
8168
|
-
});
|
|
8169
|
-
if (!response || response.ok === false) throw new Error("task search failed");
|
|
8170
|
-
const payload = await response.json();
|
|
8171
|
-
if (destroyed || seq !== searchSeq) return;
|
|
8172
|
-
const items = Array.isArray(payload && payload.items) ? payload.items : [];
|
|
8173
|
-
renderSearchResults(items, payload && payload.total);
|
|
8174
|
-
} catch (error) {
|
|
8175
|
-
if (!destroyed && seq === searchSeq) {
|
|
8176
|
-
clearNode(searchResults);
|
|
8177
|
-
searchResults.className = "hive-search-results";
|
|
8178
|
-
searchResults.appendChild(element(doc, "div", "hive-search-empty", translate("board.searchEmpty")));
|
|
8179
|
-
}
|
|
8180
|
-
reportError(error);
|
|
8181
|
-
}
|
|
8182
7887
|
}
|
|
8183
7888
|
|
|
8184
7889
|
function taskPageUrl(state, cursor) {
|
|
@@ -8242,8 +7947,8 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8242
7947
|
: null;
|
|
8243
7948
|
if (!items) throw new Error("tasks page returned no items");
|
|
8244
7949
|
const total = asCount(payload && payload.total, page.total);
|
|
8245
|
-
const cursor =
|
|
8246
|
-
const hasMore = payload && payload.hasMore === true
|
|
7950
|
+
const cursor = payload && payload.cursor !== undefined && payload.cursor !== null ? String(payload.cursor) : "";
|
|
7951
|
+
const hasMore = Boolean(payload && payload.hasMore === true);
|
|
8247
7952
|
if (!lastSnapshot) throw new Error("the board is not ready");
|
|
8248
7953
|
const existing = Array.isArray(lastSnapshot.tasks) ? lastSnapshot.tasks : [];
|
|
8249
7954
|
const seen = new Set(existing.map((task) => String(task && task.id)));
|
|
@@ -8301,8 +8006,8 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8301
8006
|
const payload = await response.json();
|
|
8302
8007
|
const items = Array.isArray(payload && payload.items) ? payload.items : [];
|
|
8303
8008
|
const total = asCount(payload && payload.total, items.length);
|
|
8304
|
-
const cursor =
|
|
8305
|
-
const hasMore = payload && payload.hasMore === true
|
|
8009
|
+
const cursor = payload && payload.cursor !== undefined && payload.cursor !== null ? String(payload.cursor) : "";
|
|
8010
|
+
const hasMore = Boolean(payload && payload.hasMore === true);
|
|
8306
8011
|
const others = (Array.isArray(lastSnapshot.tasks) ? lastSnapshot.tasks : [])
|
|
8307
8012
|
.filter((task) => (task && (task.state || "pending")) !== lane);
|
|
8308
8013
|
const lanePages = { ...(isRecord(lastSnapshot.lanePages) ? lastSnapshot.lanePages : {}) };
|
|
@@ -8834,6 +8539,8 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
8834
8539
|
|
|
8835
8540
|
function eventKey(event) {
|
|
8836
8541
|
const raw = event.raw || {};
|
|
8542
|
+
if (event.key) return String(event.key);
|
|
8543
|
+
if (raw.key) return String(raw.key);
|
|
8837
8544
|
const ref = raw.task || event.task || "";
|
|
8838
8545
|
return JSON.stringify([String(event.ts || ""), String(event.kind || ""), String(event.actor || raw.actor || ""), String(ref)]);
|
|
8839
8546
|
}
|
|
@@ -9007,7 +8714,15 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9007
8714
|
eventState.recycled = 0;
|
|
9008
8715
|
eventsList.scrollTop = 0;
|
|
9009
8716
|
} else if (items.length > 0) {
|
|
9010
|
-
|
|
8717
|
+
const known = new Set(eventState.items.map((event) => eventKey(event)));
|
|
8718
|
+
const fresh = [];
|
|
8719
|
+
for (const item of items) {
|
|
8720
|
+
const key = eventKey(item);
|
|
8721
|
+
if (known.has(key)) continue;
|
|
8722
|
+
known.add(key);
|
|
8723
|
+
fresh.push(item);
|
|
8724
|
+
}
|
|
8725
|
+
eventState.items = eventState.items.concat(fresh);
|
|
9011
8726
|
if (eventState.items.length > 5000) {
|
|
9012
8727
|
const dropped = eventState.items.length - 5000;
|
|
9013
8728
|
eventState.items = eventState.items.slice(0, 5000);
|
|
@@ -9066,7 +8781,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9066
8781
|
renderStats(model);
|
|
9067
8782
|
renderActions(model);
|
|
9068
8783
|
renderFreezeBanner(model);
|
|
9069
|
-
renderAgents(model);
|
|
9070
8784
|
renderStageChips(model);
|
|
9071
8785
|
renderLanes(model);
|
|
9072
8786
|
}
|
|
@@ -9094,12 +8808,8 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9094
8808
|
}
|
|
9095
8809
|
const state = drawerState;
|
|
9096
8810
|
if (state) {
|
|
9097
|
-
if (state.kind === "card")
|
|
9098
|
-
|
|
9099
|
-
} else {
|
|
9100
|
-
closeDrawer();
|
|
9101
|
-
openAgentDrawer(state.agent);
|
|
9102
|
-
}
|
|
8811
|
+
if (state.kind === "card") openDrawer(state.card, state.lane);
|
|
8812
|
+
else closeDrawer();
|
|
9103
8813
|
}
|
|
9104
8814
|
if (helpWasOpen) openHelp();
|
|
9105
8815
|
}
|
|
@@ -9245,7 +8955,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9245
8955
|
const payload = await response.json();
|
|
9246
8956
|
const items = Array.isArray(payload && payload.items) ? payload.items : [];
|
|
9247
8957
|
const total = asCount(payload && payload.total, items.length);
|
|
9248
|
-
const cursor =
|
|
8958
|
+
const cursor = payload && payload.cursor !== undefined && payload.cursor !== null ? String(payload.cursor) : "";
|
|
9249
8959
|
taskSlices[lane] = items;
|
|
9250
8960
|
taskSlicePages[lane] = { total, cursor, hasMore: Boolean(payload && payload.hasMore) };
|
|
9251
8961
|
state.initialLoading = false;
|
|
@@ -9271,7 +8981,7 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9271
8981
|
eventState.items = items;
|
|
9272
8982
|
eventState.total = asCount(payload && payload.total, items.length);
|
|
9273
8983
|
eventState.cursor = asCount(payload && payload.cursor, items.length);
|
|
9274
|
-
eventState.pollCursor =
|
|
8984
|
+
eventState.pollCursor = items.length > 0 ? eventKey(items[0]) : "";
|
|
9275
8985
|
eventState.filter = "";
|
|
9276
8986
|
eventState.recycled = 0;
|
|
9277
8987
|
eventState.paged = false;
|
|
@@ -9421,15 +9131,20 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9421
9131
|
async function pollEventsIncremental() {
|
|
9422
9132
|
if (!fetchImpl || !initialDataLoaded || eventState.filter) return;
|
|
9423
9133
|
if (!isNodeVisible(eventsDrawer)) return;
|
|
9424
|
-
const after =
|
|
9134
|
+
const after = eventState.pollCursor === undefined || eventState.pollCursor === null ? "" : String(eventState.pollCursor);
|
|
9425
9135
|
try {
|
|
9426
9136
|
const url = eventsUrl + (eventsUrl.includes("?") ? "&" : "?") +
|
|
9427
|
-
"after=" + encodeURIComponent(
|
|
9137
|
+
"after=" + encodeURIComponent(after) + "&limit=50";
|
|
9428
9138
|
const response = await fetchImpl(url, { cache: "no-store", headers: { accept: "application/json" } });
|
|
9429
9139
|
if (!response || response.ok === false) return;
|
|
9430
9140
|
const payload = await response.json();
|
|
9141
|
+
if (payload && payload.dropped === true) {
|
|
9142
|
+
await loadInitialEvents();
|
|
9143
|
+
if (!destroyed) showToast("error", translate("events.missed"), translate("events.missedReloaded"));
|
|
9144
|
+
return;
|
|
9145
|
+
}
|
|
9431
9146
|
const items = normalizeEvents(Array.isArray(payload && payload.items) ? payload.items : []);
|
|
9432
|
-
const nextCursor =
|
|
9147
|
+
const nextCursor = payload && payload.cursor !== undefined && payload.cursor !== null ? String(payload.cursor) : after;
|
|
9433
9148
|
const total = asCount(payload && payload.total, eventState.total);
|
|
9434
9149
|
eventState.pollCursor = nextCursor;
|
|
9435
9150
|
eventState.total = Math.max(total, eventState.items.length);
|
|
@@ -9592,10 +9307,22 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9592
9307
|
for (const child of actionsNode.children) {
|
|
9593
9308
|
if ("disabled" in child) child.disabled = disabled;
|
|
9594
9309
|
}
|
|
9595
|
-
|
|
9310
|
+
}
|
|
9311
|
+
|
|
9312
|
+
function renderActionPlaceholders() {
|
|
9313
|
+
clearNode(actionsNode);
|
|
9314
|
+
for (const action of toolbarActions(true, "free")) {
|
|
9315
|
+
const button = element(doc, "button", "hive-btn hive-action-placeholder", translate(action.labelKey));
|
|
9316
|
+
setAttr(button, "type", "button");
|
|
9317
|
+
setAttr(button, "title", translate(action.helpKey));
|
|
9318
|
+
setAttr(button, "disabled", "disabled");
|
|
9319
|
+
button.disabled = true;
|
|
9320
|
+
actionsNode.appendChild(button);
|
|
9321
|
+
}
|
|
9596
9322
|
}
|
|
9597
9323
|
|
|
9598
9324
|
function primeInitialUI() {
|
|
9325
|
+
renderActionPlaceholders();
|
|
9599
9326
|
for (const lane of LANE_ORDER) {
|
|
9600
9327
|
if (laneRenderState.has(lane)) continue;
|
|
9601
9328
|
const state = createLaneState(lane);
|
|
@@ -9613,7 +9340,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
9613
9340
|
function showStatusPlaceholders() {
|
|
9614
9341
|
clearNode(statsNode);
|
|
9615
9342
|
statsNode.appendChild(element(doc, "span", "hive-stat is-total", "—"));
|
|
9616
|
-
agentsCount.textContent = "—";
|
|
9617
9343
|
queenBadge.className = "hive-queen-badge is-hidden";
|
|
9618
9344
|
}
|
|
9619
9345
|
|