@sleep2agi/agent-network-dashboard 0.6.3-preview.21 → 0.6.3-preview.22

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 (225) 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 +26 -26
  4. package/.next/fallback-build-manifest.json +3 -3
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +2 -2
  15. package/.next/server/app/_not-found.rsc +2 -2
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/admin.html +2 -2
  24. package/.next/server/app/admin.rsc +3 -3
  25. package/.next/server/app/admin.segments/_full.segment.rsc +3 -3
  26. package/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  27. package/.next/server/app/admin.segments/_index.segment.rsc +2 -2
  28. package/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
  29. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +2 -2
  30. package/.next/server/app/admin.segments/admin.segment.rsc +1 -1
  31. package/.next/server/app/index.html +2 -2
  32. package/.next/server/app/index.rsc +3 -3
  33. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  34. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  35. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  36. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  37. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  38. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app/login.html +2 -2
  40. package/.next/server/app/login.rsc +3 -3
  41. package/.next/server/app/login.segments/_full.segment.rsc +3 -3
  42. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  43. package/.next/server/app/login.segments/_index.segment.rsc +2 -2
  44. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  45. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  46. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  47. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/logs.html +2 -2
  49. package/.next/server/app/logs.rsc +3 -3
  50. package/.next/server/app/logs.segments/_full.segment.rsc +3 -3
  51. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  52. package/.next/server/app/logs.segments/_index.segment.rsc +2 -2
  53. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  54. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +2 -2
  55. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  56. package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/messages.html +2 -2
  58. package/.next/server/app/messages.rsc +3 -3
  59. package/.next/server/app/messages.segments/_full.segment.rsc +3 -3
  60. package/.next/server/app/messages.segments/_head.segment.rsc +1 -1
  61. package/.next/server/app/messages.segments/_index.segment.rsc +2 -2
  62. package/.next/server/app/messages.segments/_tree.segment.rsc +2 -2
  63. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +2 -2
  64. package/.next/server/app/messages.segments/messages.segment.rsc +1 -1
  65. package/.next/server/app/node/page.js.nft.json +1 -1
  66. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  67. package/.next/server/app/node.html +2 -2
  68. package/.next/server/app/node.rsc +3 -3
  69. package/.next/server/app/node.segments/_full.segment.rsc +3 -3
  70. package/.next/server/app/node.segments/_head.segment.rsc +1 -1
  71. package/.next/server/app/node.segments/_index.segment.rsc +2 -2
  72. package/.next/server/app/node.segments/_tree.segment.rsc +2 -2
  73. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +2 -2
  74. package/.next/server/app/node.segments/node.segment.rsc +1 -1
  75. package/.next/server/app/nodes/page.js.nft.json +1 -1
  76. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/nodes.html +2 -2
  78. package/.next/server/app/nodes.rsc +3 -3
  79. package/.next/server/app/nodes.segments/_full.segment.rsc +3 -3
  80. package/.next/server/app/nodes.segments/_head.segment.rsc +1 -1
  81. package/.next/server/app/nodes.segments/_index.segment.rsc +2 -2
  82. package/.next/server/app/nodes.segments/_tree.segment.rsc +2 -2
  83. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +2 -2
  84. package/.next/server/app/nodes.segments/nodes.segment.rsc +1 -1
  85. package/.next/server/app/page.js.nft.json +1 -1
  86. package/.next/server/app/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/providers/page_client-reference-manifest.js +1 -1
  88. package/.next/server/app/providers.html +2 -2
  89. package/.next/server/app/providers.rsc +2 -2
  90. package/.next/server/app/providers.segments/_full.segment.rsc +2 -2
  91. package/.next/server/app/providers.segments/_head.segment.rsc +1 -1
  92. package/.next/server/app/providers.segments/_index.segment.rsc +2 -2
  93. package/.next/server/app/providers.segments/_tree.segment.rsc +2 -2
  94. package/.next/server/app/providers.segments/providers/__PAGE__.segment.rsc +1 -1
  95. package/.next/server/app/providers.segments/providers.segment.rsc +1 -1
  96. package/.next/server/app/server-logs/page_client-reference-manifest.js +1 -1
  97. package/.next/server/app/server-logs.html +2 -2
  98. package/.next/server/app/server-logs.rsc +2 -2
  99. package/.next/server/app/server-logs.segments/_full.segment.rsc +2 -2
  100. package/.next/server/app/server-logs.segments/_head.segment.rsc +1 -1
  101. package/.next/server/app/server-logs.segments/_index.segment.rsc +2 -2
  102. package/.next/server/app/server-logs.segments/_tree.segment.rsc +2 -2
  103. package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +1 -1
  104. package/.next/server/app/server-logs.segments/server-logs.segment.rsc +1 -1
  105. package/.next/server/app/servers/page_client-reference-manifest.js +1 -1
  106. package/.next/server/app/servers.html +2 -2
  107. package/.next/server/app/servers.rsc +2 -2
  108. package/.next/server/app/servers.segments/_full.segment.rsc +2 -2
  109. package/.next/server/app/servers.segments/_head.segment.rsc +1 -1
  110. package/.next/server/app/servers.segments/_index.segment.rsc +2 -2
  111. package/.next/server/app/servers.segments/_tree.segment.rsc +2 -2
  112. package/.next/server/app/servers.segments/servers/__PAGE__.segment.rsc +1 -1
  113. package/.next/server/app/servers.segments/servers.segment.rsc +1 -1
  114. package/.next/server/app/settings/networks/page_client-reference-manifest.js +1 -1
  115. package/.next/server/app/settings/networks.html +2 -2
  116. package/.next/server/app/settings/networks.rsc +3 -3
  117. package/.next/server/app/settings/networks.segments/_full.segment.rsc +3 -3
  118. package/.next/server/app/settings/networks.segments/_head.segment.rsc +1 -1
  119. package/.next/server/app/settings/networks.segments/_index.segment.rsc +2 -2
  120. package/.next/server/app/settings/networks.segments/_tree.segment.rsc +2 -2
  121. package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +2 -2
  122. package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +1 -1
  123. package/.next/server/app/settings/networks.segments/settings.segment.rsc +1 -1
  124. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  125. package/.next/server/app/settings/tokens/page_client-reference-manifest.js +1 -1
  126. package/.next/server/app/settings/tokens.html +2 -2
  127. package/.next/server/app/settings/tokens.rsc +2 -2
  128. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +2 -2
  129. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +1 -1
  130. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +2 -2
  131. package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +2 -2
  132. package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +1 -1
  133. package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +1 -1
  134. package/.next/server/app/settings/tokens.segments/settings.segment.rsc +1 -1
  135. package/.next/server/app/settings.html +2 -2
  136. package/.next/server/app/settings.rsc +3 -3
  137. package/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  138. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  139. package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  140. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  141. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  142. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  143. package/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  144. package/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  145. package/.next/server/app/tasks.html +2 -2
  146. package/.next/server/app/tasks.rsc +3 -3
  147. package/.next/server/app/tasks.segments/_full.segment.rsc +3 -3
  148. package/.next/server/app/tasks.segments/_head.segment.rsc +1 -1
  149. package/.next/server/app/tasks.segments/_index.segment.rsc +2 -2
  150. package/.next/server/app/tasks.segments/_tree.segment.rsc +2 -2
  151. package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +2 -2
  152. package/.next/server/app/tasks.segments/tasks.segment.rsc +1 -1
  153. package/.next/server/chunks/ssr/0zg~_pinyin-pro_dist_index_mjs_0fj60.q._.js +3 -0
  154. package/.next/server/chunks/ssr/0zg~_pinyin-pro_dist_index_mjs_0fj60.q._.js.map +1 -0
  155. package/.next/server/chunks/ssr/[root-of-the-server]__0-tk.iv._.js +3 -0
  156. package/.next/server/chunks/ssr/[root-of-the-server]__0-tk.iv._.js.map +1 -0
  157. package/.next/server/chunks/ssr/[root-of-the-server]__091su60._.js +2 -2
  158. package/.next/server/chunks/ssr/[root-of-the-server]__091su60._.js.map +1 -1
  159. package/.next/server/chunks/ssr/[root-of-the-server]__0k~m-.b._.js +3 -0
  160. package/.next/server/chunks/ssr/[root-of-the-server]__0k~m-.b._.js.map +1 -0
  161. package/.next/server/chunks/ssr/[root-of-the-server]__0v2rgdn._.js +3 -0
  162. package/.next/server/chunks/ssr/[root-of-the-server]__0v2rgdn._.js.map +1 -0
  163. package/.next/server/chunks/ssr/dash-loop-wt_0rh8p9o._.js +3 -3
  164. package/.next/server/chunks/ssr/dash-loop-wt_0rh8p9o._.js.map +1 -1
  165. package/.next/server/chunks/ssr/dash-loop-wt_app_0-ky8pi._.js +1 -1
  166. package/.next/server/chunks/ssr/dash-loop-wt_app_0-ky8pi._.js.map +1 -1
  167. package/.next/server/chunks/ssr/dash-loop-wt_app_0ax3klf._.js +1 -1
  168. package/.next/server/chunks/ssr/dash-loop-wt_app_0ax3klf._.js.map +1 -1
  169. package/.next/server/chunks/ssr/dash-loop-wt_app_0cxknnm._.js +1 -1
  170. package/.next/server/chunks/ssr/dash-loop-wt_app_0cxknnm._.js.map +1 -1
  171. package/.next/server/chunks/ssr/dash-loop-wt_app_0mxr2l9._.js +1 -1
  172. package/.next/server/chunks/ssr/dash-loop-wt_app_0mxr2l9._.js.map +1 -1
  173. package/.next/server/chunks/ssr/dash-loop-wt_app_0pcz05f._.js +1 -1
  174. package/.next/server/chunks/ssr/dash-loop-wt_app_0pcz05f._.js.map +1 -1
  175. package/.next/server/chunks/ssr/dash-loop-wt_app_0~.1~ew._.js +1 -1
  176. package/.next/server/chunks/ssr/dash-loop-wt_app_0~.1~ew._.js.map +1 -1
  177. package/.next/server/chunks/ssr/dash-loop-wt_app_13k3-ai._.js +1 -1
  178. package/.next/server/chunks/ssr/dash-loop-wt_app_13k3-ai._.js.map +1 -1
  179. package/.next/server/middleware-build-manifest.js +3 -3
  180. package/.next/server/pages/404.html +2 -2
  181. package/.next/server/pages/500.html +1 -1
  182. package/.next/server/server-reference-manifest.js +1 -1
  183. package/.next/server/server-reference-manifest.json +1 -1
  184. package/.next/static/chunks/0-g~4q8j8mxm4.js +2 -0
  185. package/.next/static/chunks/0.324peadzie3.js +1 -0
  186. package/.next/static/chunks/016h47ls_.eb3.js +1 -0
  187. package/.next/static/chunks/03vplr5e8v~uy.js +1 -0
  188. package/.next/static/chunks/05srmv31apvro.css +1 -0
  189. package/.next/static/chunks/0a0xa8~ux8yj2.js +1 -0
  190. package/.next/static/chunks/{0~kjngaphakh5.js → 0a9ilbebmnl47.js} +1 -1
  191. package/.next/static/chunks/0b9n013t4o.m7.js +7 -0
  192. package/.next/static/chunks/0cdo0a8-9gjs0.js +1 -0
  193. package/.next/static/chunks/0da-je9qrw1o6.js +1 -0
  194. package/.next/static/chunks/{0qjbzxfgcd6_3.js → 0q-cs_6ry76lh.js} +1 -1
  195. package/.next/static/chunks/0q5xir~9v-77t.js +1 -0
  196. package/.next/static/chunks/{02-g_rv~6kywl.js → 0z31ajz1sgl21.js} +2 -2
  197. package/.next/static/chunks/17-dam4fv0tzs.js +4 -0
  198. package/.next/trace +2 -2
  199. package/.next/trace-build +1 -1
  200. package/app/components/AliasAvatar.tsx +31 -0
  201. package/app/components/NodeSettingsPanel.tsx +52 -0
  202. package/app/components/TaskChatPanel.tsx +26 -1
  203. package/app/lib/avatars.ts +79 -0
  204. package/app/page.tsx +8 -2
  205. package/package.json +3 -2
  206. package/public/avatars/manifest.json +3 -0
  207. package/.next/server/chunks/ssr/[root-of-the-server]__04nqr0~._.js +0 -3
  208. package/.next/server/chunks/ssr/[root-of-the-server]__04nqr0~._.js.map +0 -1
  209. package/.next/server/chunks/ssr/[root-of-the-server]__0rcs2vk._.js +0 -3
  210. package/.next/server/chunks/ssr/[root-of-the-server]__0rcs2vk._.js.map +0 -1
  211. package/.next/server/chunks/ssr/[root-of-the-server]__0vc.3k7._.js +0 -3
  212. package/.next/server/chunks/ssr/[root-of-the-server]__0vc.3k7._.js.map +0 -1
  213. package/.next/static/chunks/02r4vb97r~-7r.js +0 -1
  214. package/.next/static/chunks/08medgd.1p151.js +0 -2
  215. package/.next/static/chunks/09-3btfwxmjfe.js +0 -1
  216. package/.next/static/chunks/09ju~nqgg3wpf.js +0 -4
  217. package/.next/static/chunks/0_gs9wrgf86-h.js +0 -7
  218. package/.next/static/chunks/0dq_d9k9asnws.js +0 -1
  219. package/.next/static/chunks/0usafm~4wag7t.js +0 -1
  220. package/.next/static/chunks/0wh6q.1qr0dmx.css +0 -1
  221. package/.next/static/chunks/0z52qau1ofv1z.js +0 -1
  222. package/.next/static/chunks/12jet.4d8djw0.js +0 -1
  223. /package/.next/static/{eAg58ZUqc0h75GPUsWy97 → Wh2iA_9c_IGG1Gq1ludnh}/_buildManifest.js +0 -0
  224. /package/.next/static/{eAg58ZUqc0h75GPUsWy97 → Wh2iA_9c_IGG1Gq1ludnh}/_clientMiddlewareManifest.js +0 -0
  225. /package/.next/static/{eAg58ZUqc0h75GPUsWy97 → Wh2iA_9c_IGG1Gq1ludnh}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": {},
3
3
  "edge": {},
4
- "encryptionKey": "AngM6AfAOyG0os0Zu5kgu/UToTbog1xqJqhsC71vwTo="
4
+ "encryptionKey": "F/pK0AMv4NU/qxIE7dj1dso4XCAb4B0Td7DIseXh5o4="
5
5
  }
@@ -0,0 +1,2 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27113,e=>{"use strict";var t=e.i(53116);e.s(["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(0,t.relativeAgo)(e)??"--"}])},24373,85068,e=>{"use strict";var t=e.i(66239),s=e.i(91723);let a="anet_avatars_v1",r="anet-avatars-updated",n=null,l=!1;function i(){try{let e=JSON.parse(window.localStorage.getItem(a)||"{}");return e&&"object"==typeof e?e:{}}catch{return{}}}function d(e){return l||(l=!0,fetch("/avatars/manifest.json",{cache:"no-cache"}).then(e=>e.ok?e.json():null).then(e=>{e&&"object"==typeof e&&(n=e,window.dispatchEvent(new Event(r)))}).catch(()=>{})),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}}function o(e){return(0,s.useSyncExternalStore)(d,()=>e&&(i()[e]||n?.[e])||"",()=>"")}e.s(["setAvatarUrl",0,function(e,t){if(e)try{let s=i();t.trim()?s[e]=t.trim():delete s[e],window.localStorage.setItem(a,JSON.stringify(s)),window.dispatchEvent(new Event(r))}catch{}},"useAvatarUrl",0,o],85068);let c=[180,200,220,270,300,330,30,90];function x(e){let t=0;for(let s=0;s<e.length;s++)t=31*t+e.charCodeAt(s)>>>0;let s=c[t%c.length];return{bg:`hsl(${s} 55% 22%)`,ring:`hsl(${s} 60% 45%)`,text:`hsl(${s} 80% 78%)`}}function u(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:r=""}){let n=o(e),[l,i]=(0,s.useState)("loading");if((0,s.useEffect)(()=>{i("loading")},[n]),n&&"error"!==l)return(0,t.jsx)("span",{className:`anet-alias-avatar relative inline-flex shrink-0 overflow-hidden rounded-full border border-[var(--border)] ${"loading"===l?"animate-pulse bg-[var(--bg-elevated)]":""} ${r}`,style:{width:a,height:a},title:e,"aria-hidden":!0,children:(0,t.jsx)("img",{src:n,alt:"",loading:"lazy",onLoad:()=>i("ready"),onError:()=>i("error"),className:`h-full w-full rounded-full object-cover transition-opacity duration-150 ${"ready"===l?"opacity-100":"opacity-0"}`})});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 ${r}`,style:{width:a,height:a,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let d=x(e),c=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 ${r}`,style:{width:a,height:a,fontSize:c,backgroundColor:d.bg,borderColor:d.ring,color:d.text},title:e,"aria-hidden":!0,children:u(e)})},"aliasAvatarColors",0,x,"aliasInitial",0,u],24373)},93226,e=>{"use strict";var t=e.i(66239),s=e.i(91723),a=e.i(49357);let r={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function n({variant:e,size:s}){let a={width:s,height:s},r={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"nodes":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,t.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,t.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,t.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,t.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,t.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,t.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,t.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,t.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,t.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,t.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,t.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,t.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,t.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,t.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function l({variant:e="generic",title:s,sub:i,cta:d,compact:o=!1}){let c=r[e],x=s??c.title,u=i??c.sub;return(0,t.jsxs)("div",{className:`text-center ${o?"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:o?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${o?"text-sm":"text-base"}`,children:x}),u&&(0,t.jsx)("p",{className:`text-gray-500 ${o?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:u}),d&&(0,t.jsx)("div",{className:"mt-4",children:d.href?(0,t.jsxs)(a.default,{href:d.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[d.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:d.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[d.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function i({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#26262b] bg-[#161618] shadow-lg shadow-black/20",children:e})}function d({cmd:e}){let[a,r]=(0,s.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1800)}catch{}};return(0,t.jsxs)("div",{className:"anet-empty-cmd flex items-start sm:items-center gap-2 bg-[#0e0e10] border border-[#26262b] 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 min-w-0 break-all sm:break-normal",children:e}),(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":a?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] transition-colors",children:a?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,l,"NodesEmptyState",0,function({hint:e,taskHistoryCount:s=0}){return e?.global_count?(0,t.jsx)(i,{children:(0,t.jsx)(l,{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)(i,{children:(0,t.jsx)(l,{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)(i,{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)(d,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("p",{className:"text-gray-600 text-xs mt-3 max-w-md mx-auto",children:"Once the agent connects, it appears here automatically within a few seconds — no refresh needed."}),(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:"→"})]})})]})})}])},39704,e=>{"use strict";e.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-gray-500/10 text-gray-300 border-gray-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-gray-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-gray-400",acked:"bg-gray-300",running:"bg-green-500",replied:"bg-gray-400",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-gray-600",expired:"bg-gray-600"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-gray-500/10 text-gray-300 border-gray-500/20",acked:"bg-gray-500/10 text-gray-300 border-gray-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-gray-500/10 text-gray-300 border-gray-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-gray-500/10 text-gray-500 border-gray-500/20",expired:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#9ca3af",acked:"#9ca3af",running:"#4ade80",replied:"#9ca3af",closed:"#6b7280",failed:"#f87171",cancelled:"#6b7280",expired:"#6b7280"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},8005,e=>{"use strict";var t=e.i(16309),s=e.i(33431);let a=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 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",a,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",a,r);return{health:e||null,error:s}},"useMessages",0,function(e=100){let{networkId:l}=(0,s.useNetworkId)(),{data:i,error:d,isLoading:o}=(0,t.default)(n(`/api/hub/messages?limit=${e}`,l),a,{...r,keepPreviousData:!0});return{messages:i?.messages||[],error:d,isLoading:o}},"useNodeLifecycle",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:l,error:i}=(0,t.default)(n("/api/hub/nodes",e),a,r),d={},o={};for(let e of l?.nodes??[])e.alias&&"string"==typeof e.lifecycle_state&&(d[e.alias]=e.lifecycle_state),e.alias&&"string"==typeof e.node_id&&(o[e.alias]=e.node_id);return{lifecycleByAlias:d,nodeIdByAlias:o,error:i}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:l,error:i,isLoading:d}=(0,t.default)(n("/api/hub/status",e),a,r);return{sessions:l?.sessions||[],hint:l?._hint,error:i,isLoading:d}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:l,error:i}=(0,t.default)(n("/api/hub/stats",e),a,r);return{stats:l?.ok?l:null,error:i}},"useTasks",0,function(e){let{networkId:l}=(0,s.useNetworkId)(),i=new URLSearchParams({limit:"100",...e}).toString(),{data:d,error:o,isLoading:c}=(0,t.default)(n(`/api/hub/tasks?${i}`,l),a,r);return{tasks:d?.tasks||[],count:d?.count??0,source:d?.source,error:o,isLoading:c}}])},40652,e=>{"use strict";var t=e.i(66239),s=e.i(91723);e.s(["useCollapsibleSearch",0,function(e){let{value:a}=e,[r,n]=(0,s.useState)(!1),l=(0,s.useRef)(e);l.current=e;let i=(0,s.useRef)(r);i.current=r;let d=(0,s.useCallback)(()=>{l.current.onChange(""),n(!1)},[]),[o]=(0,s.useState)(()=>({Button:()=>{let{value:e,label:s="Search",enabled:a=!0}=l.current,r=i.current;if(!a)return(0,t.jsx)(t.Fragment,{});let d=r||e;return(0,t.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),"aria-label":r?`Close ${s.toLowerCase()}`:`Open ${s.toLowerCase()}`,"aria-pressed":r,title:r?`Close ${s.toLowerCase()}`:s,className:`relative shrink-0 inline-flex items-center justify-center rounded-full border w-9 h-9 transition-colors ${d?"border-cyan-500/40 bg-cyan-500/10 text-cyan-300":"border-[#26262b] bg-[#161618] text-gray-400 hover:text-gray-200 hover:border-[#3a3a41]"}`,children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),e&&!r&&(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-cyan-400 ring-2 ring-[#0b0b0d]"})]})},Row:()=>{let{value:e,onChange:s,placeholder:a="Search…",enabled:r=!0}=l.current,n=i.current;return r&&(n||e)?(0,t.jsxs)("div",{className:"mb-3 sm:mb-4 flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",value:e,onChange:e=>s(e.target.value),onKeyDown:e=>{"Escape"===e.key&&d()},placeholder:a,autoFocus:n,className:"flex-1 bg-[#161618] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,t.jsx)("button",{type:"button",onClick:d,className:"shrink-0 text-xs text-gray-500 hover:text-gray-300 px-2 py-2","aria-label":"Clear and close search",children:"Cancel"})]}):null}}));return{Button:o.Button,Row:o.Row,value:a,reset:d}}])},44421,e=>{"use strict";var t=e.i(66239),s=e.i(91723),a=e.i(16309);function r(){let{data:e}=(0,a.default)("/api/anet/node-lifecycle",e=>fetch(e).then(e=>e.json()),{revalidateOnFocus:!1,dedupingInterval:6e4,shouldRetryOnError:!1});return e?.ok&&e.tools?e.tools:null}async function n(e,t){try{let s=await fetch("/api/anet/node-lifecycle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,...t})});return{...await s.json().catch(()=>({})),httpStatus:s.status}}catch(e){return{ok:!1,error:"network_error",message:e instanceof Error?e.message:String(e),httpStatus:0}}}function l({alias:e,nodeId:a,networkId:r,onClose:i,onCompleted:d}){let[o,c]=(0,s.useState)(!1),[x,u]=(0,s.useState)(!1),[h,m]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=e=>{"Escape"!==e.key||o||i()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,o]);let p=h&&"number"==typeof h.in_flight_count?h.in_flight_count:0,g=async()=>{c(!0),m(null);let e=await n("stop",{node_id:a,...r?{network_id:r}:{},...x?{force:!0}:{}});(c(!1),e.ok)?d():m(e)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50",onClick:o?void 0:i,"aria-hidden":!0}),(0,t.jsxs)("div",{role:"dialog","aria-label":`停止节点 ${e}`,className:"fixed left-1/2 top-1/2 z-50 w-[min(92vw,420px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-[#26262b] bg-[#161618] shadow-2xl",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-[#26262b] px-4 py-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-white",children:"停止节点"}),(0,t.jsx)("button",{onClick:o?void 0:i,"aria-label":"关闭",className:"text-gray-500 hover:text-white",children:"×"})]}),(0,t.jsxs)("div",{className:"space-y-3 px-4 py-4",children:[(0,t.jsxs)("div",{className:"text-sm text-gray-300",children:["将停止 ",(0,t.jsx)("span",{className:"font-mono text-cyan-300",children:e})," 子进程(SIGTERM,~10s 内)。配置目录保留,可通过「启动」恢复。"]}),h&&!1===h.ok&&(0,t.jsxs)("div",{className:"rounded-md border border-red-700/40 bg-red-900/20 px-3 py-2 text-xs text-red-200",children:[(0,t.jsx)("div",{className:"font-semibold",children:h.error}),h.message?(0,t.jsx)("div",{className:"mt-0.5 text-red-300/80",children:h.message}):null,"number"==typeof h.in_flight_count&&(0,t.jsxs)("div",{className:"mt-0.5 text-red-300/80",children:["当前 in-flight 任务: ",h.in_flight_count]}),h.hint?(0,t.jsx)("div",{className:"mt-1 text-red-300/60",children:h.hint}):null]}),(p>0||x)&&(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-amber-700/40 bg-amber-900/10 px-3 py-2 text-xs text-amber-200",children:[(0,t.jsx)("input",{type:"checkbox",checked:x,onChange:e=>u(e.target.checked),className:"mt-0.5"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-semibold text-amber-300",children:"强制停止"}),p>0?`(会丢弃 ${p} 条待处理任务)`:"(覆盖 in-flight 拒绝;hub 会写 audit 行)"]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-[#26262b] px-4 py-3",children:[(0,t.jsx)("button",{type:"button",disabled:o,onClick:i,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 hover:text-gray-200 disabled:opacity-50",children:"取消"}),(0,t.jsx)("button",{type:"button",disabled:o||p>0&&!x,onClick:g,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:opacity-50",children:o?"停止中…":"确认停止"})]})]})]})}function i({alias:e,nodeId:a,networkId:r,onClose:l,onCompleted:d}){let[o,c]=(0,s.useState)(!1),[x,u]=(0,s.useState)(""),[h,m]=(0,s.useState)(!1),[p,g]=(0,s.useState)(!1),[b,y]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=e=>{"Escape"!==e.key||o||l()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,o]);let f=b&&"number"==typeof b.in_flight_count?b.in_flight_count:0,j=x===e,v=async()=>{if(!j)return;c(!0),y(null);let e=await n("delete",{node_id:a,confirm_alias:x,...r?{network_id:r}:{},...h?{force:!0}:{},...p?{delete_config:!1}:{}});(c(!1),e.ok)?d():y(e)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50",onClick:o?void 0:l,"aria-hidden":!0}),(0,t.jsxs)("div",{role:"dialog","aria-label":`删除节点 ${e}`,className:"fixed left-1/2 top-1/2 z-50 w-[min(94vw,480px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-red-700/40 bg-[#161618] shadow-2xl",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-[#26262b] px-4 py-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-red-300",children:"删除节点"}),(0,t.jsx)("button",{onClick:o?void 0:l,"aria-label":"关闭",className:"text-gray-500 hover:text-white",children:"×"})]}),(0,t.jsxs)("div",{className:"space-y-3 px-4 py-4 text-sm text-gray-300",children:[(0,t.jsx)("div",{children:"这将:"}),(0,t.jsxs)("ul",{className:"list-inside list-disc space-y-1 pl-2 text-xs text-gray-400",children:[(0,t.jsxs)("li",{children:["停止 ",(0,t.jsx)("span",{className:"font-mono text-cyan-300",children:e})," 子进程(SIGTERM ~10s)"]}),(0,t.jsx)("li",{children:"从 hub 注销该节点"}),(0,t.jsx)("li",{children:"撤销该节点的 ntok"}),!p&&(0,t.jsxs)("li",{children:["配置文件备份到 ",(0,t.jsxs)("code",{className:"text-amber-300",children:["~/.anet/deleted/<ts>-",e,"/"]}),"(30 天后自动清除)"]}),p&&(0,t.jsx)("li",{className:"text-amber-300",children:"配置文件保留原地(不备份不清理 — 你勾选了「保留配置」)"})]}),b&&!1===b.ok&&(0,t.jsxs)("div",{className:"rounded-md border border-red-700/40 bg-red-900/20 px-3 py-2 text-xs text-red-200",children:[(0,t.jsx)("div",{className:"font-semibold",children:b.error}),b.message?(0,t.jsx)("div",{className:"mt-0.5 text-red-300/80",children:b.message}):null,"number"==typeof b.in_flight_count&&(0,t.jsxs)("div",{className:"mt-0.5 text-red-300/80",children:["当前 in-flight 任务: ",b.in_flight_count]}),b.hint?(0,t.jsx)("div",{className:"mt-1 text-red-300/60",children:b.hint}):null]}),(f>0||h)&&(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-amber-700/40 bg-amber-900/10 px-3 py-2 text-xs text-amber-200",children:[(0,t.jsx)("input",{type:"checkbox",checked:h,onChange:e=>m(e.target.checked),className:"mt-0.5"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-semibold text-amber-300",children:"强制删除"}),f>0?`(会丢弃 ${f} 条待处理任务)`:"(覆盖 in-flight 拒绝)"]})]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-xs text-gray-400",children:[(0,t.jsx)("input",{type:"checkbox",checked:p,onChange:e=>g(e.target.checked)}),"保留配置目录(不备份;高级用法)"]}),(0,t.jsxs)("label",{className:"block space-y-1",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:["输入节点名字 ",(0,t.jsx)("span",{className:"font-mono text-cyan-300",children:e})," 确认"]}),(0,t.jsx)("input",{autoFocus:!0,value:x,onChange:e=>u(e.target.value),placeholder:e,className:"w-full rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-2 text-sm text-gray-200 focus:border-red-500 focus:outline-none",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),x&&!j&&(0,t.jsx)("span",{className:"text-[11px] text-red-400",children:"名字不匹配(区分大小写)"})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-[#26262b] px-4 py-3",children:[(0,t.jsx)("button",{type:"button",disabled:o,onClick:l,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 hover:text-gray-200 disabled:opacity-50",children:"取消"}),(0,t.jsx)("button",{type:"button",disabled:o||!j||f>0&&!h,onClick:v,className:"rounded-md bg-red-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-red-500 disabled:cursor-not-allowed disabled:opacity-50",children:o?"删除中…":`删除 ${e}`})]})]})]})}e.s(["NodeLifecycleMenu",0,function({nodeId:e,alias:a,lifecycleState:d,networkId:o,onCompleted:c}){let x=r(),[u,h]=(0,s.useState)(!1),[m,p]=(0,s.useState)(!1),[g,b]=(0,s.useState)(!1),[y,f]=(0,s.useState)(!1),[j,v]=(0,s.useState)(null),N=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!u)return;let e=e=>{N.current&&!N.current.contains(e.target)&&h(!1)},t=e=>{"Escape"===e.key&&h(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[u]);let w=(0,s.useCallback)(async()=>{h(!1),v(null),f(!0);let t=await n("restart",{node_id:e,...o?{network_id:o}:{}});(f(!1),t.ok)?c?.():v(t)},[e,o,c]),k="string"==typeof d&&d.length>0?d:"active",S=[];return"stopping"===k||"deleting"===k?S.push({label:"stopping"===k?"停止中…":"删除中…",key:"loading",disabled:!0,onClick:()=>{}}):"active"===k?(S.push({label:y?"重启中…":"重启节点",key:"restart",disabled:y,onClick:w}),(null===x||x.stop)&&S.push({label:"停止节点",key:"stop",onClick:()=>{h(!1),p(!0)}}),(null===x||x.delete)&&S.push({label:"删除节点",key:"delete",danger:!0,onClick:()=>{h(!1),b(!0)}})):"stopped"===k||"stop_failed"===k?(S.push({label:y?"启动中…":"启动节点",key:"restart",disabled:y,onClick:w}),S.push({label:"删除节点",key:"delete",danger:!0,onClick:()=>{h(!1),b(!0)}})):S.push({label:`状态 ${k} (不识别)`,key:"unknown",disabled:!0,onClick:()=>{}}),(0,t.jsxs)("div",{ref:N,className:"relative inline-block",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("button",{type:"button","aria-label":`节点 ${a} 生命周期操作`,"aria-haspopup":"menu","aria-expanded":u,onClick:()=>h(e=>!e),className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-gray-400 hover:bg-white/5 hover:text-white focus:outline-none focus:ring-1 focus:ring-cyan-500/50",children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[(0,t.jsx)("circle",{cx:"12",cy:"5",r:"1.6"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"1.6"}),(0,t.jsx)("circle",{cx:"12",cy:"19",r:"1.6"})]})}),u&&(0,t.jsx)("div",{role:"menu",className:"absolute right-0 z-40 mt-1 w-44 overflow-hidden rounded-md border border-[#26262b] bg-[#161618] shadow-xl",children:S.map(e=>(0,t.jsx)("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:e.onClick,className:`block w-full px-3 py-2 text-left text-sm transition-colors ${e.disabled?"text-gray-600 cursor-not-allowed":e.danger?"text-red-300 hover:bg-red-900/20":"text-gray-200 hover:bg-white/5"}`,children:e.label},e.key))}),j&&!1===j.ok&&!m&&!g&&(0,t.jsx)("div",{className:"absolute right-0 z-40 mt-1 w-72 rounded-md border border-red-700/40 bg-red-900/20 px-3 py-2 text-xs text-red-200",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"font-semibold",children:j.error||"error"}),j.message?(0,t.jsx)("div",{className:"mt-0.5 text-red-300/80",children:j.message}):null,"number"==typeof j.in_flight_count&&(0,t.jsxs)("div",{className:"mt-0.5 text-red-300/80",children:["in-flight: ",j.in_flight_count]}),j.hint?(0,t.jsx)("div",{className:"mt-1 text-red-300/60",children:j.hint}):null]}),(0,t.jsx)("button",{type:"button",onClick:()=>v(null),className:"shrink-0 text-red-400 hover:text-red-200","aria-label":"关闭",children:"×"})]})}),m&&(0,t.jsx)(l,{alias:a,nodeId:e,networkId:o,onClose:()=>p(!1),onCompleted:()=>{p(!1),c?.()}}),g&&(0,t.jsx)(i,{alias:a,nodeId:e,networkId:o,onClose:()=>b(!1),onCompleted:()=>{b(!1),c?.()}})]})},"useLifecycleCaps",0,r])},43462,e=>{"use strict";var t=e.i(66239),s=e.i(91723),a=e.i(27113),r=e.i(8005),n=e.i(10451),l=e.i(49093),i=e.i(33431);function d({networkId:e,value:a,onChange:r}){let[n,l]=(0,s.useState)("loading"),[i,x]=(0,s.useState)([]),[u,h]=(0,s.useState)(""),[m,p]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{let t=!0;return l("loading"),h(""),fetch(e?`/api/anet/host-supervisors?network_id=${encodeURIComponent(e)}`:"/api/anet/host-supervisors",{cache:"no-store"}).then(e=>e.json().then(t=>({status:e.status,body:t}))).then(({status:e,body:s})=>{if(!t)return;if(501===e||s?.unconfirmed){l("unconfirmed"),h(s?.error||"hub /api/host-supervisors unavailable — upgrade to >=0.9.0-preview.8"),x([]);return}if(!s?.ok){l("error"),h(s?.error||`hub ${e}`),x([]);return}let n=Array.isArray(s.daemons)?s.daemons:[];x(n),l("ready"),1!==n.length||a||r(n[0].daemon_node_id,n[0])}).catch(e=>{t&&(l("error"),h(e instanceof Error?e.message:String(e)),x([]))}),()=>{t=!1}},[e]),"loading"===n)return(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-3 text-xs text-gray-500",children:[(0,t.jsxs)("svg",{className:"h-3.5 w-3.5 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-90",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),"正在查询可用的 host_supervisor 节点…"]});if("unconfirmed"===n)return(0,t.jsxs)("div",{className:"rounded-md border border-amber-700/40 bg-amber-900/10 px-3 py-3 text-xs text-amber-200",children:[(0,t.jsx)("div",{className:"font-semibold mb-1",children:"hub 暂未升级"}),(0,t.jsx)("div",{className:"text-amber-200/80",children:u}),(0,t.jsxs)("div",{className:"mt-1 text-[11px] text-amber-200/60",children:["升级到 ",(0,t.jsx)("code",{className:"rounded bg-black/40 px-1 py-0.5",children:"@sleep2agi/commhub-server@0.9.0-preview.8"})," 后选服务器功能才会出现。"]})]});if("error"===n)return(0,t.jsxs)("div",{className:"rounded-md border border-red-700/40 bg-red-900/10 px-3 py-3 text-xs text-red-200",children:["查询 host_supervisor 节点失败:",u]});if(0===i.length)return(0,t.jsxs)("div",{className:"rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-4 text-xs text-gray-300",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-200",children:"还没有可用的 host_supervisor 节点"}),(0,t.jsx)("p",{className:"mt-1 text-gray-500",children:"要在某台机器上创建节点,先在那台机器上跑一次 daemon 初始化命令:"}),(0,t.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-black/40 p-2 text-[11px] text-cyan-300",children:`# 任选一台目标机器(你的笔记本 / 一台服务器都行)
2
+ anet daemon up my-daemon`}),(0,t.jsx)("p",{className:"mt-2 text-gray-500",children:"注册成功后这里会自动出现,无需刷新。"})]});if(1===i.length&&!m){let e=i[0];return(0,t.jsxs)("div",{className:"rounded-md border border-cyan-700/40 bg-cyan-900/10 px-3 py-3 text-xs text-cyan-100",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-cyan-400/80",children:"将在"})," ",(0,t.jsx)("span",{className:"font-semibold",children:e.alias}),(0,t.jsxs)("span",{className:"text-cyan-300/60",children:[" (",e.hostname||"—",") "]}),(0,t.jsx)("span",{className:"text-cyan-400/80",children:"上创建"})]}),(0,t.jsx)("button",{type:"button",onClick:()=>p(!0),className:"text-[11px] text-cyan-400 hover:text-cyan-200 underline-offset-2 hover:underline",children:"详情 →"})]}),(0,t.jsx)(c,{runtimes:e.runtimes_supported,className:"mt-1"})]})}return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[(0,t.jsxs)("span",{children:["选择一台 host_supervisor 节点(",i.length," 台在线)"]}),m&&1===i.length&&(0,t.jsx)("button",{type:"button",onClick:()=>p(!1),className:"text-[11px] text-gray-500 hover:text-gray-300",children:"← 折叠"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2 lg:grid-cols-3",children:i.map(e=>(0,t.jsx)(o,{daemon:e,selected:e.daemon_node_id===a,onClick:()=>r(e.daemon_node_id,e)},e.daemon_node_id))})]})}function o({daemon:e,selected:s,onClick:a}){let r=e.host_telemetry?.alert_level||"gray";return(0,t.jsxs)("button",{type:"button",onClick:a,"aria-pressed":s,className:`flex w-full flex-col gap-1.5 rounded-md border px-3 py-2.5 text-left text-xs transition-colors ${s?"border-cyan-600 bg-cyan-900/15 text-cyan-100":"border-[#26262b] bg-[#0e0e10] text-gray-300 hover:border-[#3a3a41]"}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"truncate font-semibold",children:e.alias}),(0,t.jsx)(x,{level:r})]}),(0,t.jsx)("div",{className:"truncate text-[11px] text-gray-500",children:e.hostname||"—"}),(0,t.jsx)(c,{runtimes:e.runtimes_supported}),(e.host_telemetry?.cpu_cores!=null||e.host_telemetry?.mem_gb!=null)&&(0,t.jsxs)("div",{className:"flex gap-3 text-[10px] text-gray-500",children:[e.host_telemetry?.cpu_cores!=null&&(0,t.jsxs)("span",{children:[e.host_telemetry.cpu_cores," 核"]}),e.host_telemetry?.mem_gb!=null&&(0,t.jsxs)("span",{children:[e.host_telemetry.mem_gb," GB"]})]})]})}function c({runtimes:e,className:s=""}){return e&&0!==e.length?(0,t.jsx)("div",{className:`flex flex-wrap gap-1 ${s}`,children:e.map(e=>(0,t.jsx)("span",{className:"rounded bg-[#1c1c1f] px-1.5 py-0.5 text-[10px] text-gray-400",children:e},e))}):(0,t.jsx)("div",{className:`text-[10px] text-gray-600 ${s}`,children:"runtimes_supported: —"})}function x({level:e}){return(0,t.jsx)("span",{className:`rounded border px-1.5 py-0.5 text-[10px] ${{green:"bg-green-600/20 text-green-300 border-green-700/40",yellow:"bg-amber-600/20 text-amber-300 border-amber-700/40",red:"bg-red-600/20 text-red-300 border-red-700/40",gray:"bg-gray-600/20 text-gray-400 border-gray-700/40"}[e]}`,children:{green:"正常",yellow:"注意",red:"警报",gray:"离线"}[e]})}let u=[{id:"claude-agent-sdk",label:"Claude Agent SDK",models:["deepseek-v4-pro","MiniMax-M3","claude-sonnet-4-6","claude-opus-4-x"],defaultModel:"claude-sonnet-4-6"},{id:"codex-sdk",label:"Codex SDK",models:["gpt-5.5"],defaultModel:"gpt-5.5"},{id:"grok-build-acp",label:"Grok (build-acp)",models:["grok-build"],defaultModel:"grok-build"}],h=["default","acceptEdits","plan","bypassPermissions"],m=["服务器","名字","Runtime","模型","参数","确认"];function p({networkId:e,onClose:a,onCreated:r}){let[n,l]=(0,s.useState)(0),[o,c]=(0,s.useState)(null),[x,g]=(0,s.useState)(null),[b,y]=(0,s.useState)(""),[f,j]=(0,s.useState)(u[0].id),[v,N]=(0,s.useState)(""),[w,k]=(0,s.useState)("default"),[S,C]=(0,s.useState)(""),[_,$]=(0,s.useState)(""),[E,A]=(0,s.useState)(""),[L,I]=(0,s.useState)("form"),[T,M]=(0,s.useState)(""),[B,O]=(0,s.useState)(!1),{networkId:U}=(0,i.useNetworkId)(),z=e||U;(0,s.useEffect)(()=>{let e=e=>{"Escape"===e.key&&"creating"!==L&&a()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,L]),(0,s.useEffect)(()=>{if("done"!==L||B)return;let e=!0,t=0,s=b.trim(),a=async()=>{t+=1;try{let t=z?`/api/hub/status?network_id=${encodeURIComponent(z)}`:"/api/hub/status",a=await fetch(t,{cache:"no-store"}),r=await a.json().catch(()=>({})),n=Array.isArray(r?.sessions)?r.sessions:Array.isArray(r)?r:[];if(e&&n.some(e=>e?.alias===s))return void O(!0)}catch{}e&&t<16&&window.setTimeout(a,1500)},r=window.setTimeout(a,1200);return()=>{e=!1,window.clearTimeout(r)}},[L,B,z,b]);let R=u.find(e=>e.id===f)||u[0],P=b.trim().length>0,H=0===n&&!!o||1===n&&P||n>=2&&n<m.length,D="creating"===L;async function W(){I("creating"),M("");let t=e=>""===e.trim()?void 0:Number(e),s=v||R.defaultModel,a={name:b.trim(),runtime:f,model:s,flags:{permissionMode:w,maxTurns:t(S),budget:t(_),timeout:t(E)}};try{let t=await fetch("/api/anet/node-create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({node_spec:a,...o?{daemon_node_id:o}:{},...e?{network_id:e}:{}})}),s=await t.json().catch(()=>({}));t.ok&&s?.ok?(I("done"),M("创建请求已下发,节点正在拉起…"),r?.(s.result)):s?.unconfirmed?(I("unconfirmed"),M(`后端 create_node 未就绪:${s?.error||"不可用"}(测试 hub 可能未含 #299)`)):(I("error"),M(s?.error?`创建失败:${s.error}`:"创建失败"))}catch(e){I("error"),M(`创建失败:${e instanceof Error?e.message:"网络错误"}`)}}let F="w-full rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-2 text-sm text-gray-200 focus:border-cyan-600 focus:outline-none";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:a,"aria-hidden":!0}),(0,t.jsxs)("div",{role:"dialog","aria-label":"新建节点",className:"fixed left-1/2 top-1/2 z-50 w-[min(94vw,440px)] md:w-[min(92vw,720px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-[#26262b] bg-[#161618] shadow-2xl",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-[#26262b] px-4 py-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-white",children:"新建节点"}),(0,t.jsx)("button",{onClick:a,"aria-label":"关闭",className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-gray-500 hover:bg-white/5 hover:text-white",children:(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:(0,t.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),(0,t.jsx)("div",{className:"flex items-center gap-1.5 px-4 pt-3",children:m.map((e,s)=>(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center gap-1",children:[(0,t.jsx)("div",{className:`h-1 w-full rounded-full ${s<=n?"bg-cyan-500":"bg-[#26262b]"}`}),(0,t.jsx)("span",{className:`text-[10px] ${s===n?"text-cyan-300":"text-gray-600"}`,children:e})]},e))}),(0,t.jsx)("div",{className:"min-h-[180px] px-4 py-4",children:"form"!==L?(0,t.jsxs)("div",{className:"flex h-[180px] flex-col items-center justify-center gap-3 text-center",children:[D&&(0,t.jsxs)("svg",{className:"h-7 w-7 animate-spin text-cyan-400",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-90",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),(0,t.jsx)("div",{className:`text-sm ${"done"===L?"text-green-300":"error"===L?"text-red-300":"unconfirmed"===L?"text-amber-300":"text-gray-300"}`,children:D?"正在创建…":"done"===L&&B?`✓ ${b.trim()} 已上线`:T}),"done"===L&&(B?(0,t.jsx)("p",{className:"text-[11px] text-green-500/80",children:"节点已注册,已出现在节点列表。"}):(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 text-[11px] text-gray-500",children:[(0,t.jsxs)("svg",{className:"h-3 w-3 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-90",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}),"正在监测 ",b.trim()," 注册…(最长 ~24s)"]}))]}):(0,t.jsxs)(t.Fragment,{children:[0===n&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"在哪台机器上创建"}),(0,t.jsx)(d,{networkId:z||void 0,value:o,onChange:(e,t)=>{c(e),g(t);let s=t?.runtimes_supported;s&&s.length>0&&!s.includes(f)&&(j(s[0]),N(""))}}),!o&&(0,t.jsxs)("p",{className:"text-[11px] text-gray-600",children:["没选服务器之前无法继续;如果列表是空的,按提示在目标机器上跑 ",(0,t.jsx)("code",{className:"rounded bg-black/40 px-1 py-0.5",children:"anet daemon up <name>"}),"。"]})]}),1===n&&(0,t.jsxs)("label",{className:"block space-y-1.5",children:[(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"节点名字"}),(0,t.jsx)("input",{autoFocus:!0,value:b,onChange:e=>y(e.target.value),placeholder:"例如 my-agent-1",className:F}),!P&&(0,t.jsx)("span",{className:"text-[11px] text-gray-600",children:"名字不能为空"})]}),2===n&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:["Runtime",x?`(${x.alias} 支持)`:""]}),u.map(e=>{let s=x?.runtimes_supported,a=Array.isArray(s)&&s.length>0&&!s.includes(e.id),r=f===e.id;return(0,t.jsxs)("button",{type:"button",disabled:a,onClick:()=>{a||(j(e.id),N(""))},title:a?`${x?.alias||"该 daemon"} 未声明支持此 runtime`:void 0,className:`flex w-full items-center justify-between rounded-md border px-3 py-2 text-sm transition-colors ${a?"border-[#1c1c1f] bg-[#0a0a0c] text-gray-600 cursor-not-allowed":r?"border-cyan-600 bg-cyan-900/15 text-cyan-200":"border-[#26262b] bg-[#0e0e10] text-gray-300 hover:border-[#3a3a41]"}`,children:[(0,t.jsxs)("span",{children:[e.label,a&&(0,t.jsx)("span",{className:"ml-2 text-[10px] text-gray-700",children:"该 daemon 不支持"})]}),r&&!a&&(0,t.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})})]},e.id)})]}),3===n&&(0,t.jsxs)("label",{className:"block space-y-1.5",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:["模型(",R.label,")"]}),(0,t.jsxs)("select",{value:v,onChange:e=>N(e.target.value),className:F,children:[(0,t.jsxs)("option",{value:"",children:["默认(",R.defaultModel,")"]}),R.models.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]})]}),4===n&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("label",{className:"block space-y-1.5",children:[(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"permissionMode"}),(0,t.jsx)("select",{value:w,onChange:e=>k(e.target.value),className:F,children:h.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,t.jsxs)("label",{className:"space-y-1",children:[(0,t.jsx)("span",{className:"text-[11px] text-gray-500",children:"maxTurns"}),(0,t.jsx)("input",{inputMode:"numeric",value:S,onChange:e=>C(e.target.value),className:F})]}),(0,t.jsxs)("label",{className:"space-y-1",children:[(0,t.jsx)("span",{className:"text-[11px] text-gray-500",children:"budget"}),(0,t.jsx)("input",{inputMode:"numeric",value:_,onChange:e=>$(e.target.value),className:F})]}),(0,t.jsxs)("label",{className:"space-y-1",children:[(0,t.jsx)("span",{className:"text-[11px] text-gray-500",children:"timeout"}),(0,t.jsx)("input",{inputMode:"numeric",value:E,onChange:e=>A(e.target.value),className:F})]})]})]}),5===n&&(0,t.jsx)("div",{className:"space-y-2 text-sm",children:(0,t.jsx)("div",{className:"rounded-md border border-[#26262b] bg-[#0e0e10] divide-y divide-[#1c1c1f]",children:[["服务器",o?`${o.slice(0,24)}…`:"—"],["名字",b.trim()||"—"],["Runtime",R.label],["模型",v||`默认(${R.defaultModel})`],["permissionMode",w],["maxTurns / budget / timeout",`${S||"—"} / ${_||"—"} / ${E||"—"}`]].map(([e,s])=>(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3 px-3 py-2",children:[(0,t.jsx)("span",{className:"shrink-0 text-gray-500 text-xs",children:e}),(0,t.jsx)("span",{className:"text-right text-gray-200 text-xs break-all",children:s})]},e))})})]})}),"form"===L?(0,t.jsxs)("div",{className:"flex items-center justify-between border-t border-[#26262b] px-4 py-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>0===n?a():l(n-1),className:"rounded-md px-3 py-1.5 text-sm text-gray-400 hover:text-gray-200",children:0===n?"取消":"上一步"}),n<m.length-1?(0,t.jsx)("button",{type:"button",disabled:!H,onClick:()=>l(n+1),className:`rounded-md px-4 py-1.5 text-sm font-medium ${H?"bg-cyan-600 text-white hover:bg-cyan-500":"bg-[#1c1c1f] text-gray-600 cursor-not-allowed"}`,children:"下一步"}):(0,t.jsx)("button",{type:"button",onClick:W,className:"rounded-md bg-green-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-green-500",children:"创建节点"})]}):(0,t.jsxs)("div",{className:"flex items-center justify-end border-t border-[#26262b] px-4 py-3",children:[(0,t.jsx)("button",{type:"button",onClick:a,className:"rounded-md bg-[#1c1c1f] px-4 py-1.5 text-sm text-gray-200 hover:bg-[#26262b]",children:"done"===L?"完成":"关闭"}),("error"===L||"unconfirmed"===L)&&(0,t.jsx)("button",{type:"button",onClick:()=>I("form"),className:"ml-2 rounded-md bg-cyan-600 px-4 py-1.5 text-sm text-white hover:bg-cyan-500",children:"返回修改"})]})]})]})}var g=e.i(44421),b=e.i(93226),y=e.i(24373),f=e.i(74821),j=e.i(40652),v=e.i(39704),N=e.i(71257),w=e.i(55829);function k(e){return e?e.length>12?`${e.slice(0,8)}…`:e:"—"}function S({alias:e}){return(0,f.useHasDraft)(e)?(0,t.jsx)("span",{className:"shrink-0 text-[9px] text-red-400/90","aria-label":(0,w.t)("有未发送草稿","Unsent draft"),children:(0,w.t)("[草稿]","[draft]")}):null}e.s(["default",0,function(){let{sessions:e,isLoading:i}=(0,r.useSessions)(),{health:d}=(0,r.useHealth)(),{lifecycleByAlias:o,nodeIdByAlias:c}=(0,r.useNodeLifecycle)(),{hasUnread:x,unreadCount:u}=(0,N.useChatUnread)(),{mutate:h}=(0,n.useSWRConfig)(),m=()=>{h(e=>"string"==typeof e&&(e.startsWith("/api/hub/nodes")||e.startsWith("/api/hub/status")))},f=d?.sse_sessions||{},C=e=>(e.network_id?f[`${e.network_id}:${e.alias}`]:void 0)??f[e.alias],[_,$]=(0,s.useState)(""),[E,A]=(0,s.useState)(""),[L,I]=(0,s.useState)("list"),[T,M]=(0,s.useState)(null),[B,O]=(0,s.useState)(!1),U=(0,j.useCollapsibleSearch)({value:E,onChange:A,placeholder:"Search nodes…",label:"Search nodes",enabled:e.length>0}),z=e.map(e=>({...e,online:!!C(e)})).filter(e=>"online"===_?e.online:"offline"===_?!e.online:!_||_===e.status).filter(e=>!E||e.alias.toLowerCase().includes(E.toLowerCase())||(e.agent||"").toLowerCase().includes(E.toLowerCase())).sort((e,t)=>!!t.online-!!e.online||("working"===t.status)-("working"===e.status)),R=e.filter(e=>C(e)).length;return(0,t.jsxs)("div",{className:"min-h-screen max-w-full overflow-x-hidden bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-4 sm:mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",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 shrink-0",children:[R," 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 shrink-0",children:[e.length," total"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>O(!0),"aria-label":"新建节点",className:"inline-flex items-center gap-1 rounded-lg border border-cyan-700/50 bg-cyan-900/15 px-3 py-1.5 text-sm font-medium text-cyan-300 hover:bg-cyan-900/25 transition-colors",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-base leading-none",children:"+"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"新建节点"})]}),(0,t.jsx)(U.Button,{})]})]}),B&&(0,t.jsx)(p,{onClose:()=>O(!1)}),(0,t.jsx)(U.Row,{}),e.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-4 sm:mb-6",children:[(0,t.jsxs)("select",{value:_,onChange:e=>$(e.target.value),className:"bg-[#161618] border border-[#26262b] 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-[#26262b] bg-[#161618] p-1 text-sm",children:["list","grid"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>I(e),className:`rounded-md px-3 py-1.5 transition-colors ${L===e?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"list"===e?"List":"Grid"},e))})]}),i?(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===z.length?0===e.length?(0,t.jsx)(b.NodesEmptyState,{}):(0,t.jsx)(b.EmptyState,{variant:"nodes",title:"No nodes match your filters",sub:"Try clearing search or status filters, or wait for an agent to register."}):"grid"===L?(0,t.jsx)("div",{className:"grid min-w-0 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:z.map(e=>{let s=e.online?e.status:"offline",r="number"==typeof e.progress?e.progress:0,n=x(e.alias);return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>M(e.alias),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),M(e.alias))},className:`relative min-w-0 max-w-full overflow-hidden rounded-xl border border-[#26262b] bg-[#161618] 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.jsxs)("span",{className:"relative inline-flex shrink-0",children:[(0,t.jsx)(y.AliasAvatar,{alias:e.alias,size:36}),u(e.alias)>0&&(0,t.jsx)("span",{"aria-label":(0,w.t)(`${u(e.alias)} 条未读`,`${u(e.alias)} unread`),className:"absolute -top-1 -right-1.5 min-w-[16px] h-4 px-1 rounded-full bg-red-500 text-white text-[9px] font-semibold leading-4 text-center ring-2 ring-[#161618]",children:u(e.alias)>99?"99+":u(e.alias)})]}),n&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-[#161618] 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}),(0,t.jsx)(S,{alias: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 ${v.SESSION_STATUS_CHIP_CLASS[s]||v.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:k(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.jsx)(g.NodeLifecycleMenu,{nodeId:c[e.alias]||e.node_id||e.alias,alias:e.alias,lifecycleState:o[e.alias],networkId:e.network_id||null,onCompleted:m})]}),(0,t.jsxs)("div",{className:"mt-3 rounded-lg border border-[#1c1c1f] bg-[#0e0e10] 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,a.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"})]}),r>0&&r<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:`${r}%`}})})]},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"})]}),z.map(e=>{let s=e.online?e.status:"offline",r=x(e.alias);return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>M(e.alias),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),M(e.alias))},className:`rounded-lg border border-[#26262b] bg-[#161618] 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 ${v.SESSION_STATUS_CHIP_CLASS[s]||v.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.jsxs)("span",{className:"relative inline-flex shrink-0",children:[(0,t.jsx)(y.AliasAvatar,{alias:e.alias,size:20}),u(e.alias)>0&&(0,t.jsx)("span",{"aria-label":(0,w.t)(`${u(e.alias)} 条未读`,`${u(e.alias)} unread`),className:"absolute -top-1.5 -right-2 min-w-[15px] h-[15px] px-1 rounded-full bg-red-500 text-white text-[9px] font-semibold leading-[15px] text-center",children:u(e.alias)>99?"99+":u(e.alias)})]}),r&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full border border-[#161618] bg-red-500"})]}),(0,t.jsx)("span",{className:"truncate text-sm font-medium text-white",children:e.alias}),(0,t.jsx)(S,{alias:e.alias}),r&&(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:"·"}),k(e.server)]})}),(0,t.jsx)("div",{className:"col-span-4 truncate text-xs text-gray-500",title:e.task||"",children:e.task||"--"}),(0,t.jsxs)("div",{className:"col-span-1 flex items-center justify-between gap-2 text-xs text-gray-500",children:[(0,t.jsx)("span",{className:"truncate",children:(0,a.timeAgo)(e.last_seen_at||e.updated_at)}),(0,t.jsx)(g.NodeLifecycleMenu,{nodeId:c[e.alias]||e.node_id||e.alias,alias:e.alias,lifecycleState:o[e.alias],networkId:e.network_id||null,onCompleted:m})]})]}),(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)(y.AliasAvatar,{alias:e.alias,size:28}),r&&(0,t.jsx)("span",{className:"absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-[#161618] 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}),r&&(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,a.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 ${v.SESSION_STATUS_CHIP_CLASS[s]||v.SESSION_STATUS_CHIP_CLASS.offline}`,children:s}),(0,t.jsx)(g.NodeLifecycleMenu,{nodeId:c[e.alias]||e.node_id||e.alias,alias:e.alias,lifecycleState:o[e.alias],networkId:e.network_id||null,onCompleted:m})]}),e.task&&(0,t.jsx)("div",{className:"truncate text-xs text-gray-500",children:e.task})]})]},e.alias)})]}),T&&(0,t.jsx)(l.TaskChatPanel,{alias:T,onClose:()=>M(null)})]})}],43462)},54859,e=>{e.v(t=>Promise.all(["static/chunks/0da-je9qrw1o6.js"].map(t=>e.l(t))).then(()=>t(52527)))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27113,e=>{"use strict";var t=e.i(53116);e.s(["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(0,t.relativeAgo)(e)??"--"}])},24373,85068,e=>{"use strict";var t=e.i(66239),s=e.i(91723);let a="anet_avatars_v1",r="anet-avatars-updated",n=null,i=!1;function l(){try{let e=JSON.parse(window.localStorage.getItem(a)||"{}");return e&&"object"==typeof e?e:{}}catch{return{}}}function d(e){return i||(i=!0,fetch("/avatars/manifest.json",{cache:"no-cache"}).then(e=>e.ok?e.json():null).then(e=>{e&&"object"==typeof e&&(n=e,window.dispatchEvent(new Event(r)))}).catch(()=>{})),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}}function o(e){return(0,s.useSyncExternalStore)(d,()=>e&&(l()[e]||n?.[e])||"",()=>"")}e.s(["setAvatarUrl",0,function(e,t){if(e)try{let s=l();t.trim()?s[e]=t.trim():delete s[e],window.localStorage.setItem(a,JSON.stringify(s)),window.dispatchEvent(new Event(r))}catch{}},"useAvatarUrl",0,o],85068);let c=[180,200,220,270,300,330,30,90];function x(e){let t=0;for(let s=0;s<e.length;s++)t=31*t+e.charCodeAt(s)>>>0;let s=c[t%c.length];return{bg:`hsl(${s} 55% 22%)`,ring:`hsl(${s} 60% 45%)`,text:`hsl(${s} 80% 78%)`}}function h(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:r=""}){let n=o(e),[i,l]=(0,s.useState)("loading");if((0,s.useEffect)(()=>{l("loading")},[n]),n&&"error"!==i)return(0,t.jsx)("span",{className:`anet-alias-avatar relative inline-flex shrink-0 overflow-hidden rounded-full border border-[var(--border)] ${"loading"===i?"animate-pulse bg-[var(--bg-elevated)]":""} ${r}`,style:{width:a,height:a},title:e,"aria-hidden":!0,children:(0,t.jsx)("img",{src:n,alt:"",loading:"lazy",onLoad:()=>l("ready"),onError:()=>l("error"),className:`h-full w-full rounded-full object-cover transition-opacity duration-150 ${"ready"===i?"opacity-100":"opacity-0"}`})});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 ${r}`,style:{width:a,height:a,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let d=x(e),c=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 ${r}`,style:{width:a,height:a,fontSize:c,backgroundColor:d.bg,borderColor:d.ring,color:d.text},title:e,"aria-hidden":!0,children:h(e)})},"aliasAvatarColors",0,x,"aliasInitial",0,h],24373)},93226,e=>{"use strict";var t=e.i(66239),s=e.i(91723),a=e.i(49357);let r={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function n({variant:e,size:s}){let a={width:s,height:s},r={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"nodes":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,t.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,t.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,t.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,t.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,t.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,t.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,t.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,t.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,t.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,t.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,t.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,t.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,t.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,t.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...r,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function i({variant:e="generic",title:s,sub:l,cta:d,compact:o=!1}){let c=r[e],x=s??c.title,h=l??c.sub;return(0,t.jsxs)("div",{className:`text-center ${o?"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:o?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${o?"text-sm":"text-base"}`,children:x}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${o?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:h}),d&&(0,t.jsx)("div",{className:"mt-4",children:d.href?(0,t.jsxs)(a.default,{href:d.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[d.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:d.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[d.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-[#26262b] bg-[#161618] shadow-lg shadow-black/20",children:e})}function d({cmd:e}){let[a,r]=(0,s.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1800)}catch{}};return(0,t.jsxs)("div",{className:"anet-empty-cmd flex items-start sm:items-center gap-2 bg-[#0e0e10] border border-[#26262b] 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 min-w-0 break-all sm:break-normal",children:e}),(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":a?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] transition-colors",children:a?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:s=0}){return e?.global_count?(0,t.jsx)(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)(d,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("p",{className:"text-gray-600 text-xs mt-3 max-w-md mx-auto",children:"Once the agent connects, it appears here automatically within a few seconds — no refresh needed."}),(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:"→"})]})})]})})}])},39704,e=>{"use strict";e.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-gray-500/10 text-gray-300 border-gray-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-gray-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-gray-400",acked:"bg-gray-300",running:"bg-green-500",replied:"bg-gray-400",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-gray-600",expired:"bg-gray-600"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-gray-500/10 text-gray-300 border-gray-500/20",acked:"bg-gray-500/10 text-gray-300 border-gray-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-gray-500/10 text-gray-300 border-gray-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-gray-500/10 text-gray-500 border-gray-500/20",expired:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#9ca3af",acked:"#9ca3af",running:"#4ade80",replied:"#9ca3af",closed:"#6b7280",failed:"#f87171",cancelled:"#6b7280",expired:"#6b7280"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},71331,e=>{"use strict";var t=e.i(66239),s=e.i(91723),a=e.i(84876),r=e.i(33431),n=e.i(27113),i=e.i(24373);let l={created:"text-gray-400",delivered:"text-blue-400",running:"text-green-400",replied:"text-purple-400",failed:"text-red-400",closed:"text-gray-500"};function d({taskId:e,onClose:a}){let[r,o]=(0,s.useState)(null),[c,x]=(0,s.useState)([]),[h,m]=(0,s.useState)(!0);(0,s.useEffect)(()=>{(async()=>{try{let[t,s]=await Promise.all([fetch(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`),fetch(`/api/hub/task-events?task_id=${encodeURIComponent(e)}&limit=50`)]),a=await t.json(),r=await s.json();a.tasks?.[0]&&o(a.tasks[0]),x(r.events||[])}catch{}finally{m(!1)}})()},[e]);let g=r?[{key:"created",label:"Created",time:r.created_at,color:"bg-gray-400"},{key:"delivered",label:"Delivered",time:r.delivered_at,color:"bg-blue-400"},{key:"started",label:"Started",time:r.started_at,color:"bg-green-400"},{key:"completed",label:"Completed",time:r.completed_at,color:"bg-purple-400"}].map(e=>({...e,done:!!e.time})):[],p=g.findIndex(e=>!e.done),u=r&&"completed"!==r.status&&"failed"!==r.status&&"expired"!==r.status&&"cancelled"!==r.status,y=r?.started_at&&r?.completed_at?Math.round((new Date(r.completed_at).getTime()-new Date(r.started_at).getTime())/1e3):null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 bg-black/30 z-40 anet-fade-in",onClick:a}),(0,t.jsxs)("div",{className:"fixed top-0 right-0 h-[100dvh] w-full lg:w-[500px] bg-[#0b0b0d] border-l border-[#26262b] z-50 flex flex-col shadow-2xl shadow-black/60 overflow-y-auto animate-slide-in",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-[#26262b] bg-[#111113] sticky top-0",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-white",children:"Task Detail"}),(0,t.jsxs)("div",{className:"text-[10px] text-gray-500 mt-0.5",children:[e.slice(0,16),"..."]})]}),(0,t.jsx)("button",{onClick:a,"aria-label":"Close task drawer",className:"inline-flex min-h-[44px] min-w-[44px] items-center justify-center text-gray-500 hover:text-white rounded-lg hover:bg-[#1c1c1f]",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),h?(0,t.jsx)("div",{className:"flex justify-center py-16",children:(0,t.jsx)("div",{className:"w-6 h-6 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}):r?(0,t.jsxs)("div",{className:"px-5 py-5 space-y-5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:`text-lg font-bold ${l[r.status]||"text-gray-400"}`,children:r.status}),"normal"!==r.priority&&(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded border ${"high"===r.priority?"text-red-300 border-red-500/20":"text-gray-400 border-gray-600/20"}`,children:r.priority}),null!==y&&(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["⏱ ",y<60?`${y}s`:`${Math.floor(y/60)}m ${y%60}s`]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm flex-wrap",children:[r.from_name&&(0,t.jsx)(i.AliasAvatar,{alias:r.from_name,size:18}),(0,t.jsx)("span",{className:"text-gray-200 font-medium",children:r.from_name||"--"}),(0,t.jsx)("span",{className:"text-gray-600",children:"→"}),r.to_name&&(0,t.jsx)(i.AliasAvatar,{alias:r.to_name,size:18}),(0,t.jsx)("span",{className:"text-gray-200 font-medium",children:r.to_name||"--"})]}),(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 uppercase tracking-wide",children:"Timeline"}),null!==y&&(0,t.jsxs)("div",{className:"text-[10px] text-gray-600",children:[y<60?`${y}s`:`${Math.floor(y/60)}m ${y%60}s`," runtime"]})]}),(0,t.jsx)("div",{className:"space-y-3",children:g.map((e,s)=>{let a=u&&s===p,r=!!g[s+1]?.done;return(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center pt-0.5",children:[(0,t.jsx)("span",{className:`relative w-3 h-3 rounded-full shrink-0 ${e.done?e.color:"bg-gray-700"}`,children:a&&(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute -inset-1 rounded-full border border-current opacity-60 anet-current-step-pulse",style:{borderColor:"currentColor"}})}),s<g.length-1&&(0,t.jsx)("div",{className:`w-0.5 h-5 mt-1 ${e.done&&r?"bg-gray-500":e.done?"bg-gradient-to-b from-gray-500 to-gray-800":"bg-gray-800"}`})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:`text-xs font-medium flex items-center gap-2 ${e.done?"text-gray-200":a?"text-cyan-300":"text-gray-600"}`,children:[(0,t.jsx)("span",{children:e.label}),a&&(0,t.jsx)("span",{className:"text-[9px] uppercase tracking-wide text-cyan-400",children:"in progress"})]}),(0,t.jsx)("div",{className:"text-[10px] text-gray-500",title:e.time||void 0,children:e.time?(0,n.timeAgo)(e.time):a?"—":"Pending"})]})]},e.key)})})]}),(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 uppercase mb-2",children:"Input"}),(0,t.jsx)("div",{className:"text-sm text-gray-300 whitespace-pre-wrap",children:r.content||"--"})]}),r.result&&(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 uppercase mb-2",children:"Output"}),(0,t.jsx)("div",{className:"text-sm text-gray-300 whitespace-pre-wrap max-h-64 overflow-y-auto",children:r.result})]}),c.length>0&&(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"text-xs text-gray-500 uppercase mb-2",children:["Events (",c.length,")"]}),(0,t.jsx)("div",{className:"space-y-1.5 max-h-40 overflow-y-auto",children:c.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,t.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"running"===e.to_status?"bg-green-400":"replied"===e.to_status?"bg-purple-400":"failed"===e.to_status?"bg-red-400":"bg-blue-400"}`}),(0,t.jsx)("span",{className:"text-gray-400",children:e.event_type}),e.from_status&&(0,t.jsxs)("span",{className:"text-gray-600",children:[e.from_status,"→",e.to_status]}),(0,t.jsx)("span",{className:"text-gray-600 ml-auto",children:(0,n.timeAgo)(e.created_at)})]},e.id))})]}),(0,t.jsxs)("div",{className:"text-[10px] text-gray-600 space-y-1",children:[(0,t.jsxs)("div",{children:["Task ID: ",r.task_id]}),r.expires_at&&(0,t.jsxs)("div",{children:["Expires: ",r.expires_at]})]})]}):(0,t.jsx)("div",{className:"text-center py-16 text-gray-500",children:"Task not found"})]})]})}var o=e.i(93226),c=e.i(39704);function x(e){let t=c.STATUS_CHIP_CLASS[e]||"bg-gray-500/10 text-gray-400 border-gray-500/20";return`text-xs px-2 py-0.5 rounded-md border ${t}`}function h(e){return"high"===e?"text-red-400":"low"===e?"text-gray-600":"text-gray-400"}function m(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function g(){let e,l,g,p,u=(0,a.useSearchParams)(),{networkId:y}=(0,r.useNetworkId)(),[b,j]=(0,s.useState)([]),[v,f]=(0,s.useState)(0),[w,N]=(0,s.useState)(!0),[k,S]=(0,s.useState)(""),[_,C]=(0,s.useState)(new Set),[T,A]=(0,s.useState)(u.get("status")||""),[$,E]=(0,s.useState)(""),[L,I]=(0,s.useState)(""),[U,D]=(0,s.useState)(null),M=e=>{C(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},B=(0,s.useCallback)(async()=>{try{let e=new URLSearchParams;y&&e.set("network_id",y),T&&e.set("status",T),$&&e.set("from_name",$),L&&e.set("to_name",L),e.set("limit","100");let t=await fetch(`/api/hub/tasks?${e.toString()}`);if(401===t.status)return void window.location.assign("/login");let s=await t.json();j(s.tasks||[]),f(s.count??(s.tasks?.length||0)),S("")}catch(e){S(e instanceof Error?e.message:"fetch failed")}finally{N(!1)}},[T,$,L,y]);return(0,s.useEffect)(()=>{N(!0),B();let e=setInterval(B,5e3);return()=>clearInterval(e)},[B]),(0,t.jsxs)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-4 sm:mb-6",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Tasks"}),b.length<v&&(0,t.jsxs)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30 tabular-nums",title:`Showing ${b.length} of ${v} tasks`,children:[b.length," / ",v]})]}),b.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"anet-tabstrip-wrap mb-4",children:(0,t.jsx)("div",{className:"anet-tabstrip flex sm:flex-wrap gap-1 bg-[#161618] rounded-lg border border-[#26262b] p-1 overflow-x-auto sm:overflow-x-visible scrollbar-thin",children:(e={},b.forEach(t=>{e[t.status]=(e[t.status]||0)+1}),["",...c.TASK_STATUSES].map(s=>{let a=""===s?b.length:e[s]||0,r=T===s;return(0,t.jsxs)("button",{onClick:()=>A(s),disabled:0===a&&""!==s&&!r,className:`px-3 py-1.5 rounded-md text-xs transition-colors flex items-center gap-1.5 shrink-0 whitespace-nowrap disabled:opacity-30 disabled:cursor-not-allowed ${r?`${c.STATUS_CHIP_CLASS[s]||"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"} border`:"text-gray-500 hover:text-gray-300 hover:bg-[#1c1c1f]/40"}`,children:[s&&(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:c.STATUS_DOT_HEX[s]||"#6b7280"}}),(0,t.jsx)("span",{children:s||"All"}),(0,t.jsx)("span",{className:`text-[10px] tabular-nums ${r?"opacity-80":"text-gray-600"}`,children:a})]},s)}))})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4 sm:mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 rounded-lg border border-[#26262b] bg-[#161618] px-2.5 py-1.5 focus-within:border-blue-500/40",children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-600",children:"From"}),(0,t.jsx)("input",{type:"text",value:$,onChange:e=>E(e.target.value),placeholder:"any node",className:"w-28 bg-transparent text-base sm:text-sm text-white placeholder-gray-700 focus:outline-none"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 rounded-lg border border-[#26262b] bg-[#161618] px-2.5 py-1.5 focus-within:border-blue-500/40",children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-gray-600",children:"To"}),(0,t.jsx)("input",{type:"text",value:L,onChange:e=>I(e.target.value),placeholder:"any node",className:"w-28 bg-transparent text-base sm:text-sm text-white placeholder-gray-700 focus:outline-none"})]}),(T||$||L)&&(0,t.jsx)("button",{type:"button",onClick:()=>{A(""),E(""),I("")},className:"rounded-lg border border-gray-700 px-2.5 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:border-gray-600",children:"Clear filters"})]})]}),b.length>0&&!T&&(l={},b.forEach(e=>{l[e.status]=(l[e.status]||0)+1}),g=b.length||1,(p=c.TASK_STATUSES.map(e=>({key:e,color:c.STATUS_BAR_CLASS[e]})).filter(e=>l[e.key])).length?(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-800",children:p.map(e=>(0,t.jsx)("div",{className:e.color,style:{width:`${l[e.key]/g*100}%`},title:`${e.key}: ${l[e.key]}`},e.key))})}):null),k&&(0,t.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:k}),w?(0,t.jsx)("div",{className:"animate-pulse space-y-3",children:[1,2,3,4,5].map(e=>(0,t.jsx)("div",{className:"h-20 bg-gray-800/20 rounded-lg border border-gray-800/40"},e))}):0===b.length?(0,t.jsx)(o.EmptyState,{variant:"tasks",sub:T||$||L?"No tasks match the current filters. Try clearing them.":"Tasks will appear here when agents send them via CommHub."}):(0,t.jsxs)("div",{className:"space-y-1 sm:space-y-2",children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-12 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:"From"}),(0,t.jsx)("div",{className:"col-span-2",children:"To"}),(0,t.jsx)("div",{className:"col-span-4",children:"Content"}),(0,t.jsx)("div",{className:"col-span-1",children:"Priority"}),(0,t.jsx)("div",{className:"col-span-2",children:"Time"})]}),b.map(e=>{let s=_.has(e.task_id);return(0,t.jsxs)("div",{className:`anet-task-row group bg-[#161618] border rounded-lg px-3 py-2 sm:px-4 sm:py-3 transition-all duration-200 cursor-pointer ${s?"border-[#3a3a41] shadow-lg shadow-black/20":"border-[#26262b] hover:border-[#3a3a41] hover:bg-[#15152e]"}`,onClick:()=>M(e.task_id),role:"button",tabIndex:0,"aria-expanded":s,onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),M(e.task_id))},children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-12 gap-2 items-center",children:[(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:x(e.status),children:e.status})}),(0,t.jsxs)("div",{className:"col-span-2 flex items-center gap-1.5 min-w-0",title:e.from_name,children:[e.from_name&&(0,t.jsx)(i.AliasAvatar,{alias:e.from_name,size:18}),(0,t.jsx)("span",{className:"truncate text-sm text-gray-200",children:e.from_name||"--"})]}),(0,t.jsxs)("div",{className:"col-span-2 flex items-center gap-1.5 min-w-0",title:e.to_name,children:[e.to_name&&(0,t.jsx)(i.AliasAvatar,{alias:e.to_name,size:18}),(0,t.jsx)("span",{className:"truncate text-sm text-gray-200",children:e.to_name||"--"})]}),(0,t.jsx)("div",{className:"col-span-4 text-xs text-gray-400 truncate",title:e.content,children:(0,n.previewContent)(e.content)}),(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:`text-xs ${h(e.priority)}`,children:e.priority||"normal"})}),(0,t.jsxs)("div",{className:"col-span-2 text-xs text-gray-500 flex items-center justify-between gap-2",title:e.created_at,children:[(0,t.jsx)("span",{className:"truncate",children:m(e.created_at)}),(0,t.jsx)("svg",{"aria-hidden":!0,className:`shrink-0 text-gray-600 group-hover:text-gray-400 transition-transform duration-200 ${s?"rotate-180":""}`,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 9l6 6 6-6"})})]})]}),(0,t.jsxs)("div",{className:"sm:hidden space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:x(e.status),children:e.status}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`text-xs ${h(e.priority)}`,children:e.priority||"normal"}),(0,t.jsx)("svg",{"aria-hidden":!0,className:`text-gray-600 transition-transform duration-200 ${s?"rotate-180":""}`,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 9l6 6 6-6"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-gray-300 min-w-0",children:[e.from_name&&(0,t.jsx)(i.AliasAvatar,{alias:e.from_name,size:16}),(0,t.jsx)("span",{className:"truncate max-w-[35%]",children:e.from_name||"--"}),(0,t.jsx)("span",{className:"text-gray-600",children:"→"}),e.to_name&&(0,t.jsx)(i.AliasAvatar,{alias:e.to_name,size:16}),(0,t.jsx)("span",{className:"truncate max-w-[35%]",children:e.to_name||"--"}),(0,t.jsx)("span",{className:"ml-auto shrink-0 text-[10px] text-gray-600",children:m(e.created_at)})]}),(0,t.jsx)("div",{className:"text-xs text-gray-400 line-clamp-1",title:e.content,children:(0,n.previewContent)(e.content)})]}),(0,t.jsx)("div",{className:`grid transition-all duration-300 ease-out ${s?"grid-rows-[1fr] opacity-100 mt-3":"grid-rows-[0fr] opacity-0"}`,"aria-hidden":!s,children:(0,t.jsx)("div",{className:"overflow-hidden",children:(0,t.jsxs)("div",{className:"pt-3 border-t border-[#26262b] space-y-3",children:[e.content&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-600 mb-1",children:"Content"}),(0,t.jsx)("div",{className:"text-xs text-gray-300 whitespace-pre-wrap bg-[#0e0e10] rounded-lg px-3 py-2 border border-[#1c1c1f]",children:e.content})]}),e.result&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs text-gray-600 mb-1",children:"Result"}),(0,t.jsx)("div",{className:"text-xs text-gray-300 whitespace-pre-wrap bg-[#0e0e10] rounded-lg px-3 py-2 border border-[#1c1c1f] max-h-48 overflow-y-auto",children:e.result})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[["Created",e.created_at],["Delivered",e.delivered_at],["Started",e.started_at],["Completed",e.completed_at]].map(([e,s])=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-gray-600",children:[e,": "]}),(0,t.jsx)("span",{className:"text-gray-400",children:s?m(s):"--"})]},e))}),e.expires_at&&(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Expires: "}),(0,t.jsx)("span",{className:"text-orange-400",children:e.expires_at})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"text-xs text-gray-600 truncate",title:e.task_id,children:["ID: ",e.task_id]}),(0,t.jsxs)("div",{className:"flex gap-2 shrink-0",children:[("failed"===e.status||"expired"===e.status)&&(0,t.jsx)("button",{onClick:async t=>{t.stopPropagation(),await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e.to_name,task:e.content,priority:e.priority,...e.network_id||y?{network_id:e.network_id||y}:{}})}),B()},className:"text-xs text-orange-400 hover:text-orange-300 px-2 py-0.5 rounded border border-orange-500/20 hover:bg-orange-500/10",children:"Retry"}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),D(e.task_id)},className:"text-xs text-cyan-400 hover:text-cyan-300",children:"Detail →"})]})]})]})})})]},e.task_id)})]}),U&&(0,t.jsx)(d,{taskId:U,onClose:()=>D(null)})]})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:(0,t.jsx)("div",{className:"lg:ml-0 ml-10 text-gray-500 text-sm",children:"Loading tasks…"})}),children:(0,t.jsx)(g,{})})}],71331)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27113,e=>{"use strict";var t=e.i(53116);e.s(["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(0,t.relativeAgo)(e)??"--"}])},24373,85068,e=>{"use strict";var t=e.i(66239),a=e.i(91723);let r="anet_avatars_v1",s="anet-avatars-updated",l=null,n=!1;function i(){try{let e=JSON.parse(window.localStorage.getItem(r)||"{}");return e&&"object"==typeof e?e:{}}catch{return{}}}function d(e){return n||(n=!0,fetch("/avatars/manifest.json",{cache:"no-cache"}).then(e=>e.ok?e.json():null).then(e=>{e&&"object"==typeof e&&(l=e,window.dispatchEvent(new Event(s)))}).catch(()=>{})),window.addEventListener(s,e),window.addEventListener("storage",e),()=>{window.removeEventListener(s,e),window.removeEventListener("storage",e)}}function o(e){return(0,a.useSyncExternalStore)(d,()=>e&&(i()[e]||l?.[e])||"",()=>"")}e.s(["setAvatarUrl",0,function(e,t){if(e)try{let a=i();t.trim()?a[e]=t.trim():delete a[e],window.localStorage.setItem(r,JSON.stringify(a)),window.dispatchEvent(new Event(s))}catch{}},"useAvatarUrl",0,o],85068);let c=[180,200,220,270,300,330,30,90];function x(e){let t=0;for(let a=0;a<e.length;a++)t=31*t+e.charCodeAt(a)>>>0;let a=c[t%c.length];return{bg:`hsl(${a} 55% 22%)`,ring:`hsl(${a} 60% 45%)`,text:`hsl(${a} 80% 78%)`}}function g(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:s=""}){let l=o(e),[n,i]=(0,a.useState)("loading");if((0,a.useEffect)(()=>{i("loading")},[l]),l&&"error"!==n)return(0,t.jsx)("span",{className:`anet-alias-avatar relative inline-flex shrink-0 overflow-hidden rounded-full border border-[var(--border)] ${"loading"===n?"animate-pulse bg-[var(--bg-elevated)]":""} ${s}`,style:{width:r,height:r},title:e,"aria-hidden":!0,children:(0,t.jsx)("img",{src:l,alt:"",loading:"lazy",onLoad:()=>i("ready"),onError:()=>i("error"),className:`h-full w-full rounded-full object-cover transition-opacity duration-150 ${"ready"===n?"opacity-100":"opacity-0"}`})});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 ${s}`,style:{width:r,height:r,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let d=x(e),c=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 ${s}`,style:{width:r,height:r,fontSize:c,backgroundColor:d.bg,borderColor:d.ring,color:d.text},title:e,"aria-hidden":!0,children:g(e)})},"aliasAvatarColors",0,x,"aliasInitial",0,g],24373)},39704,e=>{"use strict";e.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-gray-500/10 text-gray-300 border-gray-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-gray-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-gray-400",acked:"bg-gray-300",running:"bg-green-500",replied:"bg-gray-400",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-gray-600",expired:"bg-gray-600"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-gray-500/10 text-gray-300 border-gray-500/20",acked:"bg-gray-500/10 text-gray-300 border-gray-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-gray-500/10 text-gray-300 border-gray-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-gray-500/10 text-gray-500 border-gray-500/20",expired:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#9ca3af",acked:"#9ca3af",running:"#4ade80",replied:"#9ca3af",closed:"#6b7280",failed:"#f87171",cancelled:"#6b7280",expired:"#6b7280"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},58959,e=>{"use strict";var t=e.i(66239),a=e.i(91723),r=e.i(84876),s=e.i(49357),l=e.i(49093),n=e.i(27113),i=e.i(24373),d=e.i(39704),o=e.i(71257);function c({tmuxName:e}){let[r,s]=(0,a.useState)(""),[l,n]=(0,a.useState)(!1),[i,d]=(0,a.useState)(!1),o=async()=>{n(!0);try{let t=await fetch(`/api/hub/tmux?name=${encodeURIComponent(e)}`),a=await t.json();s(a.output||a.error||"No output")}catch{s("Failed to fetch")}n(!1)};return(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300",children:["Terminal (",e,")"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.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,t.jsx)("button",{onClick:()=>d(!i),className:"text-xs text-gray-500 hover:text-gray-300",children:i?"Collapse":"Expand"})]})]}),r&&(0,t.jsx)("pre",{className:`text-[11px] text-green-300 bg-[#060607] rounded-lg px-3 py-2 border border-[#1c1c1f] overflow-x-auto whitespace-pre font-mono ${i?"max-h-96":"max-h-32"} overflow-y-auto`,children:r}),!r&&(0,t.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,a.useState)(null),[o,c]=(0,a.useState)([]),[x,u]=(0,a.useState)(0),[h,b]=(0,a.useState)(""),[m,p]=(0,a.useState)(""),[y,f]=(0,a.useState)(!1),v=(0,a.useCallback)(async()=>{if(e)try{let t=await fetch(`/api/hub/session?alias=${encodeURIComponent(e)}`),a=await t.json();a.session&&n(a.session),a.inbox&&c(a.inbox),u(a.sse||0),b("")}catch(e){b(e instanceof Error?e.message:"fetch failed")}},[e]);(0,a.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let[j,w]=(0,a.useState)(""),S=async()=>{if(m.trim()&&e){f(!0),w("");try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:m,...l?.network_id?{network_id:l.network_id}:{}})}),a=await t.json();a.ok?(p(""),setTimeout(v,2e3)):w(a.error||"Send failed")}catch(e){w(e instanceof Error?e.message:"Send failed")}f(!1)}};if(!e)return(0,t.jsx)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-6 flex items-center justify-center",children:(0,t.jsxs)("p",{className:"text-gray-500",children:["No alias specified. ",(0,t.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,t.jsxs)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-6 lg:ml-0 ml-10",children:[(0,t.jsx)(s.default,{href:"/nodes",className:"text-gray-500 hover:text-gray-300 text-sm shrink-0",children:"← Nodes"}),(0,t.jsx)(i.AliasAvatar,{alias:e,size:32}),(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)("h1",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:e}),(0,t.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,t.jsx)("span",{className:`text-[10px] uppercase tracking-wide font-semibold ${N}`,children:l?.status||"unknown"})]}),l?.agent&&(0,t.jsxs)("div",{className:"text-xs text-gray-500 truncate",children:[l.agent,l.server?(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("span",{className:"text-gray-700 mx-1",children:"·"})," ",l.server]}):null]})]})]}),h&&(0,t.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:h}),(0,t.jsx)(g,{alias:e,session:l,sse:x,sendMsg:m,setSendMsg:p,sending:y,sendTask:S,sendError:j})]})}function g({alias:e,session:r,sse:s,sendMsg:n,setSendMsg:i,sending:d,sendTask:x,sendError:u}){let[b,m]=(0,a.useState)("chat"),{hasUnread:p}=(0,o.useChatUnread)(),[y,f]=(0,a.useState)([]),[v,j]=(0,a.useState)(!1),w=p(e);return(0,a.useEffect)(()=>{"events"!==b||v||fetch("/api/hub/task-events?limit=50").then(e=>e.json()).then(e=>{f(e.events||[]),j(!0)}).catch(()=>j(!0))},[b,v]),(0,t.jsxs)("div",{className:"bg-[#111113] border border-[#26262b] rounded-xl overflow-hidden h-[calc(100vh-140px)] flex flex-col",children:[(0,t.jsx)("div",{className:"flex border-b border-[#26262b] bg-[#0e0e10] 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,t.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 ${b===e.id?"border-cyan-400 text-cyan-300":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,t.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,t.jsx)("path",{d:e.icon})}),(0,t.jsxs)("span",{className:"relative inline-flex items-center gap-2",children:[e.label,"chat"===e.id&&w&&"chat"!==b&&(0,t.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-red-500","aria-label":"Unread chat messages"})]})]},e.id))}),(0,t.jsxs)("div",{className:"flex-1 overflow-hidden",children:["chat"===b&&(0,t.jsx)(l.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0}),"events"===b&&(0,t.jsx)(h,{events:y,loading:!v}),"info"===b&&(0,t.jsxs)("div",{className:"p-4 overflow-y-auto h-full space-y-4 max-w-2xl",children:[(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Node Info"}),(0,t.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:a,alwaysShow:r})=>a||r?(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{className:"text-gray-500 shrink-0",children:e}),(0,t.jsx)("span",{className:"text-gray-300 truncate max-w-[200px]",title:a?String(a):"--",children:a?String(a):"--"})]},e):null)})]}),r?.task&&(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Current Task"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap",children:r.task})]}),r?.output&&(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Last Output"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap max-h-48 overflow-y-auto",children:r.output})]}),(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Send Task"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.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-[#0e0e10] border border-[#26262b] rounded px-3 py-2 text-base sm:text-xs text-white placeholder-gray-600 focus:border-blue-500 focus:outline-none"}),(0,t.jsx)("button",{onClick:x,disabled:d||!n.trim(),className:"inline-flex min-h-[44px] items-center justify-center px-4 py-2 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-700 text-white text-xs rounded transition-colors",children:d?"...":"Send"})]}),u&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:u})]}),r?.tmux_name&&(0,t.jsx)(c,{tmuxName:r.tmux_name})]})]})]})}let u={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 h({events:e,loading:a}){if(a)return(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.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,t.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 t=e.task_id||`ungrouped-${e.id}`,a=r.get(t)||[];a.push(e),r.set(t,a)}),(0,t.jsx)("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[...r.entries()].map(([e,a])=>(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"text-[10px] text-gray-600 mb-3 truncate",children:["Task: ",e.slice(0,20),"..."]}),(0,t.jsxs)("div",{className:"relative pl-6",children:[(0,t.jsx)("div",{className:"absolute left-[9px] top-2 bottom-2 w-0.5 bg-[#1c1c1f]"}),a.map((e,a)=>{let r=u[e.to_status]||u.created;return(0,t.jsxs)("div",{className:"relative pb-4 last:pb-0",children:[(0,t.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-[#161618]`,children:(0,t.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#0e0e10",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,t.jsx)("path",{d:r.path})})}),(0,t.jsxs)("div",{className:"ml-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.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,t.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.from_status," → ",e.to_status]}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600 ml-auto",children:(0,n.timeAgo)(e.created_at)})]}),e.detail&&(0,t.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,t.jsx)(a.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:(0,t.jsx)("div",{className:"lg:ml-0 ml-10 text-gray-500 text-sm",children:"Loading…"})}),children:(0,t.jsx)(x,{})})}])},54859,e=>{e.v(t=>Promise.all(["static/chunks/0da-je9qrw1o6.js"].map(t=>e.l(t))).then(()=>t(52527)))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27113,e=>{"use strict";var t=e.i(53116);e.s(["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(0,t.relativeAgo)(e)??"--"}])},24373,85068,e=>{"use strict";var t=e.i(66239),r=e.i(91723);let a="anet_avatars_v1",s="anet-avatars-updated",n=null,i=!1;function l(){try{let e=JSON.parse(window.localStorage.getItem(a)||"{}");return e&&"object"==typeof e?e:{}}catch{return{}}}function o(e){return i||(i=!0,fetch("/avatars/manifest.json",{cache:"no-cache"}).then(e=>e.ok?e.json():null).then(e=>{e&&"object"==typeof e&&(n=e,window.dispatchEvent(new Event(s)))}).catch(()=>{})),window.addEventListener(s,e),window.addEventListener("storage",e),()=>{window.removeEventListener(s,e),window.removeEventListener("storage",e)}}function c(e){return(0,r.useSyncExternalStore)(o,()=>e&&(l()[e]||n?.[e])||"",()=>"")}e.s(["setAvatarUrl",0,function(e,t){if(e)try{let r=l();t.trim()?r[e]=t.trim():delete r[e],window.localStorage.setItem(a,JSON.stringify(r)),window.dispatchEvent(new Event(s))}catch{}},"useAvatarUrl",0,c],85068);let d=[180,200,220,270,300,330,30,90];function x(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;let r=d[t%d.length];return{bg:`hsl(${r} 55% 22%)`,ring:`hsl(${r} 60% 45%)`,text:`hsl(${r} 80% 78%)`}}function h(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:s=""}){let n=c(e),[i,l]=(0,r.useState)("loading");if((0,r.useEffect)(()=>{l("loading")},[n]),n&&"error"!==i)return(0,t.jsx)("span",{className:`anet-alias-avatar relative inline-flex shrink-0 overflow-hidden rounded-full border border-[var(--border)] ${"loading"===i?"animate-pulse bg-[var(--bg-elevated)]":""} ${s}`,style:{width:a,height:a},title:e,"aria-hidden":!0,children:(0,t.jsx)("img",{src:n,alt:"",loading:"lazy",onLoad:()=>l("ready"),onError:()=>l("error"),className:`h-full w-full rounded-full object-cover transition-opacity duration-150 ${"ready"===i?"opacity-100":"opacity-0"}`})});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 ${s}`,style:{width:a,height:a,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let o=x(e),d=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 ${s}`,style:{width:a,height:a,fontSize:d,backgroundColor:o.bg,borderColor:o.ring,color:o.text},title:e,"aria-hidden":!0,children:h(e)})},"aliasAvatarColors",0,x,"aliasInitial",0,h],24373)},93226,e=>{"use strict";var t=e.i(66239),r=e.i(91723),a=e.i(49357);let s={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function n({variant:e,size:r}){let a={width:r,height:r},s={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"nodes":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,t.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,t.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,t.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,t.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,t.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,t.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,t.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,t.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,t.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,t.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,t.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,t.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,t.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,t.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...a,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function i({variant:e="generic",title:r,sub:l,cta:o,compact:c=!1}){let d=s[e],x=r??d.title,h=l??d.sub;return(0,t.jsxs)("div",{className:`text-center ${c?"py-8":"py-16"} px-4`,role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)(n,{variant:e,size:c?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${c?"text-sm":"text-base"}`,children:x}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${c?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:h}),o&&(0,t.jsx)("div",{className:"mt-4",children:o.href?(0,t.jsxs)(a.default,{href:o.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:o.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function l({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#26262b] bg-[#161618] shadow-lg shadow-black/20",children:e})}function o({cmd:e}){let[a,s]=(0,r.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1800)}catch{}};return(0,t.jsxs)("div",{className:"anet-empty-cmd flex items-start sm:items-center gap-2 bg-[#0e0e10] border border-[#26262b] 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 min-w-0 break-all sm:break-normal",children:e}),(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":a?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] transition-colors",children:a?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:r=0}){return e?.global_count?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents in this network",sub:`Server has ${e.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):r>0?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${r.toLocaleString()} task${1===r?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,t.jsx)(l,{children:(0,t.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,t.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,t.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,t.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,t.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,t.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,t.jsx)("div",{className:"mt-4 inline-block",children:(0,t.jsx)(o,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("p",{className:"text-gray-600 text-xs mt-3 max-w-md mx-auto",children:"Once the agent connects, it appears here automatically within a few seconds — no refresh needed."}),(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:"→"})]})})]})})}])},56416,e=>{"use strict";var t=e.i(66239),r=e.i(91723),a=e.i(49357),s=e.i(27113),n=e.i(33431),i=e.i(93226),l=e.i(24373);let o={register:"bg-green-500/10 text-green-300 border-green-500/20",login:"bg-blue-500/10 text-blue-300 border-blue-500/20",login_failed:"bg-red-500/10 text-red-300 border-red-500/20",create_network:"bg-purple-500/10 text-purple-300 border-purple-500/20",send_task:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"},c={register:"#4ade80",login:"#60a5fa",login_failed:"#ef4444",create_network:"#a78bfa",send_task:"#22d3ee"};e.s(["default",0,function(){let e,d,{networkId:x}=(0,n.useNetworkId)(),[h,m]=(0,r.useState)([]),[g,u]=(0,r.useState)(!0),[y,p]=(0,r.useState)(""),[b,j]=(0,r.useState)(""),f=(0,r.useCallback)(async()=>{try{let e=new URLSearchParams({limit:"100"});x&&e.set("network_id",x),b&&e.set("action",b);let t=sessionStorage.getItem("anet_v3_auth");if(t)try{let r=JSON.parse(t);r.token&&e.set("token",r.token)}catch{}let r=await fetch(`/api/hub/audit-log?${e.toString()}`);if(401===r.status)return void window.location.assign("/login");let a=await r.json();m(a.logs||[]),p(a.error&&!a.logs?.length?a.error:"")}catch(e){p(e instanceof Error?e.message:"fetch failed")}finally{u(!1)}},[b,x]);return(0,r.useEffect)(()=>{u(!0),f();let e=setInterval(f,1e4);return()=>clearInterval(e)},[f]),(0,t.jsxs)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:[(0,t.jsx)("div",{className:"flex items-center gap-4 mb-4 sm:mb-6",children:(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Audit Log"})}),(0,t.jsx)("div",{className:"mb-4 sm:mb-6 flex flex-wrap items-center gap-1 anet-tabstrip-wrap overflow-x-auto sm:overflow-x-visible",children:(e={},h.forEach(t=>{e[t.action]=(e[t.action]||0)+1}),[{key:"",label:"All"},{key:"login",label:"login",dot:c.login},{key:"login_failed",label:"login_failed",dot:c.login_failed},{key:"register",label:"register",dot:c.register},{key:"create_network",label:"create_network",dot:c.create_network},{key:"send_task",label:"send_task",dot:c.send_task}].map(r=>{let a=""===r.key?h.length:e[r.key]||0,s=b===r.key;return(0,t.jsxs)("button",{type:"button",onClick:()=>j(r.key),disabled:0===a&&""!==r.key,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0 whitespace-nowrap ${s?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/30":"text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] border border-transparent"}`,children:[r.dot&&(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:r.dot}}),(0,t.jsx)("span",{children:r.label}),(0,t.jsx)("span",{className:`text-[10px] tabular-nums ${s?"text-cyan-400":"text-gray-600"}`,children:a})]},r.key||"all")}))}),y&&(d=/unauthor|401|forbidden|403|admin/i.test(y),(0,t.jsxs)("div",{className:"anet-warn-chip bg-yellow-900/20 border border-yellow-800/40 text-yellow-300 px-4 py-3 rounded-lg mb-6 text-sm flex items-start gap-3",role:"alert",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-base leading-none",children:"⚠"}),(0,t.jsx)("div",{className:"flex-1",children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"font-medium",children:"需要 admin 权限查看审计日志"}),(0,t.jsx)("div",{className:"text-xs opacity-80 mt-1",children:"审计日志记录用户注册 / 登录 / 网络变更等事件,需要 admin 角色。"}),(0,t.jsx)(a.default,{href:"/login",className:"inline-block mt-2 text-xs font-medium underline underline-offset-4 hover:opacity-80",children:"切到 admin 账号 →"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"font-medium",children:"加载失败"}),(0,t.jsx)("div",{className:"text-xs opacity-80 mt-1",children:"请检查 CommHub 是否在线,或稍后重试。"}),(0,t.jsx)("button",{onClick:()=>window.location.reload(),className:"inline-block mt-2 text-xs font-medium underline underline-offset-4 hover:opacity-80",children:"重新加载 →"})]})})]})),g?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(e=>(0,t.jsx)("div",{className:"h-14 bg-gray-800/20 rounded-lg"},e))}):0===h.length?(0,t.jsx)(i.EmptyState,{variant:"logs"}):(0,t.jsx)("div",{className:"space-y-1 sm:space-y-2",children:h.map(e=>{let r=e.username||e.user_id;return(0,t.jsxs)("div",{className:"relative bg-[#161618] border border-[#26262b] rounded-lg pl-3 pr-3 py-2 sm:pl-4 sm:pr-4 sm:py-3 hover:border-[#3a3a41] transition-colors overflow-hidden",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute left-0 top-0 bottom-0 w-0.5",style:{backgroundColor:c[e.action]||"transparent"}}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${o[e.action]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:e.action}),r&&(0,t.jsx)(l.AliasAvatar,{alias:r,size:16}),(0,t.jsx)("span",{className:"text-sm text-gray-200 font-medium",children:r}),e.target_type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-xs text-gray-600",children:"→"}),(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:[e.target_type,e.target_id?`:${e.target_id.slice(0,12)}`:""]})]}),(0,t.jsx)("span",{className:"text-xs text-gray-600 ml-auto",children:(0,s.timeAgo)(e.created_at)})]}),e.detail&&(0,t.jsx)("div",{className:"text-xs text-gray-500",children:e.detail}),e.ip&&"unknown"!==e.ip&&(0,t.jsxs)("div",{className:"text-[10px] text-gray-700",children:["IP: ",e.ip]})]},e.id)})})]})}])}]);