@d86e/hive-panel 1.0.21 → 1.0.23
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 +4 -3
- package/public/panel.js +88 -42
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,7 +1327,7 @@ 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-details { display: flex; flex-direction: column; gap:
|
|
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
1331
|
.hive-event-detail { display: flex; align-items: flex-start; gap: 6px; }
|
|
1332
1332
|
.hive-event-label { flex: 0 0 auto; color: var(--hive-fg-faint); }
|
|
1333
1333
|
.hive-event-value { min-width: 0; color: var(--hive-fg-soft); overflow-wrap: anywhere; }
|
|
@@ -1335,3 +1335,4 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1335
1335
|
.hive-event.is-expanded .hive-event-sentence { flex-basis: 100%; white-space: normal; }
|
|
1336
1336
|
.hive-event.is-expanded .hive-event-raw { flex-basis: 100%; }
|
|
1337
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,13 +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-details { display: flex; flex-direction: column; gap:
|
|
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
2150
|
.hive-event-detail { display: flex; align-items: flex-start; gap: 6px; }
|
|
2151
2151
|
.hive-event-label { flex: 0 0 auto; color: var(--hive-fg-faint); }
|
|
2152
2152
|
.hive-event-value { min-width: 0; color: var(--hive-fg-soft); overflow-wrap: anywhere; }
|
|
2153
2153
|
.hive-event.is-expanded { flex-wrap: wrap; align-items: flex-start; height: auto; min-height: 28px; padding: 5px 7px; overflow: visible; }
|
|
2154
2154
|
.hive-event.is-expanded .hive-event-sentence { flex-basis: 100%; white-space: normal; }
|
|
2155
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; }
|
|
2156
2157
|
`;
|
|
2157
2158
|
|
|
2158
2159
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2361,6 +2362,10 @@ export const messages = Object.freeze({
|
|
|
2361
2362
|
"limits.description": "Max agents working at the same time, per role; 0 pauses the role",
|
|
2362
2363
|
"limits.role": "Role",
|
|
2363
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",
|
|
2364
2369
|
"limits.inFlight": "Running",
|
|
2365
2370
|
"limits.queued": "Waiting",
|
|
2366
2371
|
"limits.defaultHint": "0-999, default 5",
|
|
@@ -2711,6 +2716,10 @@ export const messages = Object.freeze({
|
|
|
2711
2716
|
"limits.description": "同时干活的智能体数量上限,按角色分别设置;0 表示暂停该角色",
|
|
2712
2717
|
"limits.role": "角色",
|
|
2713
2718
|
"limits.limit": "并发上限",
|
|
2719
|
+
"limits.source": "来源",
|
|
2720
|
+
"limits.source.config": "配置",
|
|
2721
|
+
"limits.source.limits": "limits.json",
|
|
2722
|
+
"limits.source.default": "默认",
|
|
2714
2723
|
"limits.inFlight": "运行",
|
|
2715
2724
|
"limits.queued": "等待",
|
|
2716
2725
|
"limits.defaultHint": "0–999,默认 5",
|
|
@@ -4955,51 +4964,77 @@ export function mount(root, options = {}) {
|
|
|
4955
4964
|
}
|
|
4956
4965
|
|
|
4957
4966
|
function roleRowsForCurrentRepo(row) {
|
|
4958
|
-
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
|
+
|
|
4959
4973
|
if (row && Array.isArray(row.roles)) {
|
|
4960
4974
|
for (const role of row.roles) {
|
|
4961
4975
|
if (!isRecord(role)) continue;
|
|
4962
4976
|
const name = asString(role.role);
|
|
4963
|
-
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;
|
|
4964
4983
|
}
|
|
4965
4984
|
}
|
|
4985
|
+
|
|
4966
4986
|
const modelRoles = lastModel && lastModel.roles && Array.isArray(lastModel.roles.list) ? lastModel.roles.list : [];
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
const effective = supervisorRoles.get(name);
|
|
4979
|
-
return {
|
|
4980
|
-
role: name,
|
|
4981
|
-
adapter: entry.adapter,
|
|
4982
|
-
model: entry.model,
|
|
4983
|
-
limit,
|
|
4984
|
-
inFlight: effective ? effective.inFlight : null,
|
|
4985
|
-
queued: effective ? effective.queued : null,
|
|
4986
|
-
};
|
|
4987
|
-
})
|
|
4988
|
-
.filter(Boolean)
|
|
4989
|
-
.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
|
+
}
|
|
4990
4998
|
}
|
|
4991
4999
|
|
|
4992
|
-
const
|
|
4993
|
-
for (const [name,
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
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);
|
|
5000
5016
|
}
|
|
5001
|
-
for (const name of Object.keys(lastModel.stats.byRole || {}))
|
|
5002
|
-
|
|
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";
|
|
5003
5038
|
}
|
|
5004
5039
|
}
|
|
5005
5040
|
return [...roles.values()].sort((left, right) => left.role.localeCompare(right.role));
|
|
@@ -5183,6 +5218,7 @@ export function mount(root, options = {}) {
|
|
|
5183
5218
|
const header = element(doc, "div", "hive-limits-row is-head");
|
|
5184
5219
|
header.appendChild(element(doc, "span", "hive-limits-cell", translate("limits.role")));
|
|
5185
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")));
|
|
5186
5222
|
header.appendChild(element(doc, "span", "hive-limits-cell is-number", translate("limits.inFlight")));
|
|
5187
5223
|
header.appendChild(element(doc, "span", "hive-limits-cell is-number", translate("limits.queued")));
|
|
5188
5224
|
header.appendChild(element(doc, "span", "hive-limits-cell is-action", ""));
|
|
@@ -5201,6 +5237,8 @@ export function mount(root, options = {}) {
|
|
|
5201
5237
|
input.value = supervisorNumber(role.limit) === null ? "5" : String(supervisorNumber(role.limit));
|
|
5202
5238
|
input.disabled = !writable || !supervisorAvailable;
|
|
5203
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)));
|
|
5204
5242
|
roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.inFlight)));
|
|
5205
5243
|
roleRow.appendChild(element(doc, "span", "hive-limits-cell is-number", limitsNumberText(role.queued)));
|
|
5206
5244
|
if (writable) {
|
|
@@ -5501,6 +5539,13 @@ export function mount(root, options = {}) {
|
|
|
5501
5539
|
throw error;
|
|
5502
5540
|
}
|
|
5503
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
|
+
}
|
|
5504
5549
|
closeLimitsDialog(false);
|
|
5505
5550
|
showToast("success", translate("limits.saved"), state.repo);
|
|
5506
5551
|
await refreshSupervisor(true);
|
|
@@ -7407,7 +7452,6 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7407
7452
|
|
|
7408
7453
|
const LANE_ROW_HEIGHT = 28;
|
|
7409
7454
|
const LANE_ROW_BUFFER = 4;
|
|
7410
|
-
const LANE_MAX_ROWS = 20;
|
|
7411
7455
|
const LANE_VIEWPORT_FALLBACK = 480;
|
|
7412
7456
|
const LANE_DATA_LIMIT = 5000;
|
|
7413
7457
|
const LANE_PAGE_SIZE = 200;
|
|
@@ -7542,10 +7586,12 @@ function renderMarkdownInto(doc, host, source) {
|
|
|
7542
7586
|
const viewport = laneViewportHeight(state);
|
|
7543
7587
|
state.lastViewportHeight = viewport;
|
|
7544
7588
|
const scrollTop = Number(state.list.scrollTop) || 0;
|
|
7589
|
+
const visibleRows = Math.max(1, Math.ceil(viewport / row));
|
|
7590
|
+
const maxRows = visibleRows + LANE_ROW_BUFFER * 2;
|
|
7545
7591
|
const start = Math.max(0, Math.floor(scrollTop / row) - LANE_ROW_BUFFER);
|
|
7546
7592
|
let end = Math.min(total, Math.ceil((scrollTop + viewport) / row) + LANE_ROW_BUFFER);
|
|
7547
|
-
if (end - start >
|
|
7548
|
-
const height = total === 0 ? 0 : total * row
|
|
7593
|
+
if (end - start > maxRows) end = start + maxRows;
|
|
7594
|
+
const height = total === 0 ? 0 : total * row;
|
|
7549
7595
|
setStyle(state.inner, "height", String(height) + "px");
|
|
7550
7596
|
|
|
7551
7597
|
const next = new Map();
|