@sleep2agi/agent-network-dashboard 0.4.5-preview.49 → 0.4.5-preview.50
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/diagnostics/route-bundle-stats.json +7 -7
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/admin.html +1 -1
- package/.next/server/app/admin.rsc +1 -1
- package/.next/server/app/admin.segments/_full.segment.rsc +1 -1
- package/.next/server/app/admin.segments/_head.segment.rsc +1 -1
- package/.next/server/app/admin.segments/_index.segment.rsc +1 -1
- package/.next/server/app/admin.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/admin.segments/admin.segment.rsc +1 -1
- package/.next/server/app/index.html +2 -2
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +2 -2
- package/.next/server/app/login.rsc +2 -2
- package/.next/server/app/login.segments/_full.segment.rsc +2 -2
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +1 -1
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/logs.html +1 -1
- package/.next/server/app/logs.rsc +1 -1
- package/.next/server/app/logs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
- package/.next/server/app/messages.html +1 -1
- package/.next/server/app/messages.rsc +1 -1
- package/.next/server/app/messages.segments/_full.segment.rsc +1 -1
- package/.next/server/app/messages.segments/_head.segment.rsc +1 -1
- package/.next/server/app/messages.segments/_index.segment.rsc +1 -1
- package/.next/server/app/messages.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/messages.segments/messages.segment.rsc +1 -1
- package/.next/server/app/node.html +1 -1
- package/.next/server/app/node.rsc +1 -1
- package/.next/server/app/node.segments/_full.segment.rsc +1 -1
- package/.next/server/app/node.segments/_head.segment.rsc +1 -1
- package/.next/server/app/node.segments/_index.segment.rsc +1 -1
- package/.next/server/app/node.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/node.segments/node.segment.rsc +1 -1
- package/.next/server/app/nodes.html +1 -1
- package/.next/server/app/nodes.rsc +1 -1
- package/.next/server/app/nodes.segments/_full.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/_head.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/_index.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/nodes.segment.rsc +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/server-logs.html +1 -1
- package/.next/server/app/server-logs.rsc +1 -1
- package/.next/server/app/server-logs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/server-logs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/server-logs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/server-logs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/server-logs.segments/server-logs.segment.rsc +1 -1
- package/.next/server/app/settings/networks.html +1 -1
- package/.next/server/app/settings/networks.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/settings.segment.rsc +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/tokens.html +1 -1
- package/.next/server/app/settings/tokens.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/settings.segment.rsc +1 -1
- package/.next/server/app/settings.html +2 -2
- package/.next/server/app/settings.rsc +2 -2
- package/.next/server/app/settings.segments/_full.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/app/tasks/page.js.nft.json +1 -1
- package/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tasks.html +2 -2
- package/.next/server/app/tasks.rsc +2 -2
- package/.next/server/app/tasks.segments/_full.segment.rsc +2 -2
- package/.next/server/app/tasks.segments/_head.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/_index.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/tasks.segments/tasks.segment.rsc +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0jjqrcf._.js → [root-of-the-server]__0n4l2is._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0n4l2is._.js.map +1 -0
- package/.next/server/chunks/ssr/_0nne7mz._.js +1 -1
- package/.next/server/chunks/ssr/_0nne7mz._.js.map +1 -1
- package/.next/server/chunks/ssr/app_0aum_g5._.js +1 -1
- package/.next/server/chunks/ssr/app_0aum_g5._.js.map +1 -1
- package/.next/server/chunks/ssr/app_0esuljp._.js +1 -1
- package/.next/server/chunks/ssr/app_0esuljp._.js.map +1 -1
- package/.next/server/chunks/ssr/{app_components_0lhp_k.._.js → app_0py1sns._.js} +2 -2
- package/.next/server/chunks/ssr/app_0py1sns._.js.map +1 -0
- package/.next/server/chunks/ssr/app_tasks_page_tsx_0z-d6mp._.js +1 -1
- package/.next/server/chunks/ssr/app_tasks_page_tsx_0z-d6mp._.js.map +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{0df0py1glk9xm.js → 0mdu-2u9-dx.4.js} +1 -1
- package/.next/static/chunks/0uar..avu998d.js +1 -0
- package/.next/static/chunks/{0rirja6g.ixyp.js → 0vqk_f6kf2hnl.js} +1 -1
- package/.next/static/chunks/{0.wzhq18qxm-w.js → 0xu37uygp5fs-.js} +1 -1
- package/.next/static/chunks/{06xte7baw6rdl.js → 1528e.3d.l1ve.js} +1 -1
- package/.next/trace +2 -2
- package/.next/trace-build +1 -1
- package/app/tasks/page.tsx +11 -59
- package/package.json +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0jjqrcf._.js.map +0 -1
- package/.next/server/chunks/ssr/app_components_0lhp_k.._.js.map +0 -1
- package/.next/static/chunks/0~eyez47uqr~6.js +0 -1
- /package/.next/static/{G7GAy-2maF5UanqZzAohm → AQXM9jmgIyScbdEjjvrFL}/_buildManifest.js +0 -0
- /package/.next/static/{G7GAy-2maF5UanqZzAohm → AQXM9jmgIyScbdEjjvrFL}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{G7GAy-2maF5UanqZzAohm → AQXM9jmgIyScbdEjjvrFL}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../app/components/utils.ts","../../../../app/components/AliasAvatar.tsx","../../../../app/components/EmptyState.tsx","../../../../app/lib/hooks.ts","../../../../app/lib/status.ts"],"sourcesContent":["export function timeAgo(dateStr: string): string {\n if (!dateStr) return '--';\n const diff = Date.now() - new Date(dateStr.replace(' ', 'T') + 'Z').getTime();\n const s = Math.floor(diff / 1000);\n if (s < 60) return `${s}s ago`;\n if (s < 3600) return `${Math.floor(s / 60)}m ago`;\n if (s < 86400) return `${Math.floor(s / 3600)}h ago`;\n return `${Math.floor(s / 86400)}d ago`;\n}\n\nexport function statusColor(status: string, hasSse: boolean): string {\n if (hasSse && status === 'working') return 'bg-green-500';\n if (hasSse && status === 'idle') return 'bg-emerald-400';\n if (hasSse) return 'bg-blue-400';\n if (status === 'offline') return 'bg-gray-500';\n return 'bg-yellow-400';\n}\n\nexport function formatUptime(seconds: number): string {\n const h = Math.floor(seconds / 3600);\n const m = Math.floor((seconds % 3600) / 60);\n if (h > 0) return `${h}h ${m}m`;\n return `${m}m`;\n}\n","/** Hue-hashed avatar pill for agent aliases. Same alias → same color across\n * every page (Messages, Nodes, TopoGraph). Use the `size` prop for inline\n * pills (16/20) vs card headers (28). Round 21 introduced the palette;\n * round 22 promotes it from app/messages to a shared component. */\n\nconst AVATAR_HUES = [180, 200, 220, 270, 300, 330, 30, 90];\n\nexport function aliasAvatarColors(alias: string): { bg: string; ring: string; text: string } {\n let h = 0;\n for (let i = 0; i < alias.length; i++) h = (h * 31 + alias.charCodeAt(i)) >>> 0;\n const hue = AVATAR_HUES[h % AVATAR_HUES.length];\n return {\n bg: `hsl(${hue} 55% 22%)`,\n ring: `hsl(${hue} 60% 45%)`,\n text: `hsl(${hue} 80% 78%)`,\n };\n}\n\nexport function aliasInitial(alias?: string): string {\n if (!alias) return '·';\n const ch = alias.trim().match(/[\\p{L}\\p{N}]/u)?.[0] || alias.trim()[0] || '·';\n return ch.toUpperCase();\n}\n\ninterface AliasAvatarProps {\n alias: string;\n size?: number;\n className?: string;\n}\n\nexport function AliasAvatar({ alias, size = 28, className = '' }: AliasAvatarProps) {\n const c = aliasAvatarColors(alias);\n const fs = Math.max(9, Math.round(size * 0.42));\n return (\n <span\n className={`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${className}`}\n style={{\n width: size,\n height: size,\n fontSize: fs,\n backgroundColor: c.bg,\n borderColor: c.ring,\n color: c.text,\n }}\n title={alias}\n aria-hidden\n >\n {aliasInitial(alias)}\n </span>\n );\n}\n","'use client';\n\nimport { useState } from 'react';\nimport Link from 'next/link';\n\nexport type EmptyVariant = 'nodes' | 'tasks' | 'messages' | 'logs' | 'tokens' | 'networks' | 'generic';\n\ninterface EmptyStateProps {\n /** Picks the icon glyph and default copy if title/sub omitted. */\n variant?: EmptyVariant;\n /** Optional override headline. */\n title?: string;\n /** Optional override sub-copy. */\n sub?: string;\n /** Optional CTA: text + href (internal) or onClick. */\n cta?: { label: string; href?: string; onClick?: () => void };\n /** Compact mode for in-card empty states (smaller padding). */\n compact?: boolean;\n}\n\nconst DEFAULTS: Record<EmptyVariant, { title: string; sub: string }> = {\n nodes: { title: 'No agents in this network', sub: 'Agent sessions will appear here once they connect to the CommHub.' },\n tasks: { title: 'No tasks yet', sub: 'Tasks will appear here when agents send them via CommHub.' },\n messages: { title: 'No messages', sub: 'Messages between agents will appear here.' },\n logs: { title: 'No audit logs', sub: 'Events will appear here when users register, login, or perform actions.' },\n tokens: { title: 'No API tokens', sub: 'Create one to authenticate CLI tools and external integrations.' },\n networks: { title: 'No networks found', sub: 'Create one or sign in with V3 auth to see your networks.' },\n generic: { title: 'Nothing here yet', sub: 'Data will appear here once available.' },\n};\n\n/**\n * Minimal monochrome SVG glyphs per variant. No filled shapes, no gradients,\n * no AI-decoration — just thin-stroke line art that fades into the page.\n * 64×64 viewBox; rendered at 56×56 (compact 40×40).\n */\nfunction Glyph({ variant, size }: { variant: EmptyVariant; size: number }) {\n const s = { width: size, height: size };\n const baseProps = {\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 1.25,\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n };\n\n switch (variant) {\n case 'nodes':\n // Mesh with dashed edges = \"nodes will land here\"\n return (\n <svg viewBox=\"0 0 64 64\" {...s}>\n <g {...baseProps}>\n <circle cx=\"32\" cy=\"14\" r=\"4\" />\n <circle cx=\"14\" cy=\"44\" r=\"4\" />\n <circle cx=\"50\" cy=\"44\" r=\"4\" />\n <line x1=\"32\" y1=\"18\" x2=\"14\" y2=\"40\" strokeDasharray=\"3 3\" opacity=\"0.6\" />\n <line x1=\"32\" y1=\"18\" x2=\"50\" y2=\"40\" strokeDasharray=\"3 3\" opacity=\"0.6\" />\n <line x1=\"18\" y1=\"44\" x2=\"46\" y2=\"44\" strokeDasharray=\"3 3\" opacity=\"0.6\" />\n </g>\n </svg>\n );\n case 'tasks':\n // Empty checkbox list\n return (\n <svg viewBox=\"0 0 64 64\" {...s}>\n <g {...baseProps}>\n <rect x=\"14\" y=\"14\" width=\"36\" height=\"6\" rx=\"1.5\" />\n <rect x=\"14\" y=\"26\" width=\"36\" height=\"6\" rx=\"1.5\" opacity=\"0.6\" />\n <rect x=\"14\" y=\"38\" width=\"36\" height=\"6\" rx=\"1.5\" opacity=\"0.35\" />\n </g>\n </svg>\n );\n case 'messages':\n // Speech bubble outline\n return (\n <svg viewBox=\"0 0 64 64\" {...s}>\n <g {...baseProps}>\n <path d=\"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z\" />\n <line x1=\"22\" y1=\"28\" x2=\"42\" y2=\"28\" opacity=\"0.5\" />\n <line x1=\"22\" y1=\"34\" x2=\"36\" y2=\"34\" opacity=\"0.5\" />\n </g>\n </svg>\n );\n case 'logs':\n // Document with lines\n return (\n <svg viewBox=\"0 0 64 64\" {...s}>\n <g {...baseProps}>\n <path d=\"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z\" />\n <path d=\"M40 12 v8 h8\" opacity=\"0.6\" />\n <line x1=\"24\" y1=\"32\" x2=\"40\" y2=\"32\" opacity=\"0.55\" />\n <line x1=\"24\" y1=\"38\" x2=\"40\" y2=\"38\" opacity=\"0.4\" />\n <line x1=\"24\" y1=\"44\" x2=\"34\" y2=\"44\" opacity=\"0.25\" />\n </g>\n </svg>\n );\n case 'tokens':\n // Key outline\n return (\n <svg viewBox=\"0 0 64 64\" {...s}>\n <g {...baseProps}>\n <circle cx=\"22\" cy=\"32\" r=\"8\" />\n <line x1=\"30\" y1=\"32\" x2=\"54\" y2=\"32\" />\n <line x1=\"44\" y1=\"32\" x2=\"44\" y2=\"38\" />\n <line x1=\"50\" y1=\"32\" x2=\"50\" y2=\"40\" />\n </g>\n </svg>\n );\n case 'networks':\n // Globe-ish concentric ovals\n return (\n <svg viewBox=\"0 0 64 64\" {...s}>\n <g {...baseProps}>\n <circle cx=\"32\" cy=\"32\" r=\"18\" />\n <ellipse cx=\"32\" cy=\"32\" rx=\"18\" ry=\"9\" opacity=\"0.55\" />\n <line x1=\"14\" y1=\"32\" x2=\"50\" y2=\"32\" opacity=\"0.55\" />\n <line x1=\"32\" y1=\"14\" x2=\"32\" y2=\"50\" opacity=\"0.55\" />\n </g>\n </svg>\n );\n case 'generic':\n default:\n // Soft sparkle outline\n return (\n <svg viewBox=\"0 0 64 64\" {...s}>\n <g {...baseProps}>\n <circle cx=\"32\" cy=\"32\" r=\"14\" strokeDasharray=\"3 3\" opacity=\"0.6\" />\n <circle cx=\"32\" cy=\"32\" r=\"3\" />\n </g>\n </svg>\n );\n }\n}\n\nexport function EmptyState({ variant = 'generic', title, sub, cta, compact = false }: EmptyStateProps) {\n const d = DEFAULTS[variant];\n const headline = title ?? d.title;\n const subcopy = sub ?? d.sub;\n const iconSize = compact ? 40 : 56;\n\n return (\n <div className={`text-center ${compact ? 'py-8' : 'py-16'} px-4`} role=\"status\">\n <div className=\"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500\" aria-hidden>\n <Glyph variant={variant} size={iconSize} />\n </div>\n <h3 className={`font-medium text-gray-300 ${compact ? 'text-sm' : 'text-base'}`}>{headline}</h3>\n {subcopy && (\n <p className={`text-gray-500 ${compact ? 'text-xs mt-1.5' : 'text-sm mt-2'} max-w-md mx-auto leading-relaxed`}>\n {subcopy}\n </p>\n )}\n {cta && (\n <div className=\"mt-4\">\n {cta.href ? (\n <Link href={cta.href} className=\"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300\">\n {cta.label}\n <span aria-hidden>→</span>\n </Link>\n ) : (\n <button onClick={cta.onClick} className=\"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300\">\n {cta.label}\n <span aria-hidden>→</span>\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n\n/**\n * Overview-specific variant with a hint about cross-network global count.\n * Kept here so /app/page.tsx can drop in without ceremony.\n */\nexport function NodesEmptyState({ hint }: { hint?: { global_count?: number; filtered_network?: string } }) {\n if (hint?.global_count) {\n return (\n <EmptyState\n variant=\"nodes\"\n title=\"No agents in this network\"\n sub={`Server has ${hint.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`}\n />\n );\n }\n // Round 52: true empty state (zero agents anywhere) — show the\n // quickstart command inline so users don't have to leave the dashboard\n // to figure out how to spin up their first agent.\n return (\n <div className=\"text-center py-16 px-4\" role=\"status\">\n <div className=\"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500\" aria-hidden>\n <svg viewBox=\"0 0 64 64\" width={56} height={56}>\n <g stroke=\"currentColor\" strokeWidth=\"1.5\" fill=\"none\">\n <rect x=\"10\" y=\"20\" width=\"44\" height=\"28\" rx=\"2\" />\n <rect x=\"20\" y=\"32\" width=\"6\" height=\"8\" opacity=\"0.5\" />\n <rect x=\"32\" y=\"32\" width=\"6\" height=\"8\" opacity=\"0.5\" />\n <rect x=\"44\" y=\"32\" width=\"4\" height=\"8\" opacity=\"0.5\" />\n <line x1=\"10\" y1=\"26\" x2=\"54\" y2=\"26\" opacity=\"0.4\" />\n <circle cx=\"14\" cy=\"23\" r=\"0.8\" fill=\"currentColor\" />\n </g>\n </svg>\n </div>\n <h3 className=\"font-medium text-gray-300 text-base\">Spin up your first agent</h3>\n <p className=\"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed\">\n Run this in a fresh terminal to register an agent with this CommHub:\n </p>\n <div className=\"mt-4 inline-block\">\n <QuickstartCommand cmd=\"npx --yes @sleep2agi/agent-network init\" />\n </div>\n <div className=\"mt-3\">\n <a\n href=\"https://anet.sh\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300\"\n >\n Full quickstart guide\n <span aria-hidden>→</span>\n </a>\n </div>\n </div>\n );\n}\n\n/** Code block + inline copy button used by the empty-Overview first-run\n * CTA. State lives here so the parent stays stateless. */\nfunction QuickstartCommand({ cmd }: { cmd: string }) {\n const [copied, setCopied] = useState(false);\n const onCopy = async () => {\n try {\n await navigator.clipboard.writeText(cmd);\n setCopied(true);\n setTimeout(() => setCopied(false), 1800);\n } catch {}\n };\n return (\n <div className=\"anet-empty-cmd flex items-center gap-2 bg-[#0a0a15] border border-[#2a2a4a] rounded-lg pl-4 pr-1.5 py-1.5 text-xs sm:text-sm\">\n <code className=\"text-cyan-300 font-mono select-all\">{cmd}</code>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={copied ? 'Copied' : 'Copy command'}\n className=\"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] transition-colors\"\n >\n {copied ? (\n <span className=\"flex items-center gap-1 text-green-400\">\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n Copied\n </span>\n ) : (\n <span className=\"flex items-center gap-1\">\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n </svg>\n Copy\n </span>\n )}\n </button>\n </div>\n );\n}\n","import useSWR from 'swr';\nimport { Session, Health, AnetConfig } from '../components/types';\nimport { useNetworkId } from './network-context';\n\nconst fetcher = async (url: string) => {\n const res = await fetch(url);\n if (res.status === 401) {\n window.location.assign('/login');\n throw new Error('unauthorized');\n }\n return res.json();\n};\n\nconst SWR_OPTIONS = { refreshInterval: 5000, dedupingInterval: 3000 };\n\n/** Append network_id to URL if set */\nfunction withNetwork(url: string, networkId: string): string {\n if (!networkId) return url;\n const sep = url.includes('?') ? '&' : '?';\n return `${url}${sep}network_id=${encodeURIComponent(networkId)}`;\n}\n\nexport function useSessions() {\n const { networkId } = useNetworkId();\n const { data, error, isLoading } = useSWR<{ sessions: Session[]; _hint?: { global_count?: number; filtered_network?: string } }>(\n withNetwork('/api/hub/status', networkId),\n fetcher,\n SWR_OPTIONS,\n );\n return { sessions: data?.sessions || [], hint: data?._hint, error, isLoading };\n}\n\nexport function useHealth() {\n const { data, error } = useSWR<Health>('/api/hub/health', fetcher, SWR_OPTIONS);\n return { health: data || null, error };\n}\n\nexport function useAnetConfig() {\n const { data } = useSWR<AnetConfig>('/api/anet/config', fetcher, { refreshInterval: 30000 });\n return { config: data || null };\n}\n\nexport function useTasks(params?: Record<string, string>) {\n const { networkId } = useNetworkId();\n const query = new URLSearchParams({ limit: '100', ...params }).toString();\n const { data, error, isLoading } = useSWR(\n withNetwork(`/api/hub/tasks?${query}`, networkId),\n fetcher,\n SWR_OPTIONS,\n );\n return {\n tasks: data?.tasks || [],\n count: data?.count ?? 0,\n source: data?.source,\n error,\n isLoading,\n };\n}\n\nexport function useStats() {\n const { networkId } = useNetworkId();\n const { data, error } = useSWR(withNetwork('/api/hub/stats', networkId), fetcher, SWR_OPTIONS);\n return { stats: data?.ok ? data : null, error };\n}\n\nexport function useLicense() {\n const { data, error } = useSWR('/api/hub/license', fetcher, { refreshInterval: 60000 });\n return { license: data?.ok ? data : null, error };\n}\n\nexport function useMessages(limit = 100) {\n const { networkId } = useNetworkId();\n const { data, error, isLoading } = useSWR(\n withNetwork(`/api/hub/messages?limit=${limit}`, networkId),\n fetcher,\n SWR_OPTIONS,\n );\n return { messages: data?.messages || [], error, isLoading };\n}\n\nexport function useNodeSession(alias: string) {\n const { data, error, isLoading } = useSWR(\n alias ? `/api/hub/session?alias=${encodeURIComponent(alias)}` : null,\n fetcher,\n SWR_OPTIONS,\n );\n return {\n session: data?.session || null,\n inbox: data?.inbox || [],\n sse: data?.sse || 0,\n error,\n isLoading,\n };\n}\n","/** Single source of truth for task status colors. Both `/tasks` (chip\n * strip, badge, distribution bar) and the Overview Recent Activity row\n * used to ship their own incomplete maps; round 66 consolidates them\n * here so adding a new status updates every consumer at once.\n *\n * Order in `TASK_STATUSES` is chronological-ish: lifecycle progress on\n * the left, terminal-good (`closed`) in the middle, terminal-bad\n * (`failed`/`cancelled`/`expired`) on the right. */\n\nexport const TASK_STATUSES = [\n 'created',\n 'delivered',\n 'acked',\n 'running',\n 'replied',\n 'closed',\n 'failed',\n 'cancelled',\n 'expired',\n] as const;\n\nexport type TaskStatus = typeof TASK_STATUSES[number];\n\n/** Pill / chip background+text+border. Tailwind classes, not inlined hex,\n * because chips are static class names safe from purge. */\nexport const STATUS_CHIP_CLASS: Record<string, string> = {\n created: 'bg-gray-500/10 text-gray-400 border-gray-500/20',\n delivered: 'bg-blue-500/10 text-blue-300 border-blue-500/20',\n acked: 'bg-cyan-500/10 text-cyan-300 border-cyan-500/20',\n running: 'bg-green-500/10 text-green-300 border-green-500/20',\n replied: 'bg-purple-500/10 text-purple-300 border-purple-500/20',\n closed: 'bg-gray-500/10 text-gray-500 border-gray-500/20',\n failed: 'bg-red-500/10 text-red-300 border-red-500/20',\n cancelled: 'bg-yellow-500/10 text-yellow-300 border-yellow-500/20',\n expired: 'bg-orange-500/10 text-orange-300 border-orange-500/20',\n};\n\n/** Inline hex dots — used wherever Tailwind would purge dynamic class\n * names (`bg-${family}-400`). Style attribute carries the color. */\nexport const STATUS_DOT_HEX: Record<string, string> = {\n created: '#9ca3af',\n delivered: '#60a5fa',\n acked: '#22d3ee',\n running: '#4ade80',\n replied: '#a78bfa',\n closed: '#6b7280',\n failed: '#f87171',\n cancelled: '#facc15',\n expired: '#fb923c',\n};\n\n/** Solid bar segment background for the Tasks distribution bar. */\nexport const STATUS_BAR_CLASS: Record<string, string> = {\n created: 'bg-gray-500',\n delivered: 'bg-blue-500',\n acked: 'bg-cyan-500',\n running: 'bg-green-500',\n replied: 'bg-purple-500',\n closed: 'bg-gray-600',\n failed: 'bg-red-500',\n cancelled: 'bg-yellow-500',\n expired: 'bg-orange-500',\n};\n"],"names":["timeAgo","dateStr","diff","Date","now","replace","getTime","s","Math","floor","statusColor","status","hasSse","formatUptime","seconds","h","m","AVATAR_HUES","aliasAvatarColors","alias","i","length","charCodeAt","hue","bg","ring","text","aliasInitial","ch","trim","match","toUpperCase","AliasAvatar","size","className","c","fs","max","round","style","width","height","fontSize","backgroundColor","borderColor","color","title","DEFAULTS","nodes","sub","tasks","messages","logs","tokens","networks","generic","Glyph","variant","baseProps","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","viewBox","cx","cy","r","x1","y1","x2","y2","strokeDasharray","opacity","x","y","rx","d","ry","EmptyState","cta","compact","headline","subcopy","iconSize","role","href","label","onClick","NodesEmptyState","hint","global_count","QuickstartCommand","cmd","target","rel","copied","setCopied","onCopy","navigator","clipboard","writeText","setTimeout","type","fetcher","url","res","fetch","window","location","assign","Error","json","SWR_OPTIONS","refreshInterval","dedupingInterval","withNetwork","networkId","sep","includes","encodeURIComponent","useSessions","data","error","isLoading","sessions","_hint","useHealth","health","useAnetConfig","config","useTasks","params","query","URLSearchParams","limit","toString","count","source","useStats","stats","ok","useLicense","license","useMessages","useNodeSession","session","inbox","sse","TASK_STATUSES","STATUS_CHIP_CLASS","created","delivered","acked","running","replied","closed","failed","cancelled","expired","STATUS_DOT_HEX","STATUS_BAR_CLASS"],"mappings":"kIAkBO,SAASa,AAAaC,CAAe,EAC1C,IAAMC,EAAIP,KAAKC,KAAK,CAACK,EAAU,MACzBE,EAAIR,KAAKC,KAAK,CAAEK,EAAU,KAAQ,WACxC,AAAIC,EAAI,EAAU,CAAP,AAAO,EAAGA,EAAE,EAAE,EAAEC,EAAE,CAAC,CAAC,CACxB,CAAA,EAAGA,EAAE,CAAC,CAAC,AAChB,cAvBO,SAAiBf,AAARD,CAAuB,EACrC,GAAI,CAACC,EAAS,MAAO,KAErB,IAAMM,EAAIC,KAAKC,KAAK,CADPN,AACQD,MADHE,GAAG,GAAK,IAAID,KAAKF,EAAQI,OAAO,CAAC,IAAK,KAAO,KAAKC,OAAO,EAAA,EAC/C,YAC5B,AAAIC,EAAI,GAAW,CAAP,AAAO,EAAGA,EAAE,KAAK,CAAC,CAC1BA,EAAI,KAAa,CAAP,AAAO,EAAGC,KAAKC,KAAK,CAACF,EAAI,IAAI,KAAK,CAAC,CAC7CA,EAAI,MAAc,CAAP,AAAO,EAAGC,KAAKC,KAAK,CAACF,EAAI,MAAM,KAAK,CAAC,CAC7C,CAAA,EAAGC,KAAKC,KAAK,CAACF,EAAI,OAAO,KAAK,CAAC,AACxC,4CCHA,IAAMU,EAAc,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,GAAI,GAAG,sBAyBnD,SAASe,AAAY,OAAEb,CAAK,CAAEc,OAAO,EAAE,WAAEC,EAAY,EAAE,CAAoB,EAChF,IAAMC,EAAIjB,AAxBL,SAA2BC,AAAlBD,CAA+B,EAC7C,IAAIH,EAAI,EACR,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ACD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[54826,(a,b,c)=>{},15299,(a,b,c)=>{a.r(54826);var d=a.r(72131),e=d&&"object"==typeof d&&"default"in d?d:{default:d},f="u">typeof process&&process.env&&!0,g=function(a){return"[object String]"===Object.prototype.toString.call(a)},h=function(){function a(a){var b=void 0===a?{}:a,c=b.name,d=void 0===c?"stylesheet":c,e=b.optimizeForSpeed,h=void 0===e?f:e;i(g(d),"`name` must be a string"),this._name=d,this._deletedRulePlaceholder="#"+d+"-deleted-rule____{}",i("boolean"==typeof h,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=h,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0,this._nonce=null}var b,c=a.prototype;return c.setOptimizeForSpeed=function(a){i("boolean"==typeof a,"`setOptimizeForSpeed` accepts a boolean"),i(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=a,this.inject()},c.isOptimizeForSpeed=function(){return this._optimizeForSpeed},c.inject=function(){var a=this;i(!this._injected,"sheet already injected"),this._injected=!0,this._serverSheet={cssRules:[],insertRule:function(b,c){return"number"==typeof c?a._serverSheet.cssRules[c]={cssText:b}:a._serverSheet.cssRules.push({cssText:b}),c},deleteRule:function(b){a._serverSheet.cssRules[b]=null}}},c.getSheetForTag=function(a){if(a.sheet)return a.sheet;for(var b=0;b<document.styleSheets.length;b++)if(document.styleSheets[b].ownerNode===a)return document.styleSheets[b]},c.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},c.insertRule=function(a,b){return i(g(a),"`insertRule` accepts only strings"),"number"!=typeof b&&(b=this._serverSheet.cssRules.length),this._serverSheet.insertRule(a,b),this._rulesCount++},c.replaceRule=function(a,b){this._optimizeForSpeed;var c=this._serverSheet;if(b.trim()||(b=this._deletedRulePlaceholder),!c.cssRules[a])return a;c.deleteRule(a);try{c.insertRule(b,a)}catch(d){f||console.warn("StyleSheet: illegal rule: \n\n"+b+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),c.insertRule(this._deletedRulePlaceholder,a)}return a},c.deleteRule=function(a){this._serverSheet.deleteRule(a)},c.flush=function(){this._injected=!1,this._rulesCount=0,this._serverSheet.cssRules=[]},c.cssRules=function(){return this._serverSheet.cssRules},c.makeStyleTag=function(a,b,c){b&&i(g(b),"makeStyleTag accepts only strings as second parameter");var d=document.createElement("style");this._nonce&&d.setAttribute("nonce",this._nonce),d.type="text/css",d.setAttribute("data-"+a,""),b&&d.appendChild(document.createTextNode(b));var e=document.head||document.getElementsByTagName("head")[0];return c?e.insertBefore(d,c):e.appendChild(d),d},b=[{key:"length",get:function(){return this._rulesCount}}],function(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}(a.prototype,b),a}();function i(a,b){if(!a)throw Error("StyleSheet: "+b+".")}var j=function(a){for(var b=5381,c=a.length;c;)b=33*b^a.charCodeAt(--c);return b>>>0},k={};function l(a,b){if(!b)return"jsx-"+a;var c=String(b),d=a+c;return k[d]||(k[d]="jsx-"+j(a+"-"+c)),k[d]}function m(a,b){var c=a+(b=b.replace(/\/style/gi,"\\/style"));return k[c]||(k[c]=b.replace(/__jsx-style-dynamic-selector/g,a)),k[c]}var n=function(){function a(a){var b=void 0===a?{}:a,c=b.styleSheet,d=void 0===c?null:c,e=b.optimizeForSpeed,f=void 0!==e&&e;this._sheet=d||new h({name:"styled-jsx",optimizeForSpeed:f}),this._sheet.inject(),d&&"boolean"==typeof f&&(this._sheet.setOptimizeForSpeed(f),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var b=a.prototype;return b.add=function(a){var b=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(a.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed());var c=this.getIdAndRules(a),d=c.styleId,e=c.rules;if(d in this._instancesCounts){this._instancesCounts[d]+=1;return}var f=e.map(function(a){return b._sheet.insertRule(a)}).filter(function(a){return -1!==a});this._indices[d]=f,this._instancesCounts[d]=1},b.remove=function(a){var b=this,c=this.getIdAndRules(a).styleId;if(function(a,b){if(!a)throw Error("StyleSheetRegistry: "+b+".")}(c in this._instancesCounts,"styleId: `"+c+"` not found"),this._instancesCounts[c]-=1,this._instancesCounts[c]<1){var d=this._fromServer&&this._fromServer[c];d?(d.parentNode.removeChild(d),delete this._fromServer[c]):(this._indices[c].forEach(function(a){return b._sheet.deleteRule(a)}),delete this._indices[c]),delete this._instancesCounts[c]}},b.update=function(a,b){this.add(b),this.remove(a)},b.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},b.cssRules=function(){var a=this,b=this._fromServer?Object.keys(this._fromServer).map(function(b){return[b,a._fromServer[b]]}):[],c=this._sheet.cssRules();return b.concat(Object.keys(this._indices).map(function(b){return[b,a._indices[b].map(function(a){return c[a].cssText}).join(a._optimizeForSpeed?"":"\n")]}).filter(function(a){return!!a[1]}))},b.styles=function(a){var b,c;return b=this.cssRules(),void 0===(c=a)&&(c={}),b.map(function(a){var b=a[0],d=a[1];return e.default.createElement("style",{id:"__"+b,key:"__"+b,nonce:c.nonce?c.nonce:void 0,dangerouslySetInnerHTML:{__html:d}})})},b.getIdAndRules=function(a){var b=a.children,c=a.dynamic,d=a.id;if(c){var e=l(d,c);return{styleId:e,rules:Array.isArray(b)?b.map(function(a){return m(e,a)}):[m(e,b)]}}return{styleId:l(d),rules:Array.isArray(b)?b:[b]}},b.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(a,b){return a[b.id.slice(2)]=b,a},{})},a}(),o=d.createContext(null);function p(){return new n}function q(){return d.useContext(o)}function r(a){var b=q();return b&&b.add(a),null}o.displayName="StyleSheetContext",e.default.useInsertionEffect||e.default.useLayoutEffect,r.dynamic=function(a){return a.map(function(a){return l(a[0],a[1])}).join(" ")},c.StyleRegistry=function(a){var b=a.registry,c=a.children,f=d.useContext(o),g=d.useState(function(){return f||b||p()})[0];return e.default.createElement(o.Provider,{value:g},c)},c.createStyleRegistry=p,c.style=r,c.useStyleRegistry=q},31626,(a,b,c)=>{b.exports=a.r(15299).style},60350,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(43515);function f({online:a,working:c,total:d,version:e,uptime:h}){let i=d>0?Math.round(a/d*100):0;return(0,b.jsxs)("div",{className:"mb-8",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Agent Network"}),(0,b.jsxs)("span",{className:"text-xs text-gray-500",children:["CommHub ",e," · ",h]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,b.jsx)(g,{value:a,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,b.jsx)(g,{value:c,label:"Working",sub:a>0?`${Math.round(c/a*100)}% utilization`:"--",color:"text-cyan-400",accent:"from-cyan-500/20 to-cyan-500/0",border:"border-cyan-500/15"}),(0,b.jsx)(g,{value:d-a,label:"Offline",sub:d-a==0?"All systems go":`${d-a} disconnected`,color:"text-gray-400",accent:"from-gray-500/10 to-gray-500/0",border:"border-gray-500/15"}),(0,b.jsx)(g,{value:d,label:"Total",sub:"Registered nodes",color:"text-white",accent:"from-blue-500/15 to-blue-500/0",border:"border-blue-500/15"})]})]})}function g({value:a,label:c,sub:d,color:e,accent:f,border:h}){let i=e.replace("text-","").split("-")[0];return(0,b.jsxs)("div",{"data-anet-stat-card":i,className:`anet-stat-card relative overflow-hidden rounded-xl border ${h} bg-[#111128] px-4 py-3 transition-all`,children:[(0,b.jsx)("div",{className:`absolute inset-0 bg-gradient-to-br ${f} pointer-events-none`}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("div",{className:`text-3xl font-bold ${e} tabular-nums leading-tight`,children:a}),(0,b.jsx)("div",{className:"text-sm text-gray-300 mt-0.5",children:c}),(0,b.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:d})]})]})}function h(){let[a,d]=(0,c.useState)(""),[e,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)(""),i=async()=>{if(a.trim()){f(!0),h("");try{let b=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a})}),c=await b.json();c.ok?(h(`Broadcast sent to ${c.recipients} node(s)`),d("")):h(`Failed: ${c.error||"Send error"}`)}catch(a){h(`Failed: ${a instanceof Error?a.message:"Send error"}`)}f(!1),setTimeout(()=>h(""),5e3)}};return(0,b.jsxs)("div",{className:"mb-6",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)("input",{type:"text",value:a,onChange:a=>d(a.target.value),onKeyDown:a=>"Enter"===a.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,b.jsx)("button",{onClick:i,disabled:e||!a.trim(),"aria-label":"Send broadcast",className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-all font-medium cursor-pointer disabled:cursor-not-allowed",children:e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,b.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),(0,b.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),(0,b.jsx)("span",{children:"Sending…"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{d:"M3 11v3a1 1 0 0 0 1 1h2l3.29 3.29a1 1 0 0 0 1.71-.71V7.42a1 1 0 0 0-1.71-.71L6 10H4a1 1 0 0 0-1 1Z"}),(0,b.jsx)("path",{d:"M16 8a5 5 0 0 1 0 6",opacity:"0.7"}),(0,b.jsx)("path",{d:"M19 5a9 9 0 0 1 0 12",opacity:"0.45"})]}),(0,b.jsx)("span",{children:"Broadcast"})]})})]}),a.length>0&&(0,b.jsxs)("div",{className:"text-right text-xs text-gray-600 mt-1 tabular-nums",children:[a.length,"/500"]}),g&&(0,b.jsx)("div",{className:`mt-3 text-sm text-center anet-fade-in ${g.startsWith("Failed")?"text-red-400":"text-green-400/80"}`,children:g})]})}function i(a,b,c,d=0){let e=b<=2?Math.PI:1.78*Math.PI,f=-Math.PI/2-e/2,g=b<=1?-Math.PI/2:f+e*a/(b-1)+d;return{x:500+c*Math.cos(g),y:330+c*Math.sin(g)}}function j(a,b,c=0){let d=(a.x+b.x)/2,e=(a.y+b.y)/2,f=b.x-a.x,g=b.y-a.y,h=Math.hypot(f,g)||1,i={x:d+-g/h*c,y:e+f/h*c};return`M${a.x},${a.y} Q${i.x},${i.y} ${b.x},${b.y}`}function k(a,b){return a.length>b?`${a.slice(0,b-1)}...`:a}let l={panelStops:["#0b1220","#080814","#101018"],radarStops:[{color:"#22d3ee",opacity:.18},{color:"#22c55e",opacity:.045},{color:"#020617",opacity:0}],arrowFill:"#67e8f9",ringStroke:"#164e63",spokeStroke:{active:"#22d3ee",idle:"#155e75"},flowEdge:"#67e8f9",flowPath:"#e0f2fe",flowParticle:"#fef08a",nodeFill:{online:"#020617",offline:"#080814"},labelBox:{fill:"#020617",stroke:"#1f2937"},legendBox:{fill:"#020617",stroke:"#1f2937"},legendText:"#94a3b8",legendHeadline:"#e5e7eb",legendAccent:"#67e8f9",containerBg:"#080814",containerBorder:"#2a2a4a",topRailGradient:"from-transparent via-cyan-400/70 to-transparent"},m={panelStops:["#f8fafc","#ffffff","#f1f5f9"],radarStops:[{color:"#10b981",opacity:.06},{color:"#3b82f6",opacity:.03},{color:"#ffffff",opacity:0}],arrowFill:"#10b981",ringStroke:"#cbd5e1",spokeStroke:{active:"#10b981",idle:"#cbd5e1"},flowEdge:"#10b981",flowPath:"#475569",flowParticle:"#f59e0b",nodeFill:{online:"#ffffff",offline:"#f8fafc"},labelBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendText:"#475569",legendHeadline:"#0f172a",legendAccent:"#0d9488",containerBg:"#ffffff",containerBorder:"#e3e6eb",topRailGradient:"from-transparent via-emerald-500/40 to-transparent"};function n({sessions:a,sseSessions:d}){let e="light"===function(){let[a,b]=(0,c.useState)("dark");return(0,c.useEffect)(()=>{let a=()=>{let a=document.documentElement.getAttribute("data-theme")||"cyber";b("light"===a||"mint"===a?"light":"dark")};a();let c=new MutationObserver(a);return c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>c.disconnect()},[]),a}(),f=e?m:l,[g,h]=(0,c.useState)([]);(0,c.useEffect)(()=>{let a=async()=>{try{let a=await fetch("/api/hub/messages?limit=50");if(401===a.status)return void window.location.assign("/login");let b=await a.json();h(b.messages||[])}catch{}};a();let b=setInterval(a,5e3);return()=>clearInterval(b)},[]);let{onlineNodes:o,offlineNodes:p,nodePositions:q,flowLinks:r,activeAliases:s}=(0,c.useMemo)(()=>{let b,c=a=>(a.network_id?d[`${a.network_id}:${a.alias}`]:void 0)??d[a.alias],e=a.filter(a=>"offline"!==a.status||c(a)),f=a.filter(a=>"offline"===a.status&&!c(a)),h={};e.forEach((a,b)=>{h[a.alias]=i(b,Math.max(e.length,1),220)});let j=e.length<=2?Math.PI:1.78*Math.PI,k=e.length>1?j/(e.length-1):0,l=e.length>0?k/2:0,m=315+6*Math.max(0,f.length-4);f.forEach((a,b)=>{h[a.alias]=i(b,Math.max(f.length,1),m,l)});let n=(b=new Map,g.forEach(a=>{if(!h[a.from_alias]||!h[a.to_alias]||a.from_alias===a.to_alias)return;let c=`${a.from_alias}->${a.to_alias}`,d=b.get(c);b.set(c,{key:c,from:a.from_alias,to:a.to_alias,count:(d?.count||0)+1,content:d?.content||a.content})}),[...b.values()].slice(0,18)),o=new Set;return n.forEach(a=>{o.add(a.from),o.add(a.to)}),{onlineNodes:e,offlineNodes:f,nodePositions:h,flowLinks:n,activeAliases:o}},[g,a,d]),t=o.filter(a=>"working"===a.status).length;return(0,b.jsxs)("section",{className:"w-full max-w-6xl mx-auto mb-8",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between mb-3 px-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs uppercase text-gray-600 tracking-wider",children:"Network Topology"}),(0,b.jsx)("h2",{className:"text-lg text-white font-semibold",children:"Command mesh"})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,b.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20",children:[t," working"]}),(0,b.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20",children:[o.length," online"]}),(0,b.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20",children:[r.length," active links"]})]})]}),(0,b.jsxs)("div",{className:`relative overflow-hidden rounded-lg border shadow-2xl ${e?"shadow-zinc-900/5":"shadow-cyan-950/30"}`,style:{background:f.containerBg,borderColor:f.containerBorder},children:[(0,b.jsx)("div",{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r ${f.topRailGradient}`}),(0,b.jsxs)("svg",{viewBox:"0 0 1000 680",className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",children:[(0,b.jsxs)("defs",{children:[(0,b.jsxs)("linearGradient",{id:"topo-panel",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,b.jsx)("stop",{offset:"0%",stopColor:f.panelStops[0]}),(0,b.jsx)("stop",{offset:"48%",stopColor:f.panelStops[1]}),(0,b.jsx)("stop",{offset:"100%",stopColor:f.panelStops[2]})]}),(0,b.jsxs)("radialGradient",{id:"topo-radar",cx:"50%",cy:"50%",r:"55%",children:[(0,b.jsx)("stop",{offset:"0%",stopColor:f.radarStops[0].color,stopOpacity:f.radarStops[0].opacity}),(0,b.jsx)("stop",{offset:"45%",stopColor:f.radarStops[1].color,stopOpacity:f.radarStops[1].opacity}),(0,b.jsx)("stop",{offset:"100%",stopColor:f.radarStops[2].color,stopOpacity:f.radarStops[2].opacity})]}),!e&&(0,b.jsxs)("filter",{id:"topo-glow",children:[(0,b.jsx)("feGaussianBlur",{stdDeviation:"4",result:"blur"}),(0,b.jsxs)("feMerge",{children:[(0,b.jsx)("feMergeNode",{in:"blur"}),(0,b.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),(0,b.jsx)("marker",{id:"topo-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:(0,b.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:f.arrowFill})}),(0,b.jsxs)("radialGradient",{id:"topo-sweep",cx:"0%",cy:"50%",r:"100%",children:[(0,b.jsx)("stop",{offset:"0%",stopColor:e?"#0d9488":"#22d3ee",stopOpacity:e?.18:.32}),(0,b.jsx)("stop",{offset:"70%",stopColor:e?"#0d9488":"#22d3ee",stopOpacity:e?.1:.18}),(0,b.jsx)("stop",{offset:"100%",stopColor:e?"#0d9488":"#22d3ee",stopOpacity:"0"})]})]}),(0,b.jsx)("rect",{width:"1000",height:"680",fill:"url(#topo-panel)"}),(0,b.jsx)("circle",{cx:500,cy:330,r:"330",fill:"url(#topo-radar)"}),!e&&(0,b.jsx)("g",{opacity:"0.5",children:Array.from({length:28}).map((a,c)=>{let d=9301*c+49297;return(0,b.jsx)("circle",{cx:13*d%1e3,cy:7*d%680,r:c%3==0?1.2:.7,fill:"#a5b4fc",opacity:.35+c%4*.05},c)})}),(0,b.jsx)("g",{style:{transformOrigin:"500px 330px",transformBox:"view-box"},className:"anet-topo-sweep",opacity:e?.7:1,children:(0,b.jsx)("path",{d:`M 500 330 L 830 330 A 330 330 0 0 0 ${500+330*Math.cos(-Math.PI/4.5)} ${330+330*Math.sin(-Math.PI/4.5)} Z`,fill:"url(#topo-sweep)"})}),[90,170,250,330].map(a=>(0,b.jsx)("circle",{cx:500,cy:330,r:a,fill:"none",stroke:f.ringStroke,strokeWidth:"1",opacity:e?.6:.35},a)),!e&&[0,.25,.5,.75].map((a,c)=>(0,b.jsx)("g",{children:(0,b.jsx)("circle",{cx:830,cy:330,r:0===c?2.8:2.2,fill:"#22d3ee",opacity:.9,filter:"url(#topo-glow)",children:(0,b.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:`${360*a} 500 330`,to:`${360*a+360} 500 330`,dur:"16s",repeatCount:"indefinite"})})},`orbit-${c}`)),[0,30,60,90,120,150].map(a=>(0,b.jsx)("line",{x1:500-360*Math.cos(a*Math.PI/180),y1:330-360*Math.sin(a*Math.PI/180),x2:500+360*Math.cos(a*Math.PI/180),y2:330+360*Math.sin(a*Math.PI/180),stroke:f.ringStroke,strokeWidth:"1",opacity:e?.35:.18},a)),o.map((a,c)=>{let d=q[a.alias];if(!d)return null;let e=j({x:500,y:330},d,0),g=s.has(a.alias);return(0,b.jsx)("path",{d:e,fill:"none",stroke:g?f.spokeStroke.active:f.spokeStroke.idle,strokeWidth:g?2:1,strokeDasharray:g?"none":"6 14",opacity:g?.7:.45,className:g?void 0:"anet-topo-spoke-flow",style:g?void 0:{animationDelay:`${-(.25*c)}s`}},`hub-${a.alias}`)}),r.map((a,c)=>{let d=q[a.from],g=q[a.to];if(!d||!g)return null;let h=j(d,g,c%2==0?36:-36),i=Math.min(2+a.count,7);return(0,b.jsxs)("g",{children:[(0,b.jsx)("path",{d:h,fill:"none",stroke:f.flowEdge,strokeWidth:i,opacity:e?.22:.28,filter:e?void 0:"url(#topo-glow)",markerEnd:"url(#topo-arrow)"}),(0,b.jsx)("path",{id:`flow-path-${c}`,d:h,fill:"none",stroke:f.flowPath,strokeWidth:"1",strokeDasharray:"2 12",opacity:e?.4:.75}),(0,b.jsx)("circle",{r:"4",fill:f.flowParticle,filter:e?void 0:"url(#topo-glow)",children:(0,b.jsx)("animateMotion",{dur:`${2.2+c%5*.32}s`,repeatCount:"indefinite",path:h})})]},a.key)}),(0,b.jsxs)("g",{children:[(0,b.jsx)("circle",{cx:500,cy:330,r:"18",fill:e?"#d1fae5":"#10b981",opacity:e?.35:.1}),(0,b.jsxs)("circle",{cx:500,cy:330,r:"10",fill:"none",stroke:"#10b981",strokeWidth:"1.5",children:[(0,b.jsx)("animate",{attributeName:"r",values:"10;38;10",dur:"2.4s",repeatCount:"indefinite"}),(0,b.jsx)("animate",{attributeName:"opacity",values:"0.55;0;0.55",dur:"2.4s",repeatCount:"indefinite"})]}),(0,b.jsxs)("circle",{cx:500,cy:330,r:"10",fill:"none",stroke:"#10b981",strokeWidth:"1.5",opacity:"0",children:[(0,b.jsx)("animate",{attributeName:"r",values:"10;38;10",dur:"2.4s",begin:"1.2s",repeatCount:"indefinite"}),(0,b.jsx)("animate",{attributeName:"opacity",values:"0.45;0;0.45",dur:"2.4s",begin:"1.2s",repeatCount:"indefinite"})]}),(0,b.jsx)("circle",{cx:500,cy:330,r:"10",fill:e?"#059669":"#10b981"}),(0,b.jsx)("circle",{cx:500,cy:330,r:"5",fill:"#d1fae5",opacity:"0.9"})]}),[...o,...p].map(a=>{let c=q[a.alias];if(!c)return null;let g=(a.network_id?d[`${a.network_id}:${a.alias}`]:void 0)??d[a.alias],h="offline"!==a.status||!!g,i=h?"working"===a.status?{label:"working",primary:e?"#059669":"#22c55e",halo:e?"#d1fae5":"#14532d",text:e?"#065f46":"#dcfce7"}:"idle"===a.status?{label:"idle",primary:e?"#0d9488":"#2dd4bf",halo:e?"#ccfbf1":"#134e4a",text:e?"#115e59":"#ccfbf1"}:{label:a.status||"online",primary:e?"#0284c7":"#38bdf8",halo:e?"#dbeafe":"#0c4a6e",text:e?"#0c4a6e":"#e0f2fe"}:{label:"offline",primary:e?"#94a3b8":"#6b7280",halo:e?"#e2e8f0":"#111827",text:e?"#475569":"#9ca3af"},j=s.has(a.alias),l=h?26:18;return(0,b.jsxs)("g",{className:"transition-opacity",children:[j&&(0,b.jsxs)("circle",{cx:c.x,cy:c.y,r:l+14,fill:i.primary,opacity:e?.08:.12,children:[(0,b.jsx)("animate",{attributeName:"r",values:`${l+8};${l+22};${l+8}`,dur:"2.4s",repeatCount:"indefinite"}),(0,b.jsx)("animate",{attributeName:"opacity",values:e?"0.12;0.02;0.12":"0.18;0.04;0.18",dur:"2.4s",repeatCount:"indefinite"})]}),(0,b.jsx)("circle",{cx:c.x,cy:c.y,r:l+8,fill:i.halo,opacity:h?e?.85:.65:e?.4:.25}),(0,b.jsx)("circle",{cx:c.x,cy:c.y,r:l,fill:h?f.nodeFill.online:f.nodeFill.offline,stroke:i.primary,strokeWidth:h?3:1.5,strokeDasharray:h?"none":"5 5",filter:h&&!e?"url(#topo-glow)":void 0}),(0,b.jsx)("circle",{cx:c.x,cy:c.y,r:h?8:5,fill:i.primary}),"working"===a.status&&(0,b.jsx)("path",{d:`M${c.x-9},${c.y+11} h18`,stroke:f.flowParticle,strokeWidth:"3",strokeLinecap:"round",children:(0,b.jsx)("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"})}),(0,b.jsxs)("g",{transform:`translate(${c.x}, ${c.y+l+22})`,children:[(0,b.jsx)("rect",{x:"-62",y:"-14",width:"124",height:"42",rx:"6",fill:f.labelBox.fill,stroke:f.labelBox.stroke,opacity:e?1:.94}),(0,b.jsx)("text",{x:"0",y:"1",textAnchor:"middle",fill:i.text,fontSize:"12",fontFamily:"monospace",fontWeight:"700",children:k(a.alias,14)}),(0,b.jsxs)("text",{x:"0",y:"17",textAnchor:"middle",fill:i.primary,fontSize:"9",fontFamily:"monospace",children:[i.label,h&&null!=g?` sse:${g}`:""]})]})]},a.alias)}),(0,b.jsxs)("g",{transform:"translate(28, 34)",children:[(0,b.jsx)("rect",{x:"0",y:"0",width:"285",height:60+20*Math.min(r.length,4),rx:"8",fill:f.legendBox.fill,stroke:f.legendBox.stroke,opacity:e?1:.94}),(0,b.jsx)("text",{x:"16",y:"26",fill:f.legendHeadline,fontSize:"13",fontFamily:"monospace",fontWeight:"700",children:"recent signal"}),(0,b.jsxs)("text",{x:"178",y:"26",fill:f.legendAccent,fontSize:"11",fontFamily:"monospace",children:[g.length," messages"]}),r.slice(0,4).map((a,c)=>(0,b.jsxs)("text",{x:"16",y:54+20*c,fill:f.legendText,fontSize:"10",fontFamily:"monospace",children:[k(a.from,8)," ","->"," ",k(a.to,8)," / ",a.count," / ",k(a.content,18)]},a.key))]}),(0,b.jsxs)("g",{transform:"translate(720, 34)",children:[(0,b.jsx)("rect",{x:"0",y:"0",width:"250",height:"112",rx:"8",fill:f.legendBox.fill,stroke:f.legendBox.stroke,opacity:e?1:.94}),(0,b.jsx)("circle",{cx:"18",cy:"26",r:"6",fill:e?"#059669":"#22c55e"}),(0,b.jsx)("text",{x:"34",y:"30",fill:f.legendText,fontSize:"11",fontFamily:"monospace",children:"working node"}),(0,b.jsx)("circle",{cx:"18",cy:"52",r:"6",fill:e?"#0d9488":"#2dd4bf"}),(0,b.jsx)("text",{x:"34",y:"56",fill:f.legendText,fontSize:"11",fontFamily:"monospace",children:"online idle"}),(0,b.jsx)("circle",{cx:"18",cy:"78",r:"6",fill:e?"#94a3b8":"#6b7280"}),(0,b.jsx)("text",{x:"34",y:"82",fill:f.legendText,fontSize:"11",fontFamily:"monospace",children:"offline / no SSE"}),(0,b.jsx)("path",{d:"M150,78 Q176,52 210,78",fill:"none",stroke:f.flowEdge,strokeWidth:"3",markerEnd:"url(#topo-arrow)"})]})]})]})]})}var o=a.i(1720);let p={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:""}},q={bg:"bg-gray-800/50 border-gray-700/30",text:"text-gray-500",dot:"bg-gray-500",glow:""};function r({session:a,hasSse:c,sseCount:f,onChat:g}){let h=c&&p[a.status]||q;return(0,b.jsxs)(d.default,{href:`/node?alias=${encodeURIComponent(a.alias)}`,prefetch:!1,className:`anet-agent-card group relative block rounded-xl border p-4 transition-all duration-300 cursor-pointer hover:-translate-y-0.5 ${c?`bg-[#111128] border-[#2a2a4a] hover:border-cyan-500/30 hover:shadow-lg ${h.glow}`:"bg-[#0d0d1a] border-[#1a1a2a] opacity-40"}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(o.AliasAvatar,{alias:a.alias,size:22}),(0,b.jsx)("span",{className:"font-semibold text-white truncate text-sm",title:a.alias,children:a.alias}),(0,b.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${h.dot} ${c&&"working"===a.status?"animate-pulse":""}`})]}),(0,b.jsx)("span",{className:`text-[11px] px-2 py-0.5 rounded-md border shrink-0 ${h.bg} ${h.text}`,children:c?a.status:"offline"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,b.jsx)("span",{className:"text-xs text-gray-600 bg-[#0a0a15] px-2 py-0.5 rounded border border-[#1a1a2a]",children:a.agent||"unknown"}),c&&(0,b.jsxs)("span",{className:"text-[10px] text-green-500",children:["SSE:",f]})]}),a.task?(0,b.jsx)("div",{className:"text-xs text-gray-400 bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] line-clamp-2",title:a.task,children:a.task}):(0,b.jsx)("div",{className:"text-xs text-gray-700 italic",children:"No active task"}),a.progress>0&&(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsxs)("div",{className:"flex justify-between text-[10px] mb-1",children:[(0,b.jsx)("span",{className:"text-gray-600",children:"Progress"}),(0,b.jsxs)("span",{className:h.text,children:[a.progress,"%"]})]}),(0,b.jsx)("div",{className:"w-full bg-gray-800 rounded-full h-1.5 overflow-hidden",children:(0,b.jsx)("div",{className:`h-1.5 rounded-full transition-all duration-700 ${"working"===a.status?"bg-green-500":"bg-cyan-500"}`,style:{width:`${Math.min(a.progress,100)}%`}})})]}),(0,b.jsxs)("div",{className:"mt-3 flex justify-between items-center text-[10px] text-gray-600",children:[(0,b.jsx)("span",{className:"truncate",title:a.server||"",children:a.server||"--"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[g&&c&&(0,b.jsx)("button",{onClick:b=>{b.preventDefault(),b.stopPropagation(),g(a.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,b.jsx)("span",{children:(0,e.timeAgo)(a.updated_at)}),(0,b.jsx)("svg",{"aria-hidden":!0,className:"w-3 h-3 text-gray-700 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-200",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M9 18l6-6-6-6"})})]})]})]})}function s({messages:a}){return 0===a.length?null:(0,b.jsxs)("div",{className:"mt-8",children:[(0,b.jsxs)("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Inbox"}),(0,b.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:a.length})]}),(0,b.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto pr-1 scrollbar-thin",children:a.map(a=>(0,b.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm transition-colors hover:border-[#3a3a5a]",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs mb-1.5",children:[a.from_session&&(0,b.jsx)(o.AliasAvatar,{alias:a.from_session,size:16}),(0,b.jsx)("span",{className:"text-gray-200 font-medium truncate",children:a.from_session}),(0,b.jsx)("span",{className:"ml-auto text-gray-600 shrink-0",title:a.created_at,children:(0,e.timeAgo)(a.created_at)})]}),(0,b.jsx)("div",{className:"text-gray-300 leading-relaxed",children:a.content})]},a.id))})]})}function t(){return(0,b.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,b.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8 anet-skeleton-pulse",children:[1,2,3,4].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-4 py-3",children:[(0,b.jsx)(u,{w:"2.5rem",h:"1.75rem"}),(0,b.jsx)(u,{w:"3.5rem",h:"0.75rem",className:"mt-2"}),(0,b.jsx)(u,{w:"5rem",h:"0.625rem",className:"mt-1"})]},a))}),(0,b.jsxs)("div",{className:"flex items-center gap-3 mb-3 anet-skeleton-pulse",children:[(0,b.jsx)(u,{w:"6rem",h:"2.5rem",rounded:"0.75rem"}),(0,b.jsxs)("div",{className:"flex-1 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-2.5 flex items-center gap-3",children:[(0,b.jsx)("div",{className:"w-8 h-8 rounded-full anet-skeleton-bar"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)(u,{w:"6rem",h:"0.875rem"}),(0,b.jsx)(u,{w:"10rem",h:"0.625rem",className:"mt-1"})]})]})]}),(0,b.jsx)("div",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 anet-skeleton-pulse",children:(0,b.jsx)(u,{w:"14rem",h:"0.875rem"})}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-3 anet-skeleton-pulse",children:[1,2,3].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-3",children:[(0,b.jsx)(u,{w:"2rem",h:"1.25rem"}),(0,b.jsx)(u,{w:"2.5rem",h:"0.75rem",className:"mt-1"}),(0,b.jsx)(u,{w:"3.5rem",h:"0.625rem",className:"mt-px"})]},a))}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-6 anet-skeleton-pulse",children:[1,2,3].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 flex items-center justify-center gap-2",children:[(0,b.jsx)("div",{className:"w-4 h-4 rounded anet-skeleton-bar"}),(0,b.jsx)(u,{w:"4rem",h:"0.75rem"})]},a))}),(0,b.jsxs)("div",{className:"mb-6 flex gap-2 anet-skeleton-pulse",children:[(0,b.jsx)("div",{className:"flex-1 h-10 rounded-lg border border-[#2a2a4a] bg-[#111128]"}),(0,b.jsx)("div",{className:"w-28 h-10 rounded-lg anet-skeleton-bar"})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4 anet-skeleton-pulse",children:[1,2,3,4].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] p-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,b.jsx)("div",{className:"w-2 h-2 rounded-full anet-skeleton-bar"}),(0,b.jsx)(u,{w:"6rem",h:"0.875rem"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(u,{w:"100%",h:"0.625rem"}),(0,b.jsx)(u,{w:"75%",h:"0.625rem"}),(0,b.jsx)(u,{w:"55%",h:"0.625rem"})]})]},a))})]})}function u({w:a,h:c,rounded:d,className:e}){return(0,b.jsx)("div",{className:`anet-skeleton-bar ${e||""}`,style:{width:a,height:c,borderRadius:d||"0.375rem"}})}var v=a.i(53142);let w={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"},x={created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee",running:"#4ade80",replied:"#a78bfa",closed:"#6b7280",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c"};var y=a.i(22397);function z(){let{setNetworkId:a}=(0,y.useNetworkId)(),[d,e]=(0,c.useState)({user:null,networks:[],currentNetwork:"",token:""}),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let a=sessionStorage.getItem("anet_v3_auth");if(a)try{e(JSON.parse(a))}catch{}},[]);let[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),v=async()=>{try{await fetch(`/api/hub/auth?token=${d.token}&endpoint=/api/auth/me`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:d.token,display_name:r,email:t})});let a=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:d.token,display_name:r,email:t})}),b=await a.json();if(b.ok&&b.user){let a={...d,user:b.user};e(a),sessionStorage.setItem("anet_v3_auth",JSON.stringify(a)),q(!1)}}catch{}};if(!d.user)return null;let w=(d.user.display_name||d.user.username).slice(0,2).toUpperCase();return(0,b.jsxs)("div",{className:"flex items-center justify-between bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-xs font-bold text-white",children:w}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm text-white font-medium",children:d.user.display_name||d.user.username}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-500",children:[d.user.role," · ",d.user.user_id]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[d.networks.length>0&&(0,b.jsx)("select",{value:d.currentNetwork,onChange:b=>{let c={...d,currentNetwork:b.target.value};e(c),a(b.target.value),sessionStorage.setItem("anet_v3_auth",JSON.stringify(c))},className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white focus:outline-none",children:d.networks.map(a=>(0,b.jsx)("option",{value:a.network_id,children:a.network_name},a.network_id))}),(0,b.jsxs)("button",{onClick:()=>{s(d.user?.display_name||""),u(""),q(!p)},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Edit profile",children:[(0,b.jsx)("span",{className:"hidden sm:inline",children:"Edit"}),(0,b.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.862 4.487z"})})]}),(0,b.jsxs)("button",{onClick:()=>{e({user:null,networks:[],currentNetwork:"",token:""}),sessionStorage.removeItem("anet_v3_auth")},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Sign out",children:[(0,b.jsx)("span",{className:"hidden sm:inline",children:"Sign out"}),(0,b.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})})]})]}),p&&(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#2a2a4a]",children:[(0,b.jsx)("input",{type:"text",value:r,onChange:a=>s(a.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,b.jsx)("input",{type:"email",value:t,onChange:a=>u(a.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,b.jsx)("button",{onClick:v,className:"px-2 py-1 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded",children:"Save"})]})]})}var A=a.i(31626),B=a.i(15261);function C({tabs:a,activeTab:c,onOpenTab:d,onCloseTab:e,onSetActive:f,onClose:g}){return 0===a.length?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{onClick:g,className:"jsx-f7cf3d1a6fdfc074 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,b.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,b.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 flex items-center border-b border-[#2a2a4a] bg-[#0d0d1a] overflow-x-auto",children:[(0,b.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 flex min-w-0",children:a.map(a=>(0,b.jsxs)("button",{onClick:()=>f(a),className:`jsx-f7cf3d1a6fdfc074 flex items-center gap-1.5 px-3 py-2.5 text-xs border-b-2 transition-colors shrink-0 ${c===a?"border-cyan-400 text-cyan-300 bg-cyan-500/5":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,b.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 w-2 h-2 rounded-full ${c===a?"bg-cyan-400":"bg-gray-600"}`}),(0,b.jsx)("span",{className:"jsx-f7cf3d1a6fdfc074 max-w-[80px] truncate",children:a}),(0,b.jsx)("button",{onClick:b=>{b.stopPropagation(),e(a)},className:"jsx-f7cf3d1a6fdfc074 ml-1 text-gray-600 hover:text-gray-300 p-0.5",children:"×"})]},a))}),(0,b.jsx)("button",{onClick:g,className:"jsx-f7cf3d1a6fdfc074 text-gray-500 hover:text-white px-3 py-2.5 shrink-0 border-l border-[#2a2a4a]",children:(0,b.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-f7cf3d1a6fdfc074 w-4 h-4",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-f7cf3d1a6fdfc074"})})})]}),(0,b.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 relative overflow-hidden",children:a.map(a=>(0,b.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 absolute inset-0 ${c===a?"block":"hidden"}`,children:(0,b.jsx)(D,{alias:a})},a))})]}),(0,b.jsx)(A.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 D({alias:a}){return(0,b.jsx)(B.TaskChatPanel,{alias:a,onClose:()=>{},inline:!0})}function E({sessions:a,onClose:d}){let[e,f]=(0,c.useState)(new Set),[g,h]=(0,c.useState)(""),[i,j]=(0,c.useState)("normal"),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)([]),[p,q]=(0,c.useState)(""),r=a.filter(a=>"offline"!==a.status).filter(a=>!p||a.alias.toLowerCase().includes(p.toLowerCase())||(a.agent||"").toLowerCase().includes(p.toLowerCase())),s=async()=>{if(!g.trim()||0===e.size||k)return;l(!0),n([]);let a=[...e].map(async a=>{try{let b=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:a,task:g,priority:i})}),c=await b.json();return{alias:a,ok:!!c.ok,error:c.error}}catch(b){return{alias:a,ok:!1,error:"send failed"}}});n(await Promise.all(a)),l(!1)},t=m.filter(a=>a.ok).length;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40 anet-fade-in",onClick:d}),(0,b.jsxs)("div",{className:"fixed inset-4 lg:inset-x-[15%] lg:inset-y-[5%] bg-[#0a0a1a] border border-[#2a2a4a] rounded-2xl z-50 flex flex-col shadow-2xl shadow-black/70 overflow-hidden anet-fade-in",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-lg font-bold text-white",children:"Dispatch Task"}),(0,b.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Send a task to one or more agents"})]}),(0,b.jsx)("button",{onClick:d,className:"text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,b.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,b.jsxs)("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden",children:[(0,b.jsxs)("div",{className:"lg:w-[280px] border-b lg:border-b-0 lg:border-r border-[#2a2a4a] flex flex-col",children:[(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-[#2a2a4a]",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.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,b.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,b.jsx)("button",{onClick:()=>{e.size===r.length?f(new Set):f(new Set(r.map(a=>a.alias)))},className:"text-[10px] text-cyan-400 hover:text-cyan-300",children:e.size===r.length?"Deselect all":`Select all (${r.length})`}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.size," selected"]})]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5 max-h-[200px] lg:max-h-none",children:[r.map(a=>(0,b.jsxs)("button",{onClick:()=>{var b;return b=a.alias,void f(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-left transition-colors ${e.has(a.alias)?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/20":"text-gray-400 hover:bg-[#1a1a2a]"}`,children:[(0,b.jsx)(o.AliasAvatar,{alias:a.alias,size:16}),(0,b.jsx)("div",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"working"===a.status?"bg-green-400":"idle"===a.status?"bg-cyan-400":"bg-gray-500"}`}),(0,b.jsx)("span",{className:"truncate flex-1",children:a.alias}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600",children:a.agent||"--"})]},a.alias)),0===r.length&&(0,b.jsx)("div",{className:"text-center text-xs text-gray-600 py-4",children:"No online agents"})]})]}),(0,b.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,b.jsxs)("div",{className:"flex-1 px-6 py-4 flex flex-col",children:[(0,b.jsx)("label",{className:"text-xs text-gray-500 uppercase mb-2",children:"Task Prompt"}),(0,b.jsx)("textarea",{value:g,onChange:a=>h(a.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,b.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[(0,b.jsxs)("select",{value:i,onChange:a=>j(a.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white focus:outline-none",children:[(0,b.jsx)("option",{value:"normal",children:"Normal priority"}),(0,b.jsx)("option",{value:"high",children:"High priority"}),(0,b.jsx)("option",{value:"low",children:"Low priority"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)("button",{onClick:s,disabled:k||!g.trim()||0===e.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:k?(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Sending..."]}):`Dispatch to ${e.size} agent${e.size>1?"s":""}`})]})]}),m.length>0&&(0,b.jsxs)("div",{className:"px-6 py-3 border-t border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,b.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:[t,"/",m.length," dispatched successfully"]}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m.map(a=>(0,b.jsxs)("span",{className:`flex items-center gap-1.5 text-[10px] pl-1 pr-2 py-0.5 rounded-full border ${a.ok?"text-green-300 border-green-500/20 bg-green-500/5":"text-red-300 border-red-500/20 bg-red-500/5"}`,children:[(0,b.jsx)(o.AliasAvatar,{alias:a.alias,size:14}),(0,b.jsx)("span",{children:a.alias}),(0,b.jsx)("span",{"aria-hidden":!0,children:a.ok?"✓":a.error||"✗"})]},a.alias))})]})]})]})]})]})}var F=a.i(44332),G=a.i(58224),H=a.i(64565);a.s(["default",0,function(){let a,g,i,j,k;(0,c.useEffect)(()=>{sessionStorage.getItem("anet_v3_auth")||(fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login"))},[]);let{sessions:l,hint:m,error:p,isLoading:q}=(0,F.useSessions)(),{health:u}=(0,F.useHealth)(),{config:y}=(0,F.useAnetConfig)(),{tasks:A}=(0,F.useTasks)({limit:"500"}),{stats:B}=(0,F.useStats)(),{license:D}=(0,F.useLicense)(),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(!1),M=function(){let[a,b]=(0,c.useState)([]),[d,e]=(0,c.useState)("");return{tabs:a,activeTab:d,openTab:a=>{b(b=>b.includes(a)?b:[...b,a]),e(a)},closeTab:a=>{b(b=>{let c=b.filter(b=>b!==a);return d===a&&e(c[c.length-1]||""),c})},closeAll:()=>{b([]),e("")},setActiveTab:e}}(),[N,O]=(0,c.useState)(!1),[P,Q]=(0,c.useState)([]),[R,S]=(0,c.useState)("all"),{mutate:T}=(0,H.useSWRConfig)(),U="1"!==process.env.NEXT_PUBLIC_DISABLE_SSE,{connected:V,supported:W}=(0,G.useSSE)({url:"/api/hub/events",enabled:U,onEvent:a=>{["new_task","new_message","new_reply","node_status_changed","broadcast"].includes(a.type)&&(T("/api/hub/status"),T(a=>"string"==typeof a&&a.startsWith("/api/hub/tasks"),void 0,{revalidate:!0}))}});if((0,c.useEffect)(()=>{let a=()=>{fetch("/api/hub/inbox").then(a=>a.json()).then(a=>{a.messages?.length&&Q(b=>{let c=new Set(b.map(a=>a.id));return[...a.messages.filter(a=>!c.has(a.id)),...b].slice(0,100)})}).catch(()=>{})};a();let b=setInterval(a,1e4);return()=>clearInterval(b)},[]),q)return(0,b.jsx)(t,{});let X=u?.sse_sessions||{},Y=a=>(a.network_id?X[`${a.network_id}:${a.alias}`]:void 0)??X[a.alias],Z=a=>"offline"!==a.status||!!Y(a),$=l.filter(Z).length,_=l.length,aa=l.filter(a=>"working"===a.status).length,ab=u?(0,e.formatUptime)(u.uptime):"--",ac=u?.version||"--",ad=!!(y?.hub&&y.tokenConfigured),ae=y?.source==="file"?"Local config":y?.source==="runtime-env"?"Runtime env":"Config missing",af={};if(B?.tasks?.by_status?.length)for(let a of B.tasks.by_status)af[a.status]=a.count;else for(let a of A)af[a.status]=(af[a.status]||0)+1;let ag=[...l].sort((a,b)=>{let c=+!!Z(a),d=+!!Z(b);if(c!==d)return d-c;let e=+("working"===a.status);return("working"===b.status)-e});return(0,b.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,b.jsx)("div",{className:"lg:ml-0 ml-10",children:(0,b.jsx)(f,{online:$,working:aa,total:_,version:ac,uptime:ab})}),(0,b.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,b.jsx)("button",{onClick:()=>O(!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,b.jsx)("div",{className:"flex-1",children:(0,b.jsx)(z,{})})]}),(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,b.jsxs)("button",{onClick:()=>L(!K),className:"w-full flex items-center justify-between text-left",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)("span",{className:"uppercase text-gray-600",children:"Config"}),(0,b.jsx)("span",{className:`w-2 h-2 rounded-full ${ad?"bg-green-400":"bg-red-400"}`}),(0,b.jsx)("span",{className:"text-gray-500",children:ae})]}),(0,b.jsx)("svg",{className:`w-4 h-4 text-gray-600 transition-transform ${K?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),K&&(0,b.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a]",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsx)("div",{className:"min-w-0",children:(0,b.jsxs)("div",{className:"text-gray-100 truncate text-sm",title:y?.hub||void 0,children:["Hub: ",(0,b.jsx)("span",{className:y?.hub?"text-cyan-300":"text-red-300",children:y?.hub?.trim()||"not configured"})]})}),(0,b.jsx)("div",{className:"flex flex-wrap gap-2 text-xs",children:(0,b.jsxs)("span",{className:`px-2.5 py-1 rounded-md border ${y?.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: ",y?.tokenPreview||"not configured"]})})]}),y?.error&&(0,b.jsx)("div",{className:"mt-2 text-xs text-gray-600",children:y.error})]})]}),Object.keys(af).length>0&&(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("div",{className:"text-xs uppercase text-gray-600",children:"Task Status"}),(0,b.jsx)(d.default,{href:"/tasks",prefetch:!1,className:"text-xs text-cyan-400 hover:text-cyan-300",children:"View all →"})]}),(0,b.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:a})=>af[a]).map(({key:a,color:c})=>(0,b.jsxs)(d.default,{href:`/tasks?status=${a}`,prefetch:!1,className:`px-2.5 py-1 rounded-md border text-xs ${c} hover:opacity-80 transition-opacity`,children:[a,": ",af[a]]},a))})]}),(0,b.jsx)("div",{className:"text-[10px] uppercase tracking-[0.12em] text-gray-600 mb-2",children:"Quick navigation"}),(0,b.jsx)("section",{className:"mb-3 grid grid-cols-3 gap-2 sm:gap-3",children:(a=l.filter(a=>Z(a)&&"working"!==a.status).length,g=_-$,i=A.filter(a=>"failed"===a.status).length,[{href:"/nodes",label:"Nodes",value:`${$}/${_}`,sub:`${_>0?Math.round($/_*100):0}% online`,color:"text-green-400 border-green-500/20",popover:0===_?null:[{k:"working",v:aa,dot:"",color:"#4ade80"},{k:"idle",v:a,dot:"",color:"#22d3ee"},{k:"offline",v:g,dot:"",color:"#9ca3af"}]},{href:"/tasks",label:"Tasks",value:String(Object.values(af).reduce((a,b)=>a+b,0)||0),sub:"all-time",color:"text-cyan-400 border-cyan-500/20",popover:0===Object.keys(af).length?null:["running","replied","failed","cancelled","expired","closed","created","delivered","acked"].filter(a=>af[a]).map(a=>({k:a,v:af[a],dot:"",color:({running:"#4ade80",replied:"#a78bfa",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c",closed:"#9ca3af",created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee"})[a]||"#9ca3af"}))},{href:"/tasks?status=failed",label:"Failed",value:String(af.failed||0),sub:af.failed?"needs review":"none",color:af.failed?"text-red-400 border-red-500/25":"text-gray-500 border-gray-700/30",popover:i?[{k:`${i} in current view`,v:"",dot:"",color:"#f87171"}]:[{k:"no failures yet",v:"",dot:"",color:"#4b5563"}]}].map(a=>(0,b.jsxs)(d.default,{href:a.href,prefetch:!1,className:`anet-stat-link group relative rounded-xl border ${a.color} bg-[#111128] px-3 py-3 transition-all hover:-translate-y-px`,children:[(0,b.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,b.jsx)("div",{className:`text-xl font-semibold tabular-nums ${a.color.split(" ")[0]}`,children:a.value}),(0,b.jsx)("div",{className:"hidden sm:block text-[10px] text-gray-600 group-hover:text-gray-400 transition-colors",children:"View →"})]}),(0,b.jsx)("div",{className:"text-[11px] text-gray-400 mt-0.5",children:a.label}),(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-px",children:a.sub}),a.popover&&a.popover.length>0&&(0,b.jsxs)("div",{className:"anet-stat-popover hidden md:block pointer-events-none absolute left-2 right-2 top-full mt-1 z-20 rounded-lg border border-[#2a2a4a] bg-[#0d0d1a] shadow-lg shadow-black/30 px-3 py-2 opacity-0 translate-y-[-2px] group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-150 delay-100",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-1.5",children:"Breakdown"}),(0,b.jsx)("ul",{className:"space-y-1",children:a.popover.map(a=>(0,b.jsxs)("li",{className:"flex items-center gap-2 text-[11px]",children:[(0,b.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:a.color},"aria-hidden":!0}),(0,b.jsx)("span",{className:"text-gray-400 capitalize",children:a.k}),""!==a.v&&(0,b.jsx)("span",{className:"ml-auto text-gray-300 tabular-nums font-medium",children:a.v})]},a.k))})]})]},a.href)))}),(0,b.jsx)("section",{className:"mb-6 grid grid-cols-3 gap-2 sm:gap-3",children:[{href:"/messages",label:"Messages",icon:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},{href:"/logs",label:"Audit log",icon:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8"},{href:"/admin",label:"Admin",icon:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4z M6 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2"}].map(a=>(0,b.jsxs)(d.default,{href:a.href,prefetch:!1,className:"anet-nav-tile flex items-center justify-center gap-2 rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 text-[12px] text-gray-400 hover:text-gray-200 transition-colors",children:[(0,b.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:a.icon})}),(0,b.jsx)("span",{children:a.label})]},a.href))}),(0,b.jsx)(h,{}),A.length>0&&(0,b.jsxs)("section",{className:"mb-6 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Recent Activity"}),(0,b.jsx)(d.default,{href:"/tasks",className:"text-xs text-cyan-400 hover:text-cyan-300",children:"All tasks →"})]}),(0,b.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:A.slice(0,5).map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:x[a.status]||"#6b7280"}}),a.from_name&&(0,b.jsx)(o.AliasAvatar,{alias:a.from_name,size:14}),(0,b.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:a.from_name||"?"}),(0,b.jsx)("span",{className:"text-gray-600",children:"→"}),a.to_name&&(0,b.jsx)(o.AliasAvatar,{alias:a.to_name,size:14}),(0,b.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:a.to_name||"?"}),(0,b.jsx)("span",{className:"text-gray-500 truncate flex-1",children:a.content?.slice(0,40)||"--"}),(0,b.jsx)("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] border ${w[a.status]||"text-gray-500 border-gray-700/30"}`,children:a.status})]},a.task_id))})]}),p&&(0,b.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,b.jsx)("span",{children:String(p)}),(0,b.jsx)("span",{className:"text-gray-500 text-xs",children:"Check CommHub connection"})]}),l.length>0&&(0,b.jsx)("div",{className:"flex justify-center mb-4",children:(0,b.jsx)("button",{onClick:()=>J(!I),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:I?"Hide Topology":"Show Topology"})}),!I&&l.length>0&&(0,b.jsx)("div",{className:"lg:hidden text-center text-xs text-gray-600 mb-4",children:"Topology hidden on mobile for better readability"}),I&&l.length>0&&(0,b.jsx)(n,{sessions:l,sseSessions:X}),0!==l.length||p?(j={all:ag.length,working:ag.filter(a=>Z(a)&&"working"===a.status).length,idle:ag.filter(a=>Z(a)&&"working"!==a.status).length,offline:ag.filter(a=>!Z(a)).length},k=ag.filter(a=>"all"===R||("offline"===R?!Z(a):"working"===R?Z(a)&&"working"===a.status:"idle"!==R||Z(a)&&"working"!==a.status)),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"mb-3 flex flex-wrap items-center gap-1",children:[{key:"all",label:"All"},{key:"working",label:"Working",dot:"#4ade80"},{key:"idle",label:"Idle",dot:"#22d3ee"},{key:"offline",label:"Offline",dot:"#6b7280"}].map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>S(a.key),disabled:0===j[a.key]&&"all"!==a.key,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${R===a.key?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/30":"text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] border border-transparent"}`,children:[a.dot&&(0,b.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:a.dot}}),(0,b.jsx)("span",{children:a.label}),(0,b.jsx)("span",{className:`text-[10px] tabular-nums ${R===a.key?"text-cyan-400":"text-gray-600"}`,children:j[a.key]})]},a.key))}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4",children:k.map(a=>(0,b.jsx)(r,{session:a,hasSse:Z(a),sseCount:Y(a)||0,onChat:M.openTab},a.alias))}),0===k.length&&(0,b.jsxs)("div",{className:"mt-4 text-center text-xs text-gray-600",children:['No agents match "',R,'" — ',(0,b.jsx)("button",{onClick:()=>S("all"),className:"underline hover:text-gray-400",children:"Show all"})]})]})):(0,b.jsx)(v.NodesEmptyState,{hint:m}),(0,b.jsx)(s,{messages:P}),(0,b.jsxs)("div",{className:"mt-8 text-center text-xs text-gray-600 flex items-center justify-center gap-2 flex-wrap",children:[W&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${V?"bg-green-400":"bg-gray-600"}`}),V?"SSE live":"SWR polling"]}),D?.license&&(0,b.jsxs)(b.Fragment,{children:[W&&(0,b.jsx)(b.Fragment,{children:"·"}),(0,b.jsxs)("span",{className:D.license.days_left<=7?"text-red-400":"pro"===D.license.type?"text-green-400":"text-yellow-400",children:[D.license.type," (",D.license.days_left,"d left)"]})]})]}),N&&(0,b.jsx)(E,{sessions:l,onClose:()=>O(!1)}),M.tabs.length>0&&(0,b.jsx)(C,{tabs:M.tabs,activeTab:M.activeTab,onOpenTab:M.openTab,onCloseTab:M.closeTab,onSetActive:M.setActiveTab,onClose:M.closeAll})]})}],60350)}];
|
|
1
|
+
module.exports=[54826,(a,b,c)=>{},15299,(a,b,c)=>{a.r(54826);var d=a.r(72131),e=d&&"object"==typeof d&&"default"in d?d:{default:d},f="u">typeof process&&process.env&&!0,g=function(a){return"[object String]"===Object.prototype.toString.call(a)},h=function(){function a(a){var b=void 0===a?{}:a,c=b.name,d=void 0===c?"stylesheet":c,e=b.optimizeForSpeed,h=void 0===e?f:e;i(g(d),"`name` must be a string"),this._name=d,this._deletedRulePlaceholder="#"+d+"-deleted-rule____{}",i("boolean"==typeof h,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=h,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0,this._nonce=null}var b,c=a.prototype;return c.setOptimizeForSpeed=function(a){i("boolean"==typeof a,"`setOptimizeForSpeed` accepts a boolean"),i(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=a,this.inject()},c.isOptimizeForSpeed=function(){return this._optimizeForSpeed},c.inject=function(){var a=this;i(!this._injected,"sheet already injected"),this._injected=!0,this._serverSheet={cssRules:[],insertRule:function(b,c){return"number"==typeof c?a._serverSheet.cssRules[c]={cssText:b}:a._serverSheet.cssRules.push({cssText:b}),c},deleteRule:function(b){a._serverSheet.cssRules[b]=null}}},c.getSheetForTag=function(a){if(a.sheet)return a.sheet;for(var b=0;b<document.styleSheets.length;b++)if(document.styleSheets[b].ownerNode===a)return document.styleSheets[b]},c.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},c.insertRule=function(a,b){return i(g(a),"`insertRule` accepts only strings"),"number"!=typeof b&&(b=this._serverSheet.cssRules.length),this._serverSheet.insertRule(a,b),this._rulesCount++},c.replaceRule=function(a,b){this._optimizeForSpeed;var c=this._serverSheet;if(b.trim()||(b=this._deletedRulePlaceholder),!c.cssRules[a])return a;c.deleteRule(a);try{c.insertRule(b,a)}catch(d){f||console.warn("StyleSheet: illegal rule: \n\n"+b+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),c.insertRule(this._deletedRulePlaceholder,a)}return a},c.deleteRule=function(a){this._serverSheet.deleteRule(a)},c.flush=function(){this._injected=!1,this._rulesCount=0,this._serverSheet.cssRules=[]},c.cssRules=function(){return this._serverSheet.cssRules},c.makeStyleTag=function(a,b,c){b&&i(g(b),"makeStyleTag accepts only strings as second parameter");var d=document.createElement("style");this._nonce&&d.setAttribute("nonce",this._nonce),d.type="text/css",d.setAttribute("data-"+a,""),b&&d.appendChild(document.createTextNode(b));var e=document.head||document.getElementsByTagName("head")[0];return c?e.insertBefore(d,c):e.appendChild(d),d},b=[{key:"length",get:function(){return this._rulesCount}}],function(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}(a.prototype,b),a}();function i(a,b){if(!a)throw Error("StyleSheet: "+b+".")}var j=function(a){for(var b=5381,c=a.length;c;)b=33*b^a.charCodeAt(--c);return b>>>0},k={};function l(a,b){if(!b)return"jsx-"+a;var c=String(b),d=a+c;return k[d]||(k[d]="jsx-"+j(a+"-"+c)),k[d]}function m(a,b){var c=a+(b=b.replace(/\/style/gi,"\\/style"));return k[c]||(k[c]=b.replace(/__jsx-style-dynamic-selector/g,a)),k[c]}var n=function(){function a(a){var b=void 0===a?{}:a,c=b.styleSheet,d=void 0===c?null:c,e=b.optimizeForSpeed,f=void 0!==e&&e;this._sheet=d||new h({name:"styled-jsx",optimizeForSpeed:f}),this._sheet.inject(),d&&"boolean"==typeof f&&(this._sheet.setOptimizeForSpeed(f),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var b=a.prototype;return b.add=function(a){var b=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(a.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed());var c=this.getIdAndRules(a),d=c.styleId,e=c.rules;if(d in this._instancesCounts){this._instancesCounts[d]+=1;return}var f=e.map(function(a){return b._sheet.insertRule(a)}).filter(function(a){return -1!==a});this._indices[d]=f,this._instancesCounts[d]=1},b.remove=function(a){var b=this,c=this.getIdAndRules(a).styleId;if(function(a,b){if(!a)throw Error("StyleSheetRegistry: "+b+".")}(c in this._instancesCounts,"styleId: `"+c+"` not found"),this._instancesCounts[c]-=1,this._instancesCounts[c]<1){var d=this._fromServer&&this._fromServer[c];d?(d.parentNode.removeChild(d),delete this._fromServer[c]):(this._indices[c].forEach(function(a){return b._sheet.deleteRule(a)}),delete this._indices[c]),delete this._instancesCounts[c]}},b.update=function(a,b){this.add(b),this.remove(a)},b.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},b.cssRules=function(){var a=this,b=this._fromServer?Object.keys(this._fromServer).map(function(b){return[b,a._fromServer[b]]}):[],c=this._sheet.cssRules();return b.concat(Object.keys(this._indices).map(function(b){return[b,a._indices[b].map(function(a){return c[a].cssText}).join(a._optimizeForSpeed?"":"\n")]}).filter(function(a){return!!a[1]}))},b.styles=function(a){var b,c;return b=this.cssRules(),void 0===(c=a)&&(c={}),b.map(function(a){var b=a[0],d=a[1];return e.default.createElement("style",{id:"__"+b,key:"__"+b,nonce:c.nonce?c.nonce:void 0,dangerouslySetInnerHTML:{__html:d}})})},b.getIdAndRules=function(a){var b=a.children,c=a.dynamic,d=a.id;if(c){var e=l(d,c);return{styleId:e,rules:Array.isArray(b)?b.map(function(a){return m(e,a)}):[m(e,b)]}}return{styleId:l(d),rules:Array.isArray(b)?b:[b]}},b.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(a,b){return a[b.id.slice(2)]=b,a},{})},a}(),o=d.createContext(null);function p(){return new n}function q(){return d.useContext(o)}function r(a){var b=q();return b&&b.add(a),null}o.displayName="StyleSheetContext",e.default.useInsertionEffect||e.default.useLayoutEffect,r.dynamic=function(a){return a.map(function(a){return l(a[0],a[1])}).join(" ")},c.StyleRegistry=function(a){var b=a.registry,c=a.children,f=d.useContext(o),g=d.useState(function(){return f||b||p()})[0];return e.default.createElement(o.Provider,{value:g},c)},c.createStyleRegistry=p,c.style=r,c.useStyleRegistry=q},31626,(a,b,c)=>{b.exports=a.r(15299).style},60350,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(43515);function f({online:a,working:c,total:d,version:e,uptime:h}){let i=d>0?Math.round(a/d*100):0;return(0,b.jsxs)("div",{className:"mb-8",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Agent Network"}),(0,b.jsxs)("span",{className:"text-xs text-gray-500",children:["CommHub ",e," · ",h]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,b.jsx)(g,{value:a,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,b.jsx)(g,{value:c,label:"Working",sub:a>0?`${Math.round(c/a*100)}% utilization`:"--",color:"text-cyan-400",accent:"from-cyan-500/20 to-cyan-500/0",border:"border-cyan-500/15"}),(0,b.jsx)(g,{value:d-a,label:"Offline",sub:d-a==0?"All systems go":`${d-a} disconnected`,color:"text-gray-400",accent:"from-gray-500/10 to-gray-500/0",border:"border-gray-500/15"}),(0,b.jsx)(g,{value:d,label:"Total",sub:"Registered nodes",color:"text-white",accent:"from-blue-500/15 to-blue-500/0",border:"border-blue-500/15"})]})]})}function g({value:a,label:c,sub:d,color:e,accent:f,border:h}){let i=e.replace("text-","").split("-")[0];return(0,b.jsxs)("div",{"data-anet-stat-card":i,className:`anet-stat-card relative overflow-hidden rounded-xl border ${h} bg-[#111128] px-4 py-3 transition-all`,children:[(0,b.jsx)("div",{className:`absolute inset-0 bg-gradient-to-br ${f} pointer-events-none`}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("div",{className:`text-3xl font-bold ${e} tabular-nums leading-tight`,children:a}),(0,b.jsx)("div",{className:"text-sm text-gray-300 mt-0.5",children:c}),(0,b.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:d})]})]})}function h(){let[a,d]=(0,c.useState)(""),[e,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)(""),i=async()=>{if(a.trim()){f(!0),h("");try{let b=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a})}),c=await b.json();c.ok?(h(`Broadcast sent to ${c.recipients} node(s)`),d("")):h(`Failed: ${c.error||"Send error"}`)}catch(a){h(`Failed: ${a instanceof Error?a.message:"Send error"}`)}f(!1),setTimeout(()=>h(""),5e3)}};return(0,b.jsxs)("div",{className:"mb-6",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)("input",{type:"text",value:a,onChange:a=>d(a.target.value),onKeyDown:a=>"Enter"===a.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,b.jsx)("button",{onClick:i,disabled:e||!a.trim(),"aria-label":"Send broadcast",className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-all font-medium cursor-pointer disabled:cursor-not-allowed",children:e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,b.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),(0,b.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),(0,b.jsx)("span",{children:"Sending…"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{d:"M3 11v3a1 1 0 0 0 1 1h2l3.29 3.29a1 1 0 0 0 1.71-.71V7.42a1 1 0 0 0-1.71-.71L6 10H4a1 1 0 0 0-1 1Z"}),(0,b.jsx)("path",{d:"M16 8a5 5 0 0 1 0 6",opacity:"0.7"}),(0,b.jsx)("path",{d:"M19 5a9 9 0 0 1 0 12",opacity:"0.45"})]}),(0,b.jsx)("span",{children:"Broadcast"})]})})]}),a.length>0&&(0,b.jsxs)("div",{className:"text-right text-xs text-gray-600 mt-1 tabular-nums",children:[a.length,"/500"]}),g&&(0,b.jsx)("div",{className:`mt-3 text-sm text-center anet-fade-in ${g.startsWith("Failed")?"text-red-400":"text-green-400/80"}`,children:g})]})}function i(a,b,c,d=0){let e=b<=2?Math.PI:1.78*Math.PI,f=-Math.PI/2-e/2,g=b<=1?-Math.PI/2:f+e*a/(b-1)+d;return{x:500+c*Math.cos(g),y:330+c*Math.sin(g)}}function j(a,b,c=0){let d=(a.x+b.x)/2,e=(a.y+b.y)/2,f=b.x-a.x,g=b.y-a.y,h=Math.hypot(f,g)||1,i={x:d+-g/h*c,y:e+f/h*c};return`M${a.x},${a.y} Q${i.x},${i.y} ${b.x},${b.y}`}function k(a,b){return a.length>b?`${a.slice(0,b-1)}...`:a}let l={panelStops:["#0b1220","#080814","#101018"],radarStops:[{color:"#22d3ee",opacity:.18},{color:"#22c55e",opacity:.045},{color:"#020617",opacity:0}],arrowFill:"#67e8f9",ringStroke:"#164e63",spokeStroke:{active:"#22d3ee",idle:"#155e75"},flowEdge:"#67e8f9",flowPath:"#e0f2fe",flowParticle:"#fef08a",nodeFill:{online:"#020617",offline:"#080814"},labelBox:{fill:"#020617",stroke:"#1f2937"},legendBox:{fill:"#020617",stroke:"#1f2937"},legendText:"#94a3b8",legendHeadline:"#e5e7eb",legendAccent:"#67e8f9",containerBg:"#080814",containerBorder:"#2a2a4a",topRailGradient:"from-transparent via-cyan-400/70 to-transparent"},m={panelStops:["#f8fafc","#ffffff","#f1f5f9"],radarStops:[{color:"#10b981",opacity:.06},{color:"#3b82f6",opacity:.03},{color:"#ffffff",opacity:0}],arrowFill:"#10b981",ringStroke:"#cbd5e1",spokeStroke:{active:"#10b981",idle:"#cbd5e1"},flowEdge:"#10b981",flowPath:"#475569",flowParticle:"#f59e0b",nodeFill:{online:"#ffffff",offline:"#f8fafc"},labelBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendText:"#475569",legendHeadline:"#0f172a",legendAccent:"#0d9488",containerBg:"#ffffff",containerBorder:"#e3e6eb",topRailGradient:"from-transparent via-emerald-500/40 to-transparent"};function n({sessions:a,sseSessions:d}){let e="light"===function(){let[a,b]=(0,c.useState)("dark");return(0,c.useEffect)(()=>{let a=()=>{let a=document.documentElement.getAttribute("data-theme")||"cyber";b("light"===a||"mint"===a?"light":"dark")};a();let c=new MutationObserver(a);return c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>c.disconnect()},[]),a}(),f=e?m:l,[g,h]=(0,c.useState)([]);(0,c.useEffect)(()=>{let a=async()=>{try{let a=await fetch("/api/hub/messages?limit=50");if(401===a.status)return void window.location.assign("/login");let b=await a.json();h(b.messages||[])}catch{}};a();let b=setInterval(a,5e3);return()=>clearInterval(b)},[]);let{onlineNodes:o,offlineNodes:p,nodePositions:q,flowLinks:r,activeAliases:s}=(0,c.useMemo)(()=>{let b,c=a=>(a.network_id?d[`${a.network_id}:${a.alias}`]:void 0)??d[a.alias],e=a.filter(a=>"offline"!==a.status||c(a)),f=a.filter(a=>"offline"===a.status&&!c(a)),h={};e.forEach((a,b)=>{h[a.alias]=i(b,Math.max(e.length,1),220)});let j=e.length<=2?Math.PI:1.78*Math.PI,k=e.length>1?j/(e.length-1):0,l=e.length>0?k/2:0,m=315+6*Math.max(0,f.length-4);f.forEach((a,b)=>{h[a.alias]=i(b,Math.max(f.length,1),m,l)});let n=(b=new Map,g.forEach(a=>{if(!h[a.from_alias]||!h[a.to_alias]||a.from_alias===a.to_alias)return;let c=`${a.from_alias}->${a.to_alias}`,d=b.get(c);b.set(c,{key:c,from:a.from_alias,to:a.to_alias,count:(d?.count||0)+1,content:d?.content||a.content})}),[...b.values()].slice(0,18)),o=new Set;return n.forEach(a=>{o.add(a.from),o.add(a.to)}),{onlineNodes:e,offlineNodes:f,nodePositions:h,flowLinks:n,activeAliases:o}},[g,a,d]),t=o.filter(a=>"working"===a.status).length;return(0,b.jsxs)("section",{className:"w-full max-w-6xl mx-auto mb-8",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between mb-3 px-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs uppercase text-gray-600 tracking-wider",children:"Network Topology"}),(0,b.jsx)("h2",{className:"text-lg text-white font-semibold",children:"Command mesh"})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,b.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20",children:[t," working"]}),(0,b.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20",children:[o.length," online"]}),(0,b.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20",children:[r.length," active links"]})]})]}),(0,b.jsxs)("div",{className:`relative overflow-hidden rounded-lg border shadow-2xl ${e?"shadow-zinc-900/5":"shadow-cyan-950/30"}`,style:{background:f.containerBg,borderColor:f.containerBorder},children:[(0,b.jsx)("div",{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r ${f.topRailGradient}`}),(0,b.jsxs)("svg",{viewBox:"0 0 1000 680",className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",children:[(0,b.jsxs)("defs",{children:[(0,b.jsxs)("linearGradient",{id:"topo-panel",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,b.jsx)("stop",{offset:"0%",stopColor:f.panelStops[0]}),(0,b.jsx)("stop",{offset:"48%",stopColor:f.panelStops[1]}),(0,b.jsx)("stop",{offset:"100%",stopColor:f.panelStops[2]})]}),(0,b.jsxs)("radialGradient",{id:"topo-radar",cx:"50%",cy:"50%",r:"55%",children:[(0,b.jsx)("stop",{offset:"0%",stopColor:f.radarStops[0].color,stopOpacity:f.radarStops[0].opacity}),(0,b.jsx)("stop",{offset:"45%",stopColor:f.radarStops[1].color,stopOpacity:f.radarStops[1].opacity}),(0,b.jsx)("stop",{offset:"100%",stopColor:f.radarStops[2].color,stopOpacity:f.radarStops[2].opacity})]}),!e&&(0,b.jsxs)("filter",{id:"topo-glow",children:[(0,b.jsx)("feGaussianBlur",{stdDeviation:"4",result:"blur"}),(0,b.jsxs)("feMerge",{children:[(0,b.jsx)("feMergeNode",{in:"blur"}),(0,b.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),(0,b.jsx)("marker",{id:"topo-arrow",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:(0,b.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:f.arrowFill})}),(0,b.jsxs)("radialGradient",{id:"topo-sweep",cx:"0%",cy:"50%",r:"100%",children:[(0,b.jsx)("stop",{offset:"0%",stopColor:e?"#0d9488":"#22d3ee",stopOpacity:e?.18:.32}),(0,b.jsx)("stop",{offset:"70%",stopColor:e?"#0d9488":"#22d3ee",stopOpacity:e?.1:.18}),(0,b.jsx)("stop",{offset:"100%",stopColor:e?"#0d9488":"#22d3ee",stopOpacity:"0"})]})]}),(0,b.jsx)("rect",{width:"1000",height:"680",fill:"url(#topo-panel)"}),(0,b.jsx)("circle",{cx:500,cy:330,r:"330",fill:"url(#topo-radar)"}),!e&&(0,b.jsx)("g",{opacity:"0.5",children:Array.from({length:28}).map((a,c)=>{let d=9301*c+49297;return(0,b.jsx)("circle",{cx:13*d%1e3,cy:7*d%680,r:c%3==0?1.2:.7,fill:"#a5b4fc",opacity:.35+c%4*.05},c)})}),(0,b.jsx)("g",{style:{transformOrigin:"500px 330px",transformBox:"view-box"},className:"anet-topo-sweep",opacity:e?.7:1,children:(0,b.jsx)("path",{d:`M 500 330 L 830 330 A 330 330 0 0 0 ${500+330*Math.cos(-Math.PI/4.5)} ${330+330*Math.sin(-Math.PI/4.5)} Z`,fill:"url(#topo-sweep)"})}),[90,170,250,330].map(a=>(0,b.jsx)("circle",{cx:500,cy:330,r:a,fill:"none",stroke:f.ringStroke,strokeWidth:"1",opacity:e?.6:.35},a)),!e&&[0,.25,.5,.75].map((a,c)=>(0,b.jsx)("g",{children:(0,b.jsx)("circle",{cx:830,cy:330,r:0===c?2.8:2.2,fill:"#22d3ee",opacity:.9,filter:"url(#topo-glow)",children:(0,b.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:`${360*a} 500 330`,to:`${360*a+360} 500 330`,dur:"16s",repeatCount:"indefinite"})})},`orbit-${c}`)),[0,30,60,90,120,150].map(a=>(0,b.jsx)("line",{x1:500-360*Math.cos(a*Math.PI/180),y1:330-360*Math.sin(a*Math.PI/180),x2:500+360*Math.cos(a*Math.PI/180),y2:330+360*Math.sin(a*Math.PI/180),stroke:f.ringStroke,strokeWidth:"1",opacity:e?.35:.18},a)),o.map((a,c)=>{let d=q[a.alias];if(!d)return null;let e=j({x:500,y:330},d,0),g=s.has(a.alias);return(0,b.jsx)("path",{d:e,fill:"none",stroke:g?f.spokeStroke.active:f.spokeStroke.idle,strokeWidth:g?2:1,strokeDasharray:g?"none":"6 14",opacity:g?.7:.45,className:g?void 0:"anet-topo-spoke-flow",style:g?void 0:{animationDelay:`${-(.25*c)}s`}},`hub-${a.alias}`)}),r.map((a,c)=>{let d=q[a.from],g=q[a.to];if(!d||!g)return null;let h=j(d,g,c%2==0?36:-36),i=Math.min(2+a.count,7);return(0,b.jsxs)("g",{children:[(0,b.jsx)("path",{d:h,fill:"none",stroke:f.flowEdge,strokeWidth:i,opacity:e?.22:.28,filter:e?void 0:"url(#topo-glow)",markerEnd:"url(#topo-arrow)"}),(0,b.jsx)("path",{id:`flow-path-${c}`,d:h,fill:"none",stroke:f.flowPath,strokeWidth:"1",strokeDasharray:"2 12",opacity:e?.4:.75}),(0,b.jsx)("circle",{r:"4",fill:f.flowParticle,filter:e?void 0:"url(#topo-glow)",children:(0,b.jsx)("animateMotion",{dur:`${2.2+c%5*.32}s`,repeatCount:"indefinite",path:h})})]},a.key)}),(0,b.jsxs)("g",{children:[(0,b.jsx)("circle",{cx:500,cy:330,r:"18",fill:e?"#d1fae5":"#10b981",opacity:e?.35:.1}),(0,b.jsxs)("circle",{cx:500,cy:330,r:"10",fill:"none",stroke:"#10b981",strokeWidth:"1.5",children:[(0,b.jsx)("animate",{attributeName:"r",values:"10;38;10",dur:"2.4s",repeatCount:"indefinite"}),(0,b.jsx)("animate",{attributeName:"opacity",values:"0.55;0;0.55",dur:"2.4s",repeatCount:"indefinite"})]}),(0,b.jsxs)("circle",{cx:500,cy:330,r:"10",fill:"none",stroke:"#10b981",strokeWidth:"1.5",opacity:"0",children:[(0,b.jsx)("animate",{attributeName:"r",values:"10;38;10",dur:"2.4s",begin:"1.2s",repeatCount:"indefinite"}),(0,b.jsx)("animate",{attributeName:"opacity",values:"0.45;0;0.45",dur:"2.4s",begin:"1.2s",repeatCount:"indefinite"})]}),(0,b.jsx)("circle",{cx:500,cy:330,r:"10",fill:e?"#059669":"#10b981"}),(0,b.jsx)("circle",{cx:500,cy:330,r:"5",fill:"#d1fae5",opacity:"0.9"})]}),[...o,...p].map(a=>{let c=q[a.alias];if(!c)return null;let g=(a.network_id?d[`${a.network_id}:${a.alias}`]:void 0)??d[a.alias],h="offline"!==a.status||!!g,i=h?"working"===a.status?{label:"working",primary:e?"#059669":"#22c55e",halo:e?"#d1fae5":"#14532d",text:e?"#065f46":"#dcfce7"}:"idle"===a.status?{label:"idle",primary:e?"#0d9488":"#2dd4bf",halo:e?"#ccfbf1":"#134e4a",text:e?"#115e59":"#ccfbf1"}:{label:a.status||"online",primary:e?"#0284c7":"#38bdf8",halo:e?"#dbeafe":"#0c4a6e",text:e?"#0c4a6e":"#e0f2fe"}:{label:"offline",primary:e?"#94a3b8":"#6b7280",halo:e?"#e2e8f0":"#111827",text:e?"#475569":"#9ca3af"},j=s.has(a.alias),l=h?26:18;return(0,b.jsxs)("g",{className:"transition-opacity",children:[j&&(0,b.jsxs)("circle",{cx:c.x,cy:c.y,r:l+14,fill:i.primary,opacity:e?.08:.12,children:[(0,b.jsx)("animate",{attributeName:"r",values:`${l+8};${l+22};${l+8}`,dur:"2.4s",repeatCount:"indefinite"}),(0,b.jsx)("animate",{attributeName:"opacity",values:e?"0.12;0.02;0.12":"0.18;0.04;0.18",dur:"2.4s",repeatCount:"indefinite"})]}),(0,b.jsx)("circle",{cx:c.x,cy:c.y,r:l+8,fill:i.halo,opacity:h?e?.85:.65:e?.4:.25}),(0,b.jsx)("circle",{cx:c.x,cy:c.y,r:l,fill:h?f.nodeFill.online:f.nodeFill.offline,stroke:i.primary,strokeWidth:h?3:1.5,strokeDasharray:h?"none":"5 5",filter:h&&!e?"url(#topo-glow)":void 0}),(0,b.jsx)("circle",{cx:c.x,cy:c.y,r:h?8:5,fill:i.primary}),"working"===a.status&&(0,b.jsx)("path",{d:`M${c.x-9},${c.y+11} h18`,stroke:f.flowParticle,strokeWidth:"3",strokeLinecap:"round",children:(0,b.jsx)("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"})}),(0,b.jsxs)("g",{transform:`translate(${c.x}, ${c.y+l+22})`,children:[(0,b.jsx)("rect",{x:"-62",y:"-14",width:"124",height:"42",rx:"6",fill:f.labelBox.fill,stroke:f.labelBox.stroke,opacity:e?1:.94}),(0,b.jsx)("text",{x:"0",y:"1",textAnchor:"middle",fill:i.text,fontSize:"12",fontFamily:"monospace",fontWeight:"700",children:k(a.alias,14)}),(0,b.jsxs)("text",{x:"0",y:"17",textAnchor:"middle",fill:i.primary,fontSize:"9",fontFamily:"monospace",children:[i.label,h&&null!=g?` sse:${g}`:""]})]})]},a.alias)}),(0,b.jsxs)("g",{transform:"translate(28, 34)",children:[(0,b.jsx)("rect",{x:"0",y:"0",width:"285",height:60+20*Math.min(r.length,4),rx:"8",fill:f.legendBox.fill,stroke:f.legendBox.stroke,opacity:e?1:.94}),(0,b.jsx)("text",{x:"16",y:"26",fill:f.legendHeadline,fontSize:"13",fontFamily:"monospace",fontWeight:"700",children:"recent signal"}),(0,b.jsxs)("text",{x:"178",y:"26",fill:f.legendAccent,fontSize:"11",fontFamily:"monospace",children:[g.length," messages"]}),r.slice(0,4).map((a,c)=>(0,b.jsxs)("text",{x:"16",y:54+20*c,fill:f.legendText,fontSize:"10",fontFamily:"monospace",children:[k(a.from,8)," ","->"," ",k(a.to,8)," / ",a.count," / ",k(a.content,18)]},a.key))]}),(0,b.jsxs)("g",{transform:"translate(720, 34)",children:[(0,b.jsx)("rect",{x:"0",y:"0",width:"250",height:"112",rx:"8",fill:f.legendBox.fill,stroke:f.legendBox.stroke,opacity:e?1:.94}),(0,b.jsx)("circle",{cx:"18",cy:"26",r:"6",fill:e?"#059669":"#22c55e"}),(0,b.jsx)("text",{x:"34",y:"30",fill:f.legendText,fontSize:"11",fontFamily:"monospace",children:"working node"}),(0,b.jsx)("circle",{cx:"18",cy:"52",r:"6",fill:e?"#0d9488":"#2dd4bf"}),(0,b.jsx)("text",{x:"34",y:"56",fill:f.legendText,fontSize:"11",fontFamily:"monospace",children:"online idle"}),(0,b.jsx)("circle",{cx:"18",cy:"78",r:"6",fill:e?"#94a3b8":"#6b7280"}),(0,b.jsx)("text",{x:"34",y:"82",fill:f.legendText,fontSize:"11",fontFamily:"monospace",children:"offline / no SSE"}),(0,b.jsx)("path",{d:"M150,78 Q176,52 210,78",fill:"none",stroke:f.flowEdge,strokeWidth:"3",markerEnd:"url(#topo-arrow)"})]})]})]})]})}var o=a.i(1720);let p={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:""}},q={bg:"bg-gray-800/50 border-gray-700/30",text:"text-gray-500",dot:"bg-gray-500",glow:""};function r({session:a,hasSse:c,sseCount:f,onChat:g}){let h=c&&p[a.status]||q;return(0,b.jsxs)(d.default,{href:`/node?alias=${encodeURIComponent(a.alias)}`,prefetch:!1,className:`anet-agent-card group relative block rounded-xl border p-4 transition-all duration-300 cursor-pointer hover:-translate-y-0.5 ${c?`bg-[#111128] border-[#2a2a4a] hover:border-cyan-500/30 hover:shadow-lg ${h.glow}`:"bg-[#0d0d1a] border-[#1a1a2a] opacity-40"}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(o.AliasAvatar,{alias:a.alias,size:22}),(0,b.jsx)("span",{className:"font-semibold text-white truncate text-sm",title:a.alias,children:a.alias}),(0,b.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${h.dot} ${c&&"working"===a.status?"animate-pulse":""}`})]}),(0,b.jsx)("span",{className:`text-[11px] px-2 py-0.5 rounded-md border shrink-0 ${h.bg} ${h.text}`,children:c?a.status:"offline"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,b.jsx)("span",{className:"text-xs text-gray-600 bg-[#0a0a15] px-2 py-0.5 rounded border border-[#1a1a2a]",children:a.agent||"unknown"}),c&&(0,b.jsxs)("span",{className:"text-[10px] text-green-500",children:["SSE:",f]})]}),a.task?(0,b.jsx)("div",{className:"text-xs text-gray-400 bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] line-clamp-2",title:a.task,children:a.task}):(0,b.jsx)("div",{className:"text-xs text-gray-700 italic",children:"No active task"}),a.progress>0&&(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsxs)("div",{className:"flex justify-between text-[10px] mb-1",children:[(0,b.jsx)("span",{className:"text-gray-600",children:"Progress"}),(0,b.jsxs)("span",{className:h.text,children:[a.progress,"%"]})]}),(0,b.jsx)("div",{className:"w-full bg-gray-800 rounded-full h-1.5 overflow-hidden",children:(0,b.jsx)("div",{className:`h-1.5 rounded-full transition-all duration-700 ${"working"===a.status?"bg-green-500":"bg-cyan-500"}`,style:{width:`${Math.min(a.progress,100)}%`}})})]}),(0,b.jsxs)("div",{className:"mt-3 flex justify-between items-center text-[10px] text-gray-600",children:[(0,b.jsx)("span",{className:"truncate",title:a.server||"",children:a.server||"--"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[g&&c&&(0,b.jsx)("button",{onClick:b=>{b.preventDefault(),b.stopPropagation(),g(a.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,b.jsx)("span",{children:(0,e.timeAgo)(a.updated_at)}),(0,b.jsx)("svg",{"aria-hidden":!0,className:"w-3 h-3 text-gray-700 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-200",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M9 18l6-6-6-6"})})]})]})]})}function s({messages:a}){return 0===a.length?null:(0,b.jsxs)("div",{className:"mt-8",children:[(0,b.jsxs)("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Inbox"}),(0,b.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:a.length})]}),(0,b.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto pr-1 scrollbar-thin",children:a.map(a=>(0,b.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm transition-colors hover:border-[#3a3a5a]",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs mb-1.5",children:[a.from_session&&(0,b.jsx)(o.AliasAvatar,{alias:a.from_session,size:16}),(0,b.jsx)("span",{className:"text-gray-200 font-medium truncate",children:a.from_session}),(0,b.jsx)("span",{className:"ml-auto text-gray-600 shrink-0",title:a.created_at,children:(0,e.timeAgo)(a.created_at)})]}),(0,b.jsx)("div",{className:"text-gray-300 leading-relaxed",children:a.content})]},a.id))})]})}function t(){return(0,b.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,b.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8 anet-skeleton-pulse",children:[1,2,3,4].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-4 py-3",children:[(0,b.jsx)(u,{w:"2.5rem",h:"1.75rem"}),(0,b.jsx)(u,{w:"3.5rem",h:"0.75rem",className:"mt-2"}),(0,b.jsx)(u,{w:"5rem",h:"0.625rem",className:"mt-1"})]},a))}),(0,b.jsxs)("div",{className:"flex items-center gap-3 mb-3 anet-skeleton-pulse",children:[(0,b.jsx)(u,{w:"6rem",h:"2.5rem",rounded:"0.75rem"}),(0,b.jsxs)("div",{className:"flex-1 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-2.5 flex items-center gap-3",children:[(0,b.jsx)("div",{className:"w-8 h-8 rounded-full anet-skeleton-bar"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)(u,{w:"6rem",h:"0.875rem"}),(0,b.jsx)(u,{w:"10rem",h:"0.625rem",className:"mt-1"})]})]})]}),(0,b.jsx)("div",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 anet-skeleton-pulse",children:(0,b.jsx)(u,{w:"14rem",h:"0.875rem"})}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-3 anet-skeleton-pulse",children:[1,2,3].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-3",children:[(0,b.jsx)(u,{w:"2rem",h:"1.25rem"}),(0,b.jsx)(u,{w:"2.5rem",h:"0.75rem",className:"mt-1"}),(0,b.jsx)(u,{w:"3.5rem",h:"0.625rem",className:"mt-px"})]},a))}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-6 anet-skeleton-pulse",children:[1,2,3].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 flex items-center justify-center gap-2",children:[(0,b.jsx)("div",{className:"w-4 h-4 rounded anet-skeleton-bar"}),(0,b.jsx)(u,{w:"4rem",h:"0.75rem"})]},a))}),(0,b.jsxs)("div",{className:"mb-6 flex gap-2 anet-skeleton-pulse",children:[(0,b.jsx)("div",{className:"flex-1 h-10 rounded-lg border border-[#2a2a4a] bg-[#111128]"}),(0,b.jsx)("div",{className:"w-28 h-10 rounded-lg anet-skeleton-bar"})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4 anet-skeleton-pulse",children:[1,2,3,4].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] p-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,b.jsx)("div",{className:"w-2 h-2 rounded-full anet-skeleton-bar"}),(0,b.jsx)(u,{w:"6rem",h:"0.875rem"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(u,{w:"100%",h:"0.625rem"}),(0,b.jsx)(u,{w:"75%",h:"0.625rem"}),(0,b.jsx)(u,{w:"55%",h:"0.625rem"})]})]},a))})]})}function u({w:a,h:c,rounded:d,className:e}){return(0,b.jsx)("div",{className:`anet-skeleton-bar ${e||""}`,style:{width:a,height:c,borderRadius:d||"0.375rem"}})}var v=a.i(53142),w=a.i(114),x=a.i(22397);function y(){let{setNetworkId:a}=(0,x.useNetworkId)(),[d,e]=(0,c.useState)({user:null,networks:[],currentNetwork:"",token:""}),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let a=sessionStorage.getItem("anet_v3_auth");if(a)try{e(JSON.parse(a))}catch{}},[]);let[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),v=async()=>{try{await fetch(`/api/hub/auth?token=${d.token}&endpoint=/api/auth/me`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:d.token,display_name:r,email:t})});let a=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:d.token,display_name:r,email:t})}),b=await a.json();if(b.ok&&b.user){let a={...d,user:b.user};e(a),sessionStorage.setItem("anet_v3_auth",JSON.stringify(a)),q(!1)}}catch{}};if(!d.user)return null;let w=(d.user.display_name||d.user.username).slice(0,2).toUpperCase();return(0,b.jsxs)("div",{className:"flex items-center justify-between bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-xs font-bold text-white",children:w}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm text-white font-medium",children:d.user.display_name||d.user.username}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-500",children:[d.user.role," · ",d.user.user_id]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[d.networks.length>0&&(0,b.jsx)("select",{value:d.currentNetwork,onChange:b=>{let c={...d,currentNetwork:b.target.value};e(c),a(b.target.value),sessionStorage.setItem("anet_v3_auth",JSON.stringify(c))},className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white focus:outline-none",children:d.networks.map(a=>(0,b.jsx)("option",{value:a.network_id,children:a.network_name},a.network_id))}),(0,b.jsxs)("button",{onClick:()=>{s(d.user?.display_name||""),u(""),q(!p)},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Edit profile",children:[(0,b.jsx)("span",{className:"hidden sm:inline",children:"Edit"}),(0,b.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.862 4.487z"})})]}),(0,b.jsxs)("button",{onClick:()=>{e({user:null,networks:[],currentNetwork:"",token:""}),sessionStorage.removeItem("anet_v3_auth")},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Sign out",children:[(0,b.jsx)("span",{className:"hidden sm:inline",children:"Sign out"}),(0,b.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})})]})]}),p&&(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#2a2a4a]",children:[(0,b.jsx)("input",{type:"text",value:r,onChange:a=>s(a.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,b.jsx)("input",{type:"email",value:t,onChange:a=>u(a.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,b.jsx)("button",{onClick:v,className:"px-2 py-1 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded",children:"Save"})]})]})}var z=a.i(31626),A=a.i(15261);function B({tabs:a,activeTab:c,onOpenTab:d,onCloseTab:e,onSetActive:f,onClose:g}){return 0===a.length?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{onClick:g,className:"jsx-f7cf3d1a6fdfc074 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,b.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,b.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 flex items-center border-b border-[#2a2a4a] bg-[#0d0d1a] overflow-x-auto",children:[(0,b.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 flex min-w-0",children:a.map(a=>(0,b.jsxs)("button",{onClick:()=>f(a),className:`jsx-f7cf3d1a6fdfc074 flex items-center gap-1.5 px-3 py-2.5 text-xs border-b-2 transition-colors shrink-0 ${c===a?"border-cyan-400 text-cyan-300 bg-cyan-500/5":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,b.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 w-2 h-2 rounded-full ${c===a?"bg-cyan-400":"bg-gray-600"}`}),(0,b.jsx)("span",{className:"jsx-f7cf3d1a6fdfc074 max-w-[80px] truncate",children:a}),(0,b.jsx)("button",{onClick:b=>{b.stopPropagation(),e(a)},className:"jsx-f7cf3d1a6fdfc074 ml-1 text-gray-600 hover:text-gray-300 p-0.5",children:"×"})]},a))}),(0,b.jsx)("button",{onClick:g,className:"jsx-f7cf3d1a6fdfc074 text-gray-500 hover:text-white px-3 py-2.5 shrink-0 border-l border-[#2a2a4a]",children:(0,b.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-f7cf3d1a6fdfc074 w-4 h-4",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-f7cf3d1a6fdfc074"})})})]}),(0,b.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 relative overflow-hidden",children:a.map(a=>(0,b.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 absolute inset-0 ${c===a?"block":"hidden"}`,children:(0,b.jsx)(C,{alias:a})},a))})]}),(0,b.jsx)(z.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 C({alias:a}){return(0,b.jsx)(A.TaskChatPanel,{alias:a,onClose:()=>{},inline:!0})}function D({sessions:a,onClose:d}){let[e,f]=(0,c.useState)(new Set),[g,h]=(0,c.useState)(""),[i,j]=(0,c.useState)("normal"),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)([]),[p,q]=(0,c.useState)(""),r=a.filter(a=>"offline"!==a.status).filter(a=>!p||a.alias.toLowerCase().includes(p.toLowerCase())||(a.agent||"").toLowerCase().includes(p.toLowerCase())),s=async()=>{if(!g.trim()||0===e.size||k)return;l(!0),n([]);let a=[...e].map(async a=>{try{let b=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:a,task:g,priority:i})}),c=await b.json();return{alias:a,ok:!!c.ok,error:c.error}}catch(b){return{alias:a,ok:!1,error:"send failed"}}});n(await Promise.all(a)),l(!1)},t=m.filter(a=>a.ok).length;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40 anet-fade-in",onClick:d}),(0,b.jsxs)("div",{className:"fixed inset-4 lg:inset-x-[15%] lg:inset-y-[5%] bg-[#0a0a1a] border border-[#2a2a4a] rounded-2xl z-50 flex flex-col shadow-2xl shadow-black/70 overflow-hidden anet-fade-in",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-lg font-bold text-white",children:"Dispatch Task"}),(0,b.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Send a task to one or more agents"})]}),(0,b.jsx)("button",{onClick:d,className:"text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,b.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,b.jsxs)("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden",children:[(0,b.jsxs)("div",{className:"lg:w-[280px] border-b lg:border-b-0 lg:border-r border-[#2a2a4a] flex flex-col",children:[(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-[#2a2a4a]",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.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,b.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,b.jsx)("button",{onClick:()=>{e.size===r.length?f(new Set):f(new Set(r.map(a=>a.alias)))},className:"text-[10px] text-cyan-400 hover:text-cyan-300",children:e.size===r.length?"Deselect all":`Select all (${r.length})`}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.size," selected"]})]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5 max-h-[200px] lg:max-h-none",children:[r.map(a=>(0,b.jsxs)("button",{onClick:()=>{var b;return b=a.alias,void f(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-left transition-colors ${e.has(a.alias)?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/20":"text-gray-400 hover:bg-[#1a1a2a]"}`,children:[(0,b.jsx)(o.AliasAvatar,{alias:a.alias,size:16}),(0,b.jsx)("div",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"working"===a.status?"bg-green-400":"idle"===a.status?"bg-cyan-400":"bg-gray-500"}`}),(0,b.jsx)("span",{className:"truncate flex-1",children:a.alias}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600",children:a.agent||"--"})]},a.alias)),0===r.length&&(0,b.jsx)("div",{className:"text-center text-xs text-gray-600 py-4",children:"No online agents"})]})]}),(0,b.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,b.jsxs)("div",{className:"flex-1 px-6 py-4 flex flex-col",children:[(0,b.jsx)("label",{className:"text-xs text-gray-500 uppercase mb-2",children:"Task Prompt"}),(0,b.jsx)("textarea",{value:g,onChange:a=>h(a.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,b.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[(0,b.jsxs)("select",{value:i,onChange:a=>j(a.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white focus:outline-none",children:[(0,b.jsx)("option",{value:"normal",children:"Normal priority"}),(0,b.jsx)("option",{value:"high",children:"High priority"}),(0,b.jsx)("option",{value:"low",children:"Low priority"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)("button",{onClick:s,disabled:k||!g.trim()||0===e.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:k?(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Sending..."]}):`Dispatch to ${e.size} agent${e.size>1?"s":""}`})]})]}),m.length>0&&(0,b.jsxs)("div",{className:"px-6 py-3 border-t border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,b.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:[t,"/",m.length," dispatched successfully"]}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m.map(a=>(0,b.jsxs)("span",{className:`flex items-center gap-1.5 text-[10px] pl-1 pr-2 py-0.5 rounded-full border ${a.ok?"text-green-300 border-green-500/20 bg-green-500/5":"text-red-300 border-red-500/20 bg-red-500/5"}`,children:[(0,b.jsx)(o.AliasAvatar,{alias:a.alias,size:14}),(0,b.jsx)("span",{children:a.alias}),(0,b.jsx)("span",{"aria-hidden":!0,children:a.ok?"✓":a.error||"✗"})]},a.alias))})]})]})]})]})]})}var E=a.i(44332),F=a.i(58224),G=a.i(64565);a.s(["default",0,function(){let a,g,i,j,k;(0,c.useEffect)(()=>{sessionStorage.getItem("anet_v3_auth")||(fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login"))},[]);let{sessions:l,hint:m,error:p,isLoading:q}=(0,E.useSessions)(),{health:u}=(0,E.useHealth)(),{config:x}=(0,E.useAnetConfig)(),{tasks:z}=(0,E.useTasks)({limit:"500"}),{stats:A}=(0,E.useStats)(),{license:C}=(0,E.useLicense)(),[H,I]=(0,c.useState)(!1),[J,K]=(0,c.useState)(!1),L=function(){let[a,b]=(0,c.useState)([]),[d,e]=(0,c.useState)("");return{tabs:a,activeTab:d,openTab:a=>{b(b=>b.includes(a)?b:[...b,a]),e(a)},closeTab:a=>{b(b=>{let c=b.filter(b=>b!==a);return d===a&&e(c[c.length-1]||""),c})},closeAll:()=>{b([]),e("")},setActiveTab:e}}(),[M,N]=(0,c.useState)(!1),[O,P]=(0,c.useState)([]),[Q,R]=(0,c.useState)("all"),{mutate:S}=(0,G.useSWRConfig)(),T="1"!==process.env.NEXT_PUBLIC_DISABLE_SSE,{connected:U,supported:V}=(0,F.useSSE)({url:"/api/hub/events",enabled:T,onEvent:a=>{["new_task","new_message","new_reply","node_status_changed","broadcast"].includes(a.type)&&(S("/api/hub/status"),S(a=>"string"==typeof a&&a.startsWith("/api/hub/tasks"),void 0,{revalidate:!0}))}});if((0,c.useEffect)(()=>{let a=()=>{fetch("/api/hub/inbox").then(a=>a.json()).then(a=>{a.messages?.length&&P(b=>{let c=new Set(b.map(a=>a.id));return[...a.messages.filter(a=>!c.has(a.id)),...b].slice(0,100)})}).catch(()=>{})};a();let b=setInterval(a,1e4);return()=>clearInterval(b)},[]),q)return(0,b.jsx)(t,{});let W=u?.sse_sessions||{},X=a=>(a.network_id?W[`${a.network_id}:${a.alias}`]:void 0)??W[a.alias],Y=a=>"offline"!==a.status||!!X(a),Z=l.filter(Y).length,$=l.length,_=l.filter(a=>"working"===a.status).length,aa=u?(0,e.formatUptime)(u.uptime):"--",ab=u?.version||"--",ac=!!(x?.hub&&x.tokenConfigured),ad=x?.source==="file"?"Local config":x?.source==="runtime-env"?"Runtime env":"Config missing",ae={};if(A?.tasks?.by_status?.length)for(let a of A.tasks.by_status)ae[a.status]=a.count;else for(let a of z)ae[a.status]=(ae[a.status]||0)+1;let af=[...l].sort((a,b)=>{let c=+!!Y(a),d=+!!Y(b);if(c!==d)return d-c;let e=+("working"===a.status);return("working"===b.status)-e});return(0,b.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,b.jsx)("div",{className:"lg:ml-0 ml-10",children:(0,b.jsx)(f,{online:Z,working:_,total:$,version:ab,uptime:aa})}),(0,b.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,b.jsx)("button",{onClick:()=>N(!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,b.jsx)("div",{className:"flex-1",children:(0,b.jsx)(y,{})})]}),(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,b.jsxs)("button",{onClick:()=>K(!J),className:"w-full flex items-center justify-between text-left",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)("span",{className:"uppercase text-gray-600",children:"Config"}),(0,b.jsx)("span",{className:`w-2 h-2 rounded-full ${ac?"bg-green-400":"bg-red-400"}`}),(0,b.jsx)("span",{className:"text-gray-500",children:ad})]}),(0,b.jsx)("svg",{className:`w-4 h-4 text-gray-600 transition-transform ${J?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),J&&(0,b.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a]",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsx)("div",{className:"min-w-0",children:(0,b.jsxs)("div",{className:"text-gray-100 truncate text-sm",title:x?.hub||void 0,children:["Hub: ",(0,b.jsx)("span",{className:x?.hub?"text-cyan-300":"text-red-300",children:x?.hub?.trim()||"not configured"})]})}),(0,b.jsx)("div",{className:"flex flex-wrap gap-2 text-xs",children:(0,b.jsxs)("span",{className:`px-2.5 py-1 rounded-md border ${x?.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: ",x?.tokenPreview||"not configured"]})})]}),x?.error&&(0,b.jsx)("div",{className:"mt-2 text-xs text-gray-600",children:x.error})]})]}),Object.keys(ae).length>0&&(0,b.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("div",{className:"text-xs uppercase text-gray-600",children:"Task Status"}),(0,b.jsx)(d.default,{href:"/tasks",prefetch:!1,className:"text-xs text-cyan-400 hover:text-cyan-300",children:"View all →"})]}),(0,b.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:a})=>ae[a]).map(({key:a,color:c})=>(0,b.jsxs)(d.default,{href:`/tasks?status=${a}`,prefetch:!1,className:`px-2.5 py-1 rounded-md border text-xs ${c} hover:opacity-80 transition-opacity`,children:[a,": ",ae[a]]},a))})]}),(0,b.jsx)("div",{className:"text-[10px] uppercase tracking-[0.12em] text-gray-600 mb-2",children:"Quick navigation"}),(0,b.jsx)("section",{className:"mb-3 grid grid-cols-3 gap-2 sm:gap-3",children:(a=l.filter(a=>Y(a)&&"working"!==a.status).length,g=$-Z,i=z.filter(a=>"failed"===a.status).length,[{href:"/nodes",label:"Nodes",value:`${Z}/${$}`,sub:`${$>0?Math.round(Z/$*100):0}% online`,color:"text-green-400 border-green-500/20",popover:0===$?null:[{k:"working",v:_,dot:"",color:"#4ade80"},{k:"idle",v:a,dot:"",color:"#22d3ee"},{k:"offline",v:g,dot:"",color:"#9ca3af"}]},{href:"/tasks",label:"Tasks",value:String(Object.values(ae).reduce((a,b)=>a+b,0)||0),sub:"all-time",color:"text-cyan-400 border-cyan-500/20",popover:0===Object.keys(ae).length?null:["running","replied","failed","cancelled","expired","closed","created","delivered","acked"].filter(a=>ae[a]).map(a=>({k:a,v:ae[a],dot:"",color:({running:"#4ade80",replied:"#a78bfa",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c",closed:"#9ca3af",created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee"})[a]||"#9ca3af"}))},{href:"/tasks?status=failed",label:"Failed",value:String(ae.failed||0),sub:ae.failed?"needs review":"none",color:ae.failed?"text-red-400 border-red-500/25":"text-gray-500 border-gray-700/30",popover:i?[{k:`${i} in current view`,v:"",dot:"",color:"#f87171"}]:[{k:"no failures yet",v:"",dot:"",color:"#4b5563"}]}].map(a=>(0,b.jsxs)(d.default,{href:a.href,prefetch:!1,className:`anet-stat-link group relative rounded-xl border ${a.color} bg-[#111128] px-3 py-3 transition-all hover:-translate-y-px`,children:[(0,b.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,b.jsx)("div",{className:`text-xl font-semibold tabular-nums ${a.color.split(" ")[0]}`,children:a.value}),(0,b.jsx)("div",{className:"hidden sm:block text-[10px] text-gray-600 group-hover:text-gray-400 transition-colors",children:"View →"})]}),(0,b.jsx)("div",{className:"text-[11px] text-gray-400 mt-0.5",children:a.label}),(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-px",children:a.sub}),a.popover&&a.popover.length>0&&(0,b.jsxs)("div",{className:"anet-stat-popover hidden md:block pointer-events-none absolute left-2 right-2 top-full mt-1 z-20 rounded-lg border border-[#2a2a4a] bg-[#0d0d1a] shadow-lg shadow-black/30 px-3 py-2 opacity-0 translate-y-[-2px] group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-150 delay-100",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-1.5",children:"Breakdown"}),(0,b.jsx)("ul",{className:"space-y-1",children:a.popover.map(a=>(0,b.jsxs)("li",{className:"flex items-center gap-2 text-[11px]",children:[(0,b.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:a.color},"aria-hidden":!0}),(0,b.jsx)("span",{className:"text-gray-400 capitalize",children:a.k}),""!==a.v&&(0,b.jsx)("span",{className:"ml-auto text-gray-300 tabular-nums font-medium",children:a.v})]},a.k))})]})]},a.href)))}),(0,b.jsx)("section",{className:"mb-6 grid grid-cols-3 gap-2 sm:gap-3",children:[{href:"/messages",label:"Messages",icon:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},{href:"/logs",label:"Audit log",icon:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8"},{href:"/admin",label:"Admin",icon:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4z M6 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2"}].map(a=>(0,b.jsxs)(d.default,{href:a.href,prefetch:!1,className:"anet-nav-tile flex items-center justify-center gap-2 rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 text-[12px] text-gray-400 hover:text-gray-200 transition-colors",children:[(0,b.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:a.icon})}),(0,b.jsx)("span",{children:a.label})]},a.href))}),(0,b.jsx)(h,{}),z.length>0&&(0,b.jsxs)("section",{className:"mb-6 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Recent Activity"}),(0,b.jsx)(d.default,{href:"/tasks",className:"text-xs text-cyan-400 hover:text-cyan-300",children:"All tasks →"})]}),(0,b.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:z.slice(0,5).map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:w.STATUS_DOT_HEX[a.status]||"#6b7280"}}),a.from_name&&(0,b.jsx)(o.AliasAvatar,{alias:a.from_name,size:14}),(0,b.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:a.from_name||"?"}),(0,b.jsx)("span",{className:"text-gray-600",children:"→"}),a.to_name&&(0,b.jsx)(o.AliasAvatar,{alias:a.to_name,size:14}),(0,b.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:a.to_name||"?"}),(0,b.jsx)("span",{className:"text-gray-500 truncate flex-1",children:a.content?.slice(0,40)||"--"}),(0,b.jsx)("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] border ${w.STATUS_CHIP_CLASS[a.status]||"text-gray-500 border-gray-700/30"}`,children:a.status})]},a.task_id))})]}),p&&(0,b.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,b.jsx)("span",{children:String(p)}),(0,b.jsx)("span",{className:"text-gray-500 text-xs",children:"Check CommHub connection"})]}),l.length>0&&(0,b.jsx)("div",{className:"flex justify-center mb-4",children:(0,b.jsx)("button",{onClick:()=>I(!H),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:H?"Hide Topology":"Show Topology"})}),!H&&l.length>0&&(0,b.jsx)("div",{className:"lg:hidden text-center text-xs text-gray-600 mb-4",children:"Topology hidden on mobile for better readability"}),H&&l.length>0&&(0,b.jsx)(n,{sessions:l,sseSessions:W}),0!==l.length||p?(j={all:af.length,working:af.filter(a=>Y(a)&&"working"===a.status).length,idle:af.filter(a=>Y(a)&&"working"!==a.status).length,offline:af.filter(a=>!Y(a)).length},k=af.filter(a=>"all"===Q||("offline"===Q?!Y(a):"working"===Q?Y(a)&&"working"===a.status:"idle"!==Q||Y(a)&&"working"!==a.status)),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"mb-3 flex flex-wrap items-center gap-1",children:[{key:"all",label:"All"},{key:"working",label:"Working",dot:"#4ade80"},{key:"idle",label:"Idle",dot:"#22d3ee"},{key:"offline",label:"Offline",dot:"#6b7280"}].map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>R(a.key),disabled:0===j[a.key]&&"all"!==a.key,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${Q===a.key?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/30":"text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] border border-transparent"}`,children:[a.dot&&(0,b.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:a.dot}}),(0,b.jsx)("span",{children:a.label}),(0,b.jsx)("span",{className:`text-[10px] tabular-nums ${Q===a.key?"text-cyan-400":"text-gray-600"}`,children:j[a.key]})]},a.key))}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4",children:k.map(a=>(0,b.jsx)(r,{session:a,hasSse:Y(a),sseCount:X(a)||0,onChat:L.openTab},a.alias))}),0===k.length&&(0,b.jsxs)("div",{className:"mt-4 text-center text-xs text-gray-600",children:['No agents match "',Q,'" — ',(0,b.jsx)("button",{onClick:()=>R("all"),className:"underline hover:text-gray-400",children:"Show all"})]})]})):(0,b.jsx)(v.NodesEmptyState,{hint:m}),(0,b.jsx)(s,{messages:O}),(0,b.jsxs)("div",{className:"mt-8 text-center text-xs text-gray-600 flex items-center justify-center gap-2 flex-wrap",children:[V&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${U?"bg-green-400":"bg-gray-600"}`}),U?"SSE live":"SWR polling"]}),C?.license&&(0,b.jsxs)(b.Fragment,{children:[V&&(0,b.jsx)(b.Fragment,{children:"·"}),(0,b.jsxs)("span",{className:C.license.days_left<=7?"text-red-400":"pro"===C.license.type?"text-green-400":"text-yellow-400",children:[C.license.type," (",C.license.days_left,"d left)"]})]})]}),M&&(0,b.jsx)(D,{sessions:l,onClose:()=>N(!1)}),L.tabs.length>0&&(0,b.jsx)(B,{tabs:L.tabs,activeTab:L.activeTab,onOpenTab:L.openTab,onCloseTab:L.closeTab,onSetActive:L.setActiveTab,onClose:L.closeAll})]})}],60350)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=_0nne7mz._.js.map
|