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

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 (327) 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/0a-6zp8m0ux5..js +1 -0
  188. package/.next/static/chunks/0ekib0be3t9i5.js +1 -0
  189. package/.next/static/chunks/0glmrdj9112tc.js +7 -0
  190. package/.next/static/chunks/0rxrez_cjn.eh.js +1 -0
  191. package/.next/static/chunks/0tvn2l1pc.h65.js +1 -0
  192. package/.next/static/chunks/0x8x.29hkju5a.js +1 -0
  193. package/.next/static/chunks/106~a5kttxze-.js +4 -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 +2181 -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-active-links-tooltip-test.mjs +79 -0
  216. package/scripts/topo-arrival-ping-test.mjs +87 -0
  217. package/scripts/topo-arrow-tier-test.mjs +61 -0
  218. package/scripts/topo-auto-fit-test.mjs +73 -0
  219. package/scripts/topo-chat-focus-ring-test.mjs +77 -0
  220. package/scripts/topo-chip-pin-mirror-test.mjs +113 -0
  221. package/scripts/topo-click-ripple-test.mjs +66 -0
  222. package/scripts/topo-cmdk-layout-view-test.mjs +108 -0
  223. package/scripts/topo-cmdk-pin-test.mjs +123 -0
  224. package/scripts/topo-cmdk-vendor-clear-test.mjs +133 -0
  225. package/scripts/topo-cmdk-vendor-pin-test.mjs +103 -0
  226. package/scripts/topo-cwd-tooltip-test.mjs +64 -0
  227. package/scripts/topo-dblclick-reset-test.mjs +74 -0
  228. package/scripts/topo-dispatch-pulse-test.mjs +83 -0
  229. package/scripts/topo-edge-count-badge-test.mjs +84 -0
  230. package/scripts/topo-edge-endpoint-highlight-test.mjs +111 -0
  231. package/scripts/topo-edge-focus-test.mjs +113 -0
  232. package/scripts/topo-edge-hover-test.mjs +93 -0
  233. package/scripts/topo-edge-tooltip-test.mjs +70 -0
  234. package/scripts/topo-endpoint-ring-test.mjs +93 -0
  235. package/scripts/topo-esc-clears-pin-test.mjs +98 -0
  236. package/scripts/topo-filter-pill-aliases-test.mjs +121 -0
  237. package/scripts/topo-filter-pill-body-click-test.mjs +112 -0
  238. package/scripts/topo-filter-pill-count-test.mjs +110 -0
  239. package/scripts/topo-filter-pill-mobile-test.mjs +90 -0
  240. package/scripts/topo-fit-key-test.mjs +106 -0
  241. package/scripts/topo-freshness-chip-test.mjs +74 -0
  242. package/scripts/topo-group-box-pinned-state-test.mjs +95 -0
  243. package/scripts/topo-group-count-test.mjs +68 -0
  244. package/scripts/topo-group-hover-test.mjs +82 -0
  245. package/scripts/topo-group-label-hover-test.mjs +119 -0
  246. package/scripts/topo-group-label-tint-test.mjs +99 -0
  247. package/scripts/topo-group-label-title-test.mjs +83 -0
  248. package/scripts/topo-group-pin-test.mjs +119 -0
  249. package/scripts/topo-group-status-pips-test.mjs +103 -0
  250. package/scripts/topo-groupbox-live-test.mjs +100 -0
  251. package/scripts/topo-groupbox-test.mjs +4 -2
  252. package/scripts/topo-help-overlay-r109-test.mjs +67 -0
  253. package/scripts/topo-help-overlay-r59-test.mjs +67 -0
  254. package/scripts/topo-help-overlay-r65-test.mjs +64 -0
  255. package/scripts/topo-help-overlay-r70-test.mjs +63 -0
  256. package/scripts/topo-help-overlay-r78-test.mjs +59 -0
  257. package/scripts/topo-help-overlay-r81-test.mjs +58 -0
  258. package/scripts/topo-help-overlay-r87-test.mjs +64 -0
  259. package/scripts/topo-help-overlay-r91-test.mjs +65 -0
  260. package/scripts/topo-hub-busyness-test.mjs +100 -0
  261. package/scripts/topo-hub-click-fit-test.mjs +137 -0
  262. package/scripts/topo-hub-title-test.mjs +93 -0
  263. package/scripts/topo-ingroup-edge-test.mjs +103 -0
  264. package/scripts/topo-label-lift-test.mjs +119 -0
  265. package/scripts/topo-label-scale-test.mjs +78 -0
  266. package/scripts/topo-lastseen-tooltip-test.mjs +59 -0
  267. package/scripts/topo-layout-key-test.mjs +91 -0
  268. package/scripts/topo-legend-count-test.mjs +88 -0
  269. package/scripts/topo-legend-hover-test.mjs +113 -0
  270. package/scripts/topo-legend-panel-header-test.mjs +83 -0
  271. package/scripts/topo-legend-pin-test.mjs +128 -0
  272. package/scripts/topo-legend-row-tint-test.mjs +95 -0
  273. package/scripts/topo-minimap-test.mjs +68 -0
  274. package/scripts/topo-mobile-chips-test.mjs +103 -0
  275. package/scripts/topo-node-hover-lift-test.mjs +85 -0
  276. package/scripts/topo-node-title-test.mjs +101 -0
  277. package/scripts/topo-offline-dim-test.mjs +70 -0
  278. package/scripts/topo-overlap-test.mjs +32 -5
  279. package/scripts/topo-pan-cursor-test.mjs +62 -0
  280. package/scripts/topo-panel-elevation-test.mjs +76 -0
  281. package/scripts/topo-particle-stagger-test.mjs +82 -0
  282. package/scripts/topo-pin-persistence-test.mjs +105 -0
  283. package/scripts/topo-popover-meta-test.mjs +78 -0
  284. package/scripts/topo-pressure-bar-test.mjs +69 -0
  285. package/scripts/topo-pressure-hover-test.mjs +123 -0
  286. package/scripts/topo-pressure-pin-test.mjs +119 -0
  287. package/scripts/topo-pressure-seg-tooltip-test.mjs +98 -0
  288. package/scripts/topo-pulse-rate-test.mjs +71 -0
  289. package/scripts/topo-recent-panel-count-test.mjs +72 -0
  290. package/scripts/topo-recent-row-hover-test.mjs +122 -0
  291. package/scripts/topo-recent-row-tint-test.mjs +91 -0
  292. package/scripts/topo-recent-row-ts-test.mjs +92 -0
  293. package/scripts/topo-recent-signal-empty-hint-test.mjs +73 -0
  294. package/scripts/topo-recent-signal-empty-test.mjs +63 -0
  295. package/scripts/topo-reduced-motion-test.mjs +77 -0
  296. package/scripts/topo-status-chip-hover-test.mjs +101 -0
  297. package/scripts/topo-status-chip-tooltip-test.mjs +95 -0
  298. package/scripts/topo-tier-ring-occupancy-test.mjs +87 -0
  299. package/scripts/topo-tier-ring-test.mjs +69 -0
  300. package/scripts/topo-tier-ring-tint-test.mjs +110 -0
  301. package/scripts/topo-tier-stagger-test.mjs +89 -0
  302. package/scripts/topo-tz-ghost-test.mjs +69 -0
  303. package/scripts/topo-vendor-chip-hover-test.mjs +111 -0
  304. package/scripts/topo-vendor-letter-tooltip-test.mjs +92 -0
  305. package/scripts/topo-vendor-pill-test.mjs +125 -0
  306. package/scripts/topo-vendor-pin-test.mjs +125 -0
  307. package/scripts/topo-wheel-zoom-test.mjs +79 -0
  308. package/scripts/topo-working-halo-breath-test.mjs +86 -0
  309. package/scripts/topo-zoom-keys-test.mjs +89 -0
  310. package/.next/static/chunks/0-7iowzu4.798.js +0 -1
  311. package/.next/static/chunks/02t5jr4shh.hy.js +0 -1
  312. package/.next/static/chunks/0_qfg5s5uzs7..js +0 -7
  313. package/.next/static/chunks/0cj5qr_a8dzky.js +0 -7
  314. package/.next/static/chunks/0dttftqqehpdj.js +0 -1
  315. package/.next/static/chunks/0elalb9n_.~di.js +0 -1
  316. package/.next/static/chunks/0j_q__o8p6g83.js +0 -1
  317. package/.next/static/chunks/0ja71r81z59di.js +0 -1
  318. package/.next/static/chunks/0jl6_w50zh4l5.js +0 -1
  319. package/.next/static/chunks/0r4q73.-1bkyl.js +0 -1
  320. package/.next/static/chunks/0r_c8eccg3z2o.js +0 -1
  321. package/.next/static/chunks/0z6mgaoe8c89-.js +0 -1
  322. package/.next/static/chunks/10oi7l-tycgl9.js +0 -1
  323. package/.next/static/chunks/11uk1izuv3~0t.js +0 -1
  324. package/.next/static/chunks/11y8xsp9mn.m8.css +0 -2
  325. /package/.next/static/{irozqkI_mD2Ls10yQ_4yG → fh5pUqgTFNt162QarYePi}/_buildManifest.js +0 -0
  326. /package/.next/static/{irozqkI_mD2Ls10yQ_4yG → fh5pUqgTFNt162QarYePi}/_clientMiddlewareManifest.js +0 -0
  327. /package/.next/static/{irozqkI_mD2Ls10yQ_4yG → fh5pUqgTFNt162QarYePi}/_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,454 @@ 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
+ // R114: tooltip lists the actual flows. Closes the
1679
+ // info-density sweep on the last chip-row hover surface
1680
+ // (R97-R113 covered everything else). Format:
1681
+ // "alpha→beta (3), gamma→delta (1) — hover brightens all"
1682
+ // Truncates at 6 flows with "+N more" so a busy fleet
1683
+ // doesn't paint a tall tooltip; the recent-signal panel
1684
+ // already shows the top 3 in detail.
1685
+ const flowList = flowLinks
1686
+ .slice(0, 6)
1687
+ .map(l => `${l.from}→${l.to} (${l.count})`)
1688
+ .join(', ');
1689
+ const flowSuffix = flowLinks.length > 6 ? ` + ${flowLinks.length - 6} more` : '';
1690
+ const tooltip = flowLinks.length === 0
1691
+ ? undefined
1692
+ : `${flowList}${flowSuffix} — hover brightens all`;
1693
+ return (
1694
+ <span
1695
+ className="hidden sm:inline px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20"
1696
+ data-active-links-chip
1697
+ data-active-links-flow-count={flowLinks.length}
1698
+ title={tooltip}
1699
+ style={{ cursor: flowLinks.length > 0 ? 'pointer' : undefined }}
1700
+ onMouseEnter={() => { if (flowLinks.length > 0) setHoveredActiveLinks(true); }}
1701
+ onMouseLeave={() => setHoveredActiveLinks(false)}
1702
+ >
1703
+ {flowLinks.length} active link{flowLinks.length === 1 ? '' : 's'}
1704
+ {rel ? <span className="text-gray-500"> · last {rel}</span> : null}
1705
+ </span>
1706
+ );
1707
+ })()}
1708
+ <FreshnessChip sessions={sessions} />
794
1709
  </div>
795
1710
  </div>
796
1711
 
@@ -810,7 +1725,18 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
810
1725
  onPointerMove={onPointerMove}
811
1726
  onPointerUp={onPointerUp}
812
1727
  onPointerLeave={onPointerUp}
813
- style={{ cursor: 'grab', touchAction: 'none' }}
1728
+ // Round 41 / Loop: the reset-button title (R22) and the Help
1729
+ // overlay (R25) both advertise "double-click the canvas to
1730
+ // reset", but the handler was never actually wired. The text
1731
+ // was lying. Wire it here, guarded so dbl-clicking a node
1732
+ // (which would also trigger the SVG-level handler via event
1733
+ // bubbling) doesn't unexpectedly reset the view on the user.
1734
+ onDoubleClick={(e) => {
1735
+ const t = e.target as Element | null;
1736
+ if (t?.closest('g[data-node]')) return;
1737
+ resetView();
1738
+ }}
1739
+ style={{ cursor: isPanning ? 'grabbing' : 'grab', touchAction: 'none' }}
814
1740
  >
815
1741
  <defs>
816
1742
  <linearGradient id="topo-panel" x1="0" x2="1" y1="0" y2="1">
@@ -832,9 +1758,37 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
832
1758
  </feMerge>
833
1759
  </filter>
834
1760
  )}
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>
1761
+ {/* Round 16 / Loop: 3-tier flow-link arrow markers.
1762
+ The single marker had `markerUnits` defaulting to
1763
+ `strokeWidth`, so heavy edges (stroke=7) rendered 35-user-
1764
+ unit arrowheads — visually dominant, the head outweighed
1765
+ the line. Switching to `userSpaceOnUse` decouples arrow
1766
+ size from stroke; binning by count gives a clearer
1767
+ hierarchy than continuous linear scaling:
1768
+ s (count 1-2) → 12 user units
1769
+ m (count 3-4) → 16 user units (alias for `topo-arrow`)
1770
+ l (count 5+) → 22 user units
1771
+ `topo-arrow` stays bound to the medium tier so the legend
1772
+ swatch (line ~1500) renders without change. */}
1773
+ {[
1774
+ { id: 'topo-arrow-s', size: 12 },
1775
+ { id: 'topo-arrow', size: 16 },
1776
+ { id: 'topo-arrow-l', size: 22 },
1777
+ ].map(m => (
1778
+ <marker
1779
+ key={m.id}
1780
+ id={m.id}
1781
+ viewBox="0 0 10 10"
1782
+ refX="8"
1783
+ refY="5"
1784
+ markerWidth={m.size}
1785
+ markerHeight={m.size}
1786
+ markerUnits="userSpaceOnUse"
1787
+ orient="auto-start-reverse"
1788
+ >
1789
+ <path d="M 0 0 L 10 5 L 0 10 z" fill={pal.arrowFill} />
1790
+ </marker>
1791
+ ))}
838
1792
  {/* Round 45: radial radar sweep gradient — bright at center
839
1793
  (where it meets the hub) fading to leading edge. */}
840
1794
  <radialGradient id="topo-sweep" cx="0%" cy="50%" r="100%">
@@ -854,13 +1808,17 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
854
1808
  grid mode drops it so the concentric rings don't sit behind a
855
1809
  rectangular grid. */}
856
1810
  {layout === 'ring' && (<>
857
- <circle cx={cx} cy={cy} r="330" fill="url(#topo-radar)" />
1811
+ {/* R52: radar bg is pure decoration — drop its pointer events so
1812
+ the hub <g> under it (and any future inner-disk affordances)
1813
+ can receive clicks. Previously the r=330 disc intercepted
1814
+ the hub click outright. */}
1815
+ <circle cx={cx} cy={cy} r="330" fill="url(#topo-radar)" style={{ pointerEvents: 'none' }} />
858
1816
 
859
1817
  {/* Round 45: subtle star field — 24 deterministic dots scattered
860
1818
  across the canvas give the radar bg some depth. Skipped on
861
1819
  light theme so the white surface stays clean. */}
862
1820
  {!isLight && (
863
- <g opacity="0.5">
1821
+ <g opacity="0.5" style={{ pointerEvents: 'none' }}>
864
1822
  {Array.from({ length: 28 }).map((_, i) => {
865
1823
  // Deterministic pseudo-random scatter so positions are
866
1824
  // stable between renders (no JS hydration mismatch).
@@ -882,6 +1840,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
882
1840
  style={{
883
1841
  transformOrigin: `${cx}px ${cy}px`,
884
1842
  transformBox: 'view-box',
1843
+ pointerEvents: 'none',
885
1844
  }}
886
1845
  className="anet-topo-sweep"
887
1846
  opacity={isLight ? 0.7 : 1}
@@ -892,11 +1851,82 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
892
1851
  />
893
1852
  </g>
894
1853
 
895
- {/* radar rings */}
1854
+ {/* radar rings — pure decoration at fixed radii, independent of
1855
+ node positions so the radar aesthetic is preserved across tier
1856
+ changes. */}
896
1857
  {[90, 170, 250, 330].map(radius => (
897
1858
  <circle key={radius} cx={cx} cy={cy} r={radius} fill="none" stroke={pal.ringStroke} strokeWidth="1" opacity={isLight ? 0.6 : 0.35} />
898
1859
  ))}
899
1860
 
1861
+ {/* Round 54 / Loop: tier-radius guide rings. The radar rings above
1862
+ are decorative and don't match the actual tier radii nodes sit
1863
+ on (single 220 / dual 175,260 / triple 145,215,285). Drawing
1864
+ a faint dashed ring at each ACTIVE tier radius lets the eye
1865
+ anchor "this is the inner / outer ring" without inferring from
1866
+ node spacing. Picked based on online node count so only the
1867
+ tiers currently in use draw — empty tiers stay quiet. pointer-
1868
+ events:none so they never intercept hub or node clicks. The
1869
+ 0.7 stroke + dashed pattern reads as guide, not feature. */}
1870
+ {(() => {
1871
+ const tierRadii = onlineNodes.length > onlineTripleThreshold
1872
+ ? [onlineTripleInnerR, onlineTripleMidR, onlineTripleOuterR]
1873
+ : onlineNodes.length > onlineTierThreshold
1874
+ ? [onlineInnerRadius, onlineOuterRadius]
1875
+ : onlineNodes.length > 0
1876
+ ? [onlineRadius]
1877
+ : [];
1878
+ // Round 92 / Loop: tier-ring occupancy. R54 drew the guide
1879
+ // rings at fixed opacity regardless of how many nodes lived
1880
+ // on each tier. With pinned filters dimming most nodes to
1881
+ // 0.28, the ring at a deserted tier looked identical to a
1882
+ // crowded one — wasting a free piece of canvas. Count
1883
+ // online nodes whose hub-distance falls within ±15 px of
1884
+ // each ring (15 px = half the inter-tier gap, so each
1885
+ // node is assigned to exactly one ring). Empty tier → skip
1886
+ // entirely. Crowded tier → stronger opacity, says "look
1887
+ // here". Buckets so the ladder feels intentional, not
1888
+ // jittery as one node migrates between tiers.
1889
+ const occupancyOf = (r: number) => onlineNodes.reduce((acc, s) => {
1890
+ const p = nodePositions[s.alias];
1891
+ if (!p) return acc;
1892
+ const d = Math.hypot(p.x - cx, p.y - cy);
1893
+ return Math.abs(d - r) < 15 ? acc + 1 : acc;
1894
+ }, 0);
1895
+ // Round 93 / Loop: when any pin is active, tint the tier
1896
+ // rings to the legend accent so the spatial guide visually
1897
+ // shares the canvas's "filtered mode" colour. The chip
1898
+ // row already says WHICH filter is on (pills + letter
1899
+ // mirror); rings answering "we're filtered" reinforces
1900
+ // the state when the eye is on the canvas, not the chip
1901
+ // row. Composes cleanly with R92 occupancy — same opacity
1902
+ // bucket logic; just the stroke colour swaps.
1903
+ const anyPin = !!(pinnedStatus || pinnedGroup || pinnedVendor);
1904
+ const tierStroke = anyPin ? pal.legendAccent : pal.ringStroke;
1905
+ return tierRadii.map(r => {
1906
+ const n = occupancyOf(r);
1907
+ if (n === 0) return null;
1908
+ const bucket = n <= 2 ? 0 : n <= 6 ? 1 : 2;
1909
+ const opLight = [0.24, 0.36, 0.50][bucket];
1910
+ const opDark = [0.32, 0.46, 0.62][bucket];
1911
+ return (
1912
+ <circle
1913
+ key={`tier-${r}`}
1914
+ cx={cx} cy={cy} r={r}
1915
+ fill="none"
1916
+ stroke={tierStroke}
1917
+ strokeWidth="0.7"
1918
+ strokeDasharray="2 8"
1919
+ opacity={isLight ? opLight : opDark}
1920
+ style={{ pointerEvents: 'none', transition: 'stroke 200ms ease-out' }}
1921
+ data-tier-ring={r}
1922
+ data-tier-occupancy={n}
1923
+ data-tier-bucket={bucket}
1924
+ data-tier-tinted={anyPin ? 'true' : 'false'}
1925
+ />
1926
+ );
1927
+ });
1928
+ })()}
1929
+
900
1930
  {/* Round 50: 4 small particles slowly orbiting the outer ring
901
1931
  (r=330). Each starts at a different angle (offset 0/0.25/0.5/0.75
902
1932
  of the cycle) so they're evenly spaced. 16s per revolution is
@@ -966,32 +1996,177 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
966
1996
  only — groupBoxes is empty in ring mode. Rendered behind the
967
1997
  flow links + nodes; pointer-events off so they never intercept
968
1998
  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"
1999
+ {groupBoxes.map(box => {
2000
+ const isHovered = activeGroup === box.key;
2001
+ // R68: distinguish "locked by click" from "currently hovered".
2002
+ // R63 made pinned and hovered identical (both hit isHovered
2003
+ // via activeGroup). A user with one team pinned should see at
2004
+ // a glance which is the locked one even while their cursor
2005
+ // sweeps elsewhere. isPinned reads pinnedGroup directly
2006
+ // (NOT activeGroup) so the visual is specific to the sticky
2007
+ // state transient hover keeps the R63 isHovered styling.
2008
+ const isPinned = pinnedGroup === box.key;
2009
+ // Round 18 / Loop: group-box hover linkage. The Round 8 fade
2010
+ // already dropped OUT-of-focus groups to 0.28, but the IN-focus
2011
+ // group sat at its baseline appearance — no positive emphasis.
2012
+ // Hovering now upgrades the box to an "accent" treatment:
2013
+ // solid stroke (not dashed), thicker, accent-coloured; brighter
2014
+ // text and slightly stronger fill. Label and box read as one
2015
+ // selected unit. Geometry unchanged → overlap test untouched.
2016
+ return (
2017
+ <g
2018
+ key={`grp-${box.key}`}
2019
+ data-group={box.key}
2020
+ className="transition-opacity"
2021
+ // R63: drop the blanket pointerEvents:'none' that
2022
+ // previously sat here. Chrome's SVG impl doesn't let a
2023
+ // child override a parent's `none` even though the spec
2024
+ // says it should — moving the property onto just the
2025
+ // rect (where it's needed so nodes underneath stay
2026
+ // clickable) lets the label text receive its own click.
2027
+ style={{ opacity: !activeGroup || isHovered ? 1 : 0.28 }}
990
2028
  >
991
- {box.key}
992
- </text>
993
- </g>
994
- ))}
2029
+ <rect
2030
+ x={box.x}
2031
+ y={box.y}
2032
+ width={box.w}
2033
+ height={box.h}
2034
+ rx="14"
2035
+ fill={isLight ? '#0f172a' : '#a5b4fc'}
2036
+ // R68: 3-tier opacity + stroke ladder.
2037
+ // pinned → fill 0.08 / 0.13, stroke 3 px (locked)
2038
+ // hovered → fill 0.05 / 0.09, stroke 2 px (inspecting)
2039
+ // idle → fill 0.025 / 0.045, stroke 1.5 px dashed
2040
+ fillOpacity={isPinned ? (isLight ? 0.08 : 0.13)
2041
+ : isHovered ? (isLight ? 0.05 : 0.09)
2042
+ : (isLight ? 0.025 : 0.045)}
2043
+ stroke={(isPinned || isHovered) ? pal.legendAccent : pal.ringStroke}
2044
+ strokeWidth={isPinned ? 3 : isHovered ? 2 : 1.5}
2045
+ strokeDasharray={(isPinned || isHovered) ? 'none' : '6 6'}
2046
+ data-group-box-pinned={isPinned ? 'true' : 'false'}
2047
+ // R85: ambient "marching ants" drift on the perimeter
2048
+ // when this group has at least one working member, and
2049
+ // neither pin nor hover is active (those treatments
2050
+ // already shout for attention via solid stroke). 12s
2051
+ // cycle reads as ambient — the eye parses "live work
2052
+ // here" without registering the box as animating.
2053
+ data-group-box-live={!isPinned && !isHovered && box.statuses.working > 0 ? 'true' : 'false'}
2054
+ className={!isPinned && !isHovered && box.statuses.working > 0 ? 'anet-topo-groupbox-live' : undefined}
2055
+ style={{ transition: 'stroke 200ms ease-out, stroke-width 200ms ease-out, fill-opacity 200ms ease-out', pointerEvents: 'none' }}
2056
+ />
2057
+ {/* R63: wrap label in a clickable <g> with an invisible
2058
+ rect hitbox. The text alone wasn't getting hit-tested
2059
+ reliably — the SVG-wide topo-panel <rect> intercepts
2060
+ at the label's screen position when the label sits at
2061
+ a high viewBox-y (it lands below where the compositor
2062
+ expects the text to paint on top, same gotcha as the
2063
+ recent-signal panel rows in R56). Hitbox rect + the
2064
+ parent <g> taking the click + onPointerDown stop-
2065
+ propagation match the R55/R56/R61 pattern. */}
2066
+ <g
2067
+ role="button"
2068
+ tabIndex={0}
2069
+ aria-pressed={pinnedGroup === box.key}
2070
+ data-group-label-hit={box.key}
2071
+ style={{ pointerEvents: 'all', cursor: 'pointer' }}
2072
+ onPointerDown={(e) => e.stopPropagation()}
2073
+ onClick={() => setPinnedGroup(prev => prev === box.key ? null : box.key)}
2074
+ // R86: hover the label → transient group focus. Releases
2075
+ // on leave; activeGroup = hoveredGroup ?? pinnedGroup
2076
+ // formula already handles transient-over-pin so a
2077
+ // user can spot-compare teams without losing their
2078
+ // pinned one. Closes the same R83-style hover/click
2079
+ // gap (segments) — now group labels carry it too.
2080
+ onPointerEnter={() => setHoveredGroupLabel(box.key)}
2081
+ onPointerLeave={() => setHoveredGroupLabel(prev => prev === box.key ? null : prev)}
2082
+ >
2083
+ {/* R99: SVG <title> tooltip listing group members +
2084
+ status breakdown. Same info-density spirit as
2085
+ R97 pill tooltips + R98 node tooltips — anywhere
2086
+ a UI element says "alpha · 3" should hover-
2087
+ explain WHICH 3. Truncates at 8 aliases with a
2088
+ "+N more" suffix so a 20-member band doesn't
2089
+ paint a 22-line tooltip. */}
2090
+ {(() => {
2091
+ const members = Object.entries(groupKeys)
2092
+ .filter(([, key]) => key === box.key)
2093
+ .map(([alias]) => alias);
2094
+ const memberPreview = members.slice(0, 8).join(', ');
2095
+ const suffix = members.length > 8 ? ` + ${members.length - 8} more` : '';
2096
+ const statusSummary = [
2097
+ box.statuses.working > 0 ? `${box.statuses.working} working` : null,
2098
+ box.statuses.idle > 0 ? `${box.statuses.idle} idle` : null,
2099
+ box.statuses.offline > 0 ? `${box.statuses.offline} offline` : null,
2100
+ ].filter(Boolean).join(' · ');
2101
+ return (
2102
+ <title>{[
2103
+ `${box.key} (${members.length} member${members.length === 1 ? '' : 's'})`,
2104
+ statusSummary || null,
2105
+ `${memberPreview}${suffix}`,
2106
+ pinnedGroup === box.key ? 'click to release pin' : 'click to pin this group',
2107
+ ].filter(Boolean).join('\n')}</title>
2108
+ );
2109
+ })()}
2110
+ <rect
2111
+ x={box.x + 6}
2112
+ y={box.y + 2}
2113
+ width={Math.min(box.w - 12, 240)}
2114
+ height={20}
2115
+ rx="4"
2116
+ /* R107 / Loop: list-item tint extends to the SVG
2117
+ group labels — same idiom R104 added to recent-
2118
+ signal rows and R105 to the legend rows. The
2119
+ tint colour is pal.legendAccent (cyan) since
2120
+ groups don't carry an inherent swatch the way
2121
+ legend rows do; this matches R68's group-box
2122
+ isPinned/isHovered accent stroke for consistency.
2123
+ hover < pinned opacity so locked vs preview is
2124
+ discriminable at a glance. */
2125
+ fill={pinnedGroup === box.key || hoveredGroupLabel === box.key ? pal.legendAccent : 'transparent'}
2126
+ opacity={pinnedGroup === box.key ? (isLight ? 0.16 : 0.20)
2127
+ : hoveredGroupLabel === box.key ? (isLight ? 0.09 : 0.13)
2128
+ : 1}
2129
+ data-group-label-tinted={pinnedGroup === box.key ? 'pinned' : hoveredGroupLabel === box.key ? 'hover' : 'none'}
2130
+ style={{ transition: 'fill 150ms ease-out, opacity 150ms ease-out' }}
2131
+ />
2132
+ <text
2133
+ x={box.x + 12}
2134
+ y={box.y + 14}
2135
+ fill={isHovered ? pal.legendHeadline : pal.legendText}
2136
+ fontSize="13"
2137
+ fontFamily="monospace"
2138
+ fontWeight="700"
2139
+ style={{ transition: 'fill 200ms ease-out' }}
2140
+ data-group-label={box.key}
2141
+ >
2142
+ {box.key}
2143
+ {/* Round 19 / Loop: member-count chip. Inline tspan stays
2144
+ in the single <text> bbox the overlap test reads, so
2145
+ the node↔label guard still catches if the chip ever
2146
+ pushes the label far enough right to clip a node.
2147
+ Smaller + lighter weight reads as metadata, not name. */}
2148
+ <tspan dx="6" fill={pal.legendText} fontSize="11" fontWeight="400">· {box.count}</tspan>
2149
+ {/* Round 58 / Loop: status mix pip strip. Compact text-
2150
+ based chips (e.g. "2w 1i") so the strip stays inside
2151
+ the same <text> bbox the overlap-test reads — keeps
2152
+ the R27 label↔label and R19 node↔label guards intact.
2153
+ Each tier is colour-coded against the legend swatches
2154
+ and only renders when count > 0, so a healthy all-
2155
+ working group reads simply " · 2w". */}
2156
+ {box.statuses.working > 0 && (
2157
+ <tspan dx="8" fill={isLight ? '#059669' : '#22c55e'} fontSize="11" fontWeight="600">{box.statuses.working}w</tspan>
2158
+ )}
2159
+ {box.statuses.idle > 0 && (
2160
+ <tspan dx="4" fill={isLight ? '#0d9488' : '#2dd4bf'} fontSize="11" fontWeight="600">{box.statuses.idle}i</tspan>
2161
+ )}
2162
+ {box.statuses.offline > 0 && (
2163
+ <tspan dx="4" fill={isLight ? '#94a3b8' : '#6b7280'} fontSize="11" fontWeight="600">{box.statuses.offline}o</tspan>
2164
+ )}
2165
+ </text>
2166
+ </g>
2167
+ </g>
2168
+ );
2169
+ })}
995
2170
 
996
2171
  {/* directed message flows */}
997
2172
  {flowLinks.map((link, index) => {
@@ -999,21 +2174,120 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
999
2174
  const to = nodePositions[link.to];
1000
2175
  if (!from || !to) return null;
1001
2176
 
1002
- const lift = index % 2 === 0 ? 36 : -36;
2177
+ // Round 7 / Loop: lift now scales with distance so short links
2178
+ // aren't over-bent (long links keep the ~36px hump), and the
2179
+ // particle period shortens with link.count so busier edges
2180
+ // visibly pulse faster — instant info density on top of the
2181
+ // existing stroke-width-by-count chip.
2182
+ const dist = Math.hypot(to.x - from.x, to.y - from.y);
2183
+ const lift = (index % 2 === 0 ? 1 : -1) * Math.min(36, dist * 0.18);
1003
2184
  const path = curvePath(from, to, lift);
1004
2185
  const width = Math.min(2 + link.count, 7);
1005
- const duration = 2.2 + (index % 5) * 0.32;
1006
-
2186
+ const duration = Math.max(0.9, 2.6 / Math.sqrt(link.count));
2187
+ // Round 10 / Loop: freshness fade. An edge that fired ≤30s ago
2188
+ // stays at full intensity; over 5 minutes it decays to ~35%.
2189
+ // Surfaces "what's happening now" vs background chatter without
2190
+ // hiding old flow entirely (some context still useful). `now`
2191
+ // captured at useMemo-recompute time (every 5s message refresh)
2192
+ // — accuracy is within the poll interval, plenty.
2193
+ const ageMs = link.last_at ? Math.max(0, Date.now() - Date.parse(link.last_at)) : 0;
2194
+ const fresh = Math.max(0.35, 1 - ageMs / (5 * 60 * 1000));
2195
+ // Round 16 arrow-tier binning — keep `topo-arrow` as the
2196
+ // medium tier id so the legend swatch picks it up unchanged.
2197
+ const arrowId = link.count <= 2 ? 'topo-arrow-s'
2198
+ : link.count <= 4 ? 'topo-arrow'
2199
+ : 'topo-arrow-l';
2200
+
2201
+ // Round 39 / Loop: edge hover tooltip — surface the same
2202
+ // last_at + count info the freshness fade and arrow tier
2203
+ // already encode visually, in plain text. The stroke is the
2204
+ // hover target; SVG `<title>` honours newlines on every
2205
+ // browser the dashboard targets.
2206
+ const lastAt = relativeAgo(link.last_at);
2207
+ const tooltip = `${link.from} → ${link.to}\n${link.count} message${link.count === 1 ? '' : 's'}${lastAt ? ` · last ${lastAt}` : ''}`;
2208
+ // Round 40 / Loop: edges follow node hover — when an alias is
2209
+ // hovered, every edge touching it brightens, the rest fade.
2210
+ // Pairs with the Round 8 group-focus fade on nodes: hover a
2211
+ // node to find "who is this agent talking to" at a glance.
2212
+ // No hover → multiplier is 1.0 (current behaviour preserved).
2213
+ // Round 50 / Loop: edge-on-self priority. When the user hovers
2214
+ // a flow edge directly (R48 widened the hitbox so this is now
2215
+ // a precise gesture), THAT edge gets the strongest boost (2.0)
2216
+ // and every other edge dims to 0.35. Node-hover (R40) keeps
2217
+ // its own ladder. Edge-hover and node-hover are mutually
2218
+ // exclusive in practice — the cursor is over one or the
2219
+ // other — but the order below makes edge-hover win if both
2220
+ // ever read truthy at the same React tick.
2221
+ // Round 53 / Loop: in-group edges follow team focus. R40
2222
+ // brightened only edges touching the exact hovered alias —
2223
+ // but with R8/R18 prefix-clustering, a user hovering one
2224
+ // member is asking about the team. So when BOTH endpoints of
2225
+ // an edge share the hoveredGroup (and neither is the exact
2226
+ // hovered alias — that gets the stronger 1.7×), the edge
2227
+ // boosts to 1.3×. Edges leaving the team (one endpoint in,
2228
+ // one out) still dim to 0.35× per R40 since they read as
2229
+ // background to the focus. Singletons fall through unchanged
2230
+ // (their group key is the alias itself, so bothInHoveredGroup
2231
+ // is impossible for a non-self-edge).
2232
+ const isHoveredEdge = hoveredEdgeKey === link.key;
2233
+ const fromGroup = groupKeys[link.from] ?? link.from;
2234
+ const toGroup = groupKeys[link.to] ?? link.to;
2235
+ const bothInHoveredGroup = !!activeGroup && fromGroup === activeGroup && toGroup === activeGroup;
2236
+ // R63: also gate "no filter" on activeGroup so pinnedGroup
2237
+ // alone activates the in-group 1.3× boost + non-group dim.
2238
+ // When neither a node nor a group is in focus, mul is 1.
2239
+ // R77: when the user hovers the "N active links" chip, the
2240
+ // baseline 1× becomes 1.5× — every flow brightens at once.
2241
+ // Sits inside the no-other-hover branch so it doesn't fight
2242
+ // the edge-hover (2.0×) or node-hover (1.7×) priorities.
2243
+ const edgeOpacityMul = isHoveredEdge
2244
+ ? 2.0
2245
+ : hoveredEdgeKey
2246
+ ? 0.35
2247
+ : !hoveredAlias && !activeGroup
2248
+ ? (hoveredActiveLinks ? 1.5 : 1)
2249
+ : (link.from === hoveredAlias || link.to === hoveredAlias)
2250
+ ? 1.7
2251
+ : bothInHoveredGroup
2252
+ ? 1.3
2253
+ : 0.35;
2254
+ // Round 50: the hovered edge also visibly thickens so the eye
2255
+ // tracks it even at low message counts (width was 3 → 4.5 on
2256
+ // hover). 1.4× is enough to read as "lifted" without
2257
+ // breaching the 16-px hitbox bound.
2258
+ const renderWidth = isHoveredEdge ? Math.min(width * 1.4, 10) : width;
1007
2259
  return (
1008
2260
  <g key={link.key}>
2261
+ {/* Round 48 / Loop: invisible hover hitbox — visible flow
2262
+ path is 3-7 px wide and damn hard to hover precisely.
2263
+ Stack a transparent 16-px-wide stroke behind it so the
2264
+ cursor only needs to be ~8 px from the line for the
2265
+ tooltip to fire. Native <title> moves here; the
2266
+ visible path no longer needs it. pointer-events on
2267
+ the visible path drop to "none" since the hitbox
2268
+ owns the hover surface. */}
2269
+ <path
2270
+ d={path}
2271
+ fill="none"
2272
+ stroke="transparent"
2273
+ strokeWidth={Math.max(width + 10, 16)}
2274
+ style={{ pointerEvents: 'stroke' }}
2275
+ data-edge-hitbox
2276
+ onMouseEnter={() => setHoveredEdgeKey(link.key)}
2277
+ onMouseLeave={() => setHoveredEdgeKey(prev => prev === link.key ? null : prev)}
2278
+ >
2279
+ <title>{tooltip}</title>
2280
+ </path>
1009
2281
  <path
1010
2282
  d={path}
1011
2283
  fill="none"
1012
2284
  stroke={pal.flowEdge}
1013
- strokeWidth={width}
1014
- opacity={isLight ? 0.22 : 0.28}
2285
+ strokeWidth={renderWidth}
2286
+ opacity={Math.min(1, (isLight ? 0.22 : 0.28) * fresh * edgeOpacityMul)}
1015
2287
  filter={isLight ? undefined : 'url(#topo-glow)'}
1016
- markerEnd="url(#topo-arrow)"
2288
+ markerEnd={`url(#${arrowId})`}
2289
+ className="transition-opacity duration-300"
2290
+ style={{ pointerEvents: 'none' }}
1017
2291
  />
1018
2292
  <path
1019
2293
  id={`flow-path-${index}`}
@@ -1022,45 +2296,223 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1022
2296
  stroke={pal.flowPath}
1023
2297
  strokeWidth="1"
1024
2298
  strokeDasharray="2 12"
1025
- opacity={isLight ? 0.4 : 0.75}
2299
+ opacity={Math.min(1, (isLight ? 0.4 : 0.75) * fresh * edgeOpacityMul)}
2300
+ className="transition-opacity duration-300"
1026
2301
  />
1027
- <circle r="4" fill={pal.flowParticle} filter={isLight ? undefined : 'url(#topo-glow)'}>
1028
- <animateMotion dur={`${duration}s`} repeatCount="indefinite" path={path} />
1029
- </circle>
2302
+ {!reducedMotion && (
2303
+ /* Round 103 / Loop: phase-stagger the particles so
2304
+ concurrent edges don't pulse in lockstep. SMIL
2305
+ `begin` accepts negative offsets to shift the cycle
2306
+ backwards in time, which means the particle starts
2307
+ mid-flight on first paint — no visible "all
2308
+ particles spawn from source simultaneously" tell.
2309
+ `(index * 0.37) % duration` gives a deterministic,
2310
+ well-distributed offset (the golden-ratio-ish 0.37
2311
+ fraction prevents lining up when N is a small
2312
+ multiple). Edge order is stable (sorted by recent
2313
+ activity), so the offsets feel calm rather than
2314
+ reshuffling each refresh. */
2315
+ <circle r="4" fill={pal.flowParticle} filter={isLight ? undefined : 'url(#topo-glow)'} opacity={Math.min(1, fresh * edgeOpacityMul)}>
2316
+ <animateMotion
2317
+ dur={`${duration}s`}
2318
+ begin={`-${((index * 0.37) % duration).toFixed(3)}s`}
2319
+ repeatCount="indefinite"
2320
+ path={path}
2321
+ />
2322
+ </circle>
2323
+ )}
2324
+ {/* Round 75 / Loop: arrival ping at the destination. The
2325
+ particle currently fades into the arrow marker
2326
+ silently — adding a small radiating ring synchronised
2327
+ to the particle's period turns message delivery into
2328
+ a visible event. begin = -dur*0.92 offsets the
2329
+ animation so the ring expands NEAR the end of each
2330
+ cycle (≈when the particle arrives). Gated by
2331
+ reducedMotion and on fresh > 0.5 — stale edges that
2332
+ haven't fired in minutes don't need the eye-grab.
2333
+ data-arrival-ping for testability. */}
2334
+ {!reducedMotion && fresh > 0.5 && (
2335
+ <circle
2336
+ cx={to.x}
2337
+ cy={to.y}
2338
+ r="0"
2339
+ fill="none"
2340
+ stroke={pal.flowEdge}
2341
+ strokeWidth="1.5"
2342
+ opacity="0"
2343
+ style={{ pointerEvents: 'none' }}
2344
+ data-arrival-ping={link.key}
2345
+ >
2346
+ <animate attributeName="r" values="0;14;22" dur={`${duration}s`} begin={`-${(duration * 0.92).toFixed(2)}s`} repeatCount="indefinite" />
2347
+ <animate attributeName="opacity" values="0;0.55;0" dur={`${duration}s`} begin={`-${(duration * 0.92).toFixed(2)}s`} repeatCount="indefinite" />
2348
+ </circle>
2349
+ )}
2350
+ {/* Round 76 / Loop: source dispatch pulse — mirror to the
2351
+ R75 arrival ping. begin = 0s (start of cycle) so the
2352
+ ring expands as the particle LEAVES the source. Only
2353
+ fires for high-traffic edges (link.count >= 3) — on
2354
+ quiet conversations the canvas should stay calm; on
2355
+ busy senders the pulse plus arrival ping bookend
2356
+ every message in flight, making the topology feel
2357
+ alive. Same fresh/reducedMotion gates as R75. Slightly
2358
+ smaller radius (0→12→18 vs R75's 0→14→22) so the
2359
+ source reads as "smaller event than arrival" — the
2360
+ destination is the meaningful endpoint. */}
2361
+ {!reducedMotion && fresh > 0.5 && link.count >= 3 && (
2362
+ <circle
2363
+ cx={from.x}
2364
+ cy={from.y}
2365
+ r="0"
2366
+ fill="none"
2367
+ stroke={pal.flowEdge}
2368
+ strokeWidth="1.5"
2369
+ opacity="0"
2370
+ style={{ pointerEvents: 'none' }}
2371
+ data-dispatch-pulse={link.key}
2372
+ >
2373
+ <animate attributeName="r" values="0;12;18" dur={`${duration}s`} begin="0s" repeatCount="indefinite" />
2374
+ <animate attributeName="opacity" values="0;0.45;0" dur={`${duration}s`} begin="0s" repeatCount="indefinite" />
2375
+ </circle>
2376
+ )}
2377
+ {/* Round 100 / Loop: midpoint count badge for high-
2378
+ traffic edges. Width already gauges intensity but
2379
+ "5 vs 12" is hard to read off stroke alone. Render
2380
+ a compact pill at the bezier midpoint (t=0.5 →
2381
+ midpoint + perpendicular × lift/2) showing the
2382
+ integer count. Threshold link.count >= 3 keeps
2383
+ the canvas quiet for sparse traffic. Bezier
2384
+ midpoint math: for a quadratic curve M A Q C B,
2385
+ the t=0.5 point is (A + 2C + B) / 4, which
2386
+ simplifies to (midAB) + 0.5 × (control - midAB)
2387
+ = midAB + perpendicular × lift/2. */}
2388
+ {link.count >= 3 && (() => {
2389
+ const midX = (from.x + to.x) / 2;
2390
+ const midY = (from.y + to.y) / 2;
2391
+ const dx = to.x - from.x;
2392
+ const dy = to.y - from.y;
2393
+ const len = Math.hypot(dx, dy) || 1;
2394
+ const badgeX = midX + (-dy / len) * lift * 0.5;
2395
+ const badgeY = midY + ( dx / len) * lift * 0.5;
2396
+ const badgeOpacity = Math.min(1, fresh * edgeOpacityMul);
2397
+ return (
2398
+ <g
2399
+ data-edge-count-badge={link.key}
2400
+ style={{ pointerEvents: 'none' }}
2401
+ opacity={badgeOpacity}
2402
+ >
2403
+ <circle
2404
+ cx={badgeX} cy={badgeY} r="9"
2405
+ fill={pal.legendBox.fill}
2406
+ stroke={pal.flowEdge}
2407
+ strokeWidth="1"
2408
+ opacity={isLight ? 0.95 : 0.82}
2409
+ />
2410
+ <text
2411
+ x={badgeX} y={badgeY + 3}
2412
+ textAnchor="middle"
2413
+ fill={pal.legendHeadline}
2414
+ fontSize="10"
2415
+ fontFamily="monospace"
2416
+ fontWeight="700"
2417
+ >{link.count}</text>
2418
+ </g>
2419
+ );
2420
+ })()}
1030
2421
  </g>
1031
2422
  );
1032
2423
  })}
1033
2424
 
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>
2425
+ {/* center hub — round 39 sized + round 13 restraint.
2426
+ The hub is the control-plane anchor. r39 gave it two outward
2427
+ pulses (r 10→38, 2.4s, double-phase) which read as "loudest
2428
+ node in the room" wrong semantics: anchors don't emit,
2429
+ they hold. r13 swaps the kinetic pulse for a slow opacity
2430
+ breath on the static halo (4s, ±15% from base), so the hub
2431
+ stays alive without throwing kinetic energy outward. The
2432
+ dual-circle "lit lamp" core is unchanged. */}
2433
+ {layout === 'ring' && (<g
2434
+ data-topo-hub
2435
+ style={{ cursor: 'pointer' }}
2436
+ // Stop pointerdown from reaching the SVG pan handler — same
2437
+ // reason as the node <g>: a captured pointer makes Chromium
2438
+ // fire the follow-up click on the SVG, not this group.
2439
+ onPointerDown={(e) => e.stopPropagation()}
2440
+ // Round 52 / Loop: hub is the visual anchor but had no click
2441
+ // action users discovered fit-to-content only via the `f`
2442
+ // key or the chrome button. Wire the hub to fitView() so the
2443
+ // most prominent element in the canvas is also the "re-
2444
+ // center" affordance. A click-ripple keyed by ts confirms
2445
+ // the gesture; the hub <title> now ends with a hint.
2446
+ onClick={() => {
2447
+ fitView();
2448
+ setClickRipple({ ts: Date.now(), x: cx, y: cy, r0: 18, color: isLight ? '#059669' : '#10b981' });
2449
+ setTimeout(() => setClickRipple(prev => prev && prev.x === cx && prev.y === cy ? null : prev), 600);
2450
+ }}
2451
+ >
2452
+ {/* Round 43 / Loop: hub `<title>` summary — hovering the
2453
+ central glow now answers "what is this?" with a one-line
2454
+ fleet snapshot. Duplicates the header chips by design;
2455
+ hovering the most visually prominent element is the
2456
+ most natural impulse, so satisfy it where the cursor
2457
+ already is. Falls clean: omits sub-clauses when their
2458
+ counts are zero. R52 appends a "click to fit view" hint.
2459
+ */}
2460
+ <title>{(() => {
2461
+ const total = sessions.length;
2462
+ const parts = [`Network hub`, `${total} session${total === 1 ? '' : 's'}`];
2463
+ if (onlineNodes.length > 0) parts.push(`${onlineNodes.length} online`);
2464
+ if (workingCount > 0) parts.push(`${workingCount} working`);
2465
+ if (flowLinks.length > 0) parts.push(`${flowLinks.length} active link${flowLinks.length === 1 ? '' : 's'}`);
2466
+ return parts.join(' · ') + '\nclick to fit view';
2467
+ })()}</title>
2468
+ {/* grounding halo — breathes in opacity, no expansion.
2469
+ R84: breath amplitude + tempo reflect workingCount. An
2470
+ idle fleet keeps the original gentle 0.32→0.52 (light) /
2471
+ 0.08→0.16 (dark) cycle over 4s — "heart at rest". As
2472
+ working sessions accumulate, the peak climbs and the
2473
+ period shortens, capped at 2.4s so it never feels
2474
+ manic. Quiet fleets see zero change; busy fleets feel
2475
+ the canvas working. */}
2476
+ {(() => {
2477
+ // Bucket workingCount to keep the visual feedback discrete
2478
+ // rather than continuous: 0 / 1-2 / 3-5 / 6+. Three buckets
2479
+ // are enough — finer gradations are imperceptible.
2480
+ const busy = workingCount === 0 ? 0
2481
+ : workingCount <= 2 ? 1
2482
+ : workingCount <= 5 ? 2
2483
+ : 3;
2484
+ const peakLight = [0.52, 0.58, 0.65, 0.72][busy];
2485
+ const peakDark = [0.16, 0.20, 0.26, 0.32][busy];
2486
+ const troughLight = 0.32;
2487
+ const troughDark = 0.08;
2488
+ const dur = [4.0, 3.2, 2.7, 2.4][busy];
2489
+ const valuesLight = `${troughLight};${peakLight};${troughLight}`;
2490
+ const valuesDark = `${troughDark};${peakDark};${troughDark}`;
2491
+ return (
2492
+ <circle
2493
+ cx={cx} cy={cy} r="18"
2494
+ fill={isLight ? '#d1fae5' : '#10b981'}
2495
+ opacity={isLight ? 0.42 : 0.12}
2496
+ data-hub-busyness={busy}
2497
+ >
2498
+ {!reducedMotion && (
2499
+ <animate
2500
+ attributeName="opacity"
2501
+ values={isLight ? valuesLight : valuesDark}
2502
+ dur={`${dur}s`}
2503
+ repeatCount="indefinite"
2504
+ />
2505
+ )}
2506
+ </circle>
2507
+ );
2508
+ })()}
1057
2509
  {/* core — 20px diameter, larger inner highlight reads as a "lit lamp" */}
1058
2510
  <circle cx={cx} cy={cy} r="10" fill={isLight ? '#059669' : '#10b981'} />
1059
2511
  <circle cx={cx} cy={cy} r="5" fill="#d1fae5" opacity="0.9" />
1060
2512
  </g>)}
1061
2513
 
1062
2514
  {/* agent nodes */}
1063
- {[...onlineNodes, ...offlineNodes].map(session => {
2515
+ {[...onlineNodes, ...offlineNodes].map((session, nodeIdx) => {
1064
2516
  const pos = nodePositions[session.alias];
1065
2517
  if (!pos) return null;
1066
2518
 
@@ -1080,11 +2532,30 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1080
2532
  // occlude an avatar), and the full card appears only for the
1081
2533
  // hovered node or once zoomed in past 1.4×.
1082
2534
  const showFullLabel = !denseLayout || hoveredAlias === session.alias || view.zoom >= 1.4;
2535
+ // Round 8: when a node in another group is hovered, fade this
2536
+ // one. Same-group nodes (incl. singletons matching the hovered
2537
+ // alias) stay full. Pure visual focus, geometry unchanged.
2538
+ const inFocus = !activeGroup || (groupKeys[session.alias] ?? session.alias) === activeGroup;
2539
+ // R72: in ring layout, classify the node into a tier by its
2540
+ // distance from hub centre so the first-paint stagger can
2541
+ // emanate inner → outer instead of running clockwise. Grid
2542
+ // layout doesn't have a radial structure; it keeps R9's pure
2543
+ // nodeIdx stagger. Thresholds bracket the actual tier radii
2544
+ // (single 220, dual 175/260, triple 145/215/285, offline 325+).
2545
+ let tierIdx = 0;
2546
+ if (layout === 'ring') {
2547
+ const p = nodePositions[session.alias];
2548
+ if (p) {
2549
+ const d = Math.hypot(p.x - cx, p.y - cy);
2550
+ tierIdx = d < 195 ? 0 : d < 270 ? 1 : d < 310 ? 2 : 3;
2551
+ }
2552
+ }
1083
2553
 
1084
2554
  return (
1085
2555
  <g
1086
2556
  key={session.alias}
1087
2557
  data-node={session.alias}
2558
+ data-tier-idx={layout === 'ring' ? tierIdx : -1}
1088
2559
  // Round 3 / Loop: `anet-fade-in` runs once when the <g>
1089
2560
  // mounts — a new session entering the fleet (or the topology
1090
2561
  // first rendering) eases in instead of popping. Re-renders of
@@ -1092,7 +2563,87 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1092
2563
  // via the alias key), so status changes don't flicker. The
1093
2564
  // global prefers-reduced-motion sweep already neutralises it.
1094
2565
  className="group transition-opacity anet-fade-in"
1095
- style={{ cursor: 'pointer' }}
2566
+ style={{
2567
+ cursor: 'pointer',
2568
+ // Round 17 / Loop: offline nodes drop to 0.6 at rest so
2569
+ // online nodes pop without losing the offline-as-ghost
2570
+ // information. The dashed stroke + smaller radius already
2571
+ // say "offline"; dimming the whole group strengthens the
2572
+ // online-vs-offline hierarchy at first glance. Exempt the
2573
+ // chat-focused node — if the user explicitly opened a
2574
+ // popover targeting an offline alias, that node stays
2575
+ // full-brightness so the focus ring + popover read as one
2576
+ // selected thing rather than a dimmed selection. Group-
2577
+ // hover fade (Round 8) still wins when inFocus is false.
2578
+ // Round 49 / Loop: edge-hover endpoint highlight composes
2579
+ // OVER the inFocus/online formula — a non-endpoint node
2580
+ // dims to 0.28 (just below the inFocus 0.32 to read as a
2581
+ // stronger "not relevant" signal), endpoints keep their
2582
+ // base opacity. chatAlias still wins to keep the focus
2583
+ // ring legible if the user clicked through.
2584
+ // Round 55 / Loop: legend-status hover composes on the
2585
+ // SAME level as edge-hover-endpoint. Non-matching nodes
2586
+ // dim to 0.28; matching nodes stay at their base.
2587
+ // activeStatus matches: working = status==='working',
2588
+ // idle = online but not working, offline = !isOnline.
2589
+ // Round 60 / Loop: activeStatus = hoveredStatus ?? pinnedStatus
2590
+ // so the pressure-bar segment pins (R60) and the legend
2591
+ // row hover (R55) feed the same branch.
2592
+ // Round 80 / Loop: vendor-letter hover composes ABOVE the
2593
+ // activeStatus branch so hovering the vendor chip's `C`
2594
+ // dims everything except C-vendor nodes. Same dim value
2595
+ // (0.28) as edge-endpoint and status filters — visually
2596
+ // consistent. Vendor lookup uses the same vendorForModel
2597
+ // helper the avatar render uses, keyed by initial so the
2598
+ // chip and the avatar always agree on grouping.
2599
+ opacity: hoveredEdgeEndpoints && !hoveredEdgeEndpoints.has(session.alias) && chatAlias !== session.alias
2600
+ ? 0.28
2601
+ : activeVendor && chatAlias !== session.alias && (() => {
2602
+ const v = vendorForModel(session.model);
2603
+ const initial = v.id === 'unknown' ? '?' : v.initial;
2604
+ return initial !== activeVendor;
2605
+ })()
2606
+ ? 0.28
2607
+ : activeStatus && chatAlias !== session.alias && !(
2608
+ activeStatus === 'working' ? session.status === 'working'
2609
+ : activeStatus === 'idle' ? (isOnline && session.status !== 'working')
2610
+ : /* offline */ !isOnline
2611
+ )
2612
+ ? 0.28
2613
+ : !inFocus
2614
+ ? 0.32
2615
+ : chatAlias === session.alias
2616
+ ? 1
2617
+ : isOnline ? 1 : 0.6,
2618
+ // Round 9 / Loop: stagger the anet-fade-in so the topology
2619
+ // reveals as a wave on first paint instead of one big pop.
2620
+ // Cap at 24 indices (≈600ms tail) so 50-node fleets still
2621
+ // finish revealing within a beat. CSS animation-delay only
2622
+ // applies during the keyframe — re-renders without a new
2623
+ // mount (same alias key) don't replay, so status changes
2624
+ // never trigger the stagger again.
2625
+ // Round 72 / Loop: in ring layout, stagger by tier radius
2626
+ // so the topology emanates from the hub outward — inner
2627
+ // tier at 0ms, middle at ~180ms, outer at ~360ms, offline
2628
+ // at ~540ms. A small within-tier offset (nodeIdx % 6 * 25)
2629
+ // adds variety so each ring rotates in instead of all-at-
2630
+ // once popping. Grid keeps R9's pure nodeIdx stagger.
2631
+ animationDelay: layout === 'ring'
2632
+ ? `${tierIdx * 180 + (nodeIdx % 6) * 25}ms`
2633
+ : `${Math.min(nodeIdx, 24) * 25}ms`,
2634
+ // Round 51 / Loop: hover micro-lift. The label already
2635
+ // lifts on group-hover (R26). The node body — circle,
2636
+ // avatar, status ring — stays planted, so the gesture
2637
+ // reads "label moves, body doesn't". Now the whole <g>
2638
+ // translates -2px when hovered: avatar + ring + label
2639
+ // move as one unit. 2 px is well inside the inter-row
2640
+ // gap (cellH headroom ≥22), and CSS transform on SVG
2641
+ // <g> never affects the overlap-test geometry (the
2642
+ // test never simulates hover). useReducedMotion drops
2643
+ // the lift to 0 for prefers-reduced-motion users.
2644
+ transform: !reducedMotion && hoveredAlias === session.alias ? 'translateY(-2px)' : undefined,
2645
+ transition: 'transform 180ms cubic-bezier(0.4,0,0.2,1)',
2646
+ }}
1096
2647
  // Stop the pointerdown from reaching the SVG pan handler: the
1097
2648
  // SVG calls setPointerCapture, and a captured pointer makes
1098
2649
  // Chromium fire the follow-up `click` on the SVG instead of
@@ -1100,14 +2651,71 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1100
2651
  // Side effect (intended): you pan from empty canvas, not by
1101
2652
  // grabbing a node.
1102
2653
  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)}
2654
+ // Track hover globally (not just under denseLayout) so the
2655
+ // Round 8 group-focus fade works at any fleet size.
2656
+ onPointerEnter={() => setHoveredAlias(session.alias)}
2657
+ onPointerLeave={() => setHoveredAlias(prev => (prev === session.alias ? null : prev))}
2658
+ onClick={() => {
2659
+ setChatAlias(session.alias);
2660
+ // Round 14 ripple — capture position, radius and status
2661
+ // colour at click time so the one-shot circle is self-
2662
+ // contained (no re-render-time recomputation needed).
2663
+ setClickRipple({
2664
+ ts: Date.now(),
2665
+ x: pos.x, y: pos.y, r0: radius,
2666
+ color: status.primary,
2667
+ });
2668
+ setTimeout(() => setClickRipple(prev =>
2669
+ prev && Date.now() - prev.ts >= 590 ? null : prev), 600);
2670
+ }}
1106
2671
  >
1107
2672
  {/* Issue #96: native hover tooltip — "Vendor · model · Runtime".
1108
2673
  Falls back to just the alias when the node reports no
1109
- model/runtime. */}
1110
- <title>{identityLine(session.model, session.runtime) || session.alias}</title>
2674
+ model/runtime.
2675
+ Round 33 / Loop: cwd line answers "what is this agent on?".
2676
+ Round 34 / Loop: for offline nodes, append "last seen: 6m ago"
2677
+ so the operator knows whether to wait or chase. Online nodes
2678
+ skip the line (Round 27's 1 h ghost age-out means anything
2679
+ still online has heartbeated recently — the line would just
2680
+ be noise). Accepts both ISO ("…T06:00:28Z") and SQL-style
2681
+ ("… 06:00:28" assumed UTC) formats. */}
2682
+ {(() => {
2683
+ // Round 35 / Loop: TZ-safe parsing via the shared lib helper
2684
+ // — same parseHubTime is used by isGhost above (Round 38
2685
+ // factored it to app/lib/time.ts so both paths interpret SQL
2686
+ // bare timestamps as UTC on every browser).
2687
+ const lastSeen = !isOnline && session.last_seen_at ? relativeAgo(session.last_seen_at) : null;
2688
+ // Round 98 / Loop: enrich the node tooltip with status,
2689
+ // group membership, and inbound/outbound flow counts —
2690
+ // same info-density spirit as R97 active-filter pill
2691
+ // tooltips. Hovering any node now answers "what is this
2692
+ // and how does it sit in the topology" without forcing
2693
+ // a click into the chat popover. Group line only shows
2694
+ // when the alias is part of a multi-member band (R106
2695
+ // prefix grouping); singletons skip it. Flow line only
2696
+ // when at least one direction has count > 0.
2697
+ const groupKey = groupKeys[session.alias];
2698
+ const groupMembers = groupKey
2699
+ ? Object.values(groupKeys).filter(k => k === groupKey).length
2700
+ : 1;
2701
+ const groupLine = groupMembers > 1 ? `group: ${groupKey} · ${groupMembers}` : null;
2702
+ let flowIn = 0, flowOut = 0;
2703
+ for (const fl of flowLinks) {
2704
+ if (fl.from === session.alias) flowOut += fl.count;
2705
+ if (fl.to === session.alias) flowIn += fl.count;
2706
+ }
2707
+ const flowLine = (flowIn + flowOut) > 0 ? `flows: ${flowIn} in / ${flowOut} out` : null;
2708
+ return (
2709
+ <title>{[
2710
+ `${session.alias} · ${session.status}`,
2711
+ identityLine(session.model, session.runtime),
2712
+ groupLine,
2713
+ session.project_dir ? `cwd: ${session.project_dir}` : null,
2714
+ lastSeen ? `last seen: ${lastSeen}` : null,
2715
+ flowLine,
2716
+ ].filter(Boolean).join('\n')}</title>
2717
+ );
2718
+ })()}
1111
2719
  {/* Round 2 / Loop: hover ring — a thin outer stroke that fades
1112
2720
  in when the cursor enters the node, signalling clickability
1113
2721
  (real-user feedback for the chat-popover open). Pure CSS via
@@ -1127,7 +2735,29 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1127
2735
  className="opacity-0 group-hover:opacity-70 transition-opacity duration-150"
1128
2736
  style={{ pointerEvents: 'none' }}
1129
2737
  />
1130
- {isActive && (
2738
+ {/* Round 11 / Loop: chat-focus ring — when the ChatPopover is
2739
+ open targeting this node, anchor a persistent ring around
2740
+ it so the floating popover visibly links back to its source
2741
+ node. Static (not pulsing) so it reads as "selected state"
2742
+ rather than "this node is active". strokeWidth=2.5 stays
2743
+ clear of the overlap-test selectors (1.5 / 3). Sits just
2744
+ outside the halo radius+8 so it never overlaps a neighbour
2745
+ (halos already pack flush in dense grids). */}
2746
+ {chatAlias === session.alias && (
2747
+ <circle
2748
+ cx={pos.x}
2749
+ cy={pos.y}
2750
+ r={radius + 14}
2751
+ fill="none"
2752
+ stroke={status.primary}
2753
+ strokeWidth="2.5"
2754
+ opacity={isLight ? 0.85 : 0.95}
2755
+ filter={!isLight ? 'url(#topo-glow)' : undefined}
2756
+ className="transition-opacity duration-200"
2757
+ style={{ pointerEvents: 'none' }}
2758
+ />
2759
+ )}
2760
+ {isActive && !reducedMotion && (
1131
2761
  <circle cx={pos.x} cy={pos.y} r={radius + 14} fill={status.primary} opacity={isLight ? 0.08 : 0.12}>
1132
2762
  <animate attributeName="r" values={`${radius + 8};${radius + 22};${radius + 8}`} dur="2.4s" repeatCount="indefinite" />
1133
2763
  <animate attributeName="opacity" values={isLight ? '0.12;0.02;0.12' : '0.18;0.04;0.18'} dur="2.4s" repeatCount="indefinite" />
@@ -1135,7 +2765,14 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1135
2765
  )}
1136
2766
  {/* Round 4 / Loop: transition-[fill,stroke,opacity] smooths
1137
2767
  status colour changes so idle↔working↔offline doesn't snap
1138
- — task replies / node-rename / SSE updates ease in. */}
2768
+ — task replies / node-rename / SSE updates ease in.
2769
+ Round 112 / Loop: working nodes get a subtle halo breath
2770
+ (±0.12 opacity at 3s cycle) so the eye can find "what's
2771
+ busy" at a glance without scanning chips. Idle + offline
2772
+ halos stay flat — they don't need to demand attention.
2773
+ R84 hub-center breath stays the loudest "fleet busyness"
2774
+ signal; this one is quieter, per-node. SMIL `<animate>`
2775
+ inside the circle, gated by reducedMotion. */}
1139
2776
  <circle
1140
2777
  cx={pos.x}
1141
2778
  cy={pos.y}
@@ -1143,7 +2780,39 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1143
2780
  fill={status.halo}
1144
2781
  opacity={isOnline ? (isLight ? 0.85 : 0.65) : (isLight ? 0.4 : 0.25)}
1145
2782
  className="transition-[fill,opacity] duration-300 ease-out"
1146
- />
2783
+ data-node-halo-breath={!reducedMotion && session.status === 'working' ? 'on' : 'off'}
2784
+ >
2785
+ {!reducedMotion && session.status === 'working' && (
2786
+ <animate
2787
+ attributeName="opacity"
2788
+ values={isLight ? '0.73;0.92;0.73' : '0.53;0.78;0.53'}
2789
+ dur="3s"
2790
+ repeatCount="indefinite"
2791
+ />
2792
+ )}
2793
+ </circle>
2794
+ {/* Round 111 / Loop: edge-endpoint emphasis ring. R49
2795
+ already keeps endpoint nodes at opacity 1 while
2796
+ others dim when an edge is hovered, but the
2797
+ endpoints had no POSITIVE indicator — they just
2798
+ "stayed bright". An accent stroke at r=radius+7
2799
+ (just inside the halo's r=radius+8 bbox so we
2800
+ don't grow the overlap footprint) clearly says
2801
+ "these are the two participants in this flow".
2802
+ pointerEvents:none so the node hitbox stays alive. */}
2803
+ {hoveredEdgeEndpoints && hoveredEdgeEndpoints.has(session.alias) && (
2804
+ <circle
2805
+ cx={pos.x}
2806
+ cy={pos.y}
2807
+ r={radius + 7}
2808
+ fill="none"
2809
+ stroke={pal.flowEdge}
2810
+ strokeWidth={1.5}
2811
+ opacity={isLight ? 0.9 : 0.85}
2812
+ data-edge-endpoint-ring
2813
+ style={{ pointerEvents: 'none', transition: 'opacity 180ms ease-out' }}
2814
+ />
2815
+ )}
1147
2816
  <circle
1148
2817
  cx={pos.x}
1149
2818
  cy={pos.y}
@@ -1240,52 +2909,115 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1240
2909
  </g>
1241
2910
  );
1242
2911
  })()}
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
- )}
2912
+ {session.status === 'working' && (() => {
2913
+ // Round 24 / Loop: pulse rate traffic. The dot's dur
2914
+ // was a flat 1.1s every working node looked equally
2915
+ // busy. Mapping it to sse:N lets the eye land on what's
2916
+ // actually hot. 3 discrete tiers read cleaner than
2917
+ // continuous easing at a glance; thresholds picked so
2918
+ // typical 1-2-SSE Claude/Codex sessions stay in the
2919
+ // "active" tier and only multi-pane orchestrators pop
2920
+ // into the "busy" tier. Geometry unchanged (r=2.5).
2921
+ const sse = sseCountFor ?? 0;
2922
+ const dur = sse >= 4 ? '0.7s' : sse >= 2 ? '0.9s' : '1.2s';
2923
+ return (
2924
+ <circle cx={pos.x} cy={pos.y - (radius - 6)} r="2.5" fill={pal.flowParticle} data-pulse-dur={dur} opacity={reducedMotion ? 0.6 : undefined}>
2925
+ {!reducedMotion && (
2926
+ <animate attributeName="opacity" values="1;0.25;1" dur={dur} repeatCount="indefinite" />
2927
+ )}
2928
+ </circle>
2929
+ );
2930
+ })()}
1252
2931
 
1253
2932
  {/* Round 98 (issue #61): label rect 124px → 100px.
1254
2933
  Round 109/110 (Vincent P0): full opaque card below the
1255
2934
  density threshold / on hover / when zoomed; otherwise a
1256
2935
  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}` : ''}
2936
+ labelled without an opaque box covering its neighbours.
2937
+ Round 15 / Loop: when nodeScale=S the node shrinks 30%
2938
+ but the label card was staying full-size, so the label
2939
+ visually outweighed the small node. Tighten the card
2940
+ frame, alias / sub fontSize, drop-offset and truncate
2941
+ length specifically for S; M and L keep their existing
2942
+ sizes (M ≈ L for labels by design — the S user is the
2943
+ one who explicitly asked for a denser view). */}
2944
+ {(() => {
2945
+ const isSmall = nodeScale < 0.8;
2946
+ const cardW = isSmall ? 88 : 100;
2947
+ const cardH = isSmall ? 36 : 42;
2948
+ const cardTopY = isSmall ? -12 : -14;
2949
+ const aliasFs = isSmall ? 11 : 12;
2950
+ const subFs = isSmall ? 8 : 9;
2951
+ const subY = isSmall ? 15 : 17;
2952
+ const dropY = isSmall ? 18 : 22;
2953
+ const fullMax = isSmall ? 11 : 12;
2954
+ const denseFs = isSmall ? 9 : 10;
2955
+ const denseDrop = isSmall ? 12 : 14;
2956
+ // Round 26 / Loop: micro-lift the label group on hover —
2957
+ // 1.5 px upward, 200 ms ease. Pairs with the Round 18
2958
+ // group-box hover-accent treatment to give the same
2959
+ // "this is the focused element" feedback at the per-
2960
+ // node level. CSS transform stacks onto the SVG
2961
+ // positioning transform attribute (SVG 2 cascade);
2962
+ // bbox is unchanged at rest, so the overlap-test gate
2963
+ // continues to see the geometric layout it expects.
2964
+ return showFullLabel ? (
2965
+ <g transform={`translate(${pos.x}, ${pos.y + radius + dropY})`} style={{ pointerEvents: 'none' }}
2966
+ className="transition-transform duration-200 group-hover:-translate-y-[1.5px]">
2967
+ <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} />
2968
+ <text x="0" y="1" textAnchor="middle" fill={status.text} fontSize={aliasFs} fontFamily="monospace" fontWeight="700">
2969
+ {truncate(session.alias, fullMax)}
2970
+ </text>
2971
+ <text x="0" y={subY} textAnchor="middle" fill={status.primary} fontSize={subFs} fontFamily="monospace">
2972
+ {status.label}{isOnline && sseCountFor != null ? ` sse:${sseCountFor}` : ''}
2973
+ </text>
2974
+ </g>
2975
+ ) : (
2976
+ <text
2977
+ x={pos.x}
2978
+ y={pos.y + radius + denseDrop}
2979
+ textAnchor="middle"
2980
+ fill={status.text}
2981
+ fontSize={denseFs}
2982
+ fontFamily="monospace"
2983
+ fontWeight="700"
2984
+ opacity={0.9}
2985
+ className="transition-transform duration-200 group-hover:-translate-y-[1.5px]"
2986
+ style={{ pointerEvents: 'none', paintOrder: 'stroke' }}
2987
+ stroke={pal.containerBg}
2988
+ strokeWidth="3"
2989
+ >
2990
+ {truncate(session.alias, isSmall ? 9 : 10)}
1266
2991
  </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
- )}
2992
+ );
2993
+ })()}
1285
2994
  </g>
1286
2995
  );
1287
2996
  })}
1288
2997
 
2998
+ {/* Round 14 / Loop: click ripple — one-shot expanding ring from
2999
+ the clicked node, ~500ms, status-coloured. Sits inside the
3000
+ zoom/pan <g> so it scales / pans with the topology. Keyed by
3001
+ ts so a re-click on any node (same or different) remounts the
3002
+ <circle> and the SMIL <animate> elements replay from t=0.
3003
+ strokeWidth=2 doesn't match the overlap-test selectors. */}
3004
+ {clickRipple && !reducedMotion && (
3005
+ <circle
3006
+ key={clickRipple.ts}
3007
+ cx={clickRipple.x}
3008
+ cy={clickRipple.y}
3009
+ r={clickRipple.r0 + 4}
3010
+ fill="none"
3011
+ stroke={clickRipple.color}
3012
+ strokeWidth="2"
3013
+ opacity="0"
3014
+ style={{ pointerEvents: 'none' }}
3015
+ >
3016
+ <animate attributeName="r" values={`${clickRipple.r0 + 4};${clickRipple.r0 + 30}`} dur="0.5s" fill="freeze" />
3017
+ <animate attributeName="opacity" values="0.7;0" dur="0.5s" fill="freeze" />
3018
+ </circle>
3019
+ )}
3020
+
1289
3021
  </g>
1290
3022
 
1291
3023
  {/* #112: overlay panels (recent-signal + legend) render OUTSIDE the
@@ -1296,30 +3028,314 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1296
3028
  corner triangles, so the panels never overlap a node, in ring
1297
3029
  OR grid layout (Vincent 4727 zero-overlap criterion). */}
1298
3030
  {/* latest flow labels */}
3031
+ {/* Round 57 / Loop: drop-shadow on the panel rects gives them
3032
+ card-like elevation, especially on light theme where the
3033
+ near-white fill on a near-white canvas read as pasted-on.
3034
+ data-topo-panel-elevation tag so the test can verify both
3035
+ panels carry the filter. The filter is on the rect, not
3036
+ the parent <g>, so it doesn't shadow the rows + text inside
3037
+ — only the panel chrome lifts. */}
1299
3038
  <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} />
3039
+ <rect
3040
+ x="0" y="0" width="230" height="84" rx="10"
3041
+ fill={pal.legendBox.fill}
3042
+ stroke={pal.legendBox.stroke}
3043
+ opacity={isLight ? 0.97 : 0.92}
3044
+ 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))' }}
3045
+ data-topo-panel-elevation="recent"
3046
+ />
1301
3047
  <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
- ))}
3048
+ {/* R96: header count now matches what the rows show. Pre-R96
3049
+ this read "X msgs" off the raw messages array, but the
3050
+ rows below render DEDUPED flowLinks so a fleet with 10
3051
+ messages aggregating to 3 pairs read "10 msgs" above
3052
+ only 3 rows. Misreads as "where are the other 7?".
3053
+ "X flows" mirrors flowLinks.length one-for-one. When
3054
+ flows < msgs the chip-row's "N active links · last 2s"
3055
+ already tells the operator about traffic volume — no
3056
+ duplicate metric needed here. */}
3057
+ <text x="150" y="21" fill={pal.legendAccent} fontSize="10" fontFamily="monospace" data-recent-panel-count>{flowLinks.length} flows</text>
3058
+ {/* Round 45 / Loop: empty state. The panel used to render
3059
+ "recent signal" + "0 msgs" with three blank slots below
3060
+ when no flow yet — read as "broken" rather than "quiet".
3061
+ A muted centred placeholder makes the empty state
3062
+ deliberate. Messages count CAN diverge from flowLinks
3063
+ count (raw count vs. deduped pairs), so the placeholder
3064
+ fires on flowLinks.length=0 specifically. */}
3065
+ {flowLinks.length === 0 ? (
3066
+ /* R45 placeholder. R110: add a sub-text hint so the
3067
+ empty state explains what it's empty OF — operators
3068
+ looking at "no flow yet" sometimes mistook it for
3069
+ a connection error. The sub-line reads as a quiet
3070
+ invitation, not an error. Two-line layout uses
3071
+ standard SVG <text>+<text> rather than tspan so the
3072
+ y-coordinates are explicit and the data-attr selector
3073
+ still finds the primary line. */
3074
+ <>
3075
+ <text x="115" y="54" textAnchor="middle" fill={pal.legendText} fontSize="10" fontFamily="monospace" fontStyle="italic" opacity={0.65} data-recent-signal-empty>
3076
+ no flow yet
3077
+ </text>
3078
+ <text x="115" y="68" textAnchor="middle" fill={pal.legendText} fontSize="8" fontFamily="monospace" opacity={0.45} data-recent-signal-empty-hint>
3079
+ send a message between agents
3080
+ </text>
3081
+ </>
3082
+ ) : (
3083
+ // Round 56 / Loop: each row is a navigator into the canvas.
3084
+ // Hover a row → set hoveredEdgeKey, which the existing R50
3085
+ // edge-focus + R49 endpoint-highlight ladders consume. The
3086
+ // matching flow edge brightens to 2× + thickens, its two
3087
+ // endpoint nodes stay full opacity, and every other edge +
3088
+ // non-endpoint node dims. Released → all restore. Wrapping
3089
+ // <g> + a transparent 218×14 hitbox so the cursor doesn't
3090
+ // have to land precisely on the truncated text.
3091
+ flowLinks.slice(0, 3).map((link, index) => {
3092
+ // Round 94 / Loop: per-row relative timestamp. The chip
3093
+ // row shows "last 2s" for the most recent flow overall,
3094
+ // but a user scanning the recent-signal panel had no way
3095
+ // to tell whether row 2 was 5s old or 5m old without
3096
+ // hovering nodes. Compact `2s` / `1m` glyph at the
3097
+ // right edge — same relativeAgo helper R42 uses for
3098
+ // the chip — pulls double duty as a recency anchor and
3099
+ // a sortedness hint (top row is freshest by construction).
3100
+ // Strip the " ago" suffix — at fontSize=8 in a 32-px
3101
+ // right-edge slot, every char counts. "30s ago" → "30s".
3102
+ const rawAt = link.last_at ? relativeAgo(link.last_at) : null;
3103
+ const lastAt = rawAt ? rawAt.replace(/\s+ago$/, '') : null;
3104
+ const isRowHovered = hoveredEdgeKey === link.key;
3105
+ return (
3106
+ <g
3107
+ key={link.key}
3108
+ data-recent-row={link.key}
3109
+ data-recent-row-hovered={isRowHovered ? 'true' : 'false'}
3110
+ style={{ cursor: 'pointer' }}
3111
+ onMouseEnter={() => setHoveredEdgeKey(link.key)}
3112
+ onMouseLeave={() => setHoveredEdgeKey(prev => prev === link.key ? null : prev)}
3113
+ >
3114
+ {/* R104: subtle row-background tint on hover. R56
3115
+ already brightens the matching edge on the canvas,
3116
+ but the panel row itself stayed flat — felt more
3117
+ like text-with-handlers than a navigable list.
3118
+ Filling the rect at hover with `pal.legendAccent`
3119
+ at low alpha gives the row visual feedback at the
3120
+ source surface, mirroring the list-item idiom from
3121
+ the chip-row pills. */}
3122
+ <rect
3123
+ x="6" y={38 + index * 16 - 10}
3124
+ width="218" height="14" rx="3"
3125
+ fill={isRowHovered ? pal.legendAccent : 'transparent'}
3126
+ opacity={isRowHovered ? (isLight ? 0.10 : 0.14) : 1}
3127
+ style={{ transition: 'fill 150ms ease-out, opacity 150ms ease-out' }}
3128
+ />
3129
+ <text
3130
+ x="13" y={38 + index * 16}
3131
+ fill={hoveredEdgeKey === link.key ? pal.legendHeadline : pal.legendText}
3132
+ fontSize="9"
3133
+ fontFamily="monospace"
3134
+ style={{ transition: 'fill 150ms ease-out' }}
3135
+ >
3136
+ {truncate(link.from, 6)} {'->'} {truncate(link.to, 6)} / {link.count} / {truncate(link.content, 8)}
3137
+ </text>
3138
+ {lastAt ? (
3139
+ <text
3140
+ x="217" y={38 + index * 16}
3141
+ textAnchor="end"
3142
+ fill={pal.legendText}
3143
+ fontSize="8"
3144
+ fontFamily="monospace"
3145
+ opacity={0.55}
3146
+ data-recent-row-ts={link.key}
3147
+ style={{ pointerEvents: 'none' }}
3148
+ >
3149
+ {lastAt}
3150
+ </text>
3151
+ ) : null}
3152
+ </g>
3153
+ );
3154
+ })
3155
+ )}
1308
3156
  </g>
1309
3157
 
1310
- {/* legend */}
3158
+ {/* legend — Round 55 / Loop: each status row is now a hover
3159
+ target. Pointer enter sets `hoveredStatus`; pointer leave
3160
+ clears it. Node opacity formula composes the match below.
3161
+ The row text brightens to legendHeadline while hovered as
3162
+ a small affordance hint. Geometry unchanged — the new
3163
+ <g> wrappers only carry pointer handlers. */}
1311
3164
  <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)" />
3165
+ {/* R57: matching drop-shadow elevation to the legend panel.
3166
+ R106: panel height grew 96 104 to seat the new header
3167
+ line + 4 px row-shift below it (so the new header text
3168
+ doesn't overlap the row-1 hitbox region). */}
3169
+ <rect
3170
+ x="0" y="0" width="224" height="104" rx="10"
3171
+ fill={pal.legendBox.fill}
3172
+ stroke={pal.legendBox.stroke}
3173
+ opacity={isLight ? 0.97 : 0.92}
3174
+ 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))' }}
3175
+ data-topo-panel-elevation="legend"
3176
+ />
3177
+ {/* R106 / Loop: panel header — symmetric with the recent-
3178
+ signal panel's "recent signal · N flows" (R96). Same
3179
+ font + position vocabulary so the two side panels feel
3180
+ paired. Title text at x=13 y=21; total fleet count
3181
+ right-aligned at x=215 y=21 in the accent colour. */}
3182
+ <text x="13" y="21" fill={pal.legendHeadline} fontSize="12" fontFamily="monospace" fontWeight="700">legend</text>
3183
+ <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>
3184
+ {(() => {
3185
+ const idleCount = onlineNodes.length - workingCount;
3186
+ // R106: rows shift +8 px (was y0=24, 48, 72 → 32, 56, 80)
3187
+ // to clear the new header row. R57 panel rect grew 96 →
3188
+ // 104 to seat them.
3189
+ const rows = [
3190
+ { key: 'working' as const, y0: 32, y1: 36, fill: isLight ? '#059669' : '#22c55e', label: 'working node', count: workingCount },
3191
+ { key: 'idle' as const, y0: 56, y1: 60, fill: isLight ? '#0d9488' : '#2dd4bf', label: 'online idle', count: idleCount },
3192
+ { key: 'offline' as const, y0: 80, y1: 84, fill: isLight ? '#94a3b8' : '#6b7280', label: 'offline / no SSE', count: offlineNodes.length },
3193
+ ];
3194
+ return rows;
3195
+ })().map(row => {
3196
+ // Round 61 / Loop: legend rows pin too — symmetric with the
3197
+ // R60 pressure-bar segments. R55 hover stays transient; the
3198
+ // new onClick toggles pinnedStatus so users can lock a
3199
+ // filter without holding the cursor still. Pinned row gets
3200
+ // an inset ring on the swatch (same vocab as R60).
3201
+ const isPinned = pinnedStatus === row.key;
3202
+ return (
3203
+ <g
3204
+ key={row.key}
3205
+ data-legend-status={row.key}
3206
+ role="button"
3207
+ tabIndex={0}
3208
+ aria-pressed={isPinned}
3209
+ style={{ cursor: 'pointer' }}
3210
+ // R61: stopPropagation on pointerdown so the SVG-level
3211
+ // pan handler (R103) doesn't setPointerCapture and
3212
+ // redirect the follow-up click away from this <g>.
3213
+ // Same trick the node <g> uses (and R52 hub).
3214
+ onPointerDown={(e) => e.stopPropagation()}
3215
+ onMouseEnter={() => setHoveredStatus(row.key)}
3216
+ onMouseLeave={() => setHoveredStatus(prev => prev === row.key ? null : prev)}
3217
+ onClick={() => setPinnedStatus(prev => prev === row.key ? null : row.key)}
3218
+ >
3219
+ {/* R55 hitbox covers the row so cursor doesn't need to
3220
+ be exactly on the 5-px swatch. R105 / Loop: the
3221
+ hitbox now also carries a subtle hover/pin tint —
3222
+ mirroring R104's recent-signal row treatment so
3223
+ both side panels share the list-item idiom. The
3224
+ tint borrows the ROW'S OWN swatch colour rather
3225
+ than legendAccent, so the user's eye associates
3226
+ the tinted row with its colour swatch instead of
3227
+ a generic accent. Pin is a stronger tint than
3228
+ hover; idle stays fully transparent. */}
3229
+ <rect
3230
+ x="6" y={row.y0 - 12}
3231
+ width="170" height="22" rx="3"
3232
+ fill={hoveredStatus === row.key || isPinned ? row.fill : 'transparent'}
3233
+ opacity={isPinned ? (isLight ? 0.14 : 0.18)
3234
+ : hoveredStatus === row.key ? (isLight ? 0.08 : 0.12)
3235
+ : 1}
3236
+ data-legend-row-tinted={isPinned ? 'pinned' : hoveredStatus === row.key ? 'hover' : 'none'}
3237
+ style={{ transition: 'fill 150ms ease-out, opacity 150ms ease-out' }}
3238
+ />
3239
+ <circle cx="16" cy={row.y0} r="5.5" fill={row.fill} />
3240
+ {/* R61 pinned-state ring — concentric stroke at r=8 in
3241
+ the row colour, draws OUTSIDE the swatch so it
3242
+ doesn't fight the fill colour the user is matching. */}
3243
+ {isPinned && (
3244
+ <circle cx="16" cy={row.y0} r="8" fill="none" stroke={row.fill} strokeWidth="1.5" />
3245
+ )}
3246
+ <text
3247
+ x="30" y={row.y1}
3248
+ fill={hoveredStatus === row.key || isPinned ? pal.legendHeadline : pal.legendText}
3249
+ fontSize="11"
3250
+ fontFamily="monospace"
3251
+ style={{ transition: 'fill 150ms ease-out' }}
3252
+ >{row.label}</text>
3253
+ {/* R95: live count anchored to the right edge of the
3254
+ panel (x=215, after the flow-arrow swatch). Same
3255
+ counts the chip-row shows ("3 working" etc.) but
3256
+ here next to the swatch the user is matching —
3257
+ saves crossing the canvas to the chip row for
3258
+ the number. text-anchor=end aligns the column
3259
+ visually like a table. pointerEvents:none so the
3260
+ count doesn't intercept the row hover hitbox. */}
3261
+ <text
3262
+ x="215" y={row.y1}
3263
+ textAnchor="end"
3264
+ fill={pal.legendText}
3265
+ fontSize="11"
3266
+ fontFamily="monospace"
3267
+ opacity={hoveredStatus === row.key || isPinned ? 0.95 : 0.65}
3268
+ data-legend-count={row.key}
3269
+ style={{ pointerEvents: 'none', transition: 'opacity 150ms ease-out' }}
3270
+ >{row.count}</text>
3271
+ </g>
3272
+ );
3273
+ })}
3274
+ {/* Flow-arrow swatch tracks the offline row — R106 shifted
3275
+ rows down by 8 px to make space for the panel header so
3276
+ this moves from y=72 to y=80. Drop its pointerEvents so
3277
+ the offline legend row stays hoverable (R55). It's
3278
+ decoration, no need to receive events. */}
3279
+ <path d="M140,80 Q164,56 196,80" fill="none" stroke={pal.flowEdge} strokeWidth="3" markerEnd="url(#topo-arrow)" style={{ pointerEvents: 'none' }} />
1320
3280
  </g>
1321
3281
  </svg>
1322
3282
 
3283
+ {/* Round 30 / Loop: minimap. Big fleets in fullscreen mode at high
3284
+ zoom let users lose their position — the minimap shows the
3285
+ whole topology miniaturised plus a viewport rectangle so the
3286
+ user always knows where they are. Click anywhere to recenter
3287
+ the canvas there. Only mounted when the view is non-default
3288
+ (zoomed or panned) since at 1× centered the minimap and the
3289
+ canvas show the same thing. HTML overlay so it stays fixed
3290
+ while the SVG transforms. */}
3291
+ {(() => {
3292
+ const isDefaultView = Math.abs(view.zoom - 1) < 0.01 && Math.abs(view.x) < 1 && Math.abs(view.y) < 1;
3293
+ if (isDefaultView || (onlineNodes.length + offlineNodes.length) === 0) return null;
3294
+ const MW = 120, MH = 82;
3295
+ const sx = MW / VIEWBOX_W, sy = MH / VIEWBOX_H;
3296
+ const rectX = (-view.x / view.zoom) * sx;
3297
+ const rectY = (-view.y / view.zoom) * sy;
3298
+ const rectW = (VIEWBOX_W / view.zoom) * sx;
3299
+ const rectH = (VIEWBOX_H / view.zoom) * sy;
3300
+ return (
3301
+ <div
3302
+ className="absolute right-3 rounded-md border shadow-lg shadow-black/30 overflow-hidden anet-fade-in"
3303
+ style={{ bottom: 56, background: pal.legendBox.fill, borderColor: pal.containerBorder, cursor: 'crosshair' }}
3304
+ role="img"
3305
+ aria-label="Topology minimap — click to recenter"
3306
+ title="Minimap · click to recenter"
3307
+ onClick={(e) => {
3308
+ const r = e.currentTarget.getBoundingClientRect();
3309
+ const fx = (e.clientX - r.left) / r.width;
3310
+ const fy = (e.clientY - r.top) / r.height;
3311
+ setView(prev => ({
3312
+ ...prev,
3313
+ x: VIEWBOX_W / 2 - fx * VIEWBOX_W * prev.zoom,
3314
+ y: VIEWBOX_H / 2 - fy * VIEWBOX_H * prev.zoom,
3315
+ }));
3316
+ }}
3317
+ data-topo-minimap
3318
+ >
3319
+ <svg width={MW} height={MH} viewBox={`0 0 ${MW} ${MH}`} style={{ display: 'block' }}>
3320
+ {[...onlineNodes, ...offlineNodes].map(s => {
3321
+ const p = nodePositions[s.alias];
3322
+ if (!p) return null;
3323
+ const sseN = (s.network_id ? sseSessions[`${s.network_id}:${s.alias}`] : undefined) ?? sseSessions[s.alias];
3324
+ const isOn = s.status !== 'offline' || !!sseN;
3325
+ const st = nodeStatus(s, isOn, isLight);
3326
+ 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} />;
3327
+ })}
3328
+ {/* viewport rectangle */}
3329
+ <rect
3330
+ x={Math.max(0, rectX)} y={Math.max(0, rectY)}
3331
+ width={Math.max(0, Math.min(MW - Math.max(0, rectX), rectW))}
3332
+ height={Math.max(0, Math.min(MH - Math.max(0, rectY), rectH))}
3333
+ fill="none" stroke={pal.legendAccent} strokeWidth="1" opacity="0.9"
3334
+ />
3335
+ </svg>
3336
+ </div>
3337
+ );
3338
+ })()}
1323
3339
  {/* Round 103 (issue #81): zoom / pan / fullscreen controls — HTML
1324
3340
  overlay so they stay fixed while the SVG content transforms.
1325
3341
  Round 104: Vincent 实测 — the reset action used to be hidden
@@ -1356,6 +3372,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1356
3372
  className="px-2 py-1 hover:bg-white/5 transition-colors"
1357
3373
  style={{ color: pal.legendText }}
1358
3374
  aria-label="Zoom out"
3375
+ title="Zoom out (−)"
1359
3376
  >
1360
3377
  <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
3378
  </button>
@@ -1371,6 +3388,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1371
3388
  className="px-2 py-1 hover:bg-white/5 transition-colors"
1372
3389
  style={{ color: pal.legendText }}
1373
3390
  aria-label="Zoom in"
3391
+ title="Zoom in (+)"
1374
3392
  >
1375
3393
  <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
3394
  </button>
@@ -1380,7 +3398,7 @@ export function TopoGraph({ sessions, sseSessions, renameSignal }: TopoGraphProp
1380
3398
  className="p-1.5 rounded-md border hover:bg-white/5 transition-colors"
1381
3399
  style={{ background: pal.legendBox.fill, borderColor: pal.containerBorder, color: pal.legendText }}
1382
3400
  aria-label="Reset view"
1383
- title="Reset zoom + pan (or double-click the canvas)"
3401
+ title="Reset zoom + pan (0, or double-click the canvas)"
1384
3402
  >
1385
3403
  <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
1386
3404
  <path d="M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.4 2.6L3 8" />