@sleep2agi/agent-network-dashboard 0.4.6-preview.12 → 0.4.6-preview.120

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 (326) 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/0.hnfdve7~422.js +7 -0
  181. package/.next/static/chunks/001t1axy5kvz8.css +2 -0
  182. package/.next/static/chunks/01lmbsd37fybu.js +1 -0
  183. package/.next/static/chunks/03o.h6kvmw4l_.js +1 -0
  184. package/.next/static/chunks/03~~oirxz7~vc.js +1 -0
  185. package/.next/static/chunks/05uk96gc~9mni.js +1 -0
  186. package/.next/static/chunks/08kf-.bgs10ze.js +1 -0
  187. package/.next/static/chunks/0glmrdj9112tc.js +7 -0
  188. package/.next/static/chunks/0mkv6lt0vewep.js +1 -0
  189. package/.next/static/chunks/0rxrez_cjn.eh.js +1 -0
  190. package/.next/static/chunks/0tvn2l1pc.h65.js +1 -0
  191. package/.next/static/chunks/0x8x.29hkju5a.js +1 -0
  192. package/.next/static/chunks/10jpspzf4.w.k.js +4 -0
  193. package/.next/static/chunks/16v9rsrf9kvx8.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 +94 -0
  203. package/app/components/HelpOverlay.tsx +76 -0
  204. package/app/components/ServersDrawer.tsx +206 -0
  205. package/app/components/TopoGraph.tsx +2165 -163
  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-cmdk-vendor-pin-test.mjs +103 -0
  225. package/scripts/topo-cwd-tooltip-test.mjs +64 -0
  226. package/scripts/topo-dblclick-reset-test.mjs +74 -0
  227. package/scripts/topo-dispatch-pulse-test.mjs +83 -0
  228. package/scripts/topo-edge-count-badge-test.mjs +84 -0
  229. package/scripts/topo-edge-endpoint-highlight-test.mjs +111 -0
  230. package/scripts/topo-edge-focus-test.mjs +113 -0
  231. package/scripts/topo-edge-hover-test.mjs +93 -0
  232. package/scripts/topo-edge-tooltip-test.mjs +70 -0
  233. package/scripts/topo-endpoint-ring-test.mjs +93 -0
  234. package/scripts/topo-esc-clears-pin-test.mjs +98 -0
  235. package/scripts/topo-filter-pill-aliases-test.mjs +121 -0
  236. package/scripts/topo-filter-pill-body-click-test.mjs +112 -0
  237. package/scripts/topo-filter-pill-count-test.mjs +110 -0
  238. package/scripts/topo-filter-pill-mobile-test.mjs +90 -0
  239. package/scripts/topo-fit-key-test.mjs +106 -0
  240. package/scripts/topo-freshness-chip-test.mjs +74 -0
  241. package/scripts/topo-group-box-pinned-state-test.mjs +95 -0
  242. package/scripts/topo-group-count-test.mjs +68 -0
  243. package/scripts/topo-group-hover-test.mjs +82 -0
  244. package/scripts/topo-group-label-hover-test.mjs +119 -0
  245. package/scripts/topo-group-label-tint-test.mjs +99 -0
  246. package/scripts/topo-group-label-title-test.mjs +83 -0
  247. package/scripts/topo-group-pin-test.mjs +119 -0
  248. package/scripts/topo-group-status-pips-test.mjs +103 -0
  249. package/scripts/topo-groupbox-live-test.mjs +100 -0
  250. package/scripts/topo-groupbox-test.mjs +4 -2
  251. package/scripts/topo-help-overlay-r109-test.mjs +67 -0
  252. package/scripts/topo-help-overlay-r59-test.mjs +67 -0
  253. package/scripts/topo-help-overlay-r65-test.mjs +64 -0
  254. package/scripts/topo-help-overlay-r70-test.mjs +63 -0
  255. package/scripts/topo-help-overlay-r78-test.mjs +59 -0
  256. package/scripts/topo-help-overlay-r81-test.mjs +58 -0
  257. package/scripts/topo-help-overlay-r87-test.mjs +64 -0
  258. package/scripts/topo-help-overlay-r91-test.mjs +65 -0
  259. package/scripts/topo-hub-busyness-test.mjs +100 -0
  260. package/scripts/topo-hub-click-fit-test.mjs +137 -0
  261. package/scripts/topo-hub-title-test.mjs +93 -0
  262. package/scripts/topo-ingroup-edge-test.mjs +103 -0
  263. package/scripts/topo-label-lift-test.mjs +119 -0
  264. package/scripts/topo-label-scale-test.mjs +78 -0
  265. package/scripts/topo-lastseen-tooltip-test.mjs +59 -0
  266. package/scripts/topo-layout-key-test.mjs +91 -0
  267. package/scripts/topo-legend-count-test.mjs +88 -0
  268. package/scripts/topo-legend-hover-test.mjs +113 -0
  269. package/scripts/topo-legend-panel-header-test.mjs +83 -0
  270. package/scripts/topo-legend-pin-test.mjs +128 -0
  271. package/scripts/topo-legend-row-tint-test.mjs +95 -0
  272. package/scripts/topo-minimap-test.mjs +68 -0
  273. package/scripts/topo-mobile-chips-test.mjs +103 -0
  274. package/scripts/topo-node-hover-lift-test.mjs +85 -0
  275. package/scripts/topo-node-title-test.mjs +101 -0
  276. package/scripts/topo-offline-dim-test.mjs +70 -0
  277. package/scripts/topo-overlap-test.mjs +32 -5
  278. package/scripts/topo-pan-cursor-test.mjs +62 -0
  279. package/scripts/topo-panel-elevation-test.mjs +76 -0
  280. package/scripts/topo-particle-stagger-test.mjs +82 -0
  281. package/scripts/topo-pin-persistence-test.mjs +105 -0
  282. package/scripts/topo-popover-meta-test.mjs +78 -0
  283. package/scripts/topo-pressure-bar-test.mjs +69 -0
  284. package/scripts/topo-pressure-hover-test.mjs +123 -0
  285. package/scripts/topo-pressure-pin-test.mjs +119 -0
  286. package/scripts/topo-pressure-seg-tooltip-test.mjs +98 -0
  287. package/scripts/topo-pulse-rate-test.mjs +71 -0
  288. package/scripts/topo-recent-panel-count-test.mjs +72 -0
  289. package/scripts/topo-recent-row-hover-test.mjs +122 -0
  290. package/scripts/topo-recent-row-tint-test.mjs +91 -0
  291. package/scripts/topo-recent-row-ts-test.mjs +92 -0
  292. package/scripts/topo-recent-signal-empty-hint-test.mjs +73 -0
  293. package/scripts/topo-recent-signal-empty-test.mjs +63 -0
  294. package/scripts/topo-reduced-motion-test.mjs +77 -0
  295. package/scripts/topo-status-chip-hover-test.mjs +101 -0
  296. package/scripts/topo-status-chip-tooltip-test.mjs +95 -0
  297. package/scripts/topo-tier-ring-occupancy-test.mjs +87 -0
  298. package/scripts/topo-tier-ring-test.mjs +69 -0
  299. package/scripts/topo-tier-ring-tint-test.mjs +110 -0
  300. package/scripts/topo-tier-stagger-test.mjs +89 -0
  301. package/scripts/topo-tz-ghost-test.mjs +69 -0
  302. package/scripts/topo-vendor-chip-hover-test.mjs +111 -0
  303. package/scripts/topo-vendor-letter-tooltip-test.mjs +92 -0
  304. package/scripts/topo-vendor-pill-test.mjs +125 -0
  305. package/scripts/topo-vendor-pin-test.mjs +125 -0
  306. package/scripts/topo-wheel-zoom-test.mjs +79 -0
  307. package/scripts/topo-working-halo-breath-test.mjs +86 -0
  308. package/scripts/topo-zoom-keys-test.mjs +89 -0
  309. package/.next/static/chunks/0-7iowzu4.798.js +0 -1
  310. package/.next/static/chunks/02t5jr4shh.hy.js +0 -1
  311. package/.next/static/chunks/0_qfg5s5uzs7..js +0 -7
  312. package/.next/static/chunks/0cj5qr_a8dzky.js +0 -7
  313. package/.next/static/chunks/0dttftqqehpdj.js +0 -1
  314. package/.next/static/chunks/0elalb9n_.~di.js +0 -1
  315. package/.next/static/chunks/0j_q__o8p6g83.js +0 -1
  316. package/.next/static/chunks/0ja71r81z59di.js +0 -1
  317. package/.next/static/chunks/0jl6_w50zh4l5.js +0 -1
  318. package/.next/static/chunks/0r4q73.-1bkyl.js +0 -1
  319. package/.next/static/chunks/0r_c8eccg3z2o.js +0 -1
  320. package/.next/static/chunks/0z6mgaoe8c89-.js +0 -1
  321. package/.next/static/chunks/10oi7l-tycgl9.js +0 -1
  322. package/.next/static/chunks/11uk1izuv3~0t.js +0 -1
  323. package/.next/static/chunks/11y8xsp9mn.m8.css +0 -2
  324. /package/.next/static/{irozqkI_mD2Ls10yQ_4yG → SMoWxoU4n1xDaueMcix38}/_buildManifest.js +0 -0
  325. /package/.next/static/{irozqkI_mD2Ls10yQ_4yG → SMoWxoU4n1xDaueMcix38}/_clientMiddlewareManifest.js +0 -0
  326. /package/.next/static/{irozqkI_mD2Ls10yQ_4yG → SMoWxoU4n1xDaueMcix38}/_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,207 @@ 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
+ } else if (detail.kind === 'vendor' && typeof detail.value === 'string') {
926
+ // R108: palette pin-vendor support. R69 added pin-status, R88
927
+ // added clickable vendor letters in the chip row, R90 added
928
+ // granular clear-vendor — but the palette never gained a
929
+ // PIN-vendor command. This branch listens for it; the matching
930
+ // commands live in CommandPalette R108. The stale-purge
931
+ // useEffect higher up already drops a pin whose vendor isn't
932
+ // in the current distribution, so commands for an absent
933
+ // vendor are harmless.
934
+ setPinnedVendor(detail.value);
935
+ }
936
+ };
937
+ window.addEventListener('anet:topo-pin', onPin);
938
+ return () => window.removeEventListener('anet:topo-pin', onPin);
939
+ }, []);
940
+ // R74 listener for layout + view palette commands lives below
941
+ // fitView's declaration — see further down in the file.
942
+ const hoveredEdgeEndpoints = useMemo<Set<string> | null>(() => {
943
+ if (!hoveredEdgeKey) return null;
944
+ const link = flowLinks.find(l => l.key === hoveredEdgeKey);
945
+ return link ? new Set([link.from, link.to]) : null;
946
+ }, [hoveredEdgeKey, flowLinks]);
615
947
 
616
948
  // --- Round 103 (issue #81): fullscreen + zoom + pan interaction layer ---
617
949
  // DIY native (no d3 / svg-pan-zoom): wrap the topology content in a single
@@ -631,6 +963,15 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
631
963
  // Issue #100: singleton chat popover. One alias at a time — clicking
632
964
  // another node swaps the target and the conversation switches in place.
633
965
  const [chatAlias, setChatAlias] = useState<string | null>(null);
966
+ // Round 14 / Loop: one-shot click ripple — fades outward from the clicked
967
+ // node so the click registers physically before the popover snaps in.
968
+ // Pairs with the Round 11 chat-focus ring: ripple expands, ring locks on.
969
+ // Keyed by ts so re-clicking the same node remounts the <circle> and the
970
+ // SMIL <animate> replays. Cleared 600ms after click (longer than the
971
+ // 500ms animation so a final frame at opacity 0 is still in the tree).
972
+ const [clickRipple, setClickRipple] = useState<{
973
+ ts: number; x: number; y: number; r0: number; color: string;
974
+ } | null>(null);
634
975
  // #84: when a node is renamed while its chat popover is open, follow the
635
976
  // rename so the conversation keeps targeting a live alias.
636
977
  useEffect(() => {
@@ -661,6 +1002,42 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
661
1002
  } catch {}
662
1003
  }, []);
663
1004
 
1005
+ // Round 28 / Loop: first-paint auto-fit. Round 27's cellH bump means
1006
+ // dense grids (≥6-7 rows) overflow the 680-px viewBox at the natural
1007
+ // 100% zoom — a new user sees the topology with its bottom rows
1008
+ // clipped and no hint that there's more below. Auto-fit on first
1009
+ // paint (and only if the user has no persisted view) sets the
1010
+ // initial zoom so all content fits. Subsequent zoom changes persist
1011
+ // and override the auto-fit on reload; explicit reset (0 key) still
1012
+ // goes back to 100% so the gesture's "reset to natural size" semantic
1013
+ // is preserved.
1014
+ //
1015
+ // Capture pre-mount persistence in a useState initializer — the
1016
+ // existing `persist` effect (declared below) runs on first render
1017
+ // with the default {1,0,0} view and writes it to localStorage before
1018
+ // the auto-fit effect (deps on async-arriving sessions) gets a turn.
1019
+ // Reading localStorage from the effect would see that write and
1020
+ // skip the fit. The useState snapshot fires once, before any effects.
1021
+ const [hadPersistedViewOnMount] = useState<boolean>(
1022
+ () => typeof window !== 'undefined' && !!localStorage.getItem('anet-topo-view'),
1023
+ );
1024
+ const autoFitDoneRef = useRef(false);
1025
+ useEffect(() => {
1026
+ if (autoFitDoneRef.current) return;
1027
+ if (hadPersistedViewOnMount) {
1028
+ autoFitDoneRef.current = true;
1029
+ return;
1030
+ }
1031
+ if (layout !== 'grid' || sessions.length === 0 || !gridContentBottom) return;
1032
+ if (gridContentBottom <= VIEWBOX_H) {
1033
+ autoFitDoneRef.current = true; // no overflow → no fit needed
1034
+ return;
1035
+ }
1036
+ const fitZoom = Math.max(ZOOM_MIN, Math.min(1, VIEWBOX_H / gridContentBottom));
1037
+ setView({ zoom: fitZoom, x: 0, y: 0 });
1038
+ autoFitDoneRef.current = true;
1039
+ }, [layout, sessions.length, gridContentBottom, hadPersistedViewOnMount]);
1040
+
664
1041
  // persist view
665
1042
  useEffect(() => {
666
1043
  try { localStorage.setItem('anet-topo-view', JSON.stringify(view)); } catch {}
@@ -680,6 +1057,14 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
680
1057
  const svg = svgRef.current;
681
1058
  if (!svg) return;
682
1059
  const onWheel = (e: WheelEvent) => {
1060
+ // Round 23 / Loop: only zoom on Ctrl/Meta+wheel when inline; plain
1061
+ // wheel over the canvas keeps scrolling the page (the topo sits at
1062
+ // the top of /; trapping page scroll mid-page is the classic
1063
+ // "scroll-jail" anti-pattern). In fullscreen the canvas owns the
1064
+ // viewport so any wheel zooms — no page scroll to preserve. Pinch-
1065
+ // zoom on a trackpad surfaces as ctrlKey=true natively, which is
1066
+ // also what we want (zoom the canvas, not the browser).
1067
+ if (!isFullscreen && !e.ctrlKey && !e.metaKey) return;
683
1068
  e.preventDefault();
684
1069
  const rect = svg.getBoundingClientRect();
685
1070
  const mx = ((e.clientX - rect.left) / rect.width) * VIEWBOX_W;
@@ -700,8 +1085,17 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
700
1085
  };
701
1086
  svg.addEventListener('wheel', onWheel, { passive: false });
702
1087
  return () => svg.removeEventListener('wheel', onWheel);
703
- }, []);
704
-
1088
+ // Re-attach when the fullscreen flag toggles so the handler's
1089
+ // closure picks up the new value (capture-by-closure means we'd
1090
+ // otherwise read the stale boolean forever).
1091
+ }, [isFullscreen]);
1092
+
1093
+ // Round 21 / Loop: pan-aware cursor. Static `grab` gave no tactile cue
1094
+ // that the canvas was actually being dragged — "grabbing" while
1095
+ // dragRef.current.active = true tells the hand it's moving the
1096
+ // viewport. Mirroring dragRef.active into state is the only way to
1097
+ // re-render the SVG style; the ref itself doesn't trigger renders.
1098
+ const [isPanning, setIsPanning] = useState(false);
705
1099
  const onPointerDown = (e: React.PointerEvent<SVGSVGElement>) => {
706
1100
  if (e.button !== 0) return;
707
1101
  (e.currentTarget as Element).setPointerCapture?.(e.pointerId);
@@ -712,6 +1106,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
712
1106
  baseX: viewRef.current.x,
713
1107
  baseY: viewRef.current.y,
714
1108
  };
1109
+ setIsPanning(true);
715
1110
  };
716
1111
  const onPointerMove = (e: React.PointerEvent<SVGSVGElement>) => {
717
1112
  const d = dragRef.current;
@@ -726,6 +1121,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
726
1121
  const onPointerUp = (e: React.PointerEvent<SVGSVGElement>) => {
727
1122
  if (!dragRef.current.active) return;
728
1123
  dragRef.current.active = false;
1124
+ setIsPanning(false);
729
1125
  try {
730
1126
  (e.currentTarget as Element).releasePointerCapture?.(e.pointerId);
731
1127
  } catch {}
@@ -743,6 +1139,90 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
743
1139
  };
744
1140
  const resetView = () => setView({ zoom: 1, x: 0, y: 0 });
745
1141
 
1142
+ // Round 29 / Loop: `f` = fit-to-content. Shared by the Round 28
1143
+ // first-paint auto-fit effect and the keyboard handler so the math is
1144
+ // in one place. When content already fits at natural zoom, this is
1145
+ // effectively a "recenter" — `f` always lands on a known good view.
1146
+ const fitView = useCallback(() => {
1147
+ const zoom = !gridContentBottom || gridContentBottom <= VIEWBOX_H
1148
+ ? 1
1149
+ : Math.max(ZOOM_MIN, Math.min(1, VIEWBOX_H / gridContentBottom));
1150
+ setView({ zoom, x: 0, y: 0 });
1151
+ }, [gridContentBottom]);
1152
+
1153
+ // R74: listen for layout + view palette commands. Sister to R69's
1154
+ // pin listener — palette dispatches a CustomEvent, the reducer here
1155
+ // calls toggleLayout / fitView. Sits below fitView's declaration so
1156
+ // the deps list resolves cleanly.
1157
+ useEffect(() => {
1158
+ const onLayout = (e: Event) => {
1159
+ const detail = (e as CustomEvent).detail || {};
1160
+ if (detail.kind === 'toggle') toggleLayout();
1161
+ };
1162
+ const onView = (e: Event) => {
1163
+ const detail = (e as CustomEvent).detail || {};
1164
+ if (detail.kind === 'fit') fitView();
1165
+ };
1166
+ window.addEventListener('anet:topo-layout', onLayout);
1167
+ window.addEventListener('anet:topo-view', onView);
1168
+ return () => {
1169
+ window.removeEventListener('anet:topo-layout', onLayout);
1170
+ window.removeEventListener('anet:topo-view', onView);
1171
+ };
1172
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1173
+ }, [fitView]);
1174
+
1175
+ // Round 22 / Loop: keyboard zoom — +/= zoom in, - zoom out, 0 reset.
1176
+ // Round 29 / Loop: +f to fit content.
1177
+ // Listen on window so the user doesn't need to focus the SVG first,
1178
+ // but only act when no text input has focus (otherwise typing "-" in
1179
+ // a chat would zoom the topology — surprising and bad). Modifier keys
1180
+ // pass through so Cmd/Ctrl combos still hit their owners. The button
1181
+ // titles below document these shortcuts so users discover them.
1182
+ useEffect(() => {
1183
+ const onKey = (e: KeyboardEvent) => {
1184
+ if (e.ctrlKey || e.metaKey || e.altKey) return;
1185
+ const ae = document.activeElement as HTMLElement | null;
1186
+ if (ae) {
1187
+ const tag = ae.tagName;
1188
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || ae.isContentEditable) return;
1189
+ }
1190
+ if (e.key === '+' || e.key === '=') { zoomBy(1.2); e.preventDefault(); }
1191
+ else if (e.key === '-' || e.key === '_') { zoomBy(1 / 1.2); e.preventDefault(); }
1192
+ else if (e.key === '0') { resetView(); e.preventDefault(); }
1193
+ else if (e.key === 'f' || e.key === 'F') { fitView(); e.preventDefault(); }
1194
+ // Round 32 / Loop: `l` toggles ring|grid. The vim-style `g l` route
1195
+ // (Audit Log) requires a preceding `g` within 1500ms; a bare `l`
1196
+ // outside that window is free for topology use.
1197
+ else if (e.key === 'l' || e.key === 'L') { toggleLayout(); e.preventDefault(); }
1198
+ // Round 62 / Loop: Esc clears the R60/R61 pinned status filter so
1199
+ // users have a universal-cancel keyboard out. Esc on an open chat
1200
+ // is owned by ChatPopover (which only mounts when chatAlias is
1201
+ // set), so this handler is effectively scoped to "no chat open".
1202
+ // We additionally guard on chatAlias to be explicit — if the chat
1203
+ // closed mid-cycle, the pin can still be cleared on the next Esc.
1204
+ // R63: extends to pinnedGroup too. Clears WHATEVER pin is active
1205
+ // (one Esc collapses all topology pins) so the keyboard escape
1206
+ // route stays a single key, not "Esc maybe Esc again".
1207
+ else if (e.key === 'Escape' && !chatAlias && (pinnedStatus || pinnedGroup || pinnedVendor)) {
1208
+ // R88: extend the universal-cancel to pinnedVendor too. One Esc
1209
+ // collapses every topology pin (matches R62/R63's "single key,
1210
+ // not Esc-maybe-Esc-again" promise).
1211
+ if (pinnedStatus) setPinnedStatus(null);
1212
+ if (pinnedGroup) setPinnedGroup(null);
1213
+ if (pinnedVendor) setPinnedVendor(null);
1214
+ e.preventDefault();
1215
+ }
1216
+ };
1217
+ window.addEventListener('keydown', onKey);
1218
+ return () => window.removeEventListener('keydown', onKey);
1219
+ // zoomBy / resetView are stable wrt setView callback; fitView changes
1220
+ // with gridContentBottom so deps list catches it. R62 adds chatAlias
1221
+ // and pinnedStatus so the Escape branch reads fresh state (re-binding
1222
+ // the listener on these state changes is sub-ms — cheaper than refs).
1223
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1224
+ }, [fitView, chatAlias, pinnedStatus, pinnedGroup, pinnedVendor]);
1225
+
746
1226
  const toggleFullscreen = () => {
747
1227
  const el = containerRef.current;
748
1228
  if (!el) return;
@@ -770,6 +1250,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
770
1250
  <button
771
1251
  onClick={() => { if (layout !== 'ring') toggleLayout(); }}
772
1252
  aria-pressed={layout === 'ring'}
1253
+ title="Ring layout (l to toggle)"
773
1254
  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
1255
  >
775
1256
  Ring
@@ -777,20 +1258,438 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
777
1258
  <button
778
1259
  onClick={() => { if (layout !== 'grid') toggleLayout(); }}
779
1260
  aria-pressed={layout === 'grid'}
1261
+ title="Grid layout (l to toggle)"
780
1262
  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
1263
  >
782
1264
  Grid
783
1265
  </button>
784
1266
  </div>
785
- <span className="px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20">
786
- {workingCount} working
787
- </span>
788
- <span className="px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20">
789
- {onlineNodes.length} online
790
- </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>
1267
+ {/* R79: working + online count chips become hover affordances —
1268
+ extends R77's chip-hover pattern to status counts. Hover the
1269
+ working chip → setHoveredStatus('working') so the R55 dim
1270
+ mechanic kicks in (same as hovering the SVG legend "working"
1271
+ row, just a different surface for the same gesture).
1272
+ The online chip uses the same setHoveredStatus('idle') path
1273
+ when there's idle but no working — falling back to working
1274
+ if any working node exists; "online" without a single bucket
1275
+ isn't part of the R55 type set, so this chip routes to the
1276
+ dominant online sub-tier instead of inventing a new state.
1277
+ Cursor only flips when there's anything to highlight. */}
1278
+ {/* R82: pin-mirror. R60 pressure-bar segments visualise the
1279
+ pinned status via an inset boxShadow; R61 legend rows via a
1280
+ concentric r=8 ring; the chip-row chips next to them did
1281
+ not — so a user who pinned via Cmd+K (R69) or the legend
1282
+ had no chip-row signal that "working" was the current
1283
+ filter. Mirror the pressure-bar treatment here so all
1284
+ status surfaces sing in unison. The online chip mirrors
1285
+ for idle pins (working ⊆ online; the routing in
1286
+ onMouseEnter already treats online as the idle fallback). */}
1287
+ {(() => {
1288
+ // R113 / Loop: extend the R97-R102/R101 alias-list tooltip
1289
+ // sweep to the remaining chip-row affordances. R79 made
1290
+ // these chips hoverable; their generic "Hover to highlight"
1291
+ // titles never said WHICH nodes match. Compute the alias
1292
+ // lists once for both chips to share.
1293
+ const workingAliases = onlineNodes.filter(s => s.status === 'working').map(s => s.alias);
1294
+ const onlineAliases = onlineNodes.map(s => s.alias);
1295
+ const truncate = (list: string[]) => {
1296
+ const head = list.slice(0, 8).join(', ');
1297
+ const tail = list.length > 8 ? ` + ${list.length - 8} more` : '';
1298
+ return head + tail;
1299
+ };
1300
+ const workingTitle = workingCount === 0
1301
+ ? undefined
1302
+ : pinnedStatus === 'working'
1303
+ ? `${truncate(workingAliases)} — pinned, Esc to clear`
1304
+ : `${truncate(workingAliases)} — hover highlights, click to pin`;
1305
+ const onlineTitle = onlineNodes.length === 0
1306
+ ? undefined
1307
+ : pinnedStatus === 'idle'
1308
+ ? `${truncate(onlineAliases)} — pinned, Esc to clear`
1309
+ : `${truncate(onlineAliases)} — hover highlights online`;
1310
+ return (
1311
+ <>
1312
+ <span
1313
+ className="px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20"
1314
+ data-working-chip
1315
+ data-working-chip-aliases={workingAliases.join(',')}
1316
+ data-pin-mirror={pinnedStatus === 'working' ? 'true' : 'false'}
1317
+ title={workingTitle}
1318
+ style={{
1319
+ cursor: workingCount > 0 ? 'pointer' : undefined,
1320
+ boxShadow: pinnedStatus === 'working' ? 'inset 0 0 0 1px #4ade80, inset 0 0 0 2px rgba(255,255,255,0.45)' : undefined,
1321
+ }}
1322
+ onMouseEnter={() => { if (workingCount > 0) setHoveredStatus('working'); }}
1323
+ onMouseLeave={() => setHoveredStatus(prev => prev === 'working' ? null : prev)}
1324
+ >
1325
+ {workingCount} working
1326
+ </span>
1327
+ <span
1328
+ className="px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20"
1329
+ data-online-chip
1330
+ data-online-chip-aliases={onlineAliases.join(',')}
1331
+ data-pin-mirror={pinnedStatus === 'idle' ? 'true' : 'false'}
1332
+ title={onlineTitle}
1333
+ style={{
1334
+ cursor: onlineNodes.length > 0 ? 'pointer' : undefined,
1335
+ boxShadow: pinnedStatus === 'idle' ? 'inset 0 0 0 1px #67e8f9, inset 0 0 0 2px rgba(255,255,255,0.45)' : undefined,
1336
+ }}
1337
+ onMouseEnter={() => {
1338
+ // If a working filter would isolate nothing, route to idle.
1339
+ const idleCount = onlineNodes.length - workingCount;
1340
+ if (workingCount > 0) setHoveredStatus('working');
1341
+ else if (idleCount > 0) setHoveredStatus('idle');
1342
+ }}
1343
+ onMouseLeave={() => setHoveredStatus(prev => prev === 'working' || prev === 'idle' ? null : prev)}
1344
+ >
1345
+ {onlineNodes.length} online
1346
+ </span>
1347
+ </>
1348
+ );
1349
+ })()}
1350
+ {/* Round 31 / Loop: fleet-health pressure bar. The "X working /
1351
+ Y online" chips already carry the raw counts; the bar lets
1352
+ the eye get the working/idle/offline RATIO in one glance
1353
+ without mental math. Stacked 3-segment chip, ~64 px wide. */}
1354
+ {(() => {
1355
+ const w = workingCount;
1356
+ const i = onlineNodes.length - workingCount; // idle = online - working
1357
+ const o = offlineNodes.length;
1358
+ const total = w + i + o;
1359
+ if (total === 0) return null;
1360
+ // Round 60 / Loop: each segment toggles a sticky filter via
1361
+ // `pinnedStatus`. Click the working segment → all non-working
1362
+ // nodes dim; click again → release. Segments share width with
1363
+ // their proportion of `total`, so a 1-node working share is
1364
+ // ~3 px wide on a 64-px bar. We pad the click target with a
1365
+ // negative-margin overlay wrapper to give thin slices a
1366
+ // 14-px minimum hit area without disturbing the rendered
1367
+ // chip width. cursor:pointer + a one-line title hint at the
1368
+ // affordance.
1369
+ const seg = (n: number, color: string, key: 'working' | 'idle' | 'offline', label: string) => {
1370
+ if (n === 0) return null;
1371
+ const isPinned = pinnedStatus === key;
1372
+ // R102: list the aliases that match this segment's bucket
1373
+ // so the title answers WHICH n, not just HOW MANY. Closes
1374
+ // the last "info-density gap" in the chip-row surfaces
1375
+ // (R97 pills / R99 group labels / R101 vendor letters all
1376
+ // already enumerate). Truncates at 8 with "+N more".
1377
+ const matchAliases = key === 'working'
1378
+ ? onlineNodes.filter(s => s.status === 'working').map(s => s.alias)
1379
+ : key === 'idle'
1380
+ ? onlineNodes.filter(s => s.status !== 'working').map(s => s.alias)
1381
+ : offlineNodes.map(s => s.alias);
1382
+ const previewList = matchAliases.slice(0, 8).join(', ');
1383
+ const suffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1384
+ const titleAction = isPinned ? 'click to release filter' : 'click to highlight';
1385
+ return (
1386
+ <span
1387
+ key={key}
1388
+ data-pressure-seg={key}
1389
+ data-pressure-seg-aliases={matchAliases.join(',')}
1390
+ role="button"
1391
+ tabIndex={0}
1392
+ aria-pressed={isPinned}
1393
+ title={`${n} ${label}\n${previewList}${suffix}\n${titleAction}`}
1394
+ style={{
1395
+ width: `${(n / total) * 100}%`,
1396
+ background: color,
1397
+ height: '100%',
1398
+ cursor: 'pointer',
1399
+ boxShadow: isPinned ? `inset 0 0 0 1px ${color}, inset 0 0 0 2px rgba(255,255,255,0.6)` : undefined,
1400
+ }}
1401
+ onClick={(e) => {
1402
+ e.stopPropagation();
1403
+ setPinnedStatus(prev => prev === key ? null : key);
1404
+ }}
1405
+ onKeyDown={(e) => {
1406
+ if (e.key === 'Enter' || e.key === ' ') {
1407
+ e.preventDefault();
1408
+ setPinnedStatus(prev => prev === key ? null : key);
1409
+ }
1410
+ }}
1411
+ // R83: hover preview — segments now match the R55 legend,
1412
+ // R79 working/online chips, and R80 vendor letters in
1413
+ // offering a hover-transient highlight before the click
1414
+ // commits to a pin. Users get to feel what the filter
1415
+ // does before they lock it in. Same activeStatus =
1416
+ // hoveredStatus ?? pinnedStatus formula; releasing the
1417
+ // pointer falls back to the pin if one is set, or to
1418
+ // baseline. Thin (3-px) segments still hit-test fine
1419
+ // because the chip itself is a flex row — span doesn't
1420
+ // need any extra hit padding for hover.
1421
+ onMouseEnter={() => setHoveredStatus(key)}
1422
+ onMouseLeave={() => setHoveredStatus(prev => prev === key ? null : prev)}
1423
+ />
1424
+ );
1425
+ };
1426
+ // Round 47 / Loop: hidden on mobile — at <640px the chip row
1427
+ // wraps to multiple lines and crowds the topology header;
1428
+ // pressure ratio is best read with the working+online raw
1429
+ // counts (kept visible) anyway.
1430
+ return (
1431
+ <span
1432
+ 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"
1433
+ title={`${w} working · ${i} idle · ${o} offline`}
1434
+ data-fleet-pressure
1435
+ >
1436
+ <span className="text-[10px] tracking-wide">pressure</span>
1437
+ <span className="inline-flex h-1.5 w-16 rounded-full overflow-hidden" style={{ background: 'rgb(75 85 99 / 0.25)' }}>
1438
+ {seg(w, isLight ? '#059669' : '#22c55e', 'working', 'working')}
1439
+ {seg(i, isLight ? '#0d9488' : '#2dd4bf', 'idle', 'idle')}
1440
+ {seg(o, isLight ? '#94a3b8' : '#6b7280', 'offline', 'offline')}
1441
+ </span>
1442
+ </span>
1443
+ );
1444
+ })()}
1445
+ {/* Round 64 / Loop: active-filter pills. When pinnedStatus or
1446
+ pinnedGroup is set, show a small "filter: <key> ×" pill so
1447
+ the user can see the pin from the chip row even if they
1448
+ scrolled the canvas off-screen. × button clears the
1449
+ specific pin (Esc still clears all — both paths are
1450
+ valid). pinnedStatus and pinnedGroup pin independently so
1451
+ both pills may render simultaneously. */}
1452
+ {/* R67: pills enter via anet-fade-in so they appear softly
1453
+ instead of popping. The "filter: " prefix collapses below
1454
+ sm — at narrow viewports the chip row is precious real
1455
+ estate (R47 already hides pressure / vendor / freshness),
1456
+ so dropping the redundant label keeps the working/idle/
1457
+ alpha keys readable without overflow. */}
1458
+ {/* R71: each pill picks up a "· N" match count tail. Tells the
1459
+ user at a glance how many sessions the active filter
1460
+ matches without scanning the canvas. Counts come from the
1461
+ already-computed workingCount + onlineNodes + offlineNodes
1462
+ for status, and groupKeys for group. */}
1463
+ {/* R73: entire pill body is a click-to-clear target — matches
1464
+ the Notion / Linear tag UX (the whole chip releases). The
1465
+ × keeps its dedicated <button> + aria-label for screen
1466
+ readers; the outer span just adds an extra mouse-friendly
1467
+ hit area with a title hint. ×'s onClick stopPropagation
1468
+ so the redundant outer onClick doesn't double-fire (no
1469
+ functional difference since both clear, but cleaner
1470
+ event flow). */}
1471
+ {pinnedStatus && (() => {
1472
+ const matchCount = pinnedStatus === 'working' ? workingCount
1473
+ : pinnedStatus === 'idle' ? (onlineNodes.length - workingCount)
1474
+ : offlineNodes.length;
1475
+ // Round 97 / Loop: the pill says HOW MANY but not WHICH.
1476
+ // Hovering it now shows the matched alias list in the
1477
+ // tooltip — answers "exactly who is this filtering to"
1478
+ // without forcing the user to scan the dim mask on the
1479
+ // canvas. Truncates at 8 names so a 50-node working
1480
+ // bucket doesn't produce a 12-line tooltip; the count
1481
+ // chip already answers "how many overall".
1482
+ const matchAliases = pinnedStatus === 'working'
1483
+ ? onlineNodes.filter(s => s.status === 'working').map(s => s.alias)
1484
+ : pinnedStatus === 'idle'
1485
+ ? onlineNodes.filter(s => s.status !== 'working').map(s => s.alias)
1486
+ : offlineNodes.map(s => s.alias);
1487
+ const matchPreview = matchAliases.slice(0, 8).join(', ');
1488
+ const matchSuffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1489
+ return (
1490
+ <span
1491
+ data-active-filter="status"
1492
+ data-filter-match-count={matchCount}
1493
+ data-filter-match-aliases={matchAliases.join(',')}
1494
+ className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in"
1495
+ title={matchCount > 0 ? `${matchPreview}${matchSuffix} — click to clear` : 'Click to clear filter'}
1496
+ onClick={() => setPinnedStatus(null)}
1497
+ style={{
1498
+ background: pinnedStatus === 'working' ? (isLight ? '#05966914' : '#22c55e1f')
1499
+ : pinnedStatus === 'idle' ? (isLight ? '#0d948814' : '#2dd4bf1f')
1500
+ : (isLight ? '#94a3b814' : '#6b72801f'),
1501
+ color: pinnedStatus === 'working' ? (isLight ? '#047857' : '#86efac')
1502
+ : pinnedStatus === 'idle' ? (isLight ? '#0f766e' : '#5eead4')
1503
+ : (isLight ? '#475569' : '#9ca3af'),
1504
+ borderColor: 'currentColor',
1505
+ cursor: 'pointer',
1506
+ }}
1507
+ >
1508
+ <span><span className="hidden sm:inline" data-filter-prefix>filter: </span>{pinnedStatus}<span className="opacity-70"> · {matchCount}</span></span>
1509
+ <button
1510
+ type="button"
1511
+ aria-label={`Clear ${pinnedStatus} filter`}
1512
+ onClick={(e) => { e.stopPropagation(); setPinnedStatus(null); }}
1513
+ className="ml-0.5 leading-none hover:opacity-70"
1514
+ style={{ background: 'transparent', color: 'inherit', cursor: 'pointer', padding: 0 }}
1515
+ >×</button>
1516
+ </span>
1517
+ );
1518
+ })()}
1519
+ {pinnedGroup && (() => {
1520
+ const matchCount = Object.values(groupKeys).filter(k => k === pinnedGroup).length;
1521
+ // R97: list group members in the tooltip.
1522
+ const matchAliases = Object.entries(groupKeys)
1523
+ .filter(([, key]) => key === pinnedGroup)
1524
+ .map(([alias]) => alias);
1525
+ const matchPreview = matchAliases.slice(0, 8).join(', ');
1526
+ const matchSuffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1527
+ return (
1528
+ <span
1529
+ data-active-filter="group"
1530
+ data-filter-match-count={matchCount}
1531
+ data-filter-match-aliases={matchAliases.join(',')}
1532
+ className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in"
1533
+ title={matchCount > 0 ? `${matchPreview}${matchSuffix} — click to clear` : 'Click to clear filter'}
1534
+ onClick={() => setPinnedGroup(null)}
1535
+ style={{
1536
+ background: isLight ? '#67e8f914' : '#67e8f91f',
1537
+ color: pal.legendAccent,
1538
+ borderColor: 'currentColor',
1539
+ cursor: 'pointer',
1540
+ }}
1541
+ >
1542
+ <span><span className="hidden sm:inline" data-filter-prefix>filter: </span>{pinnedGroup}<span className="opacity-70"> · {matchCount}</span></span>
1543
+ <button
1544
+ type="button"
1545
+ aria-label={`Clear group filter ${pinnedGroup}`}
1546
+ onClick={(e) => { e.stopPropagation(); setPinnedGroup(null); }}
1547
+ className="ml-0.5 leading-none hover:opacity-70"
1548
+ style={{ background: 'transparent', color: 'inherit', cursor: 'pointer', padding: 0 }}
1549
+ >×</button>
1550
+ </span>
1551
+ );
1552
+ })()}
1553
+ {/* R89: vendor pin gets its own filter pill, matching the R64
1554
+ status + group pattern. R88 added the pin but only the
1555
+ letter itself carried the state; the chip-row had no
1556
+ "filter: A · 2 ×" affordance the other two pins have. The
1557
+ pill colour borrows the vendor's own swatch so each pin
1558
+ still reads in its native hue (A green, O cyan, 书 blue,
1559
+ ? slate). Same body-click-clears + × button pattern as
1560
+ R64. */}
1561
+ {pinnedVendor && (() => {
1562
+ const matchEntry = vendorDist.find(v => v.initial === pinnedVendor);
1563
+ const matchCount = matchEntry?.count ?? 0;
1564
+ const vendorColor = matchEntry?.color ?? pal.legendText;
1565
+ // R97: list vendor users in the tooltip. The vendorIdentity
1566
+ // resolver maps model strings to a vendor initial — match
1567
+ // any session whose initial equals the pinned letter (with
1568
+ // unknowns folded to '?').
1569
+ const matchAliases = [...onlineNodes, ...offlineNodes]
1570
+ .filter(s => {
1571
+ const v = vendorForModel(s.model);
1572
+ return (v.id === 'unknown' ? '?' : v.initial) === pinnedVendor;
1573
+ })
1574
+ .map(s => s.alias);
1575
+ const matchPreview = matchAliases.slice(0, 8).join(', ');
1576
+ const matchSuffix = matchAliases.length > 8 ? ` + ${matchAliases.length - 8} more` : '';
1577
+ return (
1578
+ <span
1579
+ data-active-filter="vendor"
1580
+ data-filter-match-count={matchCount}
1581
+ data-filter-match-aliases={matchAliases.join(',')}
1582
+ className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in"
1583
+ title={matchCount > 0 ? `${matchPreview}${matchSuffix} — click to clear` : 'Click to clear vendor filter'}
1584
+ onClick={() => setPinnedVendor(null)}
1585
+ style={{
1586
+ background: `${vendorColor}1f`,
1587
+ color: vendorColor,
1588
+ borderColor: 'currentColor',
1589
+ cursor: 'pointer',
1590
+ }}
1591
+ >
1592
+ <span><span className="hidden sm:inline" data-filter-prefix>filter: </span>{pinnedVendor}<span className="opacity-70"> · {matchCount}</span></span>
1593
+ <button
1594
+ type="button"
1595
+ aria-label={`Clear vendor filter ${pinnedVendor}`}
1596
+ onClick={(e) => { e.stopPropagation(); setPinnedVendor(null); }}
1597
+ className="ml-0.5 leading-none hover:opacity-70"
1598
+ style={{ background: 'transparent', color: 'inherit', cursor: 'pointer', padding: 0 }}
1599
+ >×</button>
1600
+ </span>
1601
+ );
1602
+ })()}
1603
+ {vendorDist.length > 1 && (
1604
+ <span
1605
+ 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"
1606
+ title="Hover to highlight; click to pin"
1607
+ >
1608
+ {vendorDist.map(v => {
1609
+ const isPinned = pinnedVendor === v.initial;
1610
+ // R88: click toggles a sticky filter the same way R60
1611
+ // pressure-bar segments toggle pinnedStatus. Visual
1612
+ // mirror = inset boxShadow using the vendor's own
1613
+ // colour, so each pinned letter sings in its own hue
1614
+ // (Anthropic green / OpenAI cyan / 书 blue / ?).
1615
+ // R101: tooltip lists the aliases that use this vendor —
1616
+ // completes the info-density triple started by R97 pills,
1617
+ // R98 node titles, R99 group-label titles. Anywhere the
1618
+ // UI shows "A:3" should hover-explain which 3.
1619
+ const aliases = [...onlineNodes, ...offlineNodes]
1620
+ .filter(s => {
1621
+ const vid = vendorForModel(s.model);
1622
+ return (vid.id === 'unknown' ? '?' : vid.initial) === v.initial;
1623
+ })
1624
+ .map(s => s.alias);
1625
+ const preview = aliases.slice(0, 8).join(', ');
1626
+ const suffix = aliases.length > 8 ? ` + ${aliases.length - 8} more` : '';
1627
+ const tooltip = isPinned
1628
+ ? `${preview}${suffix} — click again or Esc to clear`
1629
+ : `${preview}${suffix} — click to pin`;
1630
+ return (
1631
+ <span
1632
+ key={v.initial}
1633
+ role="button"
1634
+ tabIndex={0}
1635
+ aria-pressed={isPinned}
1636
+ className="inline-flex items-baseline gap-0.5 px-1 rounded"
1637
+ data-vendor-letter={v.initial}
1638
+ data-vendor-pinned={isPinned ? 'true' : 'false'}
1639
+ data-vendor-aliases={aliases.join(',')}
1640
+ title={tooltip}
1641
+ style={{
1642
+ cursor: 'pointer',
1643
+ boxShadow: isPinned
1644
+ ? `inset 0 0 0 1px ${v.color}, inset 0 0 0 2px rgba(255,255,255,0.45)`
1645
+ : undefined,
1646
+ }}
1647
+ onMouseEnter={() => setHoveredVendor(v.initial)}
1648
+ onMouseLeave={() => setHoveredVendor(prev => prev === v.initial ? null : prev)}
1649
+ onClick={() => setPinnedVendor(prev => prev === v.initial ? null : v.initial)}
1650
+ onKeyDown={(e) => {
1651
+ if (e.key === 'Enter' || e.key === ' ') {
1652
+ e.preventDefault();
1653
+ setPinnedVendor(prev => prev === v.initial ? null : v.initial);
1654
+ }
1655
+ }}
1656
+ >
1657
+ <span style={{ color: v.color }}>{v.initial}</span>
1658
+ <span className="text-gray-500">:{v.count}</span>
1659
+ </span>
1660
+ );
1661
+ })}
1662
+ </span>
1663
+ )}
1664
+ {/* Round 42 / Loop: extend active-links chip with the timestamp
1665
+ of the most-recent flow event. Tells the operator at a glance
1666
+ whether the topology is currently humming (last 30s) or has
1667
+ been quiet for a while — the visual flow particles and
1668
+ edge brightness only show that there IS traffic, not when
1669
+ the last one was. Reuses Round 38's relativeAgo. */}
1670
+ {(() => {
1671
+ const recent = flowLinks.reduce<number | null>((acc, l) => {
1672
+ if (!l.last_at) return acc;
1673
+ const t = parseHubTime(l.last_at);
1674
+ if (t === null) return acc;
1675
+ return acc === null || t > acc ? t : acc;
1676
+ }, null);
1677
+ const rel = recent !== null ? relativeAgo(new Date(recent).toISOString()) : null;
1678
+ return (
1679
+ <span
1680
+ className="hidden sm:inline px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20"
1681
+ data-active-links-chip
1682
+ title={flowLinks.length > 0 ? 'Hover to brighten all active flows' : undefined}
1683
+ style={{ cursor: flowLinks.length > 0 ? 'pointer' : undefined }}
1684
+ onMouseEnter={() => { if (flowLinks.length > 0) setHoveredActiveLinks(true); }}
1685
+ onMouseLeave={() => setHoveredActiveLinks(false)}
1686
+ >
1687
+ {flowLinks.length} active link{flowLinks.length === 1 ? '' : 's'}
1688
+ {rel ? <span className="text-gray-500"> · last {rel}</span> : null}
1689
+ </span>
1690
+ );
1691
+ })()}
1692
+ <FreshnessChip sessions={sessions} />
794
1693
  </div>
795
1694
  </div>
796
1695
 
@@ -810,7 +1709,18 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
810
1709
  onPointerMove={onPointerMove}
811
1710
  onPointerUp={onPointerUp}
812
1711
  onPointerLeave={onPointerUp}
813
- style={{ cursor: 'grab', touchAction: 'none' }}
1712
+ // Round 41 / Loop: the reset-button title (R22) and the Help
1713
+ // overlay (R25) both advertise "double-click the canvas to
1714
+ // reset", but the handler was never actually wired. The text
1715
+ // was lying. Wire it here, guarded so dbl-clicking a node
1716
+ // (which would also trigger the SVG-level handler via event
1717
+ // bubbling) doesn't unexpectedly reset the view on the user.
1718
+ onDoubleClick={(e) => {
1719
+ const t = e.target as Element | null;
1720
+ if (t?.closest('g[data-node]')) return;
1721
+ resetView();
1722
+ }}
1723
+ style={{ cursor: isPanning ? 'grabbing' : 'grab', touchAction: 'none' }}
814
1724
  >
815
1725
  <defs>
816
1726
  <linearGradient id="topo-panel" x1="0" x2="1" y1="0" y2="1">
@@ -832,9 +1742,37 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
832
1742
  </feMerge>
833
1743
  </filter>
834
1744
  )}
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>
1745
+ {/* Round 16 / Loop: 3-tier flow-link arrow markers.
1746
+ The single marker had `markerUnits` defaulting to
1747
+ `strokeWidth`, so heavy edges (stroke=7) rendered 35-user-
1748
+ unit arrowheads — visually dominant, the head outweighed
1749
+ the line. Switching to `userSpaceOnUse` decouples arrow
1750
+ size from stroke; binning by count gives a clearer
1751
+ hierarchy than continuous linear scaling:
1752
+ s (count 1-2) → 12 user units
1753
+ m (count 3-4) → 16 user units (alias for `topo-arrow`)
1754
+ l (count 5+) → 22 user units
1755
+ `topo-arrow` stays bound to the medium tier so the legend
1756
+ swatch (line ~1500) renders without change. */}
1757
+ {[
1758
+ { id: 'topo-arrow-s', size: 12 },
1759
+ { id: 'topo-arrow', size: 16 },
1760
+ { id: 'topo-arrow-l', size: 22 },
1761
+ ].map(m => (
1762
+ <marker
1763
+ key={m.id}
1764
+ id={m.id}
1765
+ viewBox="0 0 10 10"
1766
+ refX="8"
1767
+ refY="5"
1768
+ markerWidth={m.size}
1769
+ markerHeight={m.size}
1770
+ markerUnits="userSpaceOnUse"
1771
+ orient="auto-start-reverse"
1772
+ >
1773
+ <path d="M 0 0 L 10 5 L 0 10 z" fill={pal.arrowFill} />
1774
+ </marker>
1775
+ ))}
838
1776
  {/* Round 45: radial radar sweep gradient — bright at center
839
1777
  (where it meets the hub) fading to leading edge. */}
840
1778
  <radialGradient id="topo-sweep" cx="0%" cy="50%" r="100%">
@@ -854,13 +1792,17 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
854
1792
  grid mode drops it so the concentric rings don't sit behind a
855
1793
  rectangular grid. */}
856
1794
  {layout === 'ring' && (<>
857
- <circle cx={cx} cy={cy} r="330" fill="url(#topo-radar)" />
1795
+ {/* R52: radar bg is pure decoration — drop its pointer events so
1796
+ the hub <g> under it (and any future inner-disk affordances)
1797
+ can receive clicks. Previously the r=330 disc intercepted
1798
+ the hub click outright. */}
1799
+ <circle cx={cx} cy={cy} r="330" fill="url(#topo-radar)" style={{ pointerEvents: 'none' }} />
858
1800
 
859
1801
  {/* Round 45: subtle star field — 24 deterministic dots scattered
860
1802
  across the canvas give the radar bg some depth. Skipped on
861
1803
  light theme so the white surface stays clean. */}
862
1804
  {!isLight && (
863
- <g opacity="0.5">
1805
+ <g opacity="0.5" style={{ pointerEvents: 'none' }}>
864
1806
  {Array.from({ length: 28 }).map((_, i) => {
865
1807
  // Deterministic pseudo-random scatter so positions are
866
1808
  // stable between renders (no JS hydration mismatch).
@@ -882,6 +1824,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
882
1824
  style={{
883
1825
  transformOrigin: `${cx}px ${cy}px`,
884
1826
  transformBox: 'view-box',
1827
+ pointerEvents: 'none',
885
1828
  }}
886
1829
  className="anet-topo-sweep"
887
1830
  opacity={isLight ? 0.7 : 1}
@@ -892,11 +1835,82 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
892
1835
  />
893
1836
  </g>
894
1837
 
895
- {/* radar rings */}
1838
+ {/* radar rings — pure decoration at fixed radii, independent of
1839
+ node positions so the radar aesthetic is preserved across tier
1840
+ changes. */}
896
1841
  {[90, 170, 250, 330].map(radius => (
897
1842
  <circle key={radius} cx={cx} cy={cy} r={radius} fill="none" stroke={pal.ringStroke} strokeWidth="1" opacity={isLight ? 0.6 : 0.35} />
898
1843
  ))}
899
1844
 
1845
+ {/* Round 54 / Loop: tier-radius guide rings. The radar rings above
1846
+ are decorative and don't match the actual tier radii nodes sit
1847
+ on (single 220 / dual 175,260 / triple 145,215,285). Drawing
1848
+ a faint dashed ring at each ACTIVE tier radius lets the eye
1849
+ anchor "this is the inner / outer ring" without inferring from
1850
+ node spacing. Picked based on online node count so only the
1851
+ tiers currently in use draw — empty tiers stay quiet. pointer-
1852
+ events:none so they never intercept hub or node clicks. The
1853
+ 0.7 stroke + dashed pattern reads as guide, not feature. */}
1854
+ {(() => {
1855
+ const tierRadii = onlineNodes.length > onlineTripleThreshold
1856
+ ? [onlineTripleInnerR, onlineTripleMidR, onlineTripleOuterR]
1857
+ : onlineNodes.length > onlineTierThreshold
1858
+ ? [onlineInnerRadius, onlineOuterRadius]
1859
+ : onlineNodes.length > 0
1860
+ ? [onlineRadius]
1861
+ : [];
1862
+ // Round 92 / Loop: tier-ring occupancy. R54 drew the guide
1863
+ // rings at fixed opacity regardless of how many nodes lived
1864
+ // on each tier. With pinned filters dimming most nodes to
1865
+ // 0.28, the ring at a deserted tier looked identical to a
1866
+ // crowded one — wasting a free piece of canvas. Count
1867
+ // online nodes whose hub-distance falls within ±15 px of
1868
+ // each ring (15 px = half the inter-tier gap, so each
1869
+ // node is assigned to exactly one ring). Empty tier → skip
1870
+ // entirely. Crowded tier → stronger opacity, says "look
1871
+ // here". Buckets so the ladder feels intentional, not
1872
+ // jittery as one node migrates between tiers.
1873
+ const occupancyOf = (r: number) => onlineNodes.reduce((acc, s) => {
1874
+ const p = nodePositions[s.alias];
1875
+ if (!p) return acc;
1876
+ const d = Math.hypot(p.x - cx, p.y - cy);
1877
+ return Math.abs(d - r) < 15 ? acc + 1 : acc;
1878
+ }, 0);
1879
+ // Round 93 / Loop: when any pin is active, tint the tier
1880
+ // rings to the legend accent so the spatial guide visually
1881
+ // shares the canvas's "filtered mode" colour. The chip
1882
+ // row already says WHICH filter is on (pills + letter
1883
+ // mirror); rings answering "we're filtered" reinforces
1884
+ // the state when the eye is on the canvas, not the chip
1885
+ // row. Composes cleanly with R92 occupancy — same opacity
1886
+ // bucket logic; just the stroke colour swaps.
1887
+ const anyPin = !!(pinnedStatus || pinnedGroup || pinnedVendor);
1888
+ const tierStroke = anyPin ? pal.legendAccent : pal.ringStroke;
1889
+ return tierRadii.map(r => {
1890
+ const n = occupancyOf(r);
1891
+ if (n === 0) return null;
1892
+ const bucket = n <= 2 ? 0 : n <= 6 ? 1 : 2;
1893
+ const opLight = [0.24, 0.36, 0.50][bucket];
1894
+ const opDark = [0.32, 0.46, 0.62][bucket];
1895
+ return (
1896
+ <circle
1897
+ key={`tier-${r}`}
1898
+ cx={cx} cy={cy} r={r}
1899
+ fill="none"
1900
+ stroke={tierStroke}
1901
+ strokeWidth="0.7"
1902
+ strokeDasharray="2 8"
1903
+ opacity={isLight ? opLight : opDark}
1904
+ style={{ pointerEvents: 'none', transition: 'stroke 200ms ease-out' }}
1905
+ data-tier-ring={r}
1906
+ data-tier-occupancy={n}
1907
+ data-tier-bucket={bucket}
1908
+ data-tier-tinted={anyPin ? 'true' : 'false'}
1909
+ />
1910
+ );
1911
+ });
1912
+ })()}
1913
+
900
1914
  {/* Round 50: 4 small particles slowly orbiting the outer ring
901
1915
  (r=330). Each starts at a different angle (offset 0/0.25/0.5/0.75
902
1916
  of the cycle) so they're evenly spaced. 16s per revolution is
@@ -966,32 +1980,177 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
966
1980
  only — groupBoxes is empty in ring mode. Rendered behind the
967
1981
  flow links + nodes; pointer-events off so they never intercept
968
1982
  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"
1983
+ {groupBoxes.map(box => {
1984
+ const isHovered = activeGroup === box.key;
1985
+ // R68: distinguish "locked by click" from "currently hovered".
1986
+ // R63 made pinned and hovered identical (both hit isHovered
1987
+ // via activeGroup). A user with one team pinned should see at
1988
+ // a glance which is the locked one even while their cursor
1989
+ // sweeps elsewhere. isPinned reads pinnedGroup directly
1990
+ // (NOT activeGroup) so the visual is specific to the sticky
1991
+ // state — transient hover keeps the R63 isHovered styling.
1992
+ const isPinned = pinnedGroup === box.key;
1993
+ // Round 18 / Loop: group-box hover linkage. The Round 8 fade
1994
+ // already dropped OUT-of-focus groups to 0.28, but the IN-focus
1995
+ // group sat at its baseline appearance — no positive emphasis.
1996
+ // Hovering now upgrades the box to an "accent" treatment:
1997
+ // solid stroke (not dashed), thicker, accent-coloured; brighter
1998
+ // text and slightly stronger fill. Label and box read as one
1999
+ // selected unit. Geometry unchanged → overlap test untouched.
2000
+ return (
2001
+ <g
2002
+ key={`grp-${box.key}`}
2003
+ data-group={box.key}
2004
+ className="transition-opacity"
2005
+ // R63: drop the blanket pointerEvents:'none' that
2006
+ // previously sat here. Chrome's SVG impl doesn't let a
2007
+ // child override a parent's `none` even though the spec
2008
+ // says it should — moving the property onto just the
2009
+ // rect (where it's needed so nodes underneath stay
2010
+ // clickable) lets the label text receive its own click.
2011
+ style={{ opacity: !activeGroup || isHovered ? 1 : 0.28 }}
990
2012
  >
991
- {box.key}
992
- </text>
993
- </g>
994
- ))}
2013
+ <rect
2014
+ x={box.x}
2015
+ y={box.y}
2016
+ width={box.w}
2017
+ height={box.h}
2018
+ rx="14"
2019
+ fill={isLight ? '#0f172a' : '#a5b4fc'}
2020
+ // R68: 3-tier opacity + stroke ladder.
2021
+ // pinned → fill 0.08 / 0.13, stroke 3 px (locked)
2022
+ // hovered → fill 0.05 / 0.09, stroke 2 px (inspecting)
2023
+ // idle → fill 0.025 / 0.045, stroke 1.5 px dashed
2024
+ fillOpacity={isPinned ? (isLight ? 0.08 : 0.13)
2025
+ : isHovered ? (isLight ? 0.05 : 0.09)
2026
+ : (isLight ? 0.025 : 0.045)}
2027
+ stroke={(isPinned || isHovered) ? pal.legendAccent : pal.ringStroke}
2028
+ strokeWidth={isPinned ? 3 : isHovered ? 2 : 1.5}
2029
+ strokeDasharray={(isPinned || isHovered) ? 'none' : '6 6'}
2030
+ data-group-box-pinned={isPinned ? 'true' : 'false'}
2031
+ // R85: ambient "marching ants" drift on the perimeter
2032
+ // when this group has at least one working member, and
2033
+ // neither pin nor hover is active (those treatments
2034
+ // already shout for attention via solid stroke). 12s
2035
+ // cycle reads as ambient — the eye parses "live work
2036
+ // here" without registering the box as animating.
2037
+ data-group-box-live={!isPinned && !isHovered && box.statuses.working > 0 ? 'true' : 'false'}
2038
+ className={!isPinned && !isHovered && box.statuses.working > 0 ? 'anet-topo-groupbox-live' : undefined}
2039
+ style={{ transition: 'stroke 200ms ease-out, stroke-width 200ms ease-out, fill-opacity 200ms ease-out', pointerEvents: 'none' }}
2040
+ />
2041
+ {/* R63: wrap label in a clickable <g> with an invisible
2042
+ rect hitbox. The text alone wasn't getting hit-tested
2043
+ reliably — the SVG-wide topo-panel <rect> intercepts
2044
+ at the label's screen position when the label sits at
2045
+ a high viewBox-y (it lands below where the compositor
2046
+ expects the text to paint on top, same gotcha as the
2047
+ recent-signal panel rows in R56). Hitbox rect + the
2048
+ parent <g> taking the click + onPointerDown stop-
2049
+ propagation match the R55/R56/R61 pattern. */}
2050
+ <g
2051
+ role="button"
2052
+ tabIndex={0}
2053
+ aria-pressed={pinnedGroup === box.key}
2054
+ data-group-label-hit={box.key}
2055
+ style={{ pointerEvents: 'all', cursor: 'pointer' }}
2056
+ onPointerDown={(e) => e.stopPropagation()}
2057
+ onClick={() => setPinnedGroup(prev => prev === box.key ? null : box.key)}
2058
+ // R86: hover the label → transient group focus. Releases
2059
+ // on leave; activeGroup = hoveredGroup ?? pinnedGroup
2060
+ // formula already handles transient-over-pin so a
2061
+ // user can spot-compare teams without losing their
2062
+ // pinned one. Closes the same R83-style hover/click
2063
+ // gap (segments) — now group labels carry it too.
2064
+ onPointerEnter={() => setHoveredGroupLabel(box.key)}
2065
+ onPointerLeave={() => setHoveredGroupLabel(prev => prev === box.key ? null : prev)}
2066
+ >
2067
+ {/* R99: SVG <title> tooltip listing group members +
2068
+ status breakdown. Same info-density spirit as
2069
+ R97 pill tooltips + R98 node tooltips — anywhere
2070
+ a UI element says "alpha · 3" should hover-
2071
+ explain WHICH 3. Truncates at 8 aliases with a
2072
+ "+N more" suffix so a 20-member band doesn't
2073
+ paint a 22-line tooltip. */}
2074
+ {(() => {
2075
+ const members = Object.entries(groupKeys)
2076
+ .filter(([, key]) => key === box.key)
2077
+ .map(([alias]) => alias);
2078
+ const memberPreview = members.slice(0, 8).join(', ');
2079
+ const suffix = members.length > 8 ? ` + ${members.length - 8} more` : '';
2080
+ const statusSummary = [
2081
+ box.statuses.working > 0 ? `${box.statuses.working} working` : null,
2082
+ box.statuses.idle > 0 ? `${box.statuses.idle} idle` : null,
2083
+ box.statuses.offline > 0 ? `${box.statuses.offline} offline` : null,
2084
+ ].filter(Boolean).join(' · ');
2085
+ return (
2086
+ <title>{[
2087
+ `${box.key} (${members.length} member${members.length === 1 ? '' : 's'})`,
2088
+ statusSummary || null,
2089
+ `${memberPreview}${suffix}`,
2090
+ pinnedGroup === box.key ? 'click to release pin' : 'click to pin this group',
2091
+ ].filter(Boolean).join('\n')}</title>
2092
+ );
2093
+ })()}
2094
+ <rect
2095
+ x={box.x + 6}
2096
+ y={box.y + 2}
2097
+ width={Math.min(box.w - 12, 240)}
2098
+ height={20}
2099
+ rx="4"
2100
+ /* R107 / Loop: list-item tint extends to the SVG
2101
+ group labels — same idiom R104 added to recent-
2102
+ signal rows and R105 to the legend rows. The
2103
+ tint colour is pal.legendAccent (cyan) since
2104
+ groups don't carry an inherent swatch the way
2105
+ legend rows do; this matches R68's group-box
2106
+ isPinned/isHovered accent stroke for consistency.
2107
+ hover < pinned opacity so locked vs preview is
2108
+ discriminable at a glance. */
2109
+ fill={pinnedGroup === box.key || hoveredGroupLabel === box.key ? pal.legendAccent : 'transparent'}
2110
+ opacity={pinnedGroup === box.key ? (isLight ? 0.16 : 0.20)
2111
+ : hoveredGroupLabel === box.key ? (isLight ? 0.09 : 0.13)
2112
+ : 1}
2113
+ data-group-label-tinted={pinnedGroup === box.key ? 'pinned' : hoveredGroupLabel === box.key ? 'hover' : 'none'}
2114
+ style={{ transition: 'fill 150ms ease-out, opacity 150ms ease-out' }}
2115
+ />
2116
+ <text
2117
+ x={box.x + 12}
2118
+ y={box.y + 14}
2119
+ fill={isHovered ? pal.legendHeadline : pal.legendText}
2120
+ fontSize="13"
2121
+ fontFamily="monospace"
2122
+ fontWeight="700"
2123
+ style={{ transition: 'fill 200ms ease-out' }}
2124
+ data-group-label={box.key}
2125
+ >
2126
+ {box.key}
2127
+ {/* Round 19 / Loop: member-count chip. Inline tspan stays
2128
+ in the single <text> bbox the overlap test reads, so
2129
+ the node↔label guard still catches if the chip ever
2130
+ pushes the label far enough right to clip a node.
2131
+ Smaller + lighter weight reads as metadata, not name. */}
2132
+ <tspan dx="6" fill={pal.legendText} fontSize="11" fontWeight="400">· {box.count}</tspan>
2133
+ {/* Round 58 / Loop: status mix pip strip. Compact text-
2134
+ based chips (e.g. "2w 1i") so the strip stays inside
2135
+ the same <text> bbox the overlap-test reads — keeps
2136
+ the R27 label↔label and R19 node↔label guards intact.
2137
+ Each tier is colour-coded against the legend swatches
2138
+ and only renders when count > 0, so a healthy all-
2139
+ working group reads simply " · 2w". */}
2140
+ {box.statuses.working > 0 && (
2141
+ <tspan dx="8" fill={isLight ? '#059669' : '#22c55e'} fontSize="11" fontWeight="600">{box.statuses.working}w</tspan>
2142
+ )}
2143
+ {box.statuses.idle > 0 && (
2144
+ <tspan dx="4" fill={isLight ? '#0d9488' : '#2dd4bf'} fontSize="11" fontWeight="600">{box.statuses.idle}i</tspan>
2145
+ )}
2146
+ {box.statuses.offline > 0 && (
2147
+ <tspan dx="4" fill={isLight ? '#94a3b8' : '#6b7280'} fontSize="11" fontWeight="600">{box.statuses.offline}o</tspan>
2148
+ )}
2149
+ </text>
2150
+ </g>
2151
+ </g>
2152
+ );
2153
+ })}
995
2154
 
996
2155
  {/* directed message flows */}
997
2156
  {flowLinks.map((link, index) => {
@@ -999,21 +2158,120 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
999
2158
  const to = nodePositions[link.to];
1000
2159
  if (!from || !to) return null;
1001
2160
 
1002
- const lift = index % 2 === 0 ? 36 : -36;
2161
+ // Round 7 / Loop: lift now scales with distance so short links
2162
+ // aren't over-bent (long links keep the ~36px hump), and the
2163
+ // particle period shortens with link.count so busier edges
2164
+ // visibly pulse faster — instant info density on top of the
2165
+ // existing stroke-width-by-count chip.
2166
+ const dist = Math.hypot(to.x - from.x, to.y - from.y);
2167
+ const lift = (index % 2 === 0 ? 1 : -1) * Math.min(36, dist * 0.18);
1003
2168
  const path = curvePath(from, to, lift);
1004
2169
  const width = Math.min(2 + link.count, 7);
1005
- const duration = 2.2 + (index % 5) * 0.32;
1006
-
2170
+ const duration = Math.max(0.9, 2.6 / Math.sqrt(link.count));
2171
+ // Round 10 / Loop: freshness fade. An edge that fired ≤30s ago
2172
+ // stays at full intensity; over 5 minutes it decays to ~35%.
2173
+ // Surfaces "what's happening now" vs background chatter without
2174
+ // hiding old flow entirely (some context still useful). `now`
2175
+ // captured at useMemo-recompute time (every 5s message refresh)
2176
+ // — accuracy is within the poll interval, plenty.
2177
+ const ageMs = link.last_at ? Math.max(0, Date.now() - Date.parse(link.last_at)) : 0;
2178
+ const fresh = Math.max(0.35, 1 - ageMs / (5 * 60 * 1000));
2179
+ // Round 16 arrow-tier binning — keep `topo-arrow` as the
2180
+ // medium tier id so the legend swatch picks it up unchanged.
2181
+ const arrowId = link.count <= 2 ? 'topo-arrow-s'
2182
+ : link.count <= 4 ? 'topo-arrow'
2183
+ : 'topo-arrow-l';
2184
+
2185
+ // Round 39 / Loop: edge hover tooltip — surface the same
2186
+ // last_at + count info the freshness fade and arrow tier
2187
+ // already encode visually, in plain text. The stroke is the
2188
+ // hover target; SVG `<title>` honours newlines on every
2189
+ // browser the dashboard targets.
2190
+ const lastAt = relativeAgo(link.last_at);
2191
+ const tooltip = `${link.from} → ${link.to}\n${link.count} message${link.count === 1 ? '' : 's'}${lastAt ? ` · last ${lastAt}` : ''}`;
2192
+ // Round 40 / Loop: edges follow node hover — when an alias is
2193
+ // hovered, every edge touching it brightens, the rest fade.
2194
+ // Pairs with the Round 8 group-focus fade on nodes: hover a
2195
+ // node to find "who is this agent talking to" at a glance.
2196
+ // No hover → multiplier is 1.0 (current behaviour preserved).
2197
+ // Round 50 / Loop: edge-on-self priority. When the user hovers
2198
+ // a flow edge directly (R48 widened the hitbox so this is now
2199
+ // a precise gesture), THAT edge gets the strongest boost (2.0)
2200
+ // and every other edge dims to 0.35. Node-hover (R40) keeps
2201
+ // its own ladder. Edge-hover and node-hover are mutually
2202
+ // exclusive in practice — the cursor is over one or the
2203
+ // other — but the order below makes edge-hover win if both
2204
+ // ever read truthy at the same React tick.
2205
+ // Round 53 / Loop: in-group edges follow team focus. R40
2206
+ // brightened only edges touching the exact hovered alias —
2207
+ // but with R8/R18 prefix-clustering, a user hovering one
2208
+ // member is asking about the team. So when BOTH endpoints of
2209
+ // an edge share the hoveredGroup (and neither is the exact
2210
+ // hovered alias — that gets the stronger 1.7×), the edge
2211
+ // boosts to 1.3×. Edges leaving the team (one endpoint in,
2212
+ // one out) still dim to 0.35× per R40 since they read as
2213
+ // background to the focus. Singletons fall through unchanged
2214
+ // (their group key is the alias itself, so bothInHoveredGroup
2215
+ // is impossible for a non-self-edge).
2216
+ const isHoveredEdge = hoveredEdgeKey === link.key;
2217
+ const fromGroup = groupKeys[link.from] ?? link.from;
2218
+ const toGroup = groupKeys[link.to] ?? link.to;
2219
+ const bothInHoveredGroup = !!activeGroup && fromGroup === activeGroup && toGroup === activeGroup;
2220
+ // R63: also gate "no filter" on activeGroup so pinnedGroup
2221
+ // alone activates the in-group 1.3× boost + non-group dim.
2222
+ // When neither a node nor a group is in focus, mul is 1.
2223
+ // R77: when the user hovers the "N active links" chip, the
2224
+ // baseline 1× becomes 1.5× — every flow brightens at once.
2225
+ // Sits inside the no-other-hover branch so it doesn't fight
2226
+ // the edge-hover (2.0×) or node-hover (1.7×) priorities.
2227
+ const edgeOpacityMul = isHoveredEdge
2228
+ ? 2.0
2229
+ : hoveredEdgeKey
2230
+ ? 0.35
2231
+ : !hoveredAlias && !activeGroup
2232
+ ? (hoveredActiveLinks ? 1.5 : 1)
2233
+ : (link.from === hoveredAlias || link.to === hoveredAlias)
2234
+ ? 1.7
2235
+ : bothInHoveredGroup
2236
+ ? 1.3
2237
+ : 0.35;
2238
+ // Round 50: the hovered edge also visibly thickens so the eye
2239
+ // tracks it even at low message counts (width was 3 → 4.5 on
2240
+ // hover). 1.4× is enough to read as "lifted" without
2241
+ // breaching the 16-px hitbox bound.
2242
+ const renderWidth = isHoveredEdge ? Math.min(width * 1.4, 10) : width;
1007
2243
  return (
1008
2244
  <g key={link.key}>
2245
+ {/* Round 48 / Loop: invisible hover hitbox — visible flow
2246
+ path is 3-7 px wide and damn hard to hover precisely.
2247
+ Stack a transparent 16-px-wide stroke behind it so the
2248
+ cursor only needs to be ~8 px from the line for the
2249
+ tooltip to fire. Native <title> moves here; the
2250
+ visible path no longer needs it. pointer-events on
2251
+ the visible path drop to "none" since the hitbox
2252
+ owns the hover surface. */}
2253
+ <path
2254
+ d={path}
2255
+ fill="none"
2256
+ stroke="transparent"
2257
+ strokeWidth={Math.max(width + 10, 16)}
2258
+ style={{ pointerEvents: 'stroke' }}
2259
+ data-edge-hitbox
2260
+ onMouseEnter={() => setHoveredEdgeKey(link.key)}
2261
+ onMouseLeave={() => setHoveredEdgeKey(prev => prev === link.key ? null : prev)}
2262
+ >
2263
+ <title>{tooltip}</title>
2264
+ </path>
1009
2265
  <path
1010
2266
  d={path}
1011
2267
  fill="none"
1012
2268
  stroke={pal.flowEdge}
1013
- strokeWidth={width}
1014
- opacity={isLight ? 0.22 : 0.28}
2269
+ strokeWidth={renderWidth}
2270
+ opacity={Math.min(1, (isLight ? 0.22 : 0.28) * fresh * edgeOpacityMul)}
1015
2271
  filter={isLight ? undefined : 'url(#topo-glow)'}
1016
- markerEnd="url(#topo-arrow)"
2272
+ markerEnd={`url(#${arrowId})`}
2273
+ className="transition-opacity duration-300"
2274
+ style={{ pointerEvents: 'none' }}
1017
2275
  />
1018
2276
  <path
1019
2277
  id={`flow-path-${index}`}
@@ -1022,45 +2280,223 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1022
2280
  stroke={pal.flowPath}
1023
2281
  strokeWidth="1"
1024
2282
  strokeDasharray="2 12"
1025
- opacity={isLight ? 0.4 : 0.75}
2283
+ opacity={Math.min(1, (isLight ? 0.4 : 0.75) * fresh * edgeOpacityMul)}
2284
+ className="transition-opacity duration-300"
1026
2285
  />
1027
- <circle r="4" fill={pal.flowParticle} filter={isLight ? undefined : 'url(#topo-glow)'}>
1028
- <animateMotion dur={`${duration}s`} repeatCount="indefinite" path={path} />
1029
- </circle>
2286
+ {!reducedMotion && (
2287
+ /* Round 103 / Loop: phase-stagger the particles so
2288
+ concurrent edges don't pulse in lockstep. SMIL
2289
+ `begin` accepts negative offsets to shift the cycle
2290
+ backwards in time, which means the particle starts
2291
+ mid-flight on first paint — no visible "all
2292
+ particles spawn from source simultaneously" tell.
2293
+ `(index * 0.37) % duration` gives a deterministic,
2294
+ well-distributed offset (the golden-ratio-ish 0.37
2295
+ fraction prevents lining up when N is a small
2296
+ multiple). Edge order is stable (sorted by recent
2297
+ activity), so the offsets feel calm rather than
2298
+ reshuffling each refresh. */
2299
+ <circle r="4" fill={pal.flowParticle} filter={isLight ? undefined : 'url(#topo-glow)'} opacity={Math.min(1, fresh * edgeOpacityMul)}>
2300
+ <animateMotion
2301
+ dur={`${duration}s`}
2302
+ begin={`-${((index * 0.37) % duration).toFixed(3)}s`}
2303
+ repeatCount="indefinite"
2304
+ path={path}
2305
+ />
2306
+ </circle>
2307
+ )}
2308
+ {/* Round 75 / Loop: arrival ping at the destination. The
2309
+ particle currently fades into the arrow marker
2310
+ silently — adding a small radiating ring synchronised
2311
+ to the particle's period turns message delivery into
2312
+ a visible event. begin = -dur*0.92 offsets the
2313
+ animation so the ring expands NEAR the end of each
2314
+ cycle (≈when the particle arrives). Gated by
2315
+ reducedMotion and on fresh > 0.5 — stale edges that
2316
+ haven't fired in minutes don't need the eye-grab.
2317
+ data-arrival-ping for testability. */}
2318
+ {!reducedMotion && fresh > 0.5 && (
2319
+ <circle
2320
+ cx={to.x}
2321
+ cy={to.y}
2322
+ r="0"
2323
+ fill="none"
2324
+ stroke={pal.flowEdge}
2325
+ strokeWidth="1.5"
2326
+ opacity="0"
2327
+ style={{ pointerEvents: 'none' }}
2328
+ data-arrival-ping={link.key}
2329
+ >
2330
+ <animate attributeName="r" values="0;14;22" dur={`${duration}s`} begin={`-${(duration * 0.92).toFixed(2)}s`} repeatCount="indefinite" />
2331
+ <animate attributeName="opacity" values="0;0.55;0" dur={`${duration}s`} begin={`-${(duration * 0.92).toFixed(2)}s`} repeatCount="indefinite" />
2332
+ </circle>
2333
+ )}
2334
+ {/* Round 76 / Loop: source dispatch pulse — mirror to the
2335
+ R75 arrival ping. begin = 0s (start of cycle) so the
2336
+ ring expands as the particle LEAVES the source. Only
2337
+ fires for high-traffic edges (link.count >= 3) — on
2338
+ quiet conversations the canvas should stay calm; on
2339
+ busy senders the pulse plus arrival ping bookend
2340
+ every message in flight, making the topology feel
2341
+ alive. Same fresh/reducedMotion gates as R75. Slightly
2342
+ smaller radius (0→12→18 vs R75's 0→14→22) so the
2343
+ source reads as "smaller event than arrival" — the
2344
+ destination is the meaningful endpoint. */}
2345
+ {!reducedMotion && fresh > 0.5 && link.count >= 3 && (
2346
+ <circle
2347
+ cx={from.x}
2348
+ cy={from.y}
2349
+ r="0"
2350
+ fill="none"
2351
+ stroke={pal.flowEdge}
2352
+ strokeWidth="1.5"
2353
+ opacity="0"
2354
+ style={{ pointerEvents: 'none' }}
2355
+ data-dispatch-pulse={link.key}
2356
+ >
2357
+ <animate attributeName="r" values="0;12;18" dur={`${duration}s`} begin="0s" repeatCount="indefinite" />
2358
+ <animate attributeName="opacity" values="0;0.45;0" dur={`${duration}s`} begin="0s" repeatCount="indefinite" />
2359
+ </circle>
2360
+ )}
2361
+ {/* Round 100 / Loop: midpoint count badge for high-
2362
+ traffic edges. Width already gauges intensity but
2363
+ "5 vs 12" is hard to read off stroke alone. Render
2364
+ a compact pill at the bezier midpoint (t=0.5 →
2365
+ midpoint + perpendicular × lift/2) showing the
2366
+ integer count. Threshold link.count >= 3 keeps
2367
+ the canvas quiet for sparse traffic. Bezier
2368
+ midpoint math: for a quadratic curve M A Q C B,
2369
+ the t=0.5 point is (A + 2C + B) / 4, which
2370
+ simplifies to (midAB) + 0.5 × (control - midAB)
2371
+ = midAB + perpendicular × lift/2. */}
2372
+ {link.count >= 3 && (() => {
2373
+ const midX = (from.x + to.x) / 2;
2374
+ const midY = (from.y + to.y) / 2;
2375
+ const dx = to.x - from.x;
2376
+ const dy = to.y - from.y;
2377
+ const len = Math.hypot(dx, dy) || 1;
2378
+ const badgeX = midX + (-dy / len) * lift * 0.5;
2379
+ const badgeY = midY + ( dx / len) * lift * 0.5;
2380
+ const badgeOpacity = Math.min(1, fresh * edgeOpacityMul);
2381
+ return (
2382
+ <g
2383
+ data-edge-count-badge={link.key}
2384
+ style={{ pointerEvents: 'none' }}
2385
+ opacity={badgeOpacity}
2386
+ >
2387
+ <circle
2388
+ cx={badgeX} cy={badgeY} r="9"
2389
+ fill={pal.legendBox.fill}
2390
+ stroke={pal.flowEdge}
2391
+ strokeWidth="1"
2392
+ opacity={isLight ? 0.95 : 0.82}
2393
+ />
2394
+ <text
2395
+ x={badgeX} y={badgeY + 3}
2396
+ textAnchor="middle"
2397
+ fill={pal.legendHeadline}
2398
+ fontSize="10"
2399
+ fontFamily="monospace"
2400
+ fontWeight="700"
2401
+ >{link.count}</text>
2402
+ </g>
2403
+ );
2404
+ })()}
1030
2405
  </g>
1031
2406
  );
1032
2407
  })}
1033
2408
 
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>
2409
+ {/* center hub — round 39 sized + round 13 restraint.
2410
+ The hub is the control-plane anchor. r39 gave it two outward
2411
+ pulses (r 10→38, 2.4s, double-phase) which read as "loudest
2412
+ node in the room" — wrong semantics: anchors don't emit,
2413
+ they hold. r13 swaps the kinetic pulse for a slow opacity
2414
+ breath on the static halo (4s, ±15% from base), so the hub
2415
+ stays alive without throwing kinetic energy outward. The
2416
+ dual-circle "lit lamp" core is unchanged. */}
2417
+ {layout === 'ring' && (<g
2418
+ data-topo-hub
2419
+ style={{ cursor: 'pointer' }}
2420
+ // Stop pointerdown from reaching the SVG pan handler — same
2421
+ // reason as the node <g>: a captured pointer makes Chromium
2422
+ // fire the follow-up click on the SVG, not this group.
2423
+ onPointerDown={(e) => e.stopPropagation()}
2424
+ // Round 52 / Loop: hub is the visual anchor but had no click
2425
+ // action — users discovered fit-to-content only via the `f`
2426
+ // key or the chrome button. Wire the hub to fitView() so the
2427
+ // most prominent element in the canvas is also the "re-
2428
+ // center" affordance. A click-ripple keyed by ts confirms
2429
+ // the gesture; the hub <title> now ends with a hint.
2430
+ onClick={() => {
2431
+ fitView();
2432
+ setClickRipple({ ts: Date.now(), x: cx, y: cy, r0: 18, color: isLight ? '#059669' : '#10b981' });
2433
+ setTimeout(() => setClickRipple(prev => prev && prev.x === cx && prev.y === cy ? null : prev), 600);
2434
+ }}
2435
+ >
2436
+ {/* Round 43 / Loop: hub `<title>` summary — hovering the
2437
+ central glow now answers "what is this?" with a one-line
2438
+ fleet snapshot. Duplicates the header chips by design;
2439
+ hovering the most visually prominent element is the
2440
+ most natural impulse, so satisfy it where the cursor
2441
+ already is. Falls clean: omits sub-clauses when their
2442
+ counts are zero. R52 appends a "click to fit view" hint.
2443
+ */}
2444
+ <title>{(() => {
2445
+ const total = sessions.length;
2446
+ const parts = [`Network hub`, `${total} session${total === 1 ? '' : 's'}`];
2447
+ if (onlineNodes.length > 0) parts.push(`${onlineNodes.length} online`);
2448
+ if (workingCount > 0) parts.push(`${workingCount} working`);
2449
+ if (flowLinks.length > 0) parts.push(`${flowLinks.length} active link${flowLinks.length === 1 ? '' : 's'}`);
2450
+ return parts.join(' · ') + '\nclick to fit view';
2451
+ })()}</title>
2452
+ {/* grounding halo — breathes in opacity, no expansion.
2453
+ R84: breath amplitude + tempo reflect workingCount. An
2454
+ idle fleet keeps the original gentle 0.32→0.52 (light) /
2455
+ 0.08→0.16 (dark) cycle over 4s — "heart at rest". As
2456
+ working sessions accumulate, the peak climbs and the
2457
+ period shortens, capped at 2.4s so it never feels
2458
+ manic. Quiet fleets see zero change; busy fleets feel
2459
+ the canvas working. */}
2460
+ {(() => {
2461
+ // Bucket workingCount to keep the visual feedback discrete
2462
+ // rather than continuous: 0 / 1-2 / 3-5 / 6+. Three buckets
2463
+ // are enough — finer gradations are imperceptible.
2464
+ const busy = workingCount === 0 ? 0
2465
+ : workingCount <= 2 ? 1
2466
+ : workingCount <= 5 ? 2
2467
+ : 3;
2468
+ const peakLight = [0.52, 0.58, 0.65, 0.72][busy];
2469
+ const peakDark = [0.16, 0.20, 0.26, 0.32][busy];
2470
+ const troughLight = 0.32;
2471
+ const troughDark = 0.08;
2472
+ const dur = [4.0, 3.2, 2.7, 2.4][busy];
2473
+ const valuesLight = `${troughLight};${peakLight};${troughLight}`;
2474
+ const valuesDark = `${troughDark};${peakDark};${troughDark}`;
2475
+ return (
2476
+ <circle
2477
+ cx={cx} cy={cy} r="18"
2478
+ fill={isLight ? '#d1fae5' : '#10b981'}
2479
+ opacity={isLight ? 0.42 : 0.12}
2480
+ data-hub-busyness={busy}
2481
+ >
2482
+ {!reducedMotion && (
2483
+ <animate
2484
+ attributeName="opacity"
2485
+ values={isLight ? valuesLight : valuesDark}
2486
+ dur={`${dur}s`}
2487
+ repeatCount="indefinite"
2488
+ />
2489
+ )}
2490
+ </circle>
2491
+ );
2492
+ })()}
1057
2493
  {/* core — 20px diameter, larger inner highlight reads as a "lit lamp" */}
1058
2494
  <circle cx={cx} cy={cy} r="10" fill={isLight ? '#059669' : '#10b981'} />
1059
2495
  <circle cx={cx} cy={cy} r="5" fill="#d1fae5" opacity="0.9" />
1060
2496
  </g>)}
1061
2497
 
1062
2498
  {/* agent nodes */}
1063
- {[...onlineNodes, ...offlineNodes].map(session => {
2499
+ {[...onlineNodes, ...offlineNodes].map((session, nodeIdx) => {
1064
2500
  const pos = nodePositions[session.alias];
1065
2501
  if (!pos) return null;
1066
2502
 
@@ -1080,11 +2516,30 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1080
2516
  // occlude an avatar), and the full card appears only for the
1081
2517
  // hovered node or once zoomed in past 1.4×.
1082
2518
  const showFullLabel = !denseLayout || hoveredAlias === session.alias || view.zoom >= 1.4;
2519
+ // Round 8: when a node in another group is hovered, fade this
2520
+ // one. Same-group nodes (incl. singletons matching the hovered
2521
+ // alias) stay full. Pure visual focus, geometry unchanged.
2522
+ const inFocus = !activeGroup || (groupKeys[session.alias] ?? session.alias) === activeGroup;
2523
+ // R72: in ring layout, classify the node into a tier by its
2524
+ // distance from hub centre so the first-paint stagger can
2525
+ // emanate inner → outer instead of running clockwise. Grid
2526
+ // layout doesn't have a radial structure; it keeps R9's pure
2527
+ // nodeIdx stagger. Thresholds bracket the actual tier radii
2528
+ // (single 220, dual 175/260, triple 145/215/285, offline 325+).
2529
+ let tierIdx = 0;
2530
+ if (layout === 'ring') {
2531
+ const p = nodePositions[session.alias];
2532
+ if (p) {
2533
+ const d = Math.hypot(p.x - cx, p.y - cy);
2534
+ tierIdx = d < 195 ? 0 : d < 270 ? 1 : d < 310 ? 2 : 3;
2535
+ }
2536
+ }
1083
2537
 
1084
2538
  return (
1085
2539
  <g
1086
2540
  key={session.alias}
1087
2541
  data-node={session.alias}
2542
+ data-tier-idx={layout === 'ring' ? tierIdx : -1}
1088
2543
  // Round 3 / Loop: `anet-fade-in` runs once when the <g>
1089
2544
  // mounts — a new session entering the fleet (or the topology
1090
2545
  // first rendering) eases in instead of popping. Re-renders of
@@ -1092,7 +2547,87 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1092
2547
  // via the alias key), so status changes don't flicker. The
1093
2548
  // global prefers-reduced-motion sweep already neutralises it.
1094
2549
  className="group transition-opacity anet-fade-in"
1095
- style={{ cursor: 'pointer' }}
2550
+ style={{
2551
+ cursor: 'pointer',
2552
+ // Round 17 / Loop: offline nodes drop to 0.6 at rest so
2553
+ // online nodes pop without losing the offline-as-ghost
2554
+ // information. The dashed stroke + smaller radius already
2555
+ // say "offline"; dimming the whole group strengthens the
2556
+ // online-vs-offline hierarchy at first glance. Exempt the
2557
+ // chat-focused node — if the user explicitly opened a
2558
+ // popover targeting an offline alias, that node stays
2559
+ // full-brightness so the focus ring + popover read as one
2560
+ // selected thing rather than a dimmed selection. Group-
2561
+ // hover fade (Round 8) still wins when inFocus is false.
2562
+ // Round 49 / Loop: edge-hover endpoint highlight composes
2563
+ // OVER the inFocus/online formula — a non-endpoint node
2564
+ // dims to 0.28 (just below the inFocus 0.32 to read as a
2565
+ // stronger "not relevant" signal), endpoints keep their
2566
+ // base opacity. chatAlias still wins to keep the focus
2567
+ // ring legible if the user clicked through.
2568
+ // Round 55 / Loop: legend-status hover composes on the
2569
+ // SAME level as edge-hover-endpoint. Non-matching nodes
2570
+ // dim to 0.28; matching nodes stay at their base.
2571
+ // activeStatus matches: working = status==='working',
2572
+ // idle = online but not working, offline = !isOnline.
2573
+ // Round 60 / Loop: activeStatus = hoveredStatus ?? pinnedStatus
2574
+ // so the pressure-bar segment pins (R60) and the legend
2575
+ // row hover (R55) feed the same branch.
2576
+ // Round 80 / Loop: vendor-letter hover composes ABOVE the
2577
+ // activeStatus branch so hovering the vendor chip's `C`
2578
+ // dims everything except C-vendor nodes. Same dim value
2579
+ // (0.28) as edge-endpoint and status filters — visually
2580
+ // consistent. Vendor lookup uses the same vendorForModel
2581
+ // helper the avatar render uses, keyed by initial so the
2582
+ // chip and the avatar always agree on grouping.
2583
+ opacity: hoveredEdgeEndpoints && !hoveredEdgeEndpoints.has(session.alias) && chatAlias !== session.alias
2584
+ ? 0.28
2585
+ : activeVendor && chatAlias !== session.alias && (() => {
2586
+ const v = vendorForModel(session.model);
2587
+ const initial = v.id === 'unknown' ? '?' : v.initial;
2588
+ return initial !== activeVendor;
2589
+ })()
2590
+ ? 0.28
2591
+ : activeStatus && chatAlias !== session.alias && !(
2592
+ activeStatus === 'working' ? session.status === 'working'
2593
+ : activeStatus === 'idle' ? (isOnline && session.status !== 'working')
2594
+ : /* offline */ !isOnline
2595
+ )
2596
+ ? 0.28
2597
+ : !inFocus
2598
+ ? 0.32
2599
+ : chatAlias === session.alias
2600
+ ? 1
2601
+ : isOnline ? 1 : 0.6,
2602
+ // Round 9 / Loop: stagger the anet-fade-in so the topology
2603
+ // reveals as a wave on first paint instead of one big pop.
2604
+ // Cap at 24 indices (≈600ms tail) so 50-node fleets still
2605
+ // finish revealing within a beat. CSS animation-delay only
2606
+ // applies during the keyframe — re-renders without a new
2607
+ // mount (same alias key) don't replay, so status changes
2608
+ // never trigger the stagger again.
2609
+ // Round 72 / Loop: in ring layout, stagger by tier radius
2610
+ // so the topology emanates from the hub outward — inner
2611
+ // tier at 0ms, middle at ~180ms, outer at ~360ms, offline
2612
+ // at ~540ms. A small within-tier offset (nodeIdx % 6 * 25)
2613
+ // adds variety so each ring rotates in instead of all-at-
2614
+ // once popping. Grid keeps R9's pure nodeIdx stagger.
2615
+ animationDelay: layout === 'ring'
2616
+ ? `${tierIdx * 180 + (nodeIdx % 6) * 25}ms`
2617
+ : `${Math.min(nodeIdx, 24) * 25}ms`,
2618
+ // Round 51 / Loop: hover micro-lift. The label already
2619
+ // lifts on group-hover (R26). The node body — circle,
2620
+ // avatar, status ring — stays planted, so the gesture
2621
+ // reads "label moves, body doesn't". Now the whole <g>
2622
+ // translates -2px when hovered: avatar + ring + label
2623
+ // move as one unit. 2 px is well inside the inter-row
2624
+ // gap (cellH headroom ≥22), and CSS transform on SVG
2625
+ // <g> never affects the overlap-test geometry (the
2626
+ // test never simulates hover). useReducedMotion drops
2627
+ // the lift to 0 for prefers-reduced-motion users.
2628
+ transform: !reducedMotion && hoveredAlias === session.alias ? 'translateY(-2px)' : undefined,
2629
+ transition: 'transform 180ms cubic-bezier(0.4,0,0.2,1)',
2630
+ }}
1096
2631
  // Stop the pointerdown from reaching the SVG pan handler: the
1097
2632
  // SVG calls setPointerCapture, and a captured pointer makes
1098
2633
  // Chromium fire the follow-up `click` on the SVG instead of
@@ -1100,14 +2635,71 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1100
2635
  // Side effect (intended): you pan from empty canvas, not by
1101
2636
  // grabbing a node.
1102
2637
  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)}
2638
+ // Track hover globally (not just under denseLayout) so the
2639
+ // Round 8 group-focus fade works at any fleet size.
2640
+ onPointerEnter={() => setHoveredAlias(session.alias)}
2641
+ onPointerLeave={() => setHoveredAlias(prev => (prev === session.alias ? null : prev))}
2642
+ onClick={() => {
2643
+ setChatAlias(session.alias);
2644
+ // Round 14 ripple — capture position, radius and status
2645
+ // colour at click time so the one-shot circle is self-
2646
+ // contained (no re-render-time recomputation needed).
2647
+ setClickRipple({
2648
+ ts: Date.now(),
2649
+ x: pos.x, y: pos.y, r0: radius,
2650
+ color: status.primary,
2651
+ });
2652
+ setTimeout(() => setClickRipple(prev =>
2653
+ prev && Date.now() - prev.ts >= 590 ? null : prev), 600);
2654
+ }}
1106
2655
  >
1107
2656
  {/* Issue #96: native hover tooltip — "Vendor · model · Runtime".
1108
2657
  Falls back to just the alias when the node reports no
1109
- model/runtime. */}
1110
- <title>{identityLine(session.model, session.runtime) || session.alias}</title>
2658
+ model/runtime.
2659
+ Round 33 / Loop: cwd line answers "what is this agent on?".
2660
+ Round 34 / Loop: for offline nodes, append "last seen: 6m ago"
2661
+ so the operator knows whether to wait or chase. Online nodes
2662
+ skip the line (Round 27's 1 h ghost age-out means anything
2663
+ still online has heartbeated recently — the line would just
2664
+ be noise). Accepts both ISO ("…T06:00:28Z") and SQL-style
2665
+ ("… 06:00:28" assumed UTC) formats. */}
2666
+ {(() => {
2667
+ // Round 35 / Loop: TZ-safe parsing via the shared lib helper
2668
+ // — same parseHubTime is used by isGhost above (Round 38
2669
+ // factored it to app/lib/time.ts so both paths interpret SQL
2670
+ // bare timestamps as UTC on every browser).
2671
+ const lastSeen = !isOnline && session.last_seen_at ? relativeAgo(session.last_seen_at) : null;
2672
+ // Round 98 / Loop: enrich the node tooltip with status,
2673
+ // group membership, and inbound/outbound flow counts —
2674
+ // same info-density spirit as R97 active-filter pill
2675
+ // tooltips. Hovering any node now answers "what is this
2676
+ // and how does it sit in the topology" without forcing
2677
+ // a click into the chat popover. Group line only shows
2678
+ // when the alias is part of a multi-member band (R106
2679
+ // prefix grouping); singletons skip it. Flow line only
2680
+ // when at least one direction has count > 0.
2681
+ const groupKey = groupKeys[session.alias];
2682
+ const groupMembers = groupKey
2683
+ ? Object.values(groupKeys).filter(k => k === groupKey).length
2684
+ : 1;
2685
+ const groupLine = groupMembers > 1 ? `group: ${groupKey} · ${groupMembers}` : null;
2686
+ let flowIn = 0, flowOut = 0;
2687
+ for (const fl of flowLinks) {
2688
+ if (fl.from === session.alias) flowOut += fl.count;
2689
+ if (fl.to === session.alias) flowIn += fl.count;
2690
+ }
2691
+ const flowLine = (flowIn + flowOut) > 0 ? `flows: ${flowIn} in / ${flowOut} out` : null;
2692
+ return (
2693
+ <title>{[
2694
+ `${session.alias} · ${session.status}`,
2695
+ identityLine(session.model, session.runtime),
2696
+ groupLine,
2697
+ session.project_dir ? `cwd: ${session.project_dir}` : null,
2698
+ lastSeen ? `last seen: ${lastSeen}` : null,
2699
+ flowLine,
2700
+ ].filter(Boolean).join('\n')}</title>
2701
+ );
2702
+ })()}
1111
2703
  {/* Round 2 / Loop: hover ring — a thin outer stroke that fades
1112
2704
  in when the cursor enters the node, signalling clickability
1113
2705
  (real-user feedback for the chat-popover open). Pure CSS via
@@ -1127,7 +2719,29 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1127
2719
  className="opacity-0 group-hover:opacity-70 transition-opacity duration-150"
1128
2720
  style={{ pointerEvents: 'none' }}
1129
2721
  />
1130
- {isActive && (
2722
+ {/* Round 11 / Loop: chat-focus ring — when the ChatPopover is
2723
+ open targeting this node, anchor a persistent ring around
2724
+ it so the floating popover visibly links back to its source
2725
+ node. Static (not pulsing) so it reads as "selected state"
2726
+ rather than "this node is active". strokeWidth=2.5 stays
2727
+ clear of the overlap-test selectors (1.5 / 3). Sits just
2728
+ outside the halo radius+8 so it never overlaps a neighbour
2729
+ (halos already pack flush in dense grids). */}
2730
+ {chatAlias === session.alias && (
2731
+ <circle
2732
+ cx={pos.x}
2733
+ cy={pos.y}
2734
+ r={radius + 14}
2735
+ fill="none"
2736
+ stroke={status.primary}
2737
+ strokeWidth="2.5"
2738
+ opacity={isLight ? 0.85 : 0.95}
2739
+ filter={!isLight ? 'url(#topo-glow)' : undefined}
2740
+ className="transition-opacity duration-200"
2741
+ style={{ pointerEvents: 'none' }}
2742
+ />
2743
+ )}
2744
+ {isActive && !reducedMotion && (
1131
2745
  <circle cx={pos.x} cy={pos.y} r={radius + 14} fill={status.primary} opacity={isLight ? 0.08 : 0.12}>
1132
2746
  <animate attributeName="r" values={`${radius + 8};${radius + 22};${radius + 8}`} dur="2.4s" repeatCount="indefinite" />
1133
2747
  <animate attributeName="opacity" values={isLight ? '0.12;0.02;0.12' : '0.18;0.04;0.18'} dur="2.4s" repeatCount="indefinite" />
@@ -1135,7 +2749,14 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1135
2749
  )}
1136
2750
  {/* Round 4 / Loop: transition-[fill,stroke,opacity] smooths
1137
2751
  status colour changes so idle↔working↔offline doesn't snap
1138
- — task replies / node-rename / SSE updates ease in. */}
2752
+ — task replies / node-rename / SSE updates ease in.
2753
+ Round 112 / Loop: working nodes get a subtle halo breath
2754
+ (±0.12 opacity at 3s cycle) so the eye can find "what's
2755
+ busy" at a glance without scanning chips. Idle + offline
2756
+ halos stay flat — they don't need to demand attention.
2757
+ R84 hub-center breath stays the loudest "fleet busyness"
2758
+ signal; this one is quieter, per-node. SMIL `<animate>`
2759
+ inside the circle, gated by reducedMotion. */}
1139
2760
  <circle
1140
2761
  cx={pos.x}
1141
2762
  cy={pos.y}
@@ -1143,7 +2764,39 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1143
2764
  fill={status.halo}
1144
2765
  opacity={isOnline ? (isLight ? 0.85 : 0.65) : (isLight ? 0.4 : 0.25)}
1145
2766
  className="transition-[fill,opacity] duration-300 ease-out"
1146
- />
2767
+ data-node-halo-breath={!reducedMotion && session.status === 'working' ? 'on' : 'off'}
2768
+ >
2769
+ {!reducedMotion && session.status === 'working' && (
2770
+ <animate
2771
+ attributeName="opacity"
2772
+ values={isLight ? '0.73;0.92;0.73' : '0.53;0.78;0.53'}
2773
+ dur="3s"
2774
+ repeatCount="indefinite"
2775
+ />
2776
+ )}
2777
+ </circle>
2778
+ {/* Round 111 / Loop: edge-endpoint emphasis ring. R49
2779
+ already keeps endpoint nodes at opacity 1 while
2780
+ others dim when an edge is hovered, but the
2781
+ endpoints had no POSITIVE indicator — they just
2782
+ "stayed bright". An accent stroke at r=radius+7
2783
+ (just inside the halo's r=radius+8 bbox so we
2784
+ don't grow the overlap footprint) clearly says
2785
+ "these are the two participants in this flow".
2786
+ pointerEvents:none so the node hitbox stays alive. */}
2787
+ {hoveredEdgeEndpoints && hoveredEdgeEndpoints.has(session.alias) && (
2788
+ <circle
2789
+ cx={pos.x}
2790
+ cy={pos.y}
2791
+ r={radius + 7}
2792
+ fill="none"
2793
+ stroke={pal.flowEdge}
2794
+ strokeWidth={1.5}
2795
+ opacity={isLight ? 0.9 : 0.85}
2796
+ data-edge-endpoint-ring
2797
+ style={{ pointerEvents: 'none', transition: 'opacity 180ms ease-out' }}
2798
+ />
2799
+ )}
1147
2800
  <circle
1148
2801
  cx={pos.x}
1149
2802
  cy={pos.y}
@@ -1240,52 +2893,115 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1240
2893
  </g>
1241
2894
  );
1242
2895
  })()}
1243
- {session.status === 'working' && (
1244
- // working pulse — small dot just inside the status ring,
1245
- // above the avatar text. Was a 18px horizontal bar at
1246
- // y+11 which now collides with the avatar; the dot reads
1247
- // as the same "active" cue without occluding the initial.
1248
- <circle cx={pos.x} cy={pos.y - (radius - 6)} r="2.5" fill={pal.flowParticle}>
1249
- <animate attributeName="opacity" values="1;0.25;1" dur="1.1s" repeatCount="indefinite" />
1250
- </circle>
1251
- )}
2896
+ {session.status === 'working' && (() => {
2897
+ // Round 24 / Loop: pulse rate ↔ traffic. The dot's dur
2898
+ // was a flat 1.1s — every working node looked equally
2899
+ // busy. Mapping it to sse:N lets the eye land on what's
2900
+ // actually hot. 3 discrete tiers read cleaner than
2901
+ // continuous easing at a glance; thresholds picked so
2902
+ // typical 1-2-SSE Claude/Codex sessions stay in the
2903
+ // "active" tier and only multi-pane orchestrators pop
2904
+ // into the "busy" tier. Geometry unchanged (r=2.5).
2905
+ const sse = sseCountFor ?? 0;
2906
+ const dur = sse >= 4 ? '0.7s' : sse >= 2 ? '0.9s' : '1.2s';
2907
+ return (
2908
+ <circle cx={pos.x} cy={pos.y - (radius - 6)} r="2.5" fill={pal.flowParticle} data-pulse-dur={dur} opacity={reducedMotion ? 0.6 : undefined}>
2909
+ {!reducedMotion && (
2910
+ <animate attributeName="opacity" values="1;0.25;1" dur={dur} repeatCount="indefinite" />
2911
+ )}
2912
+ </circle>
2913
+ );
2914
+ })()}
1252
2915
 
1253
2916
  {/* Round 98 (issue #61): label rect 124px → 100px.
1254
2917
  Round 109/110 (Vincent P0): full opaque card below the
1255
2918
  density threshold / on hover / when zoomed; otherwise a
1256
2919
  lightweight plain-text alias that keeps every node
1257
- labelled without an opaque box covering its neighbours. */}
1258
- {showFullLabel ? (
1259
- <g transform={`translate(${pos.x}, ${pos.y + radius + 22})`} style={{ pointerEvents: 'none' }}>
1260
- <rect x="-50" y="-14" width="100" height="42" rx="6" fill={pal.labelBox.fill} stroke={pal.labelBox.stroke} opacity={isLight ? 1 : 0.94} />
1261
- <text x="0" y="1" textAnchor="middle" fill={status.text} fontSize="12" fontFamily="monospace" fontWeight="700">
1262
- {truncate(session.alias, 12)}
1263
- </text>
1264
- <text x="0" y="17" textAnchor="middle" fill={status.primary} fontSize="9" fontFamily="monospace">
1265
- {status.label}{isOnline && sseCountFor != null ? ` sse:${sseCountFor}` : ''}
2920
+ labelled without an opaque box covering its neighbours.
2921
+ Round 15 / Loop: when nodeScale=S the node shrinks 30%
2922
+ but the label card was staying full-size, so the label
2923
+ visually outweighed the small node. Tighten the card
2924
+ frame, alias / sub fontSize, drop-offset and truncate
2925
+ length specifically for S; M and L keep their existing
2926
+ sizes (M ≈ L for labels by design — the S user is the
2927
+ one who explicitly asked for a denser view). */}
2928
+ {(() => {
2929
+ const isSmall = nodeScale < 0.8;
2930
+ const cardW = isSmall ? 88 : 100;
2931
+ const cardH = isSmall ? 36 : 42;
2932
+ const cardTopY = isSmall ? -12 : -14;
2933
+ const aliasFs = isSmall ? 11 : 12;
2934
+ const subFs = isSmall ? 8 : 9;
2935
+ const subY = isSmall ? 15 : 17;
2936
+ const dropY = isSmall ? 18 : 22;
2937
+ const fullMax = isSmall ? 11 : 12;
2938
+ const denseFs = isSmall ? 9 : 10;
2939
+ const denseDrop = isSmall ? 12 : 14;
2940
+ // Round 26 / Loop: micro-lift the label group on hover —
2941
+ // 1.5 px upward, 200 ms ease. Pairs with the Round 18
2942
+ // group-box hover-accent treatment to give the same
2943
+ // "this is the focused element" feedback at the per-
2944
+ // node level. CSS transform stacks onto the SVG
2945
+ // positioning transform attribute (SVG 2 cascade);
2946
+ // bbox is unchanged at rest, so the overlap-test gate
2947
+ // continues to see the geometric layout it expects.
2948
+ return showFullLabel ? (
2949
+ <g transform={`translate(${pos.x}, ${pos.y + radius + dropY})`} style={{ pointerEvents: 'none' }}
2950
+ className="transition-transform duration-200 group-hover:-translate-y-[1.5px]">
2951
+ <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} />
2952
+ <text x="0" y="1" textAnchor="middle" fill={status.text} fontSize={aliasFs} fontFamily="monospace" fontWeight="700">
2953
+ {truncate(session.alias, fullMax)}
2954
+ </text>
2955
+ <text x="0" y={subY} textAnchor="middle" fill={status.primary} fontSize={subFs} fontFamily="monospace">
2956
+ {status.label}{isOnline && sseCountFor != null ? ` sse:${sseCountFor}` : ''}
2957
+ </text>
2958
+ </g>
2959
+ ) : (
2960
+ <text
2961
+ x={pos.x}
2962
+ y={pos.y + radius + denseDrop}
2963
+ textAnchor="middle"
2964
+ fill={status.text}
2965
+ fontSize={denseFs}
2966
+ fontFamily="monospace"
2967
+ fontWeight="700"
2968
+ opacity={0.9}
2969
+ className="transition-transform duration-200 group-hover:-translate-y-[1.5px]"
2970
+ style={{ pointerEvents: 'none', paintOrder: 'stroke' }}
2971
+ stroke={pal.containerBg}
2972
+ strokeWidth="3"
2973
+ >
2974
+ {truncate(session.alias, isSmall ? 9 : 10)}
1266
2975
  </text>
1267
- </g>
1268
- ) : (
1269
- <text
1270
- x={pos.x}
1271
- y={pos.y + radius + 14}
1272
- textAnchor="middle"
1273
- fill={status.text}
1274
- fontSize="10"
1275
- fontFamily="monospace"
1276
- fontWeight="700"
1277
- opacity={0.9}
1278
- style={{ pointerEvents: 'none', paintOrder: 'stroke' }}
1279
- stroke={pal.containerBg}
1280
- strokeWidth="3"
1281
- >
1282
- {truncate(session.alias, 10)}
1283
- </text>
1284
- )}
2976
+ );
2977
+ })()}
1285
2978
  </g>
1286
2979
  );
1287
2980
  })}
1288
2981
 
2982
+ {/* Round 14 / Loop: click ripple — one-shot expanding ring from
2983
+ the clicked node, ~500ms, status-coloured. Sits inside the
2984
+ zoom/pan <g> so it scales / pans with the topology. Keyed by
2985
+ ts so a re-click on any node (same or different) remounts the
2986
+ <circle> and the SMIL <animate> elements replay from t=0.
2987
+ strokeWidth=2 doesn't match the overlap-test selectors. */}
2988
+ {clickRipple && !reducedMotion && (
2989
+ <circle
2990
+ key={clickRipple.ts}
2991
+ cx={clickRipple.x}
2992
+ cy={clickRipple.y}
2993
+ r={clickRipple.r0 + 4}
2994
+ fill="none"
2995
+ stroke={clickRipple.color}
2996
+ strokeWidth="2"
2997
+ opacity="0"
2998
+ style={{ pointerEvents: 'none' }}
2999
+ >
3000
+ <animate attributeName="r" values={`${clickRipple.r0 + 4};${clickRipple.r0 + 30}`} dur="0.5s" fill="freeze" />
3001
+ <animate attributeName="opacity" values="0.7;0" dur="0.5s" fill="freeze" />
3002
+ </circle>
3003
+ )}
3004
+
1289
3005
  </g>
1290
3006
 
1291
3007
  {/* #112: overlay panels (recent-signal + legend) render OUTSIDE the
@@ -1296,30 +3012,314 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1296
3012
  corner triangles, so the panels never overlap a node, in ring
1297
3013
  OR grid layout (Vincent 4727 zero-overlap criterion). */}
1298
3014
  {/* latest flow labels */}
3015
+ {/* Round 57 / Loop: drop-shadow on the panel rects gives them
3016
+ card-like elevation, especially on light theme where the
3017
+ near-white fill on a near-white canvas read as pasted-on.
3018
+ data-topo-panel-elevation tag so the test can verify both
3019
+ panels carry the filter. The filter is on the rect, not
3020
+ the parent <g>, so it doesn't shadow the rows + text inside
3021
+ — only the panel chrome lifts. */}
1299
3022
  <g transform="translate(16, 16)">
1300
- <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} />
3023
+ <rect
3024
+ x="0" y="0" width="230" height="84" rx="10"
3025
+ fill={pal.legendBox.fill}
3026
+ stroke={pal.legendBox.stroke}
3027
+ opacity={isLight ? 0.97 : 0.92}
3028
+ 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))' }}
3029
+ data-topo-panel-elevation="recent"
3030
+ />
1301
3031
  <text x="13" y="21" fill={pal.legendHeadline} fontSize="12" fontFamily="monospace" fontWeight="700">recent signal</text>
1302
- <text x="150" y="21" fill={pal.legendAccent} fontSize="10" fontFamily="monospace">{messages.length} msgs</text>
1303
- {flowLinks.slice(0, 3).map((link, index) => (
1304
- <text key={link.key} x="13" y={38 + index * 16} fill={pal.legendText} fontSize="9" fontFamily="monospace">
1305
- {truncate(link.from, 6)} {'->'} {truncate(link.to, 6)} / {link.count} / {truncate(link.content, 12)}
1306
- </text>
1307
- ))}
3032
+ {/* R96: header count now matches what the rows show. Pre-R96
3033
+ this read "X msgs" off the raw messages array, but the
3034
+ rows below render DEDUPED flowLinks — so a fleet with 10
3035
+ messages aggregating to 3 pairs read "10 msgs" above
3036
+ only 3 rows. Misreads as "where are the other 7?".
3037
+ "X flows" mirrors flowLinks.length one-for-one. When
3038
+ flows < msgs the chip-row's "N active links · last 2s"
3039
+ already tells the operator about traffic volume — no
3040
+ duplicate metric needed here. */}
3041
+ <text x="150" y="21" fill={pal.legendAccent} fontSize="10" fontFamily="monospace" data-recent-panel-count>{flowLinks.length} flows</text>
3042
+ {/* Round 45 / Loop: empty state. The panel used to render
3043
+ "recent signal" + "0 msgs" with three blank slots below
3044
+ when no flow yet — read as "broken" rather than "quiet".
3045
+ A muted centred placeholder makes the empty state
3046
+ deliberate. Messages count CAN diverge from flowLinks
3047
+ count (raw count vs. deduped pairs), so the placeholder
3048
+ fires on flowLinks.length=0 specifically. */}
3049
+ {flowLinks.length === 0 ? (
3050
+ /* R45 placeholder. R110: add a sub-text hint so the
3051
+ empty state explains what it's empty OF — operators
3052
+ looking at "no flow yet" sometimes mistook it for
3053
+ a connection error. The sub-line reads as a quiet
3054
+ invitation, not an error. Two-line layout uses
3055
+ standard SVG <text>+<text> rather than tspan so the
3056
+ y-coordinates are explicit and the data-attr selector
3057
+ still finds the primary line. */
3058
+ <>
3059
+ <text x="115" y="54" textAnchor="middle" fill={pal.legendText} fontSize="10" fontFamily="monospace" fontStyle="italic" opacity={0.65} data-recent-signal-empty>
3060
+ no flow yet
3061
+ </text>
3062
+ <text x="115" y="68" textAnchor="middle" fill={pal.legendText} fontSize="8" fontFamily="monospace" opacity={0.45} data-recent-signal-empty-hint>
3063
+ send a message between agents
3064
+ </text>
3065
+ </>
3066
+ ) : (
3067
+ // Round 56 / Loop: each row is a navigator into the canvas.
3068
+ // Hover a row → set hoveredEdgeKey, which the existing R50
3069
+ // edge-focus + R49 endpoint-highlight ladders consume. The
3070
+ // matching flow edge brightens to 2× + thickens, its two
3071
+ // endpoint nodes stay full opacity, and every other edge +
3072
+ // non-endpoint node dims. Released → all restore. Wrapping
3073
+ // <g> + a transparent 218×14 hitbox so the cursor doesn't
3074
+ // have to land precisely on the truncated text.
3075
+ flowLinks.slice(0, 3).map((link, index) => {
3076
+ // Round 94 / Loop: per-row relative timestamp. The chip
3077
+ // row shows "last 2s" for the most recent flow overall,
3078
+ // but a user scanning the recent-signal panel had no way
3079
+ // to tell whether row 2 was 5s old or 5m old without
3080
+ // hovering nodes. Compact `2s` / `1m` glyph at the
3081
+ // right edge — same relativeAgo helper R42 uses for
3082
+ // the chip — pulls double duty as a recency anchor and
3083
+ // a sortedness hint (top row is freshest by construction).
3084
+ // Strip the " ago" suffix — at fontSize=8 in a 32-px
3085
+ // right-edge slot, every char counts. "30s ago" → "30s".
3086
+ const rawAt = link.last_at ? relativeAgo(link.last_at) : null;
3087
+ const lastAt = rawAt ? rawAt.replace(/\s+ago$/, '') : null;
3088
+ const isRowHovered = hoveredEdgeKey === link.key;
3089
+ return (
3090
+ <g
3091
+ key={link.key}
3092
+ data-recent-row={link.key}
3093
+ data-recent-row-hovered={isRowHovered ? 'true' : 'false'}
3094
+ style={{ cursor: 'pointer' }}
3095
+ onMouseEnter={() => setHoveredEdgeKey(link.key)}
3096
+ onMouseLeave={() => setHoveredEdgeKey(prev => prev === link.key ? null : prev)}
3097
+ >
3098
+ {/* R104: subtle row-background tint on hover. R56
3099
+ already brightens the matching edge on the canvas,
3100
+ but the panel row itself stayed flat — felt more
3101
+ like text-with-handlers than a navigable list.
3102
+ Filling the rect at hover with `pal.legendAccent`
3103
+ at low alpha gives the row visual feedback at the
3104
+ source surface, mirroring the list-item idiom from
3105
+ the chip-row pills. */}
3106
+ <rect
3107
+ x="6" y={38 + index * 16 - 10}
3108
+ width="218" height="14" rx="3"
3109
+ fill={isRowHovered ? pal.legendAccent : 'transparent'}
3110
+ opacity={isRowHovered ? (isLight ? 0.10 : 0.14) : 1}
3111
+ style={{ transition: 'fill 150ms ease-out, opacity 150ms ease-out' }}
3112
+ />
3113
+ <text
3114
+ x="13" y={38 + index * 16}
3115
+ fill={hoveredEdgeKey === link.key ? pal.legendHeadline : pal.legendText}
3116
+ fontSize="9"
3117
+ fontFamily="monospace"
3118
+ style={{ transition: 'fill 150ms ease-out' }}
3119
+ >
3120
+ {truncate(link.from, 6)} {'->'} {truncate(link.to, 6)} / {link.count} / {truncate(link.content, 8)}
3121
+ </text>
3122
+ {lastAt ? (
3123
+ <text
3124
+ x="217" y={38 + index * 16}
3125
+ textAnchor="end"
3126
+ fill={pal.legendText}
3127
+ fontSize="8"
3128
+ fontFamily="monospace"
3129
+ opacity={0.55}
3130
+ data-recent-row-ts={link.key}
3131
+ style={{ pointerEvents: 'none' }}
3132
+ >
3133
+ {lastAt}
3134
+ </text>
3135
+ ) : null}
3136
+ </g>
3137
+ );
3138
+ })
3139
+ )}
1308
3140
  </g>
1309
3141
 
1310
- {/* legend */}
3142
+ {/* legend — Round 55 / Loop: each status row is now a hover
3143
+ target. Pointer enter sets `hoveredStatus`; pointer leave
3144
+ clears it. Node opacity formula composes the match below.
3145
+ The row text brightens to legendHeadline while hovered as
3146
+ a small affordance hint. Geometry unchanged — the new
3147
+ <g> wrappers only carry pointer handlers. */}
1311
3148
  <g transform="translate(760, 16)">
1312
- <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} />
1313
- <circle cx="16" cy="24" r="5.5" fill={isLight ? '#059669' : '#22c55e'} />
1314
- <text x="30" y="28" fill={pal.legendText} fontSize="11" fontFamily="monospace">working node</text>
1315
- <circle cx="16" cy="48" r="5.5" fill={isLight ? '#0d9488' : '#2dd4bf'} />
1316
- <text x="30" y="52" fill={pal.legendText} fontSize="11" fontFamily="monospace">online idle</text>
1317
- <circle cx="16" cy="72" r="5.5" fill={isLight ? '#94a3b8' : '#6b7280'} />
1318
- <text x="30" y="76" fill={pal.legendText} fontSize="11" fontFamily="monospace">offline / no SSE</text>
1319
- <path d="M140,72 Q164,48 196,72" fill="none" stroke={pal.flowEdge} strokeWidth="3" markerEnd="url(#topo-arrow)" />
3149
+ {/* R57: matching drop-shadow elevation to the legend panel.
3150
+ R106: panel height grew 96 → 104 to seat the new header
3151
+ line + 4 px row-shift below it (so the new header text
3152
+ doesn't overlap the row-1 hitbox region). */}
3153
+ <rect
3154
+ x="0" y="0" width="224" height="104" rx="10"
3155
+ fill={pal.legendBox.fill}
3156
+ stroke={pal.legendBox.stroke}
3157
+ opacity={isLight ? 0.97 : 0.92}
3158
+ 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))' }}
3159
+ data-topo-panel-elevation="legend"
3160
+ />
3161
+ {/* R106 / Loop: panel header — symmetric with the recent-
3162
+ signal panel's "recent signal · N flows" (R96). Same
3163
+ font + position vocabulary so the two side panels feel
3164
+ paired. Title text at x=13 y=21; total fleet count
3165
+ right-aligned at x=215 y=21 in the accent colour. */}
3166
+ <text x="13" y="21" fill={pal.legendHeadline} fontSize="12" fontFamily="monospace" fontWeight="700">legend</text>
3167
+ <text x="215" y="21" textAnchor="end" fill={pal.legendAccent} fontSize="10" fontFamily="monospace" data-legend-panel-count>{sessions.length} node{sessions.length === 1 ? '' : 's'}</text>
3168
+ {(() => {
3169
+ const idleCount = onlineNodes.length - workingCount;
3170
+ // R106: rows shift +8 px (was y0=24, 48, 72 → 32, 56, 80)
3171
+ // to clear the new header row. R57 panel rect grew 96 →
3172
+ // 104 to seat them.
3173
+ const rows = [
3174
+ { key: 'working' as const, y0: 32, y1: 36, fill: isLight ? '#059669' : '#22c55e', label: 'working node', count: workingCount },
3175
+ { key: 'idle' as const, y0: 56, y1: 60, fill: isLight ? '#0d9488' : '#2dd4bf', label: 'online idle', count: idleCount },
3176
+ { key: 'offline' as const, y0: 80, y1: 84, fill: isLight ? '#94a3b8' : '#6b7280', label: 'offline / no SSE', count: offlineNodes.length },
3177
+ ];
3178
+ return rows;
3179
+ })().map(row => {
3180
+ // Round 61 / Loop: legend rows pin too — symmetric with the
3181
+ // R60 pressure-bar segments. R55 hover stays transient; the
3182
+ // new onClick toggles pinnedStatus so users can lock a
3183
+ // filter without holding the cursor still. Pinned row gets
3184
+ // an inset ring on the swatch (same vocab as R60).
3185
+ const isPinned = pinnedStatus === row.key;
3186
+ return (
3187
+ <g
3188
+ key={row.key}
3189
+ data-legend-status={row.key}
3190
+ role="button"
3191
+ tabIndex={0}
3192
+ aria-pressed={isPinned}
3193
+ style={{ cursor: 'pointer' }}
3194
+ // R61: stopPropagation on pointerdown so the SVG-level
3195
+ // pan handler (R103) doesn't setPointerCapture and
3196
+ // redirect the follow-up click away from this <g>.
3197
+ // Same trick the node <g> uses (and R52 hub).
3198
+ onPointerDown={(e) => e.stopPropagation()}
3199
+ onMouseEnter={() => setHoveredStatus(row.key)}
3200
+ onMouseLeave={() => setHoveredStatus(prev => prev === row.key ? null : prev)}
3201
+ onClick={() => setPinnedStatus(prev => prev === row.key ? null : row.key)}
3202
+ >
3203
+ {/* R55 hitbox covers the row so cursor doesn't need to
3204
+ be exactly on the 5-px swatch. R105 / Loop: the
3205
+ hitbox now also carries a subtle hover/pin tint —
3206
+ mirroring R104's recent-signal row treatment so
3207
+ both side panels share the list-item idiom. The
3208
+ tint borrows the ROW'S OWN swatch colour rather
3209
+ than legendAccent, so the user's eye associates
3210
+ the tinted row with its colour swatch instead of
3211
+ a generic accent. Pin is a stronger tint than
3212
+ hover; idle stays fully transparent. */}
3213
+ <rect
3214
+ x="6" y={row.y0 - 12}
3215
+ width="170" height="22" rx="3"
3216
+ fill={hoveredStatus === row.key || isPinned ? row.fill : 'transparent'}
3217
+ opacity={isPinned ? (isLight ? 0.14 : 0.18)
3218
+ : hoveredStatus === row.key ? (isLight ? 0.08 : 0.12)
3219
+ : 1}
3220
+ data-legend-row-tinted={isPinned ? 'pinned' : hoveredStatus === row.key ? 'hover' : 'none'}
3221
+ style={{ transition: 'fill 150ms ease-out, opacity 150ms ease-out' }}
3222
+ />
3223
+ <circle cx="16" cy={row.y0} r="5.5" fill={row.fill} />
3224
+ {/* R61 pinned-state ring — concentric stroke at r=8 in
3225
+ the row colour, draws OUTSIDE the swatch so it
3226
+ doesn't fight the fill colour the user is matching. */}
3227
+ {isPinned && (
3228
+ <circle cx="16" cy={row.y0} r="8" fill="none" stroke={row.fill} strokeWidth="1.5" />
3229
+ )}
3230
+ <text
3231
+ x="30" y={row.y1}
3232
+ fill={hoveredStatus === row.key || isPinned ? pal.legendHeadline : pal.legendText}
3233
+ fontSize="11"
3234
+ fontFamily="monospace"
3235
+ style={{ transition: 'fill 150ms ease-out' }}
3236
+ >{row.label}</text>
3237
+ {/* R95: live count anchored to the right edge of the
3238
+ panel (x=215, after the flow-arrow swatch). Same
3239
+ counts the chip-row shows ("3 working" etc.) but
3240
+ here next to the swatch the user is matching —
3241
+ saves crossing the canvas to the chip row for
3242
+ the number. text-anchor=end aligns the column
3243
+ visually like a table. pointerEvents:none so the
3244
+ count doesn't intercept the row hover hitbox. */}
3245
+ <text
3246
+ x="215" y={row.y1}
3247
+ textAnchor="end"
3248
+ fill={pal.legendText}
3249
+ fontSize="11"
3250
+ fontFamily="monospace"
3251
+ opacity={hoveredStatus === row.key || isPinned ? 0.95 : 0.65}
3252
+ data-legend-count={row.key}
3253
+ style={{ pointerEvents: 'none', transition: 'opacity 150ms ease-out' }}
3254
+ >{row.count}</text>
3255
+ </g>
3256
+ );
3257
+ })}
3258
+ {/* Flow-arrow swatch tracks the offline row — R106 shifted
3259
+ rows down by 8 px to make space for the panel header so
3260
+ this moves from y=72 to y=80. Drop its pointerEvents so
3261
+ the offline legend row stays hoverable (R55). It's
3262
+ decoration, no need to receive events. */}
3263
+ <path d="M140,80 Q164,56 196,80" fill="none" stroke={pal.flowEdge} strokeWidth="3" markerEnd="url(#topo-arrow)" style={{ pointerEvents: 'none' }} />
1320
3264
  </g>
1321
3265
  </svg>
1322
3266
 
3267
+ {/* Round 30 / Loop: minimap. Big fleets in fullscreen mode at high
3268
+ zoom let users lose their position — the minimap shows the
3269
+ whole topology miniaturised plus a viewport rectangle so the
3270
+ user always knows where they are. Click anywhere to recenter
3271
+ the canvas there. Only mounted when the view is non-default
3272
+ (zoomed or panned) since at 1× centered the minimap and the
3273
+ canvas show the same thing. HTML overlay so it stays fixed
3274
+ while the SVG transforms. */}
3275
+ {(() => {
3276
+ const isDefaultView = Math.abs(view.zoom - 1) < 0.01 && Math.abs(view.x) < 1 && Math.abs(view.y) < 1;
3277
+ if (isDefaultView || (onlineNodes.length + offlineNodes.length) === 0) return null;
3278
+ const MW = 120, MH = 82;
3279
+ const sx = MW / VIEWBOX_W, sy = MH / VIEWBOX_H;
3280
+ const rectX = (-view.x / view.zoom) * sx;
3281
+ const rectY = (-view.y / view.zoom) * sy;
3282
+ const rectW = (VIEWBOX_W / view.zoom) * sx;
3283
+ const rectH = (VIEWBOX_H / view.zoom) * sy;
3284
+ return (
3285
+ <div
3286
+ className="absolute right-3 rounded-md border shadow-lg shadow-black/30 overflow-hidden anet-fade-in"
3287
+ style={{ bottom: 56, background: pal.legendBox.fill, borderColor: pal.containerBorder, cursor: 'crosshair' }}
3288
+ role="img"
3289
+ aria-label="Topology minimap — click to recenter"
3290
+ title="Minimap · click to recenter"
3291
+ onClick={(e) => {
3292
+ const r = e.currentTarget.getBoundingClientRect();
3293
+ const fx = (e.clientX - r.left) / r.width;
3294
+ const fy = (e.clientY - r.top) / r.height;
3295
+ setView(prev => ({
3296
+ ...prev,
3297
+ x: VIEWBOX_W / 2 - fx * VIEWBOX_W * prev.zoom,
3298
+ y: VIEWBOX_H / 2 - fy * VIEWBOX_H * prev.zoom,
3299
+ }));
3300
+ }}
3301
+ data-topo-minimap
3302
+ >
3303
+ <svg width={MW} height={MH} viewBox={`0 0 ${MW} ${MH}`} style={{ display: 'block' }}>
3304
+ {[...onlineNodes, ...offlineNodes].map(s => {
3305
+ const p = nodePositions[s.alias];
3306
+ if (!p) return null;
3307
+ const sseN = (s.network_id ? sseSessions[`${s.network_id}:${s.alias}`] : undefined) ?? sseSessions[s.alias];
3308
+ const isOn = s.status !== 'offline' || !!sseN;
3309
+ const st = nodeStatus(s, isOn, isLight);
3310
+ 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} />;
3311
+ })}
3312
+ {/* viewport rectangle */}
3313
+ <rect
3314
+ x={Math.max(0, rectX)} y={Math.max(0, rectY)}
3315
+ width={Math.max(0, Math.min(MW - Math.max(0, rectX), rectW))}
3316
+ height={Math.max(0, Math.min(MH - Math.max(0, rectY), rectH))}
3317
+ fill="none" stroke={pal.legendAccent} strokeWidth="1" opacity="0.9"
3318
+ />
3319
+ </svg>
3320
+ </div>
3321
+ );
3322
+ })()}
1323
3323
  {/* Round 103 (issue #81): zoom / pan / fullscreen controls — HTML
1324
3324
  overlay so they stay fixed while the SVG content transforms.
1325
3325
  Round 104: Vincent 实测 — the reset action used to be hidden
@@ -1356,6 +3356,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1356
3356
  className="px-2 py-1 hover:bg-white/5 transition-colors"
1357
3357
  style={{ color: pal.legendText }}
1358
3358
  aria-label="Zoom out"
3359
+ title="Zoom out (−)"
1359
3360
  >
1360
3361
  <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>
1361
3362
  </button>
@@ -1371,6 +3372,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1371
3372
  className="px-2 py-1 hover:bg-white/5 transition-colors"
1372
3373
  style={{ color: pal.legendText }}
1373
3374
  aria-label="Zoom in"
3375
+ title="Zoom in (+)"
1374
3376
  >
1375
3377
  <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>
1376
3378
  </button>
@@ -1380,7 +3382,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1380
3382
  className="p-1.5 rounded-md border hover:bg-white/5 transition-colors"
1381
3383
  style={{ background: pal.legendBox.fill, borderColor: pal.containerBorder, color: pal.legendText }}
1382
3384
  aria-label="Reset view"
1383
- title="Reset zoom + pan (or double-click the canvas)"
3385
+ title="Reset zoom + pan (0, or double-click the canvas)"
1384
3386
  >
1385
3387
  <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
1386
3388
  <path d="M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.4 2.6L3 8" />