@sleep2agi/agent-network-dashboard 0.4.6-preview.11 → 0.4.6-preview.111

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 (317) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/diagnostics/route-bundle-stats.json +69 -55
  5. package/.next/fallback-build-manifest.json +3 -3
  6. package/.next/prerender-manifest.json +3 -3
  7. package/.next/routes-manifest.json +6 -0
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/server/app/_not-found.html +2 -2
  17. package/.next/server/app/_not-found.rsc +12 -12
  18. package/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
  19. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  20. package/.next/server/app/_not-found.segments/_index.segment.rsc +7 -7
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  23. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  24. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/admin.html +2 -2
  26. package/.next/server/app/admin.rsc +14 -14
  27. package/.next/server/app/admin.segments/_full.segment.rsc +14 -14
  28. package/.next/server/app/admin.segments/_head.segment.rsc +4 -4
  29. package/.next/server/app/admin.segments/_index.segment.rsc +7 -7
  30. package/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
  31. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +4 -4
  32. package/.next/server/app/admin.segments/admin.segment.rsc +3 -3
  33. package/.next/server/app/api/hub/servers/route/app-paths-manifest.json +3 -0
  34. package/.next/server/app/api/hub/servers/route/build-manifest.json +9 -0
  35. package/.next/server/app/api/hub/servers/route/server-reference-manifest.json +4 -0
  36. package/.next/server/app/api/hub/servers/route.js +7 -0
  37. package/.next/server/app/api/hub/servers/route.js.map +5 -0
  38. package/.next/server/app/api/hub/servers/route.js.nft.json +1 -0
  39. package/.next/server/app/api/hub/servers/route_client-reference-manifest.js +3 -0
  40. package/.next/server/app/index.html +2 -2
  41. package/.next/server/app/index.rsc +14 -14
  42. package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  43. package/.next/server/app/index.segments/_full.segment.rsc +14 -14
  44. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  45. package/.next/server/app/index.segments/_index.segment.rsc +7 -7
  46. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  47. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/login.html +2 -2
  49. package/.next/server/app/login.rsc +14 -14
  50. package/.next/server/app/login.segments/_full.segment.rsc +14 -14
  51. package/.next/server/app/login.segments/_head.segment.rsc +4 -4
  52. package/.next/server/app/login.segments/_index.segment.rsc +7 -7
  53. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  54. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  55. package/.next/server/app/login.segments/login.segment.rsc +3 -3
  56. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/logs.html +2 -2
  58. package/.next/server/app/logs.rsc +14 -14
  59. package/.next/server/app/logs.segments/_full.segment.rsc +14 -14
  60. package/.next/server/app/logs.segments/_head.segment.rsc +4 -4
  61. package/.next/server/app/logs.segments/_index.segment.rsc +7 -7
  62. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  63. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +4 -4
  64. package/.next/server/app/logs.segments/logs.segment.rsc +3 -3
  65. package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/messages.html +2 -2
  67. package/.next/server/app/messages.rsc +14 -14
  68. package/.next/server/app/messages.segments/_full.segment.rsc +14 -14
  69. package/.next/server/app/messages.segments/_head.segment.rsc +4 -4
  70. package/.next/server/app/messages.segments/_index.segment.rsc +7 -7
  71. package/.next/server/app/messages.segments/_tree.segment.rsc +2 -2
  72. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +4 -4
  73. package/.next/server/app/messages.segments/messages.segment.rsc +3 -3
  74. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  75. package/.next/server/app/node.html +2 -2
  76. package/.next/server/app/node.rsc +14 -14
  77. package/.next/server/app/node.segments/_full.segment.rsc +14 -14
  78. package/.next/server/app/node.segments/_head.segment.rsc +4 -4
  79. package/.next/server/app/node.segments/_index.segment.rsc +7 -7
  80. package/.next/server/app/node.segments/_tree.segment.rsc +2 -2
  81. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +4 -4
  82. package/.next/server/app/node.segments/node.segment.rsc +3 -3
  83. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  84. package/.next/server/app/nodes.html +2 -2
  85. package/.next/server/app/nodes.rsc +14 -14
  86. package/.next/server/app/nodes.segments/_full.segment.rsc +14 -14
  87. package/.next/server/app/nodes.segments/_head.segment.rsc +4 -4
  88. package/.next/server/app/nodes.segments/_index.segment.rsc +7 -7
  89. package/.next/server/app/nodes.segments/_tree.segment.rsc +2 -2
  90. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +4 -4
  91. package/.next/server/app/nodes.segments/nodes.segment.rsc +3 -3
  92. package/.next/server/app/page_client-reference-manifest.js +1 -1
  93. package/.next/server/app/server-logs/page_client-reference-manifest.js +1 -1
  94. package/.next/server/app/server-logs.html +2 -2
  95. package/.next/server/app/server-logs.rsc +14 -14
  96. package/.next/server/app/server-logs.segments/_full.segment.rsc +14 -14
  97. package/.next/server/app/server-logs.segments/_head.segment.rsc +4 -4
  98. package/.next/server/app/server-logs.segments/_index.segment.rsc +7 -7
  99. package/.next/server/app/server-logs.segments/_tree.segment.rsc +2 -2
  100. package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +4 -4
  101. package/.next/server/app/server-logs.segments/server-logs.segment.rsc +3 -3
  102. package/.next/server/app/settings/networks/page_client-reference-manifest.js +1 -1
  103. package/.next/server/app/settings/networks.html +2 -2
  104. package/.next/server/app/settings/networks.rsc +14 -14
  105. package/.next/server/app/settings/networks.segments/_full.segment.rsc +14 -14
  106. package/.next/server/app/settings/networks.segments/_head.segment.rsc +4 -4
  107. package/.next/server/app/settings/networks.segments/_index.segment.rsc +7 -7
  108. package/.next/server/app/settings/networks.segments/_tree.segment.rsc +2 -2
  109. package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +4 -4
  110. package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +3 -3
  111. package/.next/server/app/settings/networks.segments/settings.segment.rsc +3 -3
  112. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  113. package/.next/server/app/settings/tokens/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/settings/tokens.html +2 -2
  115. package/.next/server/app/settings/tokens.rsc +14 -14
  116. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +14 -14
  117. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +4 -4
  118. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +7 -7
  119. package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +2 -2
  120. package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +4 -4
  121. package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +3 -3
  122. package/.next/server/app/settings/tokens.segments/settings.segment.rsc +3 -3
  123. package/.next/server/app/settings.html +2 -2
  124. package/.next/server/app/settings.rsc +14 -14
  125. package/.next/server/app/settings.segments/_full.segment.rsc +14 -14
  126. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  127. package/.next/server/app/settings.segments/_index.segment.rsc +7 -7
  128. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  129. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  130. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  131. package/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  132. package/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  133. package/.next/server/app/tasks.html +2 -2
  134. package/.next/server/app/tasks.rsc +14 -14
  135. package/.next/server/app/tasks.segments/_full.segment.rsc +14 -14
  136. package/.next/server/app/tasks.segments/_head.segment.rsc +4 -4
  137. package/.next/server/app/tasks.segments/_index.segment.rsc +7 -7
  138. package/.next/server/app/tasks.segments/_tree.segment.rsc +2 -2
  139. package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +4 -4
  140. package/.next/server/app/tasks.segments/tasks.segment.rsc +3 -3
  141. package/.next/server/app-paths-manifest.json +1 -0
  142. package/.next/server/chunks/0ykm__next-internal_server_app_api_hub_servers_route_actions_08-m-cs.js +3 -0
  143. package/.next/server/chunks/0ykm__next-internal_server_app_api_hub_servers_route_actions_08-m-cs.js.map +1 -0
  144. package/.next/server/chunks/[root-of-the-server]__0tx8s8i._.js +3 -0
  145. package/.next/server/chunks/[root-of-the-server]__0tx8s8i._.js.map +1 -0
  146. package/.next/server/chunks/ssr/[root-of-the-server]__03b.f76._.js +1 -1
  147. package/.next/server/chunks/ssr/[root-of-the-server]__03b.f76._.js.map +1 -1
  148. package/.next/server/chunks/ssr/[root-of-the-server]__0fhoq8i._.js +1 -1
  149. package/.next/server/chunks/ssr/[root-of-the-server]__0fhoq8i._.js.map +1 -1
  150. package/.next/server/chunks/ssr/[root-of-the-server]__0nw~zhp._.js +1 -1
  151. package/.next/server/chunks/ssr/[root-of-the-server]__0nw~zhp._.js.map +1 -1
  152. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js +4 -1
  153. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js.map +1 -1
  154. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js +1 -1
  155. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js.map +1 -1
  156. package/.next/server/chunks/ssr/agent-network-dashboard_app_057q.ne._.js +1 -1
  157. package/.next/server/chunks/ssr/agent-network-dashboard_app_057q.ne._.js.map +1 -1
  158. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js +1 -1
  159. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js.map +1 -1
  160. package/.next/server/chunks/ssr/agent-network-dashboard_app_0_d45-d._.js +1 -1
  161. package/.next/server/chunks/ssr/agent-network-dashboard_app_0_d45-d._.js.map +1 -1
  162. package/.next/server/chunks/ssr/agent-network-dashboard_app_0i3759l._.js +1 -1
  163. package/.next/server/chunks/ssr/agent-network-dashboard_app_0i3759l._.js.map +1 -1
  164. package/.next/server/chunks/ssr/agent-network-dashboard_app_0xgney8._.js +1 -1
  165. package/.next/server/chunks/ssr/agent-network-dashboard_app_0xgney8._.js.map +1 -1
  166. package/.next/server/chunks/ssr/agent-network-dashboard_app_10hjgv4._.js +1 -1
  167. package/.next/server/chunks/ssr/agent-network-dashboard_app_10hjgv4._.js.map +1 -1
  168. package/.next/server/chunks/ssr/agent-network-dashboard_app_1153xeb._.js +1 -1
  169. package/.next/server/chunks/ssr/agent-network-dashboard_app_1153xeb._.js.map +1 -1
  170. package/.next/server/chunks/ssr/agent-network-dashboard_app_12l4oto._.js +1 -1
  171. package/.next/server/chunks/ssr/agent-network-dashboard_app_12l4oto._.js.map +1 -1
  172. package/.next/server/chunks/ssr/agent-network-dashboard_app_components_0mvyi-4._.js +1 -1
  173. package/.next/server/chunks/ssr/agent-network-dashboard_app_components_0mvyi-4._.js.map +1 -1
  174. package/.next/server/middleware-build-manifest.js +3 -3
  175. package/.next/server/pages/404.html +2 -2
  176. package/.next/server/pages/500.html +1 -1
  177. package/.next/server/server-reference-manifest.js +1 -1
  178. package/.next/server/server-reference-manifest.json +1 -1
  179. package/.next/static/chunks/0-mpa_947ipeq.js +1 -0
  180. package/.next/static/chunks/0052a9q2fvljq.js +1 -0
  181. package/.next/static/chunks/01lmbsd37fybu.js +1 -0
  182. package/.next/static/chunks/03o.h6kvmw4l_.js +1 -0
  183. package/.next/static/chunks/03~~oirxz7~vc.js +1 -0
  184. package/.next/static/chunks/05uk96gc~9mni.js +1 -0
  185. package/.next/static/chunks/08kf-.bgs10ze.js +1 -0
  186. package/.next/static/chunks/0glmrdj9112tc.js +7 -0
  187. package/.next/static/chunks/0ofu4mc55-oar.js +4 -0
  188. package/.next/static/chunks/0rxrez_cjn.eh.js +1 -0
  189. package/.next/static/chunks/0tvn2l1pc.h65.js +1 -0
  190. package/.next/static/chunks/0x8x.29hkju5a.js +1 -0
  191. package/.next/static/chunks/115k17sotk9jg.css +2 -0
  192. package/.next/static/chunks/121d8yvfl8l_..js +7 -0
  193. package/.next/static/chunks/14ppi2e6ljtms.js +1 -0
  194. package/.next/static/chunks/174re5ar~kxne.js +1 -0
  195. package/.next/trace +2 -2
  196. package/.next/trace-build +1 -1
  197. package/.next/types/routes.d.ts +2 -1
  198. package/.next/types/validator.ts +9 -0
  199. package/app/api/hub/servers/route.ts +39 -0
  200. package/app/components/AppShell.tsx +2 -0
  201. package/app/components/ChatPopover.tsx +38 -2
  202. package/app/components/CommandPalette.tsx +67 -0
  203. package/app/components/HelpOverlay.tsx +71 -0
  204. package/app/components/ServersDrawer.tsx +206 -0
  205. package/app/components/TopoGraph.tsx +2032 -157
  206. package/app/components/utils.ts +8 -7
  207. package/app/globals.css +19 -1
  208. package/app/lib/time.ts +36 -0
  209. package/package.json +1 -1
  210. package/scripts/help-overlay-topo-test.mjs +44 -0
  211. package/scripts/servers-drawer-live-test.mjs +96 -0
  212. package/scripts/topo-active-filter-pill-test.mjs +101 -0
  213. package/scripts/topo-active-links-chip-hover-test.mjs +103 -0
  214. package/scripts/topo-active-links-chip-test.mjs +73 -0
  215. package/scripts/topo-arrival-ping-test.mjs +87 -0
  216. package/scripts/topo-arrow-tier-test.mjs +61 -0
  217. package/scripts/topo-auto-fit-test.mjs +73 -0
  218. package/scripts/topo-chat-focus-ring-test.mjs +77 -0
  219. package/scripts/topo-chip-pin-mirror-test.mjs +113 -0
  220. package/scripts/topo-click-ripple-test.mjs +66 -0
  221. package/scripts/topo-cmdk-layout-view-test.mjs +108 -0
  222. package/scripts/topo-cmdk-pin-test.mjs +123 -0
  223. package/scripts/topo-cmdk-vendor-clear-test.mjs +133 -0
  224. package/scripts/topo-cwd-tooltip-test.mjs +64 -0
  225. package/scripts/topo-dblclick-reset-test.mjs +74 -0
  226. package/scripts/topo-dispatch-pulse-test.mjs +83 -0
  227. package/scripts/topo-edge-count-badge-test.mjs +84 -0
  228. package/scripts/topo-edge-endpoint-highlight-test.mjs +111 -0
  229. package/scripts/topo-edge-focus-test.mjs +113 -0
  230. package/scripts/topo-edge-hover-test.mjs +93 -0
  231. package/scripts/topo-edge-tooltip-test.mjs +70 -0
  232. package/scripts/topo-esc-clears-pin-test.mjs +98 -0
  233. package/scripts/topo-filter-pill-aliases-test.mjs +121 -0
  234. package/scripts/topo-filter-pill-body-click-test.mjs +112 -0
  235. package/scripts/topo-filter-pill-count-test.mjs +110 -0
  236. package/scripts/topo-filter-pill-mobile-test.mjs +90 -0
  237. package/scripts/topo-fit-key-test.mjs +106 -0
  238. package/scripts/topo-freshness-chip-test.mjs +74 -0
  239. package/scripts/topo-group-box-pinned-state-test.mjs +95 -0
  240. package/scripts/topo-group-count-test.mjs +68 -0
  241. package/scripts/topo-group-hover-test.mjs +82 -0
  242. package/scripts/topo-group-label-hover-test.mjs +119 -0
  243. package/scripts/topo-group-label-title-test.mjs +83 -0
  244. package/scripts/topo-group-pin-test.mjs +119 -0
  245. package/scripts/topo-group-status-pips-test.mjs +103 -0
  246. package/scripts/topo-groupbox-live-test.mjs +100 -0
  247. package/scripts/topo-groupbox-test.mjs +4 -2
  248. package/scripts/topo-help-overlay-r59-test.mjs +67 -0
  249. package/scripts/topo-help-overlay-r65-test.mjs +64 -0
  250. package/scripts/topo-help-overlay-r70-test.mjs +63 -0
  251. package/scripts/topo-help-overlay-r78-test.mjs +59 -0
  252. package/scripts/topo-help-overlay-r81-test.mjs +58 -0
  253. package/scripts/topo-help-overlay-r87-test.mjs +64 -0
  254. package/scripts/topo-help-overlay-r91-test.mjs +65 -0
  255. package/scripts/topo-hub-busyness-test.mjs +100 -0
  256. package/scripts/topo-hub-click-fit-test.mjs +137 -0
  257. package/scripts/topo-hub-title-test.mjs +93 -0
  258. package/scripts/topo-ingroup-edge-test.mjs +103 -0
  259. package/scripts/topo-label-lift-test.mjs +119 -0
  260. package/scripts/topo-label-scale-test.mjs +78 -0
  261. package/scripts/topo-lastseen-tooltip-test.mjs +59 -0
  262. package/scripts/topo-layout-key-test.mjs +91 -0
  263. package/scripts/topo-legend-count-test.mjs +88 -0
  264. package/scripts/topo-legend-hover-test.mjs +113 -0
  265. package/scripts/topo-legend-pin-test.mjs +128 -0
  266. package/scripts/topo-minimap-test.mjs +68 -0
  267. package/scripts/topo-mobile-chips-test.mjs +103 -0
  268. package/scripts/topo-node-hover-lift-test.mjs +85 -0
  269. package/scripts/topo-node-title-test.mjs +101 -0
  270. package/scripts/topo-offline-dim-test.mjs +70 -0
  271. package/scripts/topo-overlap-test.mjs +32 -5
  272. package/scripts/topo-pan-cursor-test.mjs +62 -0
  273. package/scripts/topo-panel-elevation-test.mjs +76 -0
  274. package/scripts/topo-particle-stagger-test.mjs +82 -0
  275. package/scripts/topo-pin-persistence-test.mjs +105 -0
  276. package/scripts/topo-popover-meta-test.mjs +78 -0
  277. package/scripts/topo-pressure-bar-test.mjs +69 -0
  278. package/scripts/topo-pressure-hover-test.mjs +123 -0
  279. package/scripts/topo-pressure-pin-test.mjs +119 -0
  280. package/scripts/topo-pressure-seg-tooltip-test.mjs +98 -0
  281. package/scripts/topo-pulse-rate-test.mjs +71 -0
  282. package/scripts/topo-recent-panel-count-test.mjs +72 -0
  283. package/scripts/topo-recent-row-hover-test.mjs +122 -0
  284. package/scripts/topo-recent-row-tint-test.mjs +91 -0
  285. package/scripts/topo-recent-row-ts-test.mjs +92 -0
  286. package/scripts/topo-recent-signal-empty-test.mjs +63 -0
  287. package/scripts/topo-reduced-motion-test.mjs +77 -0
  288. package/scripts/topo-status-chip-hover-test.mjs +101 -0
  289. package/scripts/topo-tier-ring-occupancy-test.mjs +87 -0
  290. package/scripts/topo-tier-ring-test.mjs +69 -0
  291. package/scripts/topo-tier-ring-tint-test.mjs +110 -0
  292. package/scripts/topo-tier-stagger-test.mjs +89 -0
  293. package/scripts/topo-tz-ghost-test.mjs +69 -0
  294. package/scripts/topo-vendor-chip-hover-test.mjs +111 -0
  295. package/scripts/topo-vendor-letter-tooltip-test.mjs +92 -0
  296. package/scripts/topo-vendor-pill-test.mjs +125 -0
  297. package/scripts/topo-vendor-pin-test.mjs +125 -0
  298. package/scripts/topo-wheel-zoom-test.mjs +79 -0
  299. package/scripts/topo-zoom-keys-test.mjs +89 -0
  300. package/.next/static/chunks/0-7iowzu4.798.js +0 -1
  301. package/.next/static/chunks/02t5jr4shh.hy.js +0 -1
  302. package/.next/static/chunks/03cra9~ibhxtq.js +0 -1
  303. package/.next/static/chunks/0_qfg5s5uzs7..js +0 -7
  304. package/.next/static/chunks/0cj5qr_a8dzky.js +0 -7
  305. package/.next/static/chunks/0elalb9n_.~di.js +0 -1
  306. package/.next/static/chunks/0g-urk~xe4p41.js +0 -1
  307. package/.next/static/chunks/0j_q__o8p6g83.js +0 -1
  308. package/.next/static/chunks/0jl6_w50zh4l5.js +0 -1
  309. package/.next/static/chunks/0r4q73.-1bkyl.js +0 -1
  310. package/.next/static/chunks/0r_c8eccg3z2o.js +0 -1
  311. package/.next/static/chunks/0r~2i_zubnm0u.js +0 -1
  312. package/.next/static/chunks/0~5-jv77qynyc.css +0 -2
  313. package/.next/static/chunks/10oi7l-tycgl9.js +0 -1
  314. package/.next/static/chunks/11uk1izuv3~0t.js +0 -1
  315. /package/.next/static/{-dh0O1dlTLFw1pzDolqQ3 → 93NJDvLYgCZAXqweNe_Ye}/_buildManifest.js +0 -0
  316. /package/.next/static/{-dh0O1dlTLFw1pzDolqQ3 → 93NJDvLYgCZAXqweNe_Ye}/_clientMiddlewareManifest.js +0 -0
  317. /package/.next/static/{-dh0O1dlTLFw1pzDolqQ3 → 93NJDvLYgCZAXqweNe_Ye}/_ssgManifest.js +0 -0
@@ -1,10 +1,11 @@
1
1
  'use client';
2
2
 
3
- import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Session } from './types';
5
5
  import { aliasAvatarColors, aliasInitial } from './AliasAvatar';
6
6
  import { ChatPopover } from './ChatPopover';
7
7
  import { vendorForModel, runtimeIdentity, identityLine } from '../lib/vendorIdentity';
8
+ import { parseHubTime, relativeAgo } from '../lib/time';
8
9
 
9
10
  interface MessageFlow {
10
11
  from_alias: string;
@@ -32,6 +33,9 @@ interface FlowLink {
32
33
  to: string;
33
34
  count: number;
34
35
  content: string;
36
+ /** ISO timestamp of the most recent message on this edge — drives
37
+ * the Round 10 freshness fade so dormant links recede visually. */
38
+ last_at: string;
35
39
  }
36
40
 
37
41
  const cx = 500;
@@ -85,36 +89,118 @@ function truncate(value: string, max: number) {
85
89
  return value.length > max ? `${value.slice(0, max - 1)}...` : value;
86
90
  }
87
91
 
92
+ /** Round 46 / Loop: SWR-freshness chip.
93
+ *
94
+ * TopoGraph's data refreshes every 5 s via SWR but the user has no
95
+ * visible signal that the canvas they're looking at is current. The
96
+ * flow particles and chips (R42 active-links, R43 hub) tell you when
97
+ * the FLEET last did something, not when the DATA last syncing. This
98
+ * chip ticks `live · Ns` against a 1-second interval so the operator
99
+ * can trust freshness without doing internal math.
100
+ *
101
+ * Owns its own setInterval so the parent topology doesn't re-render
102
+ * every second (only this small chip does). lastSyncRef is updated
103
+ * whenever the `sessions` prop reference changes — that's the SWR
104
+ * refresh signal. */
105
+ function FreshnessChip({ sessions }: { sessions: unknown }) {
106
+ const lastSyncRef = useRef<number>(Date.now());
107
+ const [now, setNow] = useState(() => Date.now());
108
+ useEffect(() => {
109
+ // sessions reference changed → SWR just delivered a new payload.
110
+ lastSyncRef.current = Date.now();
111
+ }, [sessions]);
112
+ useEffect(() => {
113
+ const id = setInterval(() => setNow(Date.now()), 1000);
114
+ return () => clearInterval(id);
115
+ }, []);
116
+ const sec = Math.max(0, Math.floor((now - lastSyncRef.current) / 1000));
117
+ // Tint the chip warmer when the data goes stale (>10s since last sync).
118
+ // SWR's default refreshInterval here is 5s, so anything past ~10s is
119
+ // either a poll miss or a network hiccup.
120
+ const stale = sec > 10;
121
+ return (
122
+ <span
123
+ className={stale
124
+ ? "hidden sm:inline px-2.5 py-1 rounded-md bg-amber-500/10 text-amber-300 border border-amber-500/20 font-mono"
125
+ : "hidden sm:inline px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono"}
126
+ title={stale ? `Last sync ${sec}s ago — SWR refresh may be lagging` : `Live data · refreshes every 5s · last sync ${sec}s ago`}
127
+ data-freshness-chip
128
+ >
129
+ live · {sec}s
130
+ </span>
131
+ );
132
+ }
133
+
134
+ /** Round 36 / Loop: prefers-reduced-motion hook.
135
+ *
136
+ * Round 29's a11y sweep zeroed CSS animations via media query, but SVG
137
+ * SMIL `<animate>` / `<animateMotion>` elements aren't reachable from CSS
138
+ * — they need JS to opt out. This hook reads the media query and listens
139
+ * for changes so the topology's flow particles, pulses, click ripple
140
+ * and hub breath honour the OS-level preference. */
141
+ function useReducedMotion(): boolean {
142
+ const [reduced, setReduced] = useState(false);
143
+ useEffect(() => {
144
+ if (typeof window === 'undefined' || !window.matchMedia) return;
145
+ const mq = window.matchMedia('(prefers-reduced-motion: reduce)');
146
+ setReduced(mq.matches);
147
+ const onChange = (e: MediaQueryListEvent) => setReduced(e.matches);
148
+ mq.addEventListener('change', onChange);
149
+ return () => mq.removeEventListener('change', onChange);
150
+ }, []);
151
+ return reduced;
152
+ }
153
+
154
+ // Round 38 / Loop: parseHubTime + relativeAgo factored to app/lib/time.ts
155
+ // — the Round 35 fix lives there now alongside the Round 37 mirror so
156
+ // any future TZ-safe parse update happens in one place.
157
+
158
+ /** Round 12 / Loop: status trio audit.
159
+ *
160
+ * Each (status × theme) cell returns a {primary, halo, text} trio. The trio
161
+ * invariant — keep it when adding states or tweaking shades:
162
+ *
163
+ * light: primary = <hue>-600 halo = <hue>-100 * text = <hue>-800/900
164
+ * dark: primary = <hue>-400/500 halo = <hue>-900 text = <hue>-100
165
+ *
166
+ * * offline.halo light deviates intentionally to slate-200 (#e2e8f0):
167
+ * slate-100 (#f1f5f9) is too close to the panel bg (#f8fafc) and the
168
+ * halo would vanish. The other three rows keep the 100-shade.
169
+ *
170
+ * Audit caught one cross-family drift before this round: online-other halo
171
+ * light was #dbeafe (blue-100) while its primary (#0284c7 sky-600) and text
172
+ * (#0c4a6e sky-900) were sky-family — now sky-100 (#e0f2fe). Tiny visual
173
+ * difference; large hygiene win — every trio is now mono-hue. */
88
174
  function nodeStatus(session: Session, isOnline: boolean, isLight: boolean) {
89
175
  if (!isOnline) {
90
176
  return {
91
177
  label: 'offline',
92
- primary: isLight ? '#94a3b8' : '#6b7280',
93
- halo: isLight ? '#e2e8f0' : '#111827',
94
- text: isLight ? '#475569' : '#9ca3af',
178
+ primary: isLight ? '#94a3b8' : '#6b7280', // slate-400 / gray-500
179
+ halo: isLight ? '#e2e8f0' : '#111827', // slate-200* / gray-900
180
+ text: isLight ? '#475569' : '#9ca3af', // slate-600 / gray-400
95
181
  };
96
182
  }
97
183
  if (session.status === 'working') {
98
184
  return {
99
185
  label: 'working',
100
- primary: isLight ? '#059669' : '#22c55e',
101
- halo: isLight ? '#d1fae5' : '#14532d',
102
- text: isLight ? '#065f46' : '#dcfce7',
186
+ primary: isLight ? '#059669' : '#22c55e', // emerald-600 / green-500
187
+ halo: isLight ? '#d1fae5' : '#14532d', // emerald-100 / green-900
188
+ text: isLight ? '#065f46' : '#dcfce7', // emerald-800 / green-100
103
189
  };
104
190
  }
105
191
  if (session.status === 'idle') {
106
192
  return {
107
193
  label: 'idle',
108
- primary: isLight ? '#0d9488' : '#2dd4bf',
109
- halo: isLight ? '#ccfbf1' : '#134e4a',
110
- text: isLight ? '#115e59' : '#ccfbf1',
194
+ primary: isLight ? '#0d9488' : '#2dd4bf', // teal-600 / teal-400
195
+ halo: isLight ? '#ccfbf1' : '#134e4a', // teal-100 / teal-900
196
+ text: isLight ? '#115e59' : '#ccfbf1', // teal-800 / teal-100
111
197
  };
112
198
  }
113
199
  return {
114
200
  label: session.status || 'online',
115
- primary: isLight ? '#0284c7' : '#38bdf8',
116
- halo: isLight ? '#dbeafe' : '#0c4a6e',
117
- text: isLight ? '#0c4a6e' : '#e0f2fe',
201
+ primary: isLight ? '#0284c7' : '#38bdf8', // sky-600 / sky-400
202
+ halo: isLight ? '#e0f2fe' : '#0c4a6e', // sky-100 / sky-900 (was blue-100 — drift fixed Round 12)
203
+ text: isLight ? '#0c4a6e' : '#e0f2fe', // sky-900 / sky-100
118
204
  };
119
205
  }
120
206
 
@@ -312,12 +398,20 @@ function buildFlowLinks(messages: MessageFlow[], positions: Record<string, Point
312
398
  const key = `${message.from_alias}->${message.to_alias}`;
313
399
  const current = links.get(key);
314
400
 
401
+ // Keep the most-recent timestamp per pair so the render can fade
402
+ // dormant edges (Round 10 freshness fade).
403
+ const incoming = message.created_at || '';
404
+ const last_at = !current
405
+ ? incoming
406
+ : (incoming > current.last_at ? incoming : current.last_at);
407
+
315
408
  links.set(key, {
316
409
  key,
317
410
  from: message.from_alias,
318
411
  to: message.to_alias,
319
412
  count: (current?.count || 0) + 1,
320
413
  content: current?.content || message.content,
414
+ last_at,
321
415
  });
322
416
  });
323
417
 
@@ -327,6 +421,7 @@ function buildFlowLinks(messages: MessageFlow[], positions: Record<string, Point
327
421
  export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProps) {
328
422
  const theme = useTheme();
329
423
  const isLight = theme === 'light';
424
+ const reducedMotion = useReducedMotion();
330
425
  const pal = isLight ? LIGHT_PALETTE : DARK_PALETTE;
331
426
  const brand = useBrand();
332
427
  const isIntern = brand === 'intern';
@@ -388,6 +483,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
388
483
  activeAliases,
389
484
  groupKeys,
390
485
  groupBoxes,
486
+ gridContentBottom,
391
487
  } = useMemo(() => {
392
488
  const sseCount = (s: { alias: string; network_id?: string }) =>
393
489
  (s.network_id ? sseSessions[`${s.network_id}:${s.alias}`] : undefined) ?? sseSessions[s.alias];
@@ -397,17 +493,25 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
397
493
  // index, so contiguous-in-array becomes contiguous-in-ring, i.e.
398
494
  // each team visually clusters. localeCompare keeps CJK ordering sane.
399
495
  const byAlias = (a: Session, b: Session) => a.alias.localeCompare(b.alias);
400
- // #112 umbrella: ghost age-out — an offline node not seen for over a day
401
- // is almost certainly a deleted node the server `/api/status` still
496
+ // #112 umbrella: ghost age-out — an offline node not seen recently is
497
+ // almost certainly a deleted node the server `/api/status` still
402
498
  // returns (#74 root cause is server-side; this is the dashboard-side
403
499
  // fallback so stale ghosts stop cluttering the topology). A missing
404
500
  // last_seen_at is kept (conservative — could be a legitimately new node).
405
- const GHOST_MS = 24 * 60 * 60 * 1000;
501
+ // Round 27 / P0: the 24h threshold was too lenient — Vincent's preview.29
502
+ // screenshot showed B站马 nodes deleted ~4 h earlier still visible. A
503
+ // healthy agent heartbeats every few seconds; if it's been silent for
504
+ // an hour it's effectively gone. 1 h gives a fresh disconnect time to
505
+ // come back while removing dead nodes well within an operator session.
506
+ const GHOST_MS = 60 * 60 * 1000;
406
507
  const now = Date.now();
407
508
  const isGhost = (s: Session) => {
408
509
  if (s.status !== 'offline' || sseCount(s) || !s.last_seen_at) return false;
409
- const t = Date.parse(s.last_seen_at);
410
- return !Number.isNaN(t) && now - t > GHOST_MS;
510
+ // Round 35 / Loop: parseHubTime normalises SQL-style timestamps to UTC
511
+ // before parsing so non-UTC browsers don't see a phantom 8-hour skew
512
+ // and ghost freshly-disconnected nodes.
513
+ const t = parseHubTime(s.last_seen_at);
514
+ return t !== null && now - t > GHOST_MS;
411
515
  };
412
516
  const online = sessions.filter(s => s.status !== 'offline' || sseCount(s)).sort(byAlias);
413
517
  const offline = sessions.filter(s => s.status === 'offline' && !sseCount(s) && !isGhost(s)).sort(byAlias);
@@ -470,11 +574,25 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
470
574
  // padding always fit and stacked group boxes never touch; past the
471
575
  // floor the grid overflows and zoom/pan handles it.
472
576
  const GROUP_TOP = nodeR + 20;
473
- // Row-height floor = the tightest of: a node + its label below it
474
- // (2·nodeR + ~22), and the label band + min box padding (GROUP_TOP + 12).
475
- // Below this, rows would overlap; past it the grid overflows and
476
- // zoom/pan covers the rest.
477
- const cellH = Math.max(2 * nodeR + 22, GROUP_TOP + 12, Math.min(100, (gy1 - gy0) / totalRows));
577
+ // Round 27 / P0 (Vincent screenshot preview.29): dense plain-text
578
+ // node labels (`pos.y + radius + denseDrop`, with a 3 px containerBg
579
+ // stroke halo for readability) at the BOTTOM row of band N would
580
+ // paint OVER the start of band N+1's group label, creating the
581
+ // "blueleap → eleap", "agent-network-dashboard → t-network / board"
582
+ // visual chopping. Geometry of the collision:
583
+ // dense label visual bottom = node_N.y + radius + denseDrop + halo
584
+ // group label glyph top = boxY + 4 (text y=boxY+14, ~10px ascent)
585
+ // = node_N+1.y - GROUP_TOP + 4
586
+ // node_N+1.y - node_N.y = cellH for consecutive rows, so no-collide:
587
+ // cellH ≥ radius + denseDrop + halo + GROUP_TOP - 4 + buffer
588
+ // With halo=3 buffer=4: cellH ≥ nodeR + denseDrop + GROUP_TOP + 3.
589
+ const denseDrop = nodeScale < 0.8 ? 12 : 14;
590
+ const cellH = Math.max(
591
+ 2 * nodeR + 22, // node + dense label within band
592
+ GROUP_TOP + 12, // group-label band + box padding
593
+ nodeR + denseDrop + GROUP_TOP + 3, // round-27 dense↔group label clearance
594
+ Math.min(100, (gy1 - gy0) / totalRows),
595
+ );
478
596
 
479
597
  // Pass 2 — place each band's members.
480
598
  for (const band of bands) {
@@ -505,14 +623,36 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
505
623
  const xs = pts.map(p => p.x);
506
624
  const ys = pts.map(p => p.y);
507
625
  const minX = Math.min(...xs), minY = Math.min(...ys);
626
+ // Round 58 / Loop: per-group status mix for the label pip strip.
627
+ // Working = status==='working'. Idle = online but not working.
628
+ // Offline = !isOnline (either status==='offline' AND no SSE, or
629
+ // ghost-purged elsewhere — but ghosts never reach groupBoxes
630
+ // since they're filtered out upstream). Counts feed the label
631
+ // tspans directly so the strip stays inside the label's bbox,
632
+ // preserving the node↔label overlap-test guarantee from R19.
633
+ let w = 0, i = 0, o = 0;
634
+ for (const s of band.members) {
635
+ const isOn = s.status !== 'offline' || !!sseCount(s);
636
+ if (s.status === 'working') w++;
637
+ else if (isOn) i++;
638
+ else o++;
639
+ }
508
640
  return {
509
641
  key: band.members.length ? groupKeys[band.members[0].alias] : '',
642
+ count: band.members.length,
643
+ statuses: { working: w, idle: i, offline: o },
510
644
  x: minX - GROUP_PAD,
511
645
  y: minY - GROUP_TOP,
512
646
  w: Math.max(...xs) - minX + GROUP_PAD * 2,
513
647
  h: Math.max(...ys) - minY + GROUP_TOP + GROUP_PAD,
514
648
  };
515
649
  });
650
+ // Round 28 / Loop: surface the grid's natural content bottom so the
651
+ // mount effect can auto-fit zoom when the layout would overflow the
652
+ // viewBox. = bottom of the last node row + its label drop + a small
653
+ // breathing buffer. Round 27's cellH bump makes this overflow more
654
+ // common (30-node fleets reach ~774 px, viewBox is 680).
655
+ const gridContentBottom = gy0 + totalRows * cellH + 8;
516
656
  return {
517
657
  onlineNodes: online,
518
658
  offlineNodes: offline,
@@ -521,6 +661,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
521
661
  activeAliases: active,
522
662
  groupKeys,
523
663
  groupBoxes,
664
+ gridContentBottom,
524
665
  };
525
666
  }
526
667
 
@@ -602,16 +743,197 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
602
743
  groupKeys,
603
744
  // #111: group boxes are a grid-layout feature only — radially scattered
604
745
  // ring nodes can't be cleanly boxed. Ring keeps the #83 prefix hue.
605
- groupBoxes: [] as { key: string; x: number; y: number; w: number; h: number }[],
746
+ groupBoxes: [] as { key: string; count: number; statuses: { working: number; idle: number; offline: number }; x: number; y: number; w: number; h: number }[],
747
+ // ring fits within VIEWBOX_H by construction (offlineRadius=325 + centre at y=330)
748
+ gridContentBottom: 0,
606
749
  };
607
750
  }, [messages, sessions, sseSessions, layout, nodeScale]);
608
751
 
609
752
  const workingCount = onlineNodes.filter(s => s.status === 'working').length;
753
+ // Round 6 / Loop: vendor distribution for the header chip — at a glance
754
+ // "what's in the fleet" (A:5 M:2 O:8 书:12 …) without opening a node.
755
+ // Sorted by count desc; "unknown" vendors collapse into a "?" bucket.
756
+ const vendorDist = useMemo(() => {
757
+ const tally = new Map<string, { initial: string; count: number; color: string }>();
758
+ for (const s of [...onlineNodes, ...offlineNodes]) {
759
+ const v = vendorForModel(s.model);
760
+ const key = v.id === 'unknown' ? '?' : v.initial;
761
+ const cur = tally.get(key);
762
+ if (cur) cur.count++;
763
+ else tally.set(key, { initial: key, count: 1, color: v.mono.text });
764
+ }
765
+ return [...tally.values()].sort((a, b) => b.count - a.count);
766
+ }, [onlineNodes, offlineNodes]);
610
767
  // Round 109 (Vincent 4582 P0): hover-gated labels above this node count
611
768
  // so dense fleets show clean avatars instead of a wall of overlapping
612
769
  // label cards. 16 ≈ where the triple-tier rings start to crowd.
613
770
  const denseLayout = onlineNodes.length + offlineNodes.length > 16;
614
771
  const [hoveredAlias, setHoveredAlias] = useState<string | null>(null);
772
+ // Round 86 / Loop: pointer-over-label preview. R63 wired the group
773
+ // label to click-pin but hover gave no preview — the same hover/click
774
+ // gap R83 closed for pressure-bar segments. This state lets the
775
+ // label trigger the same dim mechanism a node hover already drives,
776
+ // independently of whether the cursor happens to be over a member
777
+ // node. ORs into hoveredGroup below so the existing derivation logic
778
+ // (which composes with hoveredAlias, activeGroup, R85 marching ants)
779
+ // keeps working unchanged.
780
+ const [hoveredGroupLabel, setHoveredGroupLabel] = useState<string | null>(null);
781
+ // Round 8 / Loop: which group is currently focused. Nodes outside this
782
+ // group + other group boxes fade so the eye locks onto the team you're
783
+ // pointing at. Singletons use their own alias as the group key.
784
+ const hoveredGroup = hoveredGroupLabel
785
+ ?? (hoveredAlias ? (groupKeys[hoveredAlias] ?? hoveredAlias) : null);
786
+ // Round 63 / Loop: sticky group focus. R8 dims non-group nodes while
787
+ // a member is hovered, but releasing the hover lets the focus fade.
788
+ // Clicking the group label pins the group key here; activeGroup =
789
+ // hoveredGroup ?? pinnedGroup so hover transiently overrides the
790
+ // pin (handy for spot-comparing teams). Same compose pattern as
791
+ // R60/R61 pinnedStatus.
792
+ const [pinnedGroup, setPinnedGroup] = useState<string | null>(() => {
793
+ // R66: same per-tab persistence treatment as pinnedStatus above.
794
+ // The group key is opaque text (could be any prefix), so the init
795
+ // reader can't validate it against a known enum — it just reads
796
+ // whatever's stored. A useEffect below clears it if the value no
797
+ // longer matches any current group (sessions changed since save).
798
+ if (typeof window === 'undefined') return null;
799
+ try { return sessionStorage.getItem('anet-topo-pinned-group'); } catch { return null; }
800
+ });
801
+ const activeGroup = hoveredGroup ?? pinnedGroup;
802
+ // R66: sync pinnedGroup into sessionStorage when it changes; clear
803
+ // it if it no longer matches any current group (the session set
804
+ // can change between loads). The pinnedStatus sync sits next to
805
+ // its declaration further down.
806
+ useEffect(() => {
807
+ try {
808
+ if (pinnedGroup) sessionStorage.setItem('anet-topo-pinned-group', pinnedGroup);
809
+ else sessionStorage.removeItem('anet-topo-pinned-group');
810
+ } catch {}
811
+ }, [pinnedGroup]);
812
+ useEffect(() => {
813
+ if (!pinnedGroup) return;
814
+ const known = new Set(Object.values(groupKeys));
815
+ if (!known.has(pinnedGroup)) setPinnedGroup(null);
816
+ }, [pinnedGroup, groupKeys]);
817
+ // Round 49 / Loop: reverse-direction of R40's edge-on-node-hover linkage.
818
+ // R48 widened the flow hitbox to 16 px, so edges are precise enough to
819
+ // serve as a state trigger. When the user hovers a flow edge, light up its
820
+ // two endpoint nodes and dim the rest — "who is this edge between" becomes
821
+ // visible without reading the tooltip. The set is the link's two aliases
822
+ // (null when no edge hovered); node opacity composes this after inFocus.
823
+ const [hoveredEdgeKey, setHoveredEdgeKey] = useState<string | null>(null);
824
+ // Round 77 / Loop: hovering the "N active links" header chip globally
825
+ // brightens every flow edge (1.5× opacity). Transient affordance — the
826
+ // chip already says HOW MANY active flows exist; this answers WHERE
827
+ // they are in one glance, without the user scanning the canvas for
828
+ // moving particles. Reset on mouse leave.
829
+ const [hoveredActiveLinks, setHoveredActiveLinks] = useState(false);
830
+ // Round 80 / Loop: vendor-letter hover in the distribution chip. The
831
+ // chip already names vendor mix (`C:5 G:3 ?:1`); hover a letter and
832
+ // every node from OTHER vendors dims. Surfaces the breakdown spatially
833
+ // without inventing a new pin slot. Stores the vendor `initial`
834
+ // (single char or "?") that matches the tally key.
835
+ const [hoveredVendor, setHoveredVendor] = useState<string | null>(null);
836
+ // Round 88 / Loop: vendor filter pin. R80 added hover-to-dim on the
837
+ // vendor letters but the filter released as soon as the cursor left
838
+ // — vendor was the only filter dimension without a sticky variant
839
+ // (R60 status, R63 group, R69 Cmd+K all support pin). This state
840
+ // closes the gap. Same pattern as pinnedStatus / pinnedGroup:
841
+ // per-tab sessionStorage persistence, Esc clears, activeVendor =
842
+ // hoveredVendor ?? pinnedVendor so hover still wins for spot-
843
+ // comparison while a pin is active.
844
+ const [pinnedVendor, setPinnedVendor] = useState<string | null>(() => {
845
+ if (typeof window === 'undefined') return null;
846
+ try { return sessionStorage.getItem('anet-topo-pinned-vendor'); } catch { return null; }
847
+ });
848
+ const activeVendor = hoveredVendor ?? pinnedVendor;
849
+ useEffect(() => {
850
+ try {
851
+ if (pinnedVendor) sessionStorage.setItem('anet-topo-pinned-vendor', pinnedVendor);
852
+ else sessionStorage.removeItem('anet-topo-pinned-vendor');
853
+ } catch {}
854
+ }, [pinnedVendor]);
855
+ // R89: stale-purge. If the fleet's vendor distribution changes such
856
+ // that a previously-pinned vendor is gone (last node of that
857
+ // vendor disconnected), clear the pin so the chip row doesn't
858
+ // show "filter: A · 0" forever. Matches the same defensive purge
859
+ // pattern pinnedGroup uses higher up — sessionStorage survives
860
+ // reloads, but a stored value that no longer matches reality
861
+ // would paint with an impossible filter.
862
+ useEffect(() => {
863
+ if (pinnedVendor && !vendorDist.some(v => v.initial === pinnedVendor)) {
864
+ setPinnedVendor(null);
865
+ }
866
+ }, [pinnedVendor, vendorDist]);
867
+ // Round 55 / Loop: hovering a legend status row dims nodes whose status
868
+ // doesn't match. The legend was passive — "what does this colour mean".
869
+ // Now it answers "show me all of these" the same way R8 group-focus
870
+ // answers "show me this team". Three values match the legend rows.
871
+ const [hoveredStatus, setHoveredStatus] = useState<'working' | 'idle' | 'offline' | null>(null);
872
+ // Round 60 / Loop: sticky variant of `hoveredStatus`. R55 only filters
873
+ // while the user is actively hovering the legend; for sweeping a fleet
874
+ // you want to LOCK the filter. Each segment of the R31 pressure bar
875
+ // toggles a pin — click again on the same segment to release. The node
876
+ // opacity formula reads `activeStatus = hoveredStatus ?? pinnedStatus`
877
+ // so hover transiently overrides a pin (handy for spot-comparison)
878
+ // without nuking it.
879
+ // Round 66 / Loop: pin survives a page reload via sessionStorage —
880
+ // per-tab not per-browser (a new tab starts clean, intentionally).
881
+ // The init reader validates against the known status set so a stale
882
+ // / corrupt value can't paint the canvas with an impossible filter.
883
+ const [pinnedStatus, setPinnedStatus] = useState<'working' | 'idle' | 'offline' | null>(() => {
884
+ if (typeof window === 'undefined') return null;
885
+ try {
886
+ const v = sessionStorage.getItem('anet-topo-pinned-status');
887
+ return (v === 'working' || v === 'idle' || v === 'offline') ? v : null;
888
+ } catch { return null; }
889
+ });
890
+ const activeStatus = hoveredStatus ?? pinnedStatus;
891
+ // R66: sync pinnedStatus into sessionStorage when it changes. Paired
892
+ // with the matching effect for pinnedGroup higher up.
893
+ useEffect(() => {
894
+ try {
895
+ if (pinnedStatus) sessionStorage.setItem('anet-topo-pinned-status', pinnedStatus);
896
+ else sessionStorage.removeItem('anet-topo-pinned-status');
897
+ } catch {}
898
+ }, [pinnedStatus]);
899
+ // R69: listen for Cmd+K palette pin actions. The palette can't reach
900
+ // this component's state directly so it dispatches a CustomEvent;
901
+ // we react by setting pinnedStatus / pinnedGroup. The palette also
902
+ // writes to sessionStorage in lockstep, so the R66 init readers
903
+ // would pick it up on reload — the event handler is what keeps the
904
+ // currently-mounted canvas in sync without one.
905
+ useEffect(() => {
906
+ const onPin = (e: Event) => {
907
+ const detail = (e as CustomEvent).detail || {};
908
+ if (detail.kind === 'clear') {
909
+ // R90: extend the universal clear to vendor. R69 only cleared
910
+ // status + group because pinnedVendor didn't exist yet; R88
911
+ // shipped the third pin and R90 closes the palette gap so
912
+ // "Clear topology filters" really means all of them.
913
+ setPinnedStatus(null);
914
+ setPinnedGroup(null);
915
+ setPinnedVendor(null);
916
+ } else if (detail.kind === 'clear-vendor') {
917
+ // R90: granular vendor-only clear so power users can release
918
+ // just the vendor without disturbing status/group pins.
919
+ setPinnedVendor(null);
920
+ } else if (detail.kind === 'status') {
921
+ const v = detail.value;
922
+ if (v === 'working' || v === 'idle' || v === 'offline') setPinnedStatus(v);
923
+ } else if (detail.kind === 'group' && typeof detail.value === 'string') {
924
+ setPinnedGroup(detail.value);
925
+ }
926
+ };
927
+ window.addEventListener('anet:topo-pin', onPin);
928
+ return () => window.removeEventListener('anet:topo-pin', onPin);
929
+ }, []);
930
+ // R74 listener for layout + view palette commands lives below
931
+ // fitView's declaration — see further down in the file.
932
+ const hoveredEdgeEndpoints = useMemo<Set<string> | null>(() => {
933
+ if (!hoveredEdgeKey) return null;
934
+ const link = flowLinks.find(l => l.key === hoveredEdgeKey);
935
+ return link ? new Set([link.from, link.to]) : null;
936
+ }, [hoveredEdgeKey, flowLinks]);
615
937
 
616
938
  // --- Round 103 (issue #81): fullscreen + zoom + pan interaction layer ---
617
939
  // DIY native (no d3 / svg-pan-zoom): wrap the topology content in a single
@@ -631,6 +953,15 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
631
953
  // Issue #100: singleton chat popover. One alias at a time — clicking
632
954
  // another node swaps the target and the conversation switches in place.
633
955
  const [chatAlias, setChatAlias] = useState<string | null>(null);
956
+ // Round 14 / Loop: one-shot click ripple — fades outward from the clicked
957
+ // node so the click registers physically before the popover snaps in.
958
+ // Pairs with the Round 11 chat-focus ring: ripple expands, ring locks on.
959
+ // Keyed by ts so re-clicking the same node remounts the <circle> and the
960
+ // SMIL <animate> replays. Cleared 600ms after click (longer than the
961
+ // 500ms animation so a final frame at opacity 0 is still in the tree).
962
+ const [clickRipple, setClickRipple] = useState<{
963
+ ts: number; x: number; y: number; r0: number; color: string;
964
+ } | null>(null);
634
965
  // #84: when a node is renamed while its chat popover is open, follow the
635
966
  // rename so the conversation keeps targeting a live alias.
636
967
  useEffect(() => {
@@ -661,6 +992,42 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
661
992
  } catch {}
662
993
  }, []);
663
994
 
995
+ // Round 28 / Loop: first-paint auto-fit. Round 27's cellH bump means
996
+ // dense grids (≥6-7 rows) overflow the 680-px viewBox at the natural
997
+ // 100% zoom — a new user sees the topology with its bottom rows
998
+ // clipped and no hint that there's more below. Auto-fit on first
999
+ // paint (and only if the user has no persisted view) sets the
1000
+ // initial zoom so all content fits. Subsequent zoom changes persist
1001
+ // and override the auto-fit on reload; explicit reset (0 key) still
1002
+ // goes back to 100% so the gesture's "reset to natural size" semantic
1003
+ // is preserved.
1004
+ //
1005
+ // Capture pre-mount persistence in a useState initializer — the
1006
+ // existing `persist` effect (declared below) runs on first render
1007
+ // with the default {1,0,0} view and writes it to localStorage before
1008
+ // the auto-fit effect (deps on async-arriving sessions) gets a turn.
1009
+ // Reading localStorage from the effect would see that write and
1010
+ // skip the fit. The useState snapshot fires once, before any effects.
1011
+ const [hadPersistedViewOnMount] = useState<boolean>(
1012
+ () => typeof window !== 'undefined' && !!localStorage.getItem('anet-topo-view'),
1013
+ );
1014
+ const autoFitDoneRef = useRef(false);
1015
+ useEffect(() => {
1016
+ if (autoFitDoneRef.current) return;
1017
+ if (hadPersistedViewOnMount) {
1018
+ autoFitDoneRef.current = true;
1019
+ return;
1020
+ }
1021
+ if (layout !== 'grid' || sessions.length === 0 || !gridContentBottom) return;
1022
+ if (gridContentBottom <= VIEWBOX_H) {
1023
+ autoFitDoneRef.current = true; // no overflow → no fit needed
1024
+ return;
1025
+ }
1026
+ const fitZoom = Math.max(ZOOM_MIN, Math.min(1, VIEWBOX_H / gridContentBottom));
1027
+ setView({ zoom: fitZoom, x: 0, y: 0 });
1028
+ autoFitDoneRef.current = true;
1029
+ }, [layout, sessions.length, gridContentBottom, hadPersistedViewOnMount]);
1030
+
664
1031
  // persist view
665
1032
  useEffect(() => {
666
1033
  try { localStorage.setItem('anet-topo-view', JSON.stringify(view)); } catch {}
@@ -680,6 +1047,14 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
680
1047
  const svg = svgRef.current;
681
1048
  if (!svg) return;
682
1049
  const onWheel = (e: WheelEvent) => {
1050
+ // Round 23 / Loop: only zoom on Ctrl/Meta+wheel when inline; plain
1051
+ // wheel over the canvas keeps scrolling the page (the topo sits at
1052
+ // the top of /; trapping page scroll mid-page is the classic
1053
+ // "scroll-jail" anti-pattern). In fullscreen the canvas owns the
1054
+ // viewport so any wheel zooms — no page scroll to preserve. Pinch-
1055
+ // zoom on a trackpad surfaces as ctrlKey=true natively, which is
1056
+ // also what we want (zoom the canvas, not the browser).
1057
+ if (!isFullscreen && !e.ctrlKey && !e.metaKey) return;
683
1058
  e.preventDefault();
684
1059
  const rect = svg.getBoundingClientRect();
685
1060
  const mx = ((e.clientX - rect.left) / rect.width) * VIEWBOX_W;
@@ -700,8 +1075,17 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
700
1075
  };
701
1076
  svg.addEventListener('wheel', onWheel, { passive: false });
702
1077
  return () => svg.removeEventListener('wheel', onWheel);
703
- }, []);
704
-
1078
+ // Re-attach when the fullscreen flag toggles so the handler's
1079
+ // closure picks up the new value (capture-by-closure means we'd
1080
+ // otherwise read the stale boolean forever).
1081
+ }, [isFullscreen]);
1082
+
1083
+ // Round 21 / Loop: pan-aware cursor. Static `grab` gave no tactile cue
1084
+ // that the canvas was actually being dragged — "grabbing" while
1085
+ // dragRef.current.active = true tells the hand it's moving the
1086
+ // viewport. Mirroring dragRef.active into state is the only way to
1087
+ // re-render the SVG style; the ref itself doesn't trigger renders.
1088
+ const [isPanning, setIsPanning] = useState(false);
705
1089
  const onPointerDown = (e: React.PointerEvent<SVGSVGElement>) => {
706
1090
  if (e.button !== 0) return;
707
1091
  (e.currentTarget as Element).setPointerCapture?.(e.pointerId);
@@ -712,6 +1096,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
712
1096
  baseX: viewRef.current.x,
713
1097
  baseY: viewRef.current.y,
714
1098
  };
1099
+ setIsPanning(true);
715
1100
  };
716
1101
  const onPointerMove = (e: React.PointerEvent<SVGSVGElement>) => {
717
1102
  const d = dragRef.current;
@@ -726,6 +1111,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
726
1111
  const onPointerUp = (e: React.PointerEvent<SVGSVGElement>) => {
727
1112
  if (!dragRef.current.active) return;
728
1113
  dragRef.current.active = false;
1114
+ setIsPanning(false);
729
1115
  try {
730
1116
  (e.currentTarget as Element).releasePointerCapture?.(e.pointerId);
731
1117
  } catch {}
@@ -743,6 +1129,90 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
743
1129
  };
744
1130
  const resetView = () => setView({ zoom: 1, x: 0, y: 0 });
745
1131
 
1132
+ // Round 29 / Loop: `f` = fit-to-content. Shared by the Round 28
1133
+ // first-paint auto-fit effect and the keyboard handler so the math is
1134
+ // in one place. When content already fits at natural zoom, this is
1135
+ // effectively a "recenter" — `f` always lands on a known good view.
1136
+ const fitView = useCallback(() => {
1137
+ const zoom = !gridContentBottom || gridContentBottom <= VIEWBOX_H
1138
+ ? 1
1139
+ : Math.max(ZOOM_MIN, Math.min(1, VIEWBOX_H / gridContentBottom));
1140
+ setView({ zoom, x: 0, y: 0 });
1141
+ }, [gridContentBottom]);
1142
+
1143
+ // R74: listen for layout + view palette commands. Sister to R69's
1144
+ // pin listener — palette dispatches a CustomEvent, the reducer here
1145
+ // calls toggleLayout / fitView. Sits below fitView's declaration so
1146
+ // the deps list resolves cleanly.
1147
+ useEffect(() => {
1148
+ const onLayout = (e: Event) => {
1149
+ const detail = (e as CustomEvent).detail || {};
1150
+ if (detail.kind === 'toggle') toggleLayout();
1151
+ };
1152
+ const onView = (e: Event) => {
1153
+ const detail = (e as CustomEvent).detail || {};
1154
+ if (detail.kind === 'fit') fitView();
1155
+ };
1156
+ window.addEventListener('anet:topo-layout', onLayout);
1157
+ window.addEventListener('anet:topo-view', onView);
1158
+ return () => {
1159
+ window.removeEventListener('anet:topo-layout', onLayout);
1160
+ window.removeEventListener('anet:topo-view', onView);
1161
+ };
1162
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1163
+ }, [fitView]);
1164
+
1165
+ // Round 22 / Loop: keyboard zoom — +/= zoom in, - zoom out, 0 reset.
1166
+ // Round 29 / Loop: +f to fit content.
1167
+ // Listen on window so the user doesn't need to focus the SVG first,
1168
+ // but only act when no text input has focus (otherwise typing "-" in
1169
+ // a chat would zoom the topology — surprising and bad). Modifier keys
1170
+ // pass through so Cmd/Ctrl combos still hit their owners. The button
1171
+ // titles below document these shortcuts so users discover them.
1172
+ useEffect(() => {
1173
+ const onKey = (e: KeyboardEvent) => {
1174
+ if (e.ctrlKey || e.metaKey || e.altKey) return;
1175
+ const ae = document.activeElement as HTMLElement | null;
1176
+ if (ae) {
1177
+ const tag = ae.tagName;
1178
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || ae.isContentEditable) return;
1179
+ }
1180
+ if (e.key === '+' || e.key === '=') { zoomBy(1.2); e.preventDefault(); }
1181
+ else if (e.key === '-' || e.key === '_') { zoomBy(1 / 1.2); e.preventDefault(); }
1182
+ else if (e.key === '0') { resetView(); e.preventDefault(); }
1183
+ else if (e.key === 'f' || e.key === 'F') { fitView(); e.preventDefault(); }
1184
+ // Round 32 / Loop: `l` toggles ring|grid. The vim-style `g l` route
1185
+ // (Audit Log) requires a preceding `g` within 1500ms; a bare `l`
1186
+ // outside that window is free for topology use.
1187
+ else if (e.key === 'l' || e.key === 'L') { toggleLayout(); e.preventDefault(); }
1188
+ // Round 62 / Loop: Esc clears the R60/R61 pinned status filter so
1189
+ // users have a universal-cancel keyboard out. Esc on an open chat
1190
+ // is owned by ChatPopover (which only mounts when chatAlias is
1191
+ // set), so this handler is effectively scoped to "no chat open".
1192
+ // We additionally guard on chatAlias to be explicit — if the chat
1193
+ // closed mid-cycle, the pin can still be cleared on the next Esc.
1194
+ // R63: extends to pinnedGroup too. Clears WHATEVER pin is active
1195
+ // (one Esc collapses all topology pins) so the keyboard escape
1196
+ // route stays a single key, not "Esc maybe Esc again".
1197
+ else if (e.key === 'Escape' && !chatAlias && (pinnedStatus || pinnedGroup || pinnedVendor)) {
1198
+ // R88: extend the universal-cancel to pinnedVendor too. One Esc
1199
+ // collapses every topology pin (matches R62/R63's "single key,
1200
+ // not Esc-maybe-Esc-again" promise).
1201
+ if (pinnedStatus) setPinnedStatus(null);
1202
+ if (pinnedGroup) setPinnedGroup(null);
1203
+ if (pinnedVendor) setPinnedVendor(null);
1204
+ e.preventDefault();
1205
+ }
1206
+ };
1207
+ window.addEventListener('keydown', onKey);
1208
+ return () => window.removeEventListener('keydown', onKey);
1209
+ // zoomBy / resetView are stable wrt setView callback; fitView changes
1210
+ // with gridContentBottom so deps list catches it. R62 adds chatAlias
1211
+ // and pinnedStatus so the Escape branch reads fresh state (re-binding
1212
+ // the listener on these state changes is sub-ms — cheaper than refs).
1213
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1214
+ }, [fitView, chatAlias, pinnedStatus, pinnedGroup, pinnedVendor]);
1215
+
746
1216
  const toggleFullscreen = () => {
747
1217
  const el = containerRef.current;
748
1218
  if (!el) return;
@@ -770,6 +1240,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
770
1240
  <button
771
1241
  onClick={() => { if (layout !== 'ring') toggleLayout(); }}
772
1242
  aria-pressed={layout === 'ring'}
1243
+ title="Ring layout (l to toggle)"
773
1244
  className={`px-2.5 py-1 transition-colors ${layout === 'ring' ? 'bg-cyan-500/15 text-cyan-300' : 'text-gray-500 hover:text-gray-400'}`}
774
1245
  >
775
1246
  Ring
@@ -777,20 +1248,408 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
777
1248
  <button
778
1249
  onClick={() => { if (layout !== 'grid') toggleLayout(); }}
779
1250
  aria-pressed={layout === 'grid'}
1251
+ title="Grid layout (l to toggle)"
780
1252
  className={`px-2.5 py-1 border-l border-gray-500/25 transition-colors ${layout === 'grid' ? 'bg-cyan-500/15 text-cyan-300' : 'text-gray-500 hover:text-gray-400'}`}
781
1253
  >
782
1254
  Grid
783
1255
  </button>
784
1256
  </div>
785
- <span className="px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20">
1257
+ {/* R79: working + online count chips become hover affordances —
1258
+ extends R77's chip-hover pattern to status counts. Hover the
1259
+ working chip → setHoveredStatus('working') so the R55 dim
1260
+ mechanic kicks in (same as hovering the SVG legend "working"
1261
+ row, just a different surface for the same gesture).
1262
+ The online chip uses the same setHoveredStatus('idle') path
1263
+ when there's idle but no working — falling back to working
1264
+ if any working node exists; "online" without a single bucket
1265
+ isn't part of the R55 type set, so this chip routes to the
1266
+ dominant online sub-tier instead of inventing a new state.
1267
+ Cursor only flips when there's anything to highlight. */}
1268
+ {/* R82: pin-mirror. R60 pressure-bar segments visualise the
1269
+ pinned status via an inset boxShadow; R61 legend rows via a
1270
+ concentric r=8 ring; the chip-row chips next to them did
1271
+ not — so a user who pinned via Cmd+K (R69) or the legend
1272
+ had no chip-row signal that "working" was the current
1273
+ filter. Mirror the pressure-bar treatment here so all
1274
+ status surfaces sing in unison. The online chip mirrors
1275
+ for idle pins (working ⊆ online; the routing in
1276
+ onMouseEnter already treats online as the idle fallback). */}
1277
+ <span
1278
+ className="px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20"
1279
+ data-working-chip
1280
+ data-pin-mirror={pinnedStatus === 'working' ? 'true' : 'false'}
1281
+ title={workingCount > 0 ? (pinnedStatus === 'working' ? 'Pinned — Esc to clear' : 'Hover to highlight working nodes') : undefined}
1282
+ style={{
1283
+ cursor: workingCount > 0 ? 'pointer' : undefined,
1284
+ boxShadow: pinnedStatus === 'working' ? 'inset 0 0 0 1px #4ade80, inset 0 0 0 2px rgba(255,255,255,0.45)' : undefined,
1285
+ }}
1286
+ onMouseEnter={() => { if (workingCount > 0) setHoveredStatus('working'); }}
1287
+ onMouseLeave={() => setHoveredStatus(prev => prev === 'working' ? null : prev)}
1288
+ >
786
1289
  {workingCount} working
787
1290
  </span>
788
- <span className="px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20">
1291
+ <span
1292
+ className="px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20"
1293
+ data-online-chip
1294
+ data-pin-mirror={pinnedStatus === 'idle' ? 'true' : 'false'}
1295
+ title={onlineNodes.length > 0 ? (pinnedStatus === 'idle' ? 'Pinned — Esc to clear' : 'Hover to highlight online nodes') : undefined}
1296
+ style={{
1297
+ cursor: onlineNodes.length > 0 ? 'pointer' : undefined,
1298
+ boxShadow: pinnedStatus === 'idle' ? 'inset 0 0 0 1px #67e8f9, inset 0 0 0 2px rgba(255,255,255,0.45)' : undefined,
1299
+ }}
1300
+ onMouseEnter={() => {
1301
+ // If a working filter would isolate nothing, route to idle.
1302
+ const idleCount = onlineNodes.length - workingCount;
1303
+ if (workingCount > 0) setHoveredStatus('working');
1304
+ else if (idleCount > 0) setHoveredStatus('idle');
1305
+ }}
1306
+ onMouseLeave={() => setHoveredStatus(prev => prev === 'working' || prev === 'idle' ? null : prev)}
1307
+ >
789
1308
  {onlineNodes.length} online
790
1309
  </span>
791
- <span className="px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20">
792
- {flowLinks.length} active links
793
- </span>
1310
+ {/* Round 31 / Loop: fleet-health pressure bar. The "X working /
1311
+ Y online" chips already carry the raw counts; the bar lets
1312
+ the eye get the working/idle/offline RATIO in one glance
1313
+ without mental math. Stacked 3-segment chip, ~64 px wide. */}
1314
+ {(() => {
1315
+ const w = workingCount;
1316
+ const i = onlineNodes.length - workingCount; // idle = online - working
1317
+ const o = offlineNodes.length;
1318
+ const total = w + i + o;
1319
+ if (total === 0) return null;
1320
+ // Round 60 / Loop: each segment toggles a sticky filter via
1321
+ // `pinnedStatus`. Click the working segment → all non-working
1322
+ // nodes dim; click again → release. Segments share width with
1323
+ // their proportion of `total`, so a 1-node working share is
1324
+ // ~3 px wide on a 64-px bar. We pad the click target with a
1325
+ // negative-margin overlay wrapper to give thin slices a
1326
+ // 14-px minimum hit area without disturbing the rendered
1327
+ // chip width. cursor:pointer + a one-line title hint at the
1328
+ // affordance.
1329
+ const seg = (n: number, color: string, key: 'working' | 'idle' | 'offline', label: string) => {
1330
+ if (n === 0) return null;
1331
+ const isPinned = pinnedStatus === key;
1332
+ // R102: list the aliases that match this segment's bucket
1333
+ // so the title answers WHICH n, not just HOW MANY. Closes
1334
+ // the last "info-density gap" in the chip-row surfaces
1335
+ // (R97 pills / R99 group labels / R101 vendor letters all
1336
+ // already enumerate). Truncates at 8 with "+N more".
1337
+ const matchAliases = key === 'working'
1338
+ ? onlineNodes.filter(s => s.status === 'working').map(s => s.alias)
1339
+ : key === 'idle'
1340
+ ? onlineNodes.filter(s => s.status !== 'working').map(s => s.alias)
1341
+ : offlineNodes.map(s => s.alias);
1342
+ const previewList = matchAliases.slice(0, 8).join(', ');
1343
+ const suffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1344
+ const titleAction = isPinned ? 'click to release filter' : 'click to highlight';
1345
+ return (
1346
+ <span
1347
+ key={key}
1348
+ data-pressure-seg={key}
1349
+ data-pressure-seg-aliases={matchAliases.join(',')}
1350
+ role="button"
1351
+ tabIndex={0}
1352
+ aria-pressed={isPinned}
1353
+ title={`${n} ${label}\n${previewList}${suffix}\n${titleAction}`}
1354
+ style={{
1355
+ width: `${(n / total) * 100}%`,
1356
+ background: color,
1357
+ height: '100%',
1358
+ cursor: 'pointer',
1359
+ boxShadow: isPinned ? `inset 0 0 0 1px ${color}, inset 0 0 0 2px rgba(255,255,255,0.6)` : undefined,
1360
+ }}
1361
+ onClick={(e) => {
1362
+ e.stopPropagation();
1363
+ setPinnedStatus(prev => prev === key ? null : key);
1364
+ }}
1365
+ onKeyDown={(e) => {
1366
+ if (e.key === 'Enter' || e.key === ' ') {
1367
+ e.preventDefault();
1368
+ setPinnedStatus(prev => prev === key ? null : key);
1369
+ }
1370
+ }}
1371
+ // R83: hover preview — segments now match the R55 legend,
1372
+ // R79 working/online chips, and R80 vendor letters in
1373
+ // offering a hover-transient highlight before the click
1374
+ // commits to a pin. Users get to feel what the filter
1375
+ // does before they lock it in. Same activeStatus =
1376
+ // hoveredStatus ?? pinnedStatus formula; releasing the
1377
+ // pointer falls back to the pin if one is set, or to
1378
+ // baseline. Thin (3-px) segments still hit-test fine
1379
+ // because the chip itself is a flex row — span doesn't
1380
+ // need any extra hit padding for hover.
1381
+ onMouseEnter={() => setHoveredStatus(key)}
1382
+ onMouseLeave={() => setHoveredStatus(prev => prev === key ? null : prev)}
1383
+ />
1384
+ );
1385
+ };
1386
+ // Round 47 / Loop: hidden on mobile — at <640px the chip row
1387
+ // wraps to multiple lines and crowds the topology header;
1388
+ // pressure ratio is best read with the working+online raw
1389
+ // counts (kept visible) anyway.
1390
+ return (
1391
+ <span
1392
+ className="hidden sm:inline-flex items-center gap-2 px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono"
1393
+ title={`${w} working · ${i} idle · ${o} offline`}
1394
+ data-fleet-pressure
1395
+ >
1396
+ <span className="text-[10px] tracking-wide">pressure</span>
1397
+ <span className="inline-flex h-1.5 w-16 rounded-full overflow-hidden" style={{ background: 'rgb(75 85 99 / 0.25)' }}>
1398
+ {seg(w, isLight ? '#059669' : '#22c55e', 'working', 'working')}
1399
+ {seg(i, isLight ? '#0d9488' : '#2dd4bf', 'idle', 'idle')}
1400
+ {seg(o, isLight ? '#94a3b8' : '#6b7280', 'offline', 'offline')}
1401
+ </span>
1402
+ </span>
1403
+ );
1404
+ })()}
1405
+ {/* Round 64 / Loop: active-filter pills. When pinnedStatus or
1406
+ pinnedGroup is set, show a small "filter: <key> ×" pill so
1407
+ the user can see the pin from the chip row even if they
1408
+ scrolled the canvas off-screen. × button clears the
1409
+ specific pin (Esc still clears all — both paths are
1410
+ valid). pinnedStatus and pinnedGroup pin independently so
1411
+ both pills may render simultaneously. */}
1412
+ {/* R67: pills enter via anet-fade-in so they appear softly
1413
+ instead of popping. The "filter: " prefix collapses below
1414
+ sm — at narrow viewports the chip row is precious real
1415
+ estate (R47 already hides pressure / vendor / freshness),
1416
+ so dropping the redundant label keeps the working/idle/
1417
+ alpha keys readable without overflow. */}
1418
+ {/* R71: each pill picks up a "· N" match count tail. Tells the
1419
+ user at a glance how many sessions the active filter
1420
+ matches without scanning the canvas. Counts come from the
1421
+ already-computed workingCount + onlineNodes + offlineNodes
1422
+ for status, and groupKeys for group. */}
1423
+ {/* R73: entire pill body is a click-to-clear target — matches
1424
+ the Notion / Linear tag UX (the whole chip releases). The
1425
+ × keeps its dedicated <button> + aria-label for screen
1426
+ readers; the outer span just adds an extra mouse-friendly
1427
+ hit area with a title hint. ×'s onClick stopPropagation
1428
+ so the redundant outer onClick doesn't double-fire (no
1429
+ functional difference since both clear, but cleaner
1430
+ event flow). */}
1431
+ {pinnedStatus && (() => {
1432
+ const matchCount = pinnedStatus === 'working' ? workingCount
1433
+ : pinnedStatus === 'idle' ? (onlineNodes.length - workingCount)
1434
+ : offlineNodes.length;
1435
+ // Round 97 / Loop: the pill says HOW MANY but not WHICH.
1436
+ // Hovering it now shows the matched alias list in the
1437
+ // tooltip — answers "exactly who is this filtering to"
1438
+ // without forcing the user to scan the dim mask on the
1439
+ // canvas. Truncates at 8 names so a 50-node working
1440
+ // bucket doesn't produce a 12-line tooltip; the count
1441
+ // chip already answers "how many overall".
1442
+ const matchAliases = pinnedStatus === 'working'
1443
+ ? onlineNodes.filter(s => s.status === 'working').map(s => s.alias)
1444
+ : pinnedStatus === 'idle'
1445
+ ? onlineNodes.filter(s => s.status !== 'working').map(s => s.alias)
1446
+ : offlineNodes.map(s => s.alias);
1447
+ const matchPreview = matchAliases.slice(0, 8).join(', ');
1448
+ const matchSuffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1449
+ return (
1450
+ <span
1451
+ data-active-filter="status"
1452
+ data-filter-match-count={matchCount}
1453
+ data-filter-match-aliases={matchAliases.join(',')}
1454
+ className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in"
1455
+ title={matchCount > 0 ? `${matchPreview}${matchSuffix} — click to clear` : 'Click to clear filter'}
1456
+ onClick={() => setPinnedStatus(null)}
1457
+ style={{
1458
+ background: pinnedStatus === 'working' ? (isLight ? '#05966914' : '#22c55e1f')
1459
+ : pinnedStatus === 'idle' ? (isLight ? '#0d948814' : '#2dd4bf1f')
1460
+ : (isLight ? '#94a3b814' : '#6b72801f'),
1461
+ color: pinnedStatus === 'working' ? (isLight ? '#047857' : '#86efac')
1462
+ : pinnedStatus === 'idle' ? (isLight ? '#0f766e' : '#5eead4')
1463
+ : (isLight ? '#475569' : '#9ca3af'),
1464
+ borderColor: 'currentColor',
1465
+ cursor: 'pointer',
1466
+ }}
1467
+ >
1468
+ <span><span className="hidden sm:inline" data-filter-prefix>filter: </span>{pinnedStatus}<span className="opacity-70"> · {matchCount}</span></span>
1469
+ <button
1470
+ type="button"
1471
+ aria-label={`Clear ${pinnedStatus} filter`}
1472
+ onClick={(e) => { e.stopPropagation(); setPinnedStatus(null); }}
1473
+ className="ml-0.5 leading-none hover:opacity-70"
1474
+ style={{ background: 'transparent', color: 'inherit', cursor: 'pointer', padding: 0 }}
1475
+ >×</button>
1476
+ </span>
1477
+ );
1478
+ })()}
1479
+ {pinnedGroup && (() => {
1480
+ const matchCount = Object.values(groupKeys).filter(k => k === pinnedGroup).length;
1481
+ // R97: list group members in the tooltip.
1482
+ const matchAliases = Object.entries(groupKeys)
1483
+ .filter(([, key]) => key === pinnedGroup)
1484
+ .map(([alias]) => alias);
1485
+ const matchPreview = matchAliases.slice(0, 8).join(', ');
1486
+ const matchSuffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1487
+ return (
1488
+ <span
1489
+ data-active-filter="group"
1490
+ data-filter-match-count={matchCount}
1491
+ data-filter-match-aliases={matchAliases.join(',')}
1492
+ className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in"
1493
+ title={matchCount > 0 ? `${matchPreview}${matchSuffix} — click to clear` : 'Click to clear filter'}
1494
+ onClick={() => setPinnedGroup(null)}
1495
+ style={{
1496
+ background: isLight ? '#67e8f914' : '#67e8f91f',
1497
+ color: pal.legendAccent,
1498
+ borderColor: 'currentColor',
1499
+ cursor: 'pointer',
1500
+ }}
1501
+ >
1502
+ <span><span className="hidden sm:inline" data-filter-prefix>filter: </span>{pinnedGroup}<span className="opacity-70"> · {matchCount}</span></span>
1503
+ <button
1504
+ type="button"
1505
+ aria-label={`Clear group filter ${pinnedGroup}`}
1506
+ onClick={(e) => { e.stopPropagation(); setPinnedGroup(null); }}
1507
+ className="ml-0.5 leading-none hover:opacity-70"
1508
+ style={{ background: 'transparent', color: 'inherit', cursor: 'pointer', padding: 0 }}
1509
+ >×</button>
1510
+ </span>
1511
+ );
1512
+ })()}
1513
+ {/* R89: vendor pin gets its own filter pill, matching the R64
1514
+ status + group pattern. R88 added the pin but only the
1515
+ letter itself carried the state; the chip-row had no
1516
+ "filter: A · 2 ×" affordance the other two pins have. The
1517
+ pill colour borrows the vendor's own swatch so each pin
1518
+ still reads in its native hue (A green, O cyan, 书 blue,
1519
+ ? slate). Same body-click-clears + × button pattern as
1520
+ R64. */}
1521
+ {pinnedVendor && (() => {
1522
+ const matchEntry = vendorDist.find(v => v.initial === pinnedVendor);
1523
+ const matchCount = matchEntry?.count ?? 0;
1524
+ const vendorColor = matchEntry?.color ?? pal.legendText;
1525
+ // R97: list vendor users in the tooltip. The vendorIdentity
1526
+ // resolver maps model strings to a vendor initial — match
1527
+ // any session whose initial equals the pinned letter (with
1528
+ // unknowns folded to '?').
1529
+ const matchAliases = [...onlineNodes, ...offlineNodes]
1530
+ .filter(s => {
1531
+ const v = vendorForModel(s.model);
1532
+ return (v.id === 'unknown' ? '?' : v.initial) === pinnedVendor;
1533
+ })
1534
+ .map(s => s.alias);
1535
+ const matchPreview = matchAliases.slice(0, 8).join(', ');
1536
+ const matchSuffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1537
+ return (
1538
+ <span
1539
+ data-active-filter="vendor"
1540
+ data-filter-match-count={matchCount}
1541
+ data-filter-match-aliases={matchAliases.join(',')}
1542
+ className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in"
1543
+ title={matchCount > 0 ? `${matchPreview}${matchSuffix} — click to clear` : 'Click to clear vendor filter'}
1544
+ onClick={() => setPinnedVendor(null)}
1545
+ style={{
1546
+ background: `${vendorColor}1f`,
1547
+ color: vendorColor,
1548
+ borderColor: 'currentColor',
1549
+ cursor: 'pointer',
1550
+ }}
1551
+ >
1552
+ <span><span className="hidden sm:inline" data-filter-prefix>filter: </span>{pinnedVendor}<span className="opacity-70"> · {matchCount}</span></span>
1553
+ <button
1554
+ type="button"
1555
+ aria-label={`Clear vendor filter ${pinnedVendor}`}
1556
+ onClick={(e) => { e.stopPropagation(); setPinnedVendor(null); }}
1557
+ className="ml-0.5 leading-none hover:opacity-70"
1558
+ style={{ background: 'transparent', color: 'inherit', cursor: 'pointer', padding: 0 }}
1559
+ >×</button>
1560
+ </span>
1561
+ );
1562
+ })()}
1563
+ {vendorDist.length > 1 && (
1564
+ <span
1565
+ className="hidden sm:inline-flex items-center gap-2 px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono"
1566
+ title="Hover to highlight; click to pin"
1567
+ >
1568
+ {vendorDist.map(v => {
1569
+ const isPinned = pinnedVendor === v.initial;
1570
+ // R88: click toggles a sticky filter the same way R60
1571
+ // pressure-bar segments toggle pinnedStatus. Visual
1572
+ // mirror = inset boxShadow using the vendor's own
1573
+ // colour, so each pinned letter sings in its own hue
1574
+ // (Anthropic green / OpenAI cyan / 书 blue / ?).
1575
+ // R101: tooltip lists the aliases that use this vendor —
1576
+ // completes the info-density triple started by R97 pills,
1577
+ // R98 node titles, R99 group-label titles. Anywhere the
1578
+ // UI shows "A:3" should hover-explain which 3.
1579
+ const aliases = [...onlineNodes, ...offlineNodes]
1580
+ .filter(s => {
1581
+ const vid = vendorForModel(s.model);
1582
+ return (vid.id === 'unknown' ? '?' : vid.initial) === v.initial;
1583
+ })
1584
+ .map(s => s.alias);
1585
+ const preview = aliases.slice(0, 8).join(', ');
1586
+ const suffix = aliases.length > 8 ? ` + ${aliases.length - 8} more` : '';
1587
+ const tooltip = isPinned
1588
+ ? `${preview}${suffix} — click again or Esc to clear`
1589
+ : `${preview}${suffix} — click to pin`;
1590
+ return (
1591
+ <span
1592
+ key={v.initial}
1593
+ role="button"
1594
+ tabIndex={0}
1595
+ aria-pressed={isPinned}
1596
+ className="inline-flex items-baseline gap-0.5 px-1 rounded"
1597
+ data-vendor-letter={v.initial}
1598
+ data-vendor-pinned={isPinned ? 'true' : 'false'}
1599
+ data-vendor-aliases={aliases.join(',')}
1600
+ title={tooltip}
1601
+ style={{
1602
+ cursor: 'pointer',
1603
+ boxShadow: isPinned
1604
+ ? `inset 0 0 0 1px ${v.color}, inset 0 0 0 2px rgba(255,255,255,0.45)`
1605
+ : undefined,
1606
+ }}
1607
+ onMouseEnter={() => setHoveredVendor(v.initial)}
1608
+ onMouseLeave={() => setHoveredVendor(prev => prev === v.initial ? null : prev)}
1609
+ onClick={() => setPinnedVendor(prev => prev === v.initial ? null : v.initial)}
1610
+ onKeyDown={(e) => {
1611
+ if (e.key === 'Enter' || e.key === ' ') {
1612
+ e.preventDefault();
1613
+ setPinnedVendor(prev => prev === v.initial ? null : v.initial);
1614
+ }
1615
+ }}
1616
+ >
1617
+ <span style={{ color: v.color }}>{v.initial}</span>
1618
+ <span className="text-gray-500">:{v.count}</span>
1619
+ </span>
1620
+ );
1621
+ })}
1622
+ </span>
1623
+ )}
1624
+ {/* Round 42 / Loop: extend active-links chip with the timestamp
1625
+ of the most-recent flow event. Tells the operator at a glance
1626
+ whether the topology is currently humming (last 30s) or has
1627
+ been quiet for a while — the visual flow particles and
1628
+ edge brightness only show that there IS traffic, not when
1629
+ the last one was. Reuses Round 38's relativeAgo. */}
1630
+ {(() => {
1631
+ const recent = flowLinks.reduce<number | null>((acc, l) => {
1632
+ if (!l.last_at) return acc;
1633
+ const t = parseHubTime(l.last_at);
1634
+ if (t === null) return acc;
1635
+ return acc === null || t > acc ? t : acc;
1636
+ }, null);
1637
+ const rel = recent !== null ? relativeAgo(new Date(recent).toISOString()) : null;
1638
+ return (
1639
+ <span
1640
+ className="hidden sm:inline px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20"
1641
+ data-active-links-chip
1642
+ title={flowLinks.length > 0 ? 'Hover to brighten all active flows' : undefined}
1643
+ style={{ cursor: flowLinks.length > 0 ? 'pointer' : undefined }}
1644
+ onMouseEnter={() => { if (flowLinks.length > 0) setHoveredActiveLinks(true); }}
1645
+ onMouseLeave={() => setHoveredActiveLinks(false)}
1646
+ >
1647
+ {flowLinks.length} active link{flowLinks.length === 1 ? '' : 's'}
1648
+ {rel ? <span className="text-gray-500"> · last {rel}</span> : null}
1649
+ </span>
1650
+ );
1651
+ })()}
1652
+ <FreshnessChip sessions={sessions} />
794
1653
  </div>
795
1654
  </div>
796
1655
 
@@ -810,7 +1669,18 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
810
1669
  onPointerMove={onPointerMove}
811
1670
  onPointerUp={onPointerUp}
812
1671
  onPointerLeave={onPointerUp}
813
- style={{ cursor: 'grab', touchAction: 'none' }}
1672
+ // Round 41 / Loop: the reset-button title (R22) and the Help
1673
+ // overlay (R25) both advertise "double-click the canvas to
1674
+ // reset", but the handler was never actually wired. The text
1675
+ // was lying. Wire it here, guarded so dbl-clicking a node
1676
+ // (which would also trigger the SVG-level handler via event
1677
+ // bubbling) doesn't unexpectedly reset the view on the user.
1678
+ onDoubleClick={(e) => {
1679
+ const t = e.target as Element | null;
1680
+ if (t?.closest('g[data-node]')) return;
1681
+ resetView();
1682
+ }}
1683
+ style={{ cursor: isPanning ? 'grabbing' : 'grab', touchAction: 'none' }}
814
1684
  >
815
1685
  <defs>
816
1686
  <linearGradient id="topo-panel" x1="0" x2="1" y1="0" y2="1">
@@ -832,9 +1702,37 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
832
1702
  </feMerge>
833
1703
  </filter>
834
1704
  )}
835
- <marker id="topo-arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="5" markerHeight="5" orient="auto-start-reverse">
836
- <path d="M 0 0 L 10 5 L 0 10 z" fill={pal.arrowFill} />
837
- </marker>
1705
+ {/* Round 16 / Loop: 3-tier flow-link arrow markers.
1706
+ The single marker had `markerUnits` defaulting to
1707
+ `strokeWidth`, so heavy edges (stroke=7) rendered 35-user-
1708
+ unit arrowheads — visually dominant, the head outweighed
1709
+ the line. Switching to `userSpaceOnUse` decouples arrow
1710
+ size from stroke; binning by count gives a clearer
1711
+ hierarchy than continuous linear scaling:
1712
+ s (count 1-2) → 12 user units
1713
+ m (count 3-4) → 16 user units (alias for `topo-arrow`)
1714
+ l (count 5+) → 22 user units
1715
+ `topo-arrow` stays bound to the medium tier so the legend
1716
+ swatch (line ~1500) renders without change. */}
1717
+ {[
1718
+ { id: 'topo-arrow-s', size: 12 },
1719
+ { id: 'topo-arrow', size: 16 },
1720
+ { id: 'topo-arrow-l', size: 22 },
1721
+ ].map(m => (
1722
+ <marker
1723
+ key={m.id}
1724
+ id={m.id}
1725
+ viewBox="0 0 10 10"
1726
+ refX="8"
1727
+ refY="5"
1728
+ markerWidth={m.size}
1729
+ markerHeight={m.size}
1730
+ markerUnits="userSpaceOnUse"
1731
+ orient="auto-start-reverse"
1732
+ >
1733
+ <path d="M 0 0 L 10 5 L 0 10 z" fill={pal.arrowFill} />
1734
+ </marker>
1735
+ ))}
838
1736
  {/* Round 45: radial radar sweep gradient — bright at center
839
1737
  (where it meets the hub) fading to leading edge. */}
840
1738
  <radialGradient id="topo-sweep" cx="0%" cy="50%" r="100%">
@@ -854,13 +1752,17 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
854
1752
  grid mode drops it so the concentric rings don't sit behind a
855
1753
  rectangular grid. */}
856
1754
  {layout === 'ring' && (<>
857
- <circle cx={cx} cy={cy} r="330" fill="url(#topo-radar)" />
1755
+ {/* R52: radar bg is pure decoration — drop its pointer events so
1756
+ the hub <g> under it (and any future inner-disk affordances)
1757
+ can receive clicks. Previously the r=330 disc intercepted
1758
+ the hub click outright. */}
1759
+ <circle cx={cx} cy={cy} r="330" fill="url(#topo-radar)" style={{ pointerEvents: 'none' }} />
858
1760
 
859
1761
  {/* Round 45: subtle star field — 24 deterministic dots scattered
860
1762
  across the canvas give the radar bg some depth. Skipped on
861
1763
  light theme so the white surface stays clean. */}
862
1764
  {!isLight && (
863
- <g opacity="0.5">
1765
+ <g opacity="0.5" style={{ pointerEvents: 'none' }}>
864
1766
  {Array.from({ length: 28 }).map((_, i) => {
865
1767
  // Deterministic pseudo-random scatter so positions are
866
1768
  // stable between renders (no JS hydration mismatch).
@@ -882,6 +1784,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
882
1784
  style={{
883
1785
  transformOrigin: `${cx}px ${cy}px`,
884
1786
  transformBox: 'view-box',
1787
+ pointerEvents: 'none',
885
1788
  }}
886
1789
  className="anet-topo-sweep"
887
1790
  opacity={isLight ? 0.7 : 1}
@@ -892,11 +1795,82 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
892
1795
  />
893
1796
  </g>
894
1797
 
895
- {/* radar rings */}
1798
+ {/* radar rings — pure decoration at fixed radii, independent of
1799
+ node positions so the radar aesthetic is preserved across tier
1800
+ changes. */}
896
1801
  {[90, 170, 250, 330].map(radius => (
897
1802
  <circle key={radius} cx={cx} cy={cy} r={radius} fill="none" stroke={pal.ringStroke} strokeWidth="1" opacity={isLight ? 0.6 : 0.35} />
898
1803
  ))}
899
1804
 
1805
+ {/* Round 54 / Loop: tier-radius guide rings. The radar rings above
1806
+ are decorative and don't match the actual tier radii nodes sit
1807
+ on (single 220 / dual 175,260 / triple 145,215,285). Drawing
1808
+ a faint dashed ring at each ACTIVE tier radius lets the eye
1809
+ anchor "this is the inner / outer ring" without inferring from
1810
+ node spacing. Picked based on online node count so only the
1811
+ tiers currently in use draw — empty tiers stay quiet. pointer-
1812
+ events:none so they never intercept hub or node clicks. The
1813
+ 0.7 stroke + dashed pattern reads as guide, not feature. */}
1814
+ {(() => {
1815
+ const tierRadii = onlineNodes.length > onlineTripleThreshold
1816
+ ? [onlineTripleInnerR, onlineTripleMidR, onlineTripleOuterR]
1817
+ : onlineNodes.length > onlineTierThreshold
1818
+ ? [onlineInnerRadius, onlineOuterRadius]
1819
+ : onlineNodes.length > 0
1820
+ ? [onlineRadius]
1821
+ : [];
1822
+ // Round 92 / Loop: tier-ring occupancy. R54 drew the guide
1823
+ // rings at fixed opacity regardless of how many nodes lived
1824
+ // on each tier. With pinned filters dimming most nodes to
1825
+ // 0.28, the ring at a deserted tier looked identical to a
1826
+ // crowded one — wasting a free piece of canvas. Count
1827
+ // online nodes whose hub-distance falls within ±15 px of
1828
+ // each ring (15 px = half the inter-tier gap, so each
1829
+ // node is assigned to exactly one ring). Empty tier → skip
1830
+ // entirely. Crowded tier → stronger opacity, says "look
1831
+ // here". Buckets so the ladder feels intentional, not
1832
+ // jittery as one node migrates between tiers.
1833
+ const occupancyOf = (r: number) => onlineNodes.reduce((acc, s) => {
1834
+ const p = nodePositions[s.alias];
1835
+ if (!p) return acc;
1836
+ const d = Math.hypot(p.x - cx, p.y - cy);
1837
+ return Math.abs(d - r) < 15 ? acc + 1 : acc;
1838
+ }, 0);
1839
+ // Round 93 / Loop: when any pin is active, tint the tier
1840
+ // rings to the legend accent so the spatial guide visually
1841
+ // shares the canvas's "filtered mode" colour. The chip
1842
+ // row already says WHICH filter is on (pills + letter
1843
+ // mirror); rings answering "we're filtered" reinforces
1844
+ // the state when the eye is on the canvas, not the chip
1845
+ // row. Composes cleanly with R92 occupancy — same opacity
1846
+ // bucket logic; just the stroke colour swaps.
1847
+ const anyPin = !!(pinnedStatus || pinnedGroup || pinnedVendor);
1848
+ const tierStroke = anyPin ? pal.legendAccent : pal.ringStroke;
1849
+ return tierRadii.map(r => {
1850
+ const n = occupancyOf(r);
1851
+ if (n === 0) return null;
1852
+ const bucket = n <= 2 ? 0 : n <= 6 ? 1 : 2;
1853
+ const opLight = [0.24, 0.36, 0.50][bucket];
1854
+ const opDark = [0.32, 0.46, 0.62][bucket];
1855
+ return (
1856
+ <circle
1857
+ key={`tier-${r}`}
1858
+ cx={cx} cy={cy} r={r}
1859
+ fill="none"
1860
+ stroke={tierStroke}
1861
+ strokeWidth="0.7"
1862
+ strokeDasharray="2 8"
1863
+ opacity={isLight ? opLight : opDark}
1864
+ style={{ pointerEvents: 'none', transition: 'stroke 200ms ease-out' }}
1865
+ data-tier-ring={r}
1866
+ data-tier-occupancy={n}
1867
+ data-tier-bucket={bucket}
1868
+ data-tier-tinted={anyPin ? 'true' : 'false'}
1869
+ />
1870
+ );
1871
+ });
1872
+ })()}
1873
+
900
1874
  {/* Round 50: 4 small particles slowly orbiting the outer ring
901
1875
  (r=330). Each starts at a different angle (offset 0/0.25/0.5/0.75
902
1876
  of the cycle) so they're evenly spaced. 16s per revolution is
@@ -966,32 +1940,162 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
966
1940
  only — groupBoxes is empty in ring mode. Rendered behind the
967
1941
  flow links + nodes; pointer-events off so they never intercept
968
1942
  a node click. Restrained dashed container + group-name label. */}
969
- {groupBoxes.map(box => (
970
- <g key={`grp-${box.key}`} data-group={box.key} style={{ pointerEvents: 'none' }}>
971
- <rect
972
- x={box.x}
973
- y={box.y}
974
- width={box.w}
975
- height={box.h}
976
- rx="14"
977
- fill={isLight ? '#0f172a' : '#a5b4fc'}
978
- fillOpacity={isLight ? 0.025 : 0.045}
979
- stroke={pal.ringStroke}
980
- strokeWidth="1.5"
981
- strokeDasharray="6 6"
982
- />
983
- <text
984
- x={box.x + 12}
985
- y={box.y + 14}
986
- fill={pal.legendText}
987
- fontSize="13"
988
- fontFamily="monospace"
989
- fontWeight="700"
1943
+ {groupBoxes.map(box => {
1944
+ const isHovered = activeGroup === box.key;
1945
+ // R68: distinguish "locked by click" from "currently hovered".
1946
+ // R63 made pinned and hovered identical (both hit isHovered
1947
+ // via activeGroup). A user with one team pinned should see at
1948
+ // a glance which is the locked one even while their cursor
1949
+ // sweeps elsewhere. isPinned reads pinnedGroup directly
1950
+ // (NOT activeGroup) so the visual is specific to the sticky
1951
+ // state — transient hover keeps the R63 isHovered styling.
1952
+ const isPinned = pinnedGroup === box.key;
1953
+ // Round 18 / Loop: group-box hover linkage. The Round 8 fade
1954
+ // already dropped OUT-of-focus groups to 0.28, but the IN-focus
1955
+ // group sat at its baseline appearance — no positive emphasis.
1956
+ // Hovering now upgrades the box to an "accent" treatment:
1957
+ // solid stroke (not dashed), thicker, accent-coloured; brighter
1958
+ // text and slightly stronger fill. Label and box read as one
1959
+ // selected unit. Geometry unchanged → overlap test untouched.
1960
+ return (
1961
+ <g
1962
+ key={`grp-${box.key}`}
1963
+ data-group={box.key}
1964
+ className="transition-opacity"
1965
+ // R63: drop the blanket pointerEvents:'none' that
1966
+ // previously sat here. Chrome's SVG impl doesn't let a
1967
+ // child override a parent's `none` even though the spec
1968
+ // says it should — moving the property onto just the
1969
+ // rect (where it's needed so nodes underneath stay
1970
+ // clickable) lets the label text receive its own click.
1971
+ style={{ opacity: !activeGroup || isHovered ? 1 : 0.28 }}
990
1972
  >
991
- {box.key}
992
- </text>
993
- </g>
994
- ))}
1973
+ <rect
1974
+ x={box.x}
1975
+ y={box.y}
1976
+ width={box.w}
1977
+ height={box.h}
1978
+ rx="14"
1979
+ fill={isLight ? '#0f172a' : '#a5b4fc'}
1980
+ // R68: 3-tier opacity + stroke ladder.
1981
+ // pinned → fill 0.08 / 0.13, stroke 3 px (locked)
1982
+ // hovered → fill 0.05 / 0.09, stroke 2 px (inspecting)
1983
+ // idle → fill 0.025 / 0.045, stroke 1.5 px dashed
1984
+ fillOpacity={isPinned ? (isLight ? 0.08 : 0.13)
1985
+ : isHovered ? (isLight ? 0.05 : 0.09)
1986
+ : (isLight ? 0.025 : 0.045)}
1987
+ stroke={(isPinned || isHovered) ? pal.legendAccent : pal.ringStroke}
1988
+ strokeWidth={isPinned ? 3 : isHovered ? 2 : 1.5}
1989
+ strokeDasharray={(isPinned || isHovered) ? 'none' : '6 6'}
1990
+ data-group-box-pinned={isPinned ? 'true' : 'false'}
1991
+ // R85: ambient "marching ants" drift on the perimeter
1992
+ // when this group has at least one working member, and
1993
+ // neither pin nor hover is active (those treatments
1994
+ // already shout for attention via solid stroke). 12s
1995
+ // cycle reads as ambient — the eye parses "live work
1996
+ // here" without registering the box as animating.
1997
+ data-group-box-live={!isPinned && !isHovered && box.statuses.working > 0 ? 'true' : 'false'}
1998
+ className={!isPinned && !isHovered && box.statuses.working > 0 ? 'anet-topo-groupbox-live' : undefined}
1999
+ style={{ transition: 'stroke 200ms ease-out, stroke-width 200ms ease-out, fill-opacity 200ms ease-out', pointerEvents: 'none' }}
2000
+ />
2001
+ {/* R63: wrap label in a clickable <g> with an invisible
2002
+ rect hitbox. The text alone wasn't getting hit-tested
2003
+ reliably — the SVG-wide topo-panel <rect> intercepts
2004
+ at the label's screen position when the label sits at
2005
+ a high viewBox-y (it lands below where the compositor
2006
+ expects the text to paint on top, same gotcha as the
2007
+ recent-signal panel rows in R56). Hitbox rect + the
2008
+ parent <g> taking the click + onPointerDown stop-
2009
+ propagation match the R55/R56/R61 pattern. */}
2010
+ <g
2011
+ role="button"
2012
+ tabIndex={0}
2013
+ aria-pressed={pinnedGroup === box.key}
2014
+ data-group-label-hit={box.key}
2015
+ style={{ pointerEvents: 'all', cursor: 'pointer' }}
2016
+ onPointerDown={(e) => e.stopPropagation()}
2017
+ onClick={() => setPinnedGroup(prev => prev === box.key ? null : box.key)}
2018
+ // R86: hover the label → transient group focus. Releases
2019
+ // on leave; activeGroup = hoveredGroup ?? pinnedGroup
2020
+ // formula already handles transient-over-pin so a
2021
+ // user can spot-compare teams without losing their
2022
+ // pinned one. Closes the same R83-style hover/click
2023
+ // gap (segments) — now group labels carry it too.
2024
+ onPointerEnter={() => setHoveredGroupLabel(box.key)}
2025
+ onPointerLeave={() => setHoveredGroupLabel(prev => prev === box.key ? null : prev)}
2026
+ >
2027
+ {/* R99: SVG <title> tooltip listing group members +
2028
+ status breakdown. Same info-density spirit as
2029
+ R97 pill tooltips + R98 node tooltips — anywhere
2030
+ a UI element says "alpha · 3" should hover-
2031
+ explain WHICH 3. Truncates at 8 aliases with a
2032
+ "+N more" suffix so a 20-member band doesn't
2033
+ paint a 22-line tooltip. */}
2034
+ {(() => {
2035
+ const members = Object.entries(groupKeys)
2036
+ .filter(([, key]) => key === box.key)
2037
+ .map(([alias]) => alias);
2038
+ const memberPreview = members.slice(0, 8).join(', ');
2039
+ const suffix = members.length > 8 ? ` + ${members.length - 8} more` : '';
2040
+ const statusSummary = [
2041
+ box.statuses.working > 0 ? `${box.statuses.working} working` : null,
2042
+ box.statuses.idle > 0 ? `${box.statuses.idle} idle` : null,
2043
+ box.statuses.offline > 0 ? `${box.statuses.offline} offline` : null,
2044
+ ].filter(Boolean).join(' · ');
2045
+ return (
2046
+ <title>{[
2047
+ `${box.key} (${members.length} member${members.length === 1 ? '' : 's'})`,
2048
+ statusSummary || null,
2049
+ `${memberPreview}${suffix}`,
2050
+ pinnedGroup === box.key ? 'click to release pin' : 'click to pin this group',
2051
+ ].filter(Boolean).join('\n')}</title>
2052
+ );
2053
+ })()}
2054
+ <rect
2055
+ x={box.x + 6}
2056
+ y={box.y + 2}
2057
+ width={Math.min(box.w - 12, 240)}
2058
+ height={20}
2059
+ fill="transparent"
2060
+ />
2061
+ <text
2062
+ x={box.x + 12}
2063
+ y={box.y + 14}
2064
+ fill={isHovered ? pal.legendHeadline : pal.legendText}
2065
+ fontSize="13"
2066
+ fontFamily="monospace"
2067
+ fontWeight="700"
2068
+ style={{ transition: 'fill 200ms ease-out' }}
2069
+ data-group-label={box.key}
2070
+ >
2071
+ {box.key}
2072
+ {/* Round 19 / Loop: member-count chip. Inline tspan stays
2073
+ in the single <text> bbox the overlap test reads, so
2074
+ the node↔label guard still catches if the chip ever
2075
+ pushes the label far enough right to clip a node.
2076
+ Smaller + lighter weight reads as metadata, not name. */}
2077
+ <tspan dx="6" fill={pal.legendText} fontSize="11" fontWeight="400">· {box.count}</tspan>
2078
+ {/* Round 58 / Loop: status mix pip strip. Compact text-
2079
+ based chips (e.g. "2w 1i") so the strip stays inside
2080
+ the same <text> bbox the overlap-test reads — keeps
2081
+ the R27 label↔label and R19 node↔label guards intact.
2082
+ Each tier is colour-coded against the legend swatches
2083
+ and only renders when count > 0, so a healthy all-
2084
+ working group reads simply " · 2w". */}
2085
+ {box.statuses.working > 0 && (
2086
+ <tspan dx="8" fill={isLight ? '#059669' : '#22c55e'} fontSize="11" fontWeight="600">{box.statuses.working}w</tspan>
2087
+ )}
2088
+ {box.statuses.idle > 0 && (
2089
+ <tspan dx="4" fill={isLight ? '#0d9488' : '#2dd4bf'} fontSize="11" fontWeight="600">{box.statuses.idle}i</tspan>
2090
+ )}
2091
+ {box.statuses.offline > 0 && (
2092
+ <tspan dx="4" fill={isLight ? '#94a3b8' : '#6b7280'} fontSize="11" fontWeight="600">{box.statuses.offline}o</tspan>
2093
+ )}
2094
+ </text>
2095
+ </g>
2096
+ </g>
2097
+ );
2098
+ })}
995
2099
 
996
2100
  {/* directed message flows */}
997
2101
  {flowLinks.map((link, index) => {
@@ -999,21 +2103,120 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
999
2103
  const to = nodePositions[link.to];
1000
2104
  if (!from || !to) return null;
1001
2105
 
1002
- const lift = index % 2 === 0 ? 36 : -36;
2106
+ // Round 7 / Loop: lift now scales with distance so short links
2107
+ // aren't over-bent (long links keep the ~36px hump), and the
2108
+ // particle period shortens with link.count so busier edges
2109
+ // visibly pulse faster — instant info density on top of the
2110
+ // existing stroke-width-by-count chip.
2111
+ const dist = Math.hypot(to.x - from.x, to.y - from.y);
2112
+ const lift = (index % 2 === 0 ? 1 : -1) * Math.min(36, dist * 0.18);
1003
2113
  const path = curvePath(from, to, lift);
1004
2114
  const width = Math.min(2 + link.count, 7);
1005
- const duration = 2.2 + (index % 5) * 0.32;
1006
-
2115
+ const duration = Math.max(0.9, 2.6 / Math.sqrt(link.count));
2116
+ // Round 10 / Loop: freshness fade. An edge that fired ≤30s ago
2117
+ // stays at full intensity; over 5 minutes it decays to ~35%.
2118
+ // Surfaces "what's happening now" vs background chatter without
2119
+ // hiding old flow entirely (some context still useful). `now`
2120
+ // captured at useMemo-recompute time (every 5s message refresh)
2121
+ // — accuracy is within the poll interval, plenty.
2122
+ const ageMs = link.last_at ? Math.max(0, Date.now() - Date.parse(link.last_at)) : 0;
2123
+ const fresh = Math.max(0.35, 1 - ageMs / (5 * 60 * 1000));
2124
+ // Round 16 arrow-tier binning — keep `topo-arrow` as the
2125
+ // medium tier id so the legend swatch picks it up unchanged.
2126
+ const arrowId = link.count <= 2 ? 'topo-arrow-s'
2127
+ : link.count <= 4 ? 'topo-arrow'
2128
+ : 'topo-arrow-l';
2129
+
2130
+ // Round 39 / Loop: edge hover tooltip — surface the same
2131
+ // last_at + count info the freshness fade and arrow tier
2132
+ // already encode visually, in plain text. The stroke is the
2133
+ // hover target; SVG `<title>` honours newlines on every
2134
+ // browser the dashboard targets.
2135
+ const lastAt = relativeAgo(link.last_at);
2136
+ const tooltip = `${link.from} → ${link.to}\n${link.count} message${link.count === 1 ? '' : 's'}${lastAt ? ` · last ${lastAt}` : ''}`;
2137
+ // Round 40 / Loop: edges follow node hover — when an alias is
2138
+ // hovered, every edge touching it brightens, the rest fade.
2139
+ // Pairs with the Round 8 group-focus fade on nodes: hover a
2140
+ // node to find "who is this agent talking to" at a glance.
2141
+ // No hover → multiplier is 1.0 (current behaviour preserved).
2142
+ // Round 50 / Loop: edge-on-self priority. When the user hovers
2143
+ // a flow edge directly (R48 widened the hitbox so this is now
2144
+ // a precise gesture), THAT edge gets the strongest boost (2.0)
2145
+ // and every other edge dims to 0.35. Node-hover (R40) keeps
2146
+ // its own ladder. Edge-hover and node-hover are mutually
2147
+ // exclusive in practice — the cursor is over one or the
2148
+ // other — but the order below makes edge-hover win if both
2149
+ // ever read truthy at the same React tick.
2150
+ // Round 53 / Loop: in-group edges follow team focus. R40
2151
+ // brightened only edges touching the exact hovered alias —
2152
+ // but with R8/R18 prefix-clustering, a user hovering one
2153
+ // member is asking about the team. So when BOTH endpoints of
2154
+ // an edge share the hoveredGroup (and neither is the exact
2155
+ // hovered alias — that gets the stronger 1.7×), the edge
2156
+ // boosts to 1.3×. Edges leaving the team (one endpoint in,
2157
+ // one out) still dim to 0.35× per R40 since they read as
2158
+ // background to the focus. Singletons fall through unchanged
2159
+ // (their group key is the alias itself, so bothInHoveredGroup
2160
+ // is impossible for a non-self-edge).
2161
+ const isHoveredEdge = hoveredEdgeKey === link.key;
2162
+ const fromGroup = groupKeys[link.from] ?? link.from;
2163
+ const toGroup = groupKeys[link.to] ?? link.to;
2164
+ const bothInHoveredGroup = !!activeGroup && fromGroup === activeGroup && toGroup === activeGroup;
2165
+ // R63: also gate "no filter" on activeGroup so pinnedGroup
2166
+ // alone activates the in-group 1.3× boost + non-group dim.
2167
+ // When neither a node nor a group is in focus, mul is 1.
2168
+ // R77: when the user hovers the "N active links" chip, the
2169
+ // baseline 1× becomes 1.5× — every flow brightens at once.
2170
+ // Sits inside the no-other-hover branch so it doesn't fight
2171
+ // the edge-hover (2.0×) or node-hover (1.7×) priorities.
2172
+ const edgeOpacityMul = isHoveredEdge
2173
+ ? 2.0
2174
+ : hoveredEdgeKey
2175
+ ? 0.35
2176
+ : !hoveredAlias && !activeGroup
2177
+ ? (hoveredActiveLinks ? 1.5 : 1)
2178
+ : (link.from === hoveredAlias || link.to === hoveredAlias)
2179
+ ? 1.7
2180
+ : bothInHoveredGroup
2181
+ ? 1.3
2182
+ : 0.35;
2183
+ // Round 50: the hovered edge also visibly thickens so the eye
2184
+ // tracks it even at low message counts (width was 3 → 4.5 on
2185
+ // hover). 1.4× is enough to read as "lifted" without
2186
+ // breaching the 16-px hitbox bound.
2187
+ const renderWidth = isHoveredEdge ? Math.min(width * 1.4, 10) : width;
1007
2188
  return (
1008
2189
  <g key={link.key}>
2190
+ {/* Round 48 / Loop: invisible hover hitbox — visible flow
2191
+ path is 3-7 px wide and damn hard to hover precisely.
2192
+ Stack a transparent 16-px-wide stroke behind it so the
2193
+ cursor only needs to be ~8 px from the line for the
2194
+ tooltip to fire. Native <title> moves here; the
2195
+ visible path no longer needs it. pointer-events on
2196
+ the visible path drop to "none" since the hitbox
2197
+ owns the hover surface. */}
2198
+ <path
2199
+ d={path}
2200
+ fill="none"
2201
+ stroke="transparent"
2202
+ strokeWidth={Math.max(width + 10, 16)}
2203
+ style={{ pointerEvents: 'stroke' }}
2204
+ data-edge-hitbox
2205
+ onMouseEnter={() => setHoveredEdgeKey(link.key)}
2206
+ onMouseLeave={() => setHoveredEdgeKey(prev => prev === link.key ? null : prev)}
2207
+ >
2208
+ <title>{tooltip}</title>
2209
+ </path>
1009
2210
  <path
1010
2211
  d={path}
1011
2212
  fill="none"
1012
2213
  stroke={pal.flowEdge}
1013
- strokeWidth={width}
1014
- opacity={isLight ? 0.22 : 0.28}
2214
+ strokeWidth={renderWidth}
2215
+ opacity={Math.min(1, (isLight ? 0.22 : 0.28) * fresh * edgeOpacityMul)}
1015
2216
  filter={isLight ? undefined : 'url(#topo-glow)'}
1016
- markerEnd="url(#topo-arrow)"
2217
+ markerEnd={`url(#${arrowId})`}
2218
+ className="transition-opacity duration-300"
2219
+ style={{ pointerEvents: 'none' }}
1017
2220
  />
1018
2221
  <path
1019
2222
  id={`flow-path-${index}`}
@@ -1022,45 +2225,223 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1022
2225
  stroke={pal.flowPath}
1023
2226
  strokeWidth="1"
1024
2227
  strokeDasharray="2 12"
1025
- opacity={isLight ? 0.4 : 0.75}
2228
+ opacity={Math.min(1, (isLight ? 0.4 : 0.75) * fresh * edgeOpacityMul)}
2229
+ className="transition-opacity duration-300"
1026
2230
  />
1027
- <circle r="4" fill={pal.flowParticle} filter={isLight ? undefined : 'url(#topo-glow)'}>
1028
- <animateMotion dur={`${duration}s`} repeatCount="indefinite" path={path} />
1029
- </circle>
2231
+ {!reducedMotion && (
2232
+ /* Round 103 / Loop: phase-stagger the particles so
2233
+ concurrent edges don't pulse in lockstep. SMIL
2234
+ `begin` accepts negative offsets to shift the cycle
2235
+ backwards in time, which means the particle starts
2236
+ mid-flight on first paint — no visible "all
2237
+ particles spawn from source simultaneously" tell.
2238
+ `(index * 0.37) % duration` gives a deterministic,
2239
+ well-distributed offset (the golden-ratio-ish 0.37
2240
+ fraction prevents lining up when N is a small
2241
+ multiple). Edge order is stable (sorted by recent
2242
+ activity), so the offsets feel calm rather than
2243
+ reshuffling each refresh. */
2244
+ <circle r="4" fill={pal.flowParticle} filter={isLight ? undefined : 'url(#topo-glow)'} opacity={Math.min(1, fresh * edgeOpacityMul)}>
2245
+ <animateMotion
2246
+ dur={`${duration}s`}
2247
+ begin={`-${((index * 0.37) % duration).toFixed(3)}s`}
2248
+ repeatCount="indefinite"
2249
+ path={path}
2250
+ />
2251
+ </circle>
2252
+ )}
2253
+ {/* Round 75 / Loop: arrival ping at the destination. The
2254
+ particle currently fades into the arrow marker
2255
+ silently — adding a small radiating ring synchronised
2256
+ to the particle's period turns message delivery into
2257
+ a visible event. begin = -dur*0.92 offsets the
2258
+ animation so the ring expands NEAR the end of each
2259
+ cycle (≈when the particle arrives). Gated by
2260
+ reducedMotion and on fresh > 0.5 — stale edges that
2261
+ haven't fired in minutes don't need the eye-grab.
2262
+ data-arrival-ping for testability. */}
2263
+ {!reducedMotion && fresh > 0.5 && (
2264
+ <circle
2265
+ cx={to.x}
2266
+ cy={to.y}
2267
+ r="0"
2268
+ fill="none"
2269
+ stroke={pal.flowEdge}
2270
+ strokeWidth="1.5"
2271
+ opacity="0"
2272
+ style={{ pointerEvents: 'none' }}
2273
+ data-arrival-ping={link.key}
2274
+ >
2275
+ <animate attributeName="r" values="0;14;22" dur={`${duration}s`} begin={`-${(duration * 0.92).toFixed(2)}s`} repeatCount="indefinite" />
2276
+ <animate attributeName="opacity" values="0;0.55;0" dur={`${duration}s`} begin={`-${(duration * 0.92).toFixed(2)}s`} repeatCount="indefinite" />
2277
+ </circle>
2278
+ )}
2279
+ {/* Round 76 / Loop: source dispatch pulse — mirror to the
2280
+ R75 arrival ping. begin = 0s (start of cycle) so the
2281
+ ring expands as the particle LEAVES the source. Only
2282
+ fires for high-traffic edges (link.count >= 3) — on
2283
+ quiet conversations the canvas should stay calm; on
2284
+ busy senders the pulse plus arrival ping bookend
2285
+ every message in flight, making the topology feel
2286
+ alive. Same fresh/reducedMotion gates as R75. Slightly
2287
+ smaller radius (0→12→18 vs R75's 0→14→22) so the
2288
+ source reads as "smaller event than arrival" — the
2289
+ destination is the meaningful endpoint. */}
2290
+ {!reducedMotion && fresh > 0.5 && link.count >= 3 && (
2291
+ <circle
2292
+ cx={from.x}
2293
+ cy={from.y}
2294
+ r="0"
2295
+ fill="none"
2296
+ stroke={pal.flowEdge}
2297
+ strokeWidth="1.5"
2298
+ opacity="0"
2299
+ style={{ pointerEvents: 'none' }}
2300
+ data-dispatch-pulse={link.key}
2301
+ >
2302
+ <animate attributeName="r" values="0;12;18" dur={`${duration}s`} begin="0s" repeatCount="indefinite" />
2303
+ <animate attributeName="opacity" values="0;0.45;0" dur={`${duration}s`} begin="0s" repeatCount="indefinite" />
2304
+ </circle>
2305
+ )}
2306
+ {/* Round 100 / Loop: midpoint count badge for high-
2307
+ traffic edges. Width already gauges intensity but
2308
+ "5 vs 12" is hard to read off stroke alone. Render
2309
+ a compact pill at the bezier midpoint (t=0.5 →
2310
+ midpoint + perpendicular × lift/2) showing the
2311
+ integer count. Threshold link.count >= 3 keeps
2312
+ the canvas quiet for sparse traffic. Bezier
2313
+ midpoint math: for a quadratic curve M A Q C B,
2314
+ the t=0.5 point is (A + 2C + B) / 4, which
2315
+ simplifies to (midAB) + 0.5 × (control - midAB)
2316
+ = midAB + perpendicular × lift/2. */}
2317
+ {link.count >= 3 && (() => {
2318
+ const midX = (from.x + to.x) / 2;
2319
+ const midY = (from.y + to.y) / 2;
2320
+ const dx = to.x - from.x;
2321
+ const dy = to.y - from.y;
2322
+ const len = Math.hypot(dx, dy) || 1;
2323
+ const badgeX = midX + (-dy / len) * lift * 0.5;
2324
+ const badgeY = midY + ( dx / len) * lift * 0.5;
2325
+ const badgeOpacity = Math.min(1, fresh * edgeOpacityMul);
2326
+ return (
2327
+ <g
2328
+ data-edge-count-badge={link.key}
2329
+ style={{ pointerEvents: 'none' }}
2330
+ opacity={badgeOpacity}
2331
+ >
2332
+ <circle
2333
+ cx={badgeX} cy={badgeY} r="9"
2334
+ fill={pal.legendBox.fill}
2335
+ stroke={pal.flowEdge}
2336
+ strokeWidth="1"
2337
+ opacity={isLight ? 0.95 : 0.82}
2338
+ />
2339
+ <text
2340
+ x={badgeX} y={badgeY + 3}
2341
+ textAnchor="middle"
2342
+ fill={pal.legendHeadline}
2343
+ fontSize="10"
2344
+ fontFamily="monospace"
2345
+ fontWeight="700"
2346
+ >{link.count}</text>
2347
+ </g>
2348
+ );
2349
+ })()}
1030
2350
  </g>
1031
2351
  );
1032
2352
  })}
1033
2353
 
1034
- {/* center hub — round 39: enlarged from r=6 (12px) to r=10 (20px)
1035
- core so the "control plane" reads as the network's anchor,
1036
- not a stray particle. Static halo ring at r=18 grounds it
1037
- visually; two outward pulses keep the "signal source" idea
1038
- from r17. Light theme gets a paler core to avoid hot-spotting
1039
- the bg. */}
1040
- {layout === 'ring' && (<g>
1041
- {/* static grounding halo — sits underneath, low opacity */}
1042
- <circle
1043
- cx={cx} cy={cy} r="18"
1044
- fill={isLight ? '#d1fae5' : '#10b981'}
1045
- opacity={isLight ? 0.35 : 0.10}
1046
- />
1047
- {/* outer pulse 1 */}
1048
- <circle cx={cx} cy={cy} r="10" fill="none" stroke="#10b981" strokeWidth="1.5">
1049
- <animate attributeName="r" values="10;38;10" dur="2.4s" repeatCount="indefinite" />
1050
- <animate attributeName="opacity" values="0.55;0;0.55" dur="2.4s" repeatCount="indefinite" />
1051
- </circle>
1052
- {/* outer pulse 2 (delayed 1.2s) */}
1053
- <circle cx={cx} cy={cy} r="10" fill="none" stroke="#10b981" strokeWidth="1.5" opacity="0">
1054
- <animate attributeName="r" values="10;38;10" dur="2.4s" begin="1.2s" repeatCount="indefinite" />
1055
- <animate attributeName="opacity" values="0.45;0;0.45" dur="2.4s" begin="1.2s" repeatCount="indefinite" />
1056
- </circle>
2354
+ {/* center hub — round 39 sized + round 13 restraint.
2355
+ The hub is the control-plane anchor. r39 gave it two outward
2356
+ pulses (r 10→38, 2.4s, double-phase) which read as "loudest
2357
+ node in the room" — wrong semantics: anchors don't emit,
2358
+ they hold. r13 swaps the kinetic pulse for a slow opacity
2359
+ breath on the static halo (4s, ±15% from base), so the hub
2360
+ stays alive without throwing kinetic energy outward. The
2361
+ dual-circle "lit lamp" core is unchanged. */}
2362
+ {layout === 'ring' && (<g
2363
+ data-topo-hub
2364
+ style={{ cursor: 'pointer' }}
2365
+ // Stop pointerdown from reaching the SVG pan handler — same
2366
+ // reason as the node <g>: a captured pointer makes Chromium
2367
+ // fire the follow-up click on the SVG, not this group.
2368
+ onPointerDown={(e) => e.stopPropagation()}
2369
+ // Round 52 / Loop: hub is the visual anchor but had no click
2370
+ // action — users discovered fit-to-content only via the `f`
2371
+ // key or the chrome button. Wire the hub to fitView() so the
2372
+ // most prominent element in the canvas is also the "re-
2373
+ // center" affordance. A click-ripple keyed by ts confirms
2374
+ // the gesture; the hub <title> now ends with a hint.
2375
+ onClick={() => {
2376
+ fitView();
2377
+ setClickRipple({ ts: Date.now(), x: cx, y: cy, r0: 18, color: isLight ? '#059669' : '#10b981' });
2378
+ setTimeout(() => setClickRipple(prev => prev && prev.x === cx && prev.y === cy ? null : prev), 600);
2379
+ }}
2380
+ >
2381
+ {/* Round 43 / Loop: hub `<title>` summary — hovering the
2382
+ central glow now answers "what is this?" with a one-line
2383
+ fleet snapshot. Duplicates the header chips by design;
2384
+ hovering the most visually prominent element is the
2385
+ most natural impulse, so satisfy it where the cursor
2386
+ already is. Falls clean: omits sub-clauses when their
2387
+ counts are zero. R52 appends a "click to fit view" hint.
2388
+ */}
2389
+ <title>{(() => {
2390
+ const total = sessions.length;
2391
+ const parts = [`Network hub`, `${total} session${total === 1 ? '' : 's'}`];
2392
+ if (onlineNodes.length > 0) parts.push(`${onlineNodes.length} online`);
2393
+ if (workingCount > 0) parts.push(`${workingCount} working`);
2394
+ if (flowLinks.length > 0) parts.push(`${flowLinks.length} active link${flowLinks.length === 1 ? '' : 's'}`);
2395
+ return parts.join(' · ') + '\nclick to fit view';
2396
+ })()}</title>
2397
+ {/* grounding halo — breathes in opacity, no expansion.
2398
+ R84: breath amplitude + tempo reflect workingCount. An
2399
+ idle fleet keeps the original gentle 0.32→0.52 (light) /
2400
+ 0.08→0.16 (dark) cycle over 4s — "heart at rest". As
2401
+ working sessions accumulate, the peak climbs and the
2402
+ period shortens, capped at 2.4s so it never feels
2403
+ manic. Quiet fleets see zero change; busy fleets feel
2404
+ the canvas working. */}
2405
+ {(() => {
2406
+ // Bucket workingCount to keep the visual feedback discrete
2407
+ // rather than continuous: 0 / 1-2 / 3-5 / 6+. Three buckets
2408
+ // are enough — finer gradations are imperceptible.
2409
+ const busy = workingCount === 0 ? 0
2410
+ : workingCount <= 2 ? 1
2411
+ : workingCount <= 5 ? 2
2412
+ : 3;
2413
+ const peakLight = [0.52, 0.58, 0.65, 0.72][busy];
2414
+ const peakDark = [0.16, 0.20, 0.26, 0.32][busy];
2415
+ const troughLight = 0.32;
2416
+ const troughDark = 0.08;
2417
+ const dur = [4.0, 3.2, 2.7, 2.4][busy];
2418
+ const valuesLight = `${troughLight};${peakLight};${troughLight}`;
2419
+ const valuesDark = `${troughDark};${peakDark};${troughDark}`;
2420
+ return (
2421
+ <circle
2422
+ cx={cx} cy={cy} r="18"
2423
+ fill={isLight ? '#d1fae5' : '#10b981'}
2424
+ opacity={isLight ? 0.42 : 0.12}
2425
+ data-hub-busyness={busy}
2426
+ >
2427
+ {!reducedMotion && (
2428
+ <animate
2429
+ attributeName="opacity"
2430
+ values={isLight ? valuesLight : valuesDark}
2431
+ dur={`${dur}s`}
2432
+ repeatCount="indefinite"
2433
+ />
2434
+ )}
2435
+ </circle>
2436
+ );
2437
+ })()}
1057
2438
  {/* core — 20px diameter, larger inner highlight reads as a "lit lamp" */}
1058
2439
  <circle cx={cx} cy={cy} r="10" fill={isLight ? '#059669' : '#10b981'} />
1059
2440
  <circle cx={cx} cy={cy} r="5" fill="#d1fae5" opacity="0.9" />
1060
2441
  </g>)}
1061
2442
 
1062
2443
  {/* agent nodes */}
1063
- {[...onlineNodes, ...offlineNodes].map(session => {
2444
+ {[...onlineNodes, ...offlineNodes].map((session, nodeIdx) => {
1064
2445
  const pos = nodePositions[session.alias];
1065
2446
  if (!pos) return null;
1066
2447
 
@@ -1080,11 +2461,30 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1080
2461
  // occlude an avatar), and the full card appears only for the
1081
2462
  // hovered node or once zoomed in past 1.4×.
1082
2463
  const showFullLabel = !denseLayout || hoveredAlias === session.alias || view.zoom >= 1.4;
2464
+ // Round 8: when a node in another group is hovered, fade this
2465
+ // one. Same-group nodes (incl. singletons matching the hovered
2466
+ // alias) stay full. Pure visual focus, geometry unchanged.
2467
+ const inFocus = !activeGroup || (groupKeys[session.alias] ?? session.alias) === activeGroup;
2468
+ // R72: in ring layout, classify the node into a tier by its
2469
+ // distance from hub centre so the first-paint stagger can
2470
+ // emanate inner → outer instead of running clockwise. Grid
2471
+ // layout doesn't have a radial structure; it keeps R9's pure
2472
+ // nodeIdx stagger. Thresholds bracket the actual tier radii
2473
+ // (single 220, dual 175/260, triple 145/215/285, offline 325+).
2474
+ let tierIdx = 0;
2475
+ if (layout === 'ring') {
2476
+ const p = nodePositions[session.alias];
2477
+ if (p) {
2478
+ const d = Math.hypot(p.x - cx, p.y - cy);
2479
+ tierIdx = d < 195 ? 0 : d < 270 ? 1 : d < 310 ? 2 : 3;
2480
+ }
2481
+ }
1083
2482
 
1084
2483
  return (
1085
2484
  <g
1086
2485
  key={session.alias}
1087
2486
  data-node={session.alias}
2487
+ data-tier-idx={layout === 'ring' ? tierIdx : -1}
1088
2488
  // Round 3 / Loop: `anet-fade-in` runs once when the <g>
1089
2489
  // mounts — a new session entering the fleet (or the topology
1090
2490
  // first rendering) eases in instead of popping. Re-renders of
@@ -1092,7 +2492,87 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1092
2492
  // via the alias key), so status changes don't flicker. The
1093
2493
  // global prefers-reduced-motion sweep already neutralises it.
1094
2494
  className="group transition-opacity anet-fade-in"
1095
- style={{ cursor: 'pointer' }}
2495
+ style={{
2496
+ cursor: 'pointer',
2497
+ // Round 17 / Loop: offline nodes drop to 0.6 at rest so
2498
+ // online nodes pop without losing the offline-as-ghost
2499
+ // information. The dashed stroke + smaller radius already
2500
+ // say "offline"; dimming the whole group strengthens the
2501
+ // online-vs-offline hierarchy at first glance. Exempt the
2502
+ // chat-focused node — if the user explicitly opened a
2503
+ // popover targeting an offline alias, that node stays
2504
+ // full-brightness so the focus ring + popover read as one
2505
+ // selected thing rather than a dimmed selection. Group-
2506
+ // hover fade (Round 8) still wins when inFocus is false.
2507
+ // Round 49 / Loop: edge-hover endpoint highlight composes
2508
+ // OVER the inFocus/online formula — a non-endpoint node
2509
+ // dims to 0.28 (just below the inFocus 0.32 to read as a
2510
+ // stronger "not relevant" signal), endpoints keep their
2511
+ // base opacity. chatAlias still wins to keep the focus
2512
+ // ring legible if the user clicked through.
2513
+ // Round 55 / Loop: legend-status hover composes on the
2514
+ // SAME level as edge-hover-endpoint. Non-matching nodes
2515
+ // dim to 0.28; matching nodes stay at their base.
2516
+ // activeStatus matches: working = status==='working',
2517
+ // idle = online but not working, offline = !isOnline.
2518
+ // Round 60 / Loop: activeStatus = hoveredStatus ?? pinnedStatus
2519
+ // so the pressure-bar segment pins (R60) and the legend
2520
+ // row hover (R55) feed the same branch.
2521
+ // Round 80 / Loop: vendor-letter hover composes ABOVE the
2522
+ // activeStatus branch so hovering the vendor chip's `C`
2523
+ // dims everything except C-vendor nodes. Same dim value
2524
+ // (0.28) as edge-endpoint and status filters — visually
2525
+ // consistent. Vendor lookup uses the same vendorForModel
2526
+ // helper the avatar render uses, keyed by initial so the
2527
+ // chip and the avatar always agree on grouping.
2528
+ opacity: hoveredEdgeEndpoints && !hoveredEdgeEndpoints.has(session.alias) && chatAlias !== session.alias
2529
+ ? 0.28
2530
+ : activeVendor && chatAlias !== session.alias && (() => {
2531
+ const v = vendorForModel(session.model);
2532
+ const initial = v.id === 'unknown' ? '?' : v.initial;
2533
+ return initial !== activeVendor;
2534
+ })()
2535
+ ? 0.28
2536
+ : activeStatus && chatAlias !== session.alias && !(
2537
+ activeStatus === 'working' ? session.status === 'working'
2538
+ : activeStatus === 'idle' ? (isOnline && session.status !== 'working')
2539
+ : /* offline */ !isOnline
2540
+ )
2541
+ ? 0.28
2542
+ : !inFocus
2543
+ ? 0.32
2544
+ : chatAlias === session.alias
2545
+ ? 1
2546
+ : isOnline ? 1 : 0.6,
2547
+ // Round 9 / Loop: stagger the anet-fade-in so the topology
2548
+ // reveals as a wave on first paint instead of one big pop.
2549
+ // Cap at 24 indices (≈600ms tail) so 50-node fleets still
2550
+ // finish revealing within a beat. CSS animation-delay only
2551
+ // applies during the keyframe — re-renders without a new
2552
+ // mount (same alias key) don't replay, so status changes
2553
+ // never trigger the stagger again.
2554
+ // Round 72 / Loop: in ring layout, stagger by tier radius
2555
+ // so the topology emanates from the hub outward — inner
2556
+ // tier at 0ms, middle at ~180ms, outer at ~360ms, offline
2557
+ // at ~540ms. A small within-tier offset (nodeIdx % 6 * 25)
2558
+ // adds variety so each ring rotates in instead of all-at-
2559
+ // once popping. Grid keeps R9's pure nodeIdx stagger.
2560
+ animationDelay: layout === 'ring'
2561
+ ? `${tierIdx * 180 + (nodeIdx % 6) * 25}ms`
2562
+ : `${Math.min(nodeIdx, 24) * 25}ms`,
2563
+ // Round 51 / Loop: hover micro-lift. The label already
2564
+ // lifts on group-hover (R26). The node body — circle,
2565
+ // avatar, status ring — stays planted, so the gesture
2566
+ // reads "label moves, body doesn't". Now the whole <g>
2567
+ // translates -2px when hovered: avatar + ring + label
2568
+ // move as one unit. 2 px is well inside the inter-row
2569
+ // gap (cellH headroom ≥22), and CSS transform on SVG
2570
+ // <g> never affects the overlap-test geometry (the
2571
+ // test never simulates hover). useReducedMotion drops
2572
+ // the lift to 0 for prefers-reduced-motion users.
2573
+ transform: !reducedMotion && hoveredAlias === session.alias ? 'translateY(-2px)' : undefined,
2574
+ transition: 'transform 180ms cubic-bezier(0.4,0,0.2,1)',
2575
+ }}
1096
2576
  // Stop the pointerdown from reaching the SVG pan handler: the
1097
2577
  // SVG calls setPointerCapture, and a captured pointer makes
1098
2578
  // Chromium fire the follow-up `click` on the SVG instead of
@@ -1100,14 +2580,71 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1100
2580
  // Side effect (intended): you pan from empty canvas, not by
1101
2581
  // grabbing a node.
1102
2582
  onPointerDown={(e) => e.stopPropagation()}
1103
- onPointerEnter={() => denseLayout && setHoveredAlias(session.alias)}
1104
- onPointerLeave={() => denseLayout && setHoveredAlias(prev => (prev === session.alias ? null : prev))}
1105
- onClick={() => setChatAlias(session.alias)}
2583
+ // Track hover globally (not just under denseLayout) so the
2584
+ // Round 8 group-focus fade works at any fleet size.
2585
+ onPointerEnter={() => setHoveredAlias(session.alias)}
2586
+ onPointerLeave={() => setHoveredAlias(prev => (prev === session.alias ? null : prev))}
2587
+ onClick={() => {
2588
+ setChatAlias(session.alias);
2589
+ // Round 14 ripple — capture position, radius and status
2590
+ // colour at click time so the one-shot circle is self-
2591
+ // contained (no re-render-time recomputation needed).
2592
+ setClickRipple({
2593
+ ts: Date.now(),
2594
+ x: pos.x, y: pos.y, r0: radius,
2595
+ color: status.primary,
2596
+ });
2597
+ setTimeout(() => setClickRipple(prev =>
2598
+ prev && Date.now() - prev.ts >= 590 ? null : prev), 600);
2599
+ }}
1106
2600
  >
1107
2601
  {/* Issue #96: native hover tooltip — "Vendor · model · Runtime".
1108
2602
  Falls back to just the alias when the node reports no
1109
- model/runtime. */}
1110
- <title>{identityLine(session.model, session.runtime) || session.alias}</title>
2603
+ model/runtime.
2604
+ Round 33 / Loop: cwd line answers "what is this agent on?".
2605
+ Round 34 / Loop: for offline nodes, append "last seen: 6m ago"
2606
+ so the operator knows whether to wait or chase. Online nodes
2607
+ skip the line (Round 27's 1 h ghost age-out means anything
2608
+ still online has heartbeated recently — the line would just
2609
+ be noise). Accepts both ISO ("…T06:00:28Z") and SQL-style
2610
+ ("… 06:00:28" assumed UTC) formats. */}
2611
+ {(() => {
2612
+ // Round 35 / Loop: TZ-safe parsing via the shared lib helper
2613
+ // — same parseHubTime is used by isGhost above (Round 38
2614
+ // factored it to app/lib/time.ts so both paths interpret SQL
2615
+ // bare timestamps as UTC on every browser).
2616
+ const lastSeen = !isOnline && session.last_seen_at ? relativeAgo(session.last_seen_at) : null;
2617
+ // Round 98 / Loop: enrich the node tooltip with status,
2618
+ // group membership, and inbound/outbound flow counts —
2619
+ // same info-density spirit as R97 active-filter pill
2620
+ // tooltips. Hovering any node now answers "what is this
2621
+ // and how does it sit in the topology" without forcing
2622
+ // a click into the chat popover. Group line only shows
2623
+ // when the alias is part of a multi-member band (R106
2624
+ // prefix grouping); singletons skip it. Flow line only
2625
+ // when at least one direction has count > 0.
2626
+ const groupKey = groupKeys[session.alias];
2627
+ const groupMembers = groupKey
2628
+ ? Object.values(groupKeys).filter(k => k === groupKey).length
2629
+ : 1;
2630
+ const groupLine = groupMembers > 1 ? `group: ${groupKey} · ${groupMembers}` : null;
2631
+ let flowIn = 0, flowOut = 0;
2632
+ for (const fl of flowLinks) {
2633
+ if (fl.from === session.alias) flowOut += fl.count;
2634
+ if (fl.to === session.alias) flowIn += fl.count;
2635
+ }
2636
+ const flowLine = (flowIn + flowOut) > 0 ? `flows: ${flowIn} in / ${flowOut} out` : null;
2637
+ return (
2638
+ <title>{[
2639
+ `${session.alias} · ${session.status}`,
2640
+ identityLine(session.model, session.runtime),
2641
+ groupLine,
2642
+ session.project_dir ? `cwd: ${session.project_dir}` : null,
2643
+ lastSeen ? `last seen: ${lastSeen}` : null,
2644
+ flowLine,
2645
+ ].filter(Boolean).join('\n')}</title>
2646
+ );
2647
+ })()}
1111
2648
  {/* Round 2 / Loop: hover ring — a thin outer stroke that fades
1112
2649
  in when the cursor enters the node, signalling clickability
1113
2650
  (real-user feedback for the chat-popover open). Pure CSS via
@@ -1127,13 +2664,45 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1127
2664
  className="opacity-0 group-hover:opacity-70 transition-opacity duration-150"
1128
2665
  style={{ pointerEvents: 'none' }}
1129
2666
  />
1130
- {isActive && (
2667
+ {/* Round 11 / Loop: chat-focus ring — when the ChatPopover is
2668
+ open targeting this node, anchor a persistent ring around
2669
+ it so the floating popover visibly links back to its source
2670
+ node. Static (not pulsing) so it reads as "selected state"
2671
+ rather than "this node is active". strokeWidth=2.5 stays
2672
+ clear of the overlap-test selectors (1.5 / 3). Sits just
2673
+ outside the halo radius+8 so it never overlaps a neighbour
2674
+ (halos already pack flush in dense grids). */}
2675
+ {chatAlias === session.alias && (
2676
+ <circle
2677
+ cx={pos.x}
2678
+ cy={pos.y}
2679
+ r={radius + 14}
2680
+ fill="none"
2681
+ stroke={status.primary}
2682
+ strokeWidth="2.5"
2683
+ opacity={isLight ? 0.85 : 0.95}
2684
+ filter={!isLight ? 'url(#topo-glow)' : undefined}
2685
+ className="transition-opacity duration-200"
2686
+ style={{ pointerEvents: 'none' }}
2687
+ />
2688
+ )}
2689
+ {isActive && !reducedMotion && (
1131
2690
  <circle cx={pos.x} cy={pos.y} r={radius + 14} fill={status.primary} opacity={isLight ? 0.08 : 0.12}>
1132
2691
  <animate attributeName="r" values={`${radius + 8};${radius + 22};${radius + 8}`} dur="2.4s" repeatCount="indefinite" />
1133
2692
  <animate attributeName="opacity" values={isLight ? '0.12;0.02;0.12' : '0.18;0.04;0.18'} dur="2.4s" repeatCount="indefinite" />
1134
2693
  </circle>
1135
2694
  )}
1136
- <circle cx={pos.x} cy={pos.y} r={radius + 8} fill={status.halo} opacity={isOnline ? (isLight ? 0.85 : 0.65) : (isLight ? 0.4 : 0.25)} />
2695
+ {/* Round 4 / Loop: transition-[fill,stroke,opacity] smooths
2696
+ status colour changes so idle↔working↔offline doesn't snap
2697
+ — task replies / node-rename / SSE updates ease in. */}
2698
+ <circle
2699
+ cx={pos.x}
2700
+ cy={pos.y}
2701
+ r={radius + 8}
2702
+ fill={status.halo}
2703
+ opacity={isOnline ? (isLight ? 0.85 : 0.65) : (isLight ? 0.4 : 0.25)}
2704
+ className="transition-[fill,opacity] duration-300 ease-out"
2705
+ />
1137
2706
  <circle
1138
2707
  cx={pos.x}
1139
2708
  cy={pos.y}
@@ -1143,6 +2712,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1143
2712
  strokeWidth={isOnline ? 3 : 1.5}
1144
2713
  strokeDasharray={isOnline ? 'none' : '5 5'}
1145
2714
  filter={isOnline && !isLight ? 'url(#topo-glow)' : undefined}
2715
+ className="transition-[fill,stroke] duration-300 ease-out"
1146
2716
  />
1147
2717
  {/* Issue #96: node "avatar" is now driven by the model
1148
2718
  vendor. Decision order:
@@ -1229,52 +2799,115 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1229
2799
  </g>
1230
2800
  );
1231
2801
  })()}
1232
- {session.status === 'working' && (
1233
- // working pulse — small dot just inside the status ring,
1234
- // above the avatar text. Was a 18px horizontal bar at
1235
- // y+11 which now collides with the avatar; the dot reads
1236
- // as the same "active" cue without occluding the initial.
1237
- <circle cx={pos.x} cy={pos.y - (radius - 6)} r="2.5" fill={pal.flowParticle}>
1238
- <animate attributeName="opacity" values="1;0.25;1" dur="1.1s" repeatCount="indefinite" />
1239
- </circle>
1240
- )}
2802
+ {session.status === 'working' && (() => {
2803
+ // Round 24 / Loop: pulse rate ↔ traffic. The dot's dur
2804
+ // was a flat 1.1s — every working node looked equally
2805
+ // busy. Mapping it to sse:N lets the eye land on what's
2806
+ // actually hot. 3 discrete tiers read cleaner than
2807
+ // continuous easing at a glance; thresholds picked so
2808
+ // typical 1-2-SSE Claude/Codex sessions stay in the
2809
+ // "active" tier and only multi-pane orchestrators pop
2810
+ // into the "busy" tier. Geometry unchanged (r=2.5).
2811
+ const sse = sseCountFor ?? 0;
2812
+ const dur = sse >= 4 ? '0.7s' : sse >= 2 ? '0.9s' : '1.2s';
2813
+ return (
2814
+ <circle cx={pos.x} cy={pos.y - (radius - 6)} r="2.5" fill={pal.flowParticle} data-pulse-dur={dur} opacity={reducedMotion ? 0.6 : undefined}>
2815
+ {!reducedMotion && (
2816
+ <animate attributeName="opacity" values="1;0.25;1" dur={dur} repeatCount="indefinite" />
2817
+ )}
2818
+ </circle>
2819
+ );
2820
+ })()}
1241
2821
 
1242
2822
  {/* Round 98 (issue #61): label rect 124px → 100px.
1243
2823
  Round 109/110 (Vincent P0): full opaque card below the
1244
2824
  density threshold / on hover / when zoomed; otherwise a
1245
2825
  lightweight plain-text alias that keeps every node
1246
- labelled without an opaque box covering its neighbours. */}
1247
- {showFullLabel ? (
1248
- <g transform={`translate(${pos.x}, ${pos.y + radius + 22})`} style={{ pointerEvents: 'none' }}>
1249
- <rect x="-50" y="-14" width="100" height="42" rx="6" fill={pal.labelBox.fill} stroke={pal.labelBox.stroke} opacity={isLight ? 1 : 0.94} />
1250
- <text x="0" y="1" textAnchor="middle" fill={status.text} fontSize="12" fontFamily="monospace" fontWeight="700">
1251
- {truncate(session.alias, 12)}
1252
- </text>
1253
- <text x="0" y="17" textAnchor="middle" fill={status.primary} fontSize="9" fontFamily="monospace">
1254
- {status.label}{isOnline && sseCountFor != null ? ` sse:${sseCountFor}` : ''}
2826
+ labelled without an opaque box covering its neighbours.
2827
+ Round 15 / Loop: when nodeScale=S the node shrinks 30%
2828
+ but the label card was staying full-size, so the label
2829
+ visually outweighed the small node. Tighten the card
2830
+ frame, alias / sub fontSize, drop-offset and truncate
2831
+ length specifically for S; M and L keep their existing
2832
+ sizes (M ≈ L for labels by design — the S user is the
2833
+ one who explicitly asked for a denser view). */}
2834
+ {(() => {
2835
+ const isSmall = nodeScale < 0.8;
2836
+ const cardW = isSmall ? 88 : 100;
2837
+ const cardH = isSmall ? 36 : 42;
2838
+ const cardTopY = isSmall ? -12 : -14;
2839
+ const aliasFs = isSmall ? 11 : 12;
2840
+ const subFs = isSmall ? 8 : 9;
2841
+ const subY = isSmall ? 15 : 17;
2842
+ const dropY = isSmall ? 18 : 22;
2843
+ const fullMax = isSmall ? 11 : 12;
2844
+ const denseFs = isSmall ? 9 : 10;
2845
+ const denseDrop = isSmall ? 12 : 14;
2846
+ // Round 26 / Loop: micro-lift the label group on hover —
2847
+ // 1.5 px upward, 200 ms ease. Pairs with the Round 18
2848
+ // group-box hover-accent treatment to give the same
2849
+ // "this is the focused element" feedback at the per-
2850
+ // node level. CSS transform stacks onto the SVG
2851
+ // positioning transform attribute (SVG 2 cascade);
2852
+ // bbox is unchanged at rest, so the overlap-test gate
2853
+ // continues to see the geometric layout it expects.
2854
+ return showFullLabel ? (
2855
+ <g transform={`translate(${pos.x}, ${pos.y + radius + dropY})`} style={{ pointerEvents: 'none' }}
2856
+ className="transition-transform duration-200 group-hover:-translate-y-[1.5px]">
2857
+ <rect x={-cardW / 2} y={cardTopY} width={cardW} height={cardH} rx="6" fill={pal.labelBox.fill} stroke={pal.labelBox.stroke} opacity={isLight ? 1 : 0.94} />
2858
+ <text x="0" y="1" textAnchor="middle" fill={status.text} fontSize={aliasFs} fontFamily="monospace" fontWeight="700">
2859
+ {truncate(session.alias, fullMax)}
2860
+ </text>
2861
+ <text x="0" y={subY} textAnchor="middle" fill={status.primary} fontSize={subFs} fontFamily="monospace">
2862
+ {status.label}{isOnline && sseCountFor != null ? ` sse:${sseCountFor}` : ''}
2863
+ </text>
2864
+ </g>
2865
+ ) : (
2866
+ <text
2867
+ x={pos.x}
2868
+ y={pos.y + radius + denseDrop}
2869
+ textAnchor="middle"
2870
+ fill={status.text}
2871
+ fontSize={denseFs}
2872
+ fontFamily="monospace"
2873
+ fontWeight="700"
2874
+ opacity={0.9}
2875
+ className="transition-transform duration-200 group-hover:-translate-y-[1.5px]"
2876
+ style={{ pointerEvents: 'none', paintOrder: 'stroke' }}
2877
+ stroke={pal.containerBg}
2878
+ strokeWidth="3"
2879
+ >
2880
+ {truncate(session.alias, isSmall ? 9 : 10)}
1255
2881
  </text>
1256
- </g>
1257
- ) : (
1258
- <text
1259
- x={pos.x}
1260
- y={pos.y + radius + 14}
1261
- textAnchor="middle"
1262
- fill={status.text}
1263
- fontSize="10"
1264
- fontFamily="monospace"
1265
- fontWeight="700"
1266
- opacity={0.9}
1267
- style={{ pointerEvents: 'none', paintOrder: 'stroke' }}
1268
- stroke={pal.containerBg}
1269
- strokeWidth="3"
1270
- >
1271
- {truncate(session.alias, 10)}
1272
- </text>
1273
- )}
2882
+ );
2883
+ })()}
1274
2884
  </g>
1275
2885
  );
1276
2886
  })}
1277
2887
 
2888
+ {/* Round 14 / Loop: click ripple — one-shot expanding ring from
2889
+ the clicked node, ~500ms, status-coloured. Sits inside the
2890
+ zoom/pan <g> so it scales / pans with the topology. Keyed by
2891
+ ts so a re-click on any node (same or different) remounts the
2892
+ <circle> and the SMIL <animate> elements replay from t=0.
2893
+ strokeWidth=2 doesn't match the overlap-test selectors. */}
2894
+ {clickRipple && !reducedMotion && (
2895
+ <circle
2896
+ key={clickRipple.ts}
2897
+ cx={clickRipple.x}
2898
+ cy={clickRipple.y}
2899
+ r={clickRipple.r0 + 4}
2900
+ fill="none"
2901
+ stroke={clickRipple.color}
2902
+ strokeWidth="2"
2903
+ opacity="0"
2904
+ style={{ pointerEvents: 'none' }}
2905
+ >
2906
+ <animate attributeName="r" values={`${clickRipple.r0 + 4};${clickRipple.r0 + 30}`} dur="0.5s" fill="freeze" />
2907
+ <animate attributeName="opacity" values="0.7;0" dur="0.5s" fill="freeze" />
2908
+ </circle>
2909
+ )}
2910
+
1278
2911
  </g>
1279
2912
 
1280
2913
  {/* #112: overlay panels (recent-signal + legend) render OUTSIDE the
@@ -1285,30 +2918,270 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1285
2918
  corner triangles, so the panels never overlap a node, in ring
1286
2919
  OR grid layout (Vincent 4727 zero-overlap criterion). */}
1287
2920
  {/* latest flow labels */}
2921
+ {/* Round 57 / Loop: drop-shadow on the panel rects gives them
2922
+ card-like elevation, especially on light theme where the
2923
+ near-white fill on a near-white canvas read as pasted-on.
2924
+ data-topo-panel-elevation tag so the test can verify both
2925
+ panels carry the filter. The filter is on the rect, not
2926
+ the parent <g>, so it doesn't shadow the rows + text inside
2927
+ — only the panel chrome lifts. */}
1288
2928
  <g transform="translate(16, 16)">
1289
- <rect x="0" y="0" width="230" height="84" rx="10" fill={pal.legendBox.fill} stroke={pal.legendBox.stroke} opacity={isLight ? 0.97 : 0.92} />
2929
+ <rect
2930
+ x="0" y="0" width="230" height="84" rx="10"
2931
+ fill={pal.legendBox.fill}
2932
+ stroke={pal.legendBox.stroke}
2933
+ opacity={isLight ? 0.97 : 0.92}
2934
+ style={{ filter: isLight ? 'drop-shadow(0 2px 6px rgba(15,23,42,0.08))' : 'drop-shadow(0 2px 6px rgba(0,0,0,0.45))' }}
2935
+ data-topo-panel-elevation="recent"
2936
+ />
1290
2937
  <text x="13" y="21" fill={pal.legendHeadline} fontSize="12" fontFamily="monospace" fontWeight="700">recent signal</text>
1291
- <text x="150" y="21" fill={pal.legendAccent} fontSize="10" fontFamily="monospace">{messages.length} msgs</text>
1292
- {flowLinks.slice(0, 3).map((link, index) => (
1293
- <text key={link.key} x="13" y={38 + index * 16} fill={pal.legendText} fontSize="9" fontFamily="monospace">
1294
- {truncate(link.from, 6)} {'->'} {truncate(link.to, 6)} / {link.count} / {truncate(link.content, 12)}
2938
+ {/* R96: header count now matches what the rows show. Pre-R96
2939
+ this read "X msgs" off the raw messages array, but the
2940
+ rows below render DEDUPED flowLinks — so a fleet with 10
2941
+ messages aggregating to 3 pairs read "10 msgs" above
2942
+ only 3 rows. Misreads as "where are the other 7?".
2943
+ "X flows" mirrors flowLinks.length one-for-one. When
2944
+ flows < msgs the chip-row's "N active links · last 2s"
2945
+ already tells the operator about traffic volume — no
2946
+ duplicate metric needed here. */}
2947
+ <text x="150" y="21" fill={pal.legendAccent} fontSize="10" fontFamily="monospace" data-recent-panel-count>{flowLinks.length} flows</text>
2948
+ {/* Round 45 / Loop: empty state. The panel used to render
2949
+ "recent signal" + "0 msgs" with three blank slots below
2950
+ when no flow yet — read as "broken" rather than "quiet".
2951
+ A muted centred placeholder makes the empty state
2952
+ deliberate. Messages count CAN diverge from flowLinks
2953
+ count (raw count vs. deduped pairs), so the placeholder
2954
+ fires on flowLinks.length=0 specifically. */}
2955
+ {flowLinks.length === 0 ? (
2956
+ <text x="115" y="60" textAnchor="middle" fill={pal.legendText} fontSize="10" fontFamily="monospace" fontStyle="italic" opacity={0.65} data-recent-signal-empty>
2957
+ no flow yet
1295
2958
  </text>
1296
- ))}
2959
+ ) : (
2960
+ // Round 56 / Loop: each row is a navigator into the canvas.
2961
+ // Hover a row → set hoveredEdgeKey, which the existing R50
2962
+ // edge-focus + R49 endpoint-highlight ladders consume. The
2963
+ // matching flow edge brightens to 2× + thickens, its two
2964
+ // endpoint nodes stay full opacity, and every other edge +
2965
+ // non-endpoint node dims. Released → all restore. Wrapping
2966
+ // <g> + a transparent 218×14 hitbox so the cursor doesn't
2967
+ // have to land precisely on the truncated text.
2968
+ flowLinks.slice(0, 3).map((link, index) => {
2969
+ // Round 94 / Loop: per-row relative timestamp. The chip
2970
+ // row shows "last 2s" for the most recent flow overall,
2971
+ // but a user scanning the recent-signal panel had no way
2972
+ // to tell whether row 2 was 5s old or 5m old without
2973
+ // hovering nodes. Compact `2s` / `1m` glyph at the
2974
+ // right edge — same relativeAgo helper R42 uses for
2975
+ // the chip — pulls double duty as a recency anchor and
2976
+ // a sortedness hint (top row is freshest by construction).
2977
+ // Strip the " ago" suffix — at fontSize=8 in a 32-px
2978
+ // right-edge slot, every char counts. "30s ago" → "30s".
2979
+ const rawAt = link.last_at ? relativeAgo(link.last_at) : null;
2980
+ const lastAt = rawAt ? rawAt.replace(/\s+ago$/, '') : null;
2981
+ const isRowHovered = hoveredEdgeKey === link.key;
2982
+ return (
2983
+ <g
2984
+ key={link.key}
2985
+ data-recent-row={link.key}
2986
+ data-recent-row-hovered={isRowHovered ? 'true' : 'false'}
2987
+ style={{ cursor: 'pointer' }}
2988
+ onMouseEnter={() => setHoveredEdgeKey(link.key)}
2989
+ onMouseLeave={() => setHoveredEdgeKey(prev => prev === link.key ? null : prev)}
2990
+ >
2991
+ {/* R104: subtle row-background tint on hover. R56
2992
+ already brightens the matching edge on the canvas,
2993
+ but the panel row itself stayed flat — felt more
2994
+ like text-with-handlers than a navigable list.
2995
+ Filling the rect at hover with `pal.legendAccent`
2996
+ at low alpha gives the row visual feedback at the
2997
+ source surface, mirroring the list-item idiom from
2998
+ the chip-row pills. */}
2999
+ <rect
3000
+ x="6" y={38 + index * 16 - 10}
3001
+ width="218" height="14" rx="3"
3002
+ fill={isRowHovered ? pal.legendAccent : 'transparent'}
3003
+ opacity={isRowHovered ? (isLight ? 0.10 : 0.14) : 1}
3004
+ style={{ transition: 'fill 150ms ease-out, opacity 150ms ease-out' }}
3005
+ />
3006
+ <text
3007
+ x="13" y={38 + index * 16}
3008
+ fill={hoveredEdgeKey === link.key ? pal.legendHeadline : pal.legendText}
3009
+ fontSize="9"
3010
+ fontFamily="monospace"
3011
+ style={{ transition: 'fill 150ms ease-out' }}
3012
+ >
3013
+ {truncate(link.from, 6)} {'->'} {truncate(link.to, 6)} / {link.count} / {truncate(link.content, 8)}
3014
+ </text>
3015
+ {lastAt ? (
3016
+ <text
3017
+ x="217" y={38 + index * 16}
3018
+ textAnchor="end"
3019
+ fill={pal.legendText}
3020
+ fontSize="8"
3021
+ fontFamily="monospace"
3022
+ opacity={0.55}
3023
+ data-recent-row-ts={link.key}
3024
+ style={{ pointerEvents: 'none' }}
3025
+ >
3026
+ {lastAt}
3027
+ </text>
3028
+ ) : null}
3029
+ </g>
3030
+ );
3031
+ })
3032
+ )}
1297
3033
  </g>
1298
3034
 
1299
- {/* legend */}
3035
+ {/* legend — Round 55 / Loop: each status row is now a hover
3036
+ target. Pointer enter sets `hoveredStatus`; pointer leave
3037
+ clears it. Node opacity formula composes the match below.
3038
+ The row text brightens to legendHeadline while hovered as
3039
+ a small affordance hint. Geometry unchanged — the new
3040
+ <g> wrappers only carry pointer handlers. */}
1300
3041
  <g transform="translate(760, 16)">
1301
- <rect x="0" y="0" width="224" height="96" rx="10" fill={pal.legendBox.fill} stroke={pal.legendBox.stroke} opacity={isLight ? 0.97 : 0.92} />
1302
- <circle cx="16" cy="24" r="5.5" fill={isLight ? '#059669' : '#22c55e'} />
1303
- <text x="30" y="28" fill={pal.legendText} fontSize="11" fontFamily="monospace">working node</text>
1304
- <circle cx="16" cy="48" r="5.5" fill={isLight ? '#0d9488' : '#2dd4bf'} />
1305
- <text x="30" y="52" fill={pal.legendText} fontSize="11" fontFamily="monospace">online idle</text>
1306
- <circle cx="16" cy="72" r="5.5" fill={isLight ? '#94a3b8' : '#6b7280'} />
1307
- <text x="30" y="76" fill={pal.legendText} fontSize="11" fontFamily="monospace">offline / no SSE</text>
1308
- <path d="M140,72 Q164,48 196,72" fill="none" stroke={pal.flowEdge} strokeWidth="3" markerEnd="url(#topo-arrow)" />
3042
+ {/* R57: matching drop-shadow elevation to the legend panel. */}
3043
+ <rect
3044
+ x="0" y="0" width="224" height="96" rx="10"
3045
+ fill={pal.legendBox.fill}
3046
+ stroke={pal.legendBox.stroke}
3047
+ opacity={isLight ? 0.97 : 0.92}
3048
+ style={{ filter: isLight ? 'drop-shadow(0 2px 6px rgba(15,23,42,0.08))' : 'drop-shadow(0 2px 6px rgba(0,0,0,0.45))' }}
3049
+ data-topo-panel-elevation="legend"
3050
+ />
3051
+ {(() => {
3052
+ const idleCount = onlineNodes.length - workingCount;
3053
+ const rows = [
3054
+ { key: 'working' as const, y0: 24, y1: 28, fill: isLight ? '#059669' : '#22c55e', label: 'working node', count: workingCount },
3055
+ { key: 'idle' as const, y0: 48, y1: 52, fill: isLight ? '#0d9488' : '#2dd4bf', label: 'online idle', count: idleCount },
3056
+ { key: 'offline' as const, y0: 72, y1: 76, fill: isLight ? '#94a3b8' : '#6b7280', label: 'offline / no SSE', count: offlineNodes.length },
3057
+ ];
3058
+ return rows;
3059
+ })().map(row => {
3060
+ // Round 61 / Loop: legend rows pin too — symmetric with the
3061
+ // R60 pressure-bar segments. R55 hover stays transient; the
3062
+ // new onClick toggles pinnedStatus so users can lock a
3063
+ // filter without holding the cursor still. Pinned row gets
3064
+ // an inset ring on the swatch (same vocab as R60).
3065
+ const isPinned = pinnedStatus === row.key;
3066
+ return (
3067
+ <g
3068
+ key={row.key}
3069
+ data-legend-status={row.key}
3070
+ role="button"
3071
+ tabIndex={0}
3072
+ aria-pressed={isPinned}
3073
+ style={{ cursor: 'pointer' }}
3074
+ // R61: stopPropagation on pointerdown so the SVG-level
3075
+ // pan handler (R103) doesn't setPointerCapture and
3076
+ // redirect the follow-up click away from this <g>.
3077
+ // Same trick the node <g> uses (and R52 hub).
3078
+ onPointerDown={(e) => e.stopPropagation()}
3079
+ onMouseEnter={() => setHoveredStatus(row.key)}
3080
+ onMouseLeave={() => setHoveredStatus(prev => prev === row.key ? null : prev)}
3081
+ onClick={() => setPinnedStatus(prev => prev === row.key ? null : row.key)}
3082
+ >
3083
+ {/* invisible hitbox covers the row so cursor doesn't need
3084
+ to be exactly on the 5-px swatch */}
3085
+ <rect x="6" y={row.y0 - 12} width="170" height="22" fill="transparent" />
3086
+ <circle cx="16" cy={row.y0} r="5.5" fill={row.fill} />
3087
+ {/* R61 pinned-state ring — concentric stroke at r=8 in
3088
+ the row colour, draws OUTSIDE the swatch so it
3089
+ doesn't fight the fill colour the user is matching. */}
3090
+ {isPinned && (
3091
+ <circle cx="16" cy={row.y0} r="8" fill="none" stroke={row.fill} strokeWidth="1.5" />
3092
+ )}
3093
+ <text
3094
+ x="30" y={row.y1}
3095
+ fill={hoveredStatus === row.key || isPinned ? pal.legendHeadline : pal.legendText}
3096
+ fontSize="11"
3097
+ fontFamily="monospace"
3098
+ style={{ transition: 'fill 150ms ease-out' }}
3099
+ >{row.label}</text>
3100
+ {/* R95: live count anchored to the right edge of the
3101
+ panel (x=215, after the flow-arrow swatch). Same
3102
+ counts the chip-row shows ("3 working" etc.) but
3103
+ here next to the swatch the user is matching —
3104
+ saves crossing the canvas to the chip row for
3105
+ the number. text-anchor=end aligns the column
3106
+ visually like a table. pointerEvents:none so the
3107
+ count doesn't intercept the row hover hitbox. */}
3108
+ <text
3109
+ x="215" y={row.y1}
3110
+ textAnchor="end"
3111
+ fill={pal.legendText}
3112
+ fontSize="11"
3113
+ fontFamily="monospace"
3114
+ opacity={hoveredStatus === row.key || isPinned ? 0.95 : 0.65}
3115
+ data-legend-count={row.key}
3116
+ style={{ pointerEvents: 'none', transition: 'opacity 150ms ease-out' }}
3117
+ >{row.count}</text>
3118
+ </g>
3119
+ );
3120
+ })}
3121
+ {/* Flow-arrow swatch sits at y=72 — same row as the offline
3122
+ hitbox. Drop its pointerEvents so the offline legend row
3123
+ stays hoverable (R55). It's decoration, no need to
3124
+ receive events. */}
3125
+ <path d="M140,72 Q164,48 196,72" fill="none" stroke={pal.flowEdge} strokeWidth="3" markerEnd="url(#topo-arrow)" style={{ pointerEvents: 'none' }} />
1309
3126
  </g>
1310
3127
  </svg>
1311
3128
 
3129
+ {/* Round 30 / Loop: minimap. Big fleets in fullscreen mode at high
3130
+ zoom let users lose their position — the minimap shows the
3131
+ whole topology miniaturised plus a viewport rectangle so the
3132
+ user always knows where they are. Click anywhere to recenter
3133
+ the canvas there. Only mounted when the view is non-default
3134
+ (zoomed or panned) since at 1× centered the minimap and the
3135
+ canvas show the same thing. HTML overlay so it stays fixed
3136
+ while the SVG transforms. */}
3137
+ {(() => {
3138
+ const isDefaultView = Math.abs(view.zoom - 1) < 0.01 && Math.abs(view.x) < 1 && Math.abs(view.y) < 1;
3139
+ if (isDefaultView || (onlineNodes.length + offlineNodes.length) === 0) return null;
3140
+ const MW = 120, MH = 82;
3141
+ const sx = MW / VIEWBOX_W, sy = MH / VIEWBOX_H;
3142
+ const rectX = (-view.x / view.zoom) * sx;
3143
+ const rectY = (-view.y / view.zoom) * sy;
3144
+ const rectW = (VIEWBOX_W / view.zoom) * sx;
3145
+ const rectH = (VIEWBOX_H / view.zoom) * sy;
3146
+ return (
3147
+ <div
3148
+ className="absolute right-3 rounded-md border shadow-lg shadow-black/30 overflow-hidden anet-fade-in"
3149
+ style={{ bottom: 56, background: pal.legendBox.fill, borderColor: pal.containerBorder, cursor: 'crosshair' }}
3150
+ role="img"
3151
+ aria-label="Topology minimap — click to recenter"
3152
+ title="Minimap · click to recenter"
3153
+ onClick={(e) => {
3154
+ const r = e.currentTarget.getBoundingClientRect();
3155
+ const fx = (e.clientX - r.left) / r.width;
3156
+ const fy = (e.clientY - r.top) / r.height;
3157
+ setView(prev => ({
3158
+ ...prev,
3159
+ x: VIEWBOX_W / 2 - fx * VIEWBOX_W * prev.zoom,
3160
+ y: VIEWBOX_H / 2 - fy * VIEWBOX_H * prev.zoom,
3161
+ }));
3162
+ }}
3163
+ data-topo-minimap
3164
+ >
3165
+ <svg width={MW} height={MH} viewBox={`0 0 ${MW} ${MH}`} style={{ display: 'block' }}>
3166
+ {[...onlineNodes, ...offlineNodes].map(s => {
3167
+ const p = nodePositions[s.alias];
3168
+ if (!p) return null;
3169
+ const sseN = (s.network_id ? sseSessions[`${s.network_id}:${s.alias}`] : undefined) ?? sseSessions[s.alias];
3170
+ const isOn = s.status !== 'offline' || !!sseN;
3171
+ const st = nodeStatus(s, isOn, isLight);
3172
+ return <circle key={s.alias} cx={p.x * sx} cy={p.y * sy} r={isOn ? 1.7 : 1.2} fill={st.primary} opacity={isOn ? 0.9 : 0.5} />;
3173
+ })}
3174
+ {/* viewport rectangle */}
3175
+ <rect
3176
+ x={Math.max(0, rectX)} y={Math.max(0, rectY)}
3177
+ width={Math.max(0, Math.min(MW - Math.max(0, rectX), rectW))}
3178
+ height={Math.max(0, Math.min(MH - Math.max(0, rectY), rectH))}
3179
+ fill="none" stroke={pal.legendAccent} strokeWidth="1" opacity="0.9"
3180
+ />
3181
+ </svg>
3182
+ </div>
3183
+ );
3184
+ })()}
1312
3185
  {/* Round 103 (issue #81): zoom / pan / fullscreen controls — HTML
1313
3186
  overlay so they stay fixed while the SVG content transforms.
1314
3187
  Round 104: Vincent 实测 — the reset action used to be hidden
@@ -1345,6 +3218,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1345
3218
  className="px-2 py-1 hover:bg-white/5 transition-colors"
1346
3219
  style={{ color: pal.legendText }}
1347
3220
  aria-label="Zoom out"
3221
+ title="Zoom out (−)"
1348
3222
  >
1349
3223
  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" aria-hidden><path d="M5 12h14" /></svg>
1350
3224
  </button>
@@ -1360,6 +3234,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1360
3234
  className="px-2 py-1 hover:bg-white/5 transition-colors"
1361
3235
  style={{ color: pal.legendText }}
1362
3236
  aria-label="Zoom in"
3237
+ title="Zoom in (+)"
1363
3238
  >
1364
3239
  <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" aria-hidden><path d="M12 5v14M5 12h14" /></svg>
1365
3240
  </button>
@@ -1369,7 +3244,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1369
3244
  className="p-1.5 rounded-md border hover:bg-white/5 transition-colors"
1370
3245
  style={{ background: pal.legendBox.fill, borderColor: pal.containerBorder, color: pal.legendText }}
1371
3246
  aria-label="Reset view"
1372
- title="Reset zoom + pan (or double-click the canvas)"
3247
+ title="Reset zoom + pan (0, or double-click the canvas)"
1373
3248
  >
1374
3249
  <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
1375
3250
  <path d="M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.4 2.6L3 8" />