@sleep2agi/agent-network-dashboard 0.4.6-preview.13 → 0.4.6-preview.130

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