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

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 (324) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +6 -6
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/diagnostics/route-bundle-stats.json +90 -87
  5. package/.next/fallback-build-manifest.json +3 -3
  6. package/.next/server/app/_global-error/page/build-manifest.json +3 -3
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +8 -8
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +8 -8
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +4 -4
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page/build-manifest.json +3 -3
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +2 -2
  18. package/.next/server/app/_not-found.rsc +11 -11
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +11 -11
  20. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  21. package/.next/server/app/_not-found.segments/_index.segment.rsc +6 -6
  22. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  23. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  24. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  25. package/.next/server/app/admin/page/build-manifest.json +3 -3
  26. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  27. package/.next/server/app/admin.html +2 -2
  28. package/.next/server/app/admin.rsc +13 -13
  29. package/.next/server/app/admin.segments/_full.segment.rsc +13 -13
  30. package/.next/server/app/admin.segments/_head.segment.rsc +4 -4
  31. package/.next/server/app/admin.segments/_index.segment.rsc +6 -6
  32. package/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
  33. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +4 -4
  34. package/.next/server/app/admin.segments/admin.segment.rsc +3 -3
  35. package/.next/server/app/api/anet/config/route.js +2 -2
  36. package/.next/server/app/api/anet/config/route.js.nft.json +1 -1
  37. package/.next/server/app/api/auth/login/route.js +2 -2
  38. package/.next/server/app/api/auth/login/route.js.nft.json +1 -1
  39. package/.next/server/app/api/auth/logout/route.js +2 -2
  40. package/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  41. package/.next/server/app/api/auth/v3/route.js +2 -2
  42. package/.next/server/app/api/auth/v3/route.js.nft.json +1 -1
  43. package/.next/server/app/api/hub/audit-log/route.js +2 -2
  44. package/.next/server/app/api/hub/audit-log/route.js.nft.json +1 -1
  45. package/.next/server/app/api/hub/auth/route.js +2 -2
  46. package/.next/server/app/api/hub/auth/route.js.nft.json +1 -1
  47. package/.next/server/app/api/hub/broadcast/route.js +2 -2
  48. package/.next/server/app/api/hub/broadcast/route.js.nft.json +1 -1
  49. package/.next/server/app/api/hub/events/route.js +2 -2
  50. package/.next/server/app/api/hub/events/route.js.nft.json +1 -1
  51. package/.next/server/app/api/hub/health/route.js +2 -2
  52. package/.next/server/app/api/hub/health/route.js.nft.json +1 -1
  53. package/.next/server/app/api/hub/inbox/route.js +2 -2
  54. package/.next/server/app/api/hub/inbox/route.js.nft.json +1 -1
  55. package/.next/server/app/api/hub/license/route.js +2 -2
  56. package/.next/server/app/api/hub/license/route.js.nft.json +1 -1
  57. package/.next/server/app/api/hub/messages/route.js +2 -2
  58. package/.next/server/app/api/hub/messages/route.js.nft.json +1 -1
  59. package/.next/server/app/api/hub/networks/route.js +2 -2
  60. package/.next/server/app/api/hub/networks/route.js.nft.json +1 -1
  61. package/.next/server/app/api/hub/nodes/route.js +2 -2
  62. package/.next/server/app/api/hub/nodes/route.js.nft.json +1 -1
  63. package/.next/server/app/api/hub/register/route.js +2 -2
  64. package/.next/server/app/api/hub/register/route.js.nft.json +1 -1
  65. package/.next/server/app/api/hub/send/route.js +2 -2
  66. package/.next/server/app/api/hub/send/route.js.nft.json +1 -1
  67. package/.next/server/app/api/hub/session/route.js +2 -2
  68. package/.next/server/app/api/hub/session/route.js.nft.json +1 -1
  69. package/.next/server/app/api/hub/stats/route.js +2 -2
  70. package/.next/server/app/api/hub/stats/route.js.nft.json +1 -1
  71. package/.next/server/app/api/hub/status/route.js +2 -2
  72. package/.next/server/app/api/hub/status/route.js.nft.json +1 -1
  73. package/.next/server/app/api/hub/task-events/route.js +2 -2
  74. package/.next/server/app/api/hub/task-events/route.js.nft.json +1 -1
  75. package/.next/server/app/api/hub/tasks/route.js +2 -2
  76. package/.next/server/app/api/hub/tasks/route.js.nft.json +1 -1
  77. package/.next/server/app/api/hub/tmux/route.js +2 -2
  78. package/.next/server/app/api/hub/tmux/route.js.nft.json +1 -1
  79. package/.next/server/app/api/hub/tokens/route.js +2 -2
  80. package/.next/server/app/api/hub/tokens/route.js.nft.json +1 -1
  81. package/.next/server/app/docs/page/build-manifest.json +3 -3
  82. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/docs.html +2 -2
  84. package/.next/server/app/docs.rsc +13 -13
  85. package/.next/server/app/docs.segments/_full.segment.rsc +13 -13
  86. package/.next/server/app/docs.segments/_head.segment.rsc +4 -4
  87. package/.next/server/app/docs.segments/_index.segment.rsc +6 -6
  88. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  89. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +4 -4
  90. package/.next/server/app/docs.segments/docs.segment.rsc +3 -3
  91. package/.next/server/app/index.html +2 -2
  92. package/.next/server/app/index.rsc +13 -13
  93. package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  94. package/.next/server/app/index.segments/_full.segment.rsc +13 -13
  95. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  96. package/.next/server/app/index.segments/_index.segment.rsc +6 -6
  97. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  98. package/.next/server/app/login/page/build-manifest.json +3 -3
  99. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  100. package/.next/server/app/login.html +1 -1
  101. package/.next/server/app/login.rsc +13 -13
  102. package/.next/server/app/login.segments/_full.segment.rsc +13 -13
  103. package/.next/server/app/login.segments/_head.segment.rsc +4 -4
  104. package/.next/server/app/login.segments/_index.segment.rsc +6 -6
  105. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  106. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  107. package/.next/server/app/login.segments/login.segment.rsc +3 -3
  108. package/.next/server/app/logs/page/build-manifest.json +3 -3
  109. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  110. package/.next/server/app/logs.html +2 -2
  111. package/.next/server/app/logs.rsc +13 -13
  112. package/.next/server/app/logs.segments/_full.segment.rsc +13 -13
  113. package/.next/server/app/logs.segments/_head.segment.rsc +4 -4
  114. package/.next/server/app/logs.segments/_index.segment.rsc +6 -6
  115. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  116. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +4 -4
  117. package/.next/server/app/logs.segments/logs.segment.rsc +3 -3
  118. package/.next/server/app/messages/page/build-manifest.json +3 -3
  119. package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
  120. package/.next/server/app/messages.html +2 -2
  121. package/.next/server/app/messages.rsc +13 -13
  122. package/.next/server/app/messages.segments/_full.segment.rsc +13 -13
  123. package/.next/server/app/messages.segments/_head.segment.rsc +4 -4
  124. package/.next/server/app/messages.segments/_index.segment.rsc +6 -6
  125. package/.next/server/app/messages.segments/_tree.segment.rsc +2 -2
  126. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +4 -4
  127. package/.next/server/app/messages.segments/messages.segment.rsc +3 -3
  128. package/.next/server/app/node/page/build-manifest.json +3 -3
  129. package/.next/server/app/node/page.js.nft.json +1 -1
  130. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  131. package/.next/server/app/node.html +2 -2
  132. package/.next/server/app/node.rsc +13 -13
  133. package/.next/server/app/node.segments/_full.segment.rsc +13 -13
  134. package/.next/server/app/node.segments/_head.segment.rsc +4 -4
  135. package/.next/server/app/node.segments/_index.segment.rsc +6 -6
  136. package/.next/server/app/node.segments/_tree.segment.rsc +2 -2
  137. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +4 -4
  138. package/.next/server/app/node.segments/node.segment.rsc +3 -3
  139. package/.next/server/app/nodes/page/build-manifest.json +3 -3
  140. package/.next/server/app/nodes/page.js.nft.json +1 -1
  141. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/nodes.html +2 -2
  143. package/.next/server/app/nodes.rsc +13 -13
  144. package/.next/server/app/nodes.segments/_full.segment.rsc +13 -13
  145. package/.next/server/app/nodes.segments/_head.segment.rsc +4 -4
  146. package/.next/server/app/nodes.segments/_index.segment.rsc +6 -6
  147. package/.next/server/app/nodes.segments/_tree.segment.rsc +2 -2
  148. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +4 -4
  149. package/.next/server/app/nodes.segments/nodes.segment.rsc +3 -3
  150. package/.next/server/app/page/build-manifest.json +3 -3
  151. package/.next/server/app/page.js.nft.json +1 -1
  152. package/.next/server/app/page_client-reference-manifest.js +1 -1
  153. package/.next/server/app/settings/networks/page/build-manifest.json +3 -3
  154. package/.next/server/app/settings/networks/page_client-reference-manifest.js +1 -1
  155. package/.next/server/app/settings/networks.html +2 -2
  156. package/.next/server/app/settings/networks.rsc +13 -13
  157. package/.next/server/app/settings/networks.segments/_full.segment.rsc +13 -13
  158. package/.next/server/app/settings/networks.segments/_head.segment.rsc +4 -4
  159. package/.next/server/app/settings/networks.segments/_index.segment.rsc +6 -6
  160. package/.next/server/app/settings/networks.segments/_tree.segment.rsc +2 -2
  161. package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +4 -4
  162. package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +3 -3
  163. package/.next/server/app/settings/networks.segments/settings.segment.rsc +3 -3
  164. package/.next/server/app/settings/page/build-manifest.json +3 -3
  165. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  166. package/.next/server/app/settings/tokens/page/build-manifest.json +3 -3
  167. package/.next/server/app/settings/tokens/page_client-reference-manifest.js +1 -1
  168. package/.next/server/app/settings/tokens.html +2 -2
  169. package/.next/server/app/settings/tokens.rsc +13 -13
  170. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +13 -13
  171. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +4 -4
  172. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +6 -6
  173. package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +2 -2
  174. package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +4 -4
  175. package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +3 -3
  176. package/.next/server/app/settings/tokens.segments/settings.segment.rsc +3 -3
  177. package/.next/server/app/settings.html +2 -2
  178. package/.next/server/app/settings.rsc +13 -13
  179. package/.next/server/app/settings.segments/_full.segment.rsc +13 -13
  180. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  181. package/.next/server/app/settings.segments/_index.segment.rsc +6 -6
  182. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  183. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  184. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  185. package/.next/server/app/tasks/[id]/page/build-manifest.json +3 -3
  186. package/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  187. package/.next/server/app/tasks/page/build-manifest.json +3 -3
  188. package/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  189. package/.next/server/app/tasks.html +2 -2
  190. package/.next/server/app/tasks.rsc +13 -13
  191. package/.next/server/app/tasks.segments/_full.segment.rsc +13 -13
  192. package/.next/server/app/tasks.segments/_head.segment.rsc +4 -4
  193. package/.next/server/app/tasks.segments/_index.segment.rsc +6 -6
  194. package/.next/server/app/tasks.segments/_tree.segment.rsc +2 -2
  195. package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +4 -4
  196. package/.next/server/app/tasks.segments/tasks.segment.rsc +3 -3
  197. package/.next/server/chunks/[root-of-the-server]__0.r9hpx._.js +3 -0
  198. package/.next/server/chunks/{[root-of-the-server]__0sywwd7._.js.map → [root-of-the-server]__0.r9hpx._.js.map} +1 -1
  199. package/.next/server/chunks/[root-of-the-server]__0.~awwb._.js +3 -0
  200. package/.next/server/chunks/{[root-of-the-server]__02up7n2._.js.map → [root-of-the-server]__0.~awwb._.js.map} +1 -1
  201. package/.next/server/chunks/[root-of-the-server]__011ghni._.js +3 -0
  202. package/.next/server/chunks/{[root-of-the-server]__0mmo75i._.js.map → [root-of-the-server]__011ghni._.js.map} +1 -1
  203. package/.next/server/chunks/[root-of-the-server]__0_roltz._.js +3 -0
  204. package/.next/server/chunks/{[root-of-the-server]__05uypa~._.js.map → [root-of-the-server]__0_roltz._.js.map} +1 -1
  205. package/.next/server/chunks/[root-of-the-server]__0ak3zmb._.js +3 -0
  206. package/.next/server/chunks/{[root-of-the-server]__0u9ppm.._.js.map → [root-of-the-server]__0ak3zmb._.js.map} +1 -1
  207. package/.next/server/chunks/[root-of-the-server]__0c0_p0v._.js +3 -0
  208. package/.next/server/chunks/{[root-of-the-server]__0uxkj4r._.js.map → [root-of-the-server]__0c0_p0v._.js.map} +1 -1
  209. package/.next/server/chunks/[root-of-the-server]__0c5h0a~._.js +3 -0
  210. package/.next/server/chunks/{[root-of-the-server]__0hz-gqk._.js.map → [root-of-the-server]__0c5h0a~._.js.map} +1 -1
  211. package/.next/server/chunks/[root-of-the-server]__0cfodg2._.js +3 -0
  212. package/.next/server/chunks/{[root-of-the-server]__0nb8029._.js.map → [root-of-the-server]__0cfodg2._.js.map} +1 -1
  213. package/.next/server/chunks/[root-of-the-server]__0fo7jlh._.js +3 -0
  214. package/.next/server/chunks/{[root-of-the-server]__0m77953._.js.map → [root-of-the-server]__0fo7jlh._.js.map} +1 -1
  215. package/.next/server/chunks/[root-of-the-server]__0hj~i84._.js +3 -0
  216. package/.next/server/chunks/{[root-of-the-server]__0nl3akl._.js.map → [root-of-the-server]__0hj~i84._.js.map} +1 -1
  217. package/.next/server/chunks/[root-of-the-server]__0hxwf9u._.js +3 -0
  218. package/.next/server/chunks/{[root-of-the-server]__13e9ex0._.js.map → [root-of-the-server]__0hxwf9u._.js.map} +1 -1
  219. package/.next/server/chunks/[root-of-the-server]__0k.vegl._.js +3 -0
  220. package/.next/server/chunks/{[root-of-the-server]__0g16ayc._.js.map → [root-of-the-server]__0k.vegl._.js.map} +1 -1
  221. package/.next/server/chunks/[root-of-the-server]__0k3eytp._.js +3 -0
  222. package/.next/server/chunks/{[root-of-the-server]__0q86a80._.js.map → [root-of-the-server]__0k3eytp._.js.map} +1 -1
  223. package/.next/server/chunks/[root-of-the-server]__0khwewd._.js +3 -0
  224. package/.next/server/chunks/{[root-of-the-server]__12s1q1.._.js.map → [root-of-the-server]__0khwewd._.js.map} +1 -1
  225. package/.next/server/chunks/[root-of-the-server]__0ku8l.~._.js +3 -0
  226. package/.next/server/chunks/{[root-of-the-server]__0344fys._.js.map → [root-of-the-server]__0ku8l.~._.js.map} +1 -1
  227. package/.next/server/chunks/[root-of-the-server]__0kx9lo1._.js +3 -0
  228. package/.next/server/chunks/{[root-of-the-server]__0o1z0_7._.js.map → [root-of-the-server]__0kx9lo1._.js.map} +1 -1
  229. package/.next/server/chunks/[root-of-the-server]__0lu__6g._.js +3 -0
  230. package/.next/server/chunks/{[root-of-the-server]__0150zad._.js.map → [root-of-the-server]__0lu__6g._.js.map} +1 -1
  231. package/.next/server/chunks/[root-of-the-server]__0nsfjkb._.js +3 -0
  232. package/.next/server/chunks/{[root-of-the-server]__0swcbs5._.js.map → [root-of-the-server]__0nsfjkb._.js.map} +1 -1
  233. package/.next/server/chunks/[root-of-the-server]__0p3fo6l._.js +1 -1
  234. package/.next/server/chunks/[root-of-the-server]__0t0.lss._.js +3 -0
  235. package/.next/server/chunks/{[root-of-the-server]__09dhh_t._.js.map → [root-of-the-server]__0t0.lss._.js.map} +1 -1
  236. package/.next/server/chunks/[root-of-the-server]__0wpe~w2._.js +3 -0
  237. package/.next/server/chunks/{[root-of-the-server]__09kj7n.._.js.map → [root-of-the-server]__0wpe~w2._.js.map} +1 -1
  238. package/.next/server/chunks/[root-of-the-server]__0x.-194._.js +3 -0
  239. package/.next/server/chunks/{[root-of-the-server]__11aui~e._.js.map → [root-of-the-server]__0x.-194._.js.map} +1 -1
  240. package/.next/server/chunks/[root-of-the-server]__10ducxb._.js +3 -0
  241. package/.next/server/chunks/{[root-of-the-server]__10439sp._.js.map → [root-of-the-server]__10ducxb._.js.map} +1 -1
  242. package/.next/server/chunks/[root-of-the-server]__10~rj8b._.js +3 -0
  243. package/.next/server/chunks/{[root-of-the-server]__0w~31ff._.js.map → [root-of-the-server]__10~rj8b._.js.map} +1 -1
  244. package/.next/server/chunks/[root-of-the-server]__114809t._.js +3 -0
  245. package/.next/server/chunks/{[root-of-the-server]__0uf_olq._.js.map → [root-of-the-server]__114809t._.js.map} +1 -1
  246. package/.next/server/chunks/[root-of-the-server]__11yl3c.._.js +3 -0
  247. package/.next/server/chunks/{[root-of-the-server]__090uiv5._.js.map → [root-of-the-server]__11yl3c.._.js.map} +1 -1
  248. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0yubv2d.js +1 -1
  249. package/.next/server/chunks/ssr/[root-of-the-server]__093ymui._.js +3 -0
  250. package/.next/server/chunks/ssr/[root-of-the-server]__093ymui._.js.map +1 -0
  251. package/.next/server/chunks/ssr/[root-of-the-server]__0nrckjd._.js +3 -0
  252. package/.next/server/chunks/ssr/[root-of-the-server]__0nrckjd._.js.map +1 -0
  253. package/.next/server/chunks/ssr/[root-of-the-server]__0xm3h9x._.js +3 -0
  254. package/.next/server/chunks/ssr/[root-of-the-server]__0xm3h9x._.js.map +1 -0
  255. package/.next/server/chunks/ssr/[root-of-the-server]__0~yad5w._.js +3 -0
  256. package/.next/server/chunks/ssr/[root-of-the-server]__0~yad5w._.js.map +1 -0
  257. package/.next/server/middleware-build-manifest.js +6 -6
  258. package/.next/server/pages/404.html +2 -2
  259. package/.next/server/pages/500.html +1 -1
  260. package/.next/static/chunks/00uwfd~z5dh.b.js +1 -0
  261. package/.next/static/chunks/{0io~i_rk3k9q3.js → 060yf6n1jdcri.js} +1 -1
  262. package/.next/static/chunks/{01bx19dpl~r6u.js → 063eleenll4ri.js} +1 -1
  263. package/.next/static/chunks/{0fpff4dxg3a5x.js → 08aj9~75raaah.js} +1 -1
  264. package/.next/static/chunks/{0xqtq9944k~ek.js → 08v0-ki6vwpxf.js} +1 -1
  265. package/.next/static/chunks/{0tb-yun7e_n3c.js → 09al3qm76q7nd.js} +1 -1
  266. package/.next/static/chunks/{12t1c0u8~txfo.js → 0afxijuigt-49.js} +1 -1
  267. package/.next/static/chunks/0bajlbn83u82v.css +2 -0
  268. package/.next/static/chunks/0dkkv90do9a4r.js +1 -0
  269. package/.next/static/chunks/{024co7ns8w7ms.js → 0ejz4zwhu3a3y.js} +1 -1
  270. package/.next/static/chunks/{0ql1nb6991-hi.js → 0h4x8zbbd__pl.js} +1 -1
  271. package/.next/static/chunks/{02w9ytw8eey3r.js → 0krweyme4bfjm.js} +1 -1
  272. package/.next/static/chunks/0ogeals5ufhho.js +1 -0
  273. package/.next/static/chunks/{15-ywchriw.vi.js → 0u359llqm1_01.js} +1 -1
  274. package/.next/static/chunks/{0~sxxils~iff..js → 0ugk4jd4e7oft.js} +1 -1
  275. package/.next/static/chunks/{0w.7_h6kx__bg.js → 0uqfv6rc-xdru.js} +1 -1
  276. package/.next/static/chunks/{11f7871-m2pu4.js → 0vlojka~d~9h4.js} +1 -1
  277. package/.next/static/chunks/0xn2oc.5gmj~v.js +1 -0
  278. package/.next/static/chunks/{0w5hxo645~s.g.js → 0xrnwfefpke-g.js} +2 -2
  279. package/.next/static/chunks/{0s4w.hhez3.xx.js → 14bsg3_-taiw4.js} +1 -1
  280. package/.next/static/chunks/{turbopack-0zklppa1rg.u8.js → turbopack-0vsvjs02l449s.js} +1 -1
  281. package/.next/trace +2 -2
  282. package/.next/trace-build +1 -1
  283. package/app/components/TaskChatPanel.tsx +68 -26
  284. package/package.json +3 -1
  285. package/.next/server/chunks/[root-of-the-server]__0150zad._.js +0 -3
  286. package/.next/server/chunks/[root-of-the-server]__02up7n2._.js +0 -3
  287. package/.next/server/chunks/[root-of-the-server]__0344fys._.js +0 -3
  288. package/.next/server/chunks/[root-of-the-server]__05uypa~._.js +0 -3
  289. package/.next/server/chunks/[root-of-the-server]__090uiv5._.js +0 -3
  290. package/.next/server/chunks/[root-of-the-server]__09dhh_t._.js +0 -3
  291. package/.next/server/chunks/[root-of-the-server]__09kj7n.._.js +0 -3
  292. package/.next/server/chunks/[root-of-the-server]__0g16ayc._.js +0 -3
  293. package/.next/server/chunks/[root-of-the-server]__0hz-gqk._.js +0 -3
  294. package/.next/server/chunks/[root-of-the-server]__0m77953._.js +0 -3
  295. package/.next/server/chunks/[root-of-the-server]__0mmo75i._.js +0 -3
  296. package/.next/server/chunks/[root-of-the-server]__0nb8029._.js +0 -3
  297. package/.next/server/chunks/[root-of-the-server]__0nl3akl._.js +0 -3
  298. package/.next/server/chunks/[root-of-the-server]__0o1z0_7._.js +0 -3
  299. package/.next/server/chunks/[root-of-the-server]__0q86a80._.js +0 -3
  300. package/.next/server/chunks/[root-of-the-server]__0swcbs5._.js +0 -3
  301. package/.next/server/chunks/[root-of-the-server]__0sywwd7._.js +0 -3
  302. package/.next/server/chunks/[root-of-the-server]__0u9ppm.._.js +0 -3
  303. package/.next/server/chunks/[root-of-the-server]__0uf_olq._.js +0 -3
  304. package/.next/server/chunks/[root-of-the-server]__0uxkj4r._.js +0 -3
  305. package/.next/server/chunks/[root-of-the-server]__0w~31ff._.js +0 -3
  306. package/.next/server/chunks/[root-of-the-server]__10439sp._.js +0 -3
  307. package/.next/server/chunks/[root-of-the-server]__11aui~e._.js +0 -3
  308. package/.next/server/chunks/[root-of-the-server]__12s1q1.._.js +0 -3
  309. package/.next/server/chunks/[root-of-the-server]__13e9ex0._.js +0 -3
  310. package/.next/server/chunks/ssr/_0s2kgzl._.js +0 -3
  311. package/.next/server/chunks/ssr/_0s2kgzl._.js.map +0 -1
  312. package/.next/server/chunks/ssr/app_05bbp~.._.js +0 -3
  313. package/.next/server/chunks/ssr/app_05bbp~.._.js.map +0 -1
  314. package/.next/server/chunks/ssr/app_0d3prqs._.js +0 -3
  315. package/.next/server/chunks/ssr/app_0d3prqs._.js.map +0 -1
  316. package/.next/server/chunks/ssr/app_0p9bx.i._.js +0 -3
  317. package/.next/server/chunks/ssr/app_0p9bx.i._.js.map +0 -1
  318. package/.next/static/chunks/06f76ht~w6c6c.js +0 -1
  319. package/.next/static/chunks/0_qu9.8wo.eq1.css +0 -2
  320. package/.next/static/chunks/0g5j6.4xxjqd3.js +0 -1
  321. package/.next/static/chunks/15cp_p75shcm9.js +0 -1
  322. /package/.next/static/{5bvXa9VuwCjy1WNEj0yoW → OhhT30BnG1-kXYvlQ_2y3}/_buildManifest.js +0 -0
  323. /package/.next/static/{5bvXa9VuwCjy1WNEj0yoW → OhhT30BnG1-kXYvlQ_2y3}/_clientMiddlewareManifest.js +0 -0
  324. /package/.next/static/{5bvXa9VuwCjy1WNEj0yoW → OhhT30BnG1-kXYvlQ_2y3}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var r=e.i(47167);e.r(16015);var a=e.r(71645),n=a&&"object"==typeof a&&"default"in a?a:{default:a},i=void 0!==r.default&&r.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},c=function(){function e(e){var t=void 0===e?{}:e,s=t.name,r=void 0===s?"stylesheet":s,a=t.optimizeForSpeed,n=void 0===a?i:a;o(l(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-deleted-rule____{}",o("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var c="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=c?c.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){o("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),o(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(o(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(o(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(r){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];o(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];o(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&o(l(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var a=document.head||document.getElementsByTagName("head")[0];return s?a.insertBefore(r,s):a.appendChild(r),r},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function o(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var d=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function x(e,t){if(!t)return"jsx-"+e;var s=String(t),r=e+s;return u[r]||(u[r]="jsx-"+d(e+"-"+s)),u[r]}function h(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,r=void 0===s?null:s,a=t.optimizeForSpeed,n=void 0!==a&&a;this._sheet=r||new c({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),r&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),r=s.styleId,a=s.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var n=a.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=n,this._instancesCounts[r]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var r=this._fromServer&&this._fromServer[s];r?(r.parentNode.removeChild(r),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],r=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,r=e.id;if(s){var a=x(r,s);return{styleId:a,rules:Array.isArray(t)?t.map(function(e){return h(a,e)}):[h(a,t)]}}return{styleId:x(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=a.createContext(null);function g(){return new m}function f(){return a.useContext(p)}p.displayName="StyleSheetContext";var y=n.default.useInsertionEffect||n.default.useLayoutEffect,b="u">typeof window?g():void 0;function v(e){var t=b||f();return t&&("u"<typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return x(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,r=a.useContext(p),i=a.useState(function(){return r||t||g()})[0];return n.default.createElement(p.Provider,{value:i},s)},s.createStyleRegistry=g,s.style=v,s.useStyleRegistry=f},21373,(e,t,s)=>{t.exports=e.r(98547).style},96527,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(18566),a=e.i(58963),n=e.i(21373),i=e.i(18150);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 c({taskId:e,onClose:r}){let[a,o]=(0,s.useState)(null),[d,u]=(0,s.useState)([]),[x,h]=(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`)]),r=await t.json(),a=await s.json();r.tasks?.[0]&&o(r.tasks[0]),u(a.events||[])}catch{}finally{h(!1)}})()},[e]);let m=a?[{label:"Created",time:a.created_at,color:"bg-gray-400"},{label:"Delivered",time:a.delivered_at,color:"bg-blue-400"},{label:"Started",time:a.started_at,color:"bg-green-400"},{label:"Completed",time:a.completed_at,color:"bg-purple-400"}]:[],p=a?.started_at&&a?.completed_at?Math.round((new Date(a.completed_at).getTime()-new Date(a.started_at).getTime())/1e3):null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:r,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 overflow-y-auto animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-5 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a] sticky top-0",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:"Task Detail"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500 mt-0.5",children:[e.slice(0,16),"..."]})]}),(0,t.jsx)("button",{onClick:r,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),x?(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 flex justify-center py-16",children:(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-6 h-6 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}):a?(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 px-5 py-5 space-y-5",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("span",{className:`jsx-c3e56cbc81656d9 text-lg font-bold ${l[a.status]||"text-gray-400"}`,children:a.status}),"normal"!==a.priority&&(0,t.jsx)("span",{className:`jsx-c3e56cbc81656d9 text-xs px-2 py-0.5 rounded border ${"high"===a.priority?"text-red-300 border-red-500/20":"text-gray-400 border-gray-600/20"}`,children:a.priority}),null!==p&&(0,t.jsxs)("span",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500",children:["⏱ ",p<60?`${p}s`:`${Math.floor(p/60)}m ${p%60}s`]})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-blue-400 font-medium",children:a.from_name||"--"}),(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-gray-600",children:"→"}),(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-cyan-400 font-medium",children:a.to_name||"--"})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-3",children:"Timeline"}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 space-y-3",children:m.map((e,s)=>(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex flex-col items-center",children:[(0,t.jsx)("div",{className:`jsx-c3e56cbc81656d9 w-3 h-3 rounded-full ${e.time?e.color:"bg-gray-700"}`}),s<m.length-1&&(0,t.jsx)("div",{className:`jsx-c3e56cbc81656d9 w-0.5 h-4 mt-1 ${e.time&&m[s+1]?.time?"bg-gray-600":"bg-gray-800"}`})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex-1",children:[(0,t.jsx)("div",{className:`jsx-c3e56cbc81656d9 text-xs font-medium ${e.time?"text-gray-300":"text-gray-600"}`,children:e.label}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:e.time||"Pending"})]})]},e.label))})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-2",children:"Input"}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm text-gray-300 whitespace-pre-wrap",children:a.content||"--"})]}),a.result&&(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-2",children:"Output"}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm text-gray-300 whitespace-pre-wrap max-h-64 overflow-y-auto",children:a.result})]}),d.length>0&&(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-2",children:["Events (",d.length,")"]}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 space-y-1.5 max-h-40 overflow-y-auto",children:d.map(e=>(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-2 text-[11px]",children:[(0,t.jsx)("span",{className:`jsx-c3e56cbc81656d9 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:"jsx-c3e56cbc81656d9 text-gray-400",children:e.event_type}),e.from_status&&(0,t.jsxs)("span",{className:"jsx-c3e56cbc81656d9 text-gray-600",children:[e.from_status,"→",e.to_status]}),(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-gray-600 ml-auto",children:(0,i.timeAgo)(e.created_at)})]},e.id))})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-600 space-y-1",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:["Task ID: ",a.task_id]}),a.expires_at&&(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:["Expires: ",a.expires_at]})]})]}):(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-center py-16 text-gray-500",children:"Task not found"})]}),(0,t.jsx)(n.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}let o=["","created","delivered","acked","running","replied","closed","failed","cancelled","expired"],d={created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-blue-500/10 text-blue-300 border-blue-500/20",acked:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-purple-500/10 text-purple-300 border-purple-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",expired:"bg-orange-500/10 text-orange-300 border-orange-500/20"};function u(e){let t=d[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 x(e){return"high"===e?"text-red-400":"low"===e?"text-gray-600":"text-gray-400"}function h(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 m(){let e,n,i,l=(0,r.useSearchParams)(),{networkId:m}=(0,a.useNetworkId)(),[p,g]=(0,s.useState)([]),[f,y]=(0,s.useState)(0),[b,v]=(0,s.useState)(!0),[j,_]=(0,s.useState)(""),[N,S]=(0,s.useState)(new Set),[w,k]=(0,s.useState)(l.get("status")||""),[C,R]=(0,s.useState)(""),[F,T]=(0,s.useState)(""),[z,$]=(0,s.useState)(null),A=(0,s.useCallback)(async()=>{try{let e=new URLSearchParams;m&&e.set("network_id",m),w&&e.set("status",w),C&&e.set("from_name",C),F&&e.set("to_name",F),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();g(s.tasks||[]),y(s.count??(s.tasks?.length||0)),_("")}catch(e){_(e instanceof Error?e.message:"fetch failed")}finally{v(!1)}},[w,C,F,m]);return(0,s.useEffect)(()=>{v(!0),A();let e=setInterval(A,5e3);return()=>clearInterval(e)},[A]),(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Tasks"}),(0,t.jsx)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30",children:f})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mb-4 bg-[#111128] rounded-lg border border-[#2a2a4a] p-1",children:["",...o.filter(Boolean)].map(e=>(0,t.jsx)("button",{onClick:()=>k(e),className:`px-3 py-1.5 rounded-md text-xs transition-colors ${w===e?`${d[e]||"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"} border`:"text-gray-500 hover:text-gray-300"}`,children:e||"All"},e))}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,t.jsx)("input",{type:"text",value:C,onChange:e=>R(e.target.value),placeholder:"From node...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-40"}),(0,t.jsx)("input",{type:"text",value:F,onChange:e=>T(e.target.value),placeholder:"To node...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-40"})]}),p.length>0&&!w&&(e={},p.forEach(t=>{e[t.status]=(e[t.status]||0)+1}),n=p.length||1,(i=[{key:"running",color:"bg-green-500",text:"text-green-400"},{key:"delivered",color:"bg-blue-500",text:"text-blue-400"},{key:"replied",color:"bg-purple-500",text:"text-purple-400"},{key:"failed",color:"bg-red-500",text:"text-red-400"},{key:"expired",color:"bg-orange-500",text:"text-orange-400"}].filter(t=>e[t.key])).length?(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-800",children:i.map(s=>(0,t.jsx)("div",{className:s.color,style:{width:`${e[s.key]/n*100}%`}},s.key))}),(0,t.jsx)("div",{className:"flex flex-wrap gap-3 mt-1.5 text-[10px] text-gray-500",children:i.map(s=>(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${s.color} mr-1`}),e[s.key]," ",s.key]},s.key))})]}):null),j&&(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:j}),b?(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===p.length?(0,t.jsxs)("div",{className:"text-center py-16",children:[(0,t.jsx)("div",{className:"text-gray-600 text-4xl mb-4",children:"--"}),(0,t.jsx)("h3",{className:"text-gray-400 text-lg font-medium mb-2",children:"No tasks found"}),(0,t.jsx)("p",{className:"text-gray-600 text-sm",children:w||C||F?"Try adjusting your filters.":"Tasks will appear here when agents send them via CommHub."})]}):(0,t.jsxs)("div",{className:"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"})]}),p.map(e=>(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 hover:border-[#3a3a5a] transition-colors cursor-pointer",onClick:()=>{var t;return t=e.task_id,void S(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},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:u(e.status),children:e.status})}),(0,t.jsx)("div",{className:"col-span-2 text-sm text-blue-400 truncate",title:e.from_name,children:e.from_name||"--"}),(0,t.jsx)("div",{className:"col-span-2 text-sm text-cyan-400 truncate",title:e.to_name,children:e.to_name||"--"}),(0,t.jsx)("div",{className:"col-span-4 text-xs text-gray-400 truncate",title:e.content,children:e.content||"--"}),(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:`text-xs ${x(e.priority)}`,children:e.priority||"normal"})}),(0,t.jsx)("div",{className:"col-span-2 text-xs text-gray-500",title:e.created_at,children:h(e.created_at)})]}),(0,t.jsxs)("div",{className:"sm:hidden space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:u(e.status),children:e.status}),(0,t.jsx)("span",{className:`text-xs ${x(e.priority)}`,children:e.priority||"normal"})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:[(0,t.jsx)("span",{className:"text-blue-400",children:e.from_name||"--"}),(0,t.jsx)("span",{className:"text-gray-600 mx-1",children:"→"}),(0,t.jsx)("span",{className:"text-cyan-400",children:e.to_name||"--"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-400 truncate",children:e.content||"--"}),(0,t.jsx)("div",{className:"text-xs text-gray-600",children:h(e.created_at)})]}),N.has(e.task_id)&&(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a] 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-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a]",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-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] 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?h(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})}),A()},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(),$(e.task_id)},className:"text-xs text-cyan-400 hover:text-cyan-300",children:"Detail →"})]})]})]})]},e.task_id))]}),z&&(0,t.jsx)(c,{taskId:z,onClose:()=>$(null)})]})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono",children:"Loading tasks..."}),children:(0,t.jsx)(m,{})})}],96527)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var r=e.i(47167);e.r(16015);var a=e.r(71645),n=a&&"object"==typeof a&&"default"in a?a:{default:a},i=void 0!==r.default&&r.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},c=function(){function e(e){var t=void 0===e?{}:e,s=t.name,r=void 0===s?"stylesheet":s,a=t.optimizeForSpeed,n=void 0===a?i:a;o(l(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-deleted-rule____{}",o("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var c="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=c?c.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){o("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),o(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(o(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(o(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(r){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];o(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];o(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&o(l(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var a=document.head||document.getElementsByTagName("head")[0];return s?a.insertBefore(r,s):a.appendChild(r),r},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function o(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var d=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function x(e,t){if(!t)return"jsx-"+e;var s=String(t),r=e+s;return u[r]||(u[r]="jsx-"+d(e+"-"+s)),u[r]}function h(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,r=void 0===s?null:s,a=t.optimizeForSpeed,n=void 0!==a&&a;this._sheet=r||new c({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),r&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),r=s.styleId,a=s.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var n=a.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=n,this._instancesCounts[r]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var r=this._fromServer&&this._fromServer[s];r?(r.parentNode.removeChild(r),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],r=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,r=e.id;if(s){var a=x(r,s);return{styleId:a,rules:Array.isArray(t)?t.map(function(e){return h(a,e)}):[h(a,t)]}}return{styleId:x(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=a.createContext(null);function g(){return new m}function f(){return a.useContext(p)}p.displayName="StyleSheetContext";var y=n.default.useInsertionEffect||n.default.useLayoutEffect,b="u">typeof window?g():void 0;function v(e){var t=b||f();return t&&("u"<typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return x(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,r=a.useContext(p),i=a.useState(function(){return r||t||g()})[0];return n.default.createElement(p.Provider,{value:i},s)},s.createStyleRegistry=g,s.style=v,s.useStyleRegistry=f},21373,(e,t,s)=>{t.exports=e.r(98547).style},96527,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(18566),a=e.i(58963),n=e.i(21373),i=e.i(18150);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 c({taskId:e,onClose:r}){let[a,o]=(0,s.useState)(null),[d,u]=(0,s.useState)([]),[x,h]=(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`)]),r=await t.json(),a=await s.json();r.tasks?.[0]&&o(r.tasks[0]),u(a.events||[])}catch{}finally{h(!1)}})()},[e]);let m=a?[{label:"Created",time:a.created_at,color:"bg-gray-400"},{label:"Delivered",time:a.delivered_at,color:"bg-blue-400"},{label:"Started",time:a.started_at,color:"bg-green-400"},{label:"Completed",time:a.completed_at,color:"bg-purple-400"}]:[],p=a?.started_at&&a?.completed_at?Math.round((new Date(a.completed_at).getTime()-new Date(a.started_at).getTime())/1e3):null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:r,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 overflow-y-auto animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-5 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a] sticky top-0",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:"Task Detail"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500 mt-0.5",children:[e.slice(0,16),"..."]})]}),(0,t.jsx)("button",{onClick:r,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),x?(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 flex justify-center py-16",children:(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-6 h-6 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}):a?(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 px-5 py-5 space-y-5",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("span",{className:`jsx-c3e56cbc81656d9 text-lg font-bold ${l[a.status]||"text-gray-400"}`,children:a.status}),"normal"!==a.priority&&(0,t.jsx)("span",{className:`jsx-c3e56cbc81656d9 text-xs px-2 py-0.5 rounded border ${"high"===a.priority?"text-red-300 border-red-500/20":"text-gray-400 border-gray-600/20"}`,children:a.priority}),null!==p&&(0,t.jsxs)("span",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500",children:["⏱ ",p<60?`${p}s`:`${Math.floor(p/60)}m ${p%60}s`]})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-blue-400 font-medium",children:a.from_name||"--"}),(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-gray-600",children:"→"}),(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-cyan-400 font-medium",children:a.to_name||"--"})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-3",children:"Timeline"}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 space-y-3",children:m.map((e,s)=>(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex flex-col items-center",children:[(0,t.jsx)("div",{className:`jsx-c3e56cbc81656d9 w-3 h-3 rounded-full ${e.time?e.color:"bg-gray-700"}`}),s<m.length-1&&(0,t.jsx)("div",{className:`jsx-c3e56cbc81656d9 w-0.5 h-4 mt-1 ${e.time&&m[s+1]?.time?"bg-gray-600":"bg-gray-800"}`})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex-1",children:[(0,t.jsx)("div",{className:`jsx-c3e56cbc81656d9 text-xs font-medium ${e.time?"text-gray-300":"text-gray-600"}`,children:e.label}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:e.time||"Pending"})]})]},e.label))})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-2",children:"Input"}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm text-gray-300 whitespace-pre-wrap",children:a.content||"--"})]}),a.result&&(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-2",children:"Output"}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm text-gray-300 whitespace-pre-wrap max-h-64 overflow-y-auto",children:a.result})]}),d.length>0&&(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 text-xs text-gray-500 uppercase mb-2",children:["Events (",d.length,")"]}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 space-y-1.5 max-h-40 overflow-y-auto",children:d.map(e=>(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-2 text-[11px]",children:[(0,t.jsx)("span",{className:`jsx-c3e56cbc81656d9 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:"jsx-c3e56cbc81656d9 text-gray-400",children:e.event_type}),e.from_status&&(0,t.jsxs)("span",{className:"jsx-c3e56cbc81656d9 text-gray-600",children:[e.from_status,"→",e.to_status]}),(0,t.jsx)("span",{className:"jsx-c3e56cbc81656d9 text-gray-600 ml-auto",children:(0,i.timeAgo)(e.created_at)})]},e.id))})]}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-600 space-y-1",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:["Task ID: ",a.task_id]}),a.expires_at&&(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:["Expires: ",a.expires_at]})]})]}):(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-center py-16 text-gray-500",children:"Task not found"})]}),(0,t.jsx)(n.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}let o=["","created","delivered","acked","running","replied","closed","failed","cancelled","expired"],d={created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-blue-500/10 text-blue-300 border-blue-500/20",acked:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-purple-500/10 text-purple-300 border-purple-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",expired:"bg-orange-500/10 text-orange-300 border-orange-500/20"};function u(e){let t=d[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 x(e){return"high"===e?"text-red-400":"low"===e?"text-gray-600":"text-gray-400"}function h(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 m(){let e,n,i,l=(0,r.useSearchParams)(),{networkId:m}=(0,a.useNetworkId)(),[p,g]=(0,s.useState)([]),[f,y]=(0,s.useState)(0),[b,v]=(0,s.useState)(!0),[j,_]=(0,s.useState)(""),[N,S]=(0,s.useState)(new Set),[w,k]=(0,s.useState)(l.get("status")||""),[C,R]=(0,s.useState)(""),[F,T]=(0,s.useState)(""),[z,$]=(0,s.useState)(null),A=(0,s.useCallback)(async()=>{try{let e=new URLSearchParams;m&&e.set("network_id",m),w&&e.set("status",w),C&&e.set("from_name",C),F&&e.set("to_name",F),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();g(s.tasks||[]),y(s.count??(s.tasks?.length||0)),_("")}catch(e){_(e instanceof Error?e.message:"fetch failed")}finally{v(!1)}},[w,C,F,m]);return(0,s.useEffect)(()=>{v(!0),A();let e=setInterval(A,5e3);return()=>clearInterval(e)},[A]),(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Tasks"}),(0,t.jsx)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30",children:f})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mb-4 bg-[#111128] rounded-lg border border-[#2a2a4a] p-1",children:["",...o.filter(Boolean)].map(e=>(0,t.jsx)("button",{onClick:()=>k(e),className:`px-3 py-1.5 rounded-md text-xs transition-colors ${w===e?`${d[e]||"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"} border`:"text-gray-500 hover:text-gray-300"}`,children:e||"All"},e))}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,t.jsx)("input",{type:"text",value:C,onChange:e=>R(e.target.value),placeholder:"From node...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-40"}),(0,t.jsx)("input",{type:"text",value:F,onChange:e=>T(e.target.value),placeholder:"To node...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-40"})]}),p.length>0&&!w&&(e={},p.forEach(t=>{e[t.status]=(e[t.status]||0)+1}),n=p.length||1,(i=[{key:"running",color:"bg-green-500",text:"text-green-400"},{key:"delivered",color:"bg-blue-500",text:"text-blue-400"},{key:"replied",color:"bg-purple-500",text:"text-purple-400"},{key:"failed",color:"bg-red-500",text:"text-red-400"},{key:"expired",color:"bg-orange-500",text:"text-orange-400"}].filter(t=>e[t.key])).length?(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-800",children:i.map(s=>(0,t.jsx)("div",{className:s.color,style:{width:`${e[s.key]/n*100}%`}},s.key))}),(0,t.jsx)("div",{className:"flex flex-wrap gap-3 mt-1.5 text-[10px] text-gray-500",children:i.map(s=>(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${s.color} mr-1`}),e[s.key]," ",s.key]},s.key))})]}):null),j&&(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:j}),b?(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===p.length?(0,t.jsxs)("div",{className:"text-center py-16",children:[(0,t.jsx)("div",{className:"text-gray-600 text-4xl mb-4",children:"--"}),(0,t.jsx)("h3",{className:"text-gray-400 text-lg font-medium mb-2",children:"No tasks found"}),(0,t.jsx)("p",{className:"text-gray-600 text-sm",children:w||C||F?"Try adjusting your filters.":"Tasks will appear here when agents send them via CommHub."})]}):(0,t.jsxs)("div",{className:"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"})]}),p.map(e=>(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 hover:border-[#3a3a5a] transition-colors cursor-pointer",onClick:()=>{var t;return t=e.task_id,void S(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},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:u(e.status),children:e.status})}),(0,t.jsx)("div",{className:"col-span-2 text-sm text-blue-400 truncate",title:e.from_name,children:e.from_name||"--"}),(0,t.jsx)("div",{className:"col-span-2 text-sm text-cyan-400 truncate",title:e.to_name,children:e.to_name||"--"}),(0,t.jsx)("div",{className:"col-span-4 text-xs text-gray-400 truncate",title:e.content,children:e.content||"--"}),(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:`text-xs ${x(e.priority)}`,children:e.priority||"normal"})}),(0,t.jsx)("div",{className:"col-span-2 text-xs text-gray-500",title:e.created_at,children:h(e.created_at)})]}),(0,t.jsxs)("div",{className:"sm:hidden space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:u(e.status),children:e.status}),(0,t.jsx)("span",{className:`text-xs ${x(e.priority)}`,children:e.priority||"normal"})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:[(0,t.jsx)("span",{className:"text-blue-400",children:e.from_name||"--"}),(0,t.jsx)("span",{className:"text-gray-600 mx-1",children:"→"}),(0,t.jsx)("span",{className:"text-cyan-400",children:e.to_name||"--"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-400 truncate",children:e.content||"--"}),(0,t.jsx)("div",{className:"text-xs text-gray-600",children:h(e.created_at)})]}),N.has(e.task_id)&&(0,t.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a] 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-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a]",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-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] 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?h(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})}),A()},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(),$(e.task_id)},className:"text-xs text-cyan-400 hover:text-cyan-300",children:"Detail →"})]})]})]})]},e.task_id))]}),z&&(0,t.jsx)(c,{taskId:z,onClose:()=>$(null)})]})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono",children:"Loading tasks..."}),children:(0,t.jsx)(m,{})})}],96527)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},65822,e=>{"use strict";var t=e.i(83599),s=e.i(58963);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 l(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}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",a,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:n}=(0,s.useNetworkId)(),{data:i,error:o,isLoading:d}=(0,t.default)(l(`/api/hub/messages?limit=${e}`,n),a,r);return{messages:i?.messages||[],error:o,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:n,error:i,isLoading:o}=(0,t.default)(l("/api/hub/status",e),a,r);return{sessions:n?.sessions||[],hint:n?._hint,error:i,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:n,error:i}=(0,t.default)(l("/api/hub/stats",e),a,r);return{stats:n?.ok?n:null,error:i}},"useTasks",0,function(e){let{networkId:n}=(0,s.useNetworkId)(),i=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:d,isLoading:c}=(0,t.default)(l(`/api/hub/tasks?${i}`,n),a,r);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:d,isLoading:c}}])},23261,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(65822),r=e.i(18150);e.s(["default",0,function(){let{sessions:e}=(0,a.useSessions)(),{health:l}=(0,a.useHealth)(),{stats:n}=(0,a.useStats)(),i=l?.sse_sessions||{},[o,d]=(0,s.useState)(""),[c,u]=(0,s.useState)(""),[x,h]=(0,s.useState)(""),[m,g]=(0,s.useState)(""),[b,p]=(0,s.useState)(""),[f,y]=(0,s.useState)(""),[j,N]=(0,s.useState)(""),[v,w]=(0,s.useState)(""),k=async()=>{if(o.trim()&&c.trim()){try{let e=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"register",username:o,password:c})}),t=await e.json();h(t.ok?`Created: ${t.user.username} (${t.user.user_id})`:`Failed: ${t.error}`),t.ok&&(d(""),u(""))}catch{h("Failed")}setTimeout(()=>h(""),8e3)}},S=async()=>{if(m.trim()){try{let e=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:m})}),t=await e.json();p(t.ok?`Sent to ${t.recipients} nodes`:`Failed: ${t.error}`),t.ok&&g("")}catch{p("Failed")}setTimeout(()=>p(""),5e3)}},T=async()=>{if(f&&j.trim()){try{let e=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:f,task:j})}),t=await e.json();w(t.ok?"Task sent":`Failed: ${t.error}`),t.ok&&N("")}catch{w("Failed")}setTimeout(()=>w(""),5e3)}},$=e.filter(e=>i[e.alias]),C=e.filter(e=>!i[e.alias]);return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white mb-6 lg:ml-0 ml-10",children:"Admin"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 max-w-6xl",children:[(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-green-400 tabular-nums",children:$.length}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Online"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-gray-500 tabular-nums",children:C.length}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Offline"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-cyan-400 tabular-nums",children:l?.sse_connections??"--"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"SSE Connections"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-white tabular-nums",children:n?.tasks?.total??"--"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Total Tasks"})]})]}),n?.tasks?.by_status&&n.tasks.by_status.length>0&&(0,t.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:n.tasks.by_status.map(e=>(0,t.jsxs)("span",{className:"text-xs px-2 py-1 rounded bg-[#0a0a15] border border-[#1a1a2a] text-gray-400",children:[e.status,": ",e.count]},e.status))})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Broadcast"}),(0,t.jsx)("textarea",{value:m,onChange:e=>g(e.target.value),placeholder:"Message to all online nodes...",rows:3,className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none resize-none"}),(0,t.jsxs)("div",{className:"flex justify-between items-center mt-3",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-600",children:[m.length,"/500"]}),(0,t.jsx)("button",{onClick:S,disabled:!m.trim(),className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Broadcast"})]}),b&&(0,t.jsx)("div",{className:`mt-2 text-xs ${b.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:b})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Send Task"}),(0,t.jsxs)("select",{value:f,onChange:e=>y(e.target.value),className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white focus:border-cyan-500/50 focus:outline-none mb-3",children:[(0,t.jsx)("option",{value:"",children:"Select target node..."}),$.map(e=>(0,t.jsxs)("option",{value:e.alias,children:[e.alias," (",e.status,")"]},e.alias)),(0,t.jsx)("optgroup",{label:"Offline",children:C.map(e=>(0,t.jsxs)("option",{value:e.alias,children:[e.alias," (offline)"]},e.alias))})]}),(0,t.jsx)("textarea",{value:j,onChange:e=>N(e.target.value),placeholder:"Task content...",rows:3,className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none resize-none"}),(0,t.jsx)("div",{className:"flex justify-end mt-3",children:(0,t.jsx)("button",{onClick:T,disabled:!f||!j.trim(),className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Send Task"})}),v&&(0,t.jsx)("div",{className:`mt-2 text-xs ${v.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:v})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:["Online Sessions ",(0,t.jsxs)("span",{className:"text-gray-600",children:["(",$.length,")"]})]}),(0,t.jsx)("div",{className:"space-y-2 max-h-80 overflow-y-auto",children:0===$.length?(0,t.jsx)("div",{className:"text-xs text-gray-600 text-center py-4",children:"No online sessions"}):$.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a]",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-sm text-white font-medium truncate",children:e.alias}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 truncate",children:[e.agent||"--"," · ",e.task||"idle"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded border ${"working"===e.status?"bg-green-900/30 text-green-300 border-green-800/30":"bg-blue-900/30 text-blue-300 border-blue-800/30"}`,children:e.status}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,r.timeAgo)(e.updated_at)})]})]},e.alias))})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Register User (V3)"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("input",{type:"text",value:o,onChange:e=>d(e.target.value),placeholder:"Username",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,t.jsx)("input",{type:"password",value:c,onChange:e=>u(e.target.value),placeholder:"Password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,t.jsx)("button",{onClick:k,disabled:!o.trim()||!c.trim(),className:"w-full px-4 py-2 bg-green-600 hover:bg-green-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Register"})]}),x&&(0,t.jsx)("div",{className:`mt-2 text-xs ${x.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:x})]})]})]})}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},65822,e=>{"use strict";var t=e.i(83599),s=e.i(58963);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 l(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}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",a,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:n}=(0,s.useNetworkId)(),{data:i,error:o,isLoading:d}=(0,t.default)(l(`/api/hub/messages?limit=${e}`,n),a,r);return{messages:i?.messages||[],error:o,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:n,error:i,isLoading:o}=(0,t.default)(l("/api/hub/status",e),a,r);return{sessions:n?.sessions||[],hint:n?._hint,error:i,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:n,error:i}=(0,t.default)(l("/api/hub/stats",e),a,r);return{stats:n?.ok?n:null,error:i}},"useTasks",0,function(e){let{networkId:n}=(0,s.useNetworkId)(),i=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:d,isLoading:c}=(0,t.default)(l(`/api/hub/tasks?${i}`,n),a,r);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:d,isLoading:c}}])},23261,e=>{"use strict";var t=e.i(18050),s=e.i(71645),a=e.i(65822),r=e.i(18150);e.s(["default",0,function(){let{sessions:e}=(0,a.useSessions)(),{health:l}=(0,a.useHealth)(),{stats:n}=(0,a.useStats)(),i=l?.sse_sessions||{},[o,d]=(0,s.useState)(""),[c,u]=(0,s.useState)(""),[x,h]=(0,s.useState)(""),[m,g]=(0,s.useState)(""),[b,p]=(0,s.useState)(""),[f,y]=(0,s.useState)(""),[j,N]=(0,s.useState)(""),[v,w]=(0,s.useState)(""),k=async()=>{if(o.trim()&&c.trim()){try{let e=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"register",username:o,password:c})}),t=await e.json();h(t.ok?`Created: ${t.user.username} (${t.user.user_id})`:`Failed: ${t.error}`),t.ok&&(d(""),u(""))}catch{h("Failed")}setTimeout(()=>h(""),8e3)}},S=async()=>{if(m.trim()){try{let e=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:m})}),t=await e.json();p(t.ok?`Sent to ${t.recipients} nodes`:`Failed: ${t.error}`),t.ok&&g("")}catch{p("Failed")}setTimeout(()=>p(""),5e3)}},T=async()=>{if(f&&j.trim()){try{let e=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:f,task:j})}),t=await e.json();w(t.ok?"Task sent":`Failed: ${t.error}`),t.ok&&N("")}catch{w("Failed")}setTimeout(()=>w(""),5e3)}},$=e.filter(e=>i[e.alias]),C=e.filter(e=>!i[e.alias]);return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white mb-6 lg:ml-0 ml-10",children:"Admin"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 max-w-6xl",children:[(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-green-400 tabular-nums",children:$.length}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Online"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-gray-500 tabular-nums",children:C.length}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Offline"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-cyan-400 tabular-nums",children:l?.sse_connections??"--"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"SSE Connections"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-3xl font-bold text-white tabular-nums",children:n?.tasks?.total??"--"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Total Tasks"})]})]}),n?.tasks?.by_status&&n.tasks.by_status.length>0&&(0,t.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:n.tasks.by_status.map(e=>(0,t.jsxs)("span",{className:"text-xs px-2 py-1 rounded bg-[#0a0a15] border border-[#1a1a2a] text-gray-400",children:[e.status,": ",e.count]},e.status))})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Broadcast"}),(0,t.jsx)("textarea",{value:m,onChange:e=>g(e.target.value),placeholder:"Message to all online nodes...",rows:3,className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none resize-none"}),(0,t.jsxs)("div",{className:"flex justify-between items-center mt-3",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-600",children:[m.length,"/500"]}),(0,t.jsx)("button",{onClick:S,disabled:!m.trim(),className:"px-4 py-2 bg-purple-600 hover:bg-purple-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Broadcast"})]}),b&&(0,t.jsx)("div",{className:`mt-2 text-xs ${b.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:b})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Send Task"}),(0,t.jsxs)("select",{value:f,onChange:e=>y(e.target.value),className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white focus:border-cyan-500/50 focus:outline-none mb-3",children:[(0,t.jsx)("option",{value:"",children:"Select target node..."}),$.map(e=>(0,t.jsxs)("option",{value:e.alias,children:[e.alias," (",e.status,")"]},e.alias)),(0,t.jsx)("optgroup",{label:"Offline",children:C.map(e=>(0,t.jsxs)("option",{value:e.alias,children:[e.alias," (offline)"]},e.alias))})]}),(0,t.jsx)("textarea",{value:j,onChange:e=>N(e.target.value),placeholder:"Task content...",rows:3,className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none resize-none"}),(0,t.jsx)("div",{className:"flex justify-end mt-3",children:(0,t.jsx)("button",{onClick:T,disabled:!f||!j.trim(),className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Send Task"})}),v&&(0,t.jsx)("div",{className:`mt-2 text-xs ${v.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:v})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:["Online Sessions ",(0,t.jsxs)("span",{className:"text-gray-600",children:["(",$.length,")"]})]}),(0,t.jsx)("div",{className:"space-y-2 max-h-80 overflow-y-auto",children:0===$.length?(0,t.jsx)("div",{className:"text-xs text-gray-600 text-center py-4",children:"No online sessions"}):$.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a]",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-sm text-white font-medium truncate",children:e.alias}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 truncate",children:[e.agent||"--"," · ",e.task||"idle"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded border ${"working"===e.status?"bg-green-900/30 text-green-300 border-green-800/30":"bg-blue-900/30 text-blue-300 border-blue-800/30"}`,children:e.status}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,r.timeAgo)(e.updated_at)})]})]},e.alias))})]}),(0,t.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Register User (V3)"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("input",{type:"text",value:o,onChange:e=>d(e.target.value),placeholder:"Username",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,t.jsx)("input",{type:"password",value:c,onChange:e=>u(e.target.value),placeholder:"Password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,t.jsx)("button",{onClick:k,disabled:!o.trim()||!c.trim(),className:"w-full px-4 py-2 bg-green-600 hover:bg-green-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Register"})]}),x&&(0,t.jsx)("div",{className:`mt-2 text-xs ${x.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:x})]})]})]})}])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31713,e=>{"use strict";var t=e.i(47167),s=e.i(43476),a=e.i(71645),r=e.i(22016),l=e.i(18150);function n({online:e,working:t,total:a,version:r,uptime:l}){let i=a>0?Math.round(e/a*100):0;return(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Agent Network"}),(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:["CommHub ",r," · ",l]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,s.jsx)(o,{value:e,label:"Online",sub:`${i}% of fleet`,color:"text-green-400",accent:"from-green-500/20 to-green-500/0",border:"border-green-500/15"}),(0,s.jsx)(o,{value:t,label:"Working",sub:e>0?`${Math.round(t/e*100)}% utilization`:"--",color:"text-cyan-400",accent:"from-cyan-500/20 to-cyan-500/0",border:"border-cyan-500/15"}),(0,s.jsx)(o,{value:a-e,label:"Offline",sub:a-e==0?"All systems go":`${a-e} disconnected`,color:"text-gray-400",accent:"from-gray-500/10 to-gray-500/0",border:"border-gray-500/15"}),(0,s.jsx)(o,{value:a,label:"Total",sub:"Registered nodes",color:"text-white",accent:"from-blue-500/15 to-blue-500/0",border:"border-blue-500/15"})]})]})}function o({value:e,label:t,sub:a,color:r,accent:l,border:n}){return(0,s.jsxs)("div",{className:`relative overflow-hidden rounded-xl border ${n} bg-[#111128] px-4 py-3`,children:[(0,s.jsx)("div",{className:`absolute inset-0 bg-gradient-to-br ${l} pointer-events-none`}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:`text-3xl font-bold ${r} tabular-nums leading-tight`,children:e}),(0,s.jsx)("div",{className:"text-sm text-gray-300 mt-0.5",children:t}),(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:a})]})]})}function i(){let[e,t]=(0,a.useState)(""),[r,l]=(0,a.useState)(!1),[n,o]=(0,a.useState)(""),i=async()=>{if(e.trim()){l(!0),o("");try{let s=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e})}),a=await s.json();a.ok?(o(`Broadcast sent to ${a.recipients} node(s)`),t("")):o(`Failed: ${a.error||"Send error"}`)}catch(e){o(`Failed: ${e instanceof Error?e.message:"Send error"}`)}l(!1),setTimeout(()=>o(""),5e3)}};return(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onKeyDown:e=>"Enter"===e.key&&i(),placeholder:"Broadcast message to all online agents...",maxLength:500,"aria-label":"Broadcast message",className:"flex-1 bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:ring-1 focus:ring-blue-500/20 focus:outline-none transition-colors"}),(0,s.jsx)("button",{onClick:i,disabled:r||!e.trim(),"aria-label":"Send broadcast",className:"px-5 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-all font-medium cursor-pointer disabled:cursor-not-allowed",children:r?"Sending...":"Broadcast"})]}),e.length>0&&(0,s.jsxs)("div",{className:"text-right text-xs text-gray-600 mt-1",children:[e.length,"/500"]}),n&&(0,s.jsx)("div",{className:`mt-3 text-sm text-center ${n.startsWith("Failed")?"text-red-400":"text-green-400/80"} animate-fade-in`,children:n})]})}function d(e,t,s){let a=t<=2?Math.PI:1.78*Math.PI,r=-Math.PI/2-a/2,l=t<=1?-Math.PI/2:r+a*e/(t-1);return{x:500+s*Math.cos(l),y:330+s*Math.sin(l)}}function c(e,t,s=0){let a=(e.x+t.x)/2,r=(e.y+t.y)/2,l=t.x-e.x,n=t.y-e.y,o=Math.hypot(l,n)||1,i={x:a+-n/o*s,y:r+l/o*s};return`M${e.x},${e.y} Q${i.x},${i.y} ${t.x},${t.y}`}function x(e,t){return e.length>t?`${e.slice(0,t-1)}...`:e}function u({sessions:e,sseSessions:t}){let[r,l]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await fetch("/api/hub/messages?limit=50");if(401===e.status)return void window.location.assign("/login");let t=await e.json();l(t.messages||[])}catch{}};e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let{onlineNodes:n,offlineNodes:o,nodePositions:i,flowLinks:h,activeAliases:m}=(0,a.useMemo)(()=>{let s,a=e.filter(e=>"offline"!==e.status||t[e.alias]),l=e.filter(e=>"offline"===e.status&&!t[e.alias]),n={};a.forEach((e,t)=>{n[e.alias]=d(t,Math.max(a.length,1),220)}),l.forEach((e,t)=>{n[e.alias]=d(t,Math.max(l.length,1),315)});let o=(s=new Map,r.forEach(e=>{if(!n[e.from_alias]||!n[e.to_alias]||e.from_alias===e.to_alias)return;let t=`${e.from_alias}->${e.to_alias}`,a=s.get(t);s.set(t,{key:t,from:e.from_alias,to:e.to_alias,count:(a?.count||0)+1,content:a?.content||e.content})}),[...s.values()].slice(0,18)),i=new Set;return o.forEach(e=>{i.add(e.from),i.add(e.to)}),{onlineNodes:a,offlineNodes:l,nodePositions:n,flowLinks:o,activeAliases:i}},[r,e,t]),g=n.filter(e=>"working"===e.status).length;return(0,s.jsxs)("section",{className:"w-full max-w-6xl mx-auto mb-8",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between mb-3 px-1",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs uppercase text-gray-600 tracking-wider",children:"Network Topology"}),(0,s.jsx)("h2",{className:"text-lg text-white font-semibold",children:"Command mesh"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,s.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20",children:[g," working"]}),(0,s.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20",children:[n.length," online"]}),(0,s.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20",children:[h.length," active links"]})]})]}),(0,s.jsxs)("div",{className:"relative overflow-hidden rounded-lg border border-[#2a2a4a] bg-[#080814] shadow-2xl shadow-cyan-950/30",children:[(0,s.jsx)("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-cyan-400/70 to-transparent"}),(0,s.jsxs)("svg",{viewBox:"0 0 1000 680",className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"topo-panel",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#0b1220"}),(0,s.jsx)("stop",{offset:"48%",stopColor:"#080814"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#101018"})]}),(0,s.jsxs)("radialGradient",{id:"topo-radar",cx:"50%",cy:"50%",r:"55%",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#22d3ee",stopOpacity:"0.18"}),(0,s.jsx)("stop",{offset:"45%",stopColor:"#22c55e",stopOpacity:"0.045"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#020617",stopOpacity:"0"})]}),(0,s.jsxs)("filter",{id:"topo-glow",children:[(0,s.jsx)("feGaussianBlur",{stdDeviation:"4",result:"blur"}),(0,s.jsxs)("feMerge",{children:[(0,s.jsx)("feMergeNode",{in:"blur"}),(0,s.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),(0,s.jsx)("marker",{id:"topo-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:(0,s.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#67e8f9"})})]}),(0,s.jsx)("rect",{width:"1000",height:"680",fill:"url(#topo-panel)"}),(0,s.jsx)("circle",{cx:500,cy:330,r:"330",fill:"url(#topo-radar)"}),[90,170,250,330].map(e=>(0,s.jsx)("circle",{cx:500,cy:330,r:e,fill:"none",stroke:"#164e63",strokeWidth:"1",opacity:"0.35"},e)),[0,30,60,90,120,150].map(e=>(0,s.jsx)("line",{x1:500-360*Math.cos(e*Math.PI/180),y1:330-360*Math.sin(e*Math.PI/180),x2:500+360*Math.cos(e*Math.PI/180),y2:330+360*Math.sin(e*Math.PI/180),stroke:"#164e63",strokeWidth:"1",opacity:"0.18"},e)),n.map(e=>{let t=i[e.alias];if(!t)return null;let a=c({x:500,y:330},t,0);return(0,s.jsx)("path",{d:a,fill:"none",stroke:m.has(e.alias)?"#22d3ee":"#155e75",strokeWidth:m.has(e.alias)?2:1,strokeDasharray:m.has(e.alias)?"none":"8 10",opacity:m.has(e.alias)?.65:.35},`hub-${e.alias}`)}),h.map((e,t)=>{let a=i[e.from],r=i[e.to];if(!a||!r)return null;let l=c(a,r,t%2==0?36:-36),n=Math.min(2+e.count,7);return(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d:l,fill:"none",stroke:"#67e8f9",strokeWidth:n,opacity:"0.28",filter:"url(#topo-glow)",markerEnd:"url(#topo-arrow)"}),(0,s.jsx)("path",{id:`flow-path-${t}`,d:l,fill:"none",stroke:"#e0f2fe",strokeWidth:"1",strokeDasharray:"2 12",opacity:"0.75"}),(0,s.jsx)("circle",{r:"4",fill:"#fef08a",filter:"url(#topo-glow)",children:(0,s.jsx)("animateMotion",{dur:`${2.2+t%5*.32}s`,repeatCount:"indefinite",path:l})})]},e.key)}),(0,s.jsxs)("g",{filter:"url(#topo-glow)",children:[(0,s.jsx)("circle",{cx:500,cy:330,r:"56",fill:"#020617",stroke:"#67e8f9",strokeWidth:"2"}),(0,s.jsxs)("circle",{cx:500,cy:330,r:"42",fill:"none",stroke:"#22c55e",strokeWidth:"1.5",opacity:"0.8",children:[(0,s.jsx)("animate",{attributeName:"r",values:"42;52;42",dur:"3s",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"opacity",values:"0.8;0.2;0.8",dur:"3s",repeatCount:"indefinite"})]}),(0,s.jsx)("path",{d:"M470 330 h60 M500 300 v60",stroke:"#e0f2fe",strokeWidth:"5",strokeLinecap:"round",opacity:"0.9"}),(0,s.jsx)("text",{x:500,y:408,textAnchor:"middle",fill:"#e5e7eb",fontSize:"16",fontFamily:"monospace",fontWeight:"700",children:"DASHBOARD"}),(0,s.jsx)("text",{x:500,y:426,textAnchor:"middle",fill:"#64748b",fontSize:"10",fontFamily:"monospace",children:"command relay"})]}),[...n,...o].map(e=>{let a=i[e.alias];if(!a)return null;let r="offline"!==e.status||!!t[e.alias],l=r?"working"===e.status?{label:"working",primary:"#22c55e",halo:"#14532d",text:"#dcfce7"}:"idle"===e.status?{label:"idle",primary:"#2dd4bf",halo:"#134e4a",text:"#ccfbf1"}:{label:e.status||"online",primary:"#38bdf8",halo:"#0c4a6e",text:"#e0f2fe"}:{label:"offline",primary:"#6b7280",halo:"#111827",text:"#9ca3af"},n=m.has(e.alias),o=r?26:18;return(0,s.jsxs)("g",{className:"transition-opacity",children:[n&&(0,s.jsxs)("circle",{cx:a.x,cy:a.y,r:o+14,fill:l.primary,opacity:"0.12",children:[(0,s.jsx)("animate",{attributeName:"r",values:`${o+8};${o+22};${o+8}`,dur:"2.4s",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"opacity",values:"0.18;0.04;0.18",dur:"2.4s",repeatCount:"indefinite"})]}),(0,s.jsx)("circle",{cx:a.x,cy:a.y,r:o+8,fill:l.halo,opacity:r?.55:.25}),(0,s.jsx)("circle",{cx:a.x,cy:a.y,r:o,fill:r?"#020617":"#080814",stroke:l.primary,strokeWidth:r?3:1.5,strokeDasharray:r?"none":"5 5",filter:r?"url(#topo-glow)":void 0}),(0,s.jsx)("circle",{cx:a.x,cy:a.y,r:r?8:5,fill:l.primary}),"working"===e.status&&(0,s.jsx)("path",{d:`M${a.x-9},${a.y+11} h18`,stroke:"#fef08a",strokeWidth:"3",strokeLinecap:"round",children:(0,s.jsx)("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"})}),(0,s.jsxs)("g",{transform:`translate(${a.x}, ${a.y+o+22})`,children:[(0,s.jsx)("rect",{x:"-62",y:"-14",width:"124",height:"42",rx:"6",fill:"#020617",stroke:"#1f2937",opacity:"0.94"}),(0,s.jsx)("text",{x:"0",y:"1",textAnchor:"middle",fill:l.text,fontSize:"12",fontFamily:"monospace",fontWeight:"700",children:x(e.alias,14)}),(0,s.jsxs)("text",{x:"0",y:"17",textAnchor:"middle",fill:l.primary,fontSize:"9",fontFamily:"monospace",children:[l.label," ",r?`sse:${t[e.alias]}`:""]})]})]},e.alias)}),(0,s.jsxs)("g",{transform:"translate(28, 34)",children:[(0,s.jsx)("rect",{x:"0",y:"0",width:"285",height:60+20*Math.min(h.length,4),rx:"8",fill:"#020617",stroke:"#1f2937",opacity:"0.94"}),(0,s.jsx)("text",{x:"16",y:"26",fill:"#e5e7eb",fontSize:"13",fontFamily:"monospace",fontWeight:"700",children:"recent signal"}),(0,s.jsxs)("text",{x:"178",y:"26",fill:"#67e8f9",fontSize:"11",fontFamily:"monospace",children:[r.length," messages"]}),h.slice(0,4).map((e,t)=>(0,s.jsxs)("text",{x:"16",y:54+20*t,fill:"#94a3b8",fontSize:"10",fontFamily:"monospace",children:[x(e.from,8)," ","->"," ",x(e.to,8)," / ",e.count," / ",x(e.content,18)]},e.key))]}),(0,s.jsxs)("g",{transform:"translate(720, 34)",children:[(0,s.jsx)("rect",{x:"0",y:"0",width:"250",height:"112",rx:"8",fill:"#020617",stroke:"#1f2937",opacity:"0.94"}),(0,s.jsx)("circle",{cx:"18",cy:"26",r:"6",fill:"#22c55e"}),(0,s.jsx)("text",{x:"34",y:"30",fill:"#94a3b8",fontSize:"11",fontFamily:"monospace",children:"working node"}),(0,s.jsx)("circle",{cx:"18",cy:"52",r:"6",fill:"#2dd4bf"}),(0,s.jsx)("text",{x:"34",y:"56",fill:"#94a3b8",fontSize:"11",fontFamily:"monospace",children:"online idle"}),(0,s.jsx)("circle",{cx:"18",cy:"78",r:"6",fill:"#6b7280"}),(0,s.jsx)("text",{x:"34",y:"82",fill:"#94a3b8",fontSize:"11",fontFamily:"monospace",children:"offline / no SSE"}),(0,s.jsx)("path",{d:"M150,78 Q176,52 210,78",fill:"none",stroke:"#67e8f9",strokeWidth:"3",markerEnd:"url(#topo-arrow)"})]})]})]})]})}let h={working:{bg:"bg-green-900/30 border-green-800/30",text:"text-green-300",dot:"bg-green-500",glow:"shadow-green-500/10"},idle:{bg:"bg-cyan-900/30 border-cyan-800/30",text:"text-cyan-300",dot:"bg-cyan-400",glow:"shadow-cyan-500/5"},blocked:{bg:"bg-yellow-900/30 border-yellow-800/30",text:"text-yellow-300",dot:"bg-yellow-500",glow:""},error:{bg:"bg-red-900/30 border-red-800/30",text:"text-red-300",dot:"bg-red-500",glow:""}},m={bg:"bg-gray-800/50 border-gray-700/30",text:"text-gray-500",dot:"bg-gray-500",glow:""};function g({session:e,hasSse:t,sseCount:a,onChat:n}){let o=t&&h[e.status]||m;return(0,s.jsxs)(r.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,prefetch:!1,className:`block rounded-xl border p-4 transition-all duration-300 cursor-pointer ${t?`bg-[#111128] border-[#2a2a4a] hover:border-cyan-500/30 hover:shadow-lg ${o.glow}`:"bg-[#0d0d1a] border-[#1a1a2a] opacity-40"}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsx)("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${o.dot} ${t&&"working"===e.status?"animate-pulse":""}`}),(0,s.jsx)("span",{className:"font-semibold text-white truncate text-sm",title:e.alias,children:e.alias})]}),(0,s.jsx)("span",{className:`text-[11px] px-2 py-0.5 rounded-md border shrink-0 ${o.bg} ${o.text}`,children:t?e.status:"offline"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)("span",{className:"text-xs text-gray-600 bg-[#0a0a15] px-2 py-0.5 rounded border border-[#1a1a2a]",children:e.agent||"unknown"}),t&&(0,s.jsxs)("span",{className:"text-[10px] text-green-500",children:["SSE:",a]})]}),e.task?(0,s.jsx)("div",{className:"text-xs text-gray-400 bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] line-clamp-2",title:e.task,children:e.task}):(0,s.jsx)("div",{className:"text-xs text-gray-700 italic",children:"No active task"}),e.progress>0&&(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsxs)("div",{className:"flex justify-between text-[10px] mb-1",children:[(0,s.jsx)("span",{className:"text-gray-600",children:"Progress"}),(0,s.jsxs)("span",{className:o.text,children:[e.progress,"%"]})]}),(0,s.jsx)("div",{className:"w-full bg-gray-800 rounded-full h-1.5 overflow-hidden",children:(0,s.jsx)("div",{className:`h-1.5 rounded-full transition-all duration-700 ${"working"===e.status?"bg-green-500":"bg-cyan-500"}`,style:{width:`${Math.min(e.progress,100)}%`}})})]}),(0,s.jsxs)("div",{className:"mt-3 flex justify-between items-center text-[10px] text-gray-600",children:[(0,s.jsx)("span",{children:e.server||"--"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[n&&t&&(0,s.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e.alias)},className:"text-cyan-400 hover:text-cyan-300 px-1.5 py-0.5 rounded border border-cyan-500/20 hover:bg-cyan-500/10 transition-colors",children:"Chat"}),(0,s.jsx)("span",{children:(0,l.timeAgo)(e.updated_at)})]})]})]})}function f({messages:e}){return 0===e.length?null:(0,s.jsxs)("div",{className:"mt-8",children:[(0,s.jsxs)("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Inbox"}),(0,s.jsx)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30",children:e.length})]}),(0,s.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto pr-1 scrollbar-thin",children:e.map(e=>(0,s.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm transition-colors hover:border-[#3a3a5a]",children:[(0,s.jsxs)("div",{className:"flex justify-between text-xs text-gray-500 mb-1.5",children:[(0,s.jsx)("span",{className:"text-blue-400 font-medium",children:e.from_session}),(0,s.jsx)("span",{children:e.created_at})]}),(0,s.jsx)("div",{className:"text-gray-300 leading-relaxed",children:e.content})]},e.id))})]})}function b(){return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono animate-pulse",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"h-7 w-48 bg-gray-800 rounded mb-2"}),(0,s.jsx)("div",{className:"h-4 w-64 bg-gray-800/60 rounded"})]}),(0,s.jsx)("div",{className:"flex gap-3",children:[1,2,3].map(e=>(0,s.jsx)("div",{className:"w-[72px] h-[60px] bg-gray-800/40 rounded-lg border border-gray-800"},e))})]}),(0,s.jsxs)("div",{className:"mb-6 flex gap-2",children:[(0,s.jsx)("div",{className:"flex-1 h-10 bg-gray-800/40 rounded-lg"}),(0,s.jsx)("div",{className:"w-28 h-10 bg-gray-800/40 rounded-lg"})]}),(0,s.jsx)("div",{className:"w-full max-w-4xl mx-auto mb-8 h-64 bg-gray-800/20 rounded-xl"}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,s.jsxs)("div",{className:"rounded-xl border border-gray-800/40 p-4 bg-gray-800/20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-gray-700"}),(0,s.jsx)("div",{className:"h-4 w-24 bg-gray-700 rounded"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{className:"h-3 w-full bg-gray-800/60 rounded"}),(0,s.jsx)("div",{className:"h-3 w-3/4 bg-gray-800/60 rounded"}),(0,s.jsx)("div",{className:"h-3 w-1/2 bg-gray-800/60 rounded"})]})]},e))})]})}function p({hint:e}){return(0,s.jsxs)("div",{className:"text-center py-16",children:[(0,s.jsx)("div",{className:"text-gray-600 text-4xl mb-4",children:"--"}),(0,s.jsx)("h3",{className:"text-gray-400 text-lg font-medium mb-2",children:"No agents in this network"}),e?.global_count?(0,s.jsxs)("p",{className:"text-gray-500 text-sm max-w-md mx-auto",children:["Server has ",(0,s.jsx)("span",{className:"text-cyan-400 font-medium",children:e.global_count})," nodes globally, but none are registered to the current network. Switch network or contact admin."]}):(0,s.jsx)("p",{className:"text-gray-600 text-sm max-w-md mx-auto",children:"Agent sessions will appear here once they connect to the CommHub."})]})}var y=e.i(58963);function j(){let{setNetworkId:e}=(0,y.useNetworkId)(),[t,r]=(0,a.useState)({user:null,networks:[],currentNetwork:"",token:""}),[l,n]=(0,a.useState)(!1),[o,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[x,u]=(0,a.useState)(""),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=sessionStorage.getItem("anet_v3_auth");if(e)try{r(JSON.parse(e))}catch{}},[]);let[g,f]=(0,a.useState)(!1),[b,p]=(0,a.useState)(""),[j,v]=(0,a.useState)(""),w=async()=>{try{await fetch(`/api/hub/auth?token=${t.token}&endpoint=/api/auth/me`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:b,email:j})});let e=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:b,email:j})}),s=await e.json();if(s.ok&&s.user){let e={...t,user:s.user};r(e),sessionStorage.setItem("anet_v3_auth",JSON.stringify(e)),f(!1)}}catch{}};if(!t.user)return null;let N=(t.user.display_name||t.user.username).slice(0,2).toUpperCase();return(0,s.jsxs)("div",{className:"flex items-center justify-between bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-xs font-bold text-white",children:N}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-white font-medium",children:t.user.display_name||t.user.username}),(0,s.jsxs)("div",{className:"text-[10px] text-gray-500",children:[t.user.role," · ",t.user.user_id]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[t.networks.length>0&&(0,s.jsx)("select",{value:t.currentNetwork,onChange:s=>{let a={...t,currentNetwork:s.target.value};r(a),e(s.target.value),sessionStorage.setItem("anet_v3_auth",JSON.stringify(a))},className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white focus:outline-none",children:t.networks.map(e=>(0,s.jsx)("option",{value:e.network_id,children:e.network_name},e.network_id))}),(0,s.jsx)("button",{onClick:()=>{p(t.user?.display_name||""),v(""),f(!g)},className:"text-xs text-gray-500 hover:text-gray-300",children:"Edit"}),(0,s.jsx)("button",{onClick:()=>{r({user:null,networks:[],currentNetwork:"",token:""}),sessionStorage.removeItem("anet_v3_auth")},className:"text-xs text-gray-500 hover:text-gray-300",children:"Sign out"})]}),g&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#2a2a4a]",children:[(0,s.jsx)("input",{type:"text",value:b,onChange:e=>p(e.target.value),placeholder:"Display name",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-32"}),(0,s.jsx)("input",{type:"email",value:j,onChange:e=>v(e.target.value),placeholder:"Email",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-40"}),(0,s.jsx)("button",{onClick:w,className:"px-2 py-1 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded",children:"Save"})]})]})}var v=e.i(21373),w=e.i(58442);function N({tabs:e,activeTab:t,onOpenTab:a,onCloseTab:r,onSetActive:l,onClose:n}){return 0===e.length?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{onClick:n,className:"jsx-f7cf3d1a6fdfc074 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,s.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,s.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 flex items-center border-b border-[#2a2a4a] bg-[#0d0d1a] overflow-x-auto",children:[(0,s.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 flex min-w-0",children:e.map(e=>(0,s.jsxs)("button",{onClick:()=>l(e),className:`jsx-f7cf3d1a6fdfc074 flex items-center gap-1.5 px-3 py-2.5 text-xs border-b-2 transition-colors shrink-0 ${t===e?"border-cyan-400 text-cyan-300 bg-cyan-500/5":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,s.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 w-2 h-2 rounded-full ${t===e?"bg-cyan-400":"bg-gray-600"}`}),(0,s.jsx)("span",{className:"jsx-f7cf3d1a6fdfc074 max-w-[80px] truncate",children:e}),(0,s.jsx)("button",{onClick:t=>{t.stopPropagation(),r(e)},className:"jsx-f7cf3d1a6fdfc074 ml-1 text-gray-600 hover:text-gray-300 p-0.5",children:"×"})]},e))}),(0,s.jsx)("button",{onClick:n,className:"jsx-f7cf3d1a6fdfc074 text-gray-500 hover:text-white px-3 py-2.5 shrink-0 border-l border-[#2a2a4a]",children:(0,s.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-f7cf3d1a6fdfc074 w-4 h-4",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-f7cf3d1a6fdfc074"})})})]}),(0,s.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 relative overflow-hidden",children:e.map(e=>(0,s.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 absolute inset-0 ${t===e?"block":"hidden"}`,children:(0,s.jsx)(k,{alias:e})},e))})]}),(0,s.jsx)(v.default,{id:"f7cf3d1a6fdfc074",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}function k({alias:e}){return(0,s.jsx)(w.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0})}function S({sessions:e,onClose:t}){let[r,l]=(0,a.useState)(new Set),[n,o]=(0,a.useState)(""),[i,d]=(0,a.useState)("normal"),[c,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)([]),[m,g]=(0,a.useState)(""),f=e.filter(e=>"offline"!==e.status).filter(e=>!m||e.alias.toLowerCase().includes(m.toLowerCase())||(e.agent||"").toLowerCase().includes(m.toLowerCase())),b=async()=>{if(!n.trim()||0===r.size||c)return;x(!0),h([]);let e=[...r].map(async e=>{try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:n,priority:i})}),s=await t.json();return{alias:e,ok:!!s.ok,error:s.error}}catch(t){return{alias:e,ok:!1,error:"send failed"}}});h(await Promise.all(e)),x(!1)},p=u.filter(e=>e.ok).length;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:t}),(0,s.jsxs)("div",{className:"fixed inset-4 lg:inset-x-[15%] lg:inset-y-[5%] bg-[#0a0a1a] border border-[#2a2a4a] rounded-2xl z-50 flex flex-col shadow-2xl shadow-black/70 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-bold text-white",children:"Dispatch Task"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Send a task to one or more agents"})]}),(0,s.jsx)("button",{onClick:t,className:"text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden",children:[(0,s.jsxs)("div",{className:"lg:w-[280px] border-b lg:border-b-0 lg:border-r border-[#2a2a4a] flex flex-col",children:[(0,s.jsxs)("div",{className:"px-4 py-3 border-b border-[#2a2a4a]",children:[(0,s.jsx)("input",{type:"text",value:m,onChange:e=>g(e.target.value),placeholder:"Filter agents...",className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,s.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,s.jsx)("button",{onClick:()=>{r.size===f.length?l(new Set):l(new Set(f.map(e=>e.alias)))},className:"text-[10px] text-cyan-400 hover:text-cyan-300",children:r.size===f.length?"Deselect all":`Select all (${f.length})`}),(0,s.jsxs)("span",{className:"text-[10px] text-gray-600",children:[r.size," selected"]})]})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5 max-h-[200px] lg:max-h-none",children:[f.map(e=>(0,s.jsxs)("button",{onClick:()=>{var t;return t=e.alias,void l(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-left transition-colors ${r.has(e.alias)?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/20":"text-gray-400 hover:bg-[#1a1a2a]"}`,children:[(0,s.jsx)("div",{className:`w-2 h-2 rounded-full shrink-0 ${"working"===e.status?"bg-green-400":"idle"===e.status?"bg-cyan-400":"bg-gray-500"}`}),(0,s.jsx)("span",{className:"truncate flex-1",children:e.alias}),(0,s.jsx)("span",{className:"text-[9px] text-gray-600",children:e.agent||"--"})]},e.alias)),0===f.length&&(0,s.jsx)("div",{className:"text-center text-xs text-gray-600 py-4",children:"No online agents"})]})]}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,s.jsxs)("div",{className:"flex-1 px-6 py-4 flex flex-col",children:[(0,s.jsx)("label",{className:"text-xs text-gray-500 uppercase mb-2",children:"Task Prompt"}),(0,s.jsx)("textarea",{value:n,onChange:e=>o(e.target.value),placeholder:"Enter the task you want to dispatch...",className:"flex-1 min-h-[120px] bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none"}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[(0,s.jsxs)("select",{value:i,onChange:e=>d(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white focus:outline-none",children:[(0,s.jsx)("option",{value:"normal",children:"Normal priority"}),(0,s.jsx)("option",{value:"high",children:"High priority"}),(0,s.jsx)("option",{value:"low",children:"Low priority"})]}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsx)("button",{onClick:b,disabled:c||!n.trim()||0===r.size,className:"px-6 py-2.5 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 disabled:from-gray-800 disabled:to-gray-800 disabled:text-gray-600 text-white text-sm font-medium rounded-xl transition-all shadow-lg shadow-cyan-500/10 disabled:shadow-none active:scale-95",children:c?(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Sending..."]}):`Dispatch to ${r.size} agent${r.size>1?"s":""}`})]})]}),u.length>0&&(0,s.jsxs)("div",{className:"px-6 py-3 border-t border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,s.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:[p,"/",u.length," dispatched successfully"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:u.map(e=>(0,s.jsxs)("span",{className:`text-[10px] px-2 py-0.5 rounded-full border ${e.ok?"text-green-300 border-green-500/20 bg-green-500/5":"text-red-300 border-red-500/20 bg-red-500/5"}`,children:[e.alias,": ",e.ok?"✓":e.error||"✗"]},e.alias))})]})]})]})]})]})}var C=e.i(65822),$=e.i(71235);e.s(["default",0,function(){(0,a.useEffect)(()=>{sessionStorage.getItem("anet_v3_auth")||(fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login"))},[]);let{sessions:e,hint:o,error:d,isLoading:c}=(0,C.useSessions)(),{health:x}=(0,C.useHealth)(),{config:h}=(0,C.useAnetConfig)(),{tasks:m}=(0,C.useTasks)({limit:"500"}),{stats:y}=(0,C.useStats)(),{license:v}=(0,C.useLicense)(),[w,k]=(0,a.useState)(window.innerWidth>=1024),[_,M]=(0,a.useState)(!1),T=function(){let[e,t]=(0,a.useState)([]),[s,r]=(0,a.useState)("");return{tabs:e,activeTab:s,openTab:e=>{t(t=>t.includes(e)?t:[...t,e]),r(e)},closeTab:e=>{t(t=>{let a=t.filter(t=>t!==e);return s===e&&r(a[a.length-1]||""),a})},closeAll:()=>{t([]),r("")},setActiveTab:r}}(),[A,E]=(0,a.useState)(!1),[z,L]=(0,a.useState)([]),{mutate:O}=(0,$.useSWRConfig)(),{connected:P,supported:W}=function({url:e,onEvent:t,reconnectDelay:s=3e3,enabled:r=!0}){let[l,n]=(0,a.useState)(!1),[o,i]=(0,a.useState)(null),[d,c]=(0,a.useState)(null),x=(0,a.useRef)(null),u=(0,a.useRef)(void 0),h=(0,a.useRef)(!1),m=(0,a.useRef)(null),g=(0,a.useRef)(!1),f=(0,a.useCallback)(()=>{if(!r||!e||h.current||g.current)return;x.current&&(x.current.close(),x.current=null),m.current&&m.current.abort();let a=e.includes("?")?`${e}&probe=1`:`${e}?probe=1`,l=new AbortController;m.current=l;let o=setTimeout(()=>l.abort(),5e3);fetch(a,{method:"HEAD",cache:"no-store",signal:l.signal}).finally(()=>clearTimeout(o)).then(a=>{if(g.current)return;if("true"!==a.headers.get("x-anet-sse-available")){h.current=!0,n(!1),c(!1);return}c(!0);let r=new EventSource(e);x.current=r,r.onopen=()=>n(!0),r.onmessage=e=>{try{let s=JSON.parse(e.data);i(s),t?.(s)}catch{}},r.onerror=()=>{n(!1),r.close(),x.current=null,g.current||(u.current=setTimeout(f,s))}}).catch(()=>{g.current||(n(!1),c(!1))})},[e,t,s,r]);return(0,a.useEffect)(()=>(h.current=!1,g.current=!1,c(!!r&&null),f(),()=>{g.current=!0,m.current&&(m.current.abort(),m.current=null),x.current&&(x.current.close(),x.current=null),u.current&&clearTimeout(u.current)}),[f]),{connected:l,lastEvent:o,supported:d}}({url:"/api/hub/events",enabled:"1"!==t.default.env.NEXT_PUBLIC_DISABLE_SSE,onEvent:e=>{["new_task","new_message","new_reply","node_status_changed","broadcast"].includes(e.type)&&(O("/api/hub/status"),O(e=>"string"==typeof e&&e.startsWith("/api/hub/tasks"),void 0,{revalidate:!0}))}});if((0,a.useEffect)(()=>{let e=()=>{fetch("/api/hub/inbox").then(e=>e.json()).then(e=>{e.messages?.length&&L(t=>{let s=new Set(t.map(e=>e.id));return[...e.messages.filter(e=>!s.has(e.id)),...t].slice(0,100)})}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),c)return(0,s.jsx)(b,{});let I=x?.sse_sessions||{},F=e=>"offline"!==e.status||!!I[e.alias],B=e.filter(F).length,D=e.length,R=e.filter(e=>"working"===e.status).length,H=x?(0,l.formatUptime)(x.uptime):"--",J=x?.version||"--",U=!!(h?.hub&&h.tokenConfigured),G=h?.source==="file"?"Local config":h?.source==="runtime-env"?"Runtime env":"Config missing",K={};if(y?.tasks?.by_status?.length)for(let e of y.tasks.by_status)K[e.status]=e.count;else for(let e of m)K[e.status]=(K[e.status]||0)+1;let Q=[...e].sort((e,t)=>{let s=+!!F(e),a=+!!F(t);if(s!==a)return a-s;let r=+("working"===e.status);return("working"===t.status)-r});return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,s.jsx)("div",{className:"lg:ml-0 ml-10",children:(0,s.jsx)(n,{online:B,working:R,total:D,version:J,uptime:H})}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,s.jsx)("button",{onClick:()=>E(!0),className:"px-4 py-2 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white text-sm font-medium rounded-xl shadow-lg shadow-cyan-500/10 transition-all active:scale-95 shrink-0",children:"⚡ Dispatch"}),(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsx)(j,{})})]}),(0,s.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,s.jsxs)("button",{onClick:()=>M(!_),className:"w-full flex items-center justify-between text-left",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("span",{className:"uppercase text-gray-600",children:"Config"}),(0,s.jsx)("span",{className:`w-2 h-2 rounded-full ${U?"bg-green-400":"bg-red-400"}`}),(0,s.jsx)("span",{className:"text-gray-500",children:G})]}),(0,s.jsx)("svg",{className:`w-4 h-4 text-gray-600 transition-transform ${_?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),_&&(0,s.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a]",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("div",{className:"text-gray-100 truncate text-sm",title:h?.hub||void 0,children:["Hub: ",(0,s.jsx)("span",{className:h?.hub?"text-cyan-300":"text-red-300",children:h?.hub?.trim()||"not configured"})]})}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 text-xs",children:(0,s.jsxs)("span",{className:`px-2.5 py-1 rounded-md border ${h?.tokenConfigured?"bg-blue-500/5 text-blue-300 border-blue-500/20":"bg-gray-500/5 text-gray-400 border-gray-500/20"}`,children:["Token: ",h?.tokenPreview||"not configured"]})})]}),h?.error&&(0,s.jsx)("div",{className:"mt-2 text-xs text-gray-600",children:h.error})]})]}),Object.keys(K).length>0&&(0,s.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("div",{className:"text-xs uppercase text-gray-600",children:"Task Status"}),(0,s.jsx)(r.default,{href:"/tasks",prefetch:!1,className:"text-xs text-cyan-400 hover:text-cyan-300",children:"View all →"})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:[{key:"running",color:"bg-green-500/10 text-green-300 border-green-500/20"},{key:"delivered",color:"bg-blue-500/10 text-blue-300 border-blue-500/20"},{key:"acked",color:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"},{key:"replied",color:"bg-purple-500/10 text-purple-300 border-purple-500/20"},{key:"failed",color:"bg-red-500/10 text-red-300 border-red-500/20"},{key:"cancelled",color:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20"},{key:"expired",color:"bg-orange-500/10 text-orange-300 border-orange-500/20"},{key:"closed",color:"bg-gray-500/10 text-gray-500 border-gray-500/20"}].filter(({key:e})=>K[e]).map(({key:e,color:t})=>(0,s.jsxs)(r.default,{href:`/tasks?status=${e}`,prefetch:!1,className:`px-2.5 py-1 rounded-md border text-xs ${t} hover:opacity-80 transition-opacity`,children:[e,": ",K[e]]},e))})]}),(0,s.jsx)("section",{className:"mb-6 grid grid-cols-3 sm:grid-cols-6 gap-2",children:[{href:"/nodes",label:"Nodes",value:`${B}/${D}`,color:"text-green-400 border-green-500/15"},{href:"/tasks",label:"Tasks",value:String(Object.values(K).reduce((e,t)=>e+t,0)||"--"),color:"text-cyan-400 border-cyan-500/15"},{href:"/tasks?status=failed",label:"Failed",value:String(K.failed||0),color:K.failed?"text-red-400 border-red-500/20":"text-gray-600 border-gray-700/30"},{href:"/messages",label:"Messages",value:"→",color:"text-blue-400 border-blue-500/15"},{href:"/logs",label:"Logs",value:"→",color:"text-purple-400 border-purple-500/15"},{href:"/admin",label:"Admin",value:"→",color:"text-gray-400 border-gray-500/15"}].map(e=>(0,s.jsxs)(r.default,{href:e.href,prefetch:!1,className:`text-center rounded-xl border ${e.color} bg-[#111128] px-3 py-2.5 hover:bg-[#161630] transition-colors`,children:[(0,s.jsx)("div",{className:`text-lg font-bold tabular-nums ${e.color.split(" ")[0]}`,children:e.value}),(0,s.jsx)("div",{className:"text-[10px] text-gray-500",children:e.label})]},e.href))}),(0,s.jsx)(i,{}),m.length>0&&(0,s.jsxs)("section",{className:"mb-6 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Recent Activity"}),(0,s.jsx)(r.default,{href:"/tasks",className:"text-xs text-cyan-400 hover:text-cyan-300",children:"All tasks →"})]}),(0,s.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:m.slice(0,5).map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"replied"===e.status?"bg-purple-400":"running"===e.status?"bg-green-400":"failed"===e.status?"bg-red-400":"bg-blue-400"}`}),(0,s.jsx)("span",{className:"text-blue-400 shrink-0",children:e.from_name||"?"}),(0,s.jsx)("span",{className:"text-gray-600",children:"→"}),(0,s.jsx)("span",{className:"text-cyan-400 shrink-0",children:e.to_name||"?"}),(0,s.jsx)("span",{className:"text-gray-500 truncate flex-1",children:e.content?.slice(0,40)||"--"}),(0,s.jsx)("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] border ${"replied"===e.status?"text-purple-300 border-purple-500/20":"failed"===e.status?"text-red-300 border-red-500/20":"text-gray-500 border-gray-700/30"}`,children:e.status})]},e.task_id))})]}),d&&(0,s.jsxs)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-3 rounded-lg mb-6 text-sm flex items-center justify-between",role:"alert",children:[(0,s.jsx)("span",{children:String(d)}),(0,s.jsx)("span",{className:"text-gray-500 text-xs",children:"Check CommHub connection"})]}),e.length>0&&(0,s.jsx)("div",{className:"flex justify-center mb-4",children:(0,s.jsx)("button",{onClick:()=>k(!w),className:"text-xs text-gray-500 hover:text-gray-300 border border-gray-700/50 px-4 py-1.5 rounded-lg transition-colors hover:border-gray-600 cursor-pointer",children:w?"Hide Topology":"Show Topology"})}),!w&&e.length>0&&(0,s.jsx)("div",{className:"lg:hidden text-center text-xs text-gray-600 mb-4",children:"Topology hidden on mobile for better readability"}),w&&e.length>0&&(0,s.jsx)(u,{sessions:e,sseSessions:I}),0!==e.length||d?(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4",children:Q.map(e=>(0,s.jsx)(g,{session:e,hasSse:F(e),sseCount:I[e.alias]||0,onChat:T.openTab},e.alias))}):(0,s.jsx)(p,{hint:o}),(0,s.jsx)(f,{messages:z}),(0,s.jsxs)("div",{className:"mt-8 text-center text-xs text-gray-600 flex items-center justify-center gap-2 flex-wrap",children:[W&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${P?"bg-green-400":"bg-gray-600"}`}),P?"SSE live":"SWR polling"]}),v?.license&&(0,s.jsxs)(s.Fragment,{children:[W&&(0,s.jsx)(s.Fragment,{children:"·"}),(0,s.jsxs)("span",{className:v.license.days_left<=7?"text-red-400":"pro"===v.license.type?"text-green-400":"text-yellow-400",children:[v.license.type," (",v.license.days_left,"d left)"]})]})]}),A&&(0,s.jsx)(S,{sessions:e,onClose:()=>E(!1)}),T.tabs.length>0&&(0,s.jsx)(N,{tabs:T.tabs,activeTab:T.activeTab,onOpenTab:T.openTab,onCloseTab:T.closeTab,onSetActive:T.setActiveTab,onClose:T.closeAll})]})}],31713)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31713,e=>{"use strict";var t=e.i(47167),s=e.i(18050),a=e.i(71645),r=e.i(22016),l=e.i(18150);function n({online:e,working:t,total:a,version:r,uptime:l}){let i=a>0?Math.round(e/a*100):0;return(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Agent Network"}),(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:["CommHub ",r," · ",l]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,s.jsx)(o,{value:e,label:"Online",sub:`${i}% of fleet`,color:"text-green-400",accent:"from-green-500/20 to-green-500/0",border:"border-green-500/15"}),(0,s.jsx)(o,{value:t,label:"Working",sub:e>0?`${Math.round(t/e*100)}% utilization`:"--",color:"text-cyan-400",accent:"from-cyan-500/20 to-cyan-500/0",border:"border-cyan-500/15"}),(0,s.jsx)(o,{value:a-e,label:"Offline",sub:a-e==0?"All systems go":`${a-e} disconnected`,color:"text-gray-400",accent:"from-gray-500/10 to-gray-500/0",border:"border-gray-500/15"}),(0,s.jsx)(o,{value:a,label:"Total",sub:"Registered nodes",color:"text-white",accent:"from-blue-500/15 to-blue-500/0",border:"border-blue-500/15"})]})]})}function o({value:e,label:t,sub:a,color:r,accent:l,border:n}){return(0,s.jsxs)("div",{className:`relative overflow-hidden rounded-xl border ${n} bg-[#111128] px-4 py-3`,children:[(0,s.jsx)("div",{className:`absolute inset-0 bg-gradient-to-br ${l} pointer-events-none`}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:`text-3xl font-bold ${r} tabular-nums leading-tight`,children:e}),(0,s.jsx)("div",{className:"text-sm text-gray-300 mt-0.5",children:t}),(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:a})]})]})}function i(){let[e,t]=(0,a.useState)(""),[r,l]=(0,a.useState)(!1),[n,o]=(0,a.useState)(""),i=async()=>{if(e.trim()){l(!0),o("");try{let s=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e})}),a=await s.json();a.ok?(o(`Broadcast sent to ${a.recipients} node(s)`),t("")):o(`Failed: ${a.error||"Send error"}`)}catch(e){o(`Failed: ${e instanceof Error?e.message:"Send error"}`)}l(!1),setTimeout(()=>o(""),5e3)}};return(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onKeyDown:e=>"Enter"===e.key&&i(),placeholder:"Broadcast message to all online agents...",maxLength:500,"aria-label":"Broadcast message",className:"flex-1 bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:ring-1 focus:ring-blue-500/20 focus:outline-none transition-colors"}),(0,s.jsx)("button",{onClick:i,disabled:r||!e.trim(),"aria-label":"Send broadcast",className:"px-5 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-all font-medium cursor-pointer disabled:cursor-not-allowed",children:r?"Sending...":"Broadcast"})]}),e.length>0&&(0,s.jsxs)("div",{className:"text-right text-xs text-gray-600 mt-1",children:[e.length,"/500"]}),n&&(0,s.jsx)("div",{className:`mt-3 text-sm text-center ${n.startsWith("Failed")?"text-red-400":"text-green-400/80"} animate-fade-in`,children:n})]})}function d(e,t,s){let a=t<=2?Math.PI:1.78*Math.PI,r=-Math.PI/2-a/2,l=t<=1?-Math.PI/2:r+a*e/(t-1);return{x:500+s*Math.cos(l),y:330+s*Math.sin(l)}}function c(e,t,s=0){let a=(e.x+t.x)/2,r=(e.y+t.y)/2,l=t.x-e.x,n=t.y-e.y,o=Math.hypot(l,n)||1,i={x:a+-n/o*s,y:r+l/o*s};return`M${e.x},${e.y} Q${i.x},${i.y} ${t.x},${t.y}`}function x(e,t){return e.length>t?`${e.slice(0,t-1)}...`:e}function u({sessions:e,sseSessions:t}){let[r,l]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await fetch("/api/hub/messages?limit=50");if(401===e.status)return void window.location.assign("/login");let t=await e.json();l(t.messages||[])}catch{}};e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let{onlineNodes:n,offlineNodes:o,nodePositions:i,flowLinks:h,activeAliases:m}=(0,a.useMemo)(()=>{let s,a=e.filter(e=>"offline"!==e.status||t[e.alias]),l=e.filter(e=>"offline"===e.status&&!t[e.alias]),n={};a.forEach((e,t)=>{n[e.alias]=d(t,Math.max(a.length,1),220)}),l.forEach((e,t)=>{n[e.alias]=d(t,Math.max(l.length,1),315)});let o=(s=new Map,r.forEach(e=>{if(!n[e.from_alias]||!n[e.to_alias]||e.from_alias===e.to_alias)return;let t=`${e.from_alias}->${e.to_alias}`,a=s.get(t);s.set(t,{key:t,from:e.from_alias,to:e.to_alias,count:(a?.count||0)+1,content:a?.content||e.content})}),[...s.values()].slice(0,18)),i=new Set;return o.forEach(e=>{i.add(e.from),i.add(e.to)}),{onlineNodes:a,offlineNodes:l,nodePositions:n,flowLinks:o,activeAliases:i}},[r,e,t]),g=n.filter(e=>"working"===e.status).length;return(0,s.jsxs)("section",{className:"w-full max-w-6xl mx-auto mb-8",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between mb-3 px-1",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs uppercase text-gray-600 tracking-wider",children:"Network Topology"}),(0,s.jsx)("h2",{className:"text-lg text-white font-semibold",children:"Command mesh"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,s.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20",children:[g," working"]}),(0,s.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20",children:[n.length," online"]}),(0,s.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20",children:[h.length," active links"]})]})]}),(0,s.jsxs)("div",{className:"relative overflow-hidden rounded-lg border border-[#2a2a4a] bg-[#080814] shadow-2xl shadow-cyan-950/30",children:[(0,s.jsx)("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-cyan-400/70 to-transparent"}),(0,s.jsxs)("svg",{viewBox:"0 0 1000 680",className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"topo-panel",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#0b1220"}),(0,s.jsx)("stop",{offset:"48%",stopColor:"#080814"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#101018"})]}),(0,s.jsxs)("radialGradient",{id:"topo-radar",cx:"50%",cy:"50%",r:"55%",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#22d3ee",stopOpacity:"0.18"}),(0,s.jsx)("stop",{offset:"45%",stopColor:"#22c55e",stopOpacity:"0.045"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#020617",stopOpacity:"0"})]}),(0,s.jsxs)("filter",{id:"topo-glow",children:[(0,s.jsx)("feGaussianBlur",{stdDeviation:"4",result:"blur"}),(0,s.jsxs)("feMerge",{children:[(0,s.jsx)("feMergeNode",{in:"blur"}),(0,s.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),(0,s.jsx)("marker",{id:"topo-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:(0,s.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#67e8f9"})})]}),(0,s.jsx)("rect",{width:"1000",height:"680",fill:"url(#topo-panel)"}),(0,s.jsx)("circle",{cx:500,cy:330,r:"330",fill:"url(#topo-radar)"}),[90,170,250,330].map(e=>(0,s.jsx)("circle",{cx:500,cy:330,r:e,fill:"none",stroke:"#164e63",strokeWidth:"1",opacity:"0.35"},e)),[0,30,60,90,120,150].map(e=>(0,s.jsx)("line",{x1:500-360*Math.cos(e*Math.PI/180),y1:330-360*Math.sin(e*Math.PI/180),x2:500+360*Math.cos(e*Math.PI/180),y2:330+360*Math.sin(e*Math.PI/180),stroke:"#164e63",strokeWidth:"1",opacity:"0.18"},e)),n.map(e=>{let t=i[e.alias];if(!t)return null;let a=c({x:500,y:330},t,0);return(0,s.jsx)("path",{d:a,fill:"none",stroke:m.has(e.alias)?"#22d3ee":"#155e75",strokeWidth:m.has(e.alias)?2:1,strokeDasharray:m.has(e.alias)?"none":"8 10",opacity:m.has(e.alias)?.65:.35},`hub-${e.alias}`)}),h.map((e,t)=>{let a=i[e.from],r=i[e.to];if(!a||!r)return null;let l=c(a,r,t%2==0?36:-36),n=Math.min(2+e.count,7);return(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d:l,fill:"none",stroke:"#67e8f9",strokeWidth:n,opacity:"0.28",filter:"url(#topo-glow)",markerEnd:"url(#topo-arrow)"}),(0,s.jsx)("path",{id:`flow-path-${t}`,d:l,fill:"none",stroke:"#e0f2fe",strokeWidth:"1",strokeDasharray:"2 12",opacity:"0.75"}),(0,s.jsx)("circle",{r:"4",fill:"#fef08a",filter:"url(#topo-glow)",children:(0,s.jsx)("animateMotion",{dur:`${2.2+t%5*.32}s`,repeatCount:"indefinite",path:l})})]},e.key)}),(0,s.jsxs)("g",{filter:"url(#topo-glow)",children:[(0,s.jsx)("circle",{cx:500,cy:330,r:"56",fill:"#020617",stroke:"#67e8f9",strokeWidth:"2"}),(0,s.jsxs)("circle",{cx:500,cy:330,r:"42",fill:"none",stroke:"#22c55e",strokeWidth:"1.5",opacity:"0.8",children:[(0,s.jsx)("animate",{attributeName:"r",values:"42;52;42",dur:"3s",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"opacity",values:"0.8;0.2;0.8",dur:"3s",repeatCount:"indefinite"})]}),(0,s.jsx)("path",{d:"M470 330 h60 M500 300 v60",stroke:"#e0f2fe",strokeWidth:"5",strokeLinecap:"round",opacity:"0.9"}),(0,s.jsx)("text",{x:500,y:408,textAnchor:"middle",fill:"#e5e7eb",fontSize:"16",fontFamily:"monospace",fontWeight:"700",children:"DASHBOARD"}),(0,s.jsx)("text",{x:500,y:426,textAnchor:"middle",fill:"#64748b",fontSize:"10",fontFamily:"monospace",children:"command relay"})]}),[...n,...o].map(e=>{let a=i[e.alias];if(!a)return null;let r="offline"!==e.status||!!t[e.alias],l=r?"working"===e.status?{label:"working",primary:"#22c55e",halo:"#14532d",text:"#dcfce7"}:"idle"===e.status?{label:"idle",primary:"#2dd4bf",halo:"#134e4a",text:"#ccfbf1"}:{label:e.status||"online",primary:"#38bdf8",halo:"#0c4a6e",text:"#e0f2fe"}:{label:"offline",primary:"#6b7280",halo:"#111827",text:"#9ca3af"},n=m.has(e.alias),o=r?26:18;return(0,s.jsxs)("g",{className:"transition-opacity",children:[n&&(0,s.jsxs)("circle",{cx:a.x,cy:a.y,r:o+14,fill:l.primary,opacity:"0.12",children:[(0,s.jsx)("animate",{attributeName:"r",values:`${o+8};${o+22};${o+8}`,dur:"2.4s",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"opacity",values:"0.18;0.04;0.18",dur:"2.4s",repeatCount:"indefinite"})]}),(0,s.jsx)("circle",{cx:a.x,cy:a.y,r:o+8,fill:l.halo,opacity:r?.55:.25}),(0,s.jsx)("circle",{cx:a.x,cy:a.y,r:o,fill:r?"#020617":"#080814",stroke:l.primary,strokeWidth:r?3:1.5,strokeDasharray:r?"none":"5 5",filter:r?"url(#topo-glow)":void 0}),(0,s.jsx)("circle",{cx:a.x,cy:a.y,r:r?8:5,fill:l.primary}),"working"===e.status&&(0,s.jsx)("path",{d:`M${a.x-9},${a.y+11} h18`,stroke:"#fef08a",strokeWidth:"3",strokeLinecap:"round",children:(0,s.jsx)("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"})}),(0,s.jsxs)("g",{transform:`translate(${a.x}, ${a.y+o+22})`,children:[(0,s.jsx)("rect",{x:"-62",y:"-14",width:"124",height:"42",rx:"6",fill:"#020617",stroke:"#1f2937",opacity:"0.94"}),(0,s.jsx)("text",{x:"0",y:"1",textAnchor:"middle",fill:l.text,fontSize:"12",fontFamily:"monospace",fontWeight:"700",children:x(e.alias,14)}),(0,s.jsxs)("text",{x:"0",y:"17",textAnchor:"middle",fill:l.primary,fontSize:"9",fontFamily:"monospace",children:[l.label," ",r?`sse:${t[e.alias]}`:""]})]})]},e.alias)}),(0,s.jsxs)("g",{transform:"translate(28, 34)",children:[(0,s.jsx)("rect",{x:"0",y:"0",width:"285",height:60+20*Math.min(h.length,4),rx:"8",fill:"#020617",stroke:"#1f2937",opacity:"0.94"}),(0,s.jsx)("text",{x:"16",y:"26",fill:"#e5e7eb",fontSize:"13",fontFamily:"monospace",fontWeight:"700",children:"recent signal"}),(0,s.jsxs)("text",{x:"178",y:"26",fill:"#67e8f9",fontSize:"11",fontFamily:"monospace",children:[r.length," messages"]}),h.slice(0,4).map((e,t)=>(0,s.jsxs)("text",{x:"16",y:54+20*t,fill:"#94a3b8",fontSize:"10",fontFamily:"monospace",children:[x(e.from,8)," ","->"," ",x(e.to,8)," / ",e.count," / ",x(e.content,18)]},e.key))]}),(0,s.jsxs)("g",{transform:"translate(720, 34)",children:[(0,s.jsx)("rect",{x:"0",y:"0",width:"250",height:"112",rx:"8",fill:"#020617",stroke:"#1f2937",opacity:"0.94"}),(0,s.jsx)("circle",{cx:"18",cy:"26",r:"6",fill:"#22c55e"}),(0,s.jsx)("text",{x:"34",y:"30",fill:"#94a3b8",fontSize:"11",fontFamily:"monospace",children:"working node"}),(0,s.jsx)("circle",{cx:"18",cy:"52",r:"6",fill:"#2dd4bf"}),(0,s.jsx)("text",{x:"34",y:"56",fill:"#94a3b8",fontSize:"11",fontFamily:"monospace",children:"online idle"}),(0,s.jsx)("circle",{cx:"18",cy:"78",r:"6",fill:"#6b7280"}),(0,s.jsx)("text",{x:"34",y:"82",fill:"#94a3b8",fontSize:"11",fontFamily:"monospace",children:"offline / no SSE"}),(0,s.jsx)("path",{d:"M150,78 Q176,52 210,78",fill:"none",stroke:"#67e8f9",strokeWidth:"3",markerEnd:"url(#topo-arrow)"})]})]})]})]})}let h={working:{bg:"bg-green-900/30 border-green-800/30",text:"text-green-300",dot:"bg-green-500",glow:"shadow-green-500/10"},idle:{bg:"bg-cyan-900/30 border-cyan-800/30",text:"text-cyan-300",dot:"bg-cyan-400",glow:"shadow-cyan-500/5"},blocked:{bg:"bg-yellow-900/30 border-yellow-800/30",text:"text-yellow-300",dot:"bg-yellow-500",glow:""},error:{bg:"bg-red-900/30 border-red-800/30",text:"text-red-300",dot:"bg-red-500",glow:""}},m={bg:"bg-gray-800/50 border-gray-700/30",text:"text-gray-500",dot:"bg-gray-500",glow:""};function g({session:e,hasSse:t,sseCount:a,onChat:n}){let o=t&&h[e.status]||m;return(0,s.jsxs)(r.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,prefetch:!1,className:`block rounded-xl border p-4 transition-all duration-300 cursor-pointer ${t?`bg-[#111128] border-[#2a2a4a] hover:border-cyan-500/30 hover:shadow-lg ${o.glow}`:"bg-[#0d0d1a] border-[#1a1a2a] opacity-40"}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsx)("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${o.dot} ${t&&"working"===e.status?"animate-pulse":""}`}),(0,s.jsx)("span",{className:"font-semibold text-white truncate text-sm",title:e.alias,children:e.alias})]}),(0,s.jsx)("span",{className:`text-[11px] px-2 py-0.5 rounded-md border shrink-0 ${o.bg} ${o.text}`,children:t?e.status:"offline"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)("span",{className:"text-xs text-gray-600 bg-[#0a0a15] px-2 py-0.5 rounded border border-[#1a1a2a]",children:e.agent||"unknown"}),t&&(0,s.jsxs)("span",{className:"text-[10px] text-green-500",children:["SSE:",a]})]}),e.task?(0,s.jsx)("div",{className:"text-xs text-gray-400 bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] line-clamp-2",title:e.task,children:e.task}):(0,s.jsx)("div",{className:"text-xs text-gray-700 italic",children:"No active task"}),e.progress>0&&(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsxs)("div",{className:"flex justify-between text-[10px] mb-1",children:[(0,s.jsx)("span",{className:"text-gray-600",children:"Progress"}),(0,s.jsxs)("span",{className:o.text,children:[e.progress,"%"]})]}),(0,s.jsx)("div",{className:"w-full bg-gray-800 rounded-full h-1.5 overflow-hidden",children:(0,s.jsx)("div",{className:`h-1.5 rounded-full transition-all duration-700 ${"working"===e.status?"bg-green-500":"bg-cyan-500"}`,style:{width:`${Math.min(e.progress,100)}%`}})})]}),(0,s.jsxs)("div",{className:"mt-3 flex justify-between items-center text-[10px] text-gray-600",children:[(0,s.jsx)("span",{children:e.server||"--"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[n&&t&&(0,s.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e.alias)},className:"text-cyan-400 hover:text-cyan-300 px-1.5 py-0.5 rounded border border-cyan-500/20 hover:bg-cyan-500/10 transition-colors",children:"Chat"}),(0,s.jsx)("span",{children:(0,l.timeAgo)(e.updated_at)})]})]})]})}function f({messages:e}){return 0===e.length?null:(0,s.jsxs)("div",{className:"mt-8",children:[(0,s.jsxs)("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Inbox"}),(0,s.jsx)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30",children:e.length})]}),(0,s.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto pr-1 scrollbar-thin",children:e.map(e=>(0,s.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm transition-colors hover:border-[#3a3a5a]",children:[(0,s.jsxs)("div",{className:"flex justify-between text-xs text-gray-500 mb-1.5",children:[(0,s.jsx)("span",{className:"text-blue-400 font-medium",children:e.from_session}),(0,s.jsx)("span",{children:e.created_at})]}),(0,s.jsx)("div",{className:"text-gray-300 leading-relaxed",children:e.content})]},e.id))})]})}function b(){return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono animate-pulse",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"h-7 w-48 bg-gray-800 rounded mb-2"}),(0,s.jsx)("div",{className:"h-4 w-64 bg-gray-800/60 rounded"})]}),(0,s.jsx)("div",{className:"flex gap-3",children:[1,2,3].map(e=>(0,s.jsx)("div",{className:"w-[72px] h-[60px] bg-gray-800/40 rounded-lg border border-gray-800"},e))})]}),(0,s.jsxs)("div",{className:"mb-6 flex gap-2",children:[(0,s.jsx)("div",{className:"flex-1 h-10 bg-gray-800/40 rounded-lg"}),(0,s.jsx)("div",{className:"w-28 h-10 bg-gray-800/40 rounded-lg"})]}),(0,s.jsx)("div",{className:"w-full max-w-4xl mx-auto mb-8 h-64 bg-gray-800/20 rounded-xl"}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,s.jsxs)("div",{className:"rounded-xl border border-gray-800/40 p-4 bg-gray-800/20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-gray-700"}),(0,s.jsx)("div",{className:"h-4 w-24 bg-gray-700 rounded"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{className:"h-3 w-full bg-gray-800/60 rounded"}),(0,s.jsx)("div",{className:"h-3 w-3/4 bg-gray-800/60 rounded"}),(0,s.jsx)("div",{className:"h-3 w-1/2 bg-gray-800/60 rounded"})]})]},e))})]})}function p({hint:e}){return(0,s.jsxs)("div",{className:"text-center py-16",children:[(0,s.jsx)("div",{className:"text-gray-600 text-4xl mb-4",children:"--"}),(0,s.jsx)("h3",{className:"text-gray-400 text-lg font-medium mb-2",children:"No agents in this network"}),e?.global_count?(0,s.jsxs)("p",{className:"text-gray-500 text-sm max-w-md mx-auto",children:["Server has ",(0,s.jsx)("span",{className:"text-cyan-400 font-medium",children:e.global_count})," nodes globally, but none are registered to the current network. Switch network or contact admin."]}):(0,s.jsx)("p",{className:"text-gray-600 text-sm max-w-md mx-auto",children:"Agent sessions will appear here once they connect to the CommHub."})]})}var y=e.i(58963);function j(){let{setNetworkId:e}=(0,y.useNetworkId)(),[t,r]=(0,a.useState)({user:null,networks:[],currentNetwork:"",token:""}),[l,n]=(0,a.useState)(!1),[o,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[x,u]=(0,a.useState)(""),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=sessionStorage.getItem("anet_v3_auth");if(e)try{r(JSON.parse(e))}catch{}},[]);let[g,f]=(0,a.useState)(!1),[b,p]=(0,a.useState)(""),[j,v]=(0,a.useState)(""),w=async()=>{try{await fetch(`/api/hub/auth?token=${t.token}&endpoint=/api/auth/me`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:b,email:j})});let e=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:b,email:j})}),s=await e.json();if(s.ok&&s.user){let e={...t,user:s.user};r(e),sessionStorage.setItem("anet_v3_auth",JSON.stringify(e)),f(!1)}}catch{}};if(!t.user)return null;let N=(t.user.display_name||t.user.username).slice(0,2).toUpperCase();return(0,s.jsxs)("div",{className:"flex items-center justify-between bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-xs font-bold text-white",children:N}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-white font-medium",children:t.user.display_name||t.user.username}),(0,s.jsxs)("div",{className:"text-[10px] text-gray-500",children:[t.user.role," · ",t.user.user_id]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[t.networks.length>0&&(0,s.jsx)("select",{value:t.currentNetwork,onChange:s=>{let a={...t,currentNetwork:s.target.value};r(a),e(s.target.value),sessionStorage.setItem("anet_v3_auth",JSON.stringify(a))},className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white focus:outline-none",children:t.networks.map(e=>(0,s.jsx)("option",{value:e.network_id,children:e.network_name},e.network_id))}),(0,s.jsx)("button",{onClick:()=>{p(t.user?.display_name||""),v(""),f(!g)},className:"text-xs text-gray-500 hover:text-gray-300",children:"Edit"}),(0,s.jsx)("button",{onClick:()=>{r({user:null,networks:[],currentNetwork:"",token:""}),sessionStorage.removeItem("anet_v3_auth")},className:"text-xs text-gray-500 hover:text-gray-300",children:"Sign out"})]}),g&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#2a2a4a]",children:[(0,s.jsx)("input",{type:"text",value:b,onChange:e=>p(e.target.value),placeholder:"Display name",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-32"}),(0,s.jsx)("input",{type:"email",value:j,onChange:e=>v(e.target.value),placeholder:"Email",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-40"}),(0,s.jsx)("button",{onClick:w,className:"px-2 py-1 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded",children:"Save"})]})]})}var v=e.i(21373),w=e.i(58442);function N({tabs:e,activeTab:t,onOpenTab:a,onCloseTab:r,onSetActive:l,onClose:n}){return 0===e.length?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{onClick:n,className:"jsx-f7cf3d1a6fdfc074 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,s.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,s.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 flex items-center border-b border-[#2a2a4a] bg-[#0d0d1a] overflow-x-auto",children:[(0,s.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 flex min-w-0",children:e.map(e=>(0,s.jsxs)("button",{onClick:()=>l(e),className:`jsx-f7cf3d1a6fdfc074 flex items-center gap-1.5 px-3 py-2.5 text-xs border-b-2 transition-colors shrink-0 ${t===e?"border-cyan-400 text-cyan-300 bg-cyan-500/5":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,s.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 w-2 h-2 rounded-full ${t===e?"bg-cyan-400":"bg-gray-600"}`}),(0,s.jsx)("span",{className:"jsx-f7cf3d1a6fdfc074 max-w-[80px] truncate",children:e}),(0,s.jsx)("button",{onClick:t=>{t.stopPropagation(),r(e)},className:"jsx-f7cf3d1a6fdfc074 ml-1 text-gray-600 hover:text-gray-300 p-0.5",children:"×"})]},e))}),(0,s.jsx)("button",{onClick:n,className:"jsx-f7cf3d1a6fdfc074 text-gray-500 hover:text-white px-3 py-2.5 shrink-0 border-l border-[#2a2a4a]",children:(0,s.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-f7cf3d1a6fdfc074 w-4 h-4",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-f7cf3d1a6fdfc074"})})})]}),(0,s.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 relative overflow-hidden",children:e.map(e=>(0,s.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 absolute inset-0 ${t===e?"block":"hidden"}`,children:(0,s.jsx)(k,{alias:e})},e))})]}),(0,s.jsx)(v.default,{id:"f7cf3d1a6fdfc074",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}function k({alias:e}){return(0,s.jsx)(w.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0})}function S({sessions:e,onClose:t}){let[r,l]=(0,a.useState)(new Set),[n,o]=(0,a.useState)(""),[i,d]=(0,a.useState)("normal"),[c,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)([]),[m,g]=(0,a.useState)(""),f=e.filter(e=>"offline"!==e.status).filter(e=>!m||e.alias.toLowerCase().includes(m.toLowerCase())||(e.agent||"").toLowerCase().includes(m.toLowerCase())),b=async()=>{if(!n.trim()||0===r.size||c)return;x(!0),h([]);let e=[...r].map(async e=>{try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:n,priority:i})}),s=await t.json();return{alias:e,ok:!!s.ok,error:s.error}}catch(t){return{alias:e,ok:!1,error:"send failed"}}});h(await Promise.all(e)),x(!1)},p=u.filter(e=>e.ok).length;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:t}),(0,s.jsxs)("div",{className:"fixed inset-4 lg:inset-x-[15%] lg:inset-y-[5%] bg-[#0a0a1a] border border-[#2a2a4a] rounded-2xl z-50 flex flex-col shadow-2xl shadow-black/70 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-bold text-white",children:"Dispatch Task"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Send a task to one or more agents"})]}),(0,s.jsx)("button",{onClick:t,className:"text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden",children:[(0,s.jsxs)("div",{className:"lg:w-[280px] border-b lg:border-b-0 lg:border-r border-[#2a2a4a] flex flex-col",children:[(0,s.jsxs)("div",{className:"px-4 py-3 border-b border-[#2a2a4a]",children:[(0,s.jsx)("input",{type:"text",value:m,onChange:e=>g(e.target.value),placeholder:"Filter agents...",className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,s.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,s.jsx)("button",{onClick:()=>{r.size===f.length?l(new Set):l(new Set(f.map(e=>e.alias)))},className:"text-[10px] text-cyan-400 hover:text-cyan-300",children:r.size===f.length?"Deselect all":`Select all (${f.length})`}),(0,s.jsxs)("span",{className:"text-[10px] text-gray-600",children:[r.size," selected"]})]})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5 max-h-[200px] lg:max-h-none",children:[f.map(e=>(0,s.jsxs)("button",{onClick:()=>{var t;return t=e.alias,void l(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-left transition-colors ${r.has(e.alias)?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/20":"text-gray-400 hover:bg-[#1a1a2a]"}`,children:[(0,s.jsx)("div",{className:`w-2 h-2 rounded-full shrink-0 ${"working"===e.status?"bg-green-400":"idle"===e.status?"bg-cyan-400":"bg-gray-500"}`}),(0,s.jsx)("span",{className:"truncate flex-1",children:e.alias}),(0,s.jsx)("span",{className:"text-[9px] text-gray-600",children:e.agent||"--"})]},e.alias)),0===f.length&&(0,s.jsx)("div",{className:"text-center text-xs text-gray-600 py-4",children:"No online agents"})]})]}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,s.jsxs)("div",{className:"flex-1 px-6 py-4 flex flex-col",children:[(0,s.jsx)("label",{className:"text-xs text-gray-500 uppercase mb-2",children:"Task Prompt"}),(0,s.jsx)("textarea",{value:n,onChange:e=>o(e.target.value),placeholder:"Enter the task you want to dispatch...",className:"flex-1 min-h-[120px] bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none"}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[(0,s.jsxs)("select",{value:i,onChange:e=>d(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white focus:outline-none",children:[(0,s.jsx)("option",{value:"normal",children:"Normal priority"}),(0,s.jsx)("option",{value:"high",children:"High priority"}),(0,s.jsx)("option",{value:"low",children:"Low priority"})]}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsx)("button",{onClick:b,disabled:c||!n.trim()||0===r.size,className:"px-6 py-2.5 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 disabled:from-gray-800 disabled:to-gray-800 disabled:text-gray-600 text-white text-sm font-medium rounded-xl transition-all shadow-lg shadow-cyan-500/10 disabled:shadow-none active:scale-95",children:c?(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Sending..."]}):`Dispatch to ${r.size} agent${r.size>1?"s":""}`})]})]}),u.length>0&&(0,s.jsxs)("div",{className:"px-6 py-3 border-t border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,s.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:[p,"/",u.length," dispatched successfully"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:u.map(e=>(0,s.jsxs)("span",{className:`text-[10px] px-2 py-0.5 rounded-full border ${e.ok?"text-green-300 border-green-500/20 bg-green-500/5":"text-red-300 border-red-500/20 bg-red-500/5"}`,children:[e.alias,": ",e.ok?"✓":e.error||"✗"]},e.alias))})]})]})]})]})]})}var C=e.i(65822),$=e.i(71235);e.s(["default",0,function(){(0,a.useEffect)(()=>{sessionStorage.getItem("anet_v3_auth")||(fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login"))},[]);let{sessions:e,hint:o,error:d,isLoading:c}=(0,C.useSessions)(),{health:x}=(0,C.useHealth)(),{config:h}=(0,C.useAnetConfig)(),{tasks:m}=(0,C.useTasks)({limit:"500"}),{stats:y}=(0,C.useStats)(),{license:v}=(0,C.useLicense)(),[w,k]=(0,a.useState)(window.innerWidth>=1024),[_,M]=(0,a.useState)(!1),T=function(){let[e,t]=(0,a.useState)([]),[s,r]=(0,a.useState)("");return{tabs:e,activeTab:s,openTab:e=>{t(t=>t.includes(e)?t:[...t,e]),r(e)},closeTab:e=>{t(t=>{let a=t.filter(t=>t!==e);return s===e&&r(a[a.length-1]||""),a})},closeAll:()=>{t([]),r("")},setActiveTab:r}}(),[A,E]=(0,a.useState)(!1),[z,L]=(0,a.useState)([]),{mutate:O}=(0,$.useSWRConfig)(),{connected:P,supported:W}=function({url:e,onEvent:t,reconnectDelay:s=3e3,enabled:r=!0}){let[l,n]=(0,a.useState)(!1),[o,i]=(0,a.useState)(null),[d,c]=(0,a.useState)(null),x=(0,a.useRef)(null),u=(0,a.useRef)(void 0),h=(0,a.useRef)(!1),m=(0,a.useRef)(null),g=(0,a.useRef)(!1),f=(0,a.useCallback)(()=>{if(!r||!e||h.current||g.current)return;x.current&&(x.current.close(),x.current=null),m.current&&m.current.abort();let a=e.includes("?")?`${e}&probe=1`:`${e}?probe=1`,l=new AbortController;m.current=l;let o=setTimeout(()=>l.abort(),5e3);fetch(a,{method:"HEAD",cache:"no-store",signal:l.signal}).finally(()=>clearTimeout(o)).then(a=>{if(g.current)return;if("true"!==a.headers.get("x-anet-sse-available")){h.current=!0,n(!1),c(!1);return}c(!0);let r=new EventSource(e);x.current=r,r.onopen=()=>n(!0),r.onmessage=e=>{try{let s=JSON.parse(e.data);i(s),t?.(s)}catch{}},r.onerror=()=>{n(!1),r.close(),x.current=null,g.current||(u.current=setTimeout(f,s))}}).catch(()=>{g.current||(n(!1),c(!1))})},[e,t,s,r]);return(0,a.useEffect)(()=>(h.current=!1,g.current=!1,c(!!r&&null),f(),()=>{g.current=!0,m.current&&(m.current.abort(),m.current=null),x.current&&(x.current.close(),x.current=null),u.current&&clearTimeout(u.current)}),[f]),{connected:l,lastEvent:o,supported:d}}({url:"/api/hub/events",enabled:"1"!==t.default.env.NEXT_PUBLIC_DISABLE_SSE,onEvent:e=>{["new_task","new_message","new_reply","node_status_changed","broadcast"].includes(e.type)&&(O("/api/hub/status"),O(e=>"string"==typeof e&&e.startsWith("/api/hub/tasks"),void 0,{revalidate:!0}))}});if((0,a.useEffect)(()=>{let e=()=>{fetch("/api/hub/inbox").then(e=>e.json()).then(e=>{e.messages?.length&&L(t=>{let s=new Set(t.map(e=>e.id));return[...e.messages.filter(e=>!s.has(e.id)),...t].slice(0,100)})}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),c)return(0,s.jsx)(b,{});let I=x?.sse_sessions||{},F=e=>"offline"!==e.status||!!I[e.alias],B=e.filter(F).length,D=e.length,R=e.filter(e=>"working"===e.status).length,H=x?(0,l.formatUptime)(x.uptime):"--",J=x?.version||"--",U=!!(h?.hub&&h.tokenConfigured),G=h?.source==="file"?"Local config":h?.source==="runtime-env"?"Runtime env":"Config missing",K={};if(y?.tasks?.by_status?.length)for(let e of y.tasks.by_status)K[e.status]=e.count;else for(let e of m)K[e.status]=(K[e.status]||0)+1;let Q=[...e].sort((e,t)=>{let s=+!!F(e),a=+!!F(t);if(s!==a)return a-s;let r=+("working"===e.status);return("working"===t.status)-r});return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,s.jsx)("div",{className:"lg:ml-0 ml-10",children:(0,s.jsx)(n,{online:B,working:R,total:D,version:J,uptime:H})}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,s.jsx)("button",{onClick:()=>E(!0),className:"px-4 py-2 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white text-sm font-medium rounded-xl shadow-lg shadow-cyan-500/10 transition-all active:scale-95 shrink-0",children:"⚡ Dispatch"}),(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsx)(j,{})})]}),(0,s.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,s.jsxs)("button",{onClick:()=>M(!_),className:"w-full flex items-center justify-between text-left",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("span",{className:"uppercase text-gray-600",children:"Config"}),(0,s.jsx)("span",{className:`w-2 h-2 rounded-full ${U?"bg-green-400":"bg-red-400"}`}),(0,s.jsx)("span",{className:"text-gray-500",children:G})]}),(0,s.jsx)("svg",{className:`w-4 h-4 text-gray-600 transition-transform ${_?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),_&&(0,s.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a]",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("div",{className:"text-gray-100 truncate text-sm",title:h?.hub||void 0,children:["Hub: ",(0,s.jsx)("span",{className:h?.hub?"text-cyan-300":"text-red-300",children:h?.hub?.trim()||"not configured"})]})}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 text-xs",children:(0,s.jsxs)("span",{className:`px-2.5 py-1 rounded-md border ${h?.tokenConfigured?"bg-blue-500/5 text-blue-300 border-blue-500/20":"bg-gray-500/5 text-gray-400 border-gray-500/20"}`,children:["Token: ",h?.tokenPreview||"not configured"]})})]}),h?.error&&(0,s.jsx)("div",{className:"mt-2 text-xs text-gray-600",children:h.error})]})]}),Object.keys(K).length>0&&(0,s.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("div",{className:"text-xs uppercase text-gray-600",children:"Task Status"}),(0,s.jsx)(r.default,{href:"/tasks",prefetch:!1,className:"text-xs text-cyan-400 hover:text-cyan-300",children:"View all →"})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:[{key:"running",color:"bg-green-500/10 text-green-300 border-green-500/20"},{key:"delivered",color:"bg-blue-500/10 text-blue-300 border-blue-500/20"},{key:"acked",color:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"},{key:"replied",color:"bg-purple-500/10 text-purple-300 border-purple-500/20"},{key:"failed",color:"bg-red-500/10 text-red-300 border-red-500/20"},{key:"cancelled",color:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20"},{key:"expired",color:"bg-orange-500/10 text-orange-300 border-orange-500/20"},{key:"closed",color:"bg-gray-500/10 text-gray-500 border-gray-500/20"}].filter(({key:e})=>K[e]).map(({key:e,color:t})=>(0,s.jsxs)(r.default,{href:`/tasks?status=${e}`,prefetch:!1,className:`px-2.5 py-1 rounded-md border text-xs ${t} hover:opacity-80 transition-opacity`,children:[e,": ",K[e]]},e))})]}),(0,s.jsx)("section",{className:"mb-6 grid grid-cols-3 sm:grid-cols-6 gap-2",children:[{href:"/nodes",label:"Nodes",value:`${B}/${D}`,color:"text-green-400 border-green-500/15"},{href:"/tasks",label:"Tasks",value:String(Object.values(K).reduce((e,t)=>e+t,0)||"--"),color:"text-cyan-400 border-cyan-500/15"},{href:"/tasks?status=failed",label:"Failed",value:String(K.failed||0),color:K.failed?"text-red-400 border-red-500/20":"text-gray-600 border-gray-700/30"},{href:"/messages",label:"Messages",value:"→",color:"text-blue-400 border-blue-500/15"},{href:"/logs",label:"Logs",value:"→",color:"text-purple-400 border-purple-500/15"},{href:"/admin",label:"Admin",value:"→",color:"text-gray-400 border-gray-500/15"}].map(e=>(0,s.jsxs)(r.default,{href:e.href,prefetch:!1,className:`text-center rounded-xl border ${e.color} bg-[#111128] px-3 py-2.5 hover:bg-[#161630] transition-colors`,children:[(0,s.jsx)("div",{className:`text-lg font-bold tabular-nums ${e.color.split(" ")[0]}`,children:e.value}),(0,s.jsx)("div",{className:"text-[10px] text-gray-500",children:e.label})]},e.href))}),(0,s.jsx)(i,{}),m.length>0&&(0,s.jsxs)("section",{className:"mb-6 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Recent Activity"}),(0,s.jsx)(r.default,{href:"/tasks",className:"text-xs text-cyan-400 hover:text-cyan-300",children:"All tasks →"})]}),(0,s.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:m.slice(0,5).map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"replied"===e.status?"bg-purple-400":"running"===e.status?"bg-green-400":"failed"===e.status?"bg-red-400":"bg-blue-400"}`}),(0,s.jsx)("span",{className:"text-blue-400 shrink-0",children:e.from_name||"?"}),(0,s.jsx)("span",{className:"text-gray-600",children:"→"}),(0,s.jsx)("span",{className:"text-cyan-400 shrink-0",children:e.to_name||"?"}),(0,s.jsx)("span",{className:"text-gray-500 truncate flex-1",children:e.content?.slice(0,40)||"--"}),(0,s.jsx)("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] border ${"replied"===e.status?"text-purple-300 border-purple-500/20":"failed"===e.status?"text-red-300 border-red-500/20":"text-gray-500 border-gray-700/30"}`,children:e.status})]},e.task_id))})]}),d&&(0,s.jsxs)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-3 rounded-lg mb-6 text-sm flex items-center justify-between",role:"alert",children:[(0,s.jsx)("span",{children:String(d)}),(0,s.jsx)("span",{className:"text-gray-500 text-xs",children:"Check CommHub connection"})]}),e.length>0&&(0,s.jsx)("div",{className:"flex justify-center mb-4",children:(0,s.jsx)("button",{onClick:()=>k(!w),className:"text-xs text-gray-500 hover:text-gray-300 border border-gray-700/50 px-4 py-1.5 rounded-lg transition-colors hover:border-gray-600 cursor-pointer",children:w?"Hide Topology":"Show Topology"})}),!w&&e.length>0&&(0,s.jsx)("div",{className:"lg:hidden text-center text-xs text-gray-600 mb-4",children:"Topology hidden on mobile for better readability"}),w&&e.length>0&&(0,s.jsx)(u,{sessions:e,sseSessions:I}),0!==e.length||d?(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4",children:Q.map(e=>(0,s.jsx)(g,{session:e,hasSse:F(e),sseCount:I[e.alias]||0,onChat:T.openTab},e.alias))}):(0,s.jsx)(p,{hint:o}),(0,s.jsx)(f,{messages:z}),(0,s.jsxs)("div",{className:"mt-8 text-center text-xs text-gray-600 flex items-center justify-center gap-2 flex-wrap",children:[W&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${P?"bg-green-400":"bg-gray-600"}`}),P?"SSE live":"SWR polling"]}),v?.license&&(0,s.jsxs)(s.Fragment,{children:[W&&(0,s.jsx)(s.Fragment,{children:"·"}),(0,s.jsxs)("span",{className:v.license.days_left<=7?"text-red-400":"pro"===v.license.type?"text-green-400":"text-yellow-400",children:[v.license.type," (",v.license.days_left,"d left)"]})]})]}),A&&(0,s.jsx)(S,{sessions:e,onClose:()=>E(!1)}),T.tabs.length>0&&(0,s.jsx)(N,{tabs:T.tabs,activeTab:T.activeTab,onOpenTab:T.openTab,onCloseTab:T.closeTab,onSetActive:T.setActiveTab,onClose:T.closeAll})]})}],31713)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var r=e.i(47167);e.r(16015);var n=e.r(71645),a=n&&"object"==typeof n&&"default"in n?n:{default:n},i=void 0!==r.default&&r.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,s=t.name,r=void 0===s?"stylesheet":s,n=t.optimizeForSpeed,a=void 0===n?i:n;d(l(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-deleted-rule____{}",d("boolean"==typeof a,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=a,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(d(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(r){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];d(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&d(l(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var n=document.head||document.getElementsByTagName("head")[0];return s?n.insertBefore(r,s):n.appendChild(r),r},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),r=e+s;return u[r]||(u[r]="jsx-"+c(e+"-"+s)),u[r]}function m(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var p=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,r=void 0===s?null:s,n=t.optimizeForSpeed,a=void 0!==n&&n;this._sheet=r||new o({name:"styled-jsx",optimizeForSpeed:a}),this._sheet.inject(),r&&"boolean"==typeof a&&(this._sheet.setOptimizeForSpeed(a),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),r=s.styleId,n=s.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var a=n.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=a,this._instancesCounts[r]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var r=this._fromServer&&this._fromServer[s];r?(r.parentNode.removeChild(r),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],r=e[1];return a.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,r=e.id;if(s){var n=h(r,s);return{styleId:n,rules:Array.isArray(t)?t.map(function(e){return m(n,e)}):[m(n,t)]}}return{styleId:h(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),f=n.createContext(null);function x(){return new p}function y(){return n.useContext(f)}f.displayName="StyleSheetContext";var g=a.default.useInsertionEffect||a.default.useLayoutEffect,v="u">typeof window?x():void 0;function b(e){var t=v||y();return t&&("u"<typeof window?t.add(e):g(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}b.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,r=n.useContext(f),i=n.useState(function(){return r||t||x()})[0];return a.default.createElement(f.Provider,{value:i},s)},s.createStyleRegistry=x,s.style=b,s.useStyleRegistry=y},21373,(e,t,s)=>{t.exports=e.r(98547).style},53136,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(18566),n=e.i(22016),a=e.i(58442),i=e.i(18150);function l({tmuxName:e}){let[r,n]=(0,s.useState)(""),[a,i]=(0,s.useState)(!1),[o,d]=(0,s.useState)(!1),c=async()=>{i(!0);try{let t=await fetch(`/api/hub/tmux?name=${encodeURIComponent(e)}`),s=await t.json();n(s.output||s.error||"No output")}catch{n("Failed to fetch")}i(!1)};return(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] 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:c,disabled:a,className:"text-xs text-cyan-400 hover:text-cyan-300 disabled:text-gray-600",children:a?"Loading...":"Capture"}),r&&(0,t.jsx)("button",{onClick:()=>d(!o),className:"text-xs text-gray-500 hover:text-gray-300",children:o?"Collapse":"Expand"})]})]}),r&&(0,t.jsx)("pre",{className:`text-[11px] text-green-300 bg-[#050510] rounded-lg px-3 py-2 border border-[#1a1a2a] overflow-x-auto whitespace-pre font-mono ${o?"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 o(){let e=(0,r.useSearchParams)().get("alias")||"",[a,i]=(0,s.useState)(null),[l,o]=(0,s.useState)([]),[c,u]=(0,s.useState)(0),[h,m]=(0,s.useState)(""),[p,f]=(0,s.useState)(""),[x,y]=(0,s.useState)(!1),g=(0,s.useCallback)(async()=>{if(e)try{let t=await fetch(`/api/hub/session?alias=${encodeURIComponent(e)}`),s=await t.json();s.session&&i(s.session),s.inbox&&o(s.inbox),u(s.sse||0),m("")}catch(e){m(e instanceof Error?e.message:"fetch failed")}},[e]);(0,s.useEffect)(()=>{g();let e=setInterval(g,5e3);return()=>clearInterval(e)},[g]);let[v,b]=(0,s.useState)(""),S=async()=>{if(p.trim()&&e){y(!0),b("");try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:p})}),s=await t.json();s.ok?(f(""),setTimeout(g,2e3)):b(s.error||"Send failed")}catch(e){b(e instanceof Error?e.message:"Send failed")}y(!1)}};if(!e)return(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono flex items-center justify-center",children:(0,t.jsxs)("p",{className:"text-gray-500",children:["No alias specified. ",(0,t.jsx)(n.default,{href:"/",className:"text-blue-400 hover:underline",children:"Back to dashboard"})]})});let _=a?.status==="working"?"text-green-400":a?.status==="idle"?"text-blue-400":"text-gray-500";return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)(n.default,{href:"/nodes",className:"text-gray-500 hover:text-gray-300 text-sm lg:ml-0 ml-10",children:"← Nodes"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:`inline-block w-3 h-3 rounded-full ${c>0?a?.status==="working"?"bg-green-500 animate-pulse":"bg-emerald-400":"bg-gray-500"}`}),(0,t.jsx)("h1",{className:"text-2xl font-bold text-white",children:e}),(0,t.jsx)("span",{className:`text-sm ${_}`,children:a?.status||"unknown"})]})]}),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)(d,{alias:e,session:a,sse:c,sendMsg:p,setSendMsg:f,sending:x,sendTask:S,sendError:v})]})}function d({alias:e,session:r,sse:n,sendMsg:i,setSendMsg:o,sending:c,sendTask:h,sendError:m}){let[p,f]=(0,s.useState)("chat"),[x,y]=(0,s.useState)([]),[g,v]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{"events"!==p||g||fetch("/api/hub/task-events?limit=50").then(e=>e.json()).then(e=>{y(e.events||[]),v(!0)}).catch(()=>v(!0))},[p,g]),(0,t.jsxs)("div",{className:"bg-[#0d0d1a] border border-[#2a2a4a] rounded-xl overflow-hidden h-[calc(100vh-140px)] flex flex-col",children:[(0,t.jsx)("div",{className:"flex border-b border-[#2a2a4a] bg-[#0a0a15] shrink-0",children:["chat","events","info"].map(e=>(0,t.jsx)("button",{onClick:()=>f(e),className:`px-5 py-3 text-sm font-medium border-b-2 transition-colors ${p===e?"border-cyan-400 text-cyan-300":"border-transparent text-gray-500 hover:text-gray-300"}`,children:"chat"===e?"💬 Chat":"events"===e?"📋 Events":"📊 Info"},e))}),(0,t.jsxs)("div",{className:"flex-1 overflow-hidden",children:["chat"===p&&(0,t.jsx)(a.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0}),"events"===p&&(0,t.jsx)(u,{events:x,loading:!g}),"info"===p&&(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-[#111128] border border-[#2a2a4a] 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:n>0?`Connected (${n})`:"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:s,alwaysShow:r})=>s||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:s?String(s):"--",children:s?String(s):"--"})]},e):null)})]}),r?.task&&(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"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-[#111128] border border-[#2a2a4a] 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-[#111128] border border-[#2a2a4a] 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:i,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&h(),placeholder:`Send task to ${e}...`,className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-blue-500 focus:outline-none"}),(0,t.jsx)("button",{onClick:h,disabled:c||!i.trim(),className:"px-3 py-2 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-700 text-white text-xs rounded transition-colors",children:c?"...":"Send"})]}),m&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:m})]}),r?.tmux_name&&(0,t.jsx)(l,{tmuxName:r.tmux_name})]})]})]})}let c={delivered:{dot:"bg-blue-400",line:"bg-blue-500/30",icon:"📬"},acked:{dot:"bg-yellow-400",line:"bg-yellow-500/30",icon:"✅"},running:{dot:"bg-green-400",line:"bg-green-500/30",icon:"⚡"},replied:{dot:"bg-purple-400",line:"bg-purple-500/30",icon:"💬"},failed:{dot:"bg-red-400",line:"bg-red-500/30",icon:"❌"},created:{dot:"bg-gray-400",line:"bg-gray-500/30",icon:"📝"}};function u({events:e,loading:s}){if(s)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}`,s=r.get(t)||[];s.push(e),r.set(t,s)}),(0,t.jsx)("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[...r.entries()].map(([e,s])=>(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] 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-[#1a1a2a]"}),s.map((e,s)=>{let r=c[e.to_status]||c.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 text-[9px] z-10 border-2 border-[#111128]`,children:r.icon.length<=2?r.icon:""}),(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,i.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)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono",children:"Loading..."}),children:(0,t.jsx)(o,{})})}])}]);