@songsid/agend 2.4.0-beta.16 → 2.4.0-beta.17

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.
Files changed (112) hide show
  1. package/dist/auth-api.js +2 -0
  2. package/dist/auth-api.js.map +1 -1
  3. package/dist/backend/claude-code.d.ts +10 -1
  4. package/dist/backend/claude-code.js +1 -0
  5. package/dist/backend/claude-code.js.map +1 -1
  6. package/dist/backend/types.d.ts +6 -0
  7. package/dist/backend/types.js.map +1 -1
  8. package/dist/build-provenance.json +1 -1
  9. package/dist/claude-credential-launch.d.ts +1 -0
  10. package/dist/claude-credential-launch.js +13 -2
  11. package/dist/claude-credential-launch.js.map +1 -1
  12. package/dist/claude-credential-vault.d.ts +7 -1
  13. package/dist/claude-credential-vault.js +26 -1
  14. package/dist/claude-credential-vault.js.map +1 -1
  15. package/dist/claude-request-observation.d.ts +7 -0
  16. package/dist/claude-request-observation.js +26 -0
  17. package/dist/claude-request-observation.js.map +1 -0
  18. package/dist/cli-audited.js +8 -6
  19. package/dist/cli-audited.js.map +1 -1
  20. package/dist/daemon.js +6 -0
  21. package/dist/daemon.js.map +1 -1
  22. package/dist/fleet-manager.d.ts +14 -0
  23. package/dist/fleet-manager.js +128 -3
  24. package/dist/fleet-manager.js.map +1 -1
  25. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +9 -3
  26. package/dist/host-monitoring-config.d.ts +2 -1
  27. package/dist/host-monitoring-config.js +8 -3
  28. package/dist/host-monitoring-config.js.map +1 -1
  29. package/dist/host-monitoring-history-files.d.ts +2 -0
  30. package/dist/host-monitoring-history-files.js +16 -0
  31. package/dist/host-monitoring-history-files.js.map +1 -0
  32. package/dist/host-monitoring-history-policy.d.ts +55 -0
  33. package/dist/host-monitoring-history-policy.js +93 -0
  34. package/dist/host-monitoring-history-policy.js.map +1 -0
  35. package/dist/host-monitoring-history-store.d.ts +52 -0
  36. package/dist/host-monitoring-history-store.js +176 -0
  37. package/dist/host-monitoring-history-store.js.map +1 -0
  38. package/dist/host-monitoring-history-worker.d.ts +1 -0
  39. package/dist/host-monitoring-history-worker.js +50 -0
  40. package/dist/host-monitoring-history-worker.js.map +1 -0
  41. package/dist/host-monitoring-history.d.ts +71 -0
  42. package/dist/host-monitoring-history.js +265 -0
  43. package/dist/host-monitoring-history.js.map +1 -0
  44. package/dist/host-monitoring-platform.d.ts +73 -0
  45. package/dist/host-monitoring-platform.js +273 -0
  46. package/dist/host-monitoring-platform.js.map +1 -0
  47. package/dist/host-monitoring-runtime.d.ts +34 -0
  48. package/dist/host-monitoring-runtime.js +80 -0
  49. package/dist/host-monitoring-runtime.js.map +1 -0
  50. package/dist/host-monitoring-settings-store.d.ts +5 -0
  51. package/dist/host-monitoring-settings-store.js +49 -0
  52. package/dist/host-monitoring-settings-store.js.map +1 -0
  53. package/dist/host-monitoring.d.ts +106 -0
  54. package/dist/host-monitoring.js +157 -0
  55. package/dist/host-monitoring.js.map +1 -0
  56. package/dist/public-web-gateway.js +4 -0
  57. package/dist/public-web-gateway.js.map +1 -1
  58. package/dist/runtime-cli-install.js +17 -16
  59. package/dist/runtime-cli-install.js.map +1 -1
  60. package/dist/settings-api.d.ts +3 -0
  61. package/dist/settings-api.js +14 -7
  62. package/dist/settings-api.js.map +1 -1
  63. package/dist/settings-baseline.d.ts +1 -0
  64. package/dist/settings-baseline.js +5 -4
  65. package/dist/settings-baseline.js.map +1 -1
  66. package/dist/settings-change.js +8 -0
  67. package/dist/settings-change.js.map +1 -1
  68. package/dist/settings-effect.d.ts +2 -0
  69. package/dist/settings-effect.js +5 -3
  70. package/dist/settings-effect.js.map +1 -1
  71. package/dist/transcript-monitor.d.ts +1 -0
  72. package/dist/transcript-monitor.js +18 -0
  73. package/dist/transcript-monitor.js.map +1 -1
  74. package/dist/ui/accounts-view.js +7 -5
  75. package/dist/ui/claude-credentials.js +12 -1
  76. package/dist/ui/fleet-office-pack.js +2 -2
  77. package/dist/ui/fleet-office-play.js +142 -3
  78. package/dist/ui/fleet-office-skin.js +67 -2
  79. package/dist/ui/fleet-office-store.js +41 -0
  80. package/dist/ui/fleet-office-zones.js +15 -8
  81. package/dist/ui/fleet-office.js +126 -21
  82. package/dist/ui/host-health-model.js +42 -0
  83. package/dist/ui/host-health.js +74 -0
  84. package/dist/ui/panel-chat.js +99 -43
  85. package/dist/ui/panel-fleet.js +24 -11
  86. package/dist/ui/panel-hub.js +5 -1
  87. package/dist/ui/panel-settings.js +3 -3
  88. package/dist/ui/search-dialog.js +8 -1
  89. package/dist/ui/settings-capabilities.js +2 -0
  90. package/dist/ui/settings-host-monitoring.js +31 -13
  91. package/dist/ui/settings-registry.js +4 -1
  92. package/dist/ui/shared/accounts.css +8 -4
  93. package/dist/ui/shared/agent-sheet.js +5 -2
  94. package/dist/ui/shared/app-route.js +1 -1
  95. package/dist/ui/shared/app.css +37 -0
  96. package/dist/ui/shared/app.js +1 -0
  97. package/dist/ui/shared/chat-strings.js +2 -2
  98. package/dist/ui/shared/chat-thread.js +42 -10
  99. package/dist/ui/shared/instance-nav.js +47 -5
  100. package/dist/ui/shared/jump-idle.js +36 -0
  101. package/dist/ui/shared/theme.js +6 -2
  102. package/dist/ui/shared/ui-menu.js +17 -11
  103. package/dist/web-api.d.ts +2 -0
  104. package/dist/web-api.js +54 -0
  105. package/dist/web-api.js.map +1 -1
  106. package/dist/web-chat-history.d.ts +7 -1
  107. package/dist/web-chat-history.js +19 -3
  108. package/dist/web-chat-history.js.map +1 -1
  109. package/dist/web-shell-routes.d.ts +1 -1
  110. package/dist/web-shell-routes.js +1 -1
  111. package/dist/web-shell-routes.js.map +1 -1
  112. package/package.json +1 -1
@@ -551,6 +551,7 @@ html:has(.shell), html:has(.shell) body { overflow: hidden; }
551
551
  /* M-2542: Fleet's tabs on its title row — the title, then the tabs (scrolling sideways if they do not fit), then the
552
552
  header's tools; under 900 px a row of their own under the header, as the instance tabs. Never wider than the page. */
553
553
  .p-fleet .panel-head .panel-title:has(+ .fleet-tabs) { flex: 0 1 auto; } /* M-2542: only when everything fits (panel-fleet) */
554
+ .p-fleet > .fleet-tabs-row { max-width: none; } /* The full tab inventory can exceed the default content column. */
554
555
  .fleet-tabs { display: flex; gap: var(--s-1); flex: 1 1 auto; min-width: 0; overflow-x: auto; }
555
556
  .panel-head .fleet-tabs .seg-item { min-height: 36px; flex-shrink: 0; }
556
557
  @media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
@@ -1292,7 +1293,12 @@ img.amb-p { object-fit: contain; }
1292
1293
  position: absolute; bottom: var(--s-3); left: 50%; transform: translateX(-50%); white-space: nowrap; display: inline-flex; align-items: center; gap: var(--s-1);
1293
1294
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-full); box-shadow: var(--shadow-2);
1294
1295
  padding: 6px var(--s-4); font-size: var(--fs-xs); font-weight: var(--fw-semibold); cursor: pointer;
1296
+ transition: opacity 200ms ease;
1295
1297
  }
1298
+ /* M-3492: after JUMP_IDLE_MS without a scroll it fades out and lets taps through to the bubble under it; it stays in the
1299
+ tab order and the accessibility tree, and keyboard focus shows it again. Reduced motion: no fade, just gone. */
1300
+ .jump-latest.is-idle:not(:focus-visible) { opacity: 0; pointer-events: none; }
1301
+ @media (prefers-reduced-motion: reduce) { .jump-latest { transition: none; } }
1296
1302
  .dock { flex-shrink: 0; padding: 0 max(var(--s-5), env(safe-area-inset-right)) max(var(--s-3), env(safe-area-inset-bottom)) max(var(--s-5), env(safe-area-inset-left)); }
1297
1303
  .dock-col { max-width: var(--col); margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-2); }
1298
1304
  .prompts { display: flex; flex-direction: column; gap: var(--s-2); }
@@ -5093,3 +5099,34 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
5093
5099
  .credential-dialog .dlg-head, .credential-dialog .dlg-actions { flex: 0 0 auto; }
5094
5100
  .credential-dialog .dlg-body { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; scroll-padding-block: var(--s-4); padding-bottom: var(--s-6); }
5095
5101
  .credential-dialog .dlg-body > * { flex-shrink: 0; }
5102
+
5103
+ /* M3454/S207: Host health uses the Fleet cards and shared page head. */
5104
+ .host-health { min-width: 0; }
5105
+ .host-health .s-page-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
5106
+ .host-health :is(.host-sample-time, .host-load-value) { display: inline-block; white-space: nowrap; overflow-wrap: normal; }
5107
+ .host-health .host-pressure-value { white-space: nowrap; overflow-wrap: normal; }
5108
+ .host-health .host-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
5109
+ .host-health .host-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
5110
+ .host-health .host-compute { display: contents; }
5111
+ .host-health .host-storage { grid-column: 1; grid-row: 1; }
5112
+ .host-health .host-space-meter { display: block; width: 100%; height: 8px; margin: 12px 0; accent-color: var(--accent); }
5113
+ .host-health .host-chart circle { fill: var(--accent); }
5114
+ .host-health .card { min-width: 0; }
5115
+ .host-health h3, .host-health h4 { margin: 0 0 12px; }
5116
+ .host-health .host-value { margin: 8px 0; font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text); overflow-wrap: anywhere; }
5117
+ .host-health .host-range { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
5118
+ .host-health .host-range .active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
5119
+ .host-health .host-volume + .host-volume { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
5120
+ .host-health .host-chart { min-width: 0; margin: 16px 0 0; }
5121
+ .host-health .host-chart figcaption { font-size: var(--fs-sm); color: var(--text-2); }
5122
+ .host-health .host-chart svg { display: block; width: 100%; height: auto; max-height: 150px; overflow: visible; margin: 8px 0; }
5123
+ .host-health .host-chart polyline { stroke: var(--accent); stroke-width: 2; fill: none; vector-effect: non-scaling-stroke; }
5124
+ .host-health .host-chart line { stroke: var(--border); vector-effect: non-scaling-stroke; }
5125
+ .host-health .host-chart .note { margin: 4px 0; }
5126
+ .host-health .host-no-history { padding: 20px 0; }
5127
+ @media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
5128
+ .host-health .host-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
5129
+ .host-health .host-storage { grid-row: 1; grid-column: 1 / -1; }
5130
+ .host-health .s-page-actions { width: 100%; }
5131
+ .host-health .btn { min-height: 44px; min-width: 44px; }
5132
+ }
@@ -83,6 +83,7 @@ if (hubPage) {
83
83
  // The chat store this page booted — whichever import succeeded (a Retry loads ?retry=<n>) — is the page's one owner
84
84
  // of its prompts; Needs you finds it here and never imports the chat itself (#1463 review).
85
85
  appStore.set({ chatOwner: m.boot({ stream, boot }) });
86
+ appStore.set({ sidebarChatMenu: !guestPage() && m.SidebarChatMenu?.contextVersion === 1 ? m.SidebarChatMenu : null });
86
87
  // Loaded only after the stream opened (a Retry): the frames sent on connect never reached it — catch up once.
87
88
  if (stream.started()) stream.catchUp();
88
89
  return m;
@@ -32,7 +32,7 @@ register("chat", {
32
32
  sendFailure_wake_capacity: "No slot is free to wake this instance. Retry when another instance is idle.",
33
33
  sendFailure_wake_credentials: "The instance could not sign in. Connect its AI account in Settings → AI accounts & keys → Accounts, or send /login in chat, then retry.",
34
34
  sendFailure_wake_timeout: "The instance did not become ready in time. Retry, or check its status in Fleet.",
35
- sendFailure_instance_stopped: "This instance was stopped or removed. Start it from the agent's chat menu → Start instance, then retry.",
35
+ sendFailure_instance_stopped: "This instance was stopped or removed. Start it from the agent's chat menu → Start agent, then retry.",
36
36
  sendFailure_delivery_unavailable: "The instance could not receive this message. Check its status in Fleet, then retry.",
37
37
  sendFailure_machine_limit: "This Windows computer already runs its limit of {0} agents: {1}. Stop one of them (or check and unlock one marked “outcome unknown”), then retry.",
38
38
  machineLimitUnknown: "{0} (outcome unknown)",
@@ -153,7 +153,7 @@ register("chat", {
153
153
  noMessages: "Type a task below.",
154
154
  guestAllHidden: "Nothing here you can see yet", guestAllHiddenHint: "This agent's recent activity is between agents, which guests don't see. Its chat appears here when someone talks in its channel.",
155
155
  pick: "Choose an agent to start chatting.", noAgents: "Create an agent to start chatting.", newAgent: "New agent", notFound: "No instance called “{0}”", notFoundHint: "It may have been deleted or renamed.", backToList: "Choose an agent",
156
- details: "Instance details", fullWidth: "Full width", start: "Start instance", stopInstance: "Stop instance", restart: "Restart instance", delete: "Delete instance…",
156
+ details: "Agent details", fullWidth: "Full width", start: "Start agent", stopInstance: "Stop agent", restart: "Restart agent", delete: "Delete agent…",
157
157
  started: "{0} started", stoppedInst: "{0} stopped", restarted: "{0} restarted", instanceDeleted: "{0} was deleted",
158
158
  deleteTitle: "Delete {0}?", deleteHelp: "This removes the instance from the fleet and stops it, and deletes its chat topic (on Discord, its channel and history). Its working directory is kept. Type “delete {0}” to confirm.", deleteGo: "Delete", cancel: "Cancel",
159
159
  loadFailed: "Failed to load", tour: "Chat tour", tourBtnTitle: "Show the chat tour on an agent's chat", tourNoAgent: "Choose an agent before opening the chat tour.",
@@ -760,17 +760,47 @@ export function createThread(list, scroller, opts) {
760
760
  * a line with more than two rows always overflows (data-lines). Nothing laid out (no width): the guess it was drawn with.
761
761
  */
762
762
  function fitStatus() {
763
- for (const m of list.querySelectorAll(".msg.status-line.folded")) {
764
- const btn = m.querySelector(".st-more");
765
- if (!btn || btn.dataset.lines) continue;
766
- let measured = false, over = false;
767
- for (const row of [...m.querySelectorAll(".st-ln")].slice(0, STATUS_FOLD_LINES)) {
768
- if (!row.clientWidth) continue;
769
- measured = true;
770
- if (row.scrollWidth > row.clientWidth + 1) over = true;
771
- }
772
- if (measured && m.classList.contains("overflows") !== over) m.classList.toggle("overflows", over);
763
+ for (const m of list.querySelectorAll(".msg.status-line.folded")) if (!fitLine(m)) stale.add(m);
764
+ if (stale.size) watchStale();
765
+ }
766
+ /**
767
+ * One folded line; false when it was not measured because its contents are skipped. M-3486: a line whose contents the
768
+ * browser is skipping (content-visibility on the row while the split divider is dragged, #4277) is not measured:
769
+ * reading a size inside it lays that row out on its own, then locks it again — once per line, each frame (4,560 forced
770
+ * layouts in one drag of two real chats). It keeps its last answer until it is shown again (watchStale).
771
+ */
772
+ function fitLine(m) {
773
+ const btn = m.querySelector(".st-more");
774
+ if (!btn || btn.dataset.lines) return true;
775
+ const rows = [...m.querySelectorAll(".st-ln")].slice(0, STATUS_FOLD_LINES);
776
+ if (rows[0]?.checkVisibility && !rows[0].checkVisibility({ contentVisibilityAuto: true })) return false;
777
+ let measured = false, over = false;
778
+ for (const row of rows) {
779
+ if (!row.clientWidth) continue;
780
+ measured = true;
781
+ if (row.scrollWidth > row.clientWidth + 1) over = true;
773
782
  }
783
+ if (measured && m.classList.contains("overflows") !== over) m.classList.toggle("overflows", over);
784
+ return true;
785
+ }
786
+ /**
787
+ * #4295 review (Prism): a skipped line is measured as soon as it is shown again — the drag ended, or it was scrolled to —
788
+ * by its own check each frame (a style query, no layout) while any is waiting; nothing else is sure to come (the list's
789
+ * size need not change at the release). A line removed meanwhile is dropped. Stops when none waits, or the thread leaves.
790
+ */
791
+ const stale = new Set();
792
+ let staleFrame = null;
793
+ function watchStale() {
794
+ if (staleFrame !== null || disposed || parked || typeof requestAnimationFrame !== "function") return;
795
+ staleFrame = requestAnimationFrame(() => {
796
+ staleFrame = null;
797
+ for (const m of [...stale]) if (!m.isConnected || fitLine(m)) stale.delete(m);
798
+ if (stale.size) watchStale();
799
+ });
800
+ }
801
+ function unwatchStale() {
802
+ if (staleFrame !== null && typeof cancelAnimationFrame === "function") cancelAnimationFrame(staleFrame);
803
+ staleFrame = null;
774
804
  }
775
805
  let ro = typeof ResizeObserver === "function" ? new ResizeObserver(resized) : null;
776
806
  if (ro) { ro.observe(list); ro.observe(scroller); }
@@ -1064,6 +1094,7 @@ export function createThread(list, scroller, opts) {
1064
1094
  if (P()) P().stopAll("leave");
1065
1095
  for (const node of list.querySelectorAll(".html-card[data-att], .text-card[data-att]")) { const f = cardDrop.get(node); if (f) f(); }
1066
1096
  if (ro) { ro.disconnect(); ro = null; }
1097
+ unwatchStale();
1067
1098
  if (growFrame !== null && typeof cancelAnimationFrame === "function") cancelAnimationFrame(growFrame);
1068
1099
  if (growTimer !== null) clearTimeout(growTimer);
1069
1100
  growTimer = growFrame = null;
@@ -1086,6 +1117,7 @@ export function createThread(list, scroller, opts) {
1086
1117
  disposed = true;
1087
1118
  if (!parked) watchReader(scroller, false);
1088
1119
  if (ro) ro.disconnect();
1120
+ unwatchStale(); stale.clear();
1089
1121
  if (P()) { if (own) P().stopIn(list); else P().stopAll("leave"); }
1090
1122
  for (const v of nodes.values()) v.handle?.unmount();
1091
1123
  nodes.clear();
@@ -25,8 +25,8 @@ import { identityClasses, identityOf, paintIdentity, useIdentityColors } from ".
25
25
 
26
26
  // Keep new copy beside its caller: a retained view-strings.js still links and renders the menu.
27
27
  register("agentRow", {
28
- en: { actions: "Actions for {0}", add: "Add to favorites", remove: "Remove from favorites" },
29
- "zh-TW": { actions: "{0} 的操作", add: "加入最愛", remove: "移出最愛" },
28
+ en: { actions: "Actions for {0}", add: "Add to favorites", remove: "Remove from favorites", contextAdd: "Add to favorites", contextRemove: "Remove from favorites" },
29
+ "zh-TW": { actions: "{0} 的操作", add: "加入最愛", remove: "移出最愛", contextAdd: "加到我的最愛", contextRemove: "從我的最愛移除" },
30
30
  });
31
31
 
32
32
  /** view.* text with named values. */
@@ -36,6 +36,7 @@ function tn(key, values = {}) {
36
36
  return s;
37
37
  }
38
38
  const stored = (k) => { try { return localStorage.getItem(k); } catch { return null; } };
39
+ const contextNow = () => globalThis.performance?.now?.() ?? Date.now();
39
40
  /** A row's instance name: `name` (status frames) or `instance_name` (View's roster). */
40
41
  const nameOf = (it) => (it && (it.name != null ? it.name : it.instance_name)) || "";
41
42
 
@@ -593,7 +594,44 @@ function SortMenu({ sort, phone = false }) {
593
594
  */
594
595
  export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting = {}, viewOnly = false, onPick, onNew = null }) {
595
596
  const nav = useStore(navStore);
596
- const workspace = useStore(appStore).chatWorkspace;
597
+ const app = useStore(appStore), workspace = app.chatWorkspace;
598
+ const [context, setContext] = useState(null);
599
+ const hold = useRef(null), heldClick = useRef(null), contextId = useRef(0);
600
+ const cancelHold = () => { if (hold.current) clearTimeout(hold.current.timer); hold.current = null; };
601
+ useLayoutEffect(() => {
602
+ const scroll = () => cancelHold();
603
+ window.addEventListener("scroll", scroll, true);
604
+ return () => { cancelHold(); window.removeEventListener("scroll", scroll, true); };
605
+ }, []);
606
+ useLayoutEffect(() => { cancelHold(); setContext(null); }, [route?.panel, route?.instance, viewOnly]);
607
+ const contextAllowed = () => !viewOnly && !guestPage() && typeof app.sidebarChatMenu === "function";
608
+ const openContext = (name, event) => {
609
+ if (!contextAllowed()) return false;
610
+ event.preventDefault(); event.stopPropagation(); cancelHold();
611
+ const row = event.currentTarget.closest?.("[data-agent-row]") || event.currentTarget;
612
+ const anchor = row.querySelector("a.inst");
613
+ if (!anchor) return false;
614
+ anchor.focus({ preventScroll: true });
615
+ setContext({name, anchor, id: ++contextId.current}); return true;
616
+ };
617
+ const contextEvents = name => ({
618
+ onContextMenu: event => openContext(name, event),
619
+ onKeyDown: event => { if (event.key === "Escape" && event.target.closest?.("dialog[open]")) { event.stopPropagation(); return; } if (event.key === "ContextMenu" || (event.key === "F10" && event.shiftKey)) openContext(name, event); },
620
+ onPointerDown: event => {
621
+ cancelHold();
622
+ if (!contextAllowed() || event.pointerType !== "touch" || (event.button != null && event.button !== 0) || event.target.closest?.("button")) return;
623
+ const currentTarget = event.currentTarget, x = event.clientX, y = event.clientY;
624
+ hold.current = {name, x, y, pointerId:event.pointerId, timer:setTimeout(() => {
625
+ hold.current = null;
626
+ if (!currentTarget.isConnected || !contextAllowed()) return;
627
+ heldClick.current = {name, pointerId:event.pointerId, until:contextNow()+1000};
628
+ openContext(name, {currentTarget, preventDefault(){}, stopPropagation(){}});
629
+ }, 500)};
630
+ },
631
+ onPointerMove: event => { const h = hold.current; if (h && (Math.abs(event.clientX-h.x)>8 || Math.abs(event.clientY-h.y)>8)) cancelHold(); },
632
+ onPointerUp: cancelHold, onPointerCancel: cancelHold, onDragStart: cancelHold,
633
+ onClickCapture: event => { if (heldClick.current?.name === name && contextNow() < heldClick.current.until && (!event.target.closest?.("[role=menu],dialog") || event.pointerId === heldClick.current.pointerId)) { heldClick.current=null; event.preventDefault(); event.stopPropagation(); } },
634
+ });
597
635
  const styledMenus = typeof getComputedStyle === "function" && getComputedStyle(document.documentElement).getPropertyValue?.("--agent-menu-version")?.trim() === "1";
598
636
  const names = useStore(namesStore); // #1722: which name leads
599
637
  const compact = useStore(sidebarDensityStore).value === "compact";
@@ -771,7 +809,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
771
809
  onSelect: () => { if (!shown.active && !favsSorted) { focusRow.current = name; moveFavorite(name, 1, known); } } },
772
810
  ] : []),
773
811
  ].filter(Boolean);
774
- return html`<li key=${name} data-agent-row=${name} class=${`v-li${!compact && two ? " two-line" : ""}`}><a class=${`inst v-inst${on ? " active" : ""}${starred ? " inst-favorite" : ""}${fade > 0 ? " replied" : ""}${mins != null && mins < 1 ? " just" : ""} ${identityClasses(id)}`}
812
+ const favorite = menuItems.find(item => item.key === "favorite");
813
+ const contextFavorite = favorite ? { ...favorite, label: t(`agentRow.${starred ? "contextRemove" : "contextAdd"}`),
814
+ onSelect: () => { setContext(null); favorite.onSelect(); } } : null;
815
+ return html`<li key=${name} data-agent-row=${name} class=${`v-li${!compact && two ? " two-line" : ""}`} ...${contextEvents(name)}><a class=${`inst v-inst${on ? " active" : ""}${starred ? " inst-favorite" : ""}${fade > 0 ? " replied" : ""}${mins != null && mins < 1 ? " just" : ""} ${identityClasses(id)}`}
775
816
  ref=${(el) => { paintIdentity(el, id); paintReply(el, fade); }} href=${rowPath(name)} title=${instanceTooltip(it)}
776
817
  aria-label=${compact ? [...new Set([label, name, labelOf(it)])].join(" · ") : undefined}
777
818
  aria-current=${on ? "page" : undefined} onClick=${onPick} ...${dragProps({ type: "instance", name, group: g }, !fav)}>
@@ -787,7 +828,8 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
787
828
  </a>${menuItems.length ? html`<${Menu} cls=${`inst-workspace inst-row-menu agent-menu${starred ? " is-favorite" : ""}`} fit=${true} topLayer=${true}
788
829
  ownerKey=${name} label=${t("agentRow.actions", label)} items=${menuItems}
789
830
  trigger=${styledMenus ? html`<span class="inst-menu-star" aria-hidden="true">${starred ? html`<${Icon} name="star" size=${14} />` : null}</span><span class="inst-menu-more" aria-hidden="true"><${Icon} name="more" size=${16} /></span>` : undefined} />`
790
- : starred ? html`<span class="inst-favorite-mark" aria-hidden="true"><${Icon} name="star" size=${14} /></span>` : null}</li>`;
831
+ : starred ? html`<span class="inst-favorite-mark" aria-hidden="true"><${Icon} name="star" size=${14} /></span>` : null}
832
+ ${contextAllowed() && context?.name === name ? html`<${app.sidebarChatMenu} key=${context.id} inst=${it} context=${context} favorite=${contextFavorite} onClose=${() => setContext(null)} />` : null}</li>`;
791
833
  };
792
834
  // #2401: an open list of two or more lines leaves room under the count for "shown" and Clear (stacked); otherwise compact.
793
835
  const facetSet = f.status.length > 0 || f.cli.length > 0;
@@ -0,0 +1,36 @@
1
+ // M-3492 (the user) / M-3493: 最新 (scroll to latest) shows while the reader scrolls and fades out JUMP_IDLE_MS after
2
+ // the last scroll, so it never sits over a bubble in a still view (a screenshot); the next scroll brings it back. One
3
+ // behaviour for the Fleet chat (panel-chat.js) and every Hub conversation (panel-hub.js): the Hub copies the Fleet chat.
4
+ // Faded (.is-idle in app.css), taps pass through it; it stays in the tab order and the accessibility tree, and keyboard
5
+ // focus shows it again. Whether it has focus is read from the button there when the timer fires, never latched: an
6
+ // activated 最新 goes away without a blur. A timer runs only while it is shown, owned by the conversation too (a thread
7
+ // reused for another one with 最新 still up arms anew).
8
+ import { useEffect, useRef, useState } from "/assets/app-html.js";
9
+
10
+ /** How long 最新 stays after the last scroll before it fades out (the user asked for about 2–3 s). */
11
+ export const JUMP_IDLE_MS = 2500;
12
+
13
+ /**
14
+ * scroller: the thread's scrolling element (a ref); show: whether 最新 is drawn; owner: what the thread shows (a chat's
15
+ * name, a room's store). Returns what the button takes: `idle` (add .is-idle), `ref`, `onFocus`, `onBlur`.
16
+ */
17
+ export function useJumpIdle(scroller, show, owner) {
18
+ const [idle, setIdle] = useState(false);
19
+ const timer = useRef(0), button = useRef(null), shown = useRef(false);
20
+ shown.current = !!show;
21
+ const rest = () => {
22
+ clearTimeout(timer.current);
23
+ timer.current = setTimeout(() => { const b = button.current; if (!b || b.ownerDocument.activeElement !== b) setIdle(true); }, JUMP_IDLE_MS);
24
+ };
25
+ useEffect(() => {
26
+ const sc = scroller.current; if (!sc) return undefined;
27
+ const wake = () => { setIdle(false); if (shown.current) rest(); };
28
+ sc.addEventListener("scroll", wake, { passive: true });
29
+ setIdle(false);
30
+ return () => { sc.removeEventListener("scroll", wake); clearTimeout(timer.current); };
31
+ }, [owner]);
32
+ useEffect(() => {
33
+ if (show) { setIdle(false); rest(); } else clearTimeout(timer.current);
34
+ }, [!!show, owner]);
35
+ return { idle, ref: button, onFocus: () => { clearTimeout(timer.current); setIdle(false); }, onBlur: rest };
36
+ }
@@ -140,13 +140,17 @@
140
140
  window.addEventListener("pageshow", schedule);
141
141
  // Page palettes are applied to the shell; routes replace headers. Coalesce paints and
142
142
  // ignore content attributes so updating this meta element cannot trigger itself.
143
- // M-3455: the split view's grid (.ws-geometry) changes only its size and drag state on these attributes — never a colour.
143
+ // M-3455: the split view's grid (.ws-geometry) changes only its size and drag state on these attributes — never a colour;
144
+ // M-3486: nor does a text box's height.
144
145
  // A divider drag writes them every frame; re-reading the header colours then forced a layout and style walk per frame.
145
146
  function relevant(records) {
146
147
  if (!records || !records.length) return true;
147
148
  for (var i = 0; i < records.length; i++) {
148
149
  var r = records[i];
149
- if (r.type !== "attributes" || !r.target.classList || !r.target.classList.contains("ws-geometry")) return true;
150
+ if (r.type !== "attributes") return true;
151
+ // M-3486: a text box's own height (the composer grows with its text: a style write each time it is measured).
152
+ if (r.attributeName === "style" && r.target.tagName === "TEXTAREA") continue;
153
+ if (!r.target.classList || !r.target.classList.contains("ws-geometry")) return true;
150
154
  }
151
155
  return false;
152
156
  }
@@ -8,24 +8,28 @@ import { t } from "./app-i18n.js";
8
8
  * items: [{ key, label, icon?, onSelect, danger?, disabled? }] (falsy entries are skipped). `checked` makes a radio item;
9
9
  * `checkbox: true` with `checked` a checkbox item (#2217 hotfix: the chat's card menu), which toggles and keeps the menu
10
10
  * open. `active`: the button shows a pressed look (what it controls is on), without changing its role.
11
+ * `context`: optional {id, anchor, onClose}; opens without a second button and returns focus to that row.
11
12
  * Optional `trigger` and `triggerClass` customize the button content and styling; `label` remains its accessible name.
12
13
  */
13
- export function Menu({ items, label, icon = "more", cls = "", active = false, trigger, triggerClass = "icon-btn", disabled = false, fit = false, topLayer = false, ownerKey, inactive = false, onOpen, leading }) {
14
+ export function Menu({ items, label, icon = "more", cls = "", active = false, trigger, triggerClass = "icon-btn", disabled = false, fit = false, topLayer = false, ownerKey, inactive = false, onOpen, leading, context }) {
14
15
  const [open, setOpen] = useState(false);
15
16
  const [placement,setPlacement] = useState("");
16
17
  const btn = useRef(null), list = useRef(null);
17
18
  const shown = (items || []).filter(Boolean);
19
+ const anchor = () => context?.anchor || btn.current;
20
+ const close = () => { setOpen(false); context?.onClose?.(); };
18
21
  const anchored = topLayer && open && typeof getComputedStyle === "function" && getComputedStyle(document.documentElement).getPropertyValue?.("--agent-menu-version")?.trim() === "1";
19
22
  useLayoutEffect(() => { setOpen(false); }, [ownerKey]);
23
+ useLayoutEffect(() => { if (context) setOpen(true); }, [context?.id]);
20
24
  useLayoutEffect(() => { if (inactive) setOpen(false); }, [inactive]);
21
25
  useLayoutEffect(() => {
22
- if (!open || !fit || !btn.current?.getBoundingClientRect || !list.current) return;
26
+ if (!open || !fit || !anchor()?.getBoundingClientRect || !list.current) return;
23
27
  const menu = list.current;
24
28
  if (anchored) menu.showPopover?.(); // escape the sidebar's scrolling clip; the same Menu keeps focus/ownership
25
29
  const place = () => {
26
- if (!btn.current || !list.current) return;
27
- const rect = btn.current.getBoundingClientRect();
28
- const boundary = btn.current.closest?.(".dlg-body")?.getBoundingClientRect();
30
+ if (!anchor() || !list.current) return;
31
+ const rect = anchor().getBoundingClientRect();
32
+ const boundary = anchor().closest?.(".dlg-body")?.getBoundingClientRect();
29
33
  const top = Math.max(0,boundary?.top || 0), bottom = Math.min(window.innerHeight,boundary?.bottom || window.innerHeight);
30
34
  const above = rect.top-top-8, below = bottom-rect.bottom-8;
31
35
  const up = below < Math.min(list.current.scrollHeight || 280,280) && above > below;
@@ -52,7 +56,7 @@ export function Menu({ items, label, icon = "more", cls = "", active = false, tr
52
56
  if (!open || disabled) { if (open && disabled) setOpen(false); return undefined; }
53
57
  const first = list.current && list.current.querySelector("[role=menuitem]:not([disabled]), [role=menuitemradio]:not([disabled]), [role=menuitemcheckbox]:not([disabled])");
54
58
  if (first) first.focus({ preventScroll: true });
55
- const outside = (e) => { if (list.current && !list.current.contains(e.target) && btn.current && !btn.current.contains(e.target)) setOpen(false); };
59
+ const outside = (e) => { if (list.current && !list.current.contains(e.target) && anchor() && !anchor().contains(e.target)) close(); };
56
60
  document.addEventListener("pointerdown", outside, true);
57
61
  return () => document.removeEventListener("pointerdown", outside, true);
58
62
  }, [open, disabled]);
@@ -61,19 +65,19 @@ export function Menu({ items, label, icon = "more", cls = "", active = false, tr
61
65
  if (e.target.closest?.("[role=menu]") !== list.current) return; // a nested card menu owns its own keys
62
66
  const all = [...list.current.querySelectorAll("[role=menuitem]:not([disabled]), [role=menuitemradio]:not([disabled]), [role=menuitemcheckbox]:not([disabled])")];
63
67
  const i = all.indexOf(document.activeElement);
64
- if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); setOpen(false); btn.current && btn.current.focus({ preventScroll: true }); }
68
+ if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); anchor()?.focus({ preventScroll: true }); close(); }
65
69
  else if (e.key === "Enter" || e.key === " ") { e.preventDefault(); document.activeElement?.click(); }
66
70
  else if (e.key === "ArrowDown") { e.preventDefault(); (all[(i + 1) % all.length] || all[0])?.focus(); }
67
71
  else if (e.key === "ArrowUp") { e.preventDefault(); (all[(i - 1 + all.length) % all.length] || all[0])?.focus(); }
68
72
  else if (e.key === "Home") { e.preventDefault(); all[0]?.focus(); }
69
73
  else if (e.key === "End") { e.preventDefault(); all[all.length - 1]?.focus(); }
70
- else if (e.key === "Tab") setOpen(false);
74
+ else if (e.key === "Tab") close();
71
75
  }
72
- function choose(item) { if (disabled || item.disabled) return; setOpen(false); btn.current && btn.current.focus({ preventScroll: true }); item.onSelect(); }
76
+ function choose(item) { if (disabled || item.disabled) return; anchor()?.focus({ preventScroll: true }); close(); item.onSelect(); }
73
77
  return html`<div class=${`menu ${cls}`}>
74
- <button ref=${btn} type="button" class=${`${triggerClass}${active ? " active" : ""}`} aria-haspopup="menu" aria-expanded=${open ? "true" : "false"} disabled=${disabled}
78
+ ${context ? null : html`<button ref=${btn} type="button" class=${`${triggerClass}${active ? " active" : ""}`} aria-haspopup="menu" aria-expanded=${open ? "true" : "false"} disabled=${disabled}
75
79
  aria-label=${label || t("app.more")} title=${label || t("app.more")} onClick=${() => { if (!disabled) { if (!open) onOpen?.(); setOpen(!open); } }}
76
- onKeyDown=${(e) => { if (!disabled && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); onOpen?.(); setOpen(true); } }}>${trigger === undefined ? html`<${Icon} name=${icon} />` : trigger}</button>
80
+ onKeyDown=${(e) => { if (!disabled && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); onOpen?.(); setOpen(true); } }}>${trigger === undefined ? html`<${Icon} name=${icon} />` : trigger}</button>`}
77
81
  ${open && !disabled ? html`<div data-trust="menu" ref=${list} popover=${anchored ? "manual" : undefined} class=${`menu-list${anchored ? " menu-anchored" : ""}${fit ? placement : ""}`} role="menu" aria-label=${label || t("app.more")} onKeyDown=${onKey}>
78
82
  ${leading || null}
79
83
  ${shown.map(item => item.heading
@@ -91,3 +95,5 @@ export function Menu({ items, label, icon = "more", cls = "", active = false, tr
91
95
  </div>`;
92
96
  }
93
97
  Menu.workspaceVersion = 1;
98
+
99
+ Menu.contextVersion = 1;
package/dist/web-api.d.ts CHANGED
@@ -59,6 +59,8 @@ export type AccountWriteResult = {
59
59
  message?: string;
60
60
  };
61
61
  export interface WebApiContext extends ClaudeCredentialApi {
62
+ hostHistoryQuery?(range: unknown, series: unknown): Promise<import('./host-monitoring-history.js').HostHistoryResult>;
63
+ hostHealthSnapshot?(): import("./host-monitoring.js").HostHealthSnapshot;
62
64
  clearContactOrigin?: ContactApiHost["clearContactOrigin"];
63
65
  contactPermissions?: ContactApiHost["contactPermissions"];
64
66
  writeContactPermissions?: ContactApiHost["writeContactPermissions"];
package/dist/web-api.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { historyQuery } from './host-monitoring-history-policy.js';
1
2
  import { handleClaudeCredentials } from "./web-claude-credentials.js";
2
3
  import { pipeline } from "node:stream/promises";
3
4
  import { handleContactAuthorizationApi } from "./contact-auth-api.js";
@@ -2625,6 +2626,59 @@ function statusTick(ctx, t) {
2625
2626
  export function handleWebRequest(req, res, url, ctx) {
2626
2627
  const path = url.pathname;
2627
2628
  const method = req.method ?? "GET";
2629
+ if (path === "/ui/host-history") {
2630
+ res.setHeader("Cache-Control", "private, no-store");
2631
+ const auth = () => evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2632
+ const who = auth();
2633
+ if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
2634
+ json(res, 403, { error: "admin_session_required" });
2635
+ return true;
2636
+ }
2637
+ const range = url.searchParams.get('range'), series = url.searchParams.getAll('series');
2638
+ try {
2639
+ if (method !== "GET" || url.search.length > 4096 || url.searchParams.getAll('range').length !== 1 || [...url.searchParams.keys()].some(k => k !== 'range' && k !== 'series'))
2640
+ throw Error();
2641
+ historyQuery(range, series, Date.now());
2642
+ }
2643
+ catch {
2644
+ json(res, 400, { error: "invalid_history_query" });
2645
+ return true;
2646
+ }
2647
+ if (!ctx.hostHistoryQuery) {
2648
+ json(res, 503, { error: "history_unavailable" });
2649
+ return true;
2650
+ }
2651
+ void Promise.resolve().then(() => ctx.hostHistoryQuery(range, series)).then(answer => {
2652
+ if (res.destroyed)
2653
+ return;
2654
+ const current = auth();
2655
+ if (current.kind !== "allow" || current.via !== "session" || current.session.tier !== "admin" || current.session.idHash !== who.session.idHash) {
2656
+ json(res, 403, { error: "admin_session_required" });
2657
+ return;
2658
+ }
2659
+ json(res, 200, answer);
2660
+ }, () => { if (!res.destroyed)
2661
+ json(res, 503, { error: "history_unavailable" }); });
2662
+ return true;
2663
+ }
2664
+ if (path === "/ui/host-health") {
2665
+ res.setHeader("Cache-Control", "private, no-store");
2666
+ const who = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2667
+ if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
2668
+ json(res, 403, { error: "admin_session_required" });
2669
+ return true;
2670
+ }
2671
+ if (method !== "GET" || url.search) {
2672
+ json(res, 400, { error: "invalid_host_health_request" });
2673
+ return true;
2674
+ }
2675
+ if (!ctx.hostHealthSnapshot) {
2676
+ json(res, 503, { error: "host_monitoring_unavailable" });
2677
+ return true;
2678
+ }
2679
+ json(res, 200, ctx.hostHealthSnapshot());
2680
+ return true;
2681
+ }
2628
2682
  // Auth check for all /ui routes. Defence in depth behind the fleet-manager
2629
2683
  // gate: the same session cookie or header token, and an unset token closes
2630
2684
  // the panel instead of comparing null against a missing credential.