@sleep2agi/agent-network-dashboard 0.4.6-preview.8 → 0.4.6

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 (259) 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/03o.h6kvmw4l_.js +1 -0
  182. package/.next/static/chunks/03~~oirxz7~vc.js +1 -0
  183. package/.next/static/chunks/05uk96gc~9mni.js +1 -0
  184. package/.next/static/chunks/088ouqy7tekty.js +2 -0
  185. package/.next/static/chunks/08kf-.bgs10ze.js +1 -0
  186. package/.next/static/chunks/0glmrdj9112tc.js +7 -0
  187. package/.next/static/chunks/0hyl7mdapsz38.js +1 -0
  188. package/.next/static/chunks/0mqwn-l7wtcdo.js +7 -0
  189. package/.next/static/chunks/0rxrez_cjn.eh.js +1 -0
  190. package/.next/static/chunks/0tvn2l1pc.h65.js +1 -0
  191. package/.next/static/chunks/0x8x.29hkju5a.js +1 -0
  192. package/.next/static/chunks/127kw7~wsnyu7.css +2 -0
  193. package/.next/static/chunks/16yfxp9ak2gdm.js +1 -0
  194. package/.next/static/chunks/174re5ar~kxne.js +1 -0
  195. package/.next/trace +2 -2
  196. package/.next/trace-build +1 -1
  197. package/.next/types/routes.d.ts +2 -1
  198. package/.next/types/validator.ts +9 -0
  199. package/app/api/hub/servers/route.ts +39 -0
  200. package/app/components/AppShell.tsx +2 -0
  201. package/app/components/ChatPopover.tsx +38 -2
  202. package/app/components/HelpOverlay.tsx +18 -0
  203. package/app/components/ServersDrawer.tsx +206 -0
  204. package/app/components/TopoGraph.tsx +871 -162
  205. package/app/components/utils.ts +8 -7
  206. package/app/lib/time.ts +36 -0
  207. package/package.json +1 -1
  208. package/scripts/help-overlay-topo-test.mjs +44 -0
  209. package/scripts/servers-drawer-live-test.mjs +96 -0
  210. package/scripts/topo-active-links-chip-test.mjs +73 -0
  211. package/scripts/topo-arrow-tier-test.mjs +61 -0
  212. package/scripts/topo-auto-fit-test.mjs +73 -0
  213. package/scripts/topo-chat-focus-ring-test.mjs +77 -0
  214. package/scripts/topo-click-ripple-test.mjs +66 -0
  215. package/scripts/topo-cwd-tooltip-test.mjs +64 -0
  216. package/scripts/topo-dblclick-reset-test.mjs +74 -0
  217. package/scripts/topo-edge-hover-test.mjs +85 -0
  218. package/scripts/topo-edge-tooltip-test.mjs +70 -0
  219. package/scripts/topo-fit-key-test.mjs +106 -0
  220. package/scripts/topo-freshness-chip-test.mjs +74 -0
  221. package/scripts/topo-group-count-test.mjs +63 -0
  222. package/scripts/topo-group-hover-test.mjs +82 -0
  223. package/scripts/topo-hub-title-test.mjs +88 -0
  224. package/scripts/topo-label-lift-test.mjs +115 -0
  225. package/scripts/topo-label-scale-test.mjs +78 -0
  226. package/scripts/topo-lastseen-tooltip-test.mjs +59 -0
  227. package/scripts/topo-layout-key-test.mjs +91 -0
  228. package/scripts/topo-minimap-test.mjs +68 -0
  229. package/scripts/topo-mobile-chips-test.mjs +103 -0
  230. package/scripts/topo-offline-dim-test.mjs +70 -0
  231. package/scripts/topo-overlap-test.mjs +164 -0
  232. package/scripts/topo-p0round-test.mjs +2 -2
  233. package/scripts/topo-pan-cursor-test.mjs +62 -0
  234. package/scripts/topo-popover-meta-test.mjs +78 -0
  235. package/scripts/topo-pressure-bar-test.mjs +69 -0
  236. package/scripts/topo-pulse-rate-test.mjs +71 -0
  237. package/scripts/topo-recent-signal-empty-test.mjs +63 -0
  238. package/scripts/topo-reduced-motion-test.mjs +77 -0
  239. package/scripts/topo-tz-ghost-test.mjs +69 -0
  240. package/scripts/topo-wheel-zoom-test.mjs +79 -0
  241. package/scripts/topo-zoom-keys-test.mjs +89 -0
  242. package/.next/static/chunks/0-7iowzu4.798.js +0 -1
  243. package/.next/static/chunks/02t5jr4shh.hy.js +0 -1
  244. package/.next/static/chunks/0_qfg5s5uzs7..js +0 -7
  245. package/.next/static/chunks/0_rmxom9~1lmk.css +0 -2
  246. package/.next/static/chunks/0cbezu61m-e~z.js +0 -1
  247. package/.next/static/chunks/0cj5qr_a8dzky.js +0 -7
  248. package/.next/static/chunks/0elalb9n_.~di.js +0 -1
  249. package/.next/static/chunks/0j_q__o8p6g83.js +0 -1
  250. package/.next/static/chunks/0jl6_w50zh4l5.js +0 -1
  251. package/.next/static/chunks/0mn0ruf0g4op5.js +0 -1
  252. package/.next/static/chunks/0r4q73.-1bkyl.js +0 -1
  253. package/.next/static/chunks/0r_c8eccg3z2o.js +0 -1
  254. package/.next/static/chunks/0y9subfnntv1s.js +0 -1
  255. package/.next/static/chunks/10oi7l-tycgl9.js +0 -1
  256. package/.next/static/chunks/11uk1izuv3~0t.js +0 -1
  257. /package/.next/static/{7xem03-473G3qw-fC160p → 23MxP0RBVA4BaOJ_HMYmM}/_buildManifest.js +0 -0
  258. /package/.next/static/{7xem03-473G3qw-fC160p → 23MxP0RBVA4BaOJ_HMYmM}/_clientMiddlewareManifest.js +0 -0
  259. /package/.next/static/{7xem03-473G3qw-fC160p → 23MxP0RBVA4BaOJ_HMYmM}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3479,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"previewContent",0,function(e){return e&&e.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},76161,e=>{"use strict";var t=e.i(22381),s=e.i(23910),a=e.i(56839);let r={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function n({variant:e,size:s}){let a={width:s,height:s},r={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"nodes":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,t.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,t.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,t.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,t.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,t.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,t.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,t.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,t.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,t.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,t.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,t.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,t.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,t.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,t.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function i({variant:e="generic",title:s,sub:o,cta:l,compact:c=!1}){let x=r[e],d=s??x.title,h=o??x.sub;return(0,t.jsxs)("div",{className:`text-center ${c?"py-8":"py-16"} px-4`,role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)(n,{variant:e,size:c?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${c?"text-sm":"text-base"}`,children:d}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${c?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:h}),l&&(0,t.jsx)("div",{className:"mt-4",children:l.href?(0,t.jsxs)(a.default,{href:l.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[l.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:l.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[l.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function o({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#2a2a4a] bg-[#111128] shadow-lg shadow-black/20",children:e})}function l({cmd:e}){let[a,r]=(0,s.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1800)}catch{}};return(0,t.jsxs)("div",{className:"anet-empty-cmd flex items-center gap-2 bg-[#0a0a15] border border-[#2a2a4a] rounded-lg pl-4 pr-1.5 py-1.5 text-xs sm:text-sm",children:[(0,t.jsx)("code",{className:"text-cyan-300 font-mono select-all",children:e}),(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":a?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] transition-colors",children:a?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:s=0}){return e?.global_count?(0,t.jsx)(o,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents in this network",sub:`Server has ${e.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):s>0?(0,t.jsx)(o,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${s.toLocaleString()} task${1===s?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,t.jsx)(o,{children:(0,t.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,t.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,t.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,t.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,t.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,t.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,t.jsx)("div",{className:"mt-4 inline-block",children:(0,t.jsx)(l,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},21743,e=>{"use strict";var t=e.i(22381),s=e.i(23910),a=e.i(56839),r=e.i(3479),n=e.i(76161);e.s(["default",0,function(){let[e,i]=(0,s.useState)([]),[o,l]=(0,s.useState)(!0),[c,x]=(0,s.useState)(""),[d,h]=(0,s.useState)({}),m=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/hub/tokens"),t=await e.json();i(t.tokens||[])}catch{}finally{l(!1)}},[]);(0,s.useEffect)(()=>{m()},[m]);let y=async()=>{if(c.trim())try{let e=sessionStorage.getItem("anet_v3_auth");if(!e)return;let{token:t}=JSON.parse(e),s=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create_token",token:t,name:c})}),a=await s.json();a.ok?(h({token:a.token}),x(""),m()):h({error:a.error})}catch{h({error:"Failed"})}},g=async e=>{try{let t=sessionStorage.getItem("anet_v3_auth");if(!t)return;let{token:s}=JSON.parse(t);await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"revoke_token",token:s,token_id:e})}),m()}catch{}};return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)(a.default,{href:"/settings",className:"text-gray-500 hover:text-gray-300 text-sm lg:ml-0 ml-10",children:"← Settings"}),(0,t.jsx)("h1",{className:"text-2xl font-bold text-white",children:"API Tokens"})]}),(0,t.jsxs)("div",{className:"max-w-2xl space-y-6",children:[(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Create Token"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:c,onChange:e=>x(e.target.value),placeholder:"Token name (e.g. my-cli)",className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,t.jsx)("button",{onClick:y,disabled:!c.trim(),className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 text-white text-sm rounded-lg transition-colors",children:"Create"})]}),d.token&&(0,t.jsxs)("div",{className:"mt-3 bg-green-500/5 border border-green-500/20 rounded-lg px-3 py-2",children:[(0,t.jsx)("div",{className:"text-xs text-green-400 mb-1",children:"Token created (copy now, shown only once):"}),(0,t.jsx)("code",{className:"text-sm text-green-300 break-all select-all",children:d.token})]}),d.error&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:d.error})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:["Active Tokens (",e.length,")"]}),o?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2].map(e=>(0,t.jsx)("div",{className:"h-12 bg-gray-800/20 rounded"},e))}):0===e.length?(0,t.jsx)(n.EmptyState,{variant:"tokens",compact:!0,sub:"Tokens authenticate CLI tools and external integrations. Sign in with V3 auth, then create one above."}):(0,t.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a]",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm text-white font-medium",children:e.name}),(0,t.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${"full"===e.scope?"text-cyan-300 border-cyan-500/20 bg-cyan-500/5":"text-gray-400 border-gray-600/20"}`,children:e.scope})]}),(0,t.jsxs)("div",{className:"text-[10px] text-gray-500",children:[e.token_id," · network: ",e.network_id?.slice(0,12)||"--"," · used ",(0,r.timeAgo)(e.last_used_at)]})]}),(0,t.jsx)("button",{onClick:()=>g(e.token_id),className:"text-xs text-red-400 hover:text-red-300 px-2 py-1 rounded border border-red-800/30 hover:bg-red-500/10 transition-colors",children:"Revoke"})]},e.token_id))})]})]})]})}])}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,98025,e=>{"use strict";e.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-blue-500/10 text-blue-300 border-blue-500/20",blocked:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",error:"bg-red-500/10 text-red-300 border-red-500/20",offline:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"SESSION_STATUS_TEXT_CLASS",0,{working:"text-green-400",idle:"text-blue-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-blue-500",acked:"bg-cyan-500",running:"bg-green-500",replied:"bg-purple-500",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-yellow-500",expired:"bg-orange-500"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-blue-500/10 text-blue-300 border-blue-500/20",acked:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-purple-500/10 text-purple-300 border-purple-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",expired:"bg-orange-500/10 text-orange-300 border-orange-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee",running:"#4ade80",replied:"#a78bfa",closed:"#6b7280",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},3479,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60);return t>0?`${t}h ${r}m`:`${r}m`},"previewContent",0,function(e){return e&&e.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},46228,e=>{"use strict";var t=e.i(22381);let r=[180,200,220,270,300,330,30,90];function s(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;let s=r[t%r.length];return{bg:`hsl(${s} 55% 22%)`,ring:`hsl(${s} 60% 45%)`,text:`hsl(${s} 80% 78%)`}}function n(e){return e?(e.trim().match(/[\p{L}\p{N}]/u)?.[0]||e.trim()[0]||"·").toUpperCase():"·"}e.s(["AliasAvatar",0,function({alias:e,size:r=28,className:a=""}){let i=s(e),l=Math.max(9,Math.round(.42*r));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${a}`,style:{width:r,height:r,fontSize:l,backgroundColor:i.bg,borderColor:i.ring,color:i.text},title:e,"aria-hidden":!0,children:n(e)})},"aliasAvatarColors",0,s,"aliasInitial",0,n])},76161,e=>{"use strict";var t=e.i(22381),r=e.i(23910),s=e.i(56839);let n={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function a({variant:e,size:r}){let s={width:r,height:r},n={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"nodes":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...n,children:[(0,t.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,t.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,t.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...n,children:[(0,t.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,t.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,t.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...n,children:[(0,t.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,t.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,t.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...n,children:[(0,t.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,t.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,t.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,t.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...n,children:[(0,t.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,t.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,t.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,t.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...n,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,t.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,t.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...n,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function i({variant:e="generic",title:r,sub:l,cta:o,compact:c=!1}){let d=n[e],x=r??d.title,h=l??d.sub;return(0,t.jsxs)("div",{className:`text-center ${c?"py-8":"py-16"} px-4`,role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)(a,{variant:e,size:c?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${c?"text-sm":"text-base"}`,children:x}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${c?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:h}),o&&(0,t.jsx)("div",{className:"mt-4",children:o.href?(0,t.jsxs)(s.default,{href:o.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:o.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function l({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#2a2a4a] bg-[#111128] shadow-lg shadow-black/20",children:e})}function o({cmd:e}){let[s,n]=(0,r.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1800)}catch{}};return(0,t.jsxs)("div",{className:"anet-empty-cmd flex items-center gap-2 bg-[#0a0a15] border border-[#2a2a4a] rounded-lg pl-4 pr-1.5 py-1.5 text-xs sm:text-sm",children:[(0,t.jsx)("code",{className:"text-cyan-300 font-mono select-all",children:e}),(0,t.jsx)("button",{type:"button",onClick:a,"aria-label":s?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] transition-colors",children:s?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:r=0}){return e?.global_count?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents in this network",sub:`Server has ${e.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):r>0?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${r.toLocaleString()} task${1===r?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,t.jsx)(l,{children:(0,t.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,t.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,t.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,t.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,t.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,t.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,t.jsx)("div",{className:"mt-4 inline-block",children:(0,t.jsx)(o,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},59276,e=>{"use strict";var t=e.i(12629),r=e.i(11449);let s=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},n={refreshInterval:5e3,dedupingInterval:3e3};function a(e,t){if(!t)return e;let r=e.includes("?")?"&":"?";return`${e}${r}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",s,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:r}=(0,t.default)("/api/hub/health",s,n);return{health:e||null,error:r}},"useLicense",0,function(){let{data:e,error:r}=(0,t.default)("/api/hub/license",s,{refreshInterval:6e4});return{license:e?.ok?e:null,error:r}},"useMessages",0,function(e=100){let{networkId:i}=(0,r.useNetworkId)(),{data:l,error:o,isLoading:c}=(0,t.default)(a(`/api/hub/messages?limit=${e}`,i),s,n);return{messages:l?.messages||[],error:o,isLoading:c}},"useSessions",0,function(){let{networkId:e}=(0,r.useNetworkId)(),{data:i,error:l,isLoading:o}=(0,t.default)(a("/api/hub/status",e),s,n);return{sessions:i?.sessions||[],hint:i?._hint,error:l,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,r.useNetworkId)(),{data:i,error:l}=(0,t.default)(a("/api/hub/stats",e),s,n);return{stats:i?.ok?i:null,error:l}},"useTasks",0,function(e){let{networkId:i}=(0,r.useNetworkId)(),l=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:c,isLoading:d}=(0,t.default)(a(`/api/hub/tasks?${l}`,i),s,n);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:c,isLoading:d}}])}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,136,(e,t,r)=>{},7454,(e,t,r)=>{var a=e.i(20888);e.r(136);var s=e.r(23910),n=s&&"object"==typeof s&&"default"in s?s:{default:s},l=void 0!==a.default&&a.default.env&&!0,i=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,r=t.name,a=void 0===r?"stylesheet":r,s=t.optimizeForSpeed,n=void 0===s?l:s;d(i(a),"`name` must be a string"),this._name=a,this._deletedRulePlaceholder="#"+a+"-deleted-rule____{}",d("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,r=e.prototype;return r.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},r.isOptimizeForSpeed=function(){return this._optimizeForSpeed},r.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(l||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,r){return"number"==typeof r?e._serverSheet.cssRules[r]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),r},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},r.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},r.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},r.insertRule=function(e,t){if(d(i(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var r=this.getSheet();"number"!=typeof t&&(t=r.cssRules.length);try{r.insertRule(e,t)}catch(t){return l||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var a=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,a))}return this._rulesCount++},r.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var r="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!r.cssRules[e])return e;r.deleteRule(e);try{r.insertRule(t,e)}catch(a){l||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),r.insertRule(this._deletedRulePlaceholder,e)}}else{var a=this._tags[e];d(a,"old rule at index `"+e+"` not found"),a.textContent=t}return e},r.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},r.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},r.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,r){return r?t=t.concat(Array.prototype.map.call(e.getSheetForTag(r).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},r.makeStyleTag=function(e,t,r){t&&d(i(t),"makeStyleTag accepts only strings as second parameter");var a=document.createElement("style");this._nonce&&a.setAttribute("nonce",this._nonce),a.type="text/css",a.setAttribute("data-"+e,""),t&&a.appendChild(document.createTextNode(t));var s=document.head||document.getElementsByTagName("head")[0];return r?s.insertBefore(a,r):s.appendChild(a),a},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},h={};function x(e,t){if(!t)return"jsx-"+e;var r=String(t),a=e+r;return h[a]||(h[a]="jsx-"+c(e+"-"+r)),h[a]}function u(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var r=e+t;return h[r]||(h[r]=t.replace(/__jsx-style-dynamic-selector/g,e)),h[r]}var m=function(){function e(e){var t=void 0===e?{}:e,r=t.styleSheet,a=void 0===r?null:r,s=t.optimizeForSpeed,n=void 0!==s&&s;this._sheet=a||new o({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),a&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var r=this.getIdAndRules(e),a=r.styleId,s=r.rules;if(a in this._instancesCounts){this._instancesCounts[a]+=1;return}var n=s.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[a]=n,this._instancesCounts[a]=1},t.remove=function(e){var t=this,r=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(r in this._instancesCounts,"styleId: `"+r+"` not found"),this._instancesCounts[r]-=1,this._instancesCounts[r]<1){var a=this._fromServer&&this._fromServer[r];a?(a.parentNode.removeChild(a),delete this._fromServer[r]):(this._indices[r].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[r]),delete this._instancesCounts[r]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],r=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return r[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,r;return t=this.cssRules(),void 0===(r=e)&&(r={}),t.map(function(e){var t=e[0],a=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:r.nonce?r.nonce:void 0,dangerouslySetInnerHTML:{__html:a}})})},t.getIdAndRules=function(e){var t=e.children,r=e.dynamic,a=e.id;if(r){var s=x(a,r);return{styleId:s,rules:Array.isArray(t)?t.map(function(e){return u(s,e)}):[u(s,t)]}}return{styleId:x(a),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),f=s.createContext(null);function p(){return new m}function g(){return s.useContext(f)}f.displayName="StyleSheetContext";var b=n.default.useInsertionEffect||n.default.useLayoutEffect,y="u">typeof window?p():void 0;function v(e){var t=y||g();return t&&("u"<typeof window?t.add(e):b(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return x(e[0],e[1])}).join(" ")},r.StyleRegistry=function(e){var t=e.registry,r=e.children,a=s.useContext(f),l=s.useState(function(){return a||t||p()})[0];return n.default.createElement(f.Provider,{value:l},r)},r.createStyleRegistry=p,r.style=v,r.useStyleRegistry=g},6694,(e,t,r)=>{t.exports=e.r(7454).style},18722,e=>{"use strict";var t=e.i(20888),r=e.i(22381),a=e.i(23910),s=e.i(56839),n=e.i(3479);function l({online:e,working:t,total:a,version:s,uptime:n}){let o=a>0?Math.round(e/a*100):0,d=0===a;return(0,r.jsxs)("div",{className:d?"mb-4":"mb-8",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Agent Network"}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["CommHub ",s," · ",n]})]}),d?(0,r.jsxs)("div",{className:"anet-stat-strip flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-gray-500 border-t border-b border-[#2a2a4a] py-2",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full bg-gray-600"}),(0,r.jsx)("span",{className:"text-gray-300 tabular-nums",children:"0"})," online"]}),(0,r.jsx)("span",{className:"text-gray-700",children:"·"}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full bg-gray-600"}),(0,r.jsx)("span",{className:"text-gray-300 tabular-nums",children:"0"})," working"]}),(0,r.jsx)("span",{className:"text-gray-700",children:"·"}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full bg-gray-600"}),(0,r.jsx)("span",{className:"text-gray-300 tabular-nums",children:"0"})," registered"]})]}):(0,r.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,r.jsx)(i,{value:e,label:"Online",sub:`${o}% of fleet`,color:"text-green-400",accent:"from-green-500/20 to-green-500/0",border:"border-green-500/15"}),(0,r.jsx)(i,{value:t,label:"Working",sub:e>0?`${Math.round(t/e*100)}% utilization`:"--",color:"text-cyan-400",accent:"from-cyan-500/20 to-cyan-500/0",border:"border-cyan-500/15"}),(0,r.jsx)(i,{value:a-e,label:"Offline",sub:a-e==0?"All systems go":`${a-e} disconnected`,color:"text-gray-400",accent:"from-gray-500/10 to-gray-500/0",border:"border-gray-500/15"}),(0,r.jsx)(i,{value:a,label:"Total",sub:"Registered nodes",color:"text-white",accent:"from-blue-500/15 to-blue-500/0",border:"border-blue-500/15"})]})]})}function i({value:e,label:t,sub:a,color:s,accent:n,border:l}){let o=s.replace("text-","").split("-")[0];return(0,r.jsxs)("div",{"data-anet-stat-card":o,className:`anet-stat-card relative overflow-hidden rounded-xl border ${l} bg-[#111128] px-4 py-3 transition-all`,children:[(0,r.jsx)("div",{className:`absolute inset-0 bg-gradient-to-br ${n} pointer-events-none`}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:`text-3xl font-bold ${s} tabular-nums leading-tight`,children:e}),(0,r.jsx)("div",{className:"text-sm text-gray-300 mt-0.5",children:t}),(0,r.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:a})]})]})}function o(){let[e,t]=(0,a.useState)(""),[s,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(""),o=async()=>{if(e.trim()){n(!0),i("");try{let r=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e})}),a=await r.json();a.ok?(i(`Broadcast sent to ${a.recipients} node(s)`),t("")):i(`Failed: ${a.error||"Send error"}`)}catch(e){i(`Failed: ${e instanceof Error?e.message:"Send error"}`)}n(!1),setTimeout(()=>i(""),5e3)}};return(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"Broadcast message to all online agents...",maxLength:500,"aria-label":"Broadcast message",className:"flex-1 bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:ring-1 focus:ring-blue-500/20 focus:outline-none transition-colors"}),(0,r.jsx)("button",{onClick:o,disabled:s||!e.trim(),"aria-label":"Send broadcast",className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-all font-medium cursor-pointer disabled:cursor-not-allowed",children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),(0,r.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),(0,r.jsx)("span",{children:"Sending…"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M3 11v3a1 1 0 0 0 1 1h2l3.29 3.29a1 1 0 0 0 1.71-.71V7.42a1 1 0 0 0-1.71-.71L6 10H4a1 1 0 0 0-1 1Z"}),(0,r.jsx)("path",{d:"M16 8a5 5 0 0 1 0 6",opacity:"0.7"}),(0,r.jsx)("path",{d:"M19 5a9 9 0 0 1 0 12",opacity:"0.45"})]}),(0,r.jsx)("span",{children:"Broadcast"})]})})]}),e.length>0&&(0,r.jsxs)("div",{className:"text-right text-xs text-gray-600 mt-1 tabular-nums",children:[e.length,"/500"]}),l&&(0,r.jsx)("div",{className:`mt-3 text-sm text-center anet-fade-in ${l.startsWith("Failed")?"text-red-400":"text-green-400/80"}`,children:l})]})}var d=e.i(46228),c=e.i(43058);function h({alias:e,onClose:t}){let[s,n]=(0,a.useState)({x:0,y:0}),[l,i]=(0,a.useState)({w:380,h:520}),o=(0,a.useRef)({active:!1,startX:0,startY:0,baseX:0,baseY:0}),x=(0,a.useRef)({active:!1,startX:0,startY:0,baseW:0,baseH:0}),u=(0,a.useCallback)((e,t,r,a)=>({x:Math.min(Math.max(16,e),Math.max(16,window.innerWidth-r-16)),y:Math.min(Math.max(16,t),Math.max(16,window.innerHeight-a-16))}),[]);(0,a.useEffect)(()=>{let e=()=>{let e=window.innerWidth,t=window.innerHeight,r=Math.min(380,e-32),a=Math.min(520,t-96);i({w:r,h:a});let s=e<640;n(u(s?16:e-r-24,s?t-a-16:96,r,a))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[u]),(0,a.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let m=e=>{if(o.current.active){o.current.active=!1;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}}},f=e=>{if(x.current.active){x.current.active=!1,e.stopPropagation();try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}}};return(0,r.jsxs)("div",{className:"fixed z-50 flex flex-col overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--bg)] shadow-2xl shadow-black/60 anet-fade-in",style:{left:s.x,top:s.y,width:l.w,height:l.h},role:"dialog","aria-label":`Chat with ${e}`,children:[(0,r.jsxs)("div",{onPointerDown:e=>{0===e.button&&(e.currentTarget.setPointerCapture?.(e.pointerId),o.current={active:!0,startX:e.clientX,startY:e.clientY,baseX:s.x,baseY:s.y})},onPointerMove:e=>{let t=o.current;t.active&&n(u(t.baseX+(e.clientX-t.startX),t.baseY+(e.clientY-t.startY),l.w,l.h))},onPointerUp:m,onPointerCancel:m,className:"flex items-center justify-between px-3 py-2.5 border-b border-[var(--border)] bg-[var(--bg-secondary)] rounded-t-xl cursor-grab active:cursor-grabbing select-none touch-none",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,r.jsx)(d.AliasAvatar,{alias:e,size:28}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("div",{className:"text-sm font-semibold text-[var(--fg)] truncate",children:e}),(0,r.jsx)("div",{className:"text-[10px] text-[var(--fg-muted)]",children:"Drag to move · Esc to close"})]})]}),(0,r.jsx)("button",{onClick:t,onPointerDown:e=>e.stopPropagation(),"aria-label":"Close chat",className:"text-[var(--fg-muted)] hover:text-[var(--fg)] p-1.5 rounded-lg hover:bg-[var(--bg-elevated)] shrink-0",children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:"flex-1 min-h-0",children:(0,r.jsx)(c.TaskChatPanel,{alias:e,onClose:t,inline:!0})}),(0,r.jsx)("div",{onPointerDown:e=>{0===e.button&&(e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),x.current={active:!0,startX:e.clientX,startY:e.clientY,baseW:l.w,baseH:l.h})},onPointerMove:e=>{let t=x.current;if(!t.active)return;e.stopPropagation();let r=Math.max(300,window.innerWidth-s.x-16),a=Math.max(320,window.innerHeight-s.y-16);i({w:Math.min(r,Math.max(300,t.baseW+(e.clientX-t.startX))),h:Math.min(a,Math.max(320,t.baseH+(e.clientY-t.startY)))})},onPointerUp:f,onPointerCancel:f,"aria-label":"Resize chat",className:"absolute bottom-0 right-0 w-5 h-5 cursor-nwse-resize touch-none z-10",style:{touchAction:"none"},children:(0,r.jsx)("svg",{className:"absolute bottom-0.5 right-0.5 w-3 h-3 text-[var(--fg-dim)]",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M11 5L5 11M11 9L9 11"})})})]})}let x={id:"unknown",label:"Unknown vendor",mono:{bg:"hsl(220 10% 26%)",ring:"hsl(220 10% 46%)",text:"hsl(220 14% 82%)"},initial:"?",logo:null},u=[{test:e=>e.startsWith("intern"),vendor:{id:"intern",label:"书生 · 上海 AI 实验室",mono:{bg:"hsl(28 38% 24%)",ring:"hsl(32 45% 52%)",text:"hsl(34 60% 82%)"},initial:"书",logo:"/intern_avatar.png"}},{test:e=>e.startsWith("minimax"),vendor:{id:"minimax",label:"MiniMax",mono:{bg:"hsl(18 50% 26%)",ring:"hsl(18 65% 52%)",text:"hsl(20 80% 82%)"},initial:"M",logo:null}},{test:e=>e.startsWith("claude"),vendor:{id:"anthropic",label:"Anthropic",mono:{bg:"hsl(16 32% 26%)",ring:"hsl(16 48% 54%)",text:"hsl(18 60% 84%)"},initial:"A",logo:null}},{test:e=>e.startsWith("gpt")||e.startsWith("codex")||e.startsWith("o1")||e.startsWith("o3")||e.startsWith("o4"),vendor:{id:"openai",label:"OpenAI",mono:{bg:"hsl(165 26% 22%)",ring:"hsl(165 40% 44%)",text:"hsl(165 45% 80%)"},initial:"O",logo:null}}];function m(e){if(!e)return x;let t=e.toLowerCase();for(let e of u)if(e.test(t))return e.vendor;return x}let f={"claude-code-cli":{label:"Claude Code CLI",iconPath:"M4 5h16v14H4z M7 9l3 3-3 3 M13 15h4",color:"#a78bfa"},"codex-sdk":{label:"Codex SDK",iconPath:"M9 7l-5 5 5 5 M15 7l5 5-5 5",color:"#38bdf8"},"claude-agent-sdk":{label:"Claude Agent SDK",iconPath:"M4 7h16v10H4z M8 11h8 M8 14h5",color:"#34d399"},"http-api":{label:"HTTP API",iconPath:"M7 18a4 4 0 010-8 5 5 0 019.6-1.3A3.5 3.5 0 0118 18z",color:"#fbbf24"}};function p(e){return e?f[e]??null:null}function g(e,t,r,a=0){let s=t<=2?Math.PI:1.78*Math.PI,n=-Math.PI/2-s/2,l=t<=1?-Math.PI/2:n+s*e/(t-1)+a;return{x:500+r*Math.cos(l),y:330+r*Math.sin(l)}}function b(e,t,r=0){let a=(e.x+t.x)/2,s=(e.y+t.y)/2,n=t.x-e.x,l=t.y-e.y,i=Math.hypot(n,l)||1,o={x:a+-l/i*r,y:s+n/i*r};return`M${e.x},${e.y} Q${o.x},${o.y} ${t.x},${t.y}`}function y(e,t){return e.length>t?`${e.slice(0,t-1)}...`:e}let v={panelStops:["#0b1220","#080814","#101018"],radarStops:[{color:"#22d3ee",opacity:.18},{color:"#22c55e",opacity:.045},{color:"#020617",opacity:0}],arrowFill:"#67e8f9",ringStroke:"#164e63",spokeStroke:{active:"#22d3ee",idle:"#155e75"},flowEdge:"#67e8f9",flowPath:"#e0f2fe",flowParticle:"#fef08a",nodeFill:{online:"#020617",offline:"#080814"},labelBox:{fill:"#020617",stroke:"#1f2937"},legendBox:{fill:"#020617",stroke:"#1f2937"},legendText:"#94a3b8",legendHeadline:"#e5e7eb",legendAccent:"#67e8f9",containerBg:"#080814",containerBorder:"#2a2a4a",topRailGradient:"from-transparent via-cyan-400/70 to-transparent"},j={panelStops:["#f8fafc","#ffffff","#f1f5f9"],radarStops:[{color:"#10b981",opacity:.06},{color:"#3b82f6",opacity:.03},{color:"#ffffff",opacity:0}],arrowFill:"#10b981",ringStroke:"#cbd5e1",spokeStroke:{active:"#10b981",idle:"#cbd5e1"},flowEdge:"#10b981",flowPath:"#475569",flowParticle:"#f59e0b",nodeFill:{online:"#ffffff",offline:"#f8fafc"},labelBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendText:"#475569",legendHeadline:"#0f172a",legendAccent:"#0d9488",containerBg:"#ffffff",containerBorder:"#e3e6eb",topRailGradient:"from-transparent via-emerald-500/40 to-transparent"};function w(e,t){let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)r++;return e.slice(0,r)}function k(e){let t=e.length,r=e.map((e,t)=>t),a=e=>{for(;r[e]!==e;)r[e]=r[r[e]],e=r[e];return e},s=(e,t)=>{let s=a(e),n=a(t);s!==n&&(r[s]=n)},n={};for(let t of(e.forEach((e,t)=>{let r=e.project_dir?.trim();r&&(n[r]||=[]).push(t)}),Object.values(n)))for(let e=1;e<t.length;e++)s(t[0],t[e]);let l=e.map((e,t)=>t).sort((t,r)=>e[t].alias.localeCompare(e[r].alias));for(let t=0;t+1<l.length;t++)w(e[l[t]].alias,e[l[t+1]].alias).length>=2&&s(l[t],l[t+1]);let i={};for(let e=0;e<t;e++)(i[a(e)]||=[]).push(e);let o={};for(let t of Object.values(i)){let r;if(1===t.length)r=e[t[0]].alias;else{let a=new Set(t.map(t=>e[t].project_dir?.trim()).filter(Boolean));if(1===a.size){let e=[...a][0];r=e.split("/").filter(Boolean).pop()||e}else(r=t.map(t=>e[t].alias).reduce((e,t)=>w(e,t))).length<2&&(r=e[t[0]].alias)}for(let a of t)o[e[a].alias]=r}return o}function N(e,t){let r=new Map;return e.forEach(e=>{if(!t[e.from_alias]||!t[e.to_alias]||e.from_alias===e.to_alias)return;let a=`${e.from_alias}->${e.to_alias}`,s=r.get(a);r.set(a,{key:a,from:e.from_alias,to:e.to_alias,count:(s?.count||0)+1,content:s?.content||e.content})}),[...r.values()].slice(0,18)}function S({sessions:e,sseSessions:t,renameSignal:s}){let n="light"===function(){let[e,t]=(0,a.useState)("dark");return(0,a.useEffect)(()=>{let e=()=>{let e=document.documentElement.getAttribute("data-theme")||"cyber";t("light"===e||"mint"===e?"light":"dark")};e();let r=new MutationObserver(e);return r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>r.disconnect()},[]),e}(),l=n?j:v,i="intern"===function(){let[e,t]=(0,a.useState)(null);return(0,a.useEffect)(()=>{try{let e=new URL(window.location.href).searchParams.get("brand");null!==e?""===e||"none"===e?(localStorage.removeItem("anet-brand"),t(null)):(localStorage.setItem("anet-brand",e),t(e)):t(localStorage.getItem("anet-brand"))}catch{}},[]),e}(),[o,c]=(0,a.useState)([]),[x,u]=(0,a.useState)("ring");(0,a.useEffect)(()=>{try{let e=localStorage.getItem("anet-topo-layout");("grid"===e||"ring"===e)&&u(e)}catch{}},[]);let f=()=>u(e=>{let t="ring"===e?"grid":"ring";try{localStorage.setItem("anet-topo-layout",t)}catch{}return t}),[w,_]=(0,a.useState)(.84);(0,a.useEffect)(()=>{try{let e=parseFloat(localStorage.getItem("anet-topo-nodescale")||"");(.7===e||.84===e||1===e)&&_(e)}catch{}},[]),(0,a.useEffect)(()=>{let e=async()=>{try{let e=await fetch("/api/hub/messages?limit=50");if(401===e.status)return void window.location.assign("/login");let t=await e.json();c(t.messages||[])}catch{}};e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let{onlineNodes:C,offlineNodes:M,nodePositions:z,flowLinks:$,activeAliases:P,groupKeys:E,groupBoxes:T}=(0,a.useMemo)(()=>{let r=e=>(e.network_id?t[`${e.network_id}:${e.alias}`]:void 0)??t[e.alias],a=(e,t)=>e.alias.localeCompare(t.alias),s=Date.now(),n=e.filter(e=>"offline"!==e.status||r(e)).sort(a),l=e.filter(e=>"offline"===e.status&&!r(e)&&!(e=>{if("offline"!==e.status||r(e)||!e.last_seen_at)return!1;let t=Date.parse(e.last_seen_at);return!Number.isNaN(t)&&s-t>864e5})(e)).sort(a),i={};if("grid"===x){let e=[...n,...l],t=k(e),r=Math.max(1,Math.ceil(Math.sqrt(e.length))),a=700/r,s=[];for(let r of e){let e=t[r.alias],a=s[s.length-1];a&&a.key===e?a.members.push(r):s.push({key:e,members:[r]})}let d=[],c=0,h=0;for(;h<s.length;)if(s[h].members.length>=2)d.push({members:s[h].members,startRow:c,centred:!1,isGroup:!0}),c+=Math.ceil(s[h].members.length/r),h++;else{let e=[];for(;h<s.length&&s[h].members.length<2;)e.push(s[h].members[0]),h++;d.push({members:e,startRow:c,centred:!0,isGroup:!1}),c+=Math.ceil(e.length/r)}let x=Math.min(100,404/Math.max(1,c));for(let e of d)e.members.forEach((t,s)=>{let n=Math.floor(s/r),l=s%r,o=Math.min(r,e.members.length-n*r),d=e.centred?(r-o)*a/2:0;i[t.alias]={x:150+d+(l+.5)*a,y:184+(e.startRow+n+.5)*x}});let u=N(o,i),m=new Set;u.forEach(e=>{m.add(e.from),m.add(e.to)});let f=Math.max(22,Math.min(44,.4*x)),p=Math.max(16,Math.min(32,.3*x)),g=d.filter(e=>e.isGroup).map(e=>{let r=e.members.map(e=>i[e.alias]).filter(Boolean),a=r.map(e=>e.x),s=r.map(e=>e.y),n=Math.min(...a),l=Math.min(...s);return{key:e.members.length?t[e.members[0].alias]:"",x:n-p,y:l-f,w:Math.max(...a)-n+2*p,h:Math.max(...s)-l+f+p}});return{onlineNodes:n,offlineNodes:l,nodePositions:i,flowLinks:u,activeAliases:m,groupKeys:t,groupBoxes:g}}let d=n.length>14,c=!d&&n.length>8,h=n.length;if(d){let e=Math.ceil(n.length/3),t=n.slice(0,e),r=n.slice(e,2*e),a=n.slice(2*e);t.forEach((e,r)=>{i[e.alias]=g(r,Math.max(t.length,1),145)});let s=t.length<=2?Math.PI:1.78*Math.PI,l=t.length>1?s/(t.length-1):0;r.forEach((e,t)=>{i[e.alias]=g(t,Math.max(r.length,1),215,l/2)}),a.forEach((e,t)=>{i[e.alias]=g(t,Math.max(a.length,1),285)}),h=a.length}else if(c){let e=Math.ceil(n.length/2),t=n.length-e,r=n.slice(0,e),a=n.slice(e);r.forEach((t,r)=>{i[t.alias]=g(r,Math.max(e,1),175)});let s=e<=2?Math.PI:1.78*Math.PI,l=e>1?s/(e-1):0;a.forEach((e,r)=>{i[e.alias]=g(r,Math.max(t,1),260,l/2)}),h=t}else n.forEach((e,t)=>{i[e.alias]=g(t,Math.max(n.length,1),220)});let u=h<=2?Math.PI:1.78*Math.PI,m=h>1?u/(h-1):0,f=h>0?m/2:0,p=325+6*Math.max(0,l.length-4);l.forEach((e,t)=>{i[e.alias]=g(t,Math.max(l.length,1),p,f)});let b=N(o,i),y=new Set;b.forEach(e=>{y.add(e.from),y.add(e.to)});let v=k([...n,...l]);return{onlineNodes:n,offlineNodes:l,nodePositions:i,flowLinks:b,activeAliases:y,groupKeys:v,groupBoxes:[]}},[o,e,t,x]),A=C.filter(e=>"working"===e.status).length,F=C.length+M.length>16,[L,R]=(0,a.useState)(null),B=(0,a.useRef)(null),I=(0,a.useRef)(null),[W,O]=(0,a.useState)({zoom:1,x:0,y:0}),H=(0,a.useRef)(W),D=(0,a.useRef)({active:!1,startX:0,startY:0,baseX:0,baseY:0}),[Y,X]=(0,a.useState)(!1),[U,G]=(0,a.useState)(null);(0,a.useEffect)(()=>{s&&s.from===U&&G(s.to)},[s]),(0,a.useEffect)(()=>{H.current=W},[W]),(0,a.useEffect)(()=>{try{let e=localStorage.getItem("anet-topo-view");if(e){let t=JSON.parse(e);"number"==typeof t?.zoom&&O({zoom:Math.min(4,Math.max(.5,t.zoom)),x:"number"==typeof t.x?t.x:0,y:"number"==typeof t.y?t.y:0})}}catch{}},[]),(0,a.useEffect)(()=>{try{localStorage.setItem("anet-topo-view",JSON.stringify(W))}catch{}},[W]),(0,a.useEffect)(()=>{let e=()=>X(document.fullscreenElement===B.current);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,a.useEffect)(()=>{let e=I.current;if(!e)return;let t=t=>{t.preventDefault();let r=e.getBoundingClientRect(),a=(t.clientX-r.left)/r.width*1e3,s=(t.clientY-r.top)/r.height*680;O(e=>{let r=Math.min(1.08,Math.max(.926,Math.exp(-(6e-4*t.deltaY)))),n=Math.min(4,Math.max(.5,e.zoom*r)),l=n/e.zoom;return{zoom:n,x:a-(a-e.x)*l,y:s-(s-e.y)*l}})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);let J=e=>{if(D.current.active){D.current.active=!1;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}}},V=e=>{O(t=>{let r=Math.min(4,Math.max(.5,t.zoom*e)),a=r/t.zoom;return{zoom:r,x:500-(500-t.x)*a,y:340-(340-t.y)*a}})};return(0,r.jsxs)("section",{className:"w-full max-w-6xl mx-auto mb-8",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between mb-3 px-1",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs uppercase text-gray-600 tracking-wider",children:"Network Topology"}),(0,r.jsx)("h2",{className:"text-lg text-white font-semibold",children:"Command mesh"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,r.jsxs)("div",{className:"inline-flex rounded-md border border-gray-500/25 overflow-hidden",role:"group","aria-label":"Topology layout",children:[(0,r.jsx)("button",{onClick:()=>{"ring"!==x&&f()},"aria-pressed":"ring"===x,className:`px-2.5 py-1 transition-colors ${"ring"===x?"bg-cyan-500/15 text-cyan-300":"text-gray-500 hover:text-gray-400"}`,children:"Ring"}),(0,r.jsx)("button",{onClick:()=>{"grid"!==x&&f()},"aria-pressed":"grid"===x,className:`px-2.5 py-1 border-l border-gray-500/25 transition-colors ${"grid"===x?"bg-cyan-500/15 text-cyan-300":"text-gray-500 hover:text-gray-400"}`,children:"Grid"})]}),(0,r.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20",children:[A," working"]}),(0,r.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20",children:[C.length," online"]}),(0,r.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20",children:[$.length," active links"]})]})]}),(0,r.jsxs)("div",{ref:B,className:`relative overflow-hidden rounded-lg border shadow-2xl ${n?"shadow-zinc-900/5":"shadow-cyan-950/30"} ${Y?"flex items-center justify-center":""}`,style:{background:l.containerBg,borderColor:l.containerBorder},children:[(0,r.jsx)("div",{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r ${l.topRailGradient}`}),(0,r.jsxs)("svg",{ref:I,viewBox:"0 0 1000 680",className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",onPointerDown:e=>{0===e.button&&(e.currentTarget.setPointerCapture?.(e.pointerId),D.current={active:!0,startX:e.clientX,startY:e.clientY,baseX:H.current.x,baseY:H.current.y})},onPointerMove:e=>{let t=D.current;if(!t.active)return;let r=I.current;if(!r)return;let a=r.getBoundingClientRect(),s=(e.clientX-t.startX)/a.width*1e3,n=(e.clientY-t.startY)/a.height*680;O(e=>({...e,x:t.baseX+s,y:t.baseY+n}))},onPointerUp:J,onPointerLeave:J,style:{cursor:"grab",touchAction:"none"},children:[(0,r.jsxs)("defs",{children:[(0,r.jsxs)("linearGradient",{id:"topo-panel",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:l.panelStops[0]}),(0,r.jsx)("stop",{offset:"48%",stopColor:l.panelStops[1]}),(0,r.jsx)("stop",{offset:"100%",stopColor:l.panelStops[2]})]}),(0,r.jsxs)("radialGradient",{id:"topo-radar",cx:"50%",cy:"50%",r:"55%",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:l.radarStops[0].color,stopOpacity:l.radarStops[0].opacity}),(0,r.jsx)("stop",{offset:"45%",stopColor:l.radarStops[1].color,stopOpacity:l.radarStops[1].opacity}),(0,r.jsx)("stop",{offset:"100%",stopColor:l.radarStops[2].color,stopOpacity:l.radarStops[2].opacity})]}),!n&&(0,r.jsxs)("filter",{id:"topo-glow",children:[(0,r.jsx)("feGaussianBlur",{stdDeviation:"4",result:"blur"}),(0,r.jsxs)("feMerge",{children:[(0,r.jsx)("feMergeNode",{in:"blur"}),(0,r.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),(0,r.jsx)("marker",{id:"topo-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:(0,r.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:l.arrowFill})}),(0,r.jsxs)("radialGradient",{id:"topo-sweep",cx:"0%",cy:"50%",r:"100%",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:n?"#0d9488":"#22d3ee",stopOpacity:n?.18:.32}),(0,r.jsx)("stop",{offset:"70%",stopColor:n?"#0d9488":"#22d3ee",stopOpacity:n?.1:.18}),(0,r.jsx)("stop",{offset:"100%",stopColor:n?"#0d9488":"#22d3ee",stopOpacity:"0"})]})]}),(0,r.jsx)("rect",{width:"1000",height:"680",fill:"url(#topo-panel)"}),(0,r.jsxs)("g",{transform:`translate(${W.x} ${W.y}) scale(${W.zoom})`,children:["ring"===x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:500,cy:330,r:"330",fill:"url(#topo-radar)"}),!n&&(0,r.jsx)("g",{opacity:"0.5",children:Array.from({length:28}).map((e,t)=>{let a=9301*t+49297;return(0,r.jsx)("circle",{cx:13*a%1e3,cy:7*a%680,r:t%3==0?1.2:.7,fill:"#a5b4fc",opacity:.35+t%4*.05},t)})}),(0,r.jsx)("g",{style:{transformOrigin:"500px 330px",transformBox:"view-box"},className:"anet-topo-sweep",opacity:n?.7:1,children:(0,r.jsx)("path",{d:`M 500 330 L 830 330 A 330 330 0 0 0 ${500+330*Math.cos(-Math.PI/4.5)} ${330+330*Math.sin(-Math.PI/4.5)} Z`,fill:"url(#topo-sweep)"})}),[90,170,250,330].map(e=>(0,r.jsx)("circle",{cx:500,cy:330,r:e,fill:"none",stroke:l.ringStroke,strokeWidth:"1",opacity:n?.6:.35},e)),!n&&[0,.25,.5,.75].map((e,t)=>(0,r.jsx)("g",{children:(0,r.jsx)("circle",{cx:830,cy:330,r:0===t?2.8:2.2,fill:"#22d3ee",opacity:.9,filter:"url(#topo-glow)",children:(0,r.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:`${360*e} 500 330`,to:`${360*e+360} 500 330`,dur:"16s",repeatCount:"indefinite"})})},`orbit-${t}`)),[0,30,60,90,120,150].map(e=>(0,r.jsx)("line",{x1:500-360*Math.cos(e*Math.PI/180),y1:330-360*Math.sin(e*Math.PI/180),x2:500+360*Math.cos(e*Math.PI/180),y2:330+360*Math.sin(e*Math.PI/180),stroke:l.ringStroke,strokeWidth:"1",opacity:n?.35:.18},e))]}),"ring"===x&&C.map((e,t)=>{let a=z[e.alias];if(!a)return null;let s=b({x:500,y:330},a,0),n=P.has(e.alias);return(0,r.jsx)("path",{d:s,fill:"none",stroke:n?l.spokeStroke.active:l.spokeStroke.idle,strokeWidth:n?2:1,strokeDasharray:n?"none":"6 14",opacity:n?.7:.45,className:n?void 0:"anet-topo-spoke-flow",style:n?void 0:{animationDelay:`${-(.25*t)}s`}},`hub-${e.alias}`)}),T.map(e=>(0,r.jsxs)("g",{"data-group":e.key,style:{pointerEvents:"none"},children:[(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:"14",fill:n?"#0f172a":"#a5b4fc",fillOpacity:n?.025:.045,stroke:l.ringStroke,strokeWidth:"1.5",strokeDasharray:"6 6"}),(0,r.jsx)("text",{x:e.x+12,y:e.y+21,fill:l.legendText,fontSize:"13",fontFamily:"monospace",fontWeight:"700",children:e.key})]},`grp-${e.key}`)),$.map((e,t)=>{let a=z[e.from],s=z[e.to];if(!a||!s)return null;let i=b(a,s,t%2==0?36:-36),o=Math.min(2+e.count,7);return(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{d:i,fill:"none",stroke:l.flowEdge,strokeWidth:o,opacity:n?.22:.28,filter:n?void 0:"url(#topo-glow)",markerEnd:"url(#topo-arrow)"}),(0,r.jsx)("path",{id:`flow-path-${t}`,d:i,fill:"none",stroke:l.flowPath,strokeWidth:"1",strokeDasharray:"2 12",opacity:n?.4:.75}),(0,r.jsx)("circle",{r:"4",fill:l.flowParticle,filter:n?void 0:"url(#topo-glow)",children:(0,r.jsx)("animateMotion",{dur:`${2.2+t%5*.32}s`,repeatCount:"indefinite",path:i})})]},e.key)}),"ring"===x&&(0,r.jsxs)("g",{children:[(0,r.jsx)("circle",{cx:500,cy:330,r:"18",fill:n?"#d1fae5":"#10b981",opacity:n?.35:.1}),(0,r.jsxs)("circle",{cx:500,cy:330,r:"10",fill:"none",stroke:"#10b981",strokeWidth:"1.5",children:[(0,r.jsx)("animate",{attributeName:"r",values:"10;38;10",dur:"2.4s",repeatCount:"indefinite"}),(0,r.jsx)("animate",{attributeName:"opacity",values:"0.55;0;0.55",dur:"2.4s",repeatCount:"indefinite"})]}),(0,r.jsxs)("circle",{cx:500,cy:330,r:"10",fill:"none",stroke:"#10b981",strokeWidth:"1.5",opacity:"0",children:[(0,r.jsx)("animate",{attributeName:"r",values:"10;38;10",dur:"2.4s",begin:"1.2s",repeatCount:"indefinite"}),(0,r.jsx)("animate",{attributeName:"opacity",values:"0.45;0;0.45",dur:"2.4s",begin:"1.2s",repeatCount:"indefinite"})]}),(0,r.jsx)("circle",{cx:500,cy:330,r:"10",fill:n?"#059669":"#10b981"}),(0,r.jsx)("circle",{cx:500,cy:330,r:"5",fill:"#d1fae5",opacity:"0.9"})]}),[...C,...M].map(e=>{var a,s;let o,c,h,x=z[e.alias];if(!x)return null;let u=(e.network_id?t[`${e.network_id}:${e.alias}`]:void 0)??t[e.alias],f="offline"!==e.status||!!u,g=f?"working"===e.status?{label:"working",primary:n?"#059669":"#22c55e",halo:n?"#d1fae5":"#14532d",text:n?"#065f46":"#dcfce7"}:"idle"===e.status?{label:"idle",primary:n?"#0d9488":"#2dd4bf",halo:n?"#ccfbf1":"#134e4a",text:n?"#115e59":"#ccfbf1"}:{label:e.status||"online",primary:n?"#0284c7":"#38bdf8",halo:n?"#dbeafe":"#0c4a6e",text:n?"#0c4a6e":"#e0f2fe"}:{label:"offline",primary:n?"#94a3b8":"#6b7280",halo:n?"#e2e8f0":"#111827",text:n?"#475569":"#9ca3af"},b=P.has(e.alias),v=Math.round((f?26:18)*w),j=!F||L===e.alias||W.zoom>=1.4;return(0,r.jsxs)("g",{"data-node":e.alias,className:"transition-opacity",style:{cursor:"pointer"},onPointerDown:e=>e.stopPropagation(),onPointerEnter:()=>F&&R(e.alias),onPointerLeave:()=>F&&R(t=>t===e.alias?null:t),onClick:()=>G(e.alias),children:[(0,r.jsx)("title",{children:(a=e.model,s=e.runtime,o=m(a),c=p(s),h=[],"unknown"!==o.id&&h.push(o.label),a&&h.push(a),c&&h.push(c.label),h.join(" · ")||e.alias)}),b&&(0,r.jsxs)("circle",{cx:x.x,cy:x.y,r:v+14,fill:g.primary,opacity:n?.08:.12,children:[(0,r.jsx)("animate",{attributeName:"r",values:`${v+8};${v+22};${v+8}`,dur:"2.4s",repeatCount:"indefinite"}),(0,r.jsx)("animate",{attributeName:"opacity",values:n?"0.12;0.02;0.12":"0.18;0.04;0.18",dur:"2.4s",repeatCount:"indefinite"})]}),(0,r.jsx)("circle",{cx:x.x,cy:x.y,r:v+8,fill:g.halo,opacity:f?n?.85:.65:n?.4:.25}),(0,r.jsx)("circle",{cx:x.x,cy:x.y,r:v,fill:f?l.nodeFill.online:l.nodeFill.offline,stroke:g.primary,strokeWidth:f?3:1.5,strokeDasharray:f?"none":"5 5",filter:f&&!n?"url(#topo-glow)":void 0}),(()=>{let t=Math.round((f?14:10)*w),a=2*v,s=m(e.model),n=/书生|书小生|intern/i.test(e.alias);if(i||n||s.logo)return(0,r.jsx)("image",{href:s.logo??"/intern_avatar.png",x:x.x-a/2,y:x.y-a/2,width:a,height:a,preserveAspectRatio:"xMidYMid meet"});if("unknown"!==s.id)return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:x.x,cy:x.y,r:t,fill:s.mono.bg,stroke:s.mono.ring,strokeWidth:"1"}),(0,r.jsx)("text",{x:x.x,y:x.y,dy:"0.34em",textAnchor:"middle",fill:s.mono.text,fontSize:t,fontFamily:"monospace",fontWeight:"700",children:s.initial})]});let l=(0,d.aliasAvatarColors)(E[e.alias]||e.alias);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:x.x,cy:x.y,r:t,fill:l.bg,stroke:l.ring,strokeWidth:"1"}),(0,r.jsx)("text",{x:x.x,y:x.y,dy:"0.34em",textAnchor:"middle",fill:l.text,fontSize:t,fontFamily:"monospace",fontWeight:"700",children:(0,d.aliasInitial)(e.alias)})]})})(),(()=>{let t=p(e.runtime);if(!t)return null;let a=f?7:5.5,s=x.x+.72*v,n=x.y+.72*v,i=2*a*.62;return(0,r.jsxs)("g",{style:{pointerEvents:"none"},children:[(0,r.jsx)("circle",{cx:s,cy:n,r:a,fill:l.containerBg,stroke:t.color,strokeWidth:"1.5"}),(0,r.jsx)("g",{transform:`translate(${s-i/2} ${n-i/2}) scale(${i/24})`,children:(0,r.jsx)("path",{d:t.iconPath,fill:"none",stroke:t.color,strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})]})})(),"working"===e.status&&(0,r.jsx)("circle",{cx:x.x,cy:x.y-(v-6),r:"2.5",fill:l.flowParticle,children:(0,r.jsx)("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"})}),j?(0,r.jsxs)("g",{transform:`translate(${x.x}, ${x.y+v+22})`,style:{pointerEvents:"none"},children:[(0,r.jsx)("rect",{x:"-50",y:"-14",width:"100",height:"42",rx:"6",fill:l.labelBox.fill,stroke:l.labelBox.stroke,opacity:n?1:.94}),(0,r.jsx)("text",{x:"0",y:"1",textAnchor:"middle",fill:g.text,fontSize:"12",fontFamily:"monospace",fontWeight:"700",children:y(e.alias,12)}),(0,r.jsxs)("text",{x:"0",y:"17",textAnchor:"middle",fill:g.primary,fontSize:"9",fontFamily:"monospace",children:[g.label,f&&null!=u?` sse:${u}`:""]})]}):(0,r.jsx)("text",{x:x.x,y:x.y+v+14,textAnchor:"middle",fill:g.text,fontSize:"10",fontFamily:"monospace",fontWeight:"700",opacity:.9,style:{pointerEvents:"none",paintOrder:"stroke"},stroke:l.containerBg,strokeWidth:"3",children:y(e.alias,10)})]},e.alias)})]}),(0,r.jsxs)("g",{transform:"translate(28, 34)",children:[(0,r.jsx)("rect",{x:"0",y:"0",width:"285",height:60+20*Math.min($.length,4),rx:"10",fill:l.legendBox.fill,stroke:l.legendBox.stroke,opacity:n?.97:.92}),(0,r.jsx)("text",{x:"16",y:"26",fill:l.legendHeadline,fontSize:"13",fontFamily:"monospace",fontWeight:"700",children:"recent signal"}),(0,r.jsxs)("text",{x:"178",y:"26",fill:l.legendAccent,fontSize:"11",fontFamily:"monospace",children:[o.length," messages"]}),$.slice(0,4).map((e,t)=>(0,r.jsxs)("text",{x:"16",y:54+20*t,fill:l.legendText,fontSize:"10",fontFamily:"monospace",children:[y(e.from,8)," ","->"," ",y(e.to,8)," / ",e.count," / ",y(e.content,18)]},e.key))]}),(0,r.jsxs)("g",{transform:"translate(720, 34)",children:[(0,r.jsx)("rect",{x:"0",y:"0",width:"250",height:"112",rx:"10",fill:l.legendBox.fill,stroke:l.legendBox.stroke,opacity:n?.97:.92}),(0,r.jsx)("circle",{cx:"18",cy:"26",r:"6",fill:n?"#059669":"#22c55e"}),(0,r.jsx)("text",{x:"34",y:"30",fill:l.legendText,fontSize:"11",fontFamily:"monospace",children:"working node"}),(0,r.jsx)("circle",{cx:"18",cy:"52",r:"6",fill:n?"#0d9488":"#2dd4bf"}),(0,r.jsx)("text",{x:"34",y:"56",fill:l.legendText,fontSize:"11",fontFamily:"monospace",children:"online idle"}),(0,r.jsx)("circle",{cx:"18",cy:"78",r:"6",fill:n?"#94a3b8":"#6b7280"}),(0,r.jsx)("text",{x:"34",y:"82",fill:l.legendText,fontSize:"11",fontFamily:"monospace",children:"offline / no SSE"}),(0,r.jsx)("path",{d:"M150,78 Q176,52 210,78",fill:"none",stroke:l.flowEdge,strokeWidth:"3",markerEnd:"url(#topo-arrow)"})]})]}),(0,r.jsxs)("div",{className:"absolute bottom-3 right-3 flex items-center gap-1.5 text-xs select-none",children:[(0,r.jsx)("div",{className:"flex items-center rounded-md border overflow-hidden",style:{background:l.legendBox.fill,borderColor:l.containerBorder},role:"group","aria-label":"Node size",children:[["S",.7],["M",.84],["L",1]].map(([e,t],a)=>(0,r.jsx)("button",{onClick:()=>(e=>{_(e);try{localStorage.setItem("anet-topo-nodescale",String(e))}catch{}})(t),"aria-pressed":w===t,title:`Node size: ${"S"===e?"small":"M"===e?"medium":"large"}`,className:`px-2 py-1 transition-colors ${a>0?"border-l":""} ${w===t?"bg-cyan-500/15 text-cyan-300":"hover:bg-white/5"}`,style:{color:w===t?void 0:l.legendText,borderColor:l.containerBorder},children:e},e))}),(0,r.jsxs)("div",{className:"flex items-center rounded-md border overflow-hidden",style:{background:l.legendBox.fill,borderColor:l.containerBorder},children:[(0,r.jsx)("button",{onClick:()=>V(1/1.2),className:"px-2 py-1 hover:bg-white/5 transition-colors",style:{color:l.legendText},"aria-label":"Zoom out",children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M5 12h14"})})}),(0,r.jsxs)("span",{className:"px-2 py-1 tabular-nums border-x text-center",style:{color:l.legendText,borderColor:l.containerBorder,minWidth:46},title:"Current zoom level",children:[Math.round(100*W.zoom),"%"]}),(0,r.jsx)("button",{onClick:()=>V(1.2),className:"px-2 py-1 hover:bg-white/5 transition-colors",style:{color:l.legendText},"aria-label":"Zoom in",children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),(0,r.jsx)("button",{onClick:()=>O({zoom:1,x:0,y:0}),className:"p-1.5 rounded-md border hover:bg-white/5 transition-colors",style:{background:l.legendBox.fill,borderColor:l.containerBorder,color:l.legendText},"aria-label":"Reset view",title:"Reset zoom + pan (or double-click the canvas)",children:(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.4 2.6L3 8"}),(0,r.jsx)("path",{d:"M3 3v5h5"})]})}),(0,r.jsx)("button",{onClick:()=>{let e=B.current;if(e)if(document.fullscreenElement)document.exitFullscreen?.();else{let t=e.requestFullscreen||e.webkitRequestFullscreen;t?.call(e)}},className:"p-1.5 rounded-md border hover:bg-white/5 transition-colors",style:{background:l.legendBox.fill,borderColor:l.containerBorder,color:l.legendText},"aria-label":Y?"Exit fullscreen":"Enter fullscreen",title:Y?"Exit fullscreen":"Fullscreen",children:Y?(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M8 3v4a1 1 0 0 1-1 1H3M21 8h-4a1 1 0 0 1-1-1V3M3 16h4a1 1 0 0 1 1 1v4M16 21v-4a1 1 0 0 1 1-1h4"})}):(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M3 8V5a2 2 0 0 1 2-2h3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M21 16v3a2 2 0 0 1-2 2h-3"})})})]}),U&&(0,r.jsx)(h,{alias:U,onClose:()=>G(null)})]})]})}let _={working:{bg:"bg-green-900/30 border-green-800/30",text:"text-green-300",dot:"bg-green-500",glow:"shadow-green-500/10"},idle:{bg:"bg-cyan-900/30 border-cyan-800/30",text:"text-cyan-300",dot:"bg-cyan-400",glow:"shadow-cyan-500/5"},blocked:{bg:"bg-yellow-900/30 border-yellow-800/30",text:"text-yellow-300",dot:"bg-yellow-500",glow:""},error:{bg:"bg-red-900/30 border-red-800/30",text:"text-red-300",dot:"bg-red-500",glow:""}},C={bg:"bg-gray-800/50 border-gray-700/30",text:"text-gray-500",dot:"bg-gray-500",glow:""};function M({session:e,hasSse:t,sseCount:a,onChat:l}){let i=t&&_[e.status]||C;return(0,r.jsxs)(s.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,prefetch:!1,className:`anet-agent-card group relative block rounded-xl border p-4 transition-all duration-300 cursor-pointer hover:-translate-y-0.5 ${t?`bg-[#111128] border-[#2a2a4a] hover:border-cyan-500/30 hover:shadow-lg ${i.glow}`:"bg-[#0d0d1a] border-[#1a1a2a] opacity-40"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)(d.AliasAvatar,{alias:e.alias,size:22}),(0,r.jsx)("span",{className:"font-semibold text-white truncate text-sm",title:e.alias,children:e.alias}),(0,r.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${i.dot} ${t&&"working"===e.status?"animate-pulse":""}`})]}),(0,r.jsx)("span",{className:`text-[11px] px-2 py-0.5 rounded-md border shrink-0 ${i.bg} ${i.text}`,children:t?e.status:"offline"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)("span",{className:"text-xs text-gray-600 bg-[#0a0a15] px-2 py-0.5 rounded border border-[#1a1a2a]",children:e.agent||"unknown"}),t&&(0,r.jsxs)("span",{className:"text-[10px] text-green-500",children:["SSE:",a]})]}),e.task?(0,r.jsx)("div",{className:"text-xs text-gray-400 bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] line-clamp-2",title:e.task,children:e.task}):(0,r.jsx)("div",{className:"text-xs text-gray-700 italic",children:"No active task"}),e.progress>0&&(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsxs)("div",{className:"flex justify-between text-[10px] mb-1",children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Progress"}),(0,r.jsxs)("span",{className:i.text,children:[e.progress,"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-800 rounded-full h-1.5 overflow-hidden",children:(0,r.jsx)("div",{className:`h-1.5 rounded-full transition-all duration-700 ${"working"===e.status?"bg-green-500":"bg-cyan-500"}`,style:{width:`${Math.min(e.progress,100)}%`}})})]}),(0,r.jsxs)("div",{className:"mt-3 flex justify-between items-center text-[10px] text-gray-600",children:[(0,r.jsx)("span",{className:"truncate",title:e.server||"",children:e.server||"--"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[l&&t&&(0,r.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e.alias)},className:"text-cyan-400 hover:text-cyan-300 px-1.5 py-0.5 rounded border border-cyan-500/20 hover:bg-cyan-500/10 transition-colors",children:"Chat"}),(0,r.jsx)("span",{children:(0,n.timeAgo)(e.updated_at)}),(0,r.jsx)("svg",{"aria-hidden":!0,className:"w-3 h-3 text-gray-700 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-200",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M9 18l6-6-6-6"})})]})]})]})}function z({messages:e}){return 0===e.length?null:(0,r.jsxs)("div",{className:"mt-8",children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-gray-500",children:"Inbox"}),(0,r.jsx)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30",children:e.length})]}),(0,r.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto pr-1 scrollbar-thin",children:e.map(e=>(0,r.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm transition-colors hover:border-[#3a3a5a]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs mb-1.5",children:[e.from_session&&(0,r.jsx)(d.AliasAvatar,{alias:e.from_session,size:16}),(0,r.jsx)("span",{className:"text-gray-200 font-medium truncate",children:e.from_session}),(0,r.jsx)("span",{className:"ml-auto text-gray-600 shrink-0",title:e.created_at,children:(0,n.timeAgo)(e.created_at)})]}),(0,r.jsx)("div",{className:"text-gray-300 leading-relaxed line-clamp-3",title:e.content||"",children:(0,n.previewContent)(e.content)})]},e.id))})]})}function $(){return(0,r.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,r.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8 anet-skeleton-pulse",children:[1,2,3,4].map(e=>(0,r.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-4 py-3",children:[(0,r.jsx)(P,{w:"2.5rem",h:"1.75rem"}),(0,r.jsx)(P,{w:"3.5rem",h:"0.75rem",className:"mt-2"}),(0,r.jsx)(P,{w:"5rem",h:"0.625rem",className:"mt-1"})]},e))}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3 anet-skeleton-pulse",children:[(0,r.jsx)(P,{w:"6rem",h:"2.5rem",rounded:"0.75rem"}),(0,r.jsxs)("div",{className:"flex-1 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-2.5 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full anet-skeleton-bar"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)(P,{w:"6rem",h:"0.875rem"}),(0,r.jsx)(P,{w:"10rem",h:"0.625rem",className:"mt-1"})]})]})]}),(0,r.jsx)("div",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 anet-skeleton-pulse",children:(0,r.jsx)(P,{w:"14rem",h:"0.875rem"})}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-3 anet-skeleton-pulse",children:[1,2,3].map(e=>(0,r.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-3",children:[(0,r.jsx)(P,{w:"2rem",h:"1.25rem"}),(0,r.jsx)(P,{w:"2.5rem",h:"0.75rem",className:"mt-1"}),(0,r.jsx)(P,{w:"3.5rem",h:"0.625rem",className:"mt-px"})]},e))}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-6 anet-skeleton-pulse",children:[1,2,3].map(e=>(0,r.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 flex items-center justify-center gap-2",children:[(0,r.jsx)("div",{className:"w-4 h-4 rounded anet-skeleton-bar"}),(0,r.jsx)(P,{w:"4rem",h:"0.75rem"})]},e))}),(0,r.jsxs)("div",{className:"mb-6 flex gap-2 anet-skeleton-pulse",children:[(0,r.jsx)("div",{className:"flex-1 h-10 rounded-lg border border-[#2a2a4a] bg-[#111128]"}),(0,r.jsx)("div",{className:"w-28 h-10 rounded-lg anet-skeleton-bar"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4 anet-skeleton-pulse",children:[1,2,3,4].map(e=>(0,r.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full anet-skeleton-bar"}),(0,r.jsx)(P,{w:"6rem",h:"0.875rem"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(P,{w:"100%",h:"0.625rem"}),(0,r.jsx)(P,{w:"75%",h:"0.625rem"}),(0,r.jsx)(P,{w:"55%",h:"0.625rem"})]})]},e))})]})}function P({w:e,h:t,rounded:a,className:s}){return(0,r.jsx)("div",{className:`anet-skeleton-bar ${s||""}`,style:{width:e,height:t,borderRadius:a||"0.375rem"}})}var E=e.i(76161),T=e.i(98025),A=e.i(11449);function F(){let{setNetworkId:e}=(0,A.useNetworkId)(),[t,s]=(0,a.useState)({user:null,networks:[],currentNetwork:"",token:""}),[n,l]=(0,a.useState)(!1),[i,o]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[h,x]=(0,a.useState)(""),[u,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=sessionStorage.getItem("anet_v3_auth");if(e)try{s(JSON.parse(e))}catch{}},[]);let[f,p]=(0,a.useState)(!1),[g,b]=(0,a.useState)(""),[y,v]=(0,a.useState)(""),j=async()=>{try{await fetch(`/api/hub/auth?token=${t.token}&endpoint=/api/auth/me`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:g,email:y})});let e=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:g,email:y})}),r=await e.json();if(r.ok&&r.user){let e={...t,user:r.user};s(e),sessionStorage.setItem("anet_v3_auth",JSON.stringify(e)),p(!1)}}catch{}};if(!t.user)return null;let w=(t.user.display_name||t.user.username).slice(0,2).toUpperCase();return(0,r.jsxs)("div",{className:"flex items-center justify-between bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-xs font-bold text-white",children:w}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-sm text-white font-medium",children:t.user.display_name||t.user.username}),(0,r.jsxs)("div",{className:"text-[10px] text-gray-500",children:[t.user.role," · ",t.user.user_id]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[t.networks.length>0&&(0,r.jsx)("select",{value:t.currentNetwork,onChange:r=>{let a={...t,currentNetwork:r.target.value};s(a),e(r.target.value),sessionStorage.setItem("anet_v3_auth",JSON.stringify(a))},className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white focus:outline-none",children:t.networks.map(e=>(0,r.jsx)("option",{value:e.network_id,children:e.network_name},e.network_id))}),(0,r.jsxs)("button",{onClick:()=>{b(t.user?.display_name||""),v(""),p(!f)},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Edit profile",children:[(0,r.jsx)("span",{className:"hidden sm:inline",children:"Edit"}),(0,r.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.862 4.487z"})})]}),(0,r.jsxs)("button",{onClick:()=>{s({user:null,networks:[],currentNetwork:"",token:""}),sessionStorage.removeItem("anet_v3_auth")},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Sign out",children:[(0,r.jsx)("span",{className:"hidden sm:inline",children:"Sign out"}),(0,r.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})})]})]}),f&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#2a2a4a]",children:[(0,r.jsx)("input",{type:"text",value:g,onChange:e=>b(e.target.value),placeholder:"Display name",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-32"}),(0,r.jsx)("input",{type:"email",value:y,onChange:e=>v(e.target.value),placeholder:"Email",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-40"}),(0,r.jsx)("button",{onClick:j,className:"px-2 py-1 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded",children:"Save"})]})]})}var L=e.i(6694);function R({tabs:e,activeTab:t,onOpenTab:a,onCloseTab:s,onSetActive:n,onClose:l}){return 0===e.length?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{onClick:l,className:"jsx-f7cf3d1a6fdfc074 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,r.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,r.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 flex items-center border-b border-[#2a2a4a] bg-[#0d0d1a] overflow-x-auto",children:[(0,r.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 flex min-w-0",children:e.map(e=>(0,r.jsxs)("button",{onClick:()=>n(e),className:`jsx-f7cf3d1a6fdfc074 flex items-center gap-1.5 px-3 py-2.5 text-xs border-b-2 transition-colors shrink-0 ${t===e?"border-cyan-400 text-cyan-300 bg-cyan-500/5":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,r.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 w-2 h-2 rounded-full ${t===e?"bg-cyan-400":"bg-gray-600"}`}),(0,r.jsx)("span",{className:"jsx-f7cf3d1a6fdfc074 max-w-[80px] truncate",children:e}),(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),s(e)},className:"jsx-f7cf3d1a6fdfc074 ml-1 text-gray-600 hover:text-gray-300 p-0.5",children:"×"})]},e))}),(0,r.jsx)("button",{onClick:l,className:"jsx-f7cf3d1a6fdfc074 text-gray-500 hover:text-white px-3 py-2.5 shrink-0 border-l border-[#2a2a4a]",children:(0,r.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-f7cf3d1a6fdfc074 w-4 h-4",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-f7cf3d1a6fdfc074"})})})]}),(0,r.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 relative overflow-hidden",children:e.map(e=>(0,r.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 absolute inset-0 ${t===e?"block":"hidden"}`,children:(0,r.jsx)(B,{alias:e})},e))})]}),(0,r.jsx)(L.default,{id:"f7cf3d1a6fdfc074",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}function B({alias:e}){return(0,r.jsx)(c.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0})}function I({sessions:e,onClose:t}){let[s,n]=(0,a.useState)(new Set),[l,i]=(0,a.useState)(""),[o,c]=(0,a.useState)("normal"),[h,x]=(0,a.useState)(!1),[u,m]=(0,a.useState)([]),[f,p]=(0,a.useState)(""),g=e.filter(e=>"offline"!==e.status).filter(e=>!f||e.alias.toLowerCase().includes(f.toLowerCase())||(e.agent||"").toLowerCase().includes(f.toLowerCase())),b=async()=>{if(!l.trim()||0===s.size||h)return;x(!0),m([]);let e=[...s].map(async e=>{try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:l,priority:o})}),r=await t.json();return{alias:e,ok:!!r.ok,error:r.error}}catch(t){return{alias:e,ok:!1,error:"send failed"}}});m(await Promise.all(e)),x(!1)},y=u.filter(e=>e.ok).length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40 anet-fade-in",onClick:t}),(0,r.jsxs)("div",{className:"fixed inset-4 lg:inset-x-[15%] lg:inset-y-[5%] bg-[#0a0a1a] border border-[#2a2a4a] rounded-2xl z-50 flex flex-col shadow-2xl shadow-black/70 overflow-hidden anet-fade-in",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-lg font-bold text-white",children:"Dispatch Task"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Send a task to one or more agents"})]}),(0,r.jsx)("button",{onClick:t,className:"text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden",children:[(0,r.jsxs)("div",{className:"lg:w-[280px] border-b lg:border-b-0 lg:border-r border-[#2a2a4a] flex flex-col",children:[(0,r.jsxs)("div",{className:"px-4 py-3 border-b border-[#2a2a4a]",children:[(0,r.jsx)("input",{type:"text",value:f,onChange:e=>p(e.target.value),placeholder:"Filter agents...",className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,r.jsx)("button",{onClick:()=>{s.size===g.length?n(new Set):n(new Set(g.map(e=>e.alias)))},className:"text-[10px] text-cyan-400 hover:text-cyan-300",children:s.size===g.length?"Deselect all":`Select all (${g.length})`}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:[s.size," selected"]})]})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5 max-h-[200px] lg:max-h-none",children:[g.map(e=>(0,r.jsxs)("button",{onClick:()=>{var t;return t=e.alias,void n(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-left transition-colors ${s.has(e.alias)?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/20":"text-gray-400 hover:bg-[#1a1a2a]"}`,children:[(0,r.jsx)(d.AliasAvatar,{alias:e.alias,size:16}),(0,r.jsx)("div",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"working"===e.status?"bg-green-400":"idle"===e.status?"bg-cyan-400":"bg-gray-500"}`}),(0,r.jsx)("span",{className:"truncate flex-1",children:e.alias}),(0,r.jsx)("span",{className:"text-[9px] text-gray-600",children:e.agent||"--"})]},e.alias)),0===g.length&&(0,r.jsx)("div",{className:"text-center text-xs text-gray-600 py-4",children:"No online agents"})]})]}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,r.jsxs)("div",{className:"flex-1 px-6 py-4 flex flex-col",children:[(0,r.jsx)("label",{className:"text-xs text-gray-500 uppercase mb-2",children:"Task Prompt"}),(0,r.jsx)("textarea",{value:l,onChange:e=>i(e.target.value),placeholder:"Enter the task you want to dispatch...",className:"flex-1 min-h-[120px] bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none"}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[(0,r.jsxs)("select",{value:o,onChange:e=>c(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white focus:outline-none",children:[(0,r.jsx)("option",{value:"normal",children:"Normal priority"}),(0,r.jsx)("option",{value:"high",children:"High priority"}),(0,r.jsx)("option",{value:"low",children:"Low priority"})]}),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsx)("button",{onClick:b,disabled:h||!l.trim()||0===s.size,className:"px-6 py-2.5 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 disabled:from-gray-800 disabled:to-gray-800 disabled:text-gray-600 text-white text-sm font-medium rounded-xl transition-all shadow-lg shadow-cyan-500/10 disabled:shadow-none active:scale-95",children:h?(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Sending..."]}):`Dispatch to ${s.size} agent${s.size>1?"s":""}`})]})]}),u.length>0&&(0,r.jsxs)("div",{className:"px-6 py-3 border-t border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,r.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:[y,"/",u.length," dispatched successfully"]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:u.map(e=>(0,r.jsxs)("span",{className:`flex items-center gap-1.5 text-[10px] pl-1 pr-2 py-0.5 rounded-full border ${e.ok?"text-green-300 border-green-500/20 bg-green-500/5":"text-red-300 border-red-500/20 bg-red-500/5"}`,children:[(0,r.jsx)(d.AliasAvatar,{alias:e.alias,size:14}),(0,r.jsx)("span",{children:e.alias}),(0,r.jsx)("span",{"aria-hidden":!0,children:e.ok?"✓":e.error||"✗"})]},e.alias))})]})]})]})]})]})}var W=e.i(59276),O=e.i(2684),H=e.i(50111);e.s(["default",0,function(){let e,i,c,h,x;(0,a.useEffect)(()=>{sessionStorage.getItem("anet_v3_auth")||(fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login"))},[]);let{sessions:u,hint:m,error:f,isLoading:p}=(0,W.useSessions)(),{health:g}=(0,W.useHealth)(),{config:b}=(0,W.useAnetConfig)(),{tasks:y}=(0,W.useTasks)({limit:"500"}),{stats:v}=(0,W.useStats)(),[j,w]=(0,a.useState)(window.innerWidth>=1024),[k,N]=(0,a.useState)(!1),_=function(){let[e,t]=(0,a.useState)([]),[r,s]=(0,a.useState)("");return{tabs:e,activeTab:r,openTab:e=>{t(t=>t.includes(e)?t:[...t,e]),s(e)},closeTab:e=>{t(t=>{let a=t.filter(t=>t!==e);return r===e&&s(a[a.length-1]||""),a})},closeAll:()=>{t([]),s("")},setActiveTab:s}}(),[C,P]=(0,a.useState)(!1),[A,L]=(0,a.useState)([]),[B,D]=(0,a.useState)("all"),[Y,X]=(0,a.useState)(null),{mutate:U}=(0,H.useSWRConfig)(),G="1"!==t.default.env.NEXT_PUBLIC_DISABLE_SSE,{connected:J,supported:V}=(0,O.useSSE)({url:"/api/hub/events",enabled:G,onEvent:e=>{if("node.renamed"===e.type){U("/api/hub/status");let t=e.data;t?.old_alias&&t?.new_alias&&X({from:t.old_alias,to:t.new_alias,ts:Date.now()});return}["new_task","new_message","new_reply","node_status_changed","broadcast"].includes(e.type)&&(U("/api/hub/status"),U(e=>"string"==typeof e&&e.startsWith("/api/hub/tasks"),void 0,{revalidate:!0}))}});if((0,a.useEffect)(()=>{let e=()=>{fetch("/api/hub/inbox").then(e=>e.json()).then(e=>{e.messages?.length&&L(t=>{let r=new Set(t.map(e=>e.id));return[...e.messages.filter(e=>!r.has(e.id)),...t].slice(0,100)})}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),p)return(0,r.jsx)($,{});let q=g?.sse_sessions||{},K=e=>(e.network_id?q[`${e.network_id}:${e.alias}`]:void 0)??q[e.alias],Z=e=>"offline"!==e.status||!!K(e),Q=u.filter(Z).length,ee=u.length,et=u.filter(e=>"working"===e.status).length,er=g?(0,n.formatUptime)(g.uptime):"--",ea=g?.version||"--",es=!!(b?.hub&&b.tokenConfigured),en=b?.source==="file"?"Local config":b?.source==="runtime-env"?"Runtime env":"Config missing",el={};if(v?.tasks?.by_status?.length)for(let e of v.tasks.by_status)el[e.status]=e.count;else for(let e of y)el[e.status]=(el[e.status]||0)+1;let ei=[...u].sort((e,t)=>{let r=+!!Z(e),a=+!!Z(t);if(r!==a)return a-r;let s=+("working"===e.status);return("working"===t.status)-s}),eo=0===u.length&&!f;return(0,r.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,r.jsx)("div",{className:"lg:ml-0 ml-10",children:(0,r.jsx)(l,{online:Q,working:et,total:ee,version:ea,uptime:er})}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[!eo&&(0,r.jsx)("button",{onClick:()=>P(!0),className:"px-4 py-2 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white text-sm font-medium rounded-xl shadow-lg shadow-cyan-500/10 transition-all active:scale-95 shrink-0",children:"⚡ Dispatch"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(F,{})})]}),(0,r.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,r.jsxs)("button",{onClick:()=>N(!k),className:"w-full flex items-center justify-between text-left",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"uppercase text-gray-600",children:"Config"}),(0,r.jsx)("span",{className:`w-2 h-2 rounded-full ${es?"bg-green-400":"bg-red-400"}`}),(0,r.jsx)("span",{className:"text-gray-500",children:en})]}),(0,r.jsx)("svg",{className:`w-4 h-4 text-gray-600 transition-transform ${k?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),k&&(0,r.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a]",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsx)("div",{className:"min-w-0",children:(0,r.jsxs)("div",{className:"text-gray-100 truncate text-sm",title:b?.hub||void 0,children:["Hub: ",(0,r.jsx)("span",{className:b?.hub?"text-cyan-300":"text-red-300",children:b?.hub?.trim()||"not configured"})]})}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2 text-xs",children:(0,r.jsxs)("span",{className:`px-2.5 py-1 rounded-md border ${b?.tokenConfigured?"bg-blue-500/5 text-blue-300 border-blue-500/20":"bg-gray-500/5 text-gray-400 border-gray-500/20"}`,children:["Token: ",b?.tokenPreview||"not configured"]})})]}),b?.error&&(0,r.jsx)("div",{className:"mt-2 text-xs text-gray-600",children:b.error})]})]}),Object.keys(el).length>0&&(0,r.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("div",{className:"text-xs uppercase text-gray-600",children:"Task Status"}),(0,r.jsx)(s.default,{href:"/tasks",prefetch:!1,className:"text-xs text-cyan-400 hover:text-cyan-300",children:"View all →"})]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:["running","delivered","acked","replied","created","failed","cancelled","expired","closed"].filter(e=>el[e]).map(e=>(0,r.jsxs)(s.default,{href:`/tasks?status=${e}`,prefetch:!1,className:`px-2.5 py-1 rounded-md border text-xs ${T.STATUS_CHIP_CLASS[e]} hover:opacity-80 transition-opacity`,children:[e,": ",el[e]]},e))})]}),!eo&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-[0.12em] text-gray-600 mb-2",children:"Quick navigation"}),(0,r.jsx)("section",{className:"mb-3 grid grid-cols-3 gap-2 sm:gap-3",children:(e=u.filter(e=>Z(e)&&"working"!==e.status).length,i=ee-Q,c=y.filter(e=>"failed"===e.status).length,[{href:"/nodes",label:"Nodes",value:`${Q}/${ee}`,sub:`${ee>0?Math.round(Q/ee*100):0}% online`,color:"text-green-400 border-green-500/20",popover:0===ee?null:[{k:"working",v:et,dot:"",color:"#4ade80"},{k:"idle",v:e,dot:"",color:"#22d3ee"},{k:"offline",v:i,dot:"",color:"#9ca3af"}]},{href:"/tasks",label:"Tasks",value:String(Object.values(el).reduce((e,t)=>e+t,0)||0),sub:"all-time",color:"text-cyan-400 border-cyan-500/20",popover:0===Object.keys(el).length?null:["running","replied","failed","cancelled","expired","closed","created","delivered","acked"].filter(e=>el[e]).map(e=>({k:e,v:el[e],dot:"",color:({running:"#4ade80",replied:"#a78bfa",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c",closed:"#9ca3af",created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee"})[e]||"#9ca3af"}))},{href:"/tasks?status=failed",label:"Failed",value:String(el.failed||0),sub:el.failed?"needs review":"none",color:el.failed?"text-red-400 border-red-500/25":"text-gray-500 border-gray-700/30",popover:c?[{k:`${c} in current view`,v:"",dot:"",color:"#f87171"}]:[{k:"no failures yet",v:"",dot:"",color:"#4b5563"}]}].map(e=>(0,r.jsxs)(s.default,{href:e.href,prefetch:!1,className:`anet-stat-link group relative rounded-xl border ${e.color} bg-[#111128] px-3 py-3 transition-all hover:-translate-y-px`,children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,r.jsx)("div",{className:`text-xl font-semibold tabular-nums ${e.color.split(" ")[0]}`,children:e.value}),(0,r.jsx)("div",{className:"hidden sm:block text-[10px] text-gray-600 group-hover:text-gray-400 transition-colors",children:"View →"})]}),(0,r.jsx)("div",{className:"text-[11px] text-gray-400 mt-0.5",children:e.label}),(0,r.jsx)("div",{className:"text-[10px] text-gray-600 mt-px",children:e.sub}),e.popover&&e.popover.length>0&&(0,r.jsxs)("div",{className:"anet-stat-popover hidden md:block pointer-events-none absolute left-2 right-2 top-full mt-1 z-20 rounded-lg border border-[#2a2a4a] bg-[#0d0d1a] shadow-lg shadow-black/30 px-3 py-2 opacity-0 translate-y-[-2px] group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-150 delay-100",children:[(0,r.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-1.5",children:"Breakdown"}),(0,r.jsx)("ul",{className:"space-y-1",children:e.popover.map(e=>(0,r.jsxs)("li",{className:"flex items-center gap-2 text-[11px]",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:e.color},"aria-hidden":!0}),(0,r.jsx)("span",{className:"text-gray-400 capitalize",children:e.k}),""!==e.v&&(0,r.jsx)("span",{className:"ml-auto text-gray-300 tabular-nums font-medium",children:e.v})]},e.k))})]})]},e.href)))}),(0,r.jsx)("section",{className:"mb-6 grid grid-cols-3 gap-2 sm:gap-3",children:[{href:"/messages",label:"Messages",icon:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},{href:"/logs",label:"Audit log",icon:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8"},{href:"/admin",label:"Admin",icon:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4z M6 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2"}].map(e=>(0,r.jsxs)(s.default,{href:e.href,prefetch:!1,className:"anet-nav-tile flex items-center justify-center gap-2 rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 text-[12px] text-gray-400 hover:text-gray-200 transition-colors",children:[(0,r.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:e.icon})}),(0,r.jsx)("span",{children:e.label})]},e.href))}),(0,r.jsx)(o,{}),y.length>0&&(0,r.jsxs)("section",{className:"mb-6 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Recent Activity"}),(0,r.jsx)(s.default,{href:"/tasks",className:"text-xs text-cyan-400 hover:text-cyan-300",children:"All tasks →"})]}),(0,r.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:y.slice(0,5).map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:T.STATUS_DOT_HEX[e.status]||"#6b7280"}}),e.from_name&&(0,r.jsx)(d.AliasAvatar,{alias:e.from_name,size:14}),(0,r.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:e.from_name||"?"}),(0,r.jsx)("span",{className:"text-gray-600",children:"→"}),e.to_name&&(0,r.jsx)(d.AliasAvatar,{alias:e.to_name,size:14}),(0,r.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:e.to_name||"?"}),(0,r.jsx)("span",{className:"text-gray-500 truncate flex-1",title:e.content||"",children:(0,n.previewContent)(e.content).slice(0,60)}),(0,r.jsx)("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] border ${T.STATUS_CHIP_CLASS[e.status]||"text-gray-500 border-gray-700/30"}`,children:e.status})]},e.task_id))})]})]}),f&&(0,r.jsxs)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-3 rounded-lg mb-6 text-sm flex items-center justify-between",role:"alert",children:[(0,r.jsx)("span",{children:String(f)}),(0,r.jsx)("span",{className:"text-gray-500 text-xs",children:"Check CommHub connection"})]}),u.length>0&&(0,r.jsx)("div",{className:"flex justify-center mb-4",children:(0,r.jsx)("button",{onClick:()=>w(!j),className:"text-xs text-gray-500 hover:text-gray-300 border border-gray-700/50 px-4 py-1.5 rounded-lg transition-colors hover:border-gray-600 cursor-pointer",children:j?"Hide Topology":"Show Topology"})}),!j&&u.length>0&&(0,r.jsx)("div",{className:"lg:hidden text-center text-xs text-gray-600 mb-4",children:"Topology hidden on mobile for better readability"}),j&&u.length>0&&(0,r.jsx)(S,{sessions:u,sseSessions:q,renameSignal:Y}),0!==u.length||f?(h={all:ei.length,working:ei.filter(e=>Z(e)&&"working"===e.status).length,idle:ei.filter(e=>Z(e)&&"working"!==e.status).length,offline:ei.filter(e=>!Z(e)).length},x=ei.filter(e=>"all"===B||("offline"===B?!Z(e):"working"===B?Z(e)&&"working"===e.status:"idle"!==B||Z(e)&&"working"!==e.status)),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-3 flex flex-wrap items-center gap-1",children:[{key:"all",label:"All"},{key:"working",label:"Working",dot:"#4ade80"},{key:"idle",label:"Idle",dot:"#22d3ee"},{key:"offline",label:"Offline",dot:"#6b7280"}].map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>D(e.key),disabled:0===h[e.key]&&"all"!==e.key,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${B===e.key?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/30":"text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] border border-transparent"}`,children:[e.dot&&(0,r.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:e.dot}}),(0,r.jsx)("span",{children:e.label}),(0,r.jsx)("span",{className:`text-[10px] tabular-nums ${B===e.key?"text-cyan-400":"text-gray-600"}`,children:h[e.key]})]},e.key))}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4",children:x.map(e=>(0,r.jsx)(M,{session:e,hasSse:Z(e),sseCount:K(e)||0,onChat:_.openTab},e.alias))}),0===x.length&&(0,r.jsxs)("div",{className:"mt-4 text-center text-xs text-gray-600",children:['No agents match "',B,'" — ',(0,r.jsx)("button",{onClick:()=>D("all"),className:"underline hover:text-gray-400",children:"Show all"})]})]})):(0,r.jsx)(E.NodesEmptyState,{hint:m,taskHistoryCount:Object.values(el).reduce((e,t)=>e+t,0)}),(0,r.jsx)(z,{messages:A}),(0,r.jsx)("div",{className:"mt-8 text-center text-xs text-gray-600 flex items-center justify-center gap-2 flex-wrap",children:V&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${J?"bg-green-400":"bg-gray-600"}`}),J?"SSE live":"SWR polling"]})}),C&&(0,r.jsx)(I,{sessions:u,onClose:()=>P(!1)}),_.tabs.length>0&&(0,r.jsx)(R,{tabs:_.tabs,activeTab:_.activeTab,onOpenTab:_.openTab,onCloseTab:_.closeTab,onSetActive:_.setActiveTab,onClose:_.closeAll})]})}],18722)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3479,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60);return t>0?`${t}h ${r}m`:`${r}m`},"previewContent",0,function(e){return e&&e.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},98025,e=>{"use strict";e.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-blue-500/10 text-blue-300 border-blue-500/20",blocked:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",error:"bg-red-500/10 text-red-300 border-red-500/20",offline:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"SESSION_STATUS_TEXT_CLASS",0,{working:"text-green-400",idle:"text-blue-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-blue-500",acked:"bg-cyan-500",running:"bg-green-500",replied:"bg-purple-500",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-yellow-500",expired:"bg-orange-500"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-blue-500/10 text-blue-300 border-blue-500/20",acked:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-purple-500/10 text-purple-300 border-purple-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",expired:"bg-orange-500/10 text-orange-300 border-orange-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee",running:"#4ade80",replied:"#a78bfa",closed:"#6b7280",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},9853,e=>{"use strict";var t=e.i(22381),r=e.i(23910),a=e.i(56839),s=e.i(12629),l=e.i(3479),d=e.i(98025);let n=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()};function i({steps:e}){return e.filter(e=>e.time).length,(0,t.jsx)("div",{className:"relative",children:e.map((r,a)=>{let s=!!r.time,d=a===e.length-1;return(0,t.jsxs)("div",{className:"flex gap-4 pb-6 last:pb-0",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:`w-3 h-3 rounded-full border-2 shrink-0 ${s?`${r.color} border-current`:"border-gray-700 bg-transparent"}`}),!d&&(0,t.jsx)("div",{className:`w-0.5 flex-1 mt-1 ${s&&e[a+1]?.time?"bg-cyan-500/40":"bg-gray-800"}`})]}),(0,t.jsxs)("div",{className:"min-w-0 -mt-0.5",children:[(0,t.jsx)("div",{className:`text-sm font-medium ${s?"text-gray-200":"text-gray-600"}`,children:r.label}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:r.time?`${(0,l.timeAgo)(r.time)} — ${r.time}`:"Pending"})]})]},r.label)})})}e.s(["default",0,function({params:e}){let{id:o}=(0,r.use)(e),{data:c,isLoading:x}=(0,s.default)(`/api/hub/tasks?task_id=${encodeURIComponent(o)}`,n,{refreshInterval:5e3}),{data:g}=(0,s.default)(`/api/hub/task-events?task_id=${encodeURIComponent(o)}&limit=50`,n,{refreshInterval:1e4}),m=c?.tasks?.[0];if(x)return(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:(0,t.jsxs)("div",{className:"animate-pulse space-y-4",children:[(0,t.jsx)("div",{className:"h-8 w-48 bg-gray-800 rounded"}),(0,t.jsx)("div",{className:"h-64 bg-gray-800/20 rounded-lg"})]})});if(!m)return(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-gray-600 text-4xl mb-4",children:"--"}),(0,t.jsx)("p",{className:"text-gray-400",children:"Task not found"}),(0,t.jsx)(a.default,{href:"/tasks",className:"text-cyan-400 text-sm mt-2 inline-block",children:"Back to tasks"})]})});let b=d.STATUS_CHIP_CLASS[m.status]||d.STATUS_CHIP_CLASS.created,u=[{label:"Created",time:m.created_at,color:"text-gray-400"},{label:"Delivered",time:m.delivered_at,color:"text-blue-400"},{label:"Started",time:m.started_at,color:"text-green-400"},{label:"Completed",time:m.completed_at,color:"text-purple-400"}];return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)(a.default,{href:"/tasks",className:"text-gray-500 hover:text-gray-300 text-sm lg:ml-0 ml-10",children:"← Tasks"}),(0,t.jsx)("h1",{className:"text-xl font-bold text-white truncate",children:"Task Detail"}),(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${b}`,children:m.status})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Timeline"}),(0,t.jsx)(i,{steps:u})]}),(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Info"}),(0,t.jsx)("div",{className:"space-y-2 text-xs",children:[["Task ID",m.task_id],["From",m.from_name],["To",m.to_name],["Priority",m.priority],["Status",m.status],["Expires",m.expires_at]].map(([e,r])=>(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"text-gray-500",children:e}),(0,t.jsx)("span",{className:"text-gray-300 truncate max-w-[200px]",title:String(r||""),children:String(r||"--")})]},e))})]})]}),(0,t.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Content"}),(0,t.jsx)("div",{className:"text-sm text-gray-300 whitespace-pre-wrap bg-[#0a0a15] rounded-lg px-4 py-3 border border-[#1a1a2a]",children:m.content||"--"})]}),m.result&&(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Result"}),(0,t.jsx)("div",{className:"text-sm text-gray-300 whitespace-pre-wrap bg-[#0a0a15] rounded-lg px-4 py-3 border border-[#1a1a2a] max-h-96 overflow-y-auto",children:m.result})]}),g?.events&&g.events.length>0&&(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:["Events (",g.events.length,")"]}),(0,t.jsx)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:g.events.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"running"===e.to_status?"bg-green-400":"replied"===e.to_status?"bg-purple-400":"failed"===e.to_status?"bg-red-400":"bg-blue-400"}`}),(0,t.jsx)("span",{className:"text-gray-400",children:e.event_type}),e.from_status&&(0,t.jsxs)("span",{className:"text-gray-600",children:[e.from_status," → ",e.to_status]}),(0,t.jsx)("span",{className:"text-gray-600 ml-auto shrink-0",children:(0,l.timeAgo)(e.created_at)})]},e.id||r))})]})]})]})]})}])}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,59276,e=>{"use strict";var t=e.i(12629),a=e.i(11449);let s=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function l(e,t){if(!t)return e;let a=e.includes("?")?"&":"?";return`${e}${a}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",s,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:a}=(0,t.default)("/api/hub/health",s,r);return{health:e||null,error:a}},"useLicense",0,function(){let{data:e,error:a}=(0,t.default)("/api/hub/license",s,{refreshInterval:6e4});return{license:e?.ok?e:null,error:a}},"useMessages",0,function(e=100){let{networkId:n}=(0,a.useNetworkId)(),{data:i,error:d,isLoading:o}=(0,t.default)(l(`/api/hub/messages?limit=${e}`,n),s,r);return{messages:i?.messages||[],error:d,isLoading:o}},"useSessions",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:n,error:i,isLoading:d}=(0,t.default)(l("/api/hub/status",e),s,r);return{sessions:n?.sessions||[],hint:n?._hint,error:i,isLoading:d}},"useStats",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:n,error:i}=(0,t.default)(l("/api/hub/stats",e),s,r);return{stats:n?.ok?n:null,error:i}},"useTasks",0,function(e){let{networkId:n}=(0,a.useNetworkId)(),i=new URLSearchParams({limit:"100",...e}).toString(),{data:d,error:o,isLoading:c}=(0,t.default)(l(`/api/hub/tasks?${i}`,n),s,r);return{tasks:d?.tasks||[],count:d?.count??0,source:d?.source,error:o,isLoading:c}}])},3479,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60);return t>0?`${t}h ${a}m`:`${a}m`},"previewContent",0,function(e){return e&&e.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},46228,e=>{"use strict";var t=e.i(22381);let a=[180,200,220,270,300,330,30,90];function s(e){let t=0;for(let a=0;a<e.length;a++)t=31*t+e.charCodeAt(a)>>>0;let s=a[t%a.length];return{bg:`hsl(${s} 55% 22%)`,ring:`hsl(${s} 60% 45%)`,text:`hsl(${s} 80% 78%)`}}function r(e){return e?(e.trim().match(/[\p{L}\p{N}]/u)?.[0]||e.trim()[0]||"·").toUpperCase():"·"}e.s(["AliasAvatar",0,function({alias:e,size:a=28,className:l=""}){let n=s(e),i=Math.max(9,Math.round(.42*a));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${l}`,style:{width:a,height:a,fontSize:i,backgroundColor:n.bg,borderColor:n.ring,color:n.text},title:e,"aria-hidden":!0,children:r(e)})},"aliasAvatarColors",0,s,"aliasInitial",0,r])},98025,e=>{"use strict";e.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-blue-500/10 text-blue-300 border-blue-500/20",blocked:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",error:"bg-red-500/10 text-red-300 border-red-500/20",offline:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"SESSION_STATUS_TEXT_CLASS",0,{working:"text-green-400",idle:"text-blue-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-blue-500",acked:"bg-cyan-500",running:"bg-green-500",replied:"bg-purple-500",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-yellow-500",expired:"bg-orange-500"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-blue-500/10 text-blue-300 border-blue-500/20",acked:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-purple-500/10 text-purple-300 border-purple-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",expired:"bg-orange-500/10 text-orange-300 border-orange-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee",running:"#4ade80",replied:"#a78bfa",closed:"#6b7280",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},28729,e=>{"use strict";var t=e.i(22381),a=e.i(23910),s=e.i(59276),r=e.i(3479),l=e.i(46228),n=e.i(98025);e.s(["default",0,function(){let{sessions:e}=(0,s.useSessions)(),{health:i}=(0,s.useHealth)(),{stats:d}=(0,s.useStats)(),o=i?.sse_sessions||{},c=e=>(e.network_id?o[`${e.network_id}:${e.alias}`]:void 0)??o[e.alias],[x,u]=(0,a.useState)(""),[g,h]=(0,a.useState)(""),[m,b]=(0,a.useState)(""),[p,f]=(0,a.useState)(""),[y,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(""),[S,w]=(0,a.useState)(""),[k,T]=(0,a.useState)(""),C=async()=>{if(x.trim()&&g.trim()){try{let e=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"register",username:x,password:g})}),t=await e.json();b(t.ok?`Created: ${t.user.username} (${t.user.user_id})`:`Failed: ${t.error}`),t.ok&&(u(""),h(""))}catch{b("Failed")}setTimeout(()=>b(""),8e3)}},A=async()=>{if(p.trim()){try{let e=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:p})}),t=await e.json();j(t.ok?`Sent to ${t.recipients} nodes`:`Failed: ${t.error}`),t.ok&&f("")}catch{j("Failed")}setTimeout(()=>j(""),5e3)}},$=async()=>{if(v&&S.trim()){try{let e=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:v,task:S})}),t=await e.json();T(t.ok?"Task sent":`Failed: ${t.error}`),t.ok&&w("")}catch{T("Failed")}setTimeout(()=>T(""),5e3)}},_=e.filter(e=>c(e)),I=e.filter(e=>!c(e));return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white mb-3 lg:ml-0 ml-10",children:"Admin"}),(0,t.jsx)("nav",{className:"mb-8 flex flex-wrap gap-1 text-xs",children:[{href:"#status",label:"Status"},{href:"#actions",label:"Actions"},{href:"#users",label:"Users"}].map(e=>(0,t.jsx)("a",{href:e.href,className:"rounded-md px-2.5 py-1 text-gray-500 hover:text-cyan-300 hover:bg-cyan-500/10 transition-colors",children:e.label},e.href))}),(0,t.jsxs)("div",{className:"max-w-6xl space-y-10",children:[(0,t.jsxs)("div",{id:"status",className:"space-y-4 scroll-mt-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Status"}),(0,t.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-green-400 tabular-nums",children:_.length}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Online"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-gray-500 tabular-nums",children:I.length}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Offline"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-cyan-400 tabular-nums",children:i?.sse_connections??"--"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:["SSE Streams ",(0,t.jsx)("span",{className:"text-gray-600",children:"· server"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-white tabular-nums",children:d?.tasks?.total??"--"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Total Tasks"})]})]}),d?.tasks?.by_status&&d.tasks.by_status.length>0&&(0,t.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:d.tasks.by_status.map(e=>(0,t.jsxs)("span",{className:`text-xs px-2 py-1 rounded border ${n.STATUS_CHIP_CLASS[e.status]||"bg-[#0a0a15] border-[#1a1a2a] text-gray-400"}`,children:[e.status,": ",e.count]},e.status))})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:["Online Sessions ",(0,t.jsxs)("span",{className:"text-gray-600",children:["(",_.length,")"]})]}),(0,t.jsx)("div",{className:"space-y-2 max-h-80 overflow-y-auto",children:0===_.length?(0,t.jsx)("div",{className:"text-xs text-gray-600 text-center py-4",children:"No online sessions"}):_.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a]",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.alias,size:20}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-sm text-white font-medium truncate",children:e.alias}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 truncate",children:[e.agent||"--"," · ",e.task||"idle"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded border ${n.SESSION_STATUS_CHIP_CLASS[e.status]||n.SESSION_STATUS_CHIP_CLASS.idle}`,children:e.status}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,r.timeAgo)(e.updated_at)})]})]},e.alias))})]})]})]}),(0,t.jsxs)("div",{id:"actions",className:"space-y-4 scroll-mt-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Actions"}),(0,t.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),0===e.length?(0,t.jsx)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl px-5 py-4 text-sm text-gray-500",children:"Broadcast and Send Task become available after the first agent registers."}):(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Broadcast"}),(0,t.jsx)("textarea",{value:p,onChange:e=>f(e.target.value),placeholder:"Message to all online nodes...",rows:3,className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none resize-none"}),(0,t.jsxs)("div",{className:"flex justify-between items-center mt-3",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-600",children:[p.length,"/500"]}),(0,t.jsx)("button",{onClick:A,disabled:!p.trim(),className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Broadcast"})]}),y&&(0,t.jsx)("div",{className:`mt-2 text-xs ${y.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:y})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Send Task"}),(0,t.jsxs)("select",{value:v,onChange:e=>N(e.target.value),className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white focus:border-cyan-500/50 focus:outline-none mb-3",children:[(0,t.jsx)("option",{value:"",children:"Select target node..."}),_.map(e=>(0,t.jsxs)("option",{value:e.alias,children:[e.alias," (",e.status,")"]},e.alias)),(0,t.jsx)("optgroup",{label:"Offline",children:I.map(e=>(0,t.jsxs)("option",{value:e.alias,children:[e.alias," (offline)"]},e.alias))})]}),(0,t.jsx)("textarea",{value:S,onChange:e=>w(e.target.value),placeholder:"Task content...",rows:3,className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none resize-none"}),(0,t.jsx)("div",{className:"flex justify-end mt-3",children:(0,t.jsx)("button",{onClick:$,disabled:!v||!S.trim(),className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Send Task"})}),k&&(0,t.jsx)("div",{className:`mt-2 text-xs ${k.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:k})]})]})]}),(0,t.jsxs)("div",{id:"users",className:"space-y-4 scroll-mt-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Users"}),(0,t.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Register User (V3)"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("input",{type:"text",value:x,onChange:e=>u(e.target.value),placeholder:"Username",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,t.jsx)("input",{type:"password",value:g,onChange:e=>h(e.target.value),placeholder:"Password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,t.jsx)("button",{onClick:C,disabled:!x.trim()||!g.trim(),className:"w-full px-4 py-2 bg-green-600 hover:bg-green-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Register"})]}),m&&(0,t.jsx)("div",{className:`mt-2 text-xs ${m.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:m})]})})]})]})]})}])}]);