@d86e/hive-panel 1.0.8 → 1.0.10
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 +36 -0
- package/public/panel.js +355 -22
package/package.json
CHANGED
package/public/panel.css
CHANGED
|
@@ -1153,3 +1153,39 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
1153
1153
|
.hive-supervisor-inline-state.is-paused::before { background: var(--hive-warn); }
|
|
1154
1154
|
.hive-supervisor-inline-state.is-unresponsive::before { background: var(--hive-fg-faint); }
|
|
1155
1155
|
|
|
1156
|
+
/* Lightweight markdown in the last-run output. */
|
|
1157
|
+
.hive-markdown { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
|
|
1158
|
+
.hive-markdown p { margin: 0 0 8px; white-space: pre-wrap; }
|
|
1159
|
+
.hive-markdown p:last-child { margin-bottom: 0; }
|
|
1160
|
+
.hive-markdown .hive-md-heading { margin: 8px 0 6px; color: var(--hive-fg); font-size: 14px; font-weight: 700; line-height: 1.4; }
|
|
1161
|
+
.hive-markdown h1.hive-md-heading { font-size: 16px; }
|
|
1162
|
+
.hive-markdown h2.hive-md-heading { font-size: 15px; }
|
|
1163
|
+
.hive-markdown .hive-md-list { margin: 0 0 8px; padding-left: 20px; }
|
|
1164
|
+
.hive-markdown .hive-md-list li { margin: 2px 0; }
|
|
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; }
|
|
1167
|
+
.hive-markdown .hive-md-code-block code { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; white-space: pre; }
|
|
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
|
+
.hive-markdown .hive-md-link { color: var(--hive-accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
1170
|
+
.hive-markdown .hive-markdown-empty { color: var(--hive-fg-faint); font-size: 12px; }
|
|
1171
|
+
|
|
1172
|
+
/* Initial loading skeleton and progress. */
|
|
1173
|
+
.hive-skeleton { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: 1 1 auto; padding: 8px; min-height: 200px; }
|
|
1174
|
+
.hive-skeleton.is-hidden { display: none; }
|
|
1175
|
+
.hive-skeleton-lane { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); }
|
|
1176
|
+
.hive-skeleton-head { color: var(--hive-fg-faint); font-size: 11px; font-weight: 600; line-height: 1.5; }
|
|
1177
|
+
.hive-skeleton-row { height: 26px; border-radius: var(--hive-radius-sm); background: var(--hive-line-2); opacity: 0.65; }
|
|
1178
|
+
.hive-skeleton-pill { width: 44px; height: 22px; border-radius: var(--hive-radius-sm); background: var(--hive-line-2); opacity: 0.65; }
|
|
1179
|
+
.hive-loading { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 10px 8px; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; }
|
|
1180
|
+
.hive-loading.is-hidden { display: none; }
|
|
1181
|
+
.hive-loading-badge { padding: 2px 7px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); color: var(--hive-fg-soft); font-size: 11px; line-height: 1.4; }
|
|
1182
|
+
.hive-loading-badge.is-hidden { display: none; }
|
|
1183
|
+
|
|
1184
|
+
/* Card scope block in the task dialog. */
|
|
1185
|
+
.hive-scope-block { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
|
|
1186
|
+
.hive-scope-title { color: var(--hive-fg); font-size: 12px; font-weight: 700; line-height: 1.5; }
|
|
1187
|
+
.hive-scope-hint { color: var(--hive-fg-faint); font-size: 11px; line-height: 1.5; }
|
|
1188
|
+
.hive-scope-list { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
|
|
1189
|
+
.hive-scope-path { max-width: 100%; padding: 2px 6px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); background: var(--hive-bg-layer-1); color: var(--hive-fg-soft); font-family: var(--hive-mono); font-size: 10.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1190
|
+
.hive-scope-more { padding: 2px 6px; font-size: 10.5px; }
|
|
1191
|
+
|
package/public/panel.js
CHANGED
|
@@ -2037,6 +2037,39 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
|
|
|
2037
2037
|
.hive-supervisor-inline-state.is-normal::before { background: var(--hive-ok); }
|
|
2038
2038
|
.hive-supervisor-inline-state.is-paused::before { background: var(--hive-warn); }
|
|
2039
2039
|
.hive-supervisor-inline-state.is-unresponsive::before { background: var(--hive-fg-faint); }
|
|
2040
|
+
/* Lightweight markdown in the last-run output. */
|
|
2041
|
+
.hive-markdown { color: var(--hive-fg-soft); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
|
|
2042
|
+
.hive-markdown p { margin: 0 0 8px; white-space: pre-wrap; }
|
|
2043
|
+
.hive-markdown p:last-child { margin-bottom: 0; }
|
|
2044
|
+
.hive-markdown .hive-md-heading { margin: 8px 0 6px; color: var(--hive-fg); font-size: 14px; font-weight: 700; line-height: 1.4; }
|
|
2045
|
+
.hive-markdown h1.hive-md-heading { font-size: 16px; }
|
|
2046
|
+
.hive-markdown h2.hive-md-heading { font-size: 15px; }
|
|
2047
|
+
.hive-markdown .hive-md-list { margin: 0 0 8px; padding-left: 20px; }
|
|
2048
|
+
.hive-markdown .hive-md-list li { margin: 2px 0; }
|
|
2049
|
+
.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; }
|
|
2051
|
+
.hive-markdown .hive-md-code-block code { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; white-space: pre; }
|
|
2052
|
+
.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
|
+
.hive-markdown .hive-md-link { color: var(--hive-accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
2054
|
+
.hive-markdown .hive-markdown-empty { color: var(--hive-fg-faint); font-size: 12px; }
|
|
2055
|
+
/* Initial loading skeleton and progress. */
|
|
2056
|
+
.hive-skeleton { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: 1 1 auto; padding: 8px; min-height: 200px; }
|
|
2057
|
+
.hive-skeleton.is-hidden { display: none; }
|
|
2058
|
+
.hive-skeleton-lane { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-md); background: var(--hive-bg-layer-1); }
|
|
2059
|
+
.hive-skeleton-head { color: var(--hive-fg-faint); font-size: 11px; font-weight: 600; line-height: 1.5; }
|
|
2060
|
+
.hive-skeleton-row { height: 26px; border-radius: var(--hive-radius-sm); background: var(--hive-line-2); opacity: 0.65; }
|
|
2061
|
+
.hive-skeleton-pill { width: 44px; height: 22px; border-radius: var(--hive-radius-sm); background: var(--hive-line-2); opacity: 0.65; }
|
|
2062
|
+
.hive-loading { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 10px 8px; color: var(--hive-fg-soft); font-size: 12px; line-height: 1.5; }
|
|
2063
|
+
.hive-loading.is-hidden { display: none; }
|
|
2064
|
+
.hive-loading-badge { padding: 2px 7px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); color: var(--hive-fg-soft); font-size: 11px; line-height: 1.4; }
|
|
2065
|
+
.hive-loading-badge.is-hidden { display: none; }
|
|
2066
|
+
/* Card scope block in the task dialog. */
|
|
2067
|
+
.hive-scope-block { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
|
|
2068
|
+
.hive-scope-title { color: var(--hive-fg); font-size: 12px; font-weight: 700; line-height: 1.5; }
|
|
2069
|
+
.hive-scope-hint { color: var(--hive-fg-faint); font-size: 11px; line-height: 1.5; }
|
|
2070
|
+
.hive-scope-list { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
|
|
2071
|
+
.hive-scope-path { max-width: 100%; padding: 2px 6px; border: 1px solid var(--hive-line-2); border-radius: var(--hive-radius-sm); background: var(--hive-bg-layer-1); color: var(--hive-fg-soft); font-family: var(--hive-mono); font-size: 10.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
2072
|
+
.hive-scope-more { padding: 2px 6px; font-size: 10.5px; }
|
|
2040
2073
|
`;
|
|
2041
2074
|
|
|
2042
2075
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
@@ -2094,6 +2127,13 @@ export const messages = Object.freeze({
|
|
|
2094
2127
|
"stats.byRoleTitle": "by role: ",
|
|
2095
2128
|
"status.actionFailed": "action failed",
|
|
2096
2129
|
"status.disconnected": "disconnected",
|
|
2130
|
+
"loading.updating": "Updating",
|
|
2131
|
+
"loading.label": "Loading",
|
|
2132
|
+
"loading.slow": "Loading · waited {seconds}s",
|
|
2133
|
+
"loading.failed": "Could not load",
|
|
2134
|
+
"loading.retry": "Retry",
|
|
2135
|
+
"loading.retryAria": "Retry loading the board",
|
|
2136
|
+
"loading.aria": "Loading the board",
|
|
2097
2137
|
"agents.openAria": "Open agent",
|
|
2098
2138
|
"agents.runningTooltip": "Running {running} / board identities {identities}",
|
|
2099
2139
|
"agents.fallbackTooltip": "Board identities {identities} (supervisor disconnected or repository not registered)",
|
|
@@ -2123,6 +2163,10 @@ export const messages = Object.freeze({
|
|
|
2123
2163
|
"drawer.removeClaimed": "A claimed task must be released or reopened before it can be deleted.",
|
|
2124
2164
|
"drawer.rawJson": "raw json",
|
|
2125
2165
|
"drawer.lastRun": "Last run",
|
|
2166
|
+
"drawer.noOutput": "(no output)",
|
|
2167
|
+
"drawer.scopeTitle": "Work scope",
|
|
2168
|
+
"drawer.scopeHint": "Directories/files this task changes.",
|
|
2169
|
+
"drawer.scopeMore": "+{count} items",
|
|
2126
2170
|
"drawer.runOverlaps": "Also writing",
|
|
2127
2171
|
"drawer.runLessons": "Read {count} lessons",
|
|
2128
2172
|
"drawer.runNoLessons": "No lessons to read",
|
|
@@ -2358,6 +2402,13 @@ export const messages = Object.freeze({
|
|
|
2358
2402
|
"stats.byRoleTitle": "按角色:",
|
|
2359
2403
|
"status.actionFailed": "操作失败",
|
|
2360
2404
|
"status.disconnected": "连接断开",
|
|
2405
|
+
"loading.updating": "更新中",
|
|
2406
|
+
"loading.label": "加载中",
|
|
2407
|
+
"loading.slow": "正在读取 · 已等 {seconds}s",
|
|
2408
|
+
"loading.failed": "读取失败",
|
|
2409
|
+
"loading.retry": "重试",
|
|
2410
|
+
"loading.retryAria": "重试读取看板",
|
|
2411
|
+
"loading.aria": "正在读取看板",
|
|
2361
2412
|
"agents.openAria": "打开智能体",
|
|
2362
2413
|
"agents.runningTooltip": "运行中 {running} / 公告板身份 {identities}",
|
|
2363
2414
|
"agents.fallbackTooltip": "公告板身份 {identities}(监督器未连接或未注册该仓库)",
|
|
@@ -2387,6 +2438,10 @@ export const messages = Object.freeze({
|
|
|
2387
2438
|
"drawer.removeClaimed": "已认领的任务必须先释放或重开才能删除。",
|
|
2388
2439
|
"drawer.rawJson": "原始 JSON",
|
|
2389
2440
|
"drawer.lastRun": "最近一次执行",
|
|
2441
|
+
"drawer.noOutput": "(无输出)",
|
|
2442
|
+
"drawer.scopeTitle": "工作范围",
|
|
2443
|
+
"drawer.scopeHint": "这个任务改动的目录/文件",
|
|
2444
|
+
"drawer.scopeMore": "+{count} 项",
|
|
2390
2445
|
"drawer.runOverlaps": "同时写入",
|
|
2391
2446
|
"drawer.runLessons": "读取了 {count} 条经验",
|
|
2392
2447
|
"drawer.runNoLessons": "没有可读取的经验",
|
|
@@ -3244,15 +3299,6 @@ function supervisorWorkerCount(row) {
|
|
|
3244
3299
|
return found ? total : null;
|
|
3245
3300
|
}
|
|
3246
3301
|
|
|
3247
|
-
function taskDisplayTitle(title) {
|
|
3248
|
-
const full = asString(title);
|
|
3249
|
-
if (!full) return full;
|
|
3250
|
-
const stripped = full
|
|
3251
|
-
.replace(/^[\w.-]+\/[A-Za-z]?\d+\s*[::]\s*/, "")
|
|
3252
|
-
.replace(/^[A-Za-z]+-\d+\s*[::]\s*/, "");
|
|
3253
|
-
return stripped || full;
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
3302
|
function element(doc, tag, className, text) {
|
|
3257
3303
|
const node = doc.createElement(tag);
|
|
3258
3304
|
if (className) node.className = className;
|
|
@@ -3667,6 +3713,10 @@ export function mount(root, options = {}) {
|
|
|
3667
3713
|
typeof view.setInterval === "function" ? view.setInterval.bind(view) : globalThis.setInterval.bind(globalThis);
|
|
3668
3714
|
const unschedule =
|
|
3669
3715
|
typeof view.clearInterval === "function" ? view.clearInterval.bind(view) : globalThis.clearInterval.bind(globalThis);
|
|
3716
|
+
const scheduleTimeout =
|
|
3717
|
+
typeof view.setTimeout === "function" ? view.setTimeout.bind(view) : globalThis.setTimeout.bind(globalThis);
|
|
3718
|
+
const clearScheduledTimeout =
|
|
3719
|
+
typeof view.clearTimeout === "function" ? view.clearTimeout.bind(view) : globalThis.clearTimeout.bind(globalThis);
|
|
3670
3720
|
|
|
3671
3721
|
const translator = typeof opts.t === "function" ? opts.t : null;
|
|
3672
3722
|
|
|
@@ -3698,6 +3748,10 @@ export function mount(root, options = {}) {
|
|
|
3698
3748
|
let refreshPromise = null;
|
|
3699
3749
|
let lastSnapshot = null;
|
|
3700
3750
|
let lastModel = null;
|
|
3751
|
+
let loadingActive = false;
|
|
3752
|
+
let loadingTicks = 0;
|
|
3753
|
+
let loadingTimer = null;
|
|
3754
|
+
let loadingPanelError = "";
|
|
3701
3755
|
let drawerNode = null;
|
|
3702
3756
|
let drawerState = null;
|
|
3703
3757
|
let drawerTrigger = null;
|
|
@@ -3796,6 +3850,10 @@ export function mount(root, options = {}) {
|
|
|
3796
3850
|
const statusNode = element(doc, "span", "hive-status", "");
|
|
3797
3851
|
bar.appendChild(statusNode);
|
|
3798
3852
|
|
|
3853
|
+
const loadingBadge = element(doc, "span", "hive-loading-badge is-hidden", translate("loading.label"));
|
|
3854
|
+
setAttr(loadingBadge, "role", "status");
|
|
3855
|
+
bar.appendChild(loadingBadge);
|
|
3856
|
+
|
|
3799
3857
|
const actionGroup = element(doc, "div", "hive-action-group");
|
|
3800
3858
|
const actionsNode = element(doc, "div", "hive-actions");
|
|
3801
3859
|
actionGroup.appendChild(actionsNode);
|
|
@@ -3907,6 +3965,31 @@ export function mount(root, options = {}) {
|
|
|
3907
3965
|
stage.appendChild(stageChips);
|
|
3908
3966
|
stage.appendChild(filterEmpty);
|
|
3909
3967
|
stage.appendChild(lanesNode);
|
|
3968
|
+
const skeletonNode = element(doc, "div", "hive-skeleton");
|
|
3969
|
+
for (const lane of LANE_ORDER) {
|
|
3970
|
+
const laneNode = element(doc, "section", "hive-skeleton-lane");
|
|
3971
|
+
laneNode.appendChild(element(doc, "div", "hive-skeleton-head", laneLabel(lane)));
|
|
3972
|
+
for (let row = 0; row < 3; row += 1) {
|
|
3973
|
+
laneNode.appendChild(element(doc, "div", "hive-skeleton-row", ""));
|
|
3974
|
+
}
|
|
3975
|
+
skeletonNode.appendChild(laneNode);
|
|
3976
|
+
}
|
|
3977
|
+
const loadingPanel = element(doc, "div", "hive-loading is-hidden");
|
|
3978
|
+
setAttr(loadingPanel, "role", "status");
|
|
3979
|
+
setAttr(loadingPanel, "aria-live", "polite");
|
|
3980
|
+
const loadingText = element(doc, "span", "hive-loading-text", "");
|
|
3981
|
+
const loadingRetry = element(doc, "button", "hive-btn hive-loading-retry", translate("loading.retry"));
|
|
3982
|
+
setAttr(loadingRetry, "type", "button");
|
|
3983
|
+
setAttr(loadingRetry, "title", translate("loading.retryAria"));
|
|
3984
|
+
setAttr(loadingRetry, "aria-label", translate("loading.retryAria"));
|
|
3985
|
+
loadingRetry.addEventListener("click", () => {
|
|
3986
|
+
beginLoading();
|
|
3987
|
+
void refresh();
|
|
3988
|
+
});
|
|
3989
|
+
loadingPanel.appendChild(loadingText);
|
|
3990
|
+
loadingPanel.appendChild(loadingRetry);
|
|
3991
|
+
stage.appendChild(skeletonNode);
|
|
3992
|
+
stage.appendChild(loadingPanel);
|
|
3910
3993
|
boardPane.appendChild(stage);
|
|
3911
3994
|
main.appendChild(boardPane);
|
|
3912
3995
|
|
|
@@ -5499,6 +5582,143 @@ export function mount(root, options = {}) {
|
|
|
5499
5582
|
* @param {object|null} run - normalized `lastRun` (see normalizeLastRun)
|
|
5500
5583
|
* @returns {HTMLElement}
|
|
5501
5584
|
*/
|
|
5585
|
+
function safeMarkdownHref(raw) {
|
|
5586
|
+
const href = asString(raw).trim();
|
|
5587
|
+
if (!href) return "";
|
|
5588
|
+
if (/^(https?:\/\/|mailto:)/i.test(href)) return href;
|
|
5589
|
+
if (href.startsWith("#") || href.startsWith("/")) return href;
|
|
5590
|
+
return "";
|
|
5591
|
+
}
|
|
5592
|
+
|
|
5593
|
+
function markdownTextNode(doc, text) {
|
|
5594
|
+
if (typeof doc.createTextNode === "function") return doc.createTextNode(text);
|
|
5595
|
+
const node = doc.createElement("span");
|
|
5596
|
+
node.textContent = text;
|
|
5597
|
+
return node;
|
|
5598
|
+
}
|
|
5599
|
+
|
|
5600
|
+
function appendInlineMarkdown(doc, parent, text) {
|
|
5601
|
+
const pattern = /(\x60[^\x60\n]+\x60|\*\*[^*\n]+\*\*|__[^_\n]+__|\*[^*\n]+\*|_[^_\n]+_|\[[^\]\n]+\]\([^)\n]+\))/g;
|
|
5602
|
+
let last = 0;
|
|
5603
|
+
let match = pattern.exec(text);
|
|
5604
|
+
while (match) {
|
|
5605
|
+
if (match.index > last) parent.appendChild(markdownTextNode(doc, text.slice(last, match.index)));
|
|
5606
|
+
const token = match[0];
|
|
5607
|
+
if (token.startsWith("\x60") && token.endsWith("\x60")) {
|
|
5608
|
+
parent.appendChild(element(doc, "code", "hive-md-code-inline", token.slice(1, -1)));
|
|
5609
|
+
} else if ((token.startsWith("**") && token.endsWith("**")) || (token.startsWith("__") && token.endsWith("__"))) {
|
|
5610
|
+
parent.appendChild(element(doc, "strong", null, token.slice(2, -2)));
|
|
5611
|
+
} else if ((token.startsWith("*") && token.endsWith("*")) || (token.startsWith("_") && token.endsWith("_"))) {
|
|
5612
|
+
parent.appendChild(element(doc, "em", null, token.slice(1, -1)));
|
|
5613
|
+
} else if (token.startsWith("[")) {
|
|
5614
|
+
const link = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(token);
|
|
5615
|
+
const href = link ? safeMarkdownHref(link[2]) : "";
|
|
5616
|
+
if (link && href) {
|
|
5617
|
+
const anchor = element(doc, "a", "hive-md-link", link[1]);
|
|
5618
|
+
setAttr(anchor, "href", href);
|
|
5619
|
+
setAttr(anchor, "rel", "noreferrer noopener");
|
|
5620
|
+
parent.appendChild(anchor);
|
|
5621
|
+
} else {
|
|
5622
|
+
parent.appendChild(markdownTextNode(doc, token));
|
|
5623
|
+
}
|
|
5624
|
+
} else {
|
|
5625
|
+
parent.appendChild(markdownTextNode(doc, token));
|
|
5626
|
+
}
|
|
5627
|
+
last = pattern.lastIndex;
|
|
5628
|
+
match = pattern.exec(text);
|
|
5629
|
+
}
|
|
5630
|
+
if (last < text.length) parent.appendChild(markdownTextNode(doc, text.slice(last)));
|
|
5631
|
+
}
|
|
5632
|
+
|
|
5633
|
+
function renderMarkdownInto(doc, host, source) {
|
|
5634
|
+
const lines = String(source).replace(/\r\n?/g, "\n").split("\n");
|
|
5635
|
+
let index = 0;
|
|
5636
|
+
let paragraph = [];
|
|
5637
|
+
const flushParagraph = () => {
|
|
5638
|
+
if (paragraph.length === 0) return;
|
|
5639
|
+
const p = element(doc, "p", "hive-md-p");
|
|
5640
|
+
appendInlineMarkdown(doc, p, paragraph.join("\n"));
|
|
5641
|
+
host.appendChild(p);
|
|
5642
|
+
paragraph = [];
|
|
5643
|
+
};
|
|
5644
|
+
|
|
5645
|
+
while (index < lines.length) {
|
|
5646
|
+
const line = lines[index];
|
|
5647
|
+
if (/^\s*\x60\x60\x60/.test(line)) {
|
|
5648
|
+
flushParagraph();
|
|
5649
|
+
const fence = /^\s*\x60\x60\x60\s*([^\s]*)/.exec(line);
|
|
5650
|
+
const language = fence ? fence[1] : "";
|
|
5651
|
+
const codeLines = [];
|
|
5652
|
+
index += 1;
|
|
5653
|
+
while (index < lines.length && !/^\s*\x60\x60\x60/.test(lines[index])) {
|
|
5654
|
+
codeLines.push(lines[index]);
|
|
5655
|
+
index += 1;
|
|
5656
|
+
}
|
|
5657
|
+
if (index < lines.length) index += 1;
|
|
5658
|
+
const pre = element(doc, "pre", "hive-md-code-block");
|
|
5659
|
+
if (language) setAttr(pre, "data-lang", language);
|
|
5660
|
+
const code = element(doc, "code", null, codeLines.join("\n"));
|
|
5661
|
+
pre.appendChild(code);
|
|
5662
|
+
host.appendChild(pre);
|
|
5663
|
+
continue;
|
|
5664
|
+
}
|
|
5665
|
+
if (/^\s*$/.test(line)) {
|
|
5666
|
+
flushParagraph();
|
|
5667
|
+
index += 1;
|
|
5668
|
+
continue;
|
|
5669
|
+
}
|
|
5670
|
+
const heading = /^\s*(#{1,6})\s+(.*)$/.exec(line);
|
|
5671
|
+
if (heading) {
|
|
5672
|
+
flushParagraph();
|
|
5673
|
+
const level = heading[1].length;
|
|
5674
|
+
const node = element(doc, "h" + String(level), "hive-md-heading");
|
|
5675
|
+
appendInlineMarkdown(doc, node, heading[2]);
|
|
5676
|
+
host.appendChild(node);
|
|
5677
|
+
index += 1;
|
|
5678
|
+
continue;
|
|
5679
|
+
}
|
|
5680
|
+
if (/^\s*>\s?/.test(line)) {
|
|
5681
|
+
flushParagraph();
|
|
5682
|
+
const quote = element(doc, "blockquote", "hive-md-quote");
|
|
5683
|
+
while (index < lines.length && /^\s*>\s?/.test(lines[index])) {
|
|
5684
|
+
const p = element(doc, "p", "hive-md-p");
|
|
5685
|
+
appendInlineMarkdown(doc, p, lines[index].replace(/^\s*>\s?/, ""));
|
|
5686
|
+
quote.appendChild(p);
|
|
5687
|
+
index += 1;
|
|
5688
|
+
}
|
|
5689
|
+
host.appendChild(quote);
|
|
5690
|
+
continue;
|
|
5691
|
+
}
|
|
5692
|
+
if (/^\s*[-*+]\s+/.test(line)) {
|
|
5693
|
+
flushParagraph();
|
|
5694
|
+
const list = element(doc, "ul", "hive-md-list");
|
|
5695
|
+
while (index < lines.length && /^\s*[-*+]\s+/.test(lines[index])) {
|
|
5696
|
+
const item = element(doc, "li", null);
|
|
5697
|
+
appendInlineMarkdown(doc, item, lines[index].replace(/^\s*[-*+]\s+/, ""));
|
|
5698
|
+
list.appendChild(item);
|
|
5699
|
+
index += 1;
|
|
5700
|
+
}
|
|
5701
|
+
host.appendChild(list);
|
|
5702
|
+
continue;
|
|
5703
|
+
}
|
|
5704
|
+
if (/^\s*\d+[.)]\s+/.test(line)) {
|
|
5705
|
+
flushParagraph();
|
|
5706
|
+
const list = element(doc, "ol", "hive-md-list");
|
|
5707
|
+
while (index < lines.length && /^\s*\d+[.)]\s+/.test(lines[index])) {
|
|
5708
|
+
const item = element(doc, "li", null);
|
|
5709
|
+
appendInlineMarkdown(doc, item, lines[index].replace(/^\s*\d+[.)]\s+/, ""));
|
|
5710
|
+
list.appendChild(item);
|
|
5711
|
+
index += 1;
|
|
5712
|
+
}
|
|
5713
|
+
host.appendChild(list);
|
|
5714
|
+
continue;
|
|
5715
|
+
}
|
|
5716
|
+
paragraph.push(line);
|
|
5717
|
+
index += 1;
|
|
5718
|
+
}
|
|
5719
|
+
flushParagraph();
|
|
5720
|
+
}
|
|
5721
|
+
|
|
5502
5722
|
function buildRunSection(run, actionHost) {
|
|
5503
5723
|
const section = element(doc, "div", "hive-card-run");
|
|
5504
5724
|
const addAction = (node) => {
|
|
@@ -5544,7 +5764,14 @@ export function mount(root, options = {}) {
|
|
|
5544
5764
|
? translate("drawer.runLessons").replace("{count}", String(lessonCount))
|
|
5545
5765
|
: translate("drawer.runNoLessons");
|
|
5546
5766
|
section.appendChild(element(doc, "div", "hive-card-run-meta", lessonsText));
|
|
5547
|
-
|
|
5767
|
+
const output = element(doc, "div", "hive-card-run-output hive-markdown");
|
|
5768
|
+
const outputText = asString(run.output);
|
|
5769
|
+
if (outputText.trim() === "") {
|
|
5770
|
+
output.appendChild(element(doc, "div", "hive-markdown-empty", translate("drawer.noOutput")));
|
|
5771
|
+
} else {
|
|
5772
|
+
renderMarkdownInto(doc, output, outputText);
|
|
5773
|
+
}
|
|
5774
|
+
section.appendChild(output);
|
|
5548
5775
|
const foot = element(doc, "div", "hive-card-run-foot");
|
|
5549
5776
|
const copy = element(doc, "button", "hive-btn hive-btn-ghost hive-card-run-copy", translate("drawer.copyOutput"));
|
|
5550
5777
|
setAttr(copy, "type", "button");
|
|
@@ -5590,7 +5817,6 @@ export function mount(root, options = {}) {
|
|
|
5590
5817
|
const id = card.id || translate("card.noId");
|
|
5591
5818
|
const role = asString(card.role) || "—";
|
|
5592
5819
|
const status = laneLabel(lane);
|
|
5593
|
-
const repo = lastModel ? lastModel.repo : "";
|
|
5594
5820
|
const ariaLabel = translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled"));
|
|
5595
5821
|
|
|
5596
5822
|
const dialog = element(doc, "dialog", "hive-dialog hive-card-dialog hive-drawer");
|
|
@@ -5603,7 +5829,7 @@ export function mount(root, options = {}) {
|
|
|
5603
5829
|
const titleBox = element(doc, "div", "hive-dialog-head-title");
|
|
5604
5830
|
titleBox.appendChild(element(doc, "h2", "hive-dialog-title", title));
|
|
5605
5831
|
const subline = element(doc, "div", "hive-card-subline");
|
|
5606
|
-
const sublineText = [id, role, status
|
|
5832
|
+
const sublineText = [id, role, status].filter(Boolean).join(" · ");
|
|
5607
5833
|
subline.textContent = sublineText;
|
|
5608
5834
|
setAttr(subline, "title", sublineText);
|
|
5609
5835
|
titleBox.appendChild(subline);
|
|
@@ -5616,14 +5842,40 @@ export function mount(root, options = {}) {
|
|
|
5616
5842
|
|
|
5617
5843
|
const body = element(doc, "div", "hive-dialog-body hive-card-body");
|
|
5618
5844
|
if (Array.isArray(card.scope) && card.scope.length > 0) {
|
|
5619
|
-
const
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5845
|
+
const scopeBlock = element(doc, "div", "hive-scope-block");
|
|
5846
|
+
scopeBlock.appendChild(element(doc, "div", "hive-scope-title", translate("drawer.scopeTitle")));
|
|
5847
|
+
scopeBlock.appendChild(element(doc, "div", "hive-scope-hint", translate("drawer.scopeHint")));
|
|
5848
|
+
const scopeList = element(doc, "div", "hive-scope-list");
|
|
5849
|
+
const scopes = card.scope.filter((scope) => asString(scope) !== "");
|
|
5850
|
+
const visibleScopes = scopes.slice(0, 5);
|
|
5851
|
+
for (const scope of visibleScopes) {
|
|
5852
|
+
const path = element(doc, "code", "hive-scope-path", asString(scope));
|
|
5853
|
+
setAttr(path, "title", asString(scope));
|
|
5854
|
+
scopeList.appendChild(path);
|
|
5855
|
+
}
|
|
5856
|
+
const hiddenScopes = scopes.slice(5);
|
|
5857
|
+
if (hiddenScopes.length > 0) {
|
|
5858
|
+
const more = element(
|
|
5859
|
+
doc,
|
|
5860
|
+
"button",
|
|
5861
|
+
"hive-btn hive-btn-ghost hive-scope-more",
|
|
5862
|
+
translate("drawer.scopeMore").replace("{count}", String(hiddenScopes.length)),
|
|
5863
|
+
);
|
|
5864
|
+
setAttr(more, "type", "button");
|
|
5865
|
+
more.addEventListener("click", () => {
|
|
5866
|
+
for (const scope of hiddenScopes) {
|
|
5867
|
+
const path = element(doc, "code", "hive-scope-path", asString(scope));
|
|
5868
|
+
setAttr(path, "title", asString(scope));
|
|
5869
|
+
scopeList.appendChild(path);
|
|
5870
|
+
}
|
|
5871
|
+
more.parentNode.removeChild(more);
|
|
5872
|
+
});
|
|
5873
|
+
scopeList.appendChild(more);
|
|
5624
5874
|
}
|
|
5625
|
-
|
|
5875
|
+
scopeBlock.appendChild(scopeList);
|
|
5876
|
+
body.appendChild(scopeBlock);
|
|
5626
5877
|
}
|
|
5878
|
+
|
|
5627
5879
|
const runActions = [];
|
|
5628
5880
|
body.appendChild(buildRunSection(card.lastRun, runActions));
|
|
5629
5881
|
dialog.appendChild(body);
|
|
@@ -6363,8 +6615,7 @@ export function mount(root, options = {}) {
|
|
|
6363
6615
|
|
|
6364
6616
|
function renderCard(card, lane, existing) {
|
|
6365
6617
|
const node = existing || element(doc, "article", "hive-card");
|
|
6366
|
-
const
|
|
6367
|
-
const title = taskDisplayTitle(fullTitle);
|
|
6618
|
+
const title = card.title || translate("card.untitled");
|
|
6368
6619
|
if (!existing) {
|
|
6369
6620
|
setAttr(node, "tabindex", "0");
|
|
6370
6621
|
setAttr(node, "role", "button");
|
|
@@ -6382,8 +6633,8 @@ export function mount(root, options = {}) {
|
|
|
6382
6633
|
node._hiveCard = card;
|
|
6383
6634
|
node._hiveLane = lane;
|
|
6384
6635
|
node._hiveTitle.textContent = title;
|
|
6385
|
-
setAttr(node, "aria-label", translate("card.openAria") + " " +
|
|
6386
|
-
setAttr(node, "title",
|
|
6636
|
+
setAttr(node, "aria-label", translate("card.openAria") + " " + title);
|
|
6637
|
+
setAttr(node, "title", title);
|
|
6387
6638
|
return node;
|
|
6388
6639
|
}
|
|
6389
6640
|
function renderStageChips(model) {
|
|
@@ -6660,6 +6911,7 @@ export function mount(root, options = {}) {
|
|
|
6660
6911
|
closeHelp(false);
|
|
6661
6912
|
openHelp();
|
|
6662
6913
|
}
|
|
6914
|
+
finishLoading();
|
|
6663
6915
|
return model;
|
|
6664
6916
|
}
|
|
6665
6917
|
|
|
@@ -6686,6 +6938,7 @@ export function mount(root, options = {}) {
|
|
|
6686
6938
|
if (!destroyed) {
|
|
6687
6939
|
setStatus("status.disconnected", "error");
|
|
6688
6940
|
reportError(error);
|
|
6941
|
+
if (!lastModel || loadingActive) failLoading(error);
|
|
6689
6942
|
}
|
|
6690
6943
|
}
|
|
6691
6944
|
}
|
|
@@ -6729,6 +6982,7 @@ export function mount(root, options = {}) {
|
|
|
6729
6982
|
unschedule(timer);
|
|
6730
6983
|
timer = null;
|
|
6731
6984
|
}
|
|
6985
|
+
stopLoadingTimer();
|
|
6732
6986
|
if (typeof doc.removeEventListener === "function") {
|
|
6733
6987
|
doc.removeEventListener("visibilitychange", onVisibilityChange);
|
|
6734
6988
|
}
|
|
@@ -6795,6 +7049,84 @@ export function mount(root, options = {}) {
|
|
|
6795
7049
|
}
|
|
6796
7050
|
}
|
|
6797
7051
|
|
|
7052
|
+
|
|
7053
|
+
function setLoadingInteractions(disabled) {
|
|
7054
|
+
frame.className =
|
|
7055
|
+
"hive" +
|
|
7056
|
+
(disabled ? " is-loading" : "") +
|
|
7057
|
+
(lastModel && lastModel.initialised === false ? " is-uninitialised" : "");
|
|
7058
|
+
setAttr(stage, "aria-busy", disabled ? "true" : "false");
|
|
7059
|
+
for (const child of actionsNode.children) {
|
|
7060
|
+
if ("disabled" in child) child.disabled = disabled;
|
|
7061
|
+
}
|
|
7062
|
+
agentsCount.disabled = disabled;
|
|
7063
|
+
}
|
|
7064
|
+
|
|
7065
|
+
function showSkeletonStats() {
|
|
7066
|
+
clearNode(statsNode);
|
|
7067
|
+
for (let index = 0; index < 2; index += 1) {
|
|
7068
|
+
statsNode.appendChild(element(doc, "span", "hive-skeleton-pill", ""));
|
|
7069
|
+
}
|
|
7070
|
+
agentsCount.textContent = "…";
|
|
7071
|
+
agentsCount.disabled = true;
|
|
7072
|
+
queenBadge.className = "hive-queen-badge is-hidden";
|
|
7073
|
+
}
|
|
7074
|
+
|
|
7075
|
+
function showLoadingPanel(text) {
|
|
7076
|
+
loadingText.textContent = text;
|
|
7077
|
+
loadingPanel.className = "hive-loading";
|
|
7078
|
+
}
|
|
7079
|
+
|
|
7080
|
+
function stopLoadingTimer() {
|
|
7081
|
+
if (loadingTimer === null) return;
|
|
7082
|
+
clearScheduledTimeout(loadingTimer);
|
|
7083
|
+
loadingTimer = null;
|
|
7084
|
+
}
|
|
7085
|
+
|
|
7086
|
+
function loadingTick() {
|
|
7087
|
+
if (!loadingActive || destroyed) return;
|
|
7088
|
+
loadingTicks += 1;
|
|
7089
|
+
if (loadingTicks >= 5) {
|
|
7090
|
+
showLoadingPanel(translate("loading.slow").replace("{seconds}", String(loadingTicks)));
|
|
7091
|
+
}
|
|
7092
|
+
loadingTimer = scheduleTimeout(loadingTick, 1000);
|
|
7093
|
+
}
|
|
7094
|
+
|
|
7095
|
+
function beginLoading() {
|
|
7096
|
+
if (destroyed) return;
|
|
7097
|
+
loadingActive = true;
|
|
7098
|
+
loadingTicks = 0;
|
|
7099
|
+
loadingPanelError = "";
|
|
7100
|
+
loadingPanel.className = "hive-loading is-hidden";
|
|
7101
|
+
loadingBadge.className = "hive-loading-badge";
|
|
7102
|
+
loadingBadge.textContent = translate("loading.label");
|
|
7103
|
+
skeletonNode.className = "hive-skeleton";
|
|
7104
|
+
showSkeletonStats();
|
|
7105
|
+
setLoadingInteractions(true);
|
|
7106
|
+
stopLoadingTimer();
|
|
7107
|
+
loadingTimer = scheduleTimeout(loadingTick, 1000);
|
|
7108
|
+
}
|
|
7109
|
+
|
|
7110
|
+
function finishLoading() {
|
|
7111
|
+
loadingActive = false;
|
|
7112
|
+
loadingPanelError = "";
|
|
7113
|
+
stopLoadingTimer();
|
|
7114
|
+
skeletonNode.className = "hive-skeleton is-hidden";
|
|
7115
|
+
loadingPanel.className = "hive-loading is-hidden";
|
|
7116
|
+
loadingBadge.className = "hive-loading-badge is-hidden";
|
|
7117
|
+
setLoadingInteractions(false);
|
|
7118
|
+
}
|
|
7119
|
+
|
|
7120
|
+
function failLoading(error) {
|
|
7121
|
+
loadingActive = false;
|
|
7122
|
+
stopLoadingTimer();
|
|
7123
|
+
const detail = asString(error && error.message) || translate("loading.failed");
|
|
7124
|
+
loadingPanelError = detail;
|
|
7125
|
+
showLoadingPanel(translate("loading.failed") + ": " + detail);
|
|
7126
|
+
loadingBadge.className = "hive-loading-badge is-hidden";
|
|
7127
|
+
setLoadingInteractions(true);
|
|
7128
|
+
}
|
|
7129
|
+
|
|
6798
7130
|
function stopPolling() {
|
|
6799
7131
|
if (timer === null) return;
|
|
6800
7132
|
unschedule(timer);
|
|
@@ -6821,6 +7153,7 @@ export function mount(root, options = {}) {
|
|
|
6821
7153
|
if (typeof doc.addEventListener === "function") {
|
|
6822
7154
|
doc.addEventListener("visibilitychange", onVisibilityChange);
|
|
6823
7155
|
}
|
|
7156
|
+
beginLoading();
|
|
6824
7157
|
startPolling();
|
|
6825
7158
|
void refresh();
|
|
6826
7159
|
|