@d86e/hive-panel 1.0.9 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d86e/hive-panel",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "A read-only board for a Hive swarm: agents, task lanes and the event tail, served from the refs and files you already have.",
5
5
  "type": "module",
6
6
  "bin": {
package/public/panel.css CHANGED
@@ -1169,3 +1169,23 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
1169
1169
  .hive-markdown .hive-md-link { color: var(--hive-accent); text-decoration: underline; text-underline-offset: 2px; }
1170
1170
  .hive-markdown .hive-markdown-empty { color: var(--hive-fg-faint); font-size: 12px; }
1171
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
@@ -2052,6 +2052,24 @@ dialog.hive-dialog .hive-dialog-body { flex: 1 1 auto; min-height: 0; overflow:
2052
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
2053
  .hive-markdown .hive-md-link { color: var(--hive-accent); text-decoration: underline; text-underline-offset: 2px; }
2054
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; }
2055
2073
  `;
2056
2074
 
2057
2075
  const LANE_LABEL_KEYS = Object.freeze({
@@ -2110,6 +2128,7 @@ export const messages = Object.freeze({
2110
2128
  "status.actionFailed": "action failed",
2111
2129
  "status.disconnected": "disconnected",
2112
2130
  "loading.updating": "Updating",
2131
+ "loading.label": "Loading",
2113
2132
  "loading.slow": "Loading · waited {seconds}s",
2114
2133
  "loading.failed": "Could not load",
2115
2134
  "loading.retry": "Retry",
@@ -2145,6 +2164,9 @@ export const messages = Object.freeze({
2145
2164
  "drawer.rawJson": "raw json",
2146
2165
  "drawer.lastRun": "Last run",
2147
2166
  "drawer.noOutput": "(no output)",
2167
+ "drawer.scopeTitle": "Work scope",
2168
+ "drawer.scopeHint": "Directories/files this task changes.",
2169
+ "drawer.scopeMore": "+{count} items",
2148
2170
  "drawer.runOverlaps": "Also writing",
2149
2171
  "drawer.runLessons": "Read {count} lessons",
2150
2172
  "drawer.runNoLessons": "No lessons to read",
@@ -2381,6 +2403,7 @@ export const messages = Object.freeze({
2381
2403
  "status.actionFailed": "操作失败",
2382
2404
  "status.disconnected": "连接断开",
2383
2405
  "loading.updating": "更新中",
2406
+ "loading.label": "加载中",
2384
2407
  "loading.slow": "正在读取 · 已等 {seconds}s",
2385
2408
  "loading.failed": "读取失败",
2386
2409
  "loading.retry": "重试",
@@ -2416,6 +2439,9 @@ export const messages = Object.freeze({
2416
2439
  "drawer.rawJson": "原始 JSON",
2417
2440
  "drawer.lastRun": "最近一次执行",
2418
2441
  "drawer.noOutput": "(无输出)",
2442
+ "drawer.scopeTitle": "工作范围",
2443
+ "drawer.scopeHint": "这个任务改动的目录/文件",
2444
+ "drawer.scopeMore": "+{count} 项",
2419
2445
  "drawer.runOverlaps": "同时写入",
2420
2446
  "drawer.runLessons": "读取了 {count} 条经验",
2421
2447
  "drawer.runNoLessons": "没有可读取的经验",
@@ -3687,6 +3713,10 @@ export function mount(root, options = {}) {
3687
3713
  typeof view.setInterval === "function" ? view.setInterval.bind(view) : globalThis.setInterval.bind(globalThis);
3688
3714
  const unschedule =
3689
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);
3690
3720
 
3691
3721
  const translator = typeof opts.t === "function" ? opts.t : null;
3692
3722
 
@@ -3718,6 +3748,10 @@ export function mount(root, options = {}) {
3718
3748
  let refreshPromise = null;
3719
3749
  let lastSnapshot = null;
3720
3750
  let lastModel = null;
3751
+ let loadingActive = false;
3752
+ let loadingTicks = 0;
3753
+ let loadingTimer = null;
3754
+ let loadingPanelError = "";
3721
3755
  let drawerNode = null;
3722
3756
  let drawerState = null;
3723
3757
  let drawerTrigger = null;
@@ -3816,6 +3850,10 @@ export function mount(root, options = {}) {
3816
3850
  const statusNode = element(doc, "span", "hive-status", "");
3817
3851
  bar.appendChild(statusNode);
3818
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
+
3819
3857
  const actionGroup = element(doc, "div", "hive-action-group");
3820
3858
  const actionsNode = element(doc, "div", "hive-actions");
3821
3859
  actionGroup.appendChild(actionsNode);
@@ -3927,6 +3965,31 @@ export function mount(root, options = {}) {
3927
3965
  stage.appendChild(stageChips);
3928
3966
  stage.appendChild(filterEmpty);
3929
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);
3930
3993
  boardPane.appendChild(stage);
3931
3994
  main.appendChild(boardPane);
3932
3995
 
@@ -5754,7 +5817,6 @@ function renderMarkdownInto(doc, host, source) {
5754
5817
  const id = card.id || translate("card.noId");
5755
5818
  const role = asString(card.role) || "—";
5756
5819
  const status = laneLabel(lane);
5757
- const repo = lastModel ? lastModel.repo : "";
5758
5820
  const ariaLabel = translate("drawer.cardAria") + " " + (card.title || card.id || translate("card.untitled"));
5759
5821
 
5760
5822
  const dialog = element(doc, "dialog", "hive-dialog hive-card-dialog hive-drawer");
@@ -5767,7 +5829,7 @@ function renderMarkdownInto(doc, host, source) {
5767
5829
  const titleBox = element(doc, "div", "hive-dialog-head-title");
5768
5830
  titleBox.appendChild(element(doc, "h2", "hive-dialog-title", title));
5769
5831
  const subline = element(doc, "div", "hive-card-subline");
5770
- const sublineText = [id, role, status, repo].filter(Boolean).join(" · ");
5832
+ const sublineText = [id, role, status].filter(Boolean).join(" · ");
5771
5833
  subline.textContent = sublineText;
5772
5834
  setAttr(subline, "title", sublineText);
5773
5835
  titleBox.appendChild(subline);
@@ -5780,14 +5842,40 @@ function renderMarkdownInto(doc, host, source) {
5780
5842
 
5781
5843
  const body = element(doc, "div", "hive-dialog-body hive-card-body");
5782
5844
  if (Array.isArray(card.scope) && card.scope.length > 0) {
5783
- const drawerScopes = element(doc, "div", "hive-scopes");
5784
- for (const scope of card.scope) {
5785
- const chip = element(doc, "span", "hive-scope", scope);
5786
- setAttr(chip, "title", scope);
5787
- drawerScopes.appendChild(chip);
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);
5788
5874
  }
5789
- body.appendChild(drawerScopes);
5875
+ scopeBlock.appendChild(scopeList);
5876
+ body.appendChild(scopeBlock);
5790
5877
  }
5878
+
5791
5879
  const runActions = [];
5792
5880
  body.appendChild(buildRunSection(card.lastRun, runActions));
5793
5881
  dialog.appendChild(body);
@@ -6823,6 +6911,7 @@ function renderMarkdownInto(doc, host, source) {
6823
6911
  closeHelp(false);
6824
6912
  openHelp();
6825
6913
  }
6914
+ finishLoading();
6826
6915
  return model;
6827
6916
  }
6828
6917
 
@@ -6849,6 +6938,7 @@ function renderMarkdownInto(doc, host, source) {
6849
6938
  if (!destroyed) {
6850
6939
  setStatus("status.disconnected", "error");
6851
6940
  reportError(error);
6941
+ if (!lastModel || loadingActive) failLoading(error);
6852
6942
  }
6853
6943
  }
6854
6944
  }
@@ -6892,6 +6982,7 @@ function renderMarkdownInto(doc, host, source) {
6892
6982
  unschedule(timer);
6893
6983
  timer = null;
6894
6984
  }
6985
+ stopLoadingTimer();
6895
6986
  if (typeof doc.removeEventListener === "function") {
6896
6987
  doc.removeEventListener("visibilitychange", onVisibilityChange);
6897
6988
  }
@@ -6958,6 +7049,84 @@ function renderMarkdownInto(doc, host, source) {
6958
7049
  }
6959
7050
  }
6960
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
+
6961
7130
  function stopPolling() {
6962
7131
  if (timer === null) return;
6963
7132
  unschedule(timer);
@@ -6984,6 +7153,7 @@ function renderMarkdownInto(doc, host, source) {
6984
7153
  if (typeof doc.addEventListener === "function") {
6985
7154
  doc.addEventListener("visibilitychange", onVisibilityChange);
6986
7155
  }
7156
+ beginLoading();
6987
7157
  startPolling();
6988
7158
  void refresh();
6989
7159