@sleep2agi/agent-network-dashboard 0.5.7-preview.2 → 0.5.7-preview.21

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 (226) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/diagnostics/route-bundle-stats.json +46 -46
  4. package/.next/fallback-build-manifest.json +3 -3
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +3 -3
  15. package/.next/server/app/_not-found.rsc +13 -13
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
  17. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  18. package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
  19. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/admin.html +3 -3
  24. package/.next/server/app/admin.rsc +15 -15
  25. package/.next/server/app/admin.segments/_full.segment.rsc +15 -15
  26. package/.next/server/app/admin.segments/_head.segment.rsc +4 -4
  27. package/.next/server/app/admin.segments/_index.segment.rsc +8 -8
  28. package/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
  29. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +4 -4
  30. package/.next/server/app/admin.segments/admin.segment.rsc +3 -3
  31. package/.next/server/app/index.html +3 -3
  32. package/.next/server/app/index.rsc +15 -15
  33. package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  34. package/.next/server/app/index.segments/_full.segment.rsc +15 -15
  35. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  36. package/.next/server/app/index.segments/_index.segment.rsc +8 -8
  37. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  38. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app/login.html +2 -2
  40. package/.next/server/app/login.rsc +15 -15
  41. package/.next/server/app/login.segments/_full.segment.rsc +15 -15
  42. package/.next/server/app/login.segments/_head.segment.rsc +4 -4
  43. package/.next/server/app/login.segments/_index.segment.rsc +8 -8
  44. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  45. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  46. package/.next/server/app/login.segments/login.segment.rsc +3 -3
  47. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/logs.html +3 -3
  49. package/.next/server/app/logs.rsc +15 -15
  50. package/.next/server/app/logs.segments/_full.segment.rsc +15 -15
  51. package/.next/server/app/logs.segments/_head.segment.rsc +4 -4
  52. package/.next/server/app/logs.segments/_index.segment.rsc +8 -8
  53. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  54. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +4 -4
  55. package/.next/server/app/logs.segments/logs.segment.rsc +3 -3
  56. package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/messages.html +3 -3
  58. package/.next/server/app/messages.rsc +15 -15
  59. package/.next/server/app/messages.segments/_full.segment.rsc +15 -15
  60. package/.next/server/app/messages.segments/_head.segment.rsc +4 -4
  61. package/.next/server/app/messages.segments/_index.segment.rsc +8 -8
  62. package/.next/server/app/messages.segments/_tree.segment.rsc +2 -2
  63. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +4 -4
  64. package/.next/server/app/messages.segments/messages.segment.rsc +3 -3
  65. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/node.html +3 -3
  67. package/.next/server/app/node.rsc +15 -15
  68. package/.next/server/app/node.segments/_full.segment.rsc +15 -15
  69. package/.next/server/app/node.segments/_head.segment.rsc +4 -4
  70. package/.next/server/app/node.segments/_index.segment.rsc +8 -8
  71. package/.next/server/app/node.segments/_tree.segment.rsc +2 -2
  72. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +4 -4
  73. package/.next/server/app/node.segments/node.segment.rsc +3 -3
  74. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  75. package/.next/server/app/nodes.html +3 -3
  76. package/.next/server/app/nodes.rsc +15 -15
  77. package/.next/server/app/nodes.segments/_full.segment.rsc +15 -15
  78. package/.next/server/app/nodes.segments/_head.segment.rsc +4 -4
  79. package/.next/server/app/nodes.segments/_index.segment.rsc +8 -8
  80. package/.next/server/app/nodes.segments/_tree.segment.rsc +2 -2
  81. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +4 -4
  82. package/.next/server/app/nodes.segments/nodes.segment.rsc +3 -3
  83. package/.next/server/app/page_client-reference-manifest.js +1 -1
  84. package/.next/server/app/server-logs/page_client-reference-manifest.js +1 -1
  85. package/.next/server/app/server-logs.html +3 -3
  86. package/.next/server/app/server-logs.rsc +15 -15
  87. package/.next/server/app/server-logs.segments/_full.segment.rsc +15 -15
  88. package/.next/server/app/server-logs.segments/_head.segment.rsc +4 -4
  89. package/.next/server/app/server-logs.segments/_index.segment.rsc +8 -8
  90. package/.next/server/app/server-logs.segments/_tree.segment.rsc +2 -2
  91. package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +4 -4
  92. package/.next/server/app/server-logs.segments/server-logs.segment.rsc +3 -3
  93. package/.next/server/app/servers/page_client-reference-manifest.js +1 -1
  94. package/.next/server/app/servers.html +3 -3
  95. package/.next/server/app/servers.rsc +15 -15
  96. package/.next/server/app/servers.segments/_full.segment.rsc +15 -15
  97. package/.next/server/app/servers.segments/_head.segment.rsc +4 -4
  98. package/.next/server/app/servers.segments/_index.segment.rsc +8 -8
  99. package/.next/server/app/servers.segments/_tree.segment.rsc +2 -2
  100. package/.next/server/app/servers.segments/servers/__PAGE__.segment.rsc +4 -4
  101. package/.next/server/app/servers.segments/servers.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 +3 -3
  104. package/.next/server/app/settings/networks.rsc +15 -15
  105. package/.next/server/app/settings/networks.segments/_full.segment.rsc +15 -15
  106. package/.next/server/app/settings/networks.segments/_head.segment.rsc +4 -4
  107. package/.next/server/app/settings/networks.segments/_index.segment.rsc +8 -8
  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 +3 -3
  115. package/.next/server/app/settings/tokens.rsc +15 -15
  116. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +15 -15
  117. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +4 -4
  118. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +8 -8
  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 +3 -3
  124. package/.next/server/app/settings.rsc +15 -15
  125. package/.next/server/app/settings.segments/_full.segment.rsc +15 -15
  126. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  127. package/.next/server/app/settings.segments/_index.segment.rsc +8 -8
  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 +3 -3
  134. package/.next/server/app/tasks.rsc +15 -15
  135. package/.next/server/app/tasks.segments/_full.segment.rsc +15 -15
  136. package/.next/server/app/tasks.segments/_head.segment.rsc +4 -4
  137. package/.next/server/app/tasks.segments/_index.segment.rsc +8 -8
  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/chunks/ssr/[root-of-the-server]__030vg4n._.js +1 -1
  142. package/.next/server/chunks/ssr/[root-of-the-server]__030vg4n._.js.map +1 -1
  143. package/.next/server/chunks/ssr/[root-of-the-server]__0fhoq8i._.js +1 -1
  144. package/.next/server/chunks/ssr/[root-of-the-server]__0fhoq8i._.js.map +1 -1
  145. package/.next/server/chunks/ssr/[root-of-the-server]__0nw~zhp._.js +1 -1
  146. package/.next/server/chunks/ssr/[root-of-the-server]__0nw~zhp._.js.map +1 -1
  147. package/.next/server/chunks/ssr/[root-of-the-server]__0sv~g.o._.js +1 -1
  148. package/.next/server/chunks/ssr/[root-of-the-server]__0sv~g.o._.js.map +1 -1
  149. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js +2 -2
  150. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js.map +1 -1
  151. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js +1 -1
  152. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js.map +1 -1
  153. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js +1 -1
  154. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js.map +1 -1
  155. package/.next/server/chunks/ssr/agent-network-dashboard_app_0i3759l._.js +1 -1
  156. package/.next/server/chunks/ssr/agent-network-dashboard_app_0i3759l._.js.map +1 -1
  157. package/.next/server/chunks/ssr/agent-network-dashboard_app_0xgney8._.js +1 -1
  158. package/.next/server/chunks/ssr/agent-network-dashboard_app_0xgney8._.js.map +1 -1
  159. package/.next/server/chunks/ssr/agent-network-dashboard_app_10hjgv4._.js +1 -1
  160. package/.next/server/chunks/ssr/agent-network-dashboard_app_10hjgv4._.js.map +1 -1
  161. package/.next/server/chunks/ssr/agent-network-dashboard_app_1153xeb._.js +1 -1
  162. package/.next/server/chunks/ssr/agent-network-dashboard_app_1153xeb._.js.map +1 -1
  163. package/.next/server/chunks/ssr/agent-network-dashboard_app_12l4oto._.js +1 -1
  164. package/.next/server/chunks/ssr/agent-network-dashboard_app_12l4oto._.js.map +1 -1
  165. package/.next/server/chunks/ssr/agent-network-dashboard_app_components_0s5uqlp._.js +2 -2
  166. package/.next/server/chunks/ssr/agent-network-dashboard_app_components_0s5uqlp._.js.map +1 -1
  167. package/.next/server/chunks/ssr/agent-network-dashboard_app_server-logs_page_tsx_0dg.l_8._.js +1 -1
  168. package/.next/server/chunks/ssr/agent-network-dashboard_app_server-logs_page_tsx_0dg.l_8._.js.map +1 -1
  169. package/.next/server/chunks/ssr/agent-network-dashboard_app_tasks_page_tsx_0mwxy4z._.js +1 -1
  170. package/.next/server/chunks/ssr/agent-network-dashboard_app_tasks_page_tsx_0mwxy4z._.js.map +1 -1
  171. package/.next/server/middleware-build-manifest.js +3 -3
  172. package/.next/server/pages/404.html +3 -3
  173. package/.next/server/pages/500.html +1 -1
  174. package/.next/server/server-reference-manifest.js +1 -1
  175. package/.next/server/server-reference-manifest.json +1 -1
  176. package/.next/static/chunks/{08sos26.n11bq.js → 0-1p~7bijv8r0.js} +1 -1
  177. package/.next/static/chunks/0.054rbp43q.y.js +1 -0
  178. package/.next/static/chunks/{181u38qblp8lz.js → 00b-ysl~m~dr~.js} +1 -1
  179. package/.next/static/chunks/{0jp~cs9-zkmqa.js → 00b4y77vxfabl.js} +1 -1
  180. package/.next/static/chunks/{0561vp5-q5.zp.js → 05wpkysi1s2zn.js} +1 -1
  181. package/.next/static/chunks/06iwj-z8xtcq3.js +7 -0
  182. package/.next/static/chunks/089vil3mpokhi.js +1 -0
  183. package/.next/static/chunks/{0a.9~-nf0gpec.js → 0_eddxjio~tei.js} +1 -1
  184. package/.next/static/chunks/0fzfrj9t-fbn_.js +1 -0
  185. package/.next/static/chunks/{15qxef.ilfysw.js → 0htz_k0~gd-wb.js} +3 -3
  186. package/.next/static/chunks/{0im751o4n61c7.js → 0hv6izw.g6cnm.js} +1 -1
  187. package/.next/static/chunks/0scdduv38l5yh.js +1 -0
  188. package/.next/static/chunks/{05uk96gc~9mni.js → 0ti3v67ixu43p.js} +1 -1
  189. package/.next/static/chunks/0zxp22qnae87..css +1 -0
  190. package/.next/static/chunks/{0.66f3.rtcybb.js → 136r0ae9ihgvo.js} +1 -1
  191. package/.next/static/chunks/{0nqm.7w9_inwd.js → 15yjjo1fv.muz.js} +2 -2
  192. package/.next/trace +2 -2
  193. package/.next/trace-build +1 -1
  194. package/app/admin/page.tsx +9 -4
  195. package/app/components/AgentCard.tsx +19 -9
  196. package/app/components/ChatPopover.tsx +1 -1
  197. package/app/components/CommandCenter.tsx +12 -2
  198. package/app/components/CommandPalette.tsx +1 -1
  199. package/app/components/DispatchPanel.tsx +7 -4
  200. package/app/components/HealthBanner.tsx +10 -2
  201. package/app/components/MobileNav.tsx +2 -2
  202. package/app/components/Sidebar.tsx +6 -4
  203. package/app/components/TaskChatPanel.tsx +19 -5
  204. package/app/components/TaskDrawer.tsx +3 -1
  205. package/app/components/UserBar.tsx +3 -3
  206. package/app/login/page.tsx +3 -3
  207. package/app/logs/page.tsx +6 -2
  208. package/app/messages/page.tsx +19 -12
  209. package/app/node/page.tsx +2 -2
  210. package/app/nodes/page.tsx +12 -6
  211. package/app/server-logs/page.tsx +10 -3
  212. package/app/settings/networks/page.tsx +3 -3
  213. package/app/settings/page.tsx +8 -5
  214. package/app/settings/tokens/page.tsx +1 -1
  215. package/app/tasks/page.tsx +13 -9
  216. package/bin/start.js +0 -0
  217. package/package.json +1 -1
  218. package/.next/static/chunks/0hxvojbn.tprh.css +0 -1
  219. package/.next/static/chunks/0inql3s9ldyx5.js +0 -1
  220. package/.next/static/chunks/0yyx7754lietg.js +0 -1
  221. package/.next/static/chunks/11xnnivocgef4.js +0 -1
  222. package/.next/static/chunks/12-6xsdci5.9v.js +0 -1
  223. package/.next/static/chunks/15-ltfhot3b4n.js +0 -7
  224. /package/.next/static/{D1tOdIVZJAhZcHTEAKrHD → bsQFZ0KSnvC1MnJVkif4H}/_buildManifest.js +0 -0
  225. /package/.next/static/{D1tOdIVZJAhZcHTEAKrHD → bsQFZ0KSnvC1MnJVkif4H}/_clientMiddlewareManifest.js +0 -0
  226. /package/.next/static/{D1tOdIVZJAhZcHTEAKrHD → bsQFZ0KSnvC1MnJVkif4H}/_ssgManifest.js +0 -0
@@ -1 +1 @@
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,59746,e=>{"use strict";function t(e){if(!e)return null;let t=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(t)?t:null}function s(e){let s=t(e);if(null===s)return null;let r=Math.floor((Date.now()-s)/1e3);return r<0?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}e.s(["parseHubTime",0,t,"relativeAgo",0,s],59746),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){return s(e)??"--"}],3479)},46228,e=>{"use strict";var t=e.i(22381);let s=[180,200,220,270,300,330,30,90];function r(e){let t=0;for(let s=0;s<e.length;s++)t=31*t+e.charCodeAt(s)>>>0;let r=s[t%s.length];return{bg:`hsl(${r} 55% 22%)`,ring:`hsl(${r} 60% 45%)`,text:`hsl(${r} 80% 78%)`}}function a(e){return e?(e.trim().match(/[\p{L}\p{N}]/u)?.[0]||e.trim()[0]||"·").toUpperCase():"·"}e.s(["AliasAvatar",0,function({alias:e,size:s=28,className:n=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${n}`,style:{width:s,height:s,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let i=r(e),l=Math.max(9,Math.round(.42*s));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${n}`,style:{width:s,height:s,fontSize:l,backgroundColor:i.bg,borderColor:i.ring,color:i.text},title:e,"aria-hidden":!0,children:a(e)})},"aliasAvatarColors",0,r,"aliasInitial",0,a])},76161,e=>{"use strict";var t=e.i(22381),s=e.i(23910),r=e.i(56839);let a={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 r={width:s,height:s},a={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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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:l,cta:o,compact:d=!1}){let c=a[e],x=s??c.title,h=l??c.sub;return(0,t.jsxs)("div",{className:`text-center ${d?"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:d?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${d?"text-sm":"text-base"}`,children:x}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${d?"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)(r.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[r,a]=(0,s.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!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":r?"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:r?(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)(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.`})}):s>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. ${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)(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),s=e.i(11449);let r=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},a={refreshInterval:5e3,dedupingInterval:3e3};function n(e,t){if(!t)return e;let s=e.includes("?")?"&":"?";return`${e}${s}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",r,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",r,a);return{health:e||null,error:s}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",r,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:i}=(0,s.useNetworkId)(),{data:l,error:o,isLoading:d}=(0,t.default)(n(`/api/hub/messages?limit=${e}`,i),r,a);return{messages:l?.messages||[],error:o,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l,isLoading:o}=(0,t.default)(n("/api/hub/status",e),r,a);return{sessions:i?.sessions||[],hint:i?._hint,error:l,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l}=(0,t.default)(n("/api/hub/stats",e),r,a);return{stats:i?.ok?i:null,error:l}},"useTasks",0,function(e){let{networkId:i}=(0,s.useNetworkId)(),l=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:d,isLoading:c}=(0,t.default)(n(`/api/hub/tasks?${l}`,i),r,a);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:d,isLoading:c}}])},70732,e=>{"use strict";var t=e.i(22381),s=e.i(23910),r=e.i(3479),a=e.i(59276),n=e.i(43058),i=e.i(76161),l=e.i(46228),o=e.i(98025),d=e.i(38263);function c(e){return e?e.length>12?`${e.slice(0,8)}…`:e:"—"}e.s(["default",0,function(){let e,x,h,u,{sessions:g,isLoading:p}=(0,a.useSessions)(),{health:m}=(0,a.useHealth)(),{hasUnread:y}=(0,d.useChatUnread)(),b=m?.sse_sessions||{},f=e=>(e.network_id?b[`${e.network_id}:${e.alias}`]:void 0)??b[e.alias],[j,v]=(0,s.useState)(""),[w,N]=(0,s.useState)(""),[k,S]=(0,s.useState)("list"),[C,_]=(0,s.useState)(null),A=g.map(e=>({...e,online:!!f(e)})).filter(e=>"online"===j?e.online:"offline"===j?!e.online:!j||j===e.status).filter(e=>!w||e.alias.toLowerCase().includes(w.toLowerCase())||(e.agent||"").toLowerCase().includes(w.toLowerCase())).sort((e,t)=>!!t.online-!!e.online||("working"===t.status)-("working"===e.status)),T=g.filter(e=>f(e)).length;return(0,t.jsxs)("div",{className:"min-h-screen max-w-full overflow-x-hidden 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)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Nodes"}),(0,t.jsxs)("span",{className:"text-xs bg-green-900/30 text-green-400 px-2 py-0.5 rounded-full border border-green-800/30",children:[T," online"]}),(0,t.jsxs)("span",{className:"text-xs bg-gray-900/30 text-gray-400 px-2 py-0.5 rounded-full border border-gray-800/30",children:[g.length," total"]})]}),g.length>0&&(e=A.filter(e=>e.online&&"working"===e.status).length,x=A.filter(e=>e.online&&"idle"===e.status).length,h=A.filter(e=>!e.online).length,u=A.length||1,(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-800",children:[e>0&&(0,t.jsx)("div",{className:"bg-green-500",style:{width:`${e/u*100}%`}}),x>0&&(0,t.jsx)("div",{className:"bg-cyan-500",style:{width:`${x/u*100}%`}}),h>0&&(0,t.jsx)("div",{className:"bg-gray-600",style:{width:`${h/u*100}%`}})]}),(0,t.jsxs)("div",{className:"flex gap-4 mt-1.5 text-[10px] text-gray-500",children:[e>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500 mr-1"}),e," working"]}),x>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-cyan-500 mr-1"}),x," idle"]}),h>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-gray-600 mr-1"}),h," offline"]})]})]})),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,t.jsx)("input",{type:"text",value:w,onChange:e=>N(e.target.value),placeholder:"Search nodes...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-48"}),(0,t.jsxs)("select",{value:j,onChange:e=>v(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white focus:border-blue-500/50 focus:outline-none",children:[(0,t.jsx)("option",{value:"",children:"All"}),(0,t.jsx)("option",{value:"online",children:"Online"}),(0,t.jsx)("option",{value:"offline",children:"Offline"}),(0,t.jsx)("option",{value:"working",children:"Working"}),(0,t.jsx)("option",{value:"idle",children:"Idle"}),(0,t.jsx)("option",{value:"blocked",children:"Blocked"}),(0,t.jsx)("option",{value:"error",children:"Error"})]}),(0,t.jsx)("div",{className:"hidden sm:flex ml-auto rounded-lg border border-[#2a2a4a] bg-[#111128] p-1 text-sm",children:["list","grid"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>S(e),className:`rounded-md px-3 py-1.5 transition-colors ${k===e?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"list"===e?"List":"Grid"},e))})]}),p?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(e=>(0,t.jsx)("div",{className:"h-16 bg-gray-800/20 rounded-lg"},e))}):0===A.length?0===g.length?(0,t.jsx)(i.NodesEmptyState,{}):(0,t.jsx)(i.EmptyState,{variant:"nodes",title:"No nodes match your filters",sub:"Try clearing search or status filters, or wait for an agent to register."}):"grid"===k?(0,t.jsx)("div",{className:"grid min-w-0 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:A.map(e=>{let s=e.online?e.status:"offline",a="number"==typeof e.progress?e.progress:0,n=y(e.alias);return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>_(e.alias),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),_(e.alias))},className:`relative min-w-0 max-w-full overflow-hidden rounded-xl border border-[#2a2a4a] bg-[#111128] p-4 transition-colors hover:border-cyan-500/40 cursor-pointer ${!e.online?"opacity-60":""}`,children:[!e.online&&(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,t.jsx)("span",{className:"rotate-[-20deg] rounded-xl border border-white/10 bg-black/20 px-5 py-2 text-xl font-bold uppercase tracking-[0.35em] text-white/10",children:"Offline"})}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.alias,size:36}),n&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-[#111128] bg-red-500"})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-base font-semibold text-white",children:e.alias}),n&&(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-red-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-red-300",children:"New"}),(0,t.jsx)("span",{className:`shrink-0 rounded-md border px-2 py-0.5 text-[10px] uppercase tracking-wide ${o.SESSION_STATUS_CHIP_CLASS[s]||o.SESSION_STATUS_CHIP_CLASS.offline}`,children:s})]}),(0,t.jsxs)("div",{className:"mt-0.5 truncate text-xs text-gray-500",children:[e.agent||"—",(0,t.jsx)("span",{className:"text-gray-700 mx-1.5",children:"·"}),(0,t.jsx)("span",{title:e.server||"",children:c(e.server)})]})]}),(0,t.jsx)("span",{className:"hidden shrink-0 rounded-lg border border-cyan-500/15 bg-cyan-500/5 px-2 py-1 text-[10px] text-cyan-300/70 sm:inline",children:"Tap to chat"})]}),(0,t.jsxs)("div",{className:"mt-3 rounded-lg border border-[#1a1a2a] bg-[#0a0a15] px-3 py-2 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-600",children:"Current task"}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)})]}),(0,t.jsx)("div",{className:`mt-1 line-clamp-2 ${e.task?"text-gray-300":"text-gray-600 italic"}`,children:e.task||"No current task"})]}),a>0&&a<100&&(0,t.jsx)("div",{className:"mt-3 h-1.5 overflow-hidden rounded-full bg-gray-800",children:(0,t.jsx)("div",{className:"h-1.5 rounded-full bg-cyan-400 transition-all",style:{width:`${a}%`}})})]},e.alias)})}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-10 gap-2 px-4 py-2 text-xs text-gray-600 uppercase",children:[(0,t.jsx)("div",{className:"col-span-1",children:"Status"}),(0,t.jsx)("div",{className:"col-span-2",children:"Alias"}),(0,t.jsx)("div",{className:"col-span-2",children:"Agent · Server"}),(0,t.jsx)("div",{className:"col-span-4",children:"Current Task"}),(0,t.jsx)("div",{className:"col-span-1",children:"Updated"})]}),A.map(e=>{let s=e.online?e.status:"offline",a=y(e.alias);return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>_(e.alias),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),_(e.alias))},className:`rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 transition-colors hover:border-cyan-500/40 cursor-pointer ${!e.online?"opacity-50":""}`,children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-10 gap-2 items-center",children:[(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${o.SESSION_STATUS_CHIP_CLASS[s]||o.SESSION_STATUS_CHIP_CLASS.offline}`,children:s})}),(0,t.jsx)("div",{className:"col-span-2 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.alias,size:20}),a&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full border border-[#111128] bg-red-500"})]}),(0,t.jsx)("span",{className:"truncate text-sm font-medium text-white",children:e.alias}),a&&(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-red-500/15 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-red-300",children:"New"})]})}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-400",title:e.server||"",children:(0,t.jsxs)("span",{className:"truncate",children:[e.agent||"--",(0,t.jsx)("span",{className:"text-gray-700 mx-1.5",children:"·"}),c(e.server)]})}),(0,t.jsx)("div",{className:"col-span-4 truncate text-xs text-gray-500",title:e.task||"",children:e.task||"--"}),(0,t.jsx)("div",{className:"col-span-1 text-xs text-gray-500",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)})]}),(0,t.jsxs)("div",{className:"sm:hidden space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.alias,size:28}),a&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-[#111128] bg-red-500"})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)("div",{className:"truncate text-sm font-medium text-white",children:e.alias}),a&&(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-red-500/15 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-red-300",children:"New"})]}),(0,t.jsxs)("div",{className:"truncate text-[10px] text-gray-500",children:[e.agent||"—"," · ",(0,r.timeAgo)(e.last_seen_at||e.updated_at)]})]}),(0,t.jsx)("span",{className:`shrink-0 text-xs px-2 py-0.5 rounded-md border ${o.SESSION_STATUS_CHIP_CLASS[s]||o.SESSION_STATUS_CHIP_CLASS.offline}`,children:s})]}),e.task&&(0,t.jsx)("div",{className:"truncate text-xs text-gray-500",children:e.task}),(0,t.jsx)("div",{className:"text-[10px] text-cyan-300/70",children:"Tap anywhere to chat"})]})]},e.alias)})]}),C&&(0,t.jsx)(n.TaskChatPanel,{alias:C,onClose:()=>_(null)})]})}])}]);
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,59746,e=>{"use strict";function t(e){if(!e)return null;let t=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(t)?t:null}function s(e){let s=t(e);if(null===s)return null;let r=Math.floor((Date.now()-s)/1e3);return r<0?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}e.s(["parseHubTime",0,t,"relativeAgo",0,s],59746),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){return s(e)??"--"}],3479)},46228,e=>{"use strict";var t=e.i(22381);let s=[180,200,220,270,300,330,30,90];function r(e){let t=0;for(let s=0;s<e.length;s++)t=31*t+e.charCodeAt(s)>>>0;let r=s[t%s.length];return{bg:`hsl(${r} 55% 22%)`,ring:`hsl(${r} 60% 45%)`,text:`hsl(${r} 80% 78%)`}}function a(e){return e?(e.trim().match(/[\p{L}\p{N}]/u)?.[0]||e.trim()[0]||"·").toUpperCase():"·"}e.s(["AliasAvatar",0,function({alias:e,size:s=28,className:n=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${n}`,style:{width:s,height:s,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let i=r(e),l=Math.max(9,Math.round(.42*s));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${n}`,style:{width:s,height:s,fontSize:l,backgroundColor:i.bg,borderColor:i.ring,color:i.text},title:e,"aria-hidden":!0,children:a(e)})},"aliasAvatarColors",0,r,"aliasInitial",0,a])},76161,e=>{"use strict";var t=e.i(22381),s=e.i(23910),r=e.i(56839);let a={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 r={width:s,height:s},a={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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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",...r,children:(0,t.jsxs)("g",{...a,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:l,cta:o,compact:d=!1}){let c=a[e],x=s??c.title,h=l??c.sub;return(0,t.jsxs)("div",{className:`text-center ${d?"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:d?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${d?"text-sm":"text-base"}`,children:x}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${d?"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)(r.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[r,a]=(0,s.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!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":r?"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:r?(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)(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.`})}):s>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. ${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)(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),s=e.i(11449);let r=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},a={refreshInterval:5e3,dedupingInterval:3e3};function n(e,t){if(!t)return e;let s=e.includes("?")?"&":"?";return`${e}${s}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",r,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",r,a);return{health:e||null,error:s}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",r,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:i}=(0,s.useNetworkId)(),{data:l,error:o,isLoading:d}=(0,t.default)(n(`/api/hub/messages?limit=${e}`,i),r,a);return{messages:l?.messages||[],error:o,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l,isLoading:o}=(0,t.default)(n("/api/hub/status",e),r,a);return{sessions:i?.sessions||[],hint:i?._hint,error:l,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l}=(0,t.default)(n("/api/hub/stats",e),r,a);return{stats:i?.ok?i:null,error:l}},"useTasks",0,function(e){let{networkId:i}=(0,s.useNetworkId)(),l=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:d,isLoading:c}=(0,t.default)(n(`/api/hub/tasks?${l}`,i),r,a);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:d,isLoading:c}}])},70732,e=>{"use strict";var t=e.i(22381),s=e.i(23910),r=e.i(3479),a=e.i(59276),n=e.i(43058),i=e.i(76161),l=e.i(46228),o=e.i(98025),d=e.i(38263);function c(e){return e?e.length>12?`${e.slice(0,8)}…`:e:"—"}e.s(["default",0,function(){let e,x,h,u,{sessions:g,isLoading:p}=(0,a.useSessions)(),{health:m}=(0,a.useHealth)(),{hasUnread:y}=(0,d.useChatUnread)(),b=m?.sse_sessions||{},f=e=>(e.network_id?b[`${e.network_id}:${e.alias}`]:void 0)??b[e.alias],[j,v]=(0,s.useState)(""),[w,N]=(0,s.useState)(""),[k,S]=(0,s.useState)("list"),[C,_]=(0,s.useState)(null),A=g.map(e=>({...e,online:!!f(e)})).filter(e=>"online"===j?e.online:"offline"===j?!e.online:!j||j===e.status).filter(e=>!w||e.alias.toLowerCase().includes(w.toLowerCase())||(e.agent||"").toLowerCase().includes(w.toLowerCase())).sort((e,t)=>!!t.online-!!e.online||("working"===t.status)-("working"===e.status)),T=g.filter(e=>f(e)).length;return(0,t.jsxs)("div",{className:"min-h-screen max-w-full overflow-x-hidden 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)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Nodes"}),(0,t.jsxs)("span",{className:"text-xs bg-green-900/30 text-green-400 px-2 py-0.5 rounded-full border border-green-800/30",children:[T," online"]}),(0,t.jsxs)("span",{className:"text-xs bg-gray-900/30 text-gray-400 px-2 py-0.5 rounded-full border border-gray-800/30",children:[g.length," total"]})]}),g.length>0&&(e=A.filter(e=>e.online&&"working"===e.status).length,x=A.filter(e=>e.online&&"idle"===e.status).length,h=A.filter(e=>!e.online).length,u=A.length||1,(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-800",children:[e>0&&(0,t.jsx)("div",{className:"bg-green-500",style:{width:`${e/u*100}%`}}),x>0&&(0,t.jsx)("div",{className:"bg-cyan-500",style:{width:`${x/u*100}%`}}),h>0&&(0,t.jsx)("div",{className:"bg-gray-600",style:{width:`${h/u*100}%`}})]}),(0,t.jsxs)("div",{className:"flex gap-4 mt-1.5 text-[10px] text-gray-500",children:[e>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500 mr-1"}),e," working"]}),x>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-cyan-500 mr-1"}),x," idle"]}),h>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-gray-600 mr-1"}),h," offline"]})]})]})),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,t.jsx)("input",{type:"text",value:w,onChange:e=>N(e.target.value),placeholder:"Search nodes...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-full sm:w-48"}),(0,t.jsxs)("select",{value:j,onChange:e=>v(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-base sm:text-sm text-white focus:border-blue-500/50 focus:outline-none",children:[(0,t.jsx)("option",{value:"",children:"All"}),(0,t.jsx)("option",{value:"online",children:"Online"}),(0,t.jsx)("option",{value:"offline",children:"Offline"}),(0,t.jsx)("option",{value:"working",children:"Working"}),(0,t.jsx)("option",{value:"idle",children:"Idle"}),(0,t.jsx)("option",{value:"blocked",children:"Blocked"}),(0,t.jsx)("option",{value:"error",children:"Error"})]}),(0,t.jsx)("div",{className:"hidden sm:flex ml-auto rounded-lg border border-[#2a2a4a] bg-[#111128] p-1 text-sm",children:["list","grid"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>S(e),className:`rounded-md px-3 py-1.5 transition-colors ${k===e?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"list"===e?"List":"Grid"},e))})]}),p?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(e=>(0,t.jsx)("div",{className:"h-16 bg-gray-800/20 rounded-lg"},e))}):0===A.length?0===g.length?(0,t.jsx)(i.NodesEmptyState,{}):(0,t.jsx)(i.EmptyState,{variant:"nodes",title:"No nodes match your filters",sub:"Try clearing search or status filters, or wait for an agent to register."}):"grid"===k?(0,t.jsx)("div",{className:"grid min-w-0 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:A.map(e=>{let s=e.online?e.status:"offline",a="number"==typeof e.progress?e.progress:0,n=y(e.alias);return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>_(e.alias),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),_(e.alias))},className:`relative min-w-0 max-w-full overflow-hidden rounded-xl border border-[#2a2a4a] bg-[#111128] p-4 transition-colors hover:border-cyan-500/40 cursor-pointer ${!e.online?"opacity-60":""}`,children:[!e.online&&(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,t.jsx)("span",{className:"rotate-[-20deg] rounded-xl border border-white/10 bg-black/20 px-5 py-2 text-xl font-bold uppercase tracking-[0.35em] text-white/10",children:"Offline"})}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.alias,size:36}),n&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-[#111128] bg-red-500"})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-base font-semibold text-white",children:e.alias}),n&&(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-red-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-red-300",children:"New"}),(0,t.jsx)("span",{className:`shrink-0 rounded-md border px-2 py-0.5 text-[10px] uppercase tracking-wide ${o.SESSION_STATUS_CHIP_CLASS[s]||o.SESSION_STATUS_CHIP_CLASS.offline}`,children:s})]}),(0,t.jsxs)("div",{className:"mt-0.5 truncate text-xs text-gray-500",children:[e.agent||"—",(0,t.jsx)("span",{className:"text-gray-700 mx-1.5",children:"·"}),(0,t.jsx)("span",{title:e.server||"",children:c(e.server)})]})]}),(0,t.jsx)("span",{className:"hidden shrink-0 rounded-lg border border-cyan-500/15 bg-cyan-500/5 px-2 py-1 text-[10px] text-cyan-300/70 sm:inline",children:"Tap to chat"})]}),(0,t.jsxs)("div",{className:"mt-3 rounded-lg border border-[#1a1a2a] bg-[#0a0a15] px-3 py-2 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-600",children:"Current task"}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)})]}),(0,t.jsx)("div",{className:`mt-1 line-clamp-2 ${e.task?"text-gray-300":"text-gray-600 italic"}`,children:e.task||"No current task"})]}),a>0&&a<100&&(0,t.jsx)("div",{className:"mt-3 h-1.5 overflow-hidden rounded-full bg-gray-800",children:(0,t.jsx)("div",{className:"h-1.5 rounded-full bg-cyan-400 transition-all",style:{width:`${a}%`}})})]},e.alias)})}):(0,t.jsxs)("div",{className:"space-y-1 sm:space-y-2",children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-10 gap-2 px-4 py-2 text-xs text-gray-600 uppercase",children:[(0,t.jsx)("div",{className:"col-span-1",children:"Status"}),(0,t.jsx)("div",{className:"col-span-2",children:"Alias"}),(0,t.jsx)("div",{className:"col-span-2",children:"Agent · Server"}),(0,t.jsx)("div",{className:"col-span-4",children:"Current Task"}),(0,t.jsx)("div",{className:"col-span-1",children:"Updated"})]}),A.map(e=>{let s=e.online?e.status:"offline",a=y(e.alias);return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>_(e.alias),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),_(e.alias))},className:`rounded-lg border border-[#2a2a4a] bg-[#111128] px-3 py-2 sm:px-4 sm:py-3 transition-colors hover:border-cyan-500/40 cursor-pointer ${!e.online?"opacity-50":""}`,children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-10 gap-2 items-center",children:[(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${o.SESSION_STATUS_CHIP_CLASS[s]||o.SESSION_STATUS_CHIP_CLASS.offline}`,children:s})}),(0,t.jsx)("div",{className:"col-span-2 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.alias,size:20}),a&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full border border-[#111128] bg-red-500"})]}),(0,t.jsx)("span",{className:"truncate text-sm font-medium text-white",children:e.alias}),a&&(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-red-500/15 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-red-300",children:"New"})]})}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-400",title:e.server||"",children:(0,t.jsxs)("span",{className:"truncate",children:[e.agent||"--",(0,t.jsx)("span",{className:"text-gray-700 mx-1.5",children:"·"}),c(e.server)]})}),(0,t.jsx)("div",{className:"col-span-4 truncate text-xs text-gray-500",title:e.task||"",children:e.task||"--"}),(0,t.jsx)("div",{className:"col-span-1 text-xs text-gray-500",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)})]}),(0,t.jsxs)("div",{className:"sm:hidden space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.alias,size:28}),a&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-[#111128] bg-red-500"})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)("div",{className:"truncate text-sm font-medium text-white",children:e.alias}),a&&(0,t.jsx)("span",{className:"shrink-0 rounded-full bg-red-500/15 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-red-300",children:"New"})]}),(0,t.jsxs)("div",{className:"truncate text-[10px] text-gray-500",children:[e.agent||"—"," · ",(0,r.timeAgo)(e.last_seen_at||e.updated_at)]})]}),(0,t.jsx)("span",{className:`shrink-0 text-xs px-2 py-0.5 rounded-md border ${o.SESSION_STATUS_CHIP_CLASS[s]||o.SESSION_STATUS_CHIP_CLASS.offline}`,children:s})]}),e.task&&(0,t.jsx)("div",{className:"truncate text-xs text-gray-500",children:e.task})]})]},e.alias)})]}),C&&(0,t.jsx)(n.TaskChatPanel,{alias:C,onClose:()=>_(null)})]})}])}]);
@@ -0,0 +1,7 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24156,e=>{"use strict";var t=e.i(22381),a=e.i(23910);let s=[{id:"cyber",label:"Cyber",emoji:"🌃",desc:"默认深色"},{id:"light",label:"Light",emoji:"☀️",desc:"浅色简洁"},{id:"mint",label:"Mint",emoji:"🌿",desc:"薄荷绿"},{id:"sunset",label:"Sunset",emoji:"🌅",desc:"暖色橙紫"}],n="anet-theme";function r(e){"u">typeof document&&document.documentElement.setAttribute("data-theme",e)}e.s(["ThemeProvider",0,function({children:e}){return(0,a.useEffect)(()=>{r(localStorage.getItem(n)||"cyber")},[]),(0,t.jsx)(t.Fragment,{children:e})},"ThemeSwitcher",0,function({compact:e=!1}){let[o,i]=(0,a.useState)("cyber"),[l,c]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=localStorage.getItem(n)||"cyber";i(e),r(e)},[]);let d=s.find(e=>e.id===o)||s[0];return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("button",{"aria-label":"切换主题",onClick:()=>c(!l),className:"px-2.5 py-1.5 rounded-md text-xs flex items-center gap-1.5 hover:opacity-80 transition-opacity",style:{background:"var(--bg-elevated)",color:"var(--fg)",border:"1px solid var(--border)"},children:[(0,t.jsx)("span",{"aria-hidden":!0,children:d.emoji}),!e&&(0,t.jsx)("span",{children:d.label})]}),l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>c(!1)}),(0,t.jsx)("div",{className:"absolute right-0 top-full mt-1 z-50 rounded-md min-w-[160px] py-1 shadow-lg",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:s.map(e=>(0,t.jsxs)("button",{onClick:()=>{var t;i(t=e.id),localStorage.setItem(n,t),r(t),c(!1)},className:"w-full px-3 py-2 text-left text-xs flex items-center gap-2 hover:opacity-80",style:{background:e.id===o?"var(--bg-elevated)":"transparent",color:"var(--fg)"},children:[(0,t.jsx)("span",{"aria-hidden":!0,children:e.emoji}),(0,t.jsx)("span",{className:"flex-1",children:e.label}),(0,t.jsx)("span",{style:{color:"var(--fg-dim)"},className:"text-[10px]",children:e.desc}),e.id===o&&(0,t.jsx)("span",{style:{color:"var(--accent)"},children:"•"})]},e.id))})]})]})}])},22485,e=>{"use strict";var t=e.i(22381),a=e.i(56058),s=e.i(56839),n=e.i(23910),r=e.i(12629),o=e.i(11449),i=e.i(24156);let l=e=>fetch(e).then(e=>e.ok?e.json():{networks:[]}),c=[{href:"/",label:"Overview",icon:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"},{href:"/tasks",label:"Tasks",icon:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},{href:"/nodes",label:"Nodes",icon:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"},{href:"/servers",label:"Servers",icon:"M4 6.5A2.5 2.5 0 016.5 4h11A2.5 2.5 0 0120 6.5v1A2.5 2.5 0 0117.5 10h-11A2.5 2.5 0 014 7.5v-1zM4 16.5A2.5 2.5 0 016.5 14h11a2.5 2.5 0 012.5 2.5v1a2.5 2.5 0 01-2.5 2.5h-11A2.5 2.5 0 014 17.5v-1zM7 7h.01M7 17h.01"},{href:"/messages",label:"Messages",icon:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"},{href:"/settings/networks",label:"Networks",icon:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},{href:"/logs",label:"Audit Log",icon:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},{href:"/server-logs",label:"Server Logs",icon:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"},{href:"/admin",label:"Admin",icon:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},{href:"/settings",label:"Settings",icon:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z"}],d={owner:"⭐",admin:"🔧",member:"👤",viewer:"👁"};function h(){let e=(0,a.usePathname)(),[h,g]=(0,n.useState)(!1),[u,x]=(0,n.useState)(!1),{networkId:f,setNetworkId:v}=(0,o.useNetworkId)(),{data:b}=(0,r.default)("/api/hub/networks",l,{refreshInterval:15e3,dedupingInterval:1e4}),{data:y}=(0,r.default)("/api/hub/status",m,{refreshInterval:15e3,dedupingInterval:1e4}),k=b?.networks||[],w=(()=>{let e=new Map;for(let t of y?.sessions||[])t.network_id&&e.set(t.network_id,(e.get(t.network_id)||0)+1);let t=new Set(k.map(e=>e.network_id));return[...k,...[...e.keys()].filter(e=>!t.has(e)).map(e=>({network_id:e,network_name:e}))].map(t=>({...t,agentCount:e.get(t.network_id)||0}))})(),j=(0,t.jsx)("nav",{className:"flex flex-col gap-1 px-2 py-4",children:c.map(a=>{var n;return(0,t.jsxs)(s.default,{href:a.href,prefetch:!1,onClick:()=>x(!1),title:h?a.label:void 0,className:`relative flex items-center gap-3 px-3 py-3 rounded-lg text-sm transition-colors active:bg-[#1a1a3a] ${("/"===(n=a.href)?"/"===e:"/settings"===n?"/settings"===e:e.startsWith(n))?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/20 anet-nav-active":"text-gray-400 hover:text-gray-200 hover:bg-[#1a1a2a]"} ${h?"justify-center px-0":""}`,children:[(0,t.jsx)("svg",{className:"w-5 h-5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:a.icon})}),!h&&(0,t.jsx)("span",{children:a.label})]},a.href)})});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>x(!u),className:"fixed top-3 left-3 z-50 lg:hidden bg-[#111128] border border-[#2a2a4a] rounded-lg p-3 min-h-[44px] min-w-[44px] inline-flex items-center justify-center text-gray-400 hover:text-white active:bg-[#1a1a3a]","aria-label":"Toggle menu",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:u?(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"}):(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})}),u&&(0,t.jsx)("div",{className:"fixed inset-0 bg-black/50 z-30 lg:hidden anet-fade-in",onClick:()=>x(!1)}),(0,t.jsxs)("aside",{"data-anet-sidebar":"true",className:`
2
+ fixed top-0 left-0 h-full z-40 bg-[#0d0d1a] border-r border-[#2a2a4a]
3
+ transition-transform duration-200 ease-out
4
+ ${h?"w-16":"w-52"}
5
+ ${u?"translate-x-0 shadow-2xl shadow-black/40 lg:shadow-none":"-translate-x-full"}
6
+ lg:translate-x-0 lg:static lg:shrink-0 lg:shadow-none
7
+ `,children:[(0,t.jsx)(p,{collapsed:h}),(0,t.jsx)("div",{className:"border-b border-[#2a2a4a]"}),!h&&w.length>0&&(0,t.jsxs)("div",{className:"px-2 py-3 border-b border-[#2a2a4a]",children:[(0,t.jsx)("div",{className:"px-3 text-[10px] text-gray-600 uppercase mb-2",children:"Networks"}),(0,t.jsx)("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:w.map(e=>(0,t.jsxs)("button",{onClick:()=>{v(e.network_id),x(!1)},title:e.network_id,className:`w-full flex items-center gap-2 px-3 py-2.5 lg:py-1.5 rounded-md text-xs transition-colors text-left ${f===e.network_id?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-300 hover:bg-[#1a1a2a]"}`,children:[(0,t.jsx)("span",{children:d[e.role||"member"]||"👤"}),(0,t.jsx)("span",{className:"truncate flex-1",children:e.network_name}),e.agentCount?(0,t.jsx)("span",{className:"shrink-0 tabular-nums text-[10px] text-gray-600",children:e.agentCount}):null]},e.network_id))})]}),(0,t.jsx)("div",{className:"pb-20",children:j}),(0,t.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 border-t border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,t.jsxs)("button",{onClick:()=>{window.dispatchEvent(new KeyboardEvent("keydown",{key:"k",metaKey:!0,ctrlKey:!0}))},title:h?"Quick search (⌘K)":void 0,className:`w-full flex items-center text-[11px] text-gray-600 hover:text-gray-400 hover:bg-[#1a1a2a] transition-colors ${h?"justify-center px-0 py-2.5":"justify-between gap-2 px-5 py-3 lg:py-2"}`,"aria-label":"Open command palette",children:[(0,t.jsxs)("span",{className:`flex items-center ${h?"":"gap-2"}`,children:[(0,t.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),!h&&"Quick search"]}),!h&&(0,t.jsx)("kbd",{className:"text-[10px] border border-current rounded px-1 py-0.5 opacity-60 font-mono",children:"⌘K"})]}),(0,t.jsxs)("button",{onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),sessionStorage.removeItem("anet_v3_auth"),window.location.assign("/login")},title:h?"Sign out":void 0,className:`w-full flex items-center text-xs text-gray-500 hover:text-red-400 hover:bg-red-500/5 transition-colors ${h?"justify-center px-0 py-2.5":"gap-3 px-5 py-3"}`,children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,t.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"})}),!h&&"Sign out"]}),(0,t.jsxs)("div",{className:`flex items-center gap-2 ${h?"flex-col px-0 py-2":"px-3 py-2 justify-between"}`,children:[(0,t.jsx)(i.ThemeSwitcher,{compact:h}),(0,t.jsx)("button",{onClick:()=>g(!h),title:h?"Expand sidebar":"Collapse sidebar",className:"hidden lg:flex p-1.5 rounded text-gray-600 hover:text-gray-400 transition-colors","aria-label":h?"Expand sidebar":"Collapse sidebar",children:(0,t.jsx)("svg",{className:`w-4 h-4 transition-transform ${h?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})})]})]})]})]})}let m=e=>fetch(e).then(e=>e.ok?e.json():{sessions:[]});function p({collapsed:e}){let{data:a}=(0,r.default)("/api/hub/status",m,{refreshInterval:1e4,dedupingInterval:4e3}),n=a?.sessions||[],o=n.filter(e=>e.status&&"offline"!==e.status).length,i=n.length;return e?(0,t.jsx)(s.default,{href:"/",className:"block px-3 py-4 flex justify-center hover:opacity-80 transition-opacity","aria-label":"Agent Network — home",children:(0,t.jsx)(g,{size:32})}):(0,t.jsxs)(s.default,{href:"/",className:"block px-4 py-4 flex items-center gap-3 hover:bg-[#11112a]/40 transition-colors rounded-r-xl","aria-label":"Agent Network — home",children:[(0,t.jsx)(g,{size:32}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-white text-[13px] font-semibold leading-tight",children:"Agent Network"}),(0,t.jsxs)("div",{className:"text-[10px] text-gray-500 flex items-center gap-1.5 mt-0.5",children:[(0,t.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${o>0?"bg-emerald-400 anet-brand-pulse":"bg-gray-600"}`,"aria-hidden":!0}),0===i?(0,t.jsx)("span",{children:"waiting for agents"}):(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"text-gray-300 font-medium tabular-nums",children:o}),(0,t.jsxs)("span",{className:"text-gray-600",children:["/",i]})," online"]})]})]})]})}function g({size:e}){return(0,t.jsxs)("svg",{width:e,height:e,viewBox:"0 0 32 32","aria-hidden":!0,className:"shrink-0",children:[(0,t.jsx)("circle",{cx:"16",cy:"16",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.2",className:"text-cyan-400"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"10",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.45",className:"text-cyan-400"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.45",className:"text-cyan-400"}),(0,t.jsx)("line",{x1:"10",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.45",className:"text-cyan-400"}),(0,t.jsx)("circle",{cx:"16",cy:"10",r:"2.5",fill:"currentColor",className:"text-cyan-400"}),(0,t.jsx)("circle",{cx:"10",cy:"20",r:"2.5",fill:"currentColor",className:"text-green-400"}),(0,t.jsx)("circle",{cx:"22",cy:"20",r:"2.5",fill:"currentColor",className:"text-violet-400"})]})}let u=async e=>{let t=await fetch(e);if(!t.ok)throw Error(String(t.status));return t.json()};function x(){let e,a,{data:o,error:i}=(0,r.default)("/api/hub/stats",u,{refreshInterval:15e3,dedupingInterval:5e3,shouldRetryOnError:!1}),{data:l,error:c}=(0,r.default)("/api/hub/health",u,{refreshInterval:15e3,dedupingInterval:5e3,shouldRetryOnError:!1}),[d,h]=(0,n.useState)(()=>"1"===sessionStorage.getItem("anet-hb-dismissed"));if(d)return null;let m=i&&c||l&&!1===l.ok,p=o?.tasks?.by_status?.find(e=>"failed"===e.status)?.count||0,g=o?.nodes?.total===0,x=null;if(m?(e="red",a="CommHub unreachable — agents may be offline",x={label:"Open Settings",href:"/settings"}):p>0?(e="amber",a=`${p} task${p>1?"s":""} failed recently`,x={label:"Review failures",href:"/tasks?status=failed"}):(g?(e="green",a="Waiting for first agent"):(e="green",a="All systems go"),x=null),"green"===e&&!o)return null;let f={red:"bg-red-500/8 border-red-500/25 text-red-300",amber:"bg-amber-500/8 border-amber-500/25 text-amber-300",green:"bg-emerald-500/6 border-emerald-500/20 text-emerald-300"}[e],v={red:"bg-red-400",amber:"bg-amber-400 anet-brand-pulse",green:"bg-emerald-400"}[e];return(0,t.jsxs)("div",{role:"status",className:`anet-health-banner sticky top-0 z-30 border-b ${f} pl-14 pr-3 sm:px-6 py-1.5 text-[12px] flex items-center justify-between gap-3 backdrop-blur-sm`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${v}`,"aria-hidden":!0}),(0,t.jsx)("span",{className:"truncate",children:a})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[x&&(0,t.jsxs)(s.default,{href:x.href,className:"text-[11px] font-medium underline-offset-2 hover:underline opacity-90 hover:opacity-100 hidden sm:inline",children:[x.label," →"]}),x&&(0,t.jsx)(s.default,{href:x.href,"aria-label":x.label,className:"sm:hidden text-[13px] font-medium opacity-90 hover:opacity-100 relative leading-none px-1.5 before:absolute before:inset-y-[-10px] before:inset-x-[-8px] before:content-['']",children:"→"}),(0,t.jsx)("button",{onClick:()=>{h(!0);try{sessionStorage.setItem("anet-hb-dismissed","1")}catch{}},"aria-label":"Dismiss banner",className:"opacity-60 hover:opacity-100 leading-none px-1.5 text-base relative rounded-md hover:bg-white/5 before:absolute before:inset-y-[-10px] before:inset-x-[-8px] before:content-['']",children:"×"})]})]})}let f="anet-cmdk-recents";function v(){try{let e=sessionStorage.getItem(f);return e?JSON.parse(e):[]}catch{return[]}}function b(e){try{let t=v().filter(t=>t!==e);t.unshift(e),sessionStorage.setItem(f,JSON.stringify(t.slice(0,4)))}catch{}}function y(e,t){if(!t)return{score:0,indices:[]};let a=e.toLowerCase(),s=t.toLowerCase(),n=0,r=0,o=0,i=0,l=[];for(;n<a.length&&r<s.length;)a[n]===s[r]?(o+=2+i,i++,l.push(n),(0===n||/[\s·:_/-]/.test(a[n-1]))&&(o+=4),r++):i=0,n++;return r<s.length?{score:-1,indices:[]}:{score:o-.05*Math.max(0,a.length-s.length),indices:l}}function k({text:e,indices:a}){if(!a.length)return(0,t.jsx)(t.Fragment,{children:e});let s=new Set(a),n=Array.from(e);return(0,t.jsx)(t.Fragment,{children:n.map((e,a)=>s.has(a)?(0,t.jsx)("mark",{className:"anet-cmdk-mark",children:e},a):(0,t.jsx)("span",{children:e},a))})}function w({d:e}){return(0,t.jsx)("svg",{width:"14",height:"14",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}let j=[{id:"go-overview",title:"Go to Overview",hint:"Fleet at a glance",group:"Navigate",icon:(0,t.jsx)(w,{d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3"}),perform:e=>e.push("/")},{id:"go-tasks",title:"Go to Tasks",hint:"All task statuses",group:"Navigate",icon:(0,t.jsx)(w,{d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"}),perform:e=>e.push("/tasks")},{id:"go-tasks-failed",title:"Go to Failed tasks",hint:"Filter status=failed",group:"Navigate",icon:(0,t.jsx)(w,{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}),perform:e=>e.push("/tasks?status=failed")},{id:"go-nodes",title:"Go to Nodes",hint:"Agent fleet",group:"Navigate",icon:(0,t.jsx)(w,{d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}),perform:e=>e.push("/nodes")},{id:"go-messages",title:"Go to Messages",hint:"Inter-agent chat",group:"Navigate",icon:(0,t.jsx)(w,{d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"}),perform:e=>e.push("/messages")},{id:"go-networks",title:"Go to Networks",hint:"Manage networks",group:"Navigate",icon:(0,t.jsx)(w,{d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"}),perform:e=>e.push("/settings/networks")},{id:"go-logs",title:"Go to Audit Log",hint:"Register / login / actions",group:"Navigate",icon:(0,t.jsx)(w,{d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"}),perform:e=>e.push("/logs")},{id:"go-server-logs",title:"Go to Server Logs",hint:"CommHub stdout/stderr",group:"Navigate",icon:(0,t.jsx)(w,{d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"}),perform:e=>e.push("/server-logs")},{id:"go-admin",title:"Go to Admin",hint:"Server overview + broadcast",group:"Navigate",icon:(0,t.jsx)(w,{d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"}),perform:e=>e.push("/admin")},{id:"go-settings",title:"Go to Settings",hint:"Connection / Account / Resources",group:"Navigate",icon:(0,t.jsx)(w,{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),perform:e=>e.push("/settings")},{id:"act-toggle-theme",title:"Toggle theme",hint:"cyber ↔ light",group:"Actions",icon:(0,t.jsx)(w,{d:"M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"}),perform:()=>{let e=document.documentElement.getAttribute("data-theme")||"cyber",t="light"===e||"mint"===e?"cyber":"light";document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem("anet-theme",t)}catch{}}},{id:"act-copy-url",title:"Copy current URL",hint:"page link to clipboard",group:"Actions",icon:(0,t.jsx)(w,{d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"}),perform:()=>{try{navigator.clipboard.writeText(window.location.href)}catch{}}},{id:"act-sign-out",title:"Sign out",hint:"clear session",group:"Actions",icon:(0,t.jsx)(w,{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"}),perform:()=>{fetch("/api/auth/logout",{method:"POST"}).catch(()=>{});try{sessionStorage.removeItem("anet_v3_auth")}catch{}window.location.assign("/login")}},{id:"act-help",title:"Show keyboard shortcuts",hint:"press ? — works on mobile too",group:"Actions",icon:(0,t.jsx)(w,{d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),perform:()=>{window.dispatchEvent(new KeyboardEvent("keydown",{key:"?"}))}},{id:"act-pin-working",title:"Pin topology filter: working",hint:"highlight working nodes only",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 6h16M4 12h8m-8 6h16"}),perform:()=>{try{sessionStorage.setItem("anet-topo-pinned-status","working")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"status",value:"working"}}))}},{id:"act-pin-idle",title:"Pin topology filter: idle",hint:"highlight idle (online) nodes only",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 6h16M4 12h8m-8 6h16"}),perform:()=>{try{sessionStorage.setItem("anet-topo-pinned-status","idle")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"status",value:"idle"}}))}},{id:"act-pin-offline",title:"Pin topology filter: offline",hint:"highlight offline / no-SSE nodes",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 6h16M4 12h8m-8 6h16"}),perform:()=>{try{sessionStorage.setItem("anet-topo-pinned-status","offline")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"status",value:"offline"}}))}},{id:"act-pin-vendor-A",title:"Pin topology filter: Anthropic",hint:"highlight A vendor only",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 6h16M4 12h8m-8 6h16"}),perform:()=>{try{sessionStorage.setItem("anet-topo-pinned-vendor","A")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"vendor",value:"A"}}))}},{id:"act-pin-vendor-O",title:"Pin topology filter: OpenAI",hint:"highlight O vendor only",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 6h16M4 12h8m-8 6h16"}),perform:()=>{try{sessionStorage.setItem("anet-topo-pinned-vendor","O")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"vendor",value:"O"}}))}},{id:"act-pin-vendor-S",title:"Pin topology filter: 书生",hint:"highlight 书 vendor only",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 6h16M4 12h8m-8 6h16"}),perform:()=>{try{sessionStorage.setItem("anet-topo-pinned-vendor","书")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"vendor",value:"书"}}))}},{id:"act-clear-topo-pins",title:"Clear topology filters",hint:"release pinned status + group + vendor + edge",group:"Actions",icon:(0,t.jsx)(w,{d:"M6 18L18 6M6 6l12 12"}),perform:()=>{try{sessionStorage.removeItem("anet-topo-pinned-status"),sessionStorage.removeItem("anet-topo-pinned-group"),sessionStorage.removeItem("anet-topo-pinned-vendor")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"clear"}}))}},{id:"act-clear-topo-edge",title:"Clear topology edge pin",hint:"release pinned recent-signal row only",group:"Actions",icon:(0,t.jsx)(w,{d:"M6 18L18 6M6 6l12 12"}),perform:()=>{window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"clear-edge"}}))}},{id:"act-clear-topo-vendor",title:"Clear topology vendor filter",hint:"release pinned vendor only",group:"Actions",icon:(0,t.jsx)(w,{d:"M6 18L18 6M6 6l12 12"}),perform:()=>{try{sessionStorage.removeItem("anet-topo-pinned-vendor")}catch{}window.dispatchEvent(new CustomEvent("anet:topo-pin",{detail:{kind:"clear-vendor"}}))}},{id:"act-topo-toggle-layout",title:"Toggle topology layout",hint:"ring ↔ grid (or press `l`)",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 4h6v6H4V4zm10 0h6v6h-6V4zM4 14h6v6H4v-6zm10 0h6v6h-6v-6z"}),perform:()=>{window.dispatchEvent(new CustomEvent("anet:topo-layout",{detail:{kind:"toggle"}}))}},{id:"act-topo-fit",title:"Fit topology to canvas",hint:"auto-zoom to content (or press `f`)",group:"Actions",icon:(0,t.jsx)(w,{d:"M4 8V4h4M16 4h4v4M20 16v4h-4M8 20H4v-4"}),perform:()=>{window.dispatchEvent(new CustomEvent("anet:topo-view",{detail:{kind:"fit"}}))}}];function N(){let e=(0,a.useRouter)(),[s,r]=(0,n.useState)(!1),[o,i]=(0,n.useState)(""),[l,c]=(0,n.useState)(0),d=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()){e.preventDefault(),r(e=>!e);return}if("/"===e.key&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA"&&!s){e.preventDefault(),r(!0);return}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s]),(0,n.useEffect)(()=>{s&&(i(""),c(0),setTimeout(()=>d.current?.focus(),50))},[s]);let[h,m]=(0,n.useState)([]);(0,n.useEffect)(()=>{s&&m(v())},[s]);let[p,g]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(!s)return;let e=!1;return(async()=>{try{let[a,s]=await Promise.all([fetch("/api/hub/status").then(e=>e.ok?e.json():{sessions:[]}),fetch("/api/hub/tasks?limit=20").then(e=>e.ok?e.json():{tasks:[]})]);if(e)return;let n=(a.sessions||[]).filter(e=>e.alias).slice(0,20).map(e=>({id:`agent-${e.alias}`,title:`Go to agent ${e.alias}`,hint:`${e.agent||"agent"} \xb7 ${e.status||"unknown"}`,group:"Agents",icon:(0,t.jsx)(w,{d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"}),perform:t=>t.push(`/node?alias=${encodeURIComponent(e.alias)}`)})),r=(s.tasks||[]).filter(e=>e.task_id).slice(0,15).map(e=>({id:`task-${e.task_id}`,title:`Open task: ${(e.content||e.task_id||"").slice(0,50)}`,hint:`${e.from_name||"?"} → ${e.to_name||"?"} \xb7 ${e.status||""}`,group:"Tasks",icon:(0,t.jsx)(w,{d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"}),perform:t=>t.push(`/tasks/${encodeURIComponent(e.task_id)}`)}));g([...n,...r])}catch{}})(),()=>{e=!0}},[s]);let u=(0,n.useMemo)(()=>{let e=[...j,...p];if(!o.trim()){let t=h.map(t=>e.find(e=>e.id===t)).filter(e=>!!e).map(e=>({...e,group:"Recents"})),a=new Set(h);return[...t,...j.filter(e=>!a.has(e.id))]}let t=e.map(e=>{let t=y(e.title,o),a=e.hint?y(e.hint,o):{score:-1,indices:[]},s=y(e.id,o);return{c:e,score:Math.max(t.score>=0?+t.score:-1/0,a.score>=0?.6*a.score:-1/0,s.score>=0?.3*s.score:-1/0),_titleHi:t.score>=0?t.indices:[],_hintHi:a.score>=0?a.indices:[]}}).filter(e=>e.score>-1/0);return t.sort((e,t)=>t.score-e.score),t.map(e=>({...e.c,_titleHi:e._titleHi,_hintHi:e._hintHi}))},[o,h,p]);if((0,n.useEffect)(()=>{l>=u.length&&c(0)},[u.length,l]),!s)return null;let x={};for(let e of u)(x[e.group]||=[]).push(e);let f=0;return(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:"anet-cmdk fixed inset-0 z-[100] flex items-start justify-center pt-[10vh] sm:pt-[15vh] px-4",onClick:()=>r(!1),onKeyDown:t=>{if("Escape"===t.key)return void r(!1);if("ArrowDown"===t.key){t.preventDefault(),c(e=>Math.min(e+1,u.length-1));return}if("ArrowUp"===t.key){t.preventDefault(),c(e=>Math.max(e-1,0));return}if("Enter"===t.key){t.preventDefault();let a=u[l];a&&(b(a.id),a.perform(e),r(!1))}},children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":!0}),(0,t.jsxs)("div",{className:"relative w-full max-w-xl rounded-xl border border-[#2a2a4a] bg-[#0d0d1a] shadow-2xl shadow-black/40 overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b border-[#2a2a4a] px-3 py-2.5",children:[(0,t.jsx)("svg",{width:"14",height:"14",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",className:"text-gray-500 shrink-0",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,t.jsx)("input",{ref:d,value:o,onChange:e=>{i(e.target.value),c(0)},placeholder:"Type a command or search…",className:"flex-1 bg-transparent text-base sm:text-sm text-gray-200 placeholder-gray-600 focus:outline-none"}),(0,t.jsx)("kbd",{className:"text-[10px] text-gray-600 border border-[#2a2a4a] rounded px-1.5 py-0.5 font-mono",children:"esc"})]}),(0,t.jsx)("div",{className:"max-h-[60vh] overflow-y-auto py-2",children:0===u.length?(0,t.jsxs)("div",{className:"px-4 py-8 text-center text-xs text-gray-600",children:['No commands match "',o,'"']}):Object.entries(x).map(([a,s])=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-[10px] uppercase tracking-[0.12em] text-gray-600 px-3 py-1",children:a}),s.map(a=>{let s=f++,n=s===l;return(0,t.jsxs)("button",{onMouseEnter:()=>c(s),onClick:()=>{b(a.id),a.perform(e),r(!1)},className:`anet-cmdk-row w-full flex items-center gap-3 px-3 py-2 text-left text-sm ${n?"bg-cyan-500/10 text-cyan-300":"text-gray-300 hover:bg-[#1a1a2a]/50"}`,children:[(0,t.jsx)("span",{className:n?"text-cyan-400":"text-gray-500",children:a.icon}),(0,t.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"block truncate",children:(0,t.jsx)(k,{text:a.title,indices:a._titleHi||[]})}),a.hint&&(0,t.jsx)("span",{className:"block text-[11px] text-gray-600 truncate",children:(0,t.jsx)(k,{text:a.hint,indices:a._hintHi||[]})})]}),n&&(0,t.jsx)("span",{className:"text-[10px] text-gray-500",children:"↵"})]},a.id)})]},a))}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] px-3 py-1.5 flex items-center justify-between text-[10px] text-gray-600",children:[(0,t.jsxs)("span",{className:"flex items-center gap-3",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{className:"font-mono",children:"↑↓"})," navigate"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{className:"font-mono",children:"↵"})," select"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{className:"font-mono",children:"esc"})," close"]})]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{className:"font-mono",children:"⌘K"})," toggle"]})]})]})]})}let M=[{group:"Global",items:[{keys:["⌘","K"],label:"Open command palette (also Ctrl+K)"},{keys:["/"],label:"Open command palette"},{keys:["?"],label:"Toggle this help overlay"},{keys:["Esc"],label:"Close any open modal"}]},{group:"Navigate (vim-style)",items:[{keys:["g","o"],label:"Go to Overview"},{keys:["g","t"],label:"Go to Tasks"},{keys:["g","n"],label:"Go to Nodes"},{keys:["g","m"],label:"Go to Messages"},{keys:["g","w"],label:"Go to Networks"},{keys:["g","a"],label:"Go to Admin"},{keys:["g","l"],label:"Go to Audit Log"},{keys:["g","s"],label:"Go to Settings"}]},{group:"Command palette",items:[{keys:["↑","↓"],label:"Move selection"},{keys:["↵"],label:"Activate selected command"},{keys:["type"],label:"Filter — searches commands, agents, tasks"}]},{group:"Topology canvas",items:[{keys:["+"],label:"Zoom in (also =)"},{keys:["−"],label:"Zoom out"},{keys:["0"],label:"Reset zoom + pan"},{keys:["f"],label:"Fit topology to canvas"},{keys:["l"],label:"Toggle layout (ring ↔ grid)"},{keys:["⌘","wheel"],label:"Zoom toward cursor (Ctrl on Windows/Linux)"},{keys:["drag"],label:"Pan the canvas (cursor → grabbing)"},{keys:["dbl-click"],label:"Reset zoom + pan (empty canvas only)"},{keys:["click"],label:"Open chat popover on a node (Esc to close)"},{keys:["click hub"],label:"Fit topology to canvas (R52)"},{keys:["hover legend"],label:"Highlight nodes of a status (R55)"},{keys:["hover signal"],label:"Highlight one flow edge (R56)"},{keys:["click chip"],label:"Pin a status filter (R60/R61)"},{keys:["Esc"],label:"Clear pinned filter (R62) — or close chat"},{keys:["click group"],label:"Pin a team focus (R63)"},{keys:["click ×"],label:"Clear one filter (R64) — Esc clears all"},{keys:["⌘","K"],label:'Pin / clear filters via palette → "Pin topology filter…" (R69)'},{keys:["⌘","K"],label:"Toggle layout / Fit canvas via palette (R74)"},{keys:["click pill"],label:"Clear filter — click anywhere on the pill body (R73)"},{keys:["hover chip"],label:'Brighten all active flows — hover "N active links" (R77)'},{keys:["hover N working"],label:"Highlight working nodes — chip-row sibling of legend (R79)"},{keys:["hover vendor"],label:"Highlight one vendor — hover A/O/书/? in the chip row (R80)"},{keys:["hover seg"],label:"Preview a status filter — hover a pressure-bar segment (R83)"},{keys:["hover group"],label:"Preview a team focus — hover a group label (R86)"},{keys:["click vendor"],label:"Pin a vendor filter — click A/O/书/? in the chip row (R88)"},{keys:["⌘","K"],label:'Clear vendor pin only via palette → "Clear topology vendor filter" (R90)'},{keys:["⌘","K"],label:'Pin vendor: Anthropic/OpenAI/书生 via palette → "Pin topology filter…" (R108)'},{keys:["click row"],label:"Pin a flow filter — click a recent-signal row to lock the edge (R116)"},{keys:["⌘","K"],label:'Clear edge pin only via palette → "Clear topology edge pin" (R117)'},{keys:["click badge"],label:"Pin a flow filter from the canvas — click an edge midpoint count badge (R121)"},{keys:["click footer"],label:'See all flows — click "+ N more flows" in the recent-signal panel (R133)'},{keys:["click chip"],label:'See all flows — click the "N active links" chip in the chip row (R136)'},{keys:["click chip"],label:'Pin "working" status — click "N working" in the chip row (R139)'},{keys:["click chip"],label:'Open the agent list — click "N online" in the chip row (R140)'},{keys:["Tab","Enter"],label:"Open chat on a focused node (also Space) — keyboard parallel of click-to-chat (R151)"}]}],C={o:"/",t:"/tasks",n:"/nodes",m:"/messages",w:"/settings/networks",a:"/admin",l:"/logs",s:"/settings"};function E(){let[e,s]=(0,n.useState)(!1),r=(0,a.useRouter)(),o=(0,n.useRef)(0);return((0,n.useEffect)(()=>{let t=t=>{let a=document.activeElement?.tagName,n="INPUT"===a||"TEXTAREA"===a||document.activeElement?.isContentEditable;if("?"===t.key&&!n){t.preventDefault(),s(e=>!e);return}if("Escape"===t.key&&e&&s(!1),!n&&!t.metaKey&&!t.ctrlKey&&!t.altKey){if("g"===t.key){o.current=Date.now();return}if(Date.now()-o.current<1500){let e=C[t.key.toLowerCase()];e&&(t.preventDefault(),o.current=0,r.push(e))}}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,r]),e)?(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:"anet-help fixed inset-0 z-[101] flex items-center justify-center px-4",onClick:()=>s(!1),children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":!0}),(0,t.jsxs)("div",{className:"relative w-full max-w-md rounded-xl border border-[#2a2a4a] bg-[#0d0d1a] shadow-2xl shadow-black/40 overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-[#2a2a4a] px-4 py-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-200",children:[(0,t.jsx)("svg",{width:"14",height:"14",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",className:"text-gray-500",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Keyboard shortcuts"]}),(0,t.jsx)("button",{onClick:()=>s(!1),"aria-label":"Close help",className:"text-gray-500 hover:text-gray-300 text-lg leading-none px-1",children:"×"})]}),(0,t.jsx)("div",{className:"px-4 py-3 max-h-[70vh] overflow-y-auto",children:M.map(e=>(0,t.jsxs)("div",{className:"mb-3 last:mb-0",children:[(0,t.jsx)("div",{className:"text-[10px] uppercase tracking-[0.12em] text-gray-600 mb-1.5",children:e.group}),(0,t.jsx)("ul",{className:"space-y-1.5",children:e.items.map((e,a)=>(0,t.jsxs)("li",{className:"flex items-center gap-3 text-xs",children:[(0,t.jsx)("span",{className:"flex items-center gap-1",children:e.keys.map((e,a)=>(0,t.jsx)("kbd",{className:"text-[10px] font-mono border border-[#2a2a4a] rounded px-1.5 py-0.5 text-gray-400 bg-[#1a1a2a]/40",children:e},a))}),(0,t.jsx)("span",{className:"text-gray-400 flex-1",children:e.label})]},a))})]},e.group))}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] px-4 py-1.5 text-[10px] text-gray-600 flex items-center justify-between",children:[(0,t.jsxs)("span",{children:["Press ",(0,t.jsx)("kbd",{className:"font-mono",children:"?"})," to toggle"]}),(0,t.jsxs)("span",{children:["or ",(0,t.jsx)("kbd",{className:"font-mono",children:"esc"})," to close"]})]})]})]}):null}var A=e.i(4221);let S=[{href:"/",label:"Overview",icon:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"},{href:"/tasks",label:"Tasks",icon:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},{href:"/nodes",label:"Agents",icon:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"},{href:"/messages",label:"Chats",icon:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"}];function L(){let e=(0,a.usePathname)();return(0,t.jsx)("nav",{className:"fixed inset-x-0 bottom-0 z-40 border-t border-[#2a2a4a] bg-[#0d0d1a]/95 px-1 pb-[calc(env(safe-area-inset-bottom)+0.35rem)] pt-1.5 backdrop-blur lg:hidden",children:(0,t.jsxs)("div",{className:"mx-auto grid max-w-md grid-cols-5 gap-1",children:[S.map(a=>{let n,r="/"===(n=a.href)?"/"===e:e.startsWith(n);return(0,t.jsxs)(s.default,{href:a.href,prefetch:!1,"aria-current":r?"page":void 0,className:`relative flex min-h-12 flex-col items-center justify-center gap-0.5 rounded-xl px-1 text-[10px] transition-colors ${r?"bg-cyan-500/12 text-cyan-300 before:absolute before:top-0 before:left-3 before:right-3 before:h-0.5 before:rounded-full before:bg-cyan-400":"text-gray-500 active:bg-[#1a1a3a] active:text-gray-200"}`,children:[(0,t.jsx)("svg",{className:"h-5 w-5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:a.icon})}),(0,t.jsx)("span",{className:"max-w-full truncate",children:a.label})]},a.href)}),(0,t.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new KeyboardEvent("keydown",{key:"k",metaKey:!0,ctrlKey:!0}))},className:"flex min-h-12 flex-col items-center justify-center gap-0.5 rounded-xl px-1 text-[10px] text-gray-500 transition-colors active:bg-[#1a1a3a] active:text-gray-200","aria-label":"Open command palette",children:[(0,t.jsx)("svg",{className:"h-5 w-5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v3m0 12v3m9-9h-3M6 12H3m15.364-6.364l-2.121 2.121M7.757 16.243l-2.121 2.121m12.728 0l-2.121-2.121M7.757 7.757L5.636 5.636M12 8.5A3.5 3.5 0 1112 15.5 3.5 3.5 0 0112 8.5z"})}),(0,t.jsx)("span",{className:"max-w-full truncate",children:"Command"})]})]})})}let R=["/login"];e.s(["AppShell",0,function({children:e}){let s=(0,a.usePathname)();return R.includes(s)?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsxs)("div",{className:"flex min-h-[100dvh] max-w-full overflow-x-hidden",children:[(0,t.jsx)(h,{}),(0,t.jsxs)("main",{className:"flex-1 min-w-0 max-w-full overflow-x-hidden flex flex-col",children:[(0,t.jsx)(x,{}),(0,t.jsx)("div",{className:"flex-1 min-w-0 max-w-full overflow-x-hidden pb-[calc(5rem+env(safe-area-inset-bottom))] lg:pb-0",children:e})]}),(0,t.jsx)(L,{}),(0,t.jsx)(N,{}),(0,t.jsx)(E,{}),(0,t.jsx)(A.ServersDrawer,{})]})}],22485)},28516,e=>{"use strict";var t=e.i(23910);e.s(["PwaInstaller",0,function(){return(0,t.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{})},[]),null}])}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,59276,e=>{"use strict";var s=e.i(12629),a=e.i(11449);let t=async e=>{let s=await fetch(e);if(401===s.status)throw window.location.assign("/login"),Error("unauthorized");return s.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function n(e,s){if(!s)return e;let a=e.includes("?")?"&":"?";return`${e}${a}network_id=${encodeURIComponent(s)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,s.default)("/api/anet/config",t,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:a}=(0,s.default)("/api/hub/health",t,r);return{health:e||null,error:a}},"useLicense",0,function(){let{data:e,error:a}=(0,s.default)("/api/hub/license",t,{refreshInterval:6e4});return{license:e?.ok?e:null,error:a}},"useMessages",0,function(e=100){let{networkId:l}=(0,a.useNetworkId)(),{data:i,error:c,isLoading:d}=(0,s.default)(n(`/api/hub/messages?limit=${e}`,l),t,r);return{messages:i?.messages||[],error:c,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:l,error:i,isLoading:c}=(0,s.default)(n("/api/hub/status",e),t,r);return{sessions:l?.sessions||[],hint:l?._hint,error:i,isLoading:c}},"useStats",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:l,error:i}=(0,s.default)(n("/api/hub/stats",e),t,r);return{stats:l?.ok?l:null,error:i}},"useTasks",0,function(e){let{networkId:l}=(0,a.useNetworkId)(),i=new URLSearchParams({limit:"100",...e}).toString(),{data:c,error:d,isLoading:o}=(0,s.default)(n(`/api/hub/tasks?${i}`,l),t,r);return{tasks:c?.tasks||[],count:c?.count??0,source:c?.source,error:d,isLoading:o}}])},70286,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.5.7-preview.21"],70286)},65610,e=>{"use strict";var s=e.i(22381),a=e.i(23910),t=e.i(56839),r=e.i(59276),n=e.i(70286);e.s(["default",0,function(){let{config:e}=(0,r.useAnetConfig)(),{health:l}=(0,r.useHealth)(),{license:i}=(0,r.useLicense)(),[c,d]=(0,a.useState)(""),[o,x]=(0,a.useState)(""),[m,h]=(0,a.useState)(""),[g,u]=(0,a.useState)(""),[p,b]=(0,a.useState)(""),N="flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",j="break-all sm:max-w-[320px] sm:text-right";return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white mb-3 lg:ml-0 ml-10",children:"Settings"}),(0,s.jsx)("nav",{className:"mb-8 flex flex-wrap gap-2 text-xs",children:[{href:"#connection",label:"Connection"},{href:"#account",label:"Account"},{href:"#resources",label:"Resources"}].map(e=>(0,s.jsx)("a",{href:e.href,className:"inline-flex min-h-[44px] items-center rounded-md border border-[#2a2a4a] bg-[#0a0a15]/60 px-3 py-2 text-gray-400 hover:border-cyan-500/50 hover:text-cyan-300 hover:bg-cyan-500/10 transition-colors",children:e.label},e.href))}),(0,s.jsxs)("div",{className:"max-w-2xl space-y-10",children:[(0,s.jsxs)("div",{id:"connection",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Connection"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"CommHub Connection"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500 shrink-0",children:"Hub URL"}),(0,s.jsx)("span",{className:`text-cyan-300 ${j}`,children:e?.hub||"not configured"})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Config Source"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:e?.source==="file"?"Local file (~/.anet/config.json)":e?.source==="runtime-env"?"Vercel env vars":"Missing"})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Auth Token"}),(0,s.jsx)("span",{className:`${e?.tokenConfigured?"text-green-400":"text-red-400"} ${j}`,children:e?.tokenConfigured?`Configured (${e.tokenPreview})`:"Not configured"})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Server Auth"}),(0,s.jsx)("span",{className:`${l?.auth==="enabled"?"text-green-400":"text-yellow-400"} sm:text-right`,children:l?.auth||"--"})]}),e?.error&&(0,s.jsx)("div",{className:"border-t border-[#2a2a4a] pt-3 text-xs text-gray-600",children:e.error})]})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Info"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.version||"--"})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Sessions"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.sessions??"--"})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsxs)("span",{className:"text-gray-500",children:["SSE streams ",(0,s.jsx)("span",{className:"text-gray-600",children:"· server"})]}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.sse_connections??"--"})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Uptime"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.uptime?`${Math.floor(l.uptime/3600)}h ${Math.floor(l.uptime%3600/60)}m`:"--"})]})]})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Dashboard"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 font-mono ${j}`,title:"From package.json @sleep2agi/agent-network-dashboard",children:n.DASHBOARD_VERSION})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Data Layer"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:"SWR (5s refresh, 3s dedup)"})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Pages"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:"Overview, Tasks, Nodes, Messages, Networks, Audit, Server Logs, Admin, Settings"})]})]})]})]}),(0,s.jsxs)("div",{id:"account",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Account"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-4 flex items-center gap-2",children:["License",i?.license&&(0,s.jsxs)("span",{className:`inline-flex items-center gap-1.5 text-[10px] font-medium px-2 py-0.5 rounded-full border ${"pro"===i.license.type?"text-green-300 bg-green-500/10 border-green-500/30":i.license.days_left<=7?"text-red-300 bg-red-500/10 border-red-500/30":"text-amber-300 bg-amber-500/10 border-amber-500/30"}`,children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"w-1.5 h-1.5 rounded-full bg-current"}),i.license.type,i.license.days_left?` \xb7 ${i.license.days_left}d left`:""]})]}),i?.license?(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[i.license.days_left<=7&&(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-red-400 font-medium",children:"⚠ Expiring soon"}),(0,s.jsxs)("span",{className:"text-red-400",children:[i.license.days_left," days left"]})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Expires"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.license.expires_at})]}),i.limits&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Max Agents"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_agents})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Max Networks"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_networks})]}),(0,s.jsxs)("div",{className:N,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Tasks/Day"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_tasks_day})]})]}),(0,s.jsxs)("div",{className:"pt-3 border-t border-[#2a2a4a]",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:"anet-XXXX-XXXX-XXXX-XXXX",className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!c.trim())return;let e=await fetch("/api/hub/license",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:c})}),s=await e.json();x(s.ok?`Activated: ${s.type}`:`Failed: ${s.error}`),s.ok&&d(""),setTimeout(()=>x(""),5e3)},className:"px-3 py-2 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded transition-colors",children:"Activate"})]}),o&&(0,s.jsx)("div",{className:`mt-2 text-xs ${o.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:o})]})]}):(0,s.jsx)("div",{className:"text-xs text-gray-600",children:"License info not available"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Change Password"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("input",{type:"password",value:m,onChange:e=>h(e.target.value),placeholder:"Current password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("input",{type:"password",value:g,onChange:e=>u(e.target.value),placeholder:"New password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!m||!g)return;let e=sessionStorage.getItem("anet_v3_auth");if(!e)return void b("Not logged in with V3 auth");let{token:s}=JSON.parse(e),a=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"change_password",token:s,current_password:m,new_password:g})}),t=await a.json();if(b(t.ok?"Password changed":`Failed: ${t.error}`),t.ok){if(t.token){let s=JSON.parse(e);sessionStorage.setItem("anet_v3_auth",JSON.stringify({...s,token:t.token}))}h(""),u("")}setTimeout(()=>b(""),5e3)},disabled:!m||!g,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:"Change Password"})]}),p&&(0,s.jsx)("div",{className:`mt-2 text-xs ${p.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:p})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Sign out"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Signing out clears your dashboard session cookie. You'll return to the login page."}),(0,s.jsx)("button",{onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login")},className:"px-4 py-2 bg-transparent hover:bg-[#1a1a2a] text-gray-300 text-sm rounded-lg border border-[#2a2a4a] hover:border-[#3a3a5a] transition-colors",children:"Sign out"})]})]}),(0,s.jsxs)("div",{id:"resources",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Resources"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)(t.default,{href:"/settings/tokens",className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"API Tokens"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create and manage tokens for CLI access."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(t.default,{href:"/settings/networks",className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Networks"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create, manage, and delete agent networks."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]})]})]})]})]})}])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3479,59746,e=>{"use strict";function t(e){if(!e)return null;let t=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(t)?t:null}function r(e){let r=t(e);if(null===r)return null;let a=Math.floor((Date.now()-r)/1e3);return a<0?"just now":a<60?`${a}s ago`:a<3600?`${Math.floor(a/60)}m ago`:a<86400?`${Math.floor(a/3600)}h ago`:`${Math.floor(a/86400)}d ago`}e.s(["parseHubTime",0,t,"relativeAgo",0,r],59746),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){return r(e)??"--"}],3479)},46228,e=>{"use strict";var t=e.i(22381);let r=[180,200,220,270,300,330,30,90];function a(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;let a=r[t%r.length];return{bg:`hsl(${a} 55% 22%)`,ring:`hsl(${a} 60% 45%)`,text:`hsl(${a} 80% 78%)`}}function s(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:n=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${n}`,style:{width:r,height:r,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let i=a(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 ${n}`,style:{width:r,height:r,fontSize:l,backgroundColor:i.bg,borderColor:i.ring,color:i.text},title:e,"aria-hidden":!0,children:s(e)})},"aliasAvatarColors",0,a,"aliasInitial",0,s])},76161,e=>{"use strict";var t=e.i(22381),r=e.i(23910),a=e.i(56839);let s={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:r}){let a={width:r,height:r},s={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",{...s,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",{...s,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",{...s,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",{...s,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",{...s,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",{...s,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",{...s,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=s[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)(n,{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)(a.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[a,s]=(0,r.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!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: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:"→"})]})})]})})}])},46860,e=>{"use strict";var t=e.i(22381),r=e.i(23910),a=e.i(56839),s=e.i(3479),n=e.i(11449),i=e.i(76161),l=e.i(46228);let o={register:"bg-green-500/10 text-green-300 border-green-500/20",login:"bg-blue-500/10 text-blue-300 border-blue-500/20",login_failed:"bg-red-500/10 text-red-300 border-red-500/20",create_network:"bg-purple-500/10 text-purple-300 border-purple-500/20",send_task:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"},c={register:"#4ade80",login:"#60a5fa",login_failed:"#ef4444",create_network:"#a78bfa",send_task:"#22d3ee"};e.s(["default",0,function(){let e,d,{networkId:x}=(0,n.useNetworkId)(),[h,g]=(0,r.useState)([]),[m,u]=(0,r.useState)(!0),[y,p]=(0,r.useState)(""),[j,b]=(0,r.useState)(""),f=(0,r.useCallback)(async()=>{try{let e=new URLSearchParams({limit:"100"});x&&e.set("network_id",x),j&&e.set("action",j);let t=sessionStorage.getItem("anet_v3_auth");if(t)try{let r=JSON.parse(t);r.token&&e.set("token",r.token)}catch{}let r=await fetch(`/api/hub/audit-log?${e.toString()}`);if(401===r.status)return void window.location.assign("/login");let a=await r.json();g(a.logs||[]),p(a.error&&!a.logs?.length?a.error:"")}catch(e){p(e instanceof Error?e.message:"fetch failed")}finally{u(!1)}},[j,x]);return(0,r.useEffect)(()=>{u(!0),f();let e=setInterval(f,1e4);return()=>clearInterval(e)},[f]),(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Audit Log"})}),(0,t.jsx)("div",{className:"mb-6 flex flex-wrap items-center gap-1 anet-tabstrip-wrap overflow-x-auto sm:overflow-x-visible",children:(e={},h.forEach(t=>{e[t.action]=(e[t.action]||0)+1}),[{key:"",label:"All"},{key:"login",label:"login",dot:c.login},{key:"login_failed",label:"login_failed",dot:c.login_failed},{key:"register",label:"register",dot:c.register},{key:"create_network",label:"create_network",dot:c.create_network},{key:"send_task",label:"send_task",dot:c.send_task}].map(r=>{let a=""===r.key?h.length:e[r.key]||0,s=j===r.key;return(0,t.jsxs)("button",{type:"button",onClick:()=>b(r.key),disabled:0===a&&""!==r.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 shrink-0 whitespace-nowrap ${s?"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:[r.dot&&(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:r.dot}}),(0,t.jsx)("span",{children:r.label}),(0,t.jsx)("span",{className:`text-[10px] tabular-nums ${s?"text-cyan-400":"text-gray-600"}`,children:a})]},r.key||"all")}))}),y&&(d=/unauthor|401|forbidden|403|admin/i.test(y),(0,t.jsxs)("div",{className:"anet-warn-chip bg-yellow-900/20 border border-yellow-800/40 text-yellow-300 px-4 py-3 rounded-lg mb-6 text-sm flex items-start gap-3",role:"alert",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-base leading-none",children:"⚠"}),(0,t.jsx)("div",{className:"flex-1",children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"font-medium",children:"需要 admin 权限查看审计日志"}),(0,t.jsx)("div",{className:"text-xs opacity-80 mt-1",children:"审计日志记录用户注册 / 登录 / 网络变更等事件,需要 admin 角色。"}),(0,t.jsx)(a.default,{href:"/login",className:"inline-block mt-2 text-xs font-medium underline underline-offset-4 hover:opacity-80",children:"切到 admin 账号 →"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"font-medium",children:"加载失败"}),(0,t.jsx)("div",{className:"text-xs opacity-80 mt-1",children:"请检查 CommHub 是否在线,或稍后重试。"}),(0,t.jsx)("button",{onClick:()=>window.location.reload(),className:"inline-block mt-2 text-xs font-medium underline underline-offset-4 hover:opacity-80",children:"重新加载 →"})]})})]})),m?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(e=>(0,t.jsx)("div",{className:"h-14 bg-gray-800/20 rounded-lg"},e))}):0===h.length?(0,t.jsx)(i.EmptyState,{variant:"logs"}):(0,t.jsx)("div",{className:"space-y-2",children:h.map(e=>{let r=e.username||e.user_id;return(0,t.jsxs)("div",{className:"relative bg-[#111128] border border-[#2a2a4a] rounded-lg pl-4 pr-4 py-3 hover:border-[#3a3a5a] transition-colors overflow-hidden",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute left-0 top-0 bottom-0 w-0.5",style:{backgroundColor:c[e.action]||"transparent"}}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${o[e.action]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:e.action}),r&&(0,t.jsx)(l.AliasAvatar,{alias:r,size:16}),(0,t.jsx)("span",{className:"text-sm text-gray-200 font-medium",children:r}),e.target_type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-xs text-gray-600",children:"→"}),(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:[e.target_type,e.target_id?`:${e.target_id.slice(0,12)}`:""]})]}),(0,t.jsx)("span",{className:"text-xs text-gray-600 ml-auto",children:(0,s.timeAgo)(e.created_at)})]}),e.detail&&(0,t.jsx)("div",{className:"text-xs text-gray-500",children:e.detail}),e.ip&&"unknown"!==e.ip&&(0,t.jsxs)("div",{className:"text-[10px] text-gray-700",children:["IP: ",e.ip]})]},e.id)})})]})}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3479,59746,e=>{"use strict";function t(e){if(!e)return null;let t=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(t)?t:null}function r(e){let r=t(e);if(null===r)return null;let a=Math.floor((Date.now()-r)/1e3);return a<0?"just now":a<60?`${a}s ago`:a<3600?`${Math.floor(a/60)}m ago`:a<86400?`${Math.floor(a/3600)}h ago`:`${Math.floor(a/86400)}d ago`}e.s(["parseHubTime",0,t,"relativeAgo",0,r],59746),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){return r(e)??"--"}],3479)},46228,e=>{"use strict";var t=e.i(22381);let r=[180,200,220,270,300,330,30,90];function a(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;let a=r[t%r.length];return{bg:`hsl(${a} 55% 22%)`,ring:`hsl(${a} 60% 45%)`,text:`hsl(${a} 80% 78%)`}}function s(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:n=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${n}`,style:{width:r,height:r,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let i=a(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 ${n}`,style:{width:r,height:r,fontSize:l,backgroundColor:i.bg,borderColor:i.ring,color:i.text},title:e,"aria-hidden":!0,children:s(e)})},"aliasAvatarColors",0,a,"aliasInitial",0,s])},76161,e=>{"use strict";var t=e.i(22381),r=e.i(23910),a=e.i(56839);let s={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:r}){let a={width:r,height:r},s={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",{...s,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",{...s,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",{...s,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",{...s,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",{...s,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",{...s,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",{...s,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=s[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)(n,{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)(a.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[a,s]=(0,r.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!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: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:"→"})]})})]})})}])},46860,e=>{"use strict";var t=e.i(22381),r=e.i(23910),a=e.i(56839),s=e.i(3479),n=e.i(11449),i=e.i(76161),l=e.i(46228);let o={register:"bg-green-500/10 text-green-300 border-green-500/20",login:"bg-blue-500/10 text-blue-300 border-blue-500/20",login_failed:"bg-red-500/10 text-red-300 border-red-500/20",create_network:"bg-purple-500/10 text-purple-300 border-purple-500/20",send_task:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"},c={register:"#4ade80",login:"#60a5fa",login_failed:"#ef4444",create_network:"#a78bfa",send_task:"#22d3ee"};e.s(["default",0,function(){let e,d,{networkId:x}=(0,n.useNetworkId)(),[h,g]=(0,r.useState)([]),[m,u]=(0,r.useState)(!0),[y,p]=(0,r.useState)(""),[j,b]=(0,r.useState)(""),f=(0,r.useCallback)(async()=>{try{let e=new URLSearchParams({limit:"100"});x&&e.set("network_id",x),j&&e.set("action",j);let t=sessionStorage.getItem("anet_v3_auth");if(t)try{let r=JSON.parse(t);r.token&&e.set("token",r.token)}catch{}let r=await fetch(`/api/hub/audit-log?${e.toString()}`);if(401===r.status)return void window.location.assign("/login");let a=await r.json();g(a.logs||[]),p(a.error&&!a.logs?.length?a.error:"")}catch(e){p(e instanceof Error?e.message:"fetch failed")}finally{u(!1)}},[j,x]);return(0,r.useEffect)(()=>{u(!0),f();let e=setInterval(f,1e4);return()=>clearInterval(e)},[f]),(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Audit Log"})}),(0,t.jsx)("div",{className:"mb-6 flex flex-wrap items-center gap-1 anet-tabstrip-wrap overflow-x-auto sm:overflow-x-visible",children:(e={},h.forEach(t=>{e[t.action]=(e[t.action]||0)+1}),[{key:"",label:"All"},{key:"login",label:"login",dot:c.login},{key:"login_failed",label:"login_failed",dot:c.login_failed},{key:"register",label:"register",dot:c.register},{key:"create_network",label:"create_network",dot:c.create_network},{key:"send_task",label:"send_task",dot:c.send_task}].map(r=>{let a=""===r.key?h.length:e[r.key]||0,s=j===r.key;return(0,t.jsxs)("button",{type:"button",onClick:()=>b(r.key),disabled:0===a&&""!==r.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 shrink-0 whitespace-nowrap ${s?"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:[r.dot&&(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:r.dot}}),(0,t.jsx)("span",{children:r.label}),(0,t.jsx)("span",{className:`text-[10px] tabular-nums ${s?"text-cyan-400":"text-gray-600"}`,children:a})]},r.key||"all")}))}),y&&(d=/unauthor|401|forbidden|403|admin/i.test(y),(0,t.jsxs)("div",{className:"anet-warn-chip bg-yellow-900/20 border border-yellow-800/40 text-yellow-300 px-4 py-3 rounded-lg mb-6 text-sm flex items-start gap-3",role:"alert",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-base leading-none",children:"⚠"}),(0,t.jsx)("div",{className:"flex-1",children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"font-medium",children:"需要 admin 权限查看审计日志"}),(0,t.jsx)("div",{className:"text-xs opacity-80 mt-1",children:"审计日志记录用户注册 / 登录 / 网络变更等事件,需要 admin 角色。"}),(0,t.jsx)(a.default,{href:"/login",className:"inline-block mt-2 text-xs font-medium underline underline-offset-4 hover:opacity-80",children:"切到 admin 账号 →"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"font-medium",children:"加载失败"}),(0,t.jsx)("div",{className:"text-xs opacity-80 mt-1",children:"请检查 CommHub 是否在线,或稍后重试。"}),(0,t.jsx)("button",{onClick:()=>window.location.reload(),className:"inline-block mt-2 text-xs font-medium underline underline-offset-4 hover:opacity-80",children:"重新加载 →"})]})})]})),m?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(e=>(0,t.jsx)("div",{className:"h-14 bg-gray-800/20 rounded-lg"},e))}):0===h.length?(0,t.jsx)(i.EmptyState,{variant:"logs"}):(0,t.jsx)("div",{className:"space-y-1 sm:space-y-2",children:h.map(e=>{let r=e.username||e.user_id;return(0,t.jsxs)("div",{className:"relative bg-[#111128] border border-[#2a2a4a] rounded-lg pl-3 pr-3 py-2 sm:pl-4 sm:pr-4 sm:py-3 hover:border-[#3a3a5a] transition-colors overflow-hidden",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute left-0 top-0 bottom-0 w-0.5",style:{backgroundColor:c[e.action]||"transparent"}}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${o[e.action]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:e.action}),r&&(0,t.jsx)(l.AliasAvatar,{alias:r,size:16}),(0,t.jsx)("span",{className:"text-sm text-gray-200 font-medium",children:r}),e.target_type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-xs text-gray-600",children:"→"}),(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:[e.target_type,e.target_id?`:${e.target_id.slice(0,12)}`:""]})]}),(0,t.jsx)("span",{className:"text-xs text-gray-600 ml-auto",children:(0,s.timeAgo)(e.created_at)})]}),e.detail&&(0,t.jsx)("div",{className:"text-xs text-gray-500",children:e.detail}),e.ip&&"unknown"!==e.ip&&(0,t.jsxs)("div",{className:"text-[10px] text-gray-700",children:["IP: ",e.ip]})]},e.id)})})]})}])}]);
@@ -0,0 +1 @@
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,59746,e=>{"use strict";function t(e){if(!e)return null;let t=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(t)?t:null}function a(e){let a=t(e);if(null===a)return null;let s=Math.floor((Date.now()-a)/1e3);return s<0?"just now":s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:s<86400?`${Math.floor(s/3600)}h ago`:`${Math.floor(s/86400)}d ago`}e.s(["parseHubTime",0,t,"relativeAgo",0,a],59746),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){return a(e)??"--"}],3479)},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=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${l}`,style:{width:a,height:a,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});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)(""),[b,m]=(0,a.useState)(""),[p,f]=(0,a.useState)(""),[y,v]=(0,a.useState)(""),[j,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();m(t.ok?`Created: ${t.user.username} (${t.user.user_id})`:`Failed: ${t.error}`),t.ok&&(u(""),h(""))}catch{m("Failed")}setTimeout(()=>m(""),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();v(t.ok?`Sent to ${t.recipients} nodes`:`Failed: ${t.error}`),t.ok&&f("")}catch{v("Failed")}setTimeout(()=>v(""),5e3)}},$=async()=>{if(j&&S.trim()){try{let e=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:j,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-2 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:"inline-flex min-h-[44px] items-center rounded-md border border-[#2a2a4a] bg-[#0a0a15]/60 px-3 py-2 text-gray-400 hover:border-cyan-500/50 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:j,onChange:e=>N(e.target.value),className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-base sm: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:!j||!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"})]}),b&&(0,t.jsx)("div",{className:`mt-2 text-xs ${b.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:b})]})})]})]})]})}])}]);