@sleep2agi/agent-network-dashboard 0.4.6-preview.10 → 0.4.6-preview.101

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