@sleep2agi/agent-network-dashboard 0.5.7-preview.11 → 0.5.7-preview.13

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 (188) 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 +21 -21
  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.html +1 -1
  14. package/.next/server/app/_not-found.rsc +1 -1
  15. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  16. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/admin.html +2 -2
  23. package/.next/server/app/admin.rsc +2 -2
  24. package/.next/server/app/admin.segments/_full.segment.rsc +2 -2
  25. package/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  26. package/.next/server/app/admin.segments/_index.segment.rsc +1 -1
  27. package/.next/server/app/admin.segments/_tree.segment.rsc +1 -1
  28. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +2 -2
  29. package/.next/server/app/admin.segments/admin.segment.rsc +1 -1
  30. package/.next/server/app/index.html +2 -2
  31. package/.next/server/app/index.rsc +2 -2
  32. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  33. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  34. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  35. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  36. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  37. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/login.html +2 -2
  39. package/.next/server/app/login.rsc +2 -2
  40. package/.next/server/app/login.segments/_full.segment.rsc +2 -2
  41. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  42. package/.next/server/app/login.segments/_index.segment.rsc +1 -1
  43. package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  44. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  45. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  46. package/.next/server/app/logs.html +1 -1
  47. package/.next/server/app/logs.rsc +1 -1
  48. package/.next/server/app/logs.segments/_full.segment.rsc +1 -1
  49. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  50. package/.next/server/app/logs.segments/_index.segment.rsc +1 -1
  51. package/.next/server/app/logs.segments/_tree.segment.rsc +1 -1
  52. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
  53. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  54. package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/messages.html +2 -2
  56. package/.next/server/app/messages.rsc +2 -2
  57. package/.next/server/app/messages.segments/_full.segment.rsc +2 -2
  58. package/.next/server/app/messages.segments/_head.segment.rsc +1 -1
  59. package/.next/server/app/messages.segments/_index.segment.rsc +1 -1
  60. package/.next/server/app/messages.segments/_tree.segment.rsc +1 -1
  61. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +2 -2
  62. package/.next/server/app/messages.segments/messages.segment.rsc +1 -1
  63. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  64. package/.next/server/app/node.html +2 -2
  65. package/.next/server/app/node.rsc +2 -2
  66. package/.next/server/app/node.segments/_full.segment.rsc +2 -2
  67. package/.next/server/app/node.segments/_head.segment.rsc +1 -1
  68. package/.next/server/app/node.segments/_index.segment.rsc +1 -1
  69. package/.next/server/app/node.segments/_tree.segment.rsc +1 -1
  70. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +2 -2
  71. package/.next/server/app/node.segments/node.segment.rsc +1 -1
  72. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  73. package/.next/server/app/nodes.html +2 -2
  74. package/.next/server/app/nodes.rsc +2 -2
  75. package/.next/server/app/nodes.segments/_full.segment.rsc +2 -2
  76. package/.next/server/app/nodes.segments/_head.segment.rsc +1 -1
  77. package/.next/server/app/nodes.segments/_index.segment.rsc +1 -1
  78. package/.next/server/app/nodes.segments/_tree.segment.rsc +1 -1
  79. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +2 -2
  80. package/.next/server/app/nodes.segments/nodes.segment.rsc +1 -1
  81. package/.next/server/app/page_client-reference-manifest.js +1 -1
  82. package/.next/server/app/server-logs.html +1 -1
  83. package/.next/server/app/server-logs.rsc +1 -1
  84. package/.next/server/app/server-logs.segments/_full.segment.rsc +1 -1
  85. package/.next/server/app/server-logs.segments/_head.segment.rsc +1 -1
  86. package/.next/server/app/server-logs.segments/_index.segment.rsc +1 -1
  87. package/.next/server/app/server-logs.segments/_tree.segment.rsc +1 -1
  88. package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +1 -1
  89. package/.next/server/app/server-logs.segments/server-logs.segment.rsc +1 -1
  90. package/.next/server/app/servers.html +1 -1
  91. package/.next/server/app/servers.rsc +1 -1
  92. package/.next/server/app/servers.segments/_full.segment.rsc +1 -1
  93. package/.next/server/app/servers.segments/_head.segment.rsc +1 -1
  94. package/.next/server/app/servers.segments/_index.segment.rsc +1 -1
  95. package/.next/server/app/servers.segments/_tree.segment.rsc +1 -1
  96. package/.next/server/app/servers.segments/servers/__PAGE__.segment.rsc +1 -1
  97. package/.next/server/app/servers.segments/servers.segment.rsc +1 -1
  98. package/.next/server/app/settings/networks/page_client-reference-manifest.js +1 -1
  99. package/.next/server/app/settings/networks.html +2 -2
  100. package/.next/server/app/settings/networks.rsc +2 -2
  101. package/.next/server/app/settings/networks.segments/_full.segment.rsc +2 -2
  102. package/.next/server/app/settings/networks.segments/_head.segment.rsc +1 -1
  103. package/.next/server/app/settings/networks.segments/_index.segment.rsc +1 -1
  104. package/.next/server/app/settings/networks.segments/_tree.segment.rsc +1 -1
  105. package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +2 -2
  106. package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +1 -1
  107. package/.next/server/app/settings/networks.segments/settings.segment.rsc +1 -1
  108. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  109. package/.next/server/app/settings/tokens/page_client-reference-manifest.js +1 -1
  110. package/.next/server/app/settings/tokens.html +2 -2
  111. package/.next/server/app/settings/tokens.rsc +2 -2
  112. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +2 -2
  113. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +1 -1
  114. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +1 -1
  115. package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +1 -1
  116. package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +2 -2
  117. package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +1 -1
  118. package/.next/server/app/settings/tokens.segments/settings.segment.rsc +1 -1
  119. package/.next/server/app/settings.html +2 -2
  120. package/.next/server/app/settings.rsc +2 -2
  121. package/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  122. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  123. package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  124. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  125. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  126. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  127. package/.next/server/app/tasks.html +1 -1
  128. package/.next/server/app/tasks.rsc +1 -1
  129. package/.next/server/app/tasks.segments/_full.segment.rsc +1 -1
  130. package/.next/server/app/tasks.segments/_head.segment.rsc +1 -1
  131. package/.next/server/app/tasks.segments/_index.segment.rsc +1 -1
  132. package/.next/server/app/tasks.segments/_tree.segment.rsc +1 -1
  133. package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +1 -1
  134. package/.next/server/app/tasks.segments/tasks.segment.rsc +1 -1
  135. package/.next/server/chunks/ssr/[root-of-the-server]__030vg4n._.js +1 -1
  136. package/.next/server/chunks/ssr/[root-of-the-server]__030vg4n._.js.map +1 -1
  137. package/.next/server/chunks/ssr/[root-of-the-server]__0fhoq8i._.js +1 -1
  138. package/.next/server/chunks/ssr/[root-of-the-server]__0fhoq8i._.js.map +1 -1
  139. package/.next/server/chunks/ssr/[root-of-the-server]__0nw~zhp._.js +1 -1
  140. package/.next/server/chunks/ssr/[root-of-the-server]__0nw~zhp._.js.map +1 -1
  141. package/.next/server/chunks/ssr/[root-of-the-server]__0sv~g.o._.js +1 -1
  142. package/.next/server/chunks/ssr/[root-of-the-server]__0sv~g.o._.js.map +1 -1
  143. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js +1 -1
  144. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js.map +1 -1
  145. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js +1 -1
  146. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js.map +1 -1
  147. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js +1 -1
  148. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js.map +1 -1
  149. package/.next/server/chunks/ssr/agent-network-dashboard_app_0i3759l._.js +1 -1
  150. package/.next/server/chunks/ssr/agent-network-dashboard_app_0i3759l._.js.map +1 -1
  151. package/.next/server/chunks/ssr/agent-network-dashboard_app_0xgney8._.js +1 -1
  152. package/.next/server/chunks/ssr/agent-network-dashboard_app_0xgney8._.js.map +1 -1
  153. package/.next/server/chunks/ssr/agent-network-dashboard_app_1153xeb._.js +1 -1
  154. package/.next/server/chunks/ssr/agent-network-dashboard_app_1153xeb._.js.map +1 -1
  155. package/.next/server/chunks/ssr/agent-network-dashboard_app_12l4oto._.js +1 -1
  156. package/.next/server/chunks/ssr/agent-network-dashboard_app_12l4oto._.js.map +1 -1
  157. package/.next/server/middleware-build-manifest.js +3 -3
  158. package/.next/server/pages/404.html +1 -1
  159. package/.next/server/pages/500.html +1 -1
  160. package/.next/server/server-reference-manifest.js +1 -1
  161. package/.next/server/server-reference-manifest.json +1 -1
  162. package/.next/static/chunks/{181u38qblp8lz.js → 00b-ysl~m~dr~.js} +1 -1
  163. package/.next/static/chunks/{082m-ou~6nopx.js → 05wpkysi1s2zn.js} +1 -1
  164. package/.next/static/chunks/{0dq~~c79pqq8g.js → 05~pc4d7ucq2m.js} +1 -1
  165. package/.next/static/chunks/{0im751o4n61c7.js → 063dy3uum1lns.js} +1 -1
  166. package/.next/static/chunks/{03~5pxwbxxw-b.js → 0fzfrj9t-fbn_.js} +1 -1
  167. package/.next/static/chunks/{00hpbc4_15cxb.js → 0iwcnbsbx1-v9.js} +1 -1
  168. package/.next/static/chunks/{0cmfkyuf7x3ip.js → 0qvnj6.7m4thb.js} +3 -3
  169. package/.next/static/chunks/{04koh~08gofyy.js → 0tfmi~tv.s~1v.js} +1 -1
  170. package/.next/static/chunks/{05uk96gc~9mni.js → 0ti3v67ixu43p.js} +1 -1
  171. package/.next/static/chunks/{0jp~cs9-zkmqa.js → 0w39f5_vtdn4g.js} +1 -1
  172. package/.next/static/chunks/{14q8_9i5izcwj.js → 15yjjo1fv.muz.js} +1 -1
  173. package/.next/trace +2 -2
  174. package/.next/trace-build +1 -1
  175. package/app/admin/page.tsx +1 -1
  176. package/app/components/DispatchPanel.tsx +1 -1
  177. package/app/components/TaskChatPanel.tsx +9 -2
  178. package/app/components/UserBar.tsx +3 -3
  179. package/app/messages/page.tsx +1 -1
  180. package/app/node/page.tsx +1 -1
  181. package/app/nodes/page.tsx +1 -1
  182. package/app/settings/networks/page.tsx +3 -3
  183. package/app/settings/page.tsx +2 -2
  184. package/app/settings/tokens/page.tsx +1 -1
  185. package/package.json +1 -1
  186. /package/.next/static/{fBBOqrPbHswdz_woUXk6R → 6uvBPCkdDwXnefcWYkQL2}/_buildManifest.js +0 -0
  187. /package/.next/static/{fBBOqrPbHswdz_woUXk6R → 6uvBPCkdDwXnefcWYkQL2}/_clientMiddlewareManifest.js +0 -0
  188. /package/.next/static/{fBBOqrPbHswdz_woUXk6R → 6uvBPCkdDwXnefcWYkQL2}/_ssgManifest.js +0 -0
@@ -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 s=Math.floor((Date.now()-r)/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,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 s(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;let s=r[t%r.length];return{bg:`hsl(${s} 55% 22%)`,ring:`hsl(${s} 60% 45%)`,text:`hsl(${s} 80% 78%)`}}function 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: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=s(e),l=Math.max(9,Math.round(.42*r));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${n}`,style:{width:r,height:r,fontSize:l,backgroundColor:i.bg,borderColor:i.ring,color:i.text},title:e,"aria-hidden":!0,children:a(e)})},"aliasAvatarColors",0,s,"aliasInitial",0,a])},76161,e=>{"use strict";var t=e.i(22381),r=e.i(23910),s=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:r}){let s={width:r,height:r},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",...s,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",...s,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",...s,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",...s,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",...s,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",...s,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",...s,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:r,sub:l,cta:o,compact:c=!1}){let d=a[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)(s.default,{href:o.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:o.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function l({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#2a2a4a] bg-[#111128] shadow-lg shadow-black/20",children:e})}function o({cmd:e}){let[s,a]=(0,r.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":s?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] transition-colors",children:s?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:r=0}){return e?.global_count?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents in this network",sub:`Server has ${e.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):r>0?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${r.toLocaleString()} task${1===r?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,t.jsx)(l,{children:(0,t.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,t.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,t.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,t.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,t.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,t.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,t.jsx)("div",{className:"mt-4 inline-block",children:(0,t.jsx)(o,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},46660,e=>{"use strict";var t=e.i(22381),r=e.i(23910),s=e.i(56839),a=e.i(3479),n=e.i(76161),i=e.i(46228),l=e.i(12629);let o=e=>fetch(e).then(e=>e.json());e.s(["default",0,function(){let{data:e,mutate:c}=(0,l.default)("/api/hub/networks",o,{refreshInterval:1e4}),d=e?.networks||[],x=!e,[h,m]=(0,r.useState)(""),[u,g]=(0,r.useState)(""),[p,y]=(0,r.useState)(""),[j,b]=(0,r.useState)(null),[v,w]=(0,r.useState)(null),[f,k]=(0,r.useState)({}),[N,C]=(0,r.useState)("member"),[_,$]=(0,r.useState)(""),S=()=>{try{let e=sessionStorage.getItem("anet_v3_auth");if(e)return JSON.parse(e).token}catch{}return""},T=async()=>{if(!h.trim())return;let e=S();if(!e)return void y("V3 auth required — sign in via Agent Network login");let t=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create_network",token:e,name:h,description:u})}),r=await t.json();y(r.ok?`Created: ${r.network_id}`:`Failed: ${r.error}`),r.ok&&(m(""),g(""),c()),setTimeout(()=>y(""),5e3)},M=async e=>{let t=S();if(!t)return;let r=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete_network",token:t,network_id:e})}),s=await r.json();y(s.ok?"Deleted":`Failed: ${s.error}`),b(null),s.ok&&c(),setTimeout(()=>y(""),5e3)},A=async e=>{let t=S();if(!t)return;let r=await fetch(`/api/hub/auth?endpoint=/api/networks/${e}/members&token=${t}`),s=await r.json();k(t=>({...t,[e]:s.members||[]}))},B=async e=>{let t=S();if(!t)return;let r=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"invite_member",token:t,network_id:e,role:N})}),s=await r.json();s.ok&&s.invite_code?$(s.invite_code):y(`Invite failed: ${s.error}`)};return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)(s.default,{href:"/settings",className:"text-gray-500 hover:text-gray-300 text-sm lg:ml-0 ml-10",children:"← Settings"}),(0,t.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Networks"})]}),(0,t.jsxs)("div",{className:"max-w-2xl space-y-6",children:[(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Create Network"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("input",{type:"text",value:h,onChange:e=>m(e.target.value),placeholder:"Network name",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:"text",value:u,onChange:e=>g(e.target.value),placeholder:"Description (optional)",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:T,disabled:!h.trim(),className:"px-4 py-2 bg-green-600 hover:bg-green-500 disabled:bg-gray-800 text-white text-sm rounded-lg transition-colors",children:"Create"})]}),p&&(0,t.jsx)("div",{className:`mt-2 text-xs ${p.startsWith("Failed")||p.startsWith("V3")||p.startsWith("Invite")?"text-red-400":"text-green-400"}`,children:p})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"My Networks"}),d.length>0&&(0,t.jsxs)("span",{className:"text-[10px] text-gray-600 uppercase tracking-wide",children:[d.length," total"]})]}),x?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2].map(e=>(0,t.jsx)("div",{className:"h-14 bg-gray-800/20 rounded"},e))}):0===d.length?(0,t.jsx)(n.EmptyState,{variant:"networks",compact:!0,sub:"Create your first network above, or sign in with V3 auth to see existing ones."}):(0,t.jsx)("div",{className:"space-y-3",children:d.map(e=>(0,t.jsxs)("div",{className:"bg-[#0a0a15] rounded-lg px-4 py-3 border border-[#1a1a2a]",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 min-w-0",children:[(0,t.jsx)(i.AliasAvatar,{alias:e.network_name,size:28}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-sm text-white font-medium truncate",children:e.network_name}),(0,t.jsxs)("div",{className:"text-[10px] text-gray-500 font-mono truncate",title:e.network_id,children:[e.network_id," · ",(0,a.timeAgo)(e.created_at)]}),e.description&&(0,t.jsx)("div",{className:"text-xs text-gray-400 mt-1",children:e.description})]})]}),(0,t.jsxs)("div",{className:"flex gap-2 shrink-0",children:[(0,t.jsx)("button",{onClick:()=>{v===e.network_id?w(null):(w(e.network_id),A(e.network_id))},className:"text-xs text-cyan-400 hover:text-cyan-300 px-2 py-1 rounded border border-cyan-800/30 hover:bg-cyan-500/10",children:v===e.network_id?"Hide":"Members"}),j===e.network_id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>M(e.network_id),className:"text-xs text-red-400 px-2 py-1 rounded border border-red-800/30 bg-red-500/10",children:"Confirm"}),(0,t.jsx)("button",{onClick:()=>b(null),className:"text-xs text-gray-500",children:"Cancel"})]}):(0,t.jsx)("button",{onClick:()=>b(e.network_id),className:"text-xs text-red-400 hover:text-red-300 px-2 py-1 rounded border border-red-800/30 hover:bg-red-500/10",children:"Delete"})]})]}),v===e.network_id&&(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#1a1a2a]",children:[(0,t.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:["Members (",(f[e.network_id]||[]).length,")"]}),0===(f[e.network_id]||[]).length?(0,t.jsx)("div",{className:"text-[10px] text-gray-600",children:"No members or V3 auth required"}):(f[e.network_id]||[]).map(e=>{let r=e.username||e.display_name||"?";return(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-between text-xs py-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)(i.AliasAvatar,{alias:r,size:16}),(0,t.jsx)("span",{className:"text-gray-300 truncate",children:r})]}),(0,t.jsx)("span",{className:`px-1.5 py-0.5 rounded border text-[10px] shrink-0 ${"owner"===e.role?"text-yellow-300 border-yellow-500/20":"text-gray-400 border-gray-600/20"}`,children:e.role})]},e.user_id)}),(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#1a1a2a]",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:"Invite"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("select",{value:N,onChange:e=>C(e.target.value),className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white focus:outline-none",children:[(0,t.jsx)("option",{value:"member",children:"member"}),(0,t.jsx)("option",{value:"admin",children:"admin"}),(0,t.jsx)("option",{value:"viewer",children:"viewer"})]}),(0,t.jsx)("button",{onClick:()=>B(e.network_id),className:"px-2 py-1 bg-green-600 hover:bg-green-500 text-white text-xs rounded",children:"Generate Code"})]}),_&&(0,t.jsxs)("div",{className:"mt-2 bg-green-500/5 border border-green-500/20 rounded px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 uppercase tracking-wide",children:"Invite code"}),(0,t.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(_).catch(()=>{})},className:"text-[10px] text-green-300 hover:text-green-200 px-1.5 py-0.5 rounded border border-green-500/20 hover:bg-green-500/10",children:"Copy"})]}),(0,t.jsx)("code",{className:"text-xs text-green-300 select-all break-all",children:_})]})]})]})]},e.network_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 s=Math.floor((Date.now()-r)/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,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 s(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;let s=r[t%r.length];return{bg:`hsl(${s} 55% 22%)`,ring:`hsl(${s} 60% 45%)`,text:`hsl(${s} 80% 78%)`}}function 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: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=s(e),l=Math.max(9,Math.round(.42*r));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${n}`,style:{width:r,height:r,fontSize:l,backgroundColor:i.bg,borderColor:i.ring,color:i.text},title:e,"aria-hidden":!0,children:a(e)})},"aliasAvatarColors",0,s,"aliasInitial",0,a])},76161,e=>{"use strict";var t=e.i(22381),r=e.i(23910),s=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:r}){let s={width:r,height:r},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",...s,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",...s,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",...s,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",...s,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",...s,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",...s,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",...s,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:r,sub:l,cta:o,compact:c=!1}){let d=a[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)(s.default,{href:o.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:o.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function l({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#2a2a4a] bg-[#111128] shadow-lg shadow-black/20",children:e})}function o({cmd:e}){let[s,a]=(0,r.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":s?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] transition-colors",children:s?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:r=0}){return e?.global_count?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents in this network",sub:`Server has ${e.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):r>0?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${r.toLocaleString()} task${1===r?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,t.jsx)(l,{children:(0,t.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,t.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,t.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,t.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,t.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,t.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,t.jsx)("div",{className:"mt-4 inline-block",children:(0,t.jsx)(o,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},46660,e=>{"use strict";var t=e.i(22381),r=e.i(23910),s=e.i(56839),a=e.i(3479),n=e.i(76161),i=e.i(46228),l=e.i(12629);let o=e=>fetch(e).then(e=>e.json());e.s(["default",0,function(){let{data:e,mutate:c}=(0,l.default)("/api/hub/networks",o,{refreshInterval:1e4}),d=e?.networks||[],x=!e,[h,m]=(0,r.useState)(""),[u,g]=(0,r.useState)(""),[p,y]=(0,r.useState)(""),[j,b]=(0,r.useState)(null),[v,w]=(0,r.useState)(null),[f,k]=(0,r.useState)({}),[N,C]=(0,r.useState)("member"),[_,$]=(0,r.useState)(""),S=()=>{try{let e=sessionStorage.getItem("anet_v3_auth");if(e)return JSON.parse(e).token}catch{}return""},T=async()=>{if(!h.trim())return;let e=S();if(!e)return void y("V3 auth required — sign in via Agent Network login");let t=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create_network",token:e,name:h,description:u})}),r=await t.json();y(r.ok?`Created: ${r.network_id}`:`Failed: ${r.error}`),r.ok&&(m(""),g(""),c()),setTimeout(()=>y(""),5e3)},M=async e=>{let t=S();if(!t)return;let r=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete_network",token:t,network_id:e})}),s=await r.json();y(s.ok?"Deleted":`Failed: ${s.error}`),b(null),s.ok&&c(),setTimeout(()=>y(""),5e3)},A=async e=>{let t=S();if(!t)return;let r=await fetch(`/api/hub/auth?endpoint=/api/networks/${e}/members&token=${t}`),s=await r.json();k(t=>({...t,[e]:s.members||[]}))},B=async e=>{let t=S();if(!t)return;let r=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"invite_member",token:t,network_id:e,role:N})}),s=await r.json();s.ok&&s.invite_code?$(s.invite_code):y(`Invite failed: ${s.error}`)};return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)(s.default,{href:"/settings",className:"text-gray-500 hover:text-gray-300 text-sm lg:ml-0 ml-10",children:"← Settings"}),(0,t.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Networks"})]}),(0,t.jsxs)("div",{className:"max-w-2xl space-y-6",children:[(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Create Network"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("input",{type:"text",value:h,onChange:e=>m(e.target.value),placeholder:"Network name",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,t.jsx)("input",{type:"text",value:u,onChange:e=>g(e.target.value),placeholder:"Description (optional)",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,t.jsx)("button",{onClick:T,disabled:!h.trim(),className:"px-4 py-2 bg-green-600 hover:bg-green-500 disabled:bg-gray-800 text-white text-sm rounded-lg transition-colors",children:"Create"})]}),p&&(0,t.jsx)("div",{className:`mt-2 text-xs ${p.startsWith("Failed")||p.startsWith("V3")||p.startsWith("Invite")?"text-red-400":"text-green-400"}`,children:p})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"My Networks"}),d.length>0&&(0,t.jsxs)("span",{className:"text-[10px] text-gray-600 uppercase tracking-wide",children:[d.length," total"]})]}),x?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2].map(e=>(0,t.jsx)("div",{className:"h-14 bg-gray-800/20 rounded"},e))}):0===d.length?(0,t.jsx)(n.EmptyState,{variant:"networks",compact:!0,sub:"Create your first network above, or sign in with V3 auth to see existing ones."}):(0,t.jsx)("div",{className:"space-y-3",children:d.map(e=>(0,t.jsxs)("div",{className:"bg-[#0a0a15] rounded-lg px-4 py-3 border border-[#1a1a2a]",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 min-w-0",children:[(0,t.jsx)(i.AliasAvatar,{alias:e.network_name,size:28}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-sm text-white font-medium truncate",children:e.network_name}),(0,t.jsxs)("div",{className:"text-[10px] text-gray-500 font-mono truncate",title:e.network_id,children:[e.network_id," · ",(0,a.timeAgo)(e.created_at)]}),e.description&&(0,t.jsx)("div",{className:"text-xs text-gray-400 mt-1",children:e.description})]})]}),(0,t.jsxs)("div",{className:"flex gap-2 shrink-0",children:[(0,t.jsx)("button",{onClick:()=>{v===e.network_id?w(null):(w(e.network_id),A(e.network_id))},className:"text-xs text-cyan-400 hover:text-cyan-300 px-2 py-1 rounded border border-cyan-800/30 hover:bg-cyan-500/10",children:v===e.network_id?"Hide":"Members"}),j===e.network_id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>M(e.network_id),className:"text-xs text-red-400 px-2 py-1 rounded border border-red-800/30 bg-red-500/10",children:"Confirm"}),(0,t.jsx)("button",{onClick:()=>b(null),className:"text-xs text-gray-500",children:"Cancel"})]}):(0,t.jsx)("button",{onClick:()=>b(e.network_id),className:"text-xs text-red-400 hover:text-red-300 px-2 py-1 rounded border border-red-800/30 hover:bg-red-500/10",children:"Delete"})]})]}),v===e.network_id&&(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#1a1a2a]",children:[(0,t.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:["Members (",(f[e.network_id]||[]).length,")"]}),0===(f[e.network_id]||[]).length?(0,t.jsx)("div",{className:"text-[10px] text-gray-600",children:"No members or V3 auth required"}):(f[e.network_id]||[]).map(e=>{let r=e.username||e.display_name||"?";return(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-between text-xs py-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)(i.AliasAvatar,{alias:r,size:16}),(0,t.jsx)("span",{className:"text-gray-300 truncate",children:r})]}),(0,t.jsx)("span",{className:`px-1.5 py-0.5 rounded border text-[10px] shrink-0 ${"owner"===e.role?"text-yellow-300 border-yellow-500/20":"text-gray-400 border-gray-600/20"}`,children:e.role})]},e.user_id)}),(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#1a1a2a]",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:"Invite"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("select",{value:N,onChange:e=>C(e.target.value),className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-base sm:text-xs text-white focus:outline-none",children:[(0,t.jsx)("option",{value:"member",children:"member"}),(0,t.jsx)("option",{value:"admin",children:"admin"}),(0,t.jsx)("option",{value:"viewer",children:"viewer"})]}),(0,t.jsx)("button",{onClick:()=>B(e.network_id),className:"px-2 py-1 bg-green-600 hover:bg-green-500 text-white text-xs rounded",children:"Generate Code"})]}),_&&(0,t.jsxs)("div",{className:"mt-2 bg-green-500/5 border border-green-500/20 rounded px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 uppercase tracking-wide",children:"Invite code"}),(0,t.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(_).catch(()=>{})},className:"text-[10px] text-green-300 hover:text-green-200 px-1.5 py-0.5 rounded border border-green-500/20 hover:bg-green-500/10",children:"Copy"})]}),(0,t.jsx)("code",{className:"text-xs text-green-300 select-all break-all",children:_})]})]})]})]},e.network_id))})]})]})]})}])}]);
@@ -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-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-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)})]})}])}]);
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)})]})}])}]);
@@ -1 +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.11"],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-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-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
+ (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.13"],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 a(e){if(!e)return null;let a=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(a)?a:null}function t(e){let t=a(e);if(null===t)return null;let r=Math.floor((Date.now()-t)/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,a,"relativeAgo",0,t],59746),e.s(["formatUptime",0,function(e){let a=Math.floor(e/3600),t=Math.floor(e%3600/60);return a>0?`${a}h ${t}m`:`${t}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 t(e)??"--"}],3479)},46228,e=>{"use strict";var a=e.i(22381);let t=[180,200,220,270,300,330,30,90];function r(e){let a=0;for(let t=0;t<e.length;t++)a=31*a+e.charCodeAt(t)>>>0;let r=t[a%t.length];return{bg:`hsl(${r} 55% 22%)`,ring:`hsl(${r} 60% 45%)`,text:`hsl(${r} 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:t=28,className:l=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,a.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:t,height:t,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let n=r(e),i=Math.max(9,Math.round(.42*t));return(0,a.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${l}`,style:{width:t,height:t,fontSize:i,backgroundColor:n.bg,borderColor:n.ring,color:n.text},title:e,"aria-hidden":!0,children:s(e)})},"aliasAvatarColors",0,r,"aliasInitial",0,s])},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"]])},51868,e=>{"use strict";var a=e.i(22381),t=e.i(23910),r=e.i(56058),s=e.i(56839),l=e.i(43058),n=e.i(3479),i=e.i(46228),d=e.i(98025),o=e.i(38263);function c({tmuxName:e}){let[r,s]=(0,t.useState)(""),[l,n]=(0,t.useState)(!1),[i,d]=(0,t.useState)(!1),o=async()=>{n(!0);try{let a=await fetch(`/api/hub/tmux?name=${encodeURIComponent(e)}`),t=await a.json();s(t.output||t.error||"No output")}catch{s("Failed to fetch")}n(!1)};return(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("h2",{className:"text-sm font-semibold text-gray-300",children:["Terminal (",e,")"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:o,disabled:l,className:"text-xs text-cyan-400 hover:text-cyan-300 disabled:text-gray-600",children:l?"Loading...":"Capture"}),r&&(0,a.jsx)("button",{onClick:()=>d(!i),className:"text-xs text-gray-500 hover:text-gray-300",children:i?"Collapse":"Expand"})]})]}),r&&(0,a.jsx)("pre",{className:`text-[11px] text-green-300 bg-[#050510] rounded-lg px-3 py-2 border border-[#1a1a2a] overflow-x-auto whitespace-pre font-mono ${i?"max-h-96":"max-h-32"} overflow-y-auto`,children:r}),!r&&(0,a.jsx)("p",{className:"text-xs text-gray-600",children:"Click Capture to view terminal output"})]})}function x(){let e=(0,r.useSearchParams)().get("alias")||"",[l,n]=(0,t.useState)(null),[o,c]=(0,t.useState)([]),[x,h]=(0,t.useState)(0),[b,g]=(0,t.useState)(""),[m,p]=(0,t.useState)(""),[f,y]=(0,t.useState)(!1),v=(0,t.useCallback)(async()=>{if(e)try{let a=await fetch(`/api/hub/session?alias=${encodeURIComponent(e)}`),t=await a.json();t.session&&n(t.session),t.inbox&&c(t.inbox),h(t.sse||0),g("")}catch(e){g(e instanceof Error?e.message:"fetch failed")}},[e]);(0,t.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let[j,S]=(0,t.useState)(""),w=async()=>{if(m.trim()&&e){y(!0),S("");try{let a=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:m})}),t=await a.json();t.ok?(p(""),setTimeout(v,2e3)):S(t.error||"Send failed")}catch(e){S(e instanceof Error?e.message:"Send failed")}y(!1)}};if(!e)return(0,a.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono flex items-center justify-center",children:(0,a.jsxs)("p",{className:"text-gray-500",children:["No alias specified. ",(0,a.jsx)(s.default,{href:"/",className:"text-blue-400 hover:underline",children:"Back to dashboard"})]})});let N=d.SESSION_STATUS_TEXT_CLASS[l?.status||""]||d.SESSION_STATUS_TEXT_CLASS.offline;return(0,a.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6 lg:ml-0 ml-10",children:[(0,a.jsx)(s.default,{href:"/nodes",className:"text-gray-500 hover:text-gray-300 text-sm shrink-0",children:"← Nodes"}),(0,a.jsx)(i.AliasAvatar,{alias:e,size:32}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h1",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:e}),(0,a.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${x>0?l?.status==="working"?"bg-green-500 animate-pulse":"bg-emerald-400":"bg-gray-500"}`}),(0,a.jsx)("span",{className:`text-[10px] uppercase tracking-wide font-semibold ${N}`,children:l?.status||"unknown"})]}),l?.agent&&(0,a.jsxs)("div",{className:"text-xs text-gray-500 truncate",children:[l.agent,l.server?(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsx)("span",{className:"text-gray-700 mx-1",children:"·"})," ",l.server]}):null]})]})]}),b&&(0,a.jsx)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-2 rounded-lg mb-6 text-sm",children:b}),(0,a.jsx)(u,{alias:e,session:l,sse:x,sendMsg:m,setSendMsg:p,sending:f,sendTask:w,sendError:j})]})}function u({alias:e,session:r,sse:s,sendMsg:n,setSendMsg:i,sending:d,sendTask:x,sendError:h}){let[g,m]=(0,t.useState)("chat"),{hasUnread:p}=(0,o.useChatUnread)(),[f,y]=(0,t.useState)([]),[v,j]=(0,t.useState)(!1),S=p(e);return(0,t.useEffect)(()=>{"events"!==g||v||fetch("/api/hub/task-events?limit=50").then(e=>e.json()).then(e=>{y(e.events||[]),j(!0)}).catch(()=>j(!0))},[g,v]),(0,a.jsxs)("div",{className:"bg-[#0d0d1a] border border-[#2a2a4a] rounded-xl overflow-hidden h-[calc(100vh-140px)] flex flex-col",children:[(0,a.jsx)("div",{className:"flex border-b border-[#2a2a4a] bg-[#0a0a15] shrink-0",children:[{id:"chat",label:"Chat",icon:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},{id:"events",label:"Events",icon:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8"},{id:"info",label:"Info",icon:"M12 21a9 9 0 100-18 9 9 0 000 18z M12 8h.01 M11 12h1v4h1"}].map(e=>(0,a.jsxs)("button",{onClick:()=>m(e.id),className:`flex items-center gap-2 px-5 py-3 text-sm font-medium border-b-2 transition-colors ${g===e.id?"border-cyan-400 text-cyan-300":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,a.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:e.icon})}),(0,a.jsxs)("span",{className:"relative inline-flex items-center gap-2",children:[e.label,"chat"===e.id&&S&&"chat"!==g&&(0,a.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-red-500","aria-label":"Unread chat messages"})]})]},e.id))}),(0,a.jsxs)("div",{className:"flex-1 overflow-hidden",children:["chat"===g&&(0,a.jsx)(l.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0}),"events"===g&&(0,a.jsx)(b,{events:f,loading:!v}),"info"===g&&(0,a.jsxs)("div",{className:"p-4 overflow-y-auto h-full space-y-4 max-w-2xl",children:[(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Node Info"}),(0,a.jsx)("div",{className:"space-y-2 text-xs",children:[{label:"Node ID",value:r?.node_id,alwaysShow:!0},{label:"Session ID",value:r?.session_id,alwaysShow:!0},{label:"Resume ID",value:r?.resume_id,alwaysShow:!0},{label:"Alias",value:r?.alias,alwaysShow:!0},{label:"Agent",value:r?.agent,alwaysShow:!0},{label:"Model",value:r?.model,alwaysShow:!0},{label:"Version",value:r?.version},{label:"Server",value:r?.server,alwaysShow:!0},{label:"Hostname",value:r?.hostname,alwaysShow:!0},{label:"IP",value:r?.ip,alwaysShow:!0},{label:"Project",value:r?.project_dir},{label:"Config",value:r?.config_path,alwaysShow:!0},{label:"Channels",value:r?.channels?.length?Array.isArray(r.channels)?r.channels.join(", "):r.channels:null,alwaysShow:!0},{label:"Tmux",value:r?.tmux_name},{label:"SSE",value:s>0?`Connected (${s})`:"Disconnected",alwaysShow:!0},{label:"Progress",value:r?.progress?`${r.progress}%`:null},{label:"Score",value:r?.score},{label:"Last Seen",value:r?.last_seen_at,alwaysShow:!0},{label:"Registered",value:r?.registered_at,alwaysShow:!0},{label:"Updated",value:r?.updated_at,alwaysShow:!0}].map(({label:e,value:t,alwaysShow:r})=>t||r?(0,a.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,a.jsx)("span",{className:"text-gray-500 shrink-0",children:e}),(0,a.jsx)("span",{className:"text-gray-300 truncate max-w-[200px]",title:t?String(t):"--",children:t?String(t):"--"})]},e):null)})]}),r?.task&&(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Current Task"}),(0,a.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap",children:r.task})]}),r?.output&&(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Last Output"}),(0,a.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap max-h-48 overflow-y-auto",children:r.output})]}),(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Send Task"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:n,onChange:e=>i(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:`Send task to ${e}...`,className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-blue-500 focus:outline-none"}),(0,a.jsx)("button",{onClick:x,disabled:d||!n.trim(),className:"px-3 py-2 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-700 text-white text-xs rounded transition-colors",children:d?"...":"Send"})]}),h&&(0,a.jsx)("div",{className:"mt-2 text-xs text-red-400",children:h})]}),r?.tmux_name&&(0,a.jsx)(c,{tmuxName:r.tmux_name})]})]})]})}let h={delivered:{dot:"bg-blue-400",line:"bg-blue-500/30",path:"M12 5v14 M5 12l7 7 7-7"},acked:{dot:"bg-yellow-400",line:"bg-yellow-500/30",path:"M20 6 9 17l-5-5"},running:{dot:"bg-green-400",line:"bg-green-500/30",path:"M13 2L4 14h6l-1 8 10-12h-6l1-8z"},replied:{dot:"bg-purple-400",line:"bg-purple-500/30",path:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},failed:{dot:"bg-red-400",line:"bg-red-500/30",path:"M18 6 6 18 M6 6l12 12"},created:{dot:"bg-gray-400",line:"bg-gray-500/30",path:"M12 5v14 M5 12h14"}};function b({events:e,loading:t}){if(t)return(0,a.jsx)("div",{className:"flex justify-center py-8",children:(0,a.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})});if(0===e.length)return(0,a.jsx)("div",{className:"text-center py-12 text-gray-600 text-xs",children:"No task events yet"});let r=new Map;return e.forEach(e=>{let a=e.task_id||`ungrouped-${e.id}`,t=r.get(a)||[];t.push(e),r.set(a,t)}),(0,a.jsx)("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[...r.entries()].map(([e,t])=>(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsxs)("div",{className:"text-[10px] text-gray-600 mb-3 truncate",children:["Task: ",e.slice(0,20),"..."]}),(0,a.jsxs)("div",{className:"relative pl-6",children:[(0,a.jsx)("div",{className:"absolute left-[9px] top-2 bottom-2 w-0.5 bg-[#1a1a2a]"}),t.map((e,t)=>{let r=h[e.to_status]||h.created;return(0,a.jsxs)("div",{className:"relative pb-4 last:pb-0",children:[(0,a.jsx)("div",{className:`absolute -left-6 top-0.5 w-[18px] h-[18px] rounded-full ${r.dot} flex items-center justify-center z-10 border-2 border-[#111128]`,children:(0,a.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#0a0a15",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:r.path})})}),(0,a.jsxs)("div",{className:"ml-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-medium ${"failed"===e.to_status?"text-red-400":"replied"===e.to_status?"text-purple-400":"text-gray-300"}`,children:e.event_type}),e.from_status&&(0,a.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.from_status," → ",e.to_status]}),(0,a.jsx)("span",{className:"text-[10px] text-gray-600 ml-auto",children:(0,n.timeAgo)(e.created_at)})]}),e.detail&&(0,a.jsxs)("div",{className:"text-[11px] text-gray-500 mt-0.5 truncate",children:[e.detail.slice(0,50),e.detail.length>50?"...":""]})]})]},e.id)})]})]},e))})}e.s(["default",0,function(){return(0,a.jsx)(t.Suspense,{fallback:(0,a.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono",children:"Loading..."}),children:(0,a.jsx)(x,{})})}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3479,59746,e=>{"use strict";function a(e){if(!e)return null;let a=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(a)?a:null}function t(e){let t=a(e);if(null===t)return null;let r=Math.floor((Date.now()-t)/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,a,"relativeAgo",0,t],59746),e.s(["formatUptime",0,function(e){let a=Math.floor(e/3600),t=Math.floor(e%3600/60);return a>0?`${a}h ${t}m`:`${t}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 t(e)??"--"}],3479)},46228,e=>{"use strict";var a=e.i(22381);let t=[180,200,220,270,300,330,30,90];function r(e){let a=0;for(let t=0;t<e.length;t++)a=31*a+e.charCodeAt(t)>>>0;let r=t[a%t.length];return{bg:`hsl(${r} 55% 22%)`,ring:`hsl(${r} 60% 45%)`,text:`hsl(${r} 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:t=28,className:l=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,a.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:t,height:t,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let n=r(e),i=Math.max(9,Math.round(.42*t));return(0,a.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${l}`,style:{width:t,height:t,fontSize:i,backgroundColor:n.bg,borderColor:n.ring,color:n.text},title:e,"aria-hidden":!0,children:s(e)})},"aliasAvatarColors",0,r,"aliasInitial",0,s])},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"]])},51868,e=>{"use strict";var a=e.i(22381),t=e.i(23910),r=e.i(56058),s=e.i(56839),l=e.i(43058),n=e.i(3479),i=e.i(46228),d=e.i(98025),o=e.i(38263);function c({tmuxName:e}){let[r,s]=(0,t.useState)(""),[l,n]=(0,t.useState)(!1),[i,d]=(0,t.useState)(!1),o=async()=>{n(!0);try{let a=await fetch(`/api/hub/tmux?name=${encodeURIComponent(e)}`),t=await a.json();s(t.output||t.error||"No output")}catch{s("Failed to fetch")}n(!1)};return(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("h2",{className:"text-sm font-semibold text-gray-300",children:["Terminal (",e,")"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:o,disabled:l,className:"text-xs text-cyan-400 hover:text-cyan-300 disabled:text-gray-600",children:l?"Loading...":"Capture"}),r&&(0,a.jsx)("button",{onClick:()=>d(!i),className:"text-xs text-gray-500 hover:text-gray-300",children:i?"Collapse":"Expand"})]})]}),r&&(0,a.jsx)("pre",{className:`text-[11px] text-green-300 bg-[#050510] rounded-lg px-3 py-2 border border-[#1a1a2a] overflow-x-auto whitespace-pre font-mono ${i?"max-h-96":"max-h-32"} overflow-y-auto`,children:r}),!r&&(0,a.jsx)("p",{className:"text-xs text-gray-600",children:"Click Capture to view terminal output"})]})}function x(){let e=(0,r.useSearchParams)().get("alias")||"",[l,n]=(0,t.useState)(null),[o,c]=(0,t.useState)([]),[x,h]=(0,t.useState)(0),[b,g]=(0,t.useState)(""),[m,p]=(0,t.useState)(""),[f,y]=(0,t.useState)(!1),v=(0,t.useCallback)(async()=>{if(e)try{let a=await fetch(`/api/hub/session?alias=${encodeURIComponent(e)}`),t=await a.json();t.session&&n(t.session),t.inbox&&c(t.inbox),h(t.sse||0),g("")}catch(e){g(e instanceof Error?e.message:"fetch failed")}},[e]);(0,t.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let[j,S]=(0,t.useState)(""),w=async()=>{if(m.trim()&&e){y(!0),S("");try{let a=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:m})}),t=await a.json();t.ok?(p(""),setTimeout(v,2e3)):S(t.error||"Send failed")}catch(e){S(e instanceof Error?e.message:"Send failed")}y(!1)}};if(!e)return(0,a.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono flex items-center justify-center",children:(0,a.jsxs)("p",{className:"text-gray-500",children:["No alias specified. ",(0,a.jsx)(s.default,{href:"/",className:"text-blue-400 hover:underline",children:"Back to dashboard"})]})});let N=d.SESSION_STATUS_TEXT_CLASS[l?.status||""]||d.SESSION_STATUS_TEXT_CLASS.offline;return(0,a.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6 lg:ml-0 ml-10",children:[(0,a.jsx)(s.default,{href:"/nodes",className:"text-gray-500 hover:text-gray-300 text-sm shrink-0",children:"← Nodes"}),(0,a.jsx)(i.AliasAvatar,{alias:e,size:32}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h1",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:e}),(0,a.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${x>0?l?.status==="working"?"bg-green-500 animate-pulse":"bg-emerald-400":"bg-gray-500"}`}),(0,a.jsx)("span",{className:`text-[10px] uppercase tracking-wide font-semibold ${N}`,children:l?.status||"unknown"})]}),l?.agent&&(0,a.jsxs)("div",{className:"text-xs text-gray-500 truncate",children:[l.agent,l.server?(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsx)("span",{className:"text-gray-700 mx-1",children:"·"})," ",l.server]}):null]})]})]}),b&&(0,a.jsx)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-2 rounded-lg mb-6 text-sm",children:b}),(0,a.jsx)(u,{alias:e,session:l,sse:x,sendMsg:m,setSendMsg:p,sending:f,sendTask:w,sendError:j})]})}function u({alias:e,session:r,sse:s,sendMsg:n,setSendMsg:i,sending:d,sendTask:x,sendError:h}){let[g,m]=(0,t.useState)("chat"),{hasUnread:p}=(0,o.useChatUnread)(),[f,y]=(0,t.useState)([]),[v,j]=(0,t.useState)(!1),S=p(e);return(0,t.useEffect)(()=>{"events"!==g||v||fetch("/api/hub/task-events?limit=50").then(e=>e.json()).then(e=>{y(e.events||[]),j(!0)}).catch(()=>j(!0))},[g,v]),(0,a.jsxs)("div",{className:"bg-[#0d0d1a] border border-[#2a2a4a] rounded-xl overflow-hidden h-[calc(100vh-140px)] flex flex-col",children:[(0,a.jsx)("div",{className:"flex border-b border-[#2a2a4a] bg-[#0a0a15] shrink-0",children:[{id:"chat",label:"Chat",icon:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},{id:"events",label:"Events",icon:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8"},{id:"info",label:"Info",icon:"M12 21a9 9 0 100-18 9 9 0 000 18z M12 8h.01 M11 12h1v4h1"}].map(e=>(0,a.jsxs)("button",{onClick:()=>m(e.id),className:`flex items-center gap-2 px-5 py-3 text-sm font-medium border-b-2 transition-colors ${g===e.id?"border-cyan-400 text-cyan-300":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,a.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:e.icon})}),(0,a.jsxs)("span",{className:"relative inline-flex items-center gap-2",children:[e.label,"chat"===e.id&&S&&"chat"!==g&&(0,a.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-red-500","aria-label":"Unread chat messages"})]})]},e.id))}),(0,a.jsxs)("div",{className:"flex-1 overflow-hidden",children:["chat"===g&&(0,a.jsx)(l.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0}),"events"===g&&(0,a.jsx)(b,{events:f,loading:!v}),"info"===g&&(0,a.jsxs)("div",{className:"p-4 overflow-y-auto h-full space-y-4 max-w-2xl",children:[(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Node Info"}),(0,a.jsx)("div",{className:"space-y-2 text-xs",children:[{label:"Node ID",value:r?.node_id,alwaysShow:!0},{label:"Session ID",value:r?.session_id,alwaysShow:!0},{label:"Resume ID",value:r?.resume_id,alwaysShow:!0},{label:"Alias",value:r?.alias,alwaysShow:!0},{label:"Agent",value:r?.agent,alwaysShow:!0},{label:"Model",value:r?.model,alwaysShow:!0},{label:"Version",value:r?.version},{label:"Server",value:r?.server,alwaysShow:!0},{label:"Hostname",value:r?.hostname,alwaysShow:!0},{label:"IP",value:r?.ip,alwaysShow:!0},{label:"Project",value:r?.project_dir},{label:"Config",value:r?.config_path,alwaysShow:!0},{label:"Channels",value:r?.channels?.length?Array.isArray(r.channels)?r.channels.join(", "):r.channels:null,alwaysShow:!0},{label:"Tmux",value:r?.tmux_name},{label:"SSE",value:s>0?`Connected (${s})`:"Disconnected",alwaysShow:!0},{label:"Progress",value:r?.progress?`${r.progress}%`:null},{label:"Score",value:r?.score},{label:"Last Seen",value:r?.last_seen_at,alwaysShow:!0},{label:"Registered",value:r?.registered_at,alwaysShow:!0},{label:"Updated",value:r?.updated_at,alwaysShow:!0}].map(({label:e,value:t,alwaysShow:r})=>t||r?(0,a.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,a.jsx)("span",{className:"text-gray-500 shrink-0",children:e}),(0,a.jsx)("span",{className:"text-gray-300 truncate max-w-[200px]",title:t?String(t):"--",children:t?String(t):"--"})]},e):null)})]}),r?.task&&(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Current Task"}),(0,a.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap",children:r.task})]}),r?.output&&(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Last Output"}),(0,a.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap max-h-48 overflow-y-auto",children:r.output})]}),(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Send Task"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:n,onChange:e=>i(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:`Send task to ${e}...`,className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-base sm:text-xs text-white placeholder-gray-600 focus:border-blue-500 focus:outline-none"}),(0,a.jsx)("button",{onClick:x,disabled:d||!n.trim(),className:"px-3 py-2 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-700 text-white text-xs rounded transition-colors",children:d?"...":"Send"})]}),h&&(0,a.jsx)("div",{className:"mt-2 text-xs text-red-400",children:h})]}),r?.tmux_name&&(0,a.jsx)(c,{tmuxName:r.tmux_name})]})]})]})}let h={delivered:{dot:"bg-blue-400",line:"bg-blue-500/30",path:"M12 5v14 M5 12l7 7 7-7"},acked:{dot:"bg-yellow-400",line:"bg-yellow-500/30",path:"M20 6 9 17l-5-5"},running:{dot:"bg-green-400",line:"bg-green-500/30",path:"M13 2L4 14h6l-1 8 10-12h-6l1-8z"},replied:{dot:"bg-purple-400",line:"bg-purple-500/30",path:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},failed:{dot:"bg-red-400",line:"bg-red-500/30",path:"M18 6 6 18 M6 6l12 12"},created:{dot:"bg-gray-400",line:"bg-gray-500/30",path:"M12 5v14 M5 12h14"}};function b({events:e,loading:t}){if(t)return(0,a.jsx)("div",{className:"flex justify-center py-8",children:(0,a.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})});if(0===e.length)return(0,a.jsx)("div",{className:"text-center py-12 text-gray-600 text-xs",children:"No task events yet"});let r=new Map;return e.forEach(e=>{let a=e.task_id||`ungrouped-${e.id}`,t=r.get(a)||[];t.push(e),r.set(a,t)}),(0,a.jsx)("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[...r.entries()].map(([e,t])=>(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsxs)("div",{className:"text-[10px] text-gray-600 mb-3 truncate",children:["Task: ",e.slice(0,20),"..."]}),(0,a.jsxs)("div",{className:"relative pl-6",children:[(0,a.jsx)("div",{className:"absolute left-[9px] top-2 bottom-2 w-0.5 bg-[#1a1a2a]"}),t.map((e,t)=>{let r=h[e.to_status]||h.created;return(0,a.jsxs)("div",{className:"relative pb-4 last:pb-0",children:[(0,a.jsx)("div",{className:`absolute -left-6 top-0.5 w-[18px] h-[18px] rounded-full ${r.dot} flex items-center justify-center z-10 border-2 border-[#111128]`,children:(0,a.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#0a0a15",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:r.path})})}),(0,a.jsxs)("div",{className:"ml-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-medium ${"failed"===e.to_status?"text-red-400":"replied"===e.to_status?"text-purple-400":"text-gray-300"}`,children:e.event_type}),e.from_status&&(0,a.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.from_status," → ",e.to_status]}),(0,a.jsx)("span",{className:"text-[10px] text-gray-600 ml-auto",children:(0,n.timeAgo)(e.created_at)})]}),e.detail&&(0,a.jsxs)("div",{className:"text-[11px] text-gray-500 mt-0.5 truncate",children:[e.detail.slice(0,50),e.detail.length>50?"...":""]})]})]},e.id)})]})]},e))})}e.s(["default",0,function(){return(0,a.jsx)(t.Suspense,{fallback:(0,a.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono",children:"Loading..."}),children:(0,a.jsx)(x,{})})}])}]);
@@ -1 +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-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})]})})]})]})]})}])}]);
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})]})})]})]})]})}])}]);