@sleep2agi/agent-network-dashboard 0.6.3-preview.49 → 0.6.3-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_COMMIT +1 -1
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/diagnostics/route-bundle-stats.json +97 -97
- 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/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +5 -5
- package/.next/server/app/_not-found.rsc +13 -13
- package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
- package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin.html +5 -5
- package/.next/server/app/admin.rsc +15 -15
- package/.next/server/app/admin.segments/_full.segment.rsc +15 -15
- package/.next/server/app/admin.segments/_head.segment.rsc +4 -4
- package/.next/server/app/admin.segments/_index.segment.rsc +8 -8
- package/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/admin.segments/admin.segment.rsc +3 -3
- package/.next/server/app/index.html +5 -5
- package/.next/server/app/index.rsc +15 -15
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/server/app/index.segments/_index.segment.rsc +8 -8
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- 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 +15 -15
- package/.next/server/app/login.segments/_full.segment.rsc +15 -15
- package/.next/server/app/login.segments/_head.segment.rsc +4 -4
- package/.next/server/app/login.segments/_index.segment.rsc +8 -8
- package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/login.segments/login.segment.rsc +3 -3
- package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/logs.html +5 -5
- package/.next/server/app/logs.rsc +15 -15
- package/.next/server/app/logs.segments/_full.segment.rsc +15 -15
- package/.next/server/app/logs.segments/_head.segment.rsc +4 -4
- package/.next/server/app/logs.segments/_index.segment.rsc +8 -8
- package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/logs.segments/logs.segment.rsc +3 -3
- package/.next/server/app/messages/page.js.nft.json +1 -1
- package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
- package/.next/server/app/messages.html +5 -5
- package/.next/server/app/messages.rsc +15 -15
- package/.next/server/app/messages.segments/_full.segment.rsc +15 -15
- package/.next/server/app/messages.segments/_head.segment.rsc +4 -4
- package/.next/server/app/messages.segments/_index.segment.rsc +8 -8
- package/.next/server/app/messages.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/messages.segments/messages.segment.rsc +3 -3
- package/.next/server/app/node/page.js.nft.json +1 -1
- package/.next/server/app/node/page_client-reference-manifest.js +1 -1
- package/.next/server/app/node.html +5 -5
- package/.next/server/app/node.rsc +15 -15
- package/.next/server/app/node.segments/_full.segment.rsc +15 -15
- package/.next/server/app/node.segments/_head.segment.rsc +4 -4
- package/.next/server/app/node.segments/_index.segment.rsc +8 -8
- package/.next/server/app/node.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/node.segments/node.segment.rsc +3 -3
- package/.next/server/app/nodes/[alias]/page.js.nft.json +1 -1
- package/.next/server/app/nodes/[alias]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/nodes/page.js.nft.json +1 -1
- package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/nodes.html +5 -5
- package/.next/server/app/nodes.rsc +15 -15
- package/.next/server/app/nodes.segments/_full.segment.rsc +15 -15
- package/.next/server/app/nodes.segments/_head.segment.rsc +4 -4
- package/.next/server/app/nodes.segments/_index.segment.rsc +8 -8
- package/.next/server/app/nodes.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/nodes.segments/nodes.segment.rsc +3 -3
- 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/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/providers.html +5 -5
- package/.next/server/app/providers.rsc +15 -15
- package/.next/server/app/providers.segments/_full.segment.rsc +15 -15
- package/.next/server/app/providers.segments/_head.segment.rsc +4 -4
- package/.next/server/app/providers.segments/_index.segment.rsc +8 -8
- package/.next/server/app/providers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/providers.segments/providers/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/providers.segments/providers.segment.rsc +3 -3
- package/.next/server/app/server-logs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/server-logs.html +5 -5
- package/.next/server/app/server-logs.rsc +15 -15
- package/.next/server/app/server-logs.segments/_full.segment.rsc +15 -15
- package/.next/server/app/server-logs.segments/_head.segment.rsc +4 -4
- package/.next/server/app/server-logs.segments/_index.segment.rsc +8 -8
- package/.next/server/app/server-logs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/server-logs.segments/server-logs.segment.rsc +3 -3
- package/.next/server/app/servers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/servers.html +5 -5
- package/.next/server/app/servers.rsc +15 -15
- package/.next/server/app/servers.segments/_full.segment.rsc +15 -15
- package/.next/server/app/servers.segments/_head.segment.rsc +4 -4
- package/.next/server/app/servers.segments/_index.segment.rsc +8 -8
- package/.next/server/app/servers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/servers.segments/servers/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/servers.segments/servers.segment.rsc +3 -3
- package/.next/server/app/settings/networks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/networks.html +5 -5
- package/.next/server/app/settings/networks.rsc +15 -15
- package/.next/server/app/settings/networks.segments/_full.segment.rsc +15 -15
- package/.next/server/app/settings/networks.segments/_head.segment.rsc +4 -4
- package/.next/server/app/settings/networks.segments/_index.segment.rsc +8 -8
- package/.next/server/app/settings/networks.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +3 -3
- package/.next/server/app/settings/networks.segments/settings.segment.rsc +3 -3
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/tokens/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/tokens.html +5 -5
- package/.next/server/app/settings/tokens.rsc +15 -15
- package/.next/server/app/settings/tokens.segments/_full.segment.rsc +15 -15
- package/.next/server/app/settings/tokens.segments/_head.segment.rsc +4 -4
- package/.next/server/app/settings/tokens.segments/_index.segment.rsc +8 -8
- package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +3 -3
- package/.next/server/app/settings/tokens.segments/settings.segment.rsc +3 -3
- package/.next/server/app/settings.html +5 -5
- package/.next/server/app/settings.rsc +15 -15
- package/.next/server/app/settings.segments/_full.segment.rsc +15 -15
- package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/server/app/settings.segments/_index.segment.rsc +8 -8
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/server/app/tasks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/tasks/[id]/page_client-reference-manifest.js +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 +5 -5
- package/.next/server/app/tasks.rsc +15 -15
- package/.next/server/app/tasks.segments/_full.segment.rsc +15 -15
- package/.next/server/app/tasks.segments/_head.segment.rsc +4 -4
- package/.next/server/app/tasks.segments/_index.segment.rsc +8 -8
- package/.next/server/app/tasks.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/tasks.segments/tasks.segment.rsc +3 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__05z_qq6._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__05z_qq6._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__06w5i08._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__06w5i08._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0jgqpfv._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0jgqpfv._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0w7k~3f._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0w7k~3f._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__11wln8.._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__11wln8.._.js.map +1 -0
- package/.next/server/chunks/ssr/{dash-stageb-wt_app_0e7vp44._.js → dash-stageb-wt_app_045dcq5._.js} +2 -2
- package/.next/server/chunks/ssr/dash-stageb-wt_app_045dcq5._.js.map +1 -0
- package/.next/server/chunks/ssr/{dash-stageb-wt_app_0g~a.7i._.js → dash-stageb-wt_app_05u4_h~._.js} +8 -2
- package/.next/server/chunks/ssr/dash-stageb-wt_app_05u4_h~._.js.map +1 -0
- package/.next/server/chunks/ssr/{dash-stageb-wt_app_0qpn85e._.js → dash-stageb-wt_app_0nuizh~._.js} +2 -2
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0nuizh~._.js.map +1 -0
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0qn7hvc._.js +1 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0qn7hvc._.js.map +1 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0ss0pj-._.js +1 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0ss0pj-._.js.map +1 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_components_0vzsmx1._.js +5 -5
- package/.next/server/chunks/ssr/dash-stageb-wt_app_components_0vzsmx1._.js.map +1 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_nodes_NodesView_tsx_0patjj7._.js +1 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_nodes_NodesView_tsx_0patjj7._.js.map +1 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_tasks_TasksView_tsx_0pnz7dd._.js +3 -0
- package/.next/server/chunks/ssr/dash-stageb-wt_app_tasks_TasksView_tsx_0pnz7dd._.js.map +1 -0
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +5 -5
- 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/02.5_nifak.uu.js +1 -0
- package/.next/static/chunks/03hzj129k~odb.js +1 -0
- package/.next/static/chunks/06q7-vhy~1-y3.js +7 -0
- package/.next/static/chunks/0_4ljrbp.stxy.js +1 -0
- package/.next/static/chunks/0cey4i.y0a8~j.js +1 -0
- package/.next/static/chunks/{0i8qbq4v47v3r.js → 0ep78sq90x_yc.js} +1 -1
- package/.next/static/chunks/{0_xyyy_x0k42j.js → 0hm52b0y~k0~z.js} +1 -1
- package/.next/static/chunks/0kncmrm2a_q43.js +1 -0
- package/.next/static/chunks/0mhaf6lrw5nn..css +1 -0
- package/.next/static/chunks/{12jbb28xy2hw..js → 0qf8xjihw3zi..js} +1 -1
- package/.next/static/chunks/0xyu92zdvvghl.js +7 -0
- package/.next/static/chunks/0zj_navpyhltx.js +2 -0
- package/.next/static/chunks/10px7ehmo7eq0.js +1 -0
- package/.next/static/chunks/{0tv-.l-_mw4ye.js → 11zz15q37~bz5.js} +1 -1
- package/.next/static/chunks/14y4x3de1lbug.js +1 -0
- package/.next/static/chunks/15ka68xi.w-i-.js +1 -0
- package/.next/static/chunks/17qkc714xy04..js +1 -0
- package/.next/trace +2 -2
- package/.next/trace-build +1 -1
- package/app/components/ChatPane.tsx +2 -2
- package/app/components/NodeList.tsx +40 -4
- package/app/components/Sidebar.tsx +180 -29
- package/app/components/TaskChatPanel.tsx +1 -1
- package/app/components/TaskDetail.tsx +407 -0
- package/app/components/TaskList.tsx +117 -0
- package/app/nodes/NodesView.tsx +28 -3
- package/app/tasks/TasksView.tsx +353 -0
- package/app/tasks/[id]/page.tsx +23 -176
- package/app/tasks/page.tsx +10 -453
- package/package.json +1 -1
- package/tests/e2e-sidebar-default.spec.ts +141 -0
- package/tests/e2e-sidebar-icon-rail.spec.ts +261 -0
- package/tests/e2e-stage-b-chat-pane.spec.ts +286 -0
- package/tests/e2e-stage-tasks-two-column.spec.ts +353 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0b-b6yh._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0b-b6yh._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0fs-j~c._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0fs-j~c._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0ma5-5u._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0ma5-5u._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0~hwpo-._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0~hwpo-._.js.map +0 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_095q0~q._.js +0 -3
- package/.next/server/chunks/ssr/dash-stageb-wt_app_095q0~q._.js.map +0 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0e7vp44._.js.map +0 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0g~a.7i._.js.map +0 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0qpn85e._.js.map +0 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0tppjr_._.js +0 -9
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0tppjr_._.js.map +0 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0y764mt._.js +0 -3
- package/.next/server/chunks/ssr/dash-stageb-wt_app_0y764mt._.js.map +0 -1
- package/.next/server/chunks/ssr/dash-stageb-wt_app_tasks_page_tsx_0.fhtup._.js +0 -3
- package/.next/server/chunks/ssr/dash-stageb-wt_app_tasks_page_tsx_0.fhtup._.js.map +0 -1
- package/.next/static/chunks/027yjbjm9afuk.js +0 -1
- package/.next/static/chunks/07wf61~wof.l~.js +0 -1
- package/.next/static/chunks/0ev252k-tf_aa.css +0 -1
- package/.next/static/chunks/0j-jjs3w89dei.js +0 -1
- package/.next/static/chunks/0ko39v-gezo7d.js +0 -1
- package/.next/static/chunks/0l8vf4q2t5x4d.js +0 -7
- package/.next/static/chunks/0xcazs6t8~l4q.js +0 -2
- package/.next/static/chunks/10sr651~7vm42.js +0 -7
- package/.next/static/chunks/13_i5b0qmko7z.js +0 -1
- package/.next/static/chunks/140suz13o9va6.js +0 -1
- package/.next/static/chunks/144cf7ds3_9~b.js +0 -1
- package/.next/static/chunks/17c4wlsbmmgk9.js +0 -1
- package/.next/static/chunks/17cfly-04z1j0.js +0 -1
- /package/.next/static/{HIKVEkFShWE481BxQDjwH → vc_aJHtYwefsVcl2_f14Z}/_buildManifest.js +0 -0
- /package/.next/static/{HIKVEkFShWE481BxQDjwH → vc_aJHtYwefsVcl2_f14Z}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{HIKVEkFShWE481BxQDjwH → vc_aJHtYwefsVcl2_f14Z}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,91342,e=>{"use strict";var t=e.i(25599);e.s(["previewContent",0,function(e){return e&&e.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(e){return(0,t.relativeAgo)(e)??"--"}])},57835,97879,e=>{"use strict";var t=e.i(90724),r=e.i(87854);let s="anet_avatars_v1",a="anet-avatars-updated",n=null,i=[],l=!1;function o(){try{let e=JSON.parse(window.localStorage.getItem(s)||"{}");return e&&"object"==typeof e?e:{}}catch{return{}}}function c(e){return e&&(o()[e]||n?.[e]||function(e){if(!i.length)return"";let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)>>>0;return i[t%i.length]}(e))||""}let d=0;function x(e){l||(l=!0,fetch("/avatars/manifest.json",{cache:"no-cache"}).then(e=>e.ok?e.json():null).then(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t={};for(let[r,s]of Object.entries(e))!r.startsWith("_")&&"string"==typeof s&&s.startsWith("/")&&(t[r]=s);let r=e._pool;i=Array.isArray(r)?r.filter(e=>"string"==typeof e&&e.startsWith("/")):[],n=t,window.dispatchEvent(new Event(a))}}).catch(()=>{}));let t=()=>{d++,e()};return window.addEventListener(a,t),window.addEventListener("storage",t),()=>{window.removeEventListener(a,t),window.removeEventListener("storage",t)}}function h(e){return(0,r.useSyncExternalStore)(x,()=>c(e),()=>"")}e.s(["getAvatarUrl",0,c,"setAvatarUrl",0,function(e,t){if(e)try{let r=o();t.trim()?r[e]=t.trim():delete r[e],window.localStorage.setItem(s,JSON.stringify(r)),window.dispatchEvent(new Event(a))}catch{}},"useAvatarUrl",0,h,"useAvatarsVersion",0,function(){return(0,r.useSyncExternalStore)(x,()=>d,()=>0)}],97879);let m=[180,200,220,270,300,330,30,90];function u(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)>>>0;let r=m[t%m.length];return{bg:`hsl(${r} 55% 22%)`,ring:`hsl(${r} 60% 45%)`,text:`hsl(${r} 80% 78%)`}}function p(e){return e?(e.trim().match(/[\p{L}\p{N}]/u)?.[0]||e.trim()[0]||"·").toUpperCase():"·"}e.s(["AliasAvatar",0,function({alias:e,size:s=28,className:a=""}){let n=h(e),[i,l]=(0,r.useState)("loading"),[o,c]=(0,r.useState)(n);if(n!==o&&(c(n),l("loading")),n&&"error"!==i)return(0,t.jsx)("span",{className:`anet-alias-avatar relative inline-flex shrink-0 overflow-hidden rounded-full border border-[var(--border)] ${"loading"===i?"animate-pulse bg-[var(--bg-elevated)]":""} ${a}`,style:{width:s,height:s},title:e,"aria-hidden":!0,children:(0,t.jsx)("img",{src:n,alt:"",loading:"lazy",onLoad:()=>l("ready"),onError:()=>l("error"),className:`h-full w-full rounded-full object-cover transition-opacity duration-150 ${"ready"===i?"opacity-100":"opacity-0"}`})});if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${a}`,style:{width:s,height:s,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let d=u(e),x=Math.max(9,Math.round(.42*s));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${a}`,style:{width:s,height:s,fontSize:x,backgroundColor:d.bg,borderColor:d.ring,color:d.text},title:e,"aria-hidden":!0,children:p(e)})},"aliasAvatarColors",0,u,"aliasInitial",0,p],57835)},3068,e=>{"use strict";var t=e.i(90724),r=e.i(87854),s=e.i(60449);let a={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function n({variant:e,size:r}){let s={width:r,height:r},a={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"nodes":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...a,children:[(0,t.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,t.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,t.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...a,children:[(0,t.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,t.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,t.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...a,children:[(0,t.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,t.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,t.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...a,children:[(0,t.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,t.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,t.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,t.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...a,children:[(0,t.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,t.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,t.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,t.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...a,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,t.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,t.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...s,children:(0,t.jsxs)("g",{...a,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function i({variant:e="generic",title:r,sub:l,cta:o,compact:c=!1}){let d=a[e],x=r??d.title,h=l??d.sub;return(0,t.jsxs)("div",{className:`text-center ${c?"py-8":"py-16"} px-4`,role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)(n,{variant:e,size:c?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${c?"text-sm":"text-base"}`,children:x}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${c?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:h}),o&&(0,t.jsx)("div",{className:"mt-4",children:o.href?(0,t.jsxs)(s.default,{href:o.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:o.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[o.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function l({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#26262b] bg-[#161618] shadow-lg shadow-black/20",children:e})}function o({cmd:e}){let[s,a]=(0,r.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1800)}catch{}};return(0,t.jsxs)("div",{className:"anet-empty-cmd flex items-start sm:items-center gap-2 bg-[#0e0e10] border border-[#26262b] rounded-lg pl-4 pr-1.5 py-1.5 text-xs sm:text-sm",children:[(0,t.jsx)("code",{className:"text-cyan-300 font-mono select-all min-w-0 break-all sm:break-normal",children:e}),(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":s?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] transition-colors",children:s?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:r=0}){return e?.global_count?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents in this network",sub:`Server has ${e.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):r>0?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${r.toLocaleString()} task${1===r?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,t.jsx)(l,{children:(0,t.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,t.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,t.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,t.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,t.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,t.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,t.jsx)("div",{className:"mt-4 inline-block",children:(0,t.jsx)(o,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("p",{className:"text-gray-600 text-xs mt-3 max-w-md mx-auto",children:"Once the agent connects, it appears here automatically within a few seconds — no refresh needed."}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},99825,519,e=>{"use strict";var t=e.i(87854);let r=null,s=!1,a=new Set,n=new Map;function i(e){return a.add(e),()=>void a.delete(e)}e.s(["pinyinMatch",0,function(t,i){let l=i.trim().toLowerCase();if(!l||t.toLowerCase().includes(l))return!0;if(r||s||(s=!0,e.A(83927).then(e=>{r=t=>[e.pinyin(t,{toneType:"none",type:"array"}).join("").toLowerCase(),e.pinyin(t,{pattern:"first",toneType:"none",type:"array"}).join("").toLowerCase()],a.forEach(e=>e())}).catch(()=>{s=!1})),!r)return!1;let o=n.get(t);return o||(o=r(t),n.set(t,o)),o[0].includes(l)||o[1].includes(l)},"usePinyinReady",0,function(){return(0,t.useSyncExternalStore)(i,()=>!!r,()=>!1)}],99825),e.s(["t",0,function(e,t){return"u">typeof navigator&&(navigator.language||"").toLowerCase().startsWith("zh")?e:t}],519)},45840,e=>{"use strict";var t=e.i(90724),r=e.i(87854);let s=new Set(["png","jpg","jpeg","gif","webp","mp4","webm","mov"]),a=new Set(["image/png","image/jpeg","image/gif","image/webp"]),n=new Set(["video/mp4","video/webm"]),i=/^[A-Za-z0-9_-]{8,64}$/;async function l(e){let t=await fetch(`/api/hub/files/${encodeURIComponent(e)}`,{credentials:"include"});if(!t.ok)throw Error(`HTTP ${t.status}`);let r=t.headers.get("x-verified-type"),s=r&&(a.has(r)||n.has(r))?r:null,i=await t.blob(),l=s?new Blob([i],{type:s}):i;return{blobUrl:URL.createObjectURL(l),verifiedType:s,blob:l}}function o(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}function c({fileId:e,name:s,size:n,onNotInlineable:i}){let o="number"==typeof n&&n<=5242880,[d,x]=(0,r.useState)(null),[h,m]=(0,r.useState)(!1),[u,p]=(0,r.useState)(!1),g=(0,r.useRef)(i);g.current=i;let y=(0,r.useCallback)(async()=>{if(!h&&!d){m(!0);try{let{blobUrl:t,verifiedType:r}=await l(e);if(!r||!a.has(r)){URL.revokeObjectURL(t),g.current();return}x(t)}catch{p(!0)}finally{m(!1)}}},[e,h,d]);return((0,r.useEffect)(()=>{o&&y()},[o,y]),(0,r.useEffect)(()=>{if(d)return()=>URL.revokeObjectURL(d)},[d]),u)?(0,t.jsx)("div",{className:"mt-2 rounded-lg border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-sm text-amber-200",children:"图片加载失败 · 请点击下方下载按钮查看"}):d?(0,t.jsx)("div",{className:"mt-2 overflow-hidden rounded-lg border border-white/10 bg-black/20",children:(0,t.jsx)("img",{src:d,alt:s,className:"block max-h-[50vh] w-auto max-w-full cursor-zoom-in object-contain",onClick:()=>window.open(d,"_blank","noopener")})}):(0,t.jsxs)("button",{type:"button",onClick:y,disabled:h,className:"mt-2 flex w-full items-center gap-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 px-3 py-2 text-left text-sm text-cyan-100 transition hover:border-cyan-400/40 hover:bg-cyan-500/10 disabled:cursor-wait disabled:opacity-60",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-lg",children:"🖼️"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-cyan-300",children:h?"加载中…":"点击查看"})]})}function d({fileId:e,name:s,onNotInlineable:a}){let[i,o]=(0,r.useState)(null),[c,x]=(0,r.useState)(!1),[h,m]=(0,r.useState)(!1),u=(0,r.useRef)(a);u.current=a;let p=(0,r.useCallback)(async()=>{if(!c&&!i){x(!0);try{let{blobUrl:t,verifiedType:r}=await l(e);if(!r||!n.has(r)){URL.revokeObjectURL(t),u.current();return}o(t)}catch{m(!0)}finally{x(!1)}}},[e,c,i]);return((0,r.useEffect)(()=>{if(i)return()=>URL.revokeObjectURL(i)},[i]),h)?(0,t.jsx)("div",{className:"mt-2 rounded-lg border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-sm text-amber-200",children:"视频加载失败 · 请点击下方下载按钮查看"}):i?(0,t.jsx)("div",{className:"mt-2 overflow-hidden rounded-lg border border-white/10 bg-black/20",children:(0,t.jsx)("video",{src:i,controls:!0,autoPlay:!0,className:"block max-h-[50vh] w-full",children:"您的浏览器不支持内联视频播放,请下载后查看。"})}):(0,t.jsxs)("button",{type:"button",onClick:p,disabled:c,className:"mt-2 flex w-full items-center gap-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 px-3 py-2 text-left text-sm text-cyan-100 transition hover:border-cyan-400/40 hover:bg-cyan-500/10 disabled:cursor-wait disabled:opacity-60",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-lg",children:"🎬"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-cyan-300",children:c?"加载中…":"▶ 播放"})]})}e.s(["AttachmentBlock",0,function({attachment:e}){var l,x;let h,m,[u,p]=(0,r.useState)(!1),[g,y]=(0,r.useState)(null),[b,f]=(0,r.useState)(!1),j=function(e){if("string"!=typeof e||0===e.length)return"file";let t=e.replace(/[/\\]/g,"_").replace(/[\r\n\t\0]/g,"_");for(;t.startsWith(".");)t=t.slice(1);return t.length>200&&(t=t.slice(0,200)),t||"file"}(e.name),v="string"!=typeof(l=e.mime)?"":l.replace(/[^a-zA-Z0-9./+-]/g,"").slice(0,100),w="number"!=typeof(x=e.size)||!Number.isFinite(x)||x<0?"":x<1024?`${x} B`:x<1048576?`${(x/1024).toFixed(1)} KB`:x<0x40000000?`${(x/1024/1024).toFixed(1)} MB`:`${(x/1024/1024/1024).toFixed(2)} GB`,N=(h=(v||"").toLowerCase(),m=(j.split(".").pop()||"").toLowerCase(),h.startsWith("image/")?"🖼️":h.startsWith("video/")?"🎬":h.startsWith("audio/")?"🎵":h.includes("pdf")||"pdf"===m?"📄":["ppt","pptx"].includes(m)?"📊":["doc","docx"].includes(m)?"📝":["xls","xlsx","csv"].includes(m)?"📈":["zip","tar","gz","rar","7z"].includes(m)?"📦":"📎"),k="string"==typeof e.file_id&&i.test(e.file_id),C=k&&!b&&function(e,t){if(a.has(t)||n.has(t))return!0;let r=o(e);return""!==r&&s.has(r)}(j,v),_=o(j),$=C?n.has(v)||["mp4","webm","mov"].includes(_)?"video":"image":null;async function S(){if(!k||!e.file_id)return;y(null),p(!0);let t=null;try{let r=await fetch(`/api/hub/files/${encodeURIComponent(e.file_id)}`,{credentials:"include"});if(!r.ok)throw Error(`HTTP ${r.status}`);let s=await r.blob();t=URL.createObjectURL(s);let a=document.createElement("a");a.href=t,a.download=j,a.rel="noopener",document.body.appendChild(a),a.click(),document.body.removeChild(a)}catch(e){y(e instanceof Error?e.message:String(e))}finally{t&&URL.revokeObjectURL(t),p(!1)}}return k?(0,t.jsxs)("div",{className:"mt-2 flex flex-col",children:["image"===$&&e.file_id&&(0,t.jsx)(c,{fileId:e.file_id,name:j,size:"number"==typeof e.size?e.size:void 0,onNotInlineable:()=>f(!0)}),"video"===$&&e.file_id&&(0,t.jsx)(d,{fileId:e.file_id,name:j,onNotInlineable:()=>f(!0)}),(0,t.jsxs)("button",{type:"button",onClick:S,disabled:u,className:"flex w-full items-center gap-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 px-3 py-2 text-left text-sm text-cyan-100 transition hover:border-cyan-400/40 hover:bg-cyan-500/10 disabled:cursor-wait disabled:opacity-60 mt-2 first:mt-0",title:`Download ${j}`,children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-lg",children:N}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:j}),w&&(0,t.jsx)("span",{className:"shrink-0 text-xs text-neutral-400",children:w}),v&&(0,t.jsx)("span",{className:"shrink-0 rounded bg-white/5 px-1.5 py-0.5 text-[10px] text-neutral-400",children:v}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-cyan-300",children:u?"下载中…":g?`⚠ ${g}`:"↓ 下载"})]})]}):(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm text-neutral-300",children:[(0,t.jsx)("span",{"aria-hidden":!0,children:N}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:j}),w&&(0,t.jsx)("span",{className:"shrink-0 text-xs text-neutral-500",children:w}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-neutral-500",title:"Attachment has no file_id — single-host path only. Ask the sender to re-upload.",children:"(host-local)"})]})},"extractAttachments",0,function(e){if(!e||"object"!=typeof e)return[];let t=e.meta;if(!t&&"string"==typeof e.meta_json&&e.meta_json.length>0)try{t=JSON.parse(e.meta_json)}catch{return[]}if(!t||"object"!=typeof t)return[];let r=t.attachments;return Array.isArray(r)?r.filter(e=>!!e&&"object"==typeof e).map(e=>({file_id:"string"==typeof e.file_id?e.file_id:void 0,path:"string"==typeof e.path?e.path:void 0,name:"string"==typeof e.name?e.name:void 0,mime:"string"==typeof e.mime?e.mime:void 0,size:"number"==typeof e.size?e.size:void 0,type:"string"==typeof e.type?e.type:void 0})):[]}])},54258,e=>{"use strict";var t=e.i(90724),r=e.i(87854);e.s(["useCollapsibleSearch",0,function(e){let{value:s}=e,[a,n]=(0,r.useState)(!1),i=(0,r.useRef)(e);i.current=e;let l=(0,r.useRef)(a);l.current=a;let o=(0,r.useCallback)(()=>{i.current.onChange(""),n(!1)},[]),[c]=(0,r.useState)(()=>({Button:()=>{let{value:e,label:r="Search",enabled:s=!0}=i.current,a=l.current;if(!s)return(0,t.jsx)(t.Fragment,{});let o=a||e;return(0,t.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),"aria-label":a?`Close ${r.toLowerCase()}`:`Open ${r.toLowerCase()}`,"aria-pressed":a,title:a?`Close ${r.toLowerCase()}`:r,className:`relative shrink-0 inline-flex items-center justify-center rounded-full border w-9 h-9 transition-colors ${o?"border-cyan-500/40 bg-cyan-500/10 text-cyan-300":"border-[#26262b] bg-[#161618] text-gray-400 hover:text-gray-200 hover:border-[#3a3a41]"}`,children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),e&&!a&&(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-cyan-400 ring-2 ring-[#0b0b0d]"})]})},Row:()=>{let{value:e,onChange:r,placeholder:s="Search…",enabled:a=!0}=i.current,n=l.current;return a&&(n||e)?(0,t.jsxs)("div",{className:"mb-3 sm:mb-4 flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",value:e,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key&&o()},placeholder:s,autoFocus:n,className:"flex-1 bg-[#161618] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,t.jsx)("button",{type:"button",onClick:o,className:"shrink-0 text-xs text-gray-500 hover:text-gray-300 px-2 py-2","aria-label":"Clear and close search",children:"Cancel"})]}):null}}));return{Button:c.Button,Row:c.Row,value:s,reset:o}}])},23840,e=>{"use strict";var t=e.i(90724),r=e.i(87854),s=e.i(74069),a=e.i(91342),n=e.i(25599),i=e.i(3068),l=e.i(57835),o=e.i(54258),c=e.i(99825),d=e.i(519),x=e.i(45840);let h={task:"bg-green-500/10 text-green-300 border-green-500/20",message:"bg-blue-500/10 text-blue-300 border-blue-500/20",broadcast:"bg-purple-500/10 text-purple-300 border-purple-500/20",reply:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"};function m(e){return e?new Date(e.replace(" ","T")+"Z").getTime():0}function u(e){return"broadcast"===e.type?"broadcast":"dashboard"===(e.from_alias||"").toLowerCase()?"outgoing":"incoming"}function p(e,r){let s=e||"--",a=r.trim();if(!a||a.startsWith("from:"))return s;let n=s.toLowerCase().indexOf(a.toLowerCase());return n<0?s:(0,t.jsxs)(t.Fragment,{children:[s.slice(0,n),(0,t.jsx)("mark",{className:"bg-yellow-500/30 text-yellow-200 rounded px-0.5",children:s.slice(n,n+a.length)}),s.slice(n+a.length)]})}e.s(["default",0,function(){let[e,g]=(0,r.useState)(30),{messages:y,isLoading:b}=(0,s.useMessages)(e),f=y.length>=e,j=b&&y.length>0,[v,w]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),C=(0,c.usePinyinReady)(),[_,$]=(0,r.useState)(!1),[S,L]=(0,r.useState)("timeline"),A=(0,r.useRef)(null),R=(0,r.useRef)(!1);(0,r.useEffect)(()=>{R.current||0===y.length||(R.current=!0,A.current?.scrollIntoView())},[y.length]);let E=(0,o.useCollapsibleSearch)({value:N,onChange:k,placeholder:(0,d.t)("搜 别名(支持拼音)/内容,或 from:别名…","Search from/to (pinyin ok)/content, or from:alias…"),label:"Search messages",enabled:y.length>0}),U=(0,r.useMemo)(()=>{let e=new Set;return y.forEach(t=>{let r=t.from_alias?.trim();r&&"dashboard"!==r.toLowerCase()&&e.add(r)}),[...e].slice(0,8)},[y]),z=(0,r.useMemo)(()=>{let e=N.trim().toLowerCase(),t=e.startsWith("from:")?e.slice(5).trim():"";return[...y].filter(r=>(!v||r.type===v)&&(t?(0,c.pinyinMatch)(r.from_alias||"",t):!e||(0,c.pinyinMatch)(r.from_alias||"",e)||(0,c.pinyinMatch)(r.to_alias||"",e)||(r.content||"").toLowerCase().includes(e))).sort((e,t)=>m(e.created_at)-m(t.created_at))},[v,y,N,C]),B=(0,r.useMemo)(()=>{let e=new Map;return z.forEach(t=>{let r=t.from_alias||"?",s=t.to_alias||"?",a=[r,s].sort().join("↔"),n=e.get(a)||{participants:[r,s].sort(),messages:[],lastTime:0};n.messages.push(t),n.lastTime=Math.max(n.lastTime,m(t.created_at)),e.set(a,n)}),[...e.values()].sort((e,t)=>t.lastTime-e.lastTime)},[z]);return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-4 sm:mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Messages"}),(0,t.jsx)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30 tabular-nums shrink-0",title:z.length<y.length?`Showing ${z.length} of ${y.length} messages`:void 0,children:z.length<y.length?`${z.length} / ${y.length}`:y.length}),z.length>0&&(0,t.jsx)("button",{onClick:()=>{let e=z.map(e=>`**${e.from_alias||"?"}** → ${e.to_alias||"?"} (${e.type||"?"}) — ${e.created_at||""}
|
|
2
|
+
|
|
3
|
+
${e.content||"--"}
|
|
4
|
+
|
|
5
|
+
---`).join("\n\n"),t=new Blob([`# Messages Export
|
|
6
|
+
|
|
7
|
+
${e}`],{type:"text/markdown"}),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=`messages-${new Date().toISOString().slice(0,10)}.md`,s.click(),URL.revokeObjectURL(r)},className:"text-xs text-gray-500 hover:text-gray-300 border border-gray-700/50 px-2.5 py-1 rounded-lg transition-colors shrink-0",children:"Export MD"})]}),(0,t.jsx)(E.Button,{})]}),(0,t.jsx)(E.Row,{}),y.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-3",children:[(0,t.jsxs)("select",{value:v,onChange:e=>w(e.target.value),className:"bg-[#161618] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white focus:border-blue-500/50 focus:outline-none",children:[(0,t.jsx)("option",{value:"",children:"All types"}),(0,t.jsx)("option",{value:"task",children:"task"}),(0,t.jsx)("option",{value:"message",children:"message"}),(0,t.jsx)("option",{value:"broadcast",children:"broadcast"}),(0,t.jsx)("option",{value:"reply",children:"reply"})]}),(0,t.jsx)("div",{className:"flex rounded-lg border border-[#26262b] bg-[#161618] p-0.5",children:["timeline","grouped"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>L(e),className:`rounded-md px-2.5 py-1.5 text-xs transition-colors ${S===e?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"timeline"===e?"Timeline":"Grouped"},e))}),(0,t.jsx)("button",{onClick:()=>$(!_),className:`text-xs px-3 py-2 rounded-lg border transition-colors ${_?"bg-yellow-500/10 text-yellow-300 border-yellow-500/20":"text-gray-500 border-gray-700/50 hover:text-gray-300"}`,children:_?"Debug ON":"Debug"})]}),U.length>0&&(0,t.jsxs)("div",{className:"mb-4 sm:mb-6 flex gap-2 overflow-x-auto whitespace-nowrap pb-1 scrollbar-thin sm:flex-wrap sm:overflow-visible sm:whitespace-normal sm:pb-0",children:[U.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>k(`from:${e}`),className:`shrink-0 rounded-full border px-3 py-1 text-xs transition-colors ${N===`from:${e}`?"border-cyan-500/30 bg-cyan-500/10 text-cyan-300":"border-[#26262b] bg-[#161618] text-gray-400 hover:text-gray-200"}`,children:["from:",e]},e)),N.startsWith("from:")&&(0,t.jsx)("button",{type:"button",onClick:()=>k(""),className:"shrink-0 rounded-full border border-gray-700 px-3 py-1 text-xs text-gray-500 hover:text-gray-200",children:"Clear"})]}),y.length>0&&f&&(0,t.jsx)("div",{className:"mb-3 flex justify-center",children:(0,t.jsx)("button",{type:"button",onClick:()=>g(e=>e+30),disabled:j,className:"rounded-full border border-[#26262b] bg-[#161618] px-4 py-1.5 text-xs text-gray-400 transition-colors hover:text-gray-200 disabled:opacity-50",children:j?"Loading…":"↑ Load earlier messages"})}),b&&0===y.length?(0,t.jsx)("div",{className:"animate-pulse space-y-3",children:[1,2,3,4,5].map(e=>(0,t.jsx)("div",{className:"h-20 rounded-2xl bg-gray-800/20"},e))}):0===z.length?(0,t.jsx)(i.EmptyState,{variant:"messages"}):"grouped"===S?(0,t.jsx)("div",{className:"space-y-4",children:B.map((e,r)=>(0,t.jsxs)("div",{className:"bg-[#161618] border border-[#26262b] rounded-xl overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-4 py-2.5 border-b border-[#26262b] flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.AliasAvatar,{alias:e.participants[0],size:16}),(0,t.jsx)("span",{className:"text-sm text-gray-200 font-medium",children:e.participants[0]}),(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"↔"}),(0,t.jsx)(l.AliasAvatar,{alias:e.participants[1],size:16}),(0,t.jsx)("span",{className:"text-sm text-gray-200 font-medium",children:e.participants[1]})]}),(0,t.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.messages.length," messages"]})]}),(0,t.jsx)("div",{className:"px-4 py-2 space-y-2 max-h-64 overflow-y-auto",children:e.messages.map(e=>(0,t.jsxs)("div",{className:"flex items-start gap-2 text-xs py-1",children:[e.from_alias&&(0,t.jsx)(l.AliasAvatar,{alias:e.from_alias,size:14}),(0,t.jsx)("span",{className:"shrink-0 font-medium text-gray-200",children:e.from_alias}),(0,t.jsx)("span",{className:"text-gray-400 flex-1 truncate",title:e.content||"",children:(0,a.previewContent)(e.content).slice(0,120)}),(0,t.jsx)("span",{className:"text-[9px] text-gray-600 shrink-0",children:(0,a.timeAgo)(e.created_at||"")})]},e.id))})]},r))}):(0,t.jsxs)("div",{className:"space-y-1",children:[z.map((e,r)=>{var s;let i=z[r-1],o=!!i&&m(e.created_at)-m(i.created_at)>3e5,c=u(e),d=!!i&&!o&&u(i)===c&&(i.from_alias||"")===(e.from_alias||"")&&(i.to_alias||"")===(e.to_alias||""),g=e.from_alias||"?";return(0,t.jsxs)("div",{children:[o&&(0,t.jsxs)("div",{className:"my-2 sm:my-4 flex items-center gap-3",children:[(0,t.jsx)("div",{className:"h-px flex-1 bg-[#26262b]"}),(0,t.jsx)("div",{className:"text-[11px] text-gray-600",children:(s=e.created_at,(0,n.formatWeChatTime)(s)||"Time gap")}),(0,t.jsx)("div",{className:"h-px flex-1 bg-[#26262b]"})]}),"broadcast"===c?(0,t.jsx)("div",{className:d?"mt-0.5 sm:mt-1":"mt-2 sm:mt-3",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-purple-500/20 bg-purple-500/10 px-3 py-2 sm:px-4 sm:py-3 shadow-sm w-full",children:[(0,t.jsxs)("div",{className:"mb-1 sm:mb-2 flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${h[e.type||""]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:e.type||"unknown"}),(0,t.jsx)("span",{className:"text-sm font-medium text-purple-200",children:g}),e.to_alias&&(0,t.jsxs)("span",{className:"text-xs text-purple-200/80",children:["to ",e.to_alias]}),"high"===e.priority&&(0,t.jsx)("span",{className:"text-xs text-red-400",children:"HIGH"}),(0,t.jsx)("span",{className:"ml-auto text-xs text-gray-500",children:e.created_at?(0,a.timeAgo)(e.created_at):"--"})]}),(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere] text-sm leading-snug sm:leading-relaxed text-gray-200",children:p(e.content,N)}),(0,x.extractAttachments)(e).map((r,s)=>(0,t.jsx)(x.AttachmentBlock,{attachment:r},`att-b-${e.id}-${r.file_id??s}`))]})}):(0,t.jsxs)("div",{className:`${d?"mt-0.5 sm:mt-1":"mt-2 sm:mt-3"} flex gap-2 ${"outgoing"===c?"flex-row-reverse":"flex-row"}`,children:[(0,t.jsx)("div",{className:"w-8 shrink-0 pt-1",children:!d&&(0,t.jsx)(l.AliasAvatar,{alias:g,size:32})}),(0,t.jsxs)("div",{className:`min-w-0 max-w-3xl rounded-2xl border px-3 py-2 sm:px-4 sm:py-3 shadow-sm ${"outgoing"===c?"border-green-500/20 bg-green-500/10":"border-blue-500/20 bg-blue-500/10"}`,children:[!d&&(0,t.jsxs)("div",{className:"mb-1 sm:mb-2 flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${h[e.type||""]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:e.type||"unknown"}),(0,t.jsx)("span",{className:`text-sm font-medium ${"outgoing"===c?"text-green-300":"text-blue-300"}`,children:g}),(0,t.jsx)("span",{className:"text-xs text-gray-600",children:"→"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:e.to_alias||"--"}),"high"===e.priority&&(0,t.jsx)("span",{className:"text-xs text-red-400",children:"HIGH"}),(0,t.jsx)("span",{className:"ml-auto text-xs text-gray-500",children:e.created_at?(0,a.timeAgo)(e.created_at):"--"})]}),(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere] text-sm leading-snug sm:leading-relaxed text-gray-200",children:p(e.content,N)}),(0,x.extractAttachments)(e).map((r,s)=>(0,t.jsx)(x.AttachmentBlock,{attachment:r},`att-msg-${e.id}-${r.file_id??s}`)),d&&(0,t.jsx)("div",{className:"mt-1 text-[10px] text-gray-600 text-right",children:e.created_at?(0,a.timeAgo)(e.created_at):""}),_&&(0,t.jsxs)("div",{className:"mt-3 border-t border-white/10 pt-3 text-xs text-gray-500 space-y-1",children:[(0,t.jsxs)("div",{children:["ID: ",e.id]}),e.task_id&&(0,t.jsxs)("div",{children:["Task ID: ",e.task_id]}),(0,t.jsxs)("div",{children:["Created: ",e.created_at]})]})]})]})]},e.id)}),(0,t.jsx)("div",{ref:A})]})]})}])},83927,e=>{e.v(t=>Promise.all(["static/chunks/0u848pnoyh8zz.js"].map(t=>e.l(t))).then(()=>t(46496)))}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,91342,e=>{"use strict";var t=e.i(25599);e.s(["previewContent",0,function(e){return e&&e.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(e){return(0,t.relativeAgo)(e)??"--"}])},57835,97879,e=>{"use strict";var t=e.i(90724),a=e.i(87854);let r="anet_avatars_v1",s="anet-avatars-updated",n=null,i=[],l=!1;function d(){try{let e=JSON.parse(window.localStorage.getItem(r)||"{}");return e&&"object"==typeof e?e:{}}catch{return{}}}function o(e){return e&&(d()[e]||n?.[e]||function(e){if(!i.length)return"";let t=5381;for(let a=0;a<e.length;a++)t=(t<<5)+t+e.charCodeAt(a)>>>0;return i[t%i.length]}(e))||""}let c=0;function x(e){l||(l=!0,fetch("/avatars/manifest.json",{cache:"no-cache"}).then(e=>e.ok?e.json():null).then(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t={};for(let[a,r]of Object.entries(e))!a.startsWith("_")&&"string"==typeof r&&r.startsWith("/")&&(t[a]=r);let a=e._pool;i=Array.isArray(a)?a.filter(e=>"string"==typeof e&&e.startsWith("/")):[],n=t,window.dispatchEvent(new Event(s))}}).catch(()=>{}));let t=()=>{c++,e()};return window.addEventListener(s,t),window.addEventListener("storage",t),()=>{window.removeEventListener(s,t),window.removeEventListener("storage",t)}}function h(e){return(0,a.useSyncExternalStore)(x,()=>o(e),()=>"")}e.s(["getAvatarUrl",0,o,"setAvatarUrl",0,function(e,t){if(e)try{let a=d();t.trim()?a[e]=t.trim():delete a[e],window.localStorage.setItem(r,JSON.stringify(a)),window.dispatchEvent(new Event(s))}catch{}},"useAvatarUrl",0,h,"useAvatarsVersion",0,function(){return(0,a.useSyncExternalStore)(x,()=>c,()=>0)}],97879);let m=[180,200,220,270,300,330,30,90];function g(e){let t=0;for(let a=0;a<e.length;a++)t=31*t+e.charCodeAt(a)>>>0;let a=m[t%m.length];return{bg:`hsl(${a} 55% 22%)`,ring:`hsl(${a} 60% 45%)`,text:`hsl(${a} 80% 78%)`}}function u(e){return e?(e.trim().match(/[\p{L}\p{N}]/u)?.[0]||e.trim()[0]||"·").toUpperCase():"·"}e.s(["AliasAvatar",0,function({alias:e,size:r=28,className:s=""}){let n=h(e),[i,l]=(0,a.useState)("loading"),[d,o]=(0,a.useState)(n);if(n!==d&&(o(n),l("loading")),n&&"error"!==i)return(0,t.jsx)("span",{className:`anet-alias-avatar relative inline-flex shrink-0 overflow-hidden rounded-full border border-[var(--border)] ${"loading"===i?"animate-pulse bg-[var(--bg-elevated)]":""} ${s}`,style:{width:r,height:r},title:e,"aria-hidden":!0,children:(0,t.jsx)("img",{src:n,alt:"",loading:"lazy",onLoad:()=>l("ready"),onError:()=>l("error"),className:`h-full w-full rounded-full object-cover transition-opacity duration-150 ${"ready"===i?"opacity-100":"opacity-0"}`})});if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(e))return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${s}`,style:{width:r,height:r,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:e,"aria-hidden":!0});let c=g(e),x=Math.max(9,Math.round(.42*r));return(0,t.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${s}`,style:{width:r,height:r,fontSize:x,backgroundColor:c.bg,borderColor:c.ring,color:c.text},title:e,"aria-hidden":!0,children:u(e)})},"aliasAvatarColors",0,g,"aliasInitial",0,u],57835)},3068,e=>{"use strict";var t=e.i(90724),a=e.i(87854),r=e.i(60449);let s={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function n({variant:e,size:a}){let r={width:a,height:a},s={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"nodes":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...r,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,t.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,t.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...r,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,t.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,t.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...r,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,t.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,t.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...r,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,t.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,t.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,t.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...r,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,t.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,t.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,t.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...r,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,t.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,t.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,t.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,t.jsx)("svg",{viewBox:"0 0 64 64",...r,children:(0,t.jsxs)("g",{...s,children:[(0,t.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,t.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function i({variant:e="generic",title:a,sub:l,cta:d,compact:o=!1}){let c=s[e],x=a??c.title,h=l??c.sub;return(0,t.jsxs)("div",{className:`text-center ${o?"py-8":"py-16"} px-4`,role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)(n,{variant:e,size:o?40:56})}),(0,t.jsx)("h3",{className:`font-medium text-gray-300 ${o?"text-sm":"text-base"}`,children:x}),h&&(0,t.jsx)("p",{className:`text-gray-500 ${o?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:h}),d&&(0,t.jsx)("div",{className:"mt-4",children:d.href?(0,t.jsxs)(r.default,{href:d.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[d.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,t.jsxs)("button",{onClick:d.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[d.label,(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function l({children:e}){return(0,t.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#26262b] bg-[#161618] shadow-lg shadow-black/20",children:e})}function d({cmd:e}){let[r,s]=(0,a.useState)(!1),n=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1800)}catch{}};return(0,t.jsxs)("div",{className:"anet-empty-cmd flex items-start sm:items-center gap-2 bg-[#0e0e10] border border-[#26262b] rounded-lg pl-4 pr-1.5 py-1.5 text-xs sm:text-sm",children:[(0,t.jsx)("code",{className:"text-cyan-300 font-mono select-all min-w-0 break-all sm:break-normal",children:e}),(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":r?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] transition-colors",children:r?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}e.s(["EmptyState",0,i,"NodesEmptyState",0,function({hint:e,taskHistoryCount:a=0}){return e?.global_count?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents in this network",sub:`Server has ${e.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):a>0?(0,t.jsx)(l,{children:(0,t.jsx)(i,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${a.toLocaleString()} task${1===a?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,t.jsx)(l,{children:(0,t.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,t.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,t.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,t.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,t.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,t.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,t.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,t.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,t.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,t.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,t.jsx)("div",{className:"mt-4 inline-block",children:(0,t.jsx)(d,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,t.jsx)("p",{className:"text-gray-600 text-xs mt-3 max-w-md mx-auto",children:"Once the agent connects, it appears here automatically within a few seconds — no refresh needed."}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,t.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},90991,e=>{"use strict";e.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-gray-500/10 text-gray-300 border-gray-500/20",blocked:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",error:"bg-red-500/10 text-red-300 border-red-500/20",offline:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"SESSION_STATUS_TEXT_CLASS",0,{working:"text-green-400",idle:"text-gray-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-gray-400",acked:"bg-gray-300",running:"bg-green-500",replied:"bg-gray-400",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-gray-600",expired:"bg-gray-600"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-gray-500/10 text-gray-300 border-gray-500/20",acked:"bg-gray-500/10 text-gray-300 border-gray-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-gray-500/10 text-gray-300 border-gray-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-gray-500/10 text-gray-500 border-gray-500/20",expired:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#9ca3af",acked:"#9ca3af",running:"#4ade80",replied:"#9ca3af",closed:"#6b7280",failed:"#f87171",cancelled:"#6b7280",expired:"#6b7280"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},15445,e=>{"use strict";var t=e.i(90724),a=e.i(87854),r=e.i(61866),s=e.i(25879),n=e.i(3068),i=e.i(57835),l=e.i(91342),d=e.i(90991);function o({tasks:e,selectedId:a,onSelect:r}){return(0,t.jsx)("div",{"data-testid":"task-list-rail",className:"flex flex-col h-full max-h-screen overflow-y-auto",children:0===e.length?(0,t.jsx)("div",{className:"px-4 py-6 text-xs text-gray-600 text-center",children:"没有匹配的任务"}):(0,t.jsx)("ul",{className:"flex flex-col divide-y divide-[#1c1c1f]",children:e.map(e=>{let s=e.task_id===a;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-task-row":!0,"data-task-id":e.task_id,"data-selected":s?"true":"false",onClick:()=>r(e.task_id),className:`w-full text-left px-3 py-2.5 transition-colors ${s?"bg-cyan-500/10 border-l-2 border-cyan-500":"border-l-2 border-transparent hover:bg-[#1c1c1f]/40"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:d.STATUS_DOT_HEX[e.status]||"#6b7280"}}),(0,t.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${d.STATUS_CHIP_CLASS[e.status]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:e.status}),"high"===e.priority&&(0,t.jsx)("span",{className:"text-[10px] text-red-400 shrink-0",children:"HIGH"}),(0,t.jsx)("span",{className:"ml-auto text-[10px] text-gray-600 tabular-nums shrink-0",children:function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}(e.created_at)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 text-xs text-gray-300 min-w-0 mb-1",children:[e.from_name&&(0,t.jsx)(i.AliasAvatar,{alias:e.from_name,size:14}),(0,t.jsx)("span",{className:"truncate max-w-[35%]",children:e.from_name||"--"}),(0,t.jsx)("span",{className:"text-gray-600 shrink-0",children:"→"}),e.to_name&&(0,t.jsx)(i.AliasAvatar,{alias:e.to_name,size:14}),(0,t.jsx)("span",{className:"truncate max-w-[35%]",children:e.to_name||"--"})]}),(0,t.jsx)("div",{className:"text-[11px] text-gray-500 line-clamp-2 leading-snug",title:e.content,children:(0,l.previewContent)(e.content)||(0,t.jsx)("span",{className:"italic",children:"(no content)"})})]})},e.task_id)})})})}var c=e.i(35644);function x(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}let h=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()};function m({taskId:e,onClose:r,onRetried:s}){var n;let{data:l,isLoading:o,error:g,mutate:u}=(0,c.default)(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`,h,{refreshInterval:5e3}),{data:y}=(0,c.default)(`/api/hub/task-events?task_id=${encodeURIComponent(e)}&limit=50`,h,{refreshInterval:1e4}),[p,b]=(0,a.useState)(!1),f=l?.tasks?.[0],j=y?.events||[],v=async()=>{if(f){b(!0);try{await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:f.to_name,task:f.content,priority:f.priority,...f.network_id?{network_id:f.network_id}:{}})}),u(),s?.()}finally{b(!1)}}},w=f?[{label:"Created",time:f.created_at,color:"text-gray-400"},{label:"Delivered",time:f.delivered_at,color:"text-blue-400"},{label:"Started",time:f.started_at,color:"text-green-400"},{label:"Completed",time:f.completed_at,color:"text-purple-400"}]:[];return(0,t.jsxs)("div",{"data-testid":"task-detail-pane","data-task-id":e,"data-poll-task-ms":String(5e3),"data-poll-events-ms":String(1e4),className:"flex flex-col h-full max-h-screen overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[#1c1c1f]",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"text-xs text-gray-500 truncate",title:e,children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Task ID:"})," ",(0,t.jsxs)("span",{className:"font-mono",children:[e.slice(0,12),"…"]})]}),f&&(0,t.jsx)("span",{"data-testid":"task-detail-status",className:`text-xs px-2 py-0.5 rounded-md border ${d.STATUS_CHIP_CLASS[f.status]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:f.status})]}),r&&(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":"Close detail (返回 tasks 列表)","data-testid":"task-detail-close",className:"shrink-0 rounded-md border border-[#26262b] px-2 py-1 text-xs text-gray-400 hover:text-white hover:border-[#3a3a41]",children:"←"})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[o&&!f&&(0,t.jsxs)("div",{className:"animate-pulse space-y-3",children:[(0,t.jsx)("div",{className:"h-6 w-1/3 bg-gray-800/40 rounded"}),(0,t.jsx)("div",{className:"h-24 bg-gray-800/40 rounded"}),(0,t.jsx)("div",{className:"h-24 bg-gray-800/40 rounded"})]}),g&&(0,t.jsx)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-3 py-2 rounded text-sm",children:g instanceof Error?g.message:"fetch failed"}),!o&&!g&&!f&&(0,t.jsx)("div",{className:"text-gray-400 text-sm",children:"Task not found"}),f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("section",{"data-testid":"task-detail-timeline","data-block":"timeline",className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Timeline"}),(0,t.jsx)("div",{className:"relative",children:w.map((e,a)=>{let r=!!e.time,s=a===w.length-1;return(0,t.jsxs)("div",{"data-testid":`timeline-step-${e.label.toLowerCase()}`,"data-timeline-step":e.label.toLowerCase(),"data-timeline-done":r?"true":"false",className:"flex gap-3 pb-4 last:pb-0",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("div",{className:`w-3 h-3 rounded-full border-2 shrink-0 ${r?`${e.color} border-current`:"border-gray-700 bg-transparent"}`}),!s&&(0,t.jsx)("div",{className:`w-0.5 flex-1 mt-1 ${r&&w[a+1]?.time?"bg-cyan-500/40":"bg-gray-800"}`})]}),(0,t.jsxs)("div",{className:"min-w-0 -mt-0.5",children:[(0,t.jsx)("div",{className:`text-sm font-medium ${r?"text-gray-200":"text-gray-600"}`,children:e.label}),(0,t.jsx)("div",{className:"text-xs text-gray-500",title:e.time||void 0,children:e.time?`${x(e.time)} — ${e.time}`:"Pending"})]})]},e.label)})})]}),(0,t.jsxs)("section",{"data-testid":"task-detail-info","data-block":"info",className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Info"}),(0,t.jsx)("div",{className:"space-y-2 text-xs",children:[["Task ID",f.task_id],["From",f.from_name],["To",f.to_name],["Priority",f.priority],["Status",f.status],["Expires",f.expires_at]].map(([e,a])=>(0,t.jsxs)("div",{className:"flex justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-gray-500 shrink-0",children:e}),(0,t.jsx)("span",{"data-info-field":String(e).toLowerCase().replace(/\s+/g,"-"),className:"text-gray-300 truncate max-w-[240px] text-right",title:String(a||""),children:String(a||"--")})]},e))}),(0,t.jsxs)("div",{className:"mt-4 pt-3 border-t border-[#1c1c1f] flex items-center gap-2 text-sm text-gray-300","data-testid":"task-detail-participants",children:[f.from_name&&(0,t.jsx)(i.AliasAvatar,{alias:f.from_name,size:20}),(0,t.jsx)("span",{className:"truncate",children:f.from_name||"--"}),(0,t.jsx)("span",{className:"text-gray-600 shrink-0",children:"→"}),f.to_name&&(0,t.jsx)(i.AliasAvatar,{alias:f.to_name,size:20}),(0,t.jsx)("span",{className:"truncate",children:f.to_name||"--"})]}),(0,t.jsx)("div",{className:"mt-2 text-[10px]",children:(0,t.jsxs)("span",{className:"high"===(n=f.priority)?"text-red-400":"low"===n?"text-gray-600":"text-gray-400","data-testid":"task-detail-priority",children:["Priority: ",f.priority||"normal"]})})]}),(0,t.jsxs)("section",{"data-testid":"task-detail-content","data-block":"content",className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Content"}),(0,t.jsx)("pre",{"data-testid":"task-detail-content-body",className:"text-xs text-gray-200 whitespace-pre-wrap break-words bg-[#0e0e10] rounded-lg px-3 py-2 border border-[#1c1c1f] max-h-64 overflow-y-auto font-sans",children:f.content||"--"})]}),f.result&&(0,t.jsxs)("section",{"data-testid":"task-detail-result","data-block":"result",className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Result"}),(0,t.jsx)("pre",{"data-testid":"task-detail-result-body",className:"text-xs text-gray-200 whitespace-pre-wrap break-words bg-[#0e0e10] rounded-lg px-3 py-2 border border-[#1c1c1f] max-h-64 overflow-y-auto font-sans",children:f.result})]}),(0,t.jsxs)("section",{"data-testid":"task-detail-events","data-block":"events","data-events-count":j.length,className:"bg-[#161618] border border-[#26262b] rounded-xl p-4",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:["Events ",j.length>0&&(0,t.jsxs)("span",{className:"text-gray-500",children:["(",j.length,")"]})]}),0===j.length?(0,t.jsx)("div",{className:"text-xs text-gray-600 italic",children:"No events yet."}):(0,t.jsx)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:j.map((e,a)=>(0,t.jsxs)("div",{"data-testid":"task-detail-event-row",className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:`w-1.5 h-1.5 rounded-full shrink-0 ${"running"===e.to_status?"bg-green-400":"replied"===e.to_status?"bg-purple-400":"failed"===e.to_status?"bg-red-400":"bg-blue-400"}`}),(0,t.jsx)("span",{className:"text-gray-400",children:e.event_type}),e.from_status&&(0,t.jsxs)("span",{className:"text-gray-600",children:[e.from_status," → ",e.to_status]}),(0,t.jsx)("span",{className:"text-gray-600 ml-auto shrink-0",title:e.created_at,children:x(e.created_at)})]},e.id??a))})]}),("failed"===f.status||"expired"===f.status)&&(0,t.jsx)("div",{children:(0,t.jsx)("button",{onClick:v,disabled:p,"data-testid":"task-detail-retry",className:"text-xs text-orange-400 hover:text-orange-300 px-3 py-1.5 rounded-md border border-orange-500/30 hover:bg-orange-500/10 disabled:opacity-50 disabled:cursor-wait",children:p?"Retrying…":"Retry task"})})]})]})]})}let g="(min-width: 768px)";function u(e){let t=window.matchMedia(g);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function y(e){try{return decodeURIComponent(e)}catch{return e}}function p({initialSelectedId:e=null}){let i=(0,r.useSearchParams)(),{networkId:l}=(0,s.useNetworkId)(),[c,x]=(0,a.useState)([]),[h,b]=(0,a.useState)(0),[f,j]=(0,a.useState)(!0),[v,w]=(0,a.useState)(""),[k,N]=(0,a.useState)(i.get("status")||""),[S,_]=(0,a.useState)(""),[C,T]=(0,a.useState)(""),[A,$]=(0,a.useState)(e),E=(0,a.useSyncExternalStore)(u,()=>window.matchMedia(g).matches,()=>!0),I=()=>{$(null);try{window.history.pushState({},"","/tasks")}catch{}};(0,a.useEffect)(()=>{let e=()=>{let e=window.location.pathname.match(/^\/tasks\/([^/]+)\/?$/);$(e?y(e[1]):null)};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]);let L=(0,a.useCallback)(async()=>{try{let e=new URLSearchParams;l&&e.set("network_id",l),k&&e.set("status",k),S&&e.set("from_name",S),C&&e.set("to_name",C),e.set("limit","100");let t=await fetch(`/api/hub/tasks?${e.toString()}`);if(401===t.status)return void window.location.assign("/login");let a=await t.json();x(a.tasks||[]),b(a.count??(a.tasks?.length||0)),w("")}catch(e){w(e instanceof Error?e.message:"fetch failed")}finally{j(!1)}},[k,S,C,l]);(0,a.useEffect)(()=>{j(!0),L();let e=setInterval(L,5e3);return()=>clearInterval(e)},[L]);let U={};c.forEach(e=>{U[e.status]=(U[e.status]||0)+1});let M=c.length||1,R=d.TASK_STATUSES.map(e=>({key:e,color:d.STATUS_BAR_CLASS[e]})).filter(e=>U[e.key]);return(0,t.jsxs)("div",{"data-testid":"tasks-layout","data-selected-id":A??"",className:"min-h-screen max-w-full overflow-x-hidden bg-[#0b0b0d] text-gray-100 flex",children:[(0,t.jsxs)("aside",{"data-testid":"task-list-column",className:`flex flex-col w-full sm:w-[380px] shrink-0 min-h-screen sticky top-0 border-r border-[#1c1c1f] ${A&&!E?"hidden":"flex"}`,children:[(0,t.jsxs)("div",{className:"px-4 py-3 border-b border-[#1c1c1f]",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("h1",{className:"text-xl font-bold text-white lg:ml-0 ml-10",children:"Tasks"}),c.length<h&&(0,t.jsxs)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30 tabular-nums",title:`Showing ${c.length} of ${h} tasks`,children:[c.length," / ",h]})]}),c.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"anet-tabstrip-wrap mb-2",children:(0,t.jsx)("div",{className:"anet-tabstrip flex flex-wrap gap-1 bg-[#161618] rounded-lg border border-[#26262b] p-1 overflow-x-auto scrollbar-thin",children:["",...d.TASK_STATUSES].map(e=>{let a=""===e?c.length:U[e]||0,r=k===e;return(0,t.jsxs)("button",{onClick:()=>N(e),disabled:0===a&&""!==e&&!r,className:`px-2.5 py-1 rounded-md text-xs transition-colors flex items-center gap-1 shrink-0 whitespace-nowrap disabled:opacity-30 disabled:cursor-not-allowed ${r?`${d.STATUS_CHIP_CLASS[e]||"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"} border`:"text-gray-500 hover:text-gray-300 hover:bg-[#1c1c1f]/40"}`,children:[e&&(0,t.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:d.STATUS_DOT_HEX[e]||"#6b7280"}}),(0,t.jsx)("span",{children:e||"All"}),(0,t.jsx)("span",{className:`text-[10px] tabular-nums ${r?"opacity-80":"text-gray-600"}`,children:a})]},e||"all")})})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded border border-[#26262b] bg-[#161618] px-2 py-1 focus-within:border-blue-500/40",children:[(0,t.jsx)("span",{className:"text-[9px] uppercase tracking-wide text-gray-600",children:"From"}),(0,t.jsx)("input",{type:"text",value:S,onChange:e=>_(e.target.value),placeholder:"any",className:"w-16 bg-transparent text-xs text-white placeholder-gray-700 focus:outline-none"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded border border-[#26262b] bg-[#161618] px-2 py-1 focus-within:border-blue-500/40",children:[(0,t.jsx)("span",{className:"text-[9px] uppercase tracking-wide text-gray-600",children:"To"}),(0,t.jsx)("input",{type:"text",value:C,onChange:e=>T(e.target.value),placeholder:"any",className:"w-16 bg-transparent text-xs text-white placeholder-gray-700 focus:outline-none"})]}),(k||S||C)&&(0,t.jsx)("button",{type:"button",onClick:()=>{N(""),_(""),T("")},className:"rounded border border-gray-700 px-2 py-0.5 text-[10px] text-gray-500 hover:text-gray-200 hover:border-gray-600",children:"Clear"})]}),!k&&R.length>0&&(0,t.jsx)("div",{className:"flex h-1 rounded-full overflow-hidden bg-gray-800",children:R.map(e=>(0,t.jsx)("div",{className:e.color,style:{width:`${U[e.key]/M*100}%`},title:`${e.key}: ${U[e.key]}`},e.key))})]}),v&&(0,t.jsx)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-3 py-1.5 rounded mt-2 text-xs",children:v})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:f?(0,t.jsx)("div",{className:"animate-pulse space-y-1 px-3 py-2",children:[1,2,3,4,5,6,7,8].map(e=>(0,t.jsx)("div",{className:"h-14 bg-gray-800/40 rounded"},e))}):0===c.length?(0,t.jsx)("div",{className:"px-3 py-6",children:(0,t.jsx)(n.EmptyState,{variant:"tasks",sub:k||S||C?"No tasks match the current filters. Try clearing them.":"Tasks will appear here when agents send them via CommHub."})}):(0,t.jsx)(o,{tasks:c,selectedId:A,onSelect:e=>{$(e);try{window.history.pushState({},"",`/tasks/${encodeURIComponent(e)}`)}catch{}}})})]}),A&&E&&(0,t.jsx)("section",{"data-testid":"task-detail-column",className:"flex-1 min-w-0 min-h-screen",children:(0,t.jsx)(m,{taskId:A,onClose:I,onRetried:L})}),A&&!E&&(0,t.jsx)("section",{"data-testid":"task-detail-mobile",className:"fixed inset-0 z-40 bg-[#0b0b0d]",children:(0,t.jsx)(m,{taskId:A,onClose:I,onRetried:L})}),!A&&E&&(0,t.jsx)("section",{"data-testid":"task-detail-empty",className:"flex-1 min-w-0 min-h-screen flex items-center justify-center text-sm text-gray-600",children:"请从左侧列表选择一条任务查看详情"})]})}e.s(["TasksView",0,function({initialSelectedId:e=null}){return(0,t.jsx)(a.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:(0,t.jsx)("div",{className:"lg:ml-0 ml-10 text-gray-500 text-sm",children:"Loading tasks…"})}),children:(0,t.jsx)(p,{initialSelectedId:e})})},"decodeIdSegment",0,y],15445)},64093,e=>{"use strict";var t=e.i(90724),a=e.i(87854),r=e.i(15445);e.s(["default",0,function({params:e}){let{id:s}=(0,a.use)(e);return(0,t.jsx)(r.TasksView,{initialSelectedId:(0,r.decodeIdSegment)(s)})}])}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,45840,e=>{"use strict";var t=e.i(90724),s=e.i(87854);let n=new Set(["png","jpg","jpeg","gif","webp","mp4","webm","mov"]),a=new Set(["image/png","image/jpeg","image/gif","image/webp"]),r=new Set(["video/mp4","video/webm"]),l=/^[A-Za-z0-9_-]{8,64}$/;async function i(e){let t=await fetch(`/api/hub/files/${encodeURIComponent(e)}`,{credentials:"include"});if(!t.ok)throw Error(`HTTP ${t.status}`);let s=t.headers.get("x-verified-type"),n=s&&(a.has(s)||r.has(s))?s:null,l=await t.blob(),i=n?new Blob([l],{type:n}):l;return{blobUrl:URL.createObjectURL(i),verifiedType:n,blob:i}}function d(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}function o({fileId:e,name:n,size:r,onNotInlineable:l}){let d="number"==typeof r&&r<=5242880,[c,u]=(0,s.useState)(null),[x,m]=(0,s.useState)(!1),[h,p]=(0,s.useState)(!1),b=(0,s.useRef)(l);b.current=l;let f=(0,s.useCallback)(async()=>{if(!x&&!c){m(!0);try{let{blobUrl:t,verifiedType:s}=await i(e);if(!s||!a.has(s)){URL.revokeObjectURL(t),b.current();return}u(t)}catch{p(!0)}finally{m(!1)}}},[e,x,c]);return((0,s.useEffect)(()=>{d&&f()},[d,f]),(0,s.useEffect)(()=>{if(c)return()=>URL.revokeObjectURL(c)},[c]),h)?(0,t.jsx)("div",{className:"mt-2 rounded-lg border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-sm text-amber-200",children:"图片加载失败 · 请点击下方下载按钮查看"}):c?(0,t.jsx)("div",{className:"mt-2 overflow-hidden rounded-lg border border-white/10 bg-black/20",children:(0,t.jsx)("img",{src:c,alt:n,className:"block max-h-[50vh] w-auto max-w-full cursor-zoom-in object-contain",onClick:()=>window.open(c,"_blank","noopener")})}):(0,t.jsxs)("button",{type:"button",onClick:f,disabled:x,className:"mt-2 flex w-full items-center gap-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 px-3 py-2 text-left text-sm text-cyan-100 transition hover:border-cyan-400/40 hover:bg-cyan-500/10 disabled:cursor-wait disabled:opacity-60",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-lg",children:"🖼️"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-cyan-300",children:x?"加载中…":"点击查看"})]})}function c({fileId:e,name:n,onNotInlineable:a}){let[l,d]=(0,s.useState)(null),[o,u]=(0,s.useState)(!1),[x,m]=(0,s.useState)(!1),h=(0,s.useRef)(a);h.current=a;let p=(0,s.useCallback)(async()=>{if(!o&&!l){u(!0);try{let{blobUrl:t,verifiedType:s}=await i(e);if(!s||!r.has(s)){URL.revokeObjectURL(t),h.current();return}d(t)}catch{m(!0)}finally{u(!1)}}},[e,o,l]);return((0,s.useEffect)(()=>{if(l)return()=>URL.revokeObjectURL(l)},[l]),x)?(0,t.jsx)("div",{className:"mt-2 rounded-lg border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-sm text-amber-200",children:"视频加载失败 · 请点击下方下载按钮查看"}):l?(0,t.jsx)("div",{className:"mt-2 overflow-hidden rounded-lg border border-white/10 bg-black/20",children:(0,t.jsx)("video",{src:l,controls:!0,autoPlay:!0,className:"block max-h-[50vh] w-full",children:"您的浏览器不支持内联视频播放,请下载后查看。"})}):(0,t.jsxs)("button",{type:"button",onClick:p,disabled:o,className:"mt-2 flex w-full items-center gap-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 px-3 py-2 text-left text-sm text-cyan-100 transition hover:border-cyan-400/40 hover:bg-cyan-500/10 disabled:cursor-wait disabled:opacity-60",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-lg",children:"🎬"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-cyan-300",children:o?"加载中…":"▶ 播放"})]})}e.s(["AttachmentBlock",0,function({attachment:e}){var i,u;let x,m,[h,p]=(0,s.useState)(!1),[b,f]=(0,s.useState)(null),[y,g]=(0,s.useState)(!1),j=function(e){if("string"!=typeof e||0===e.length)return"file";let t=e.replace(/[/\\]/g,"_").replace(/[\r\n\t\0]/g,"_");for(;t.startsWith(".");)t=t.slice(1);return t.length>200&&(t=t.slice(0,200)),t||"file"}(e.name),v="string"!=typeof(i=e.mime)?"":i.replace(/[^a-zA-Z0-9./+-]/g,"").slice(0,100),w="number"!=typeof(u=e.size)||!Number.isFinite(u)||u<0?"":u<1024?`${u} B`:u<1048576?`${(u/1024).toFixed(1)} KB`:u<0x40000000?`${(u/1024/1024).toFixed(1)} MB`:`${(u/1024/1024/1024).toFixed(2)} GB`,N=(x=(v||"").toLowerCase(),m=(j.split(".").pop()||"").toLowerCase(),x.startsWith("image/")?"🖼️":x.startsWith("video/")?"🎬":x.startsWith("audio/")?"🎵":x.includes("pdf")||"pdf"===m?"📄":["ppt","pptx"].includes(m)?"📊":["doc","docx"].includes(m)?"📝":["xls","xlsx","csv"].includes(m)?"📈":["zip","tar","gz","rar","7z"].includes(m)?"📦":"📎"),k="string"==typeof e.file_id&&l.test(e.file_id),C=k&&!y&&function(e,t){if(a.has(t)||r.has(t))return!0;let s=d(e);return""!==s&&n.has(s)}(j,v),_=d(j),S=C?r.has(v)||["mp4","webm","mov"].includes(_)?"video":"image":null;async function E(){if(!k||!e.file_id)return;f(null),p(!0);let t=null;try{let s=await fetch(`/api/hub/files/${encodeURIComponent(e.file_id)}`,{credentials:"include"});if(!s.ok)throw Error(`HTTP ${s.status}`);let n=await s.blob();t=URL.createObjectURL(n);let a=document.createElement("a");a.href=t,a.download=j,a.rel="noopener",document.body.appendChild(a),a.click(),document.body.removeChild(a)}catch(e){f(e instanceof Error?e.message:String(e))}finally{t&&URL.revokeObjectURL(t),p(!1)}}return k?(0,t.jsxs)("div",{className:"mt-2 flex flex-col",children:["image"===S&&e.file_id&&(0,t.jsx)(o,{fileId:e.file_id,name:j,size:"number"==typeof e.size?e.size:void 0,onNotInlineable:()=>g(!0)}),"video"===S&&e.file_id&&(0,t.jsx)(c,{fileId:e.file_id,name:j,onNotInlineable:()=>g(!0)}),(0,t.jsxs)("button",{type:"button",onClick:E,disabled:h,className:"flex w-full items-center gap-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 px-3 py-2 text-left text-sm text-cyan-100 transition hover:border-cyan-400/40 hover:bg-cyan-500/10 disabled:cursor-wait disabled:opacity-60 mt-2 first:mt-0",title:`Download ${j}`,children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"text-lg",children:N}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:j}),w&&(0,t.jsx)("span",{className:"shrink-0 text-xs text-neutral-400",children:w}),v&&(0,t.jsx)("span",{className:"shrink-0 rounded bg-white/5 px-1.5 py-0.5 text-[10px] text-neutral-400",children:v}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-cyan-300",children:h?"下载中…":b?`⚠ ${b}`:"↓ 下载"})]})]}):(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm text-neutral-300",children:[(0,t.jsx)("span",{"aria-hidden":!0,children:N}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:j}),w&&(0,t.jsx)("span",{className:"shrink-0 text-xs text-neutral-500",children:w}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-neutral-500",title:"Attachment has no file_id — single-host path only. Ask the sender to re-upload.",children:"(host-local)"})]})},"extractAttachments",0,function(e){if(!e||"object"!=typeof e)return[];let t=e.meta;if(!t&&"string"==typeof e.meta_json&&e.meta_json.length>0)try{t=JSON.parse(e.meta_json)}catch{return[]}if(!t||"object"!=typeof t)return[];let s=t.attachments;return Array.isArray(s)?s.filter(e=>!!e&&"object"==typeof e).map(e=>({file_id:"string"==typeof e.file_id?e.file_id:void 0,path:"string"==typeof e.path?e.path:void 0,name:"string"==typeof e.name?e.name:void 0,mime:"string"==typeof e.mime?e.mime:void 0,size:"number"==typeof e.size?e.size:void 0,type:"string"==typeof e.type?e.type:void 0})):[]}])},99825,519,e=>{"use strict";var t=e.i(87854);let s=null,n=!1,a=new Set,r=new Map;function l(e){return a.add(e),()=>void a.delete(e)}e.s(["pinyinMatch",0,function(t,l){let i=l.trim().toLowerCase();if(!i||t.toLowerCase().includes(i))return!0;if(s||n||(n=!0,e.A(83927).then(e=>{s=t=>[e.pinyin(t,{toneType:"none",type:"array"}).join("").toLowerCase(),e.pinyin(t,{pattern:"first",toneType:"none",type:"array"}).join("").toLowerCase()],a.forEach(e=>e())}).catch(()=>{n=!1})),!s)return!1;let d=r.get(t);return d||(d=s(t),r.set(t,d)),d[0].includes(i)||d[1].includes(i)},"usePinyinReady",0,function(){return(0,t.useSyncExternalStore)(l,()=>!!s,()=>!1)}],99825),e.s(["t",0,function(e,t){return"u">typeof navigator&&(navigator.language||"").toLowerCase().startsWith("zh")?e:t}],519)},576,e=>{"use strict";var t=e.i(90724),s=e.i(87854),n=e.i(35644);function a(e){return e.trim().replace(/[-]+/g," ").toLowerCase()}function r({alias:e,nodeId:n,snapshot:l,onClose:i,onSaved:d}){let[o,c]=(0,s.useState)(l.display_name??""),[u,x]=(0,s.useState)(l.team??""),[m,h]=(0,s.useState)(l.tags),[p,b]=(0,s.useState)(""),[f,y]=(0,s.useState)(!1),[g,j]=(0,s.useState)(null),[v,w]=(0,s.useState)(null),[N,k]=(0,s.useState)(null),[C,_]=(0,s.useState)(null),[S,E]=(0,s.useState)(l.attrs_revision),L=(0,s.useRef)(null),$=(0,s.useRef)(!1);(0,s.useEffect)(()=>{E(l.attrs_revision),$.current||(c(l.display_name??""),x(l.team??""),h(l.tags))},[l.attrs_revision,l.display_name,l.team,l.tags]),(0,s.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopPropagation(),i())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[i]);let R=()=>{$.current=!0},U=()=>{let e=p.trim();if(!e)return;if(e.length>64)return void j("标签不能超过 64 字符");if(m.length>=16)return void j("最多 16 个标签");if(m.includes(e))return void b("");let t=a(e),s=m.find(e=>a(e)===t);s?_(`「${e}」和已有的「${s}」可能会被服务端当作同一个(保存时告诉你结果)`):_(null),h([...m,e]),b(""),j(null),R()},z=async()=>{if(f)return;j(null),w(null),k(null),_(null),y(!0);let e=function(e){let t=[];for(let s of e){if("string"!=typeof s)continue;let e=s.trim();if(0!==e.length&&!(e.length>64)&&(t.push(e),t.length>=16))break}return t}(m);try{let t={base_attrs_revision:S,display_name:o.trim().length>0?o.trim():null,team:u.trim().length>0?u.trim():null,tags:e},s=await fetch(`/api/hub/nodes/${encodeURIComponent(n)}/attrs`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await s.json().catch(()=>({ok:!1,message:`HTTP ${s.status}`}));if(409===s.status){let e="number"==typeof r.current_attrs_revision?r.current_attrs_revision:null;w(e),j(r.message||"编辑冲突");return}if(!s.ok||!r.ok)return void j(r.message||`保存失败 (HTTP ${s.status})`);let l=Array.isArray(r.tags)?r.tags:[],m=function(e,t){let s=new Set(t.map(e=>a(e))),n=[],r=new Map;for(let n of e){let e=a(n);if(!s.has(e))continue;let l=t.find(t=>a(t)===e);if(l&&l!==n){let e=r.get(l)??[];n!==l&&e.push(n),e.length>0&&r.set(l,e)}}for(let[e,t]of r)t.length>0&&n.push(`「${t.join("」、「")}」已合并到「${e}」`);let l=new Set(e.map(e=>a(e))),i=e.filter(e=>{let t=a(e);return!s.has(t)&&l.has(t)});return i.length>0&&n.push(`「${i.join("」、「")}」被清理(含控制字符或格式不合规)`),n}(e,l);h(l),("string"==typeof r.display_name||null===r.display_name)&&c(r.display_name??""),("string"==typeof r.team||null===r.team)&&x(r.team??""),"number"==typeof r.attrs_revision&&E(r.attrs_revision),$.current=!1,d(),m.length>0?k(m):i()}catch(e){j(e instanceof Error?e.message:String(e))}finally{y(!1)}};return(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:i,children:(0,t.jsxs)("div",{ref:L,role:"dialog","aria-label":`编辑节点 ${e} 属性`,"aria-modal":"true",className:"w-full max-w-md rounded-lg border border-[#26262b] bg-[#161618] p-4 shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-semibold text-white",children:"编辑属性"}),(0,t.jsxs)("p",{className:"mt-0.5 truncate text-xs text-gray-500",children:["节点:",(0,t.jsx)("span",{className:"text-gray-300",children:e}),(0,t.jsx)("span",{className:"mx-1.5 text-gray-700",children:"·"}),"修订版本:",(0,t.jsx)("span",{className:"text-gray-300",children:S})]})]}),(0,t.jsx)("button",{type:"button",onClick:i,"aria-label":"关闭",className:"shrink-0 rounded-md p-1 text-gray-500 hover:bg-white/5 hover:text-white",children:"×"})]}),(0,t.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"显示名 · display_name"}),(0,t.jsx)("input",{type:"text",value:o,onChange:e=>{c(e.target.value),R(),j(null)},maxLength:120,placeholder:"留空以清除",className:"mt-1 w-full rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,t.jsxs)("span",{className:"mt-1 block text-[10px] text-gray-500",children:["仅用于显示,不影响别人 @ 你的路由名(alias 保持 ",(0,t.jsx)("code",{className:"text-gray-400",children:e}),")"]})]}),(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"团队 · team"}),(0,t.jsx)("input",{type:"text",value:u,onChange:e=>{x(e.target.value),R(),j(null)},maxLength:120,placeholder:"如:Comm / 商务组 / Bots",className:"mt-1 w-full rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:["标签 · tags(最多 ",16," 个)"]}),(0,t.jsx)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:m.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-cyan-500/20 bg-cyan-500/5 px-2 py-0.5 text-xs text-cyan-100",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>{h(m.filter(t=>t!==e)),R()},"aria-label":`移除 ${e}`,className:"text-cyan-400/70 hover:text-red-300",children:"×"})]},e))}),(0,t.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:p,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),U())},maxLength:64,placeholder:"新标签(回车添加)",className:"flex-1 rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none",disabled:m.length>=16}),(0,t.jsx)("button",{type:"button",onClick:U,disabled:!p.trim()||m.length>=16,className:"rounded-md border border-cyan-500/30 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-100 hover:bg-cyan-500/20 disabled:cursor-not-allowed disabled:opacity-40",children:"添加"})]}),C&&(0,t.jsx)("div",{className:"mt-1 text-[10px] text-amber-300/80",role:"status",children:C})]})]}),N&&N.length>0&&(0,t.jsxs)("div",{className:"mt-3 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-100",children:[(0,t.jsx)("div",{className:"mb-1 font-semibold",children:"已保存 — 服务端做了这些整理:"}),(0,t.jsx)("ul",{className:"list-disc space-y-0.5 pl-4",children:N.map((e,s)=>(0,t.jsx)("li",{children:e},s))}),(0,t.jsx)("div",{className:"mt-1 text-[10px] text-amber-200/60",children:"以上是服务端的实存结果,已同步到此表单"})]}),g&&(0,t.jsxs)("div",{className:"mt-3 rounded-md border border-red-700/40 bg-red-900/20 px-3 py-2 text-xs text-red-200",children:[g,null!==v&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"text-red-300/70",children:["最新版本:",v]}),(0,t.jsx)("button",{type:"button",onClick:()=>{$.current=!1,d(),w(null),j(null)},className:"ml-auto rounded border border-red-500/40 bg-red-500/10 px-2 py-0.5 text-red-100 hover:bg-red-500/20",children:"重新加载最新值"})]})]}),(0,t.jsxs)("div",{className:"mt-4 flex items-center justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:i,disabled:f,className:"rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-2 text-sm text-gray-300 hover:bg-white/5 disabled:opacity-50",children:"取消"}),(0,t.jsx)("button",{type:"button",onClick:z,disabled:f,className:"rounded-md bg-cyan-600 px-3 py-2 text-sm text-white hover:bg-cyan-500 disabled:cursor-wait disabled:opacity-50",children:f?"保存中…":"保存"})]})]})})}function l(){let{data:e}=(0,n.default)("/api/anet/node-lifecycle",e=>fetch(e).then(e=>e.json()),{revalidateOnFocus:!1,dedupingInterval:6e4,shouldRetryOnError:!1});return e?.ok&&e.tools?e.tools:null}async function i(e,t){try{let s=await fetch("/api/anet/node-lifecycle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,...t})});return{...await s.json().catch(()=>({})),httpStatus:s.status}}catch(e){return{ok:!1,error:"network_error",message:e instanceof Error?e.message:String(e),httpStatus:0}}}function d({alias:e,nodeId:n,networkId:a,onClose:r,onCompleted:l}){let[o,c]=(0,s.useState)(!1),[u,x]=(0,s.useState)(!1),[m,h]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=e=>{"Escape"!==e.key||o||r()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]);let p=m&&"number"==typeof m.in_flight_count?m.in_flight_count:0,b=async()=>{c(!0),h(null);let e=await i("stop",{node_id:n,...a?{network_id:a}:{},...u?{force:!0}:{}});(c(!1),e.ok)?l():h(e)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50",onClick:o?void 0:r,"aria-hidden":!0}),(0,t.jsxs)("div",{role:"dialog","aria-label":`停止节点 ${e}`,className:"fixed left-1/2 top-1/2 z-50 w-[min(92vw,420px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-[#26262b] bg-[#161618] shadow-2xl",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-[#26262b] px-4 py-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-white",children:"停止节点"}),(0,t.jsx)("button",{onClick:o?void 0:r,"aria-label":"关闭",className:"text-gray-500 hover:text-white",children:"×"})]}),(0,t.jsxs)("div",{className:"space-y-3 px-4 py-4",children:[(0,t.jsxs)("div",{className:"text-sm text-gray-300",children:["将停止 ",(0,t.jsx)("span",{className:"font-mono text-cyan-300",children:e})," 子进程(SIGTERM,~10s 内)。配置目录保留,可通过「启动」恢复。"]}),m&&!1===m.ok&&(0,t.jsxs)("div",{className:"rounded-md border border-red-700/40 bg-red-900/20 px-3 py-2 text-xs text-red-200",children:[(0,t.jsx)("div",{className:"font-semibold",children:m.error}),m.message?(0,t.jsx)("div",{className:"mt-0.5 text-red-300/80",children:m.message}):null,"number"==typeof m.in_flight_count&&(0,t.jsxs)("div",{className:"mt-0.5 text-red-300/80",children:["当前 in-flight 任务: ",m.in_flight_count]}),m.hint?(0,t.jsx)("div",{className:"mt-1 text-red-300/60",children:m.hint}):null]}),(p>0||u)&&(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-amber-700/40 bg-amber-900/10 px-3 py-2 text-xs text-amber-200",children:[(0,t.jsx)("input",{type:"checkbox",checked:u,onChange:e=>x(e.target.checked),className:"mt-0.5"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-semibold text-amber-300",children:"强制停止"}),p>0?`(会丢弃 ${p} 条待处理任务)`:"(覆盖 in-flight 拒绝;hub 会写 audit 行)"]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-[#26262b] px-4 py-3",children:[(0,t.jsx)("button",{type:"button",disabled:o,onClick:r,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 hover:text-gray-200 disabled:opacity-50",children:"取消"}),(0,t.jsx)("button",{type:"button",disabled:o||p>0&&!u,onClick:b,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:opacity-50",children:o?"停止中…":"确认停止"})]})]})]})}function o({alias:e,nodeId:n,networkId:a,onClose:r,onCompleted:l}){let[d,c]=(0,s.useState)(!1),[u,x]=(0,s.useState)(""),[m,h]=(0,s.useState)(!1),[p,b]=(0,s.useState)(!1),[f,y]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=e=>{"Escape"!==e.key||d||r()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,d]);let g=f&&"number"==typeof f.in_flight_count?f.in_flight_count:0,j=u===e,v=async()=>{if(!j)return;c(!0),y(null);let e=await i("delete",{node_id:n,confirm_alias:u,...a?{network_id:a}:{},...m?{force:!0}:{},...p?{delete_config:!1}:{}});(c(!1),e.ok)?l():y(e)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50",onClick:d?void 0:r,"aria-hidden":!0}),(0,t.jsxs)("div",{role:"dialog","aria-label":`删除节点 ${e}`,className:"fixed left-1/2 top-1/2 z-50 w-[min(94vw,480px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-red-700/40 bg-[#161618] shadow-2xl",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-[#26262b] px-4 py-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-red-300",children:"删除节点"}),(0,t.jsx)("button",{onClick:d?void 0:r,"aria-label":"关闭",className:"text-gray-500 hover:text-white",children:"×"})]}),(0,t.jsxs)("div",{className:"space-y-3 px-4 py-4 text-sm text-gray-300",children:[(0,t.jsx)("div",{children:"这将:"}),(0,t.jsxs)("ul",{className:"list-inside list-disc space-y-1 pl-2 text-xs text-gray-400",children:[(0,t.jsxs)("li",{children:["停止 ",(0,t.jsx)("span",{className:"font-mono text-cyan-300",children:e})," 子进程(SIGTERM ~10s)"]}),(0,t.jsx)("li",{children:"从 hub 注销该节点"}),(0,t.jsx)("li",{children:"撤销该节点的 ntok"}),!p&&(0,t.jsxs)("li",{children:["配置文件备份到 ",(0,t.jsxs)("code",{className:"text-amber-300",children:["~/.anet/deleted/<ts>-",e,"/"]}),"(30 天后自动清除)"]}),p&&(0,t.jsx)("li",{className:"text-amber-300",children:"配置文件保留原地(不备份不清理 — 你勾选了「保留配置」)"})]}),f&&!1===f.ok&&(0,t.jsxs)("div",{className:"rounded-md border border-red-700/40 bg-red-900/20 px-3 py-2 text-xs text-red-200",children:[(0,t.jsx)("div",{className:"font-semibold",children:f.error}),f.message?(0,t.jsx)("div",{className:"mt-0.5 text-red-300/80",children:f.message}):null,"number"==typeof f.in_flight_count&&(0,t.jsxs)("div",{className:"mt-0.5 text-red-300/80",children:["当前 in-flight 任务: ",f.in_flight_count]}),f.hint?(0,t.jsx)("div",{className:"mt-1 text-red-300/60",children:f.hint}):null]}),(g>0||m)&&(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-amber-700/40 bg-amber-900/10 px-3 py-2 text-xs text-amber-200",children:[(0,t.jsx)("input",{type:"checkbox",checked:m,onChange:e=>h(e.target.checked),className:"mt-0.5"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-semibold text-amber-300",children:"强制删除"}),g>0?`(会丢弃 ${g} 条待处理任务)`:"(覆盖 in-flight 拒绝)"]})]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-xs text-gray-400",children:[(0,t.jsx)("input",{type:"checkbox",checked:p,onChange:e=>b(e.target.checked)}),"保留配置目录(不备份;高级用法)"]}),(0,t.jsxs)("label",{className:"block space-y-1",children:[(0,t.jsxs)("span",{className:"text-xs text-gray-400",children:["输入节点名字 ",(0,t.jsx)("span",{className:"font-mono text-cyan-300",children:e})," 确认"]}),(0,t.jsx)("input",{autoFocus:!0,value:u,onChange:e=>x(e.target.value),placeholder:e,className:"w-full rounded-md border border-[#26262b] bg-[#0e0e10] px-3 py-2 text-sm text-gray-200 focus:border-red-500 focus:outline-none",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),u&&!j&&(0,t.jsx)("span",{className:"text-[11px] text-red-400",children:"名字不匹配(区分大小写)"})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-[#26262b] px-4 py-3",children:[(0,t.jsx)("button",{type:"button",disabled:d,onClick:r,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 hover:text-gray-200 disabled:opacity-50",children:"取消"}),(0,t.jsx)("button",{type:"button",disabled:d||!j||g>0&&!m,onClick:v,className:"rounded-md bg-red-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-red-500 disabled:cursor-not-allowed disabled:opacity-50",children:d?"删除中…":`删除 ${e}`})]})]})]})}e.s(["NodeLifecycleMenu",0,function({nodeId:e,alias:n,lifecycleState:a,networkId:c,onCompleted:u,attrsSnapshot:x}){let m=l(),[h,p]=(0,s.useState)(!1),[b,f]=(0,s.useState)(!1),[y,g]=(0,s.useState)(!1),[j,v]=(0,s.useState)(!1),[w,N]=(0,s.useState)(!1),[k,C]=(0,s.useState)(null),_=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!h)return;let e=e=>{_.current&&!_.current.contains(e.target)&&p(!1)},t=e=>{"Escape"===e.key&&p(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[h]);let S=(0,s.useCallback)(async()=>{p(!1),C(null),N(!0);let t=await i("restart",{node_id:e,...c?{network_id:c}:{}});(N(!1),t.ok)?u?.():C(t)},[e,c,u]),E="string"==typeof a&&a.length>0?a:"active",L=[];return"stopping"===E||"deleting"===E?L.push({label:"stopping"===E?"停止中…":"删除中…",key:"loading",disabled:!0,onClick:()=>{}}):"active"===E?(L.push({label:w?"重启中…":"重启节点",key:"restart",disabled:w,onClick:S}),x&&L.push({label:"编辑属性",key:"edit-attrs",onClick:()=>{p(!1),v(!0)}}),(null===m||m.stop)&&L.push({label:"停止节点",key:"stop",onClick:()=>{p(!1),f(!0)}}),(null===m||m.delete)&&L.push({label:"删除节点",key:"delete",danger:!0,onClick:()=>{p(!1),g(!0)}})):"stopped"===E||"stop_failed"===E?(L.push({label:w?"启动中…":"启动节点",key:"restart",disabled:w,onClick:S}),x&&L.push({label:"编辑属性",key:"edit-attrs",onClick:()=>{p(!1),v(!0)}}),L.push({label:"删除节点",key:"delete",danger:!0,onClick:()=>{p(!1),g(!0)}})):L.push({label:`状态 ${E} (不识别)`,key:"unknown",disabled:!0,onClick:()=>{}}),(0,t.jsxs)("div",{ref:_,className:"relative inline-block",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("button",{type:"button","aria-label":`节点 ${n} 生命周期操作`,"aria-haspopup":"menu","aria-expanded":h,onClick:()=>p(e=>!e),className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-gray-400 hover:bg-white/5 hover:text-white focus:outline-none focus:ring-1 focus:ring-cyan-500/50",children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[(0,t.jsx)("circle",{cx:"12",cy:"5",r:"1.6"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"1.6"}),(0,t.jsx)("circle",{cx:"12",cy:"19",r:"1.6"})]})}),h&&(0,t.jsx)("div",{role:"menu",className:"absolute right-0 z-40 mt-1 w-44 overflow-hidden rounded-md border border-[#26262b] bg-[#161618] shadow-xl",children:L.map(e=>(0,t.jsx)("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:e.onClick,className:`block w-full px-3 py-2 text-left text-sm transition-colors ${e.disabled?"text-gray-600 cursor-not-allowed":e.danger?"text-red-300 hover:bg-red-900/20":"text-gray-200 hover:bg-white/5"}`,children:e.label},e.key))}),k&&!1===k.ok&&!b&&!y&&(0,t.jsx)("div",{className:"absolute right-0 z-40 mt-1 w-72 rounded-md border border-red-700/40 bg-red-900/20 px-3 py-2 text-xs text-red-200",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"font-semibold",children:k.error||"error"}),k.message?(0,t.jsx)("div",{className:"mt-0.5 text-red-300/80",children:k.message}):null,"number"==typeof k.in_flight_count&&(0,t.jsxs)("div",{className:"mt-0.5 text-red-300/80",children:["in-flight: ",k.in_flight_count]}),k.hint?(0,t.jsx)("div",{className:"mt-1 text-red-300/60",children:k.hint}):null]}),(0,t.jsx)("button",{type:"button",onClick:()=>C(null),className:"shrink-0 text-red-400 hover:text-red-200","aria-label":"关闭",children:"×"})]})}),b&&(0,t.jsx)(d,{alias:n,nodeId:e,networkId:c,onClose:()=>f(!1),onCompleted:()=>{f(!1),u?.()}}),y&&(0,t.jsx)(o,{alias:n,nodeId:e,networkId:c,onClose:()=>g(!1),onCompleted:()=>{g(!1),u?.()}}),j&&x&&(0,t.jsx)(r,{alias:n,nodeId:e,snapshot:x,onClose:()=>v(!1),onSaved:()=>{u?.()}})]})},"useLifecycleCaps",0,l],576)},25371,e=>{"use strict";var t=e.i(87854);let s="anet_chat_pin_v1",n="anet-chat-pin-updated";function a(){try{let e=JSON.parse(window.localStorage.getItem(s)||"[]");return new Set(Array.isArray(e)?e:[])}catch{return new Set}}function r(e){return!!e&&a().has(e)}let l=0;function i(e){let t=()=>{l++,e()};return window.addEventListener(n,t),window.addEventListener("storage",t),()=>{window.removeEventListener(n,t),window.removeEventListener("storage",t)}}e.s(["isPinned",0,r,"togglePin",0,function(e){if(e)try{let t=a();t.has(e)?t.delete(e):t.add(e),window.localStorage.setItem(s,JSON.stringify([...t])),window.dispatchEvent(new Event(n))}catch{}},"usePinVersion",0,function(){return(0,t.useSyncExternalStore)(i,()=>l,()=>0)},"usePinned",0,function(e){return(0,t.useSyncExternalStore)(i,()=>!!e&&r(e),()=>!1)}])}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,22752,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.6.3-preview.49"],22752)},36171,e=>{"use strict";var s=e.i(90724),a=e.i(87854),r=e.i(60449),t=e.i(74069),n=e.i(70563),l=e.i(22752);e.s(["default",0,function(){let{config:e}=(0,t.useAnetConfig)(),{health:c,error:o}=(0,t.useHealth)(),[i,d]=(0,a.useState)(()=>{try{return localStorage.getItem("anet-theme")||"cyber"}catch{return"cyber"}}),[x,m]=(0,a.useState)(""),[h,b]=(0,a.useState)(""),[g,p]=(0,a.useState)(""),u="flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",N="break-all sm:max-w-[320px] sm:text-right";return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white mb-3 lg:ml-0 ml-10",children:"Settings"}),(0,s.jsx)("nav",{className:"mb-4 sm:mb-8 flex flex-wrap gap-2 text-xs",children:[{href:"#appearance",label:"Appearance"},{href:"#connection",label:"Connection"},{href:"#account",label:"Account"},{href:"#resources",label:"Resources"}].map(e=>(0,s.jsx)("a",{href:e.href,className:"inline-flex min-h-[44px] items-center rounded-md border border-[#26262b] bg-[#0e0e10]/60 px-3 py-2 text-gray-400 hover:border-cyan-500/50 hover:text-cyan-300 hover:bg-cyan-500/10 transition-colors",children:e.label},e.href))}),(0,s.jsxs)("div",{className:"max-w-2xl space-y-10",children:[(0,s.jsxs)("div",{id:"appearance",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Appearance"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Theme"}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-3",children:[{id:"cyber",label:"Dark",swatch:"#0b0b0d"},{id:"light",label:"Light",swatch:"#f6f7f9"},{id:"slack",label:"Slack",swatch:"#3f0e40"}].map(e=>(0,s.jsxs)("button",{onClick:()=>{try{localStorage.setItem("anet-theme",e.id)}catch{}(0,n.applyTheme)(e.id),d(e.id)},"aria-pressed":i===e.id,className:`flex items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors ${i===e.id?"border-cyan-500/60 bg-cyan-500/10 text-gray-100":"border-[#26262b] text-gray-400 hover:border-[#3a3a41]"}`,children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block w-5 h-5 rounded-full border border-black/20 shrink-0",style:{backgroundColor:e.swatch}}),e.label,i===e.id&&(0,s.jsx)("svg",{"aria-hidden":!0,className:"ml-auto w-4 h-4 text-cyan-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("path",{d:"M20 6 9 17l-5-5"})})]},e.id))})]})]}),(0,s.jsxs)("div",{id:"connection",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Connection"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"CommHub Connection"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500 shrink-0",children:"Hub URL"}),(0,s.jsx)("span",{className:`text-cyan-300 ${N}`,children:e?.hub||"not configured"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Config Source"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:e?.source==="file"?"Local file (~/.anet/config.json)":e?.source==="runtime-env"?"Vercel env vars":"Missing"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Auth Token"}),(0,s.jsx)("span",{className:`${e?.tokenConfigured?"text-green-400":"text-red-400"} ${N}`,children:e?.tokenConfigured?`Configured (${e.tokenPreview})`:"Not configured"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Server Auth"}),(0,s.jsx)("span",{className:`${c?.auth==="enabled"?"text-green-400":"text-yellow-400"} sm:text-right`,children:c?.auth||"--"})]}),e?.error&&(0,s.jsx)("div",{className:"border-t border-[#26262b] pt-3 text-xs text-gray-500",children:e.error}),(o||c?.ok===!1)&&(0,s.jsxs)("div",{className:"border-t border-red-500/20 pt-3 text-xs space-y-1.5",role:"alert",children:[(0,s.jsx)("div",{className:"text-red-300 font-medium",children:"CommHub unreachable — how to recover:"}),(0,s.jsxs)("div",{className:"text-gray-400",children:["1. Check the hub process on the server: ",(0,s.jsx)("code",{className:"font-mono bg-[#0e0e10] border border-[#1c1c1f] rounded px-1.5 py-0.5",children:"anet hub status"})]}),(0,s.jsxs)("div",{className:"text-gray-400",children:["2. Start it if stopped: ",(0,s.jsx)("code",{className:"font-mono bg-[#0e0e10] border border-[#1c1c1f] rounded px-1.5 py-0.5",children:"anet hub start"})]}),(0,s.jsx)("div",{className:"text-gray-400",children:"3. Confirm the Hub URL above matches where the hub actually listens."})]})]})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Info"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.version||"--"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Sessions"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.sessions??"--"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsxs)("span",{className:"text-gray-500",children:["SSE streams ",(0,s.jsx)("span",{className:"text-gray-600",children:"· server"})]}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.sse_connections??"--"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Uptime"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.uptime?`${Math.floor(c.uptime/3600)}h ${Math.floor(c.uptime%3600/60)}m`:"--"})]})]})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Dashboard"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 font-mono ${N}`,title:"From package.json @sleep2agi/agent-network-dashboard",children:l.DASHBOARD_VERSION})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Data Layer"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:"SWR (5s refresh, 3s dedup)"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Pages"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:"Overview, Tasks, Nodes, Messages, Networks, Audit, Server Logs, Admin, Settings"})]})]})]})]}),(0,s.jsxs)("div",{id:"account",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Account"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Change Password"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("input",{type:"password",value:x,onChange:e=>m(e.target.value),placeholder:"Current password",className:"w-full bg-[#0e0e10] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("input",{type:"password",value:h,onChange:e=>b(e.target.value),placeholder:"New password",className:"w-full bg-[#0e0e10] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!x||!h)return;let e=sessionStorage.getItem("anet_v3_auth");if(!e)return void p("Not logged in with V3 auth");let{token:s}=JSON.parse(e),a=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"change_password",token:s,current_password:x,new_password:h})}),r=await a.json();if(p(r.ok?"Password changed":`Failed: ${r.error}`),r.ok){if(r.token){let s=JSON.parse(e);sessionStorage.setItem("anet_v3_auth",JSON.stringify({...s,token:r.token}))}m(""),b("")}setTimeout(()=>p(""),5e3)},disabled:!x||!h,className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Change Password"})]}),g&&(0,s.jsx)("div",{className:`mt-2 text-xs ${g.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:g})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Sign out"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Signing out clears your dashboard session cookie. You'll return to the login page."}),(0,s.jsx)("button",{onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login")},className:"px-4 py-2 bg-transparent hover:bg-[#1c1c1f] text-gray-300 text-sm rounded-lg border border-[#26262b] hover:border-[#3a3a41] transition-colors",children:"Sign out"})]})]}),(0,s.jsxs)("div",{id:"resources",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Resources"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)(r.default,{href:"/settings/tokens",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"API Tokens"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create and manage tokens for CLI access."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(r.default,{href:"/settings/networks",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Networks"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create, manage, and delete agent networks."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(r.default,{href:"/settings/providers",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Model Providers"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Configure model providers and per-server reachability."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(r.default,{href:"/messages",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Messages"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Global timeline of CommHub messages across all agents."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Open →"})]}),(0,s.jsxs)(r.default,{href:"/logs",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Audit Log"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Authentication, token rotations, and admin actions."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Open →"})]}),(0,s.jsxs)(r.default,{href:"/server-logs",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Server Logs"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Live stdout / stderr from the CommHub server."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Open →"})]})]})]})]})]})}])}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,22752,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.6.3-preview.50"],22752)},36171,e=>{"use strict";var s=e.i(90724),a=e.i(87854),r=e.i(60449),t=e.i(74069),n=e.i(70563),l=e.i(22752);e.s(["default",0,function(){let{config:e}=(0,t.useAnetConfig)(),{health:c,error:o}=(0,t.useHealth)(),[i,d]=(0,a.useState)(()=>{try{return localStorage.getItem("anet-theme")||"cyber"}catch{return"cyber"}}),[x,m]=(0,a.useState)(""),[h,b]=(0,a.useState)(""),[g,p]=(0,a.useState)(""),u="flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",N="break-all sm:max-w-[320px] sm:text-right";return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 p-4 sm:p-6",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white mb-3 lg:ml-0 ml-10",children:"Settings"}),(0,s.jsx)("nav",{className:"mb-4 sm:mb-8 flex flex-wrap gap-2 text-xs",children:[{href:"#appearance",label:"Appearance"},{href:"#connection",label:"Connection"},{href:"#account",label:"Account"},{href:"#resources",label:"Resources"}].map(e=>(0,s.jsx)("a",{href:e.href,className:"inline-flex min-h-[44px] items-center rounded-md border border-[#26262b] bg-[#0e0e10]/60 px-3 py-2 text-gray-400 hover:border-cyan-500/50 hover:text-cyan-300 hover:bg-cyan-500/10 transition-colors",children:e.label},e.href))}),(0,s.jsxs)("div",{className:"max-w-2xl space-y-10",children:[(0,s.jsxs)("div",{id:"appearance",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Appearance"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Theme"}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-3",children:[{id:"cyber",label:"Dark",swatch:"#0b0b0d"},{id:"light",label:"Light",swatch:"#f6f7f9"},{id:"slack",label:"Slack",swatch:"#3f0e40"}].map(e=>(0,s.jsxs)("button",{onClick:()=>{try{localStorage.setItem("anet-theme",e.id)}catch{}(0,n.applyTheme)(e.id),d(e.id)},"aria-pressed":i===e.id,className:`flex items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors ${i===e.id?"border-cyan-500/60 bg-cyan-500/10 text-gray-100":"border-[#26262b] text-gray-400 hover:border-[#3a3a41]"}`,children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block w-5 h-5 rounded-full border border-black/20 shrink-0",style:{backgroundColor:e.swatch}}),e.label,i===e.id&&(0,s.jsx)("svg",{"aria-hidden":!0,className:"ml-auto w-4 h-4 text-cyan-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("path",{d:"M20 6 9 17l-5-5"})})]},e.id))})]})]}),(0,s.jsxs)("div",{id:"connection",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Connection"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"CommHub Connection"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500 shrink-0",children:"Hub URL"}),(0,s.jsx)("span",{className:`text-cyan-300 ${N}`,children:e?.hub||"not configured"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Config Source"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:e?.source==="file"?"Local file (~/.anet/config.json)":e?.source==="runtime-env"?"Vercel env vars":"Missing"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Auth Token"}),(0,s.jsx)("span",{className:`${e?.tokenConfigured?"text-green-400":"text-red-400"} ${N}`,children:e?.tokenConfigured?`Configured (${e.tokenPreview})`:"Not configured"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Server Auth"}),(0,s.jsx)("span",{className:`${c?.auth==="enabled"?"text-green-400":"text-yellow-400"} sm:text-right`,children:c?.auth||"--"})]}),e?.error&&(0,s.jsx)("div",{className:"border-t border-[#26262b] pt-3 text-xs text-gray-500",children:e.error}),(o||c?.ok===!1)&&(0,s.jsxs)("div",{className:"border-t border-red-500/20 pt-3 text-xs space-y-1.5",role:"alert",children:[(0,s.jsx)("div",{className:"text-red-300 font-medium",children:"CommHub unreachable — how to recover:"}),(0,s.jsxs)("div",{className:"text-gray-400",children:["1. Check the hub process on the server: ",(0,s.jsx)("code",{className:"font-mono bg-[#0e0e10] border border-[#1c1c1f] rounded px-1.5 py-0.5",children:"anet hub status"})]}),(0,s.jsxs)("div",{className:"text-gray-400",children:["2. Start it if stopped: ",(0,s.jsx)("code",{className:"font-mono bg-[#0e0e10] border border-[#1c1c1f] rounded px-1.5 py-0.5",children:"anet hub start"})]}),(0,s.jsx)("div",{className:"text-gray-400",children:"3. Confirm the Hub URL above matches where the hub actually listens."})]})]})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Info"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.version||"--"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Sessions"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.sessions??"--"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsxs)("span",{className:"text-gray-500",children:["SSE streams ",(0,s.jsx)("span",{className:"text-gray-600",children:"· server"})]}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.sse_connections??"--"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Uptime"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:c?.uptime?`${Math.floor(c.uptime/3600)}h ${Math.floor(c.uptime%3600/60)}m`:"--"})]})]})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Dashboard"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 font-mono ${N}`,title:"From package.json @sleep2agi/agent-network-dashboard",children:l.DASHBOARD_VERSION})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Data Layer"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:"SWR (5s refresh, 3s dedup)"})]}),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Pages"}),(0,s.jsx)("span",{className:`text-gray-300 ${N}`,children:"Overview, Tasks, Nodes, Messages, Networks, Audit, Server Logs, Admin, Settings"})]})]})]})]}),(0,s.jsxs)("div",{id:"account",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Account"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Change Password"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("input",{type:"password",value:x,onChange:e=>m(e.target.value),placeholder:"Current password",className:"w-full bg-[#0e0e10] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("input",{type:"password",value:h,onChange:e=>b(e.target.value),placeholder:"New password",className:"w-full bg-[#0e0e10] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!x||!h)return;let e=sessionStorage.getItem("anet_v3_auth");if(!e)return void p("Not logged in with V3 auth");let{token:s}=JSON.parse(e),a=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"change_password",token:s,current_password:x,new_password:h})}),r=await a.json();if(p(r.ok?"Password changed":`Failed: ${r.error}`),r.ok){if(r.token){let s=JSON.parse(e);sessionStorage.setItem("anet_v3_auth",JSON.stringify({...s,token:r.token}))}m(""),b("")}setTimeout(()=>p(""),5e3)},disabled:!x||!h,className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Change Password"})]}),g&&(0,s.jsx)("div",{className:`mt-2 text-xs ${g.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:g})]}),(0,s.jsxs)("section",{className:"bg-[#161618] border border-[#26262b] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Sign out"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Signing out clears your dashboard session cookie. You'll return to the login page."}),(0,s.jsx)("button",{onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login")},className:"px-4 py-2 bg-transparent hover:bg-[#1c1c1f] text-gray-300 text-sm rounded-lg border border-[#26262b] hover:border-[#3a3a41] transition-colors",children:"Sign out"})]})]}),(0,s.jsxs)("div",{id:"resources",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Resources"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#26262b]"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)(r.default,{href:"/settings/tokens",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"API Tokens"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create and manage tokens for CLI access."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(r.default,{href:"/settings/networks",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Networks"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create, manage, and delete agent networks."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(r.default,{href:"/settings/providers",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Model Providers"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Configure model providers and per-server reachability."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(r.default,{href:"/messages",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Messages"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Global timeline of CommHub messages across all agents."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Open →"})]}),(0,s.jsxs)(r.default,{href:"/logs",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Audit Log"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Authentication, token rotations, and admin actions."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Open →"})]}),(0,s.jsxs)(r.default,{href:"/server-logs",className:"bg-[#161618] border border-[#26262b] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Server Logs"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Live stdout / stderr from the CommHub server."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Open →"})]})]})]})]})]})}])}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,22752,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.6.3-preview.
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,22752,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.6.3-preview.50"],22752)},10536,e=>{"use strict";var t=e.i(90724),r=e.i(87854),s=e.i(22752);e.s(["default",0,function(){let[e,a]=(0,r.useState)("login"),[n,o]=(0,r.useState)(""),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[x,m]=(0,r.useState)(""),[g,h]=(0,r.useState)(!1),u=async t=>{t.preventDefault(),h(!0),m("");try{let t=await fetch("/api/auth/v3",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,username:n,password:i})}),r=await t.json();if(r.ok){r.token&&sessionStorage.setItem("anet_v3_auth",JSON.stringify({user:r.user,token:r.token,networks:r.networks||[],currentNetwork:r.network_id||r.networks?.[0]?.network_id||""})),window.location.assign("/");return}m(r.error||"Login failed")}catch{m("Connection failed")}h(!1)};return(0,t.jsxs)("main",{className:"min-h-screen bg-[#0b0b0d] text-gray-100 flex items-center justify-center relative overflow-hidden px-4 py-10 sm:py-16",children:[(0,t.jsx)("div",{className:"absolute inset-0 pointer-events-none anet-login-bg","aria-hidden":!0}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[460px] h-[460px] rounded-full bg-cyan-500/[0.045] blur-[110px] pointer-events-none","aria-hidden":!0}),(0,t.jsxs)("div",{className:"relative w-full max-w-sm",children:[(0,t.jsxs)("div",{className:"text-center mb-7",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-4 rounded-2xl bg-[#161618] border border-[#26262b] anet-login-mark",children:(0,t.jsxs)("svg",{className:"w-9 h-9",viewBox:"0 0 32 32","aria-hidden":!0,children:[(0,t.jsx)("circle",{cx:"16",cy:"16",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.25",className:"text-cyan-400 anet-login-mark-ring"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"10",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("line",{x1:"10",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("circle",{cx:"16",cy:"10",r:"3",fill:"currentColor",className:"text-cyan-400 anet-login-mark-node-a"}),(0,t.jsx)("circle",{cx:"10",cy:"20",r:"3",fill:"currentColor",className:"text-green-400 anet-login-mark-node-b"}),(0,t.jsx)("circle",{cx:"22",cy:"20",r:"3",fill:"currentColor",className:"text-violet-400 anet-login-mark-node-c"})]})}),(0,t.jsx)("h1",{className:"text-[22px] sm:text-2xl font-semibold text-white tracking-tight",children:"Agent Network"}),(0,t.jsx)("p",{className:"text-[13px] text-gray-400 mt-1.5 leading-snug",children:"login"===e?(0,t.jsxs)(t.Fragment,{children:["Welcome back · ",(0,t.jsx)("span",{className:"text-gray-500",children:"Tasks · Mesh · Messages"})]}):(0,t.jsxs)(t.Fragment,{children:["Create your account · ",(0,t.jsx)("span",{className:"text-gray-500",children:"Free preview · no credit card"})]})})]}),(0,t.jsx)("div",{className:"flex rounded-lg border border-[#26262b] bg-[#161618] p-1 mb-4",children:["login","register"].map(r=>(0,t.jsx)("button",{type:"button",onClick:()=>{a(r),m("")},className:`flex-1 rounded-md px-3 py-2 text-sm transition-colors ${e===r?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"login"===r?"Sign in":"Register"},r))}),(0,t.jsxs)("form",{onSubmit:u,className:"border border-[#26262b] bg-[#161618]/80 backdrop-blur-sm rounded-xl p-6 shadow-2xl shadow-black/30",children:[(0,t.jsx)("label",{htmlFor:"username",className:"block text-xs text-gray-500 mb-2 uppercase tracking-wider",children:"Username"}),(0,t.jsx)("input",{id:"username",type:"text",value:n,onChange:e=>o(e.target.value),autoFocus:!0,placeholder:"Enter username",className:"w-full bg-[#0e0e10] border border-[#26262b] rounded-lg px-4 py-3 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:ring-1 focus:ring-cyan-500/20 focus:outline-none transition-all mb-4"}),(0,t.jsx)("label",{htmlFor:"password",className:"block text-xs text-gray-500 mb-2 uppercase tracking-wider",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{id:"password",type:c?"text":"password",value:i,onChange:e=>l(e.target.value),placeholder:"Enter password",className:"w-full bg-[#0e0e10] border border-[#26262b] rounded-lg px-4 pr-11 py-3 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:ring-1 focus:ring-cyan-500/20 focus:outline-none transition-all"}),(0,t.jsx)("button",{type:"button",onClick:()=>d(e=>!e),tabIndex:-1,"aria-label":c?"Hide password":"Show password",className:"absolute inset-y-0 right-0 flex items-center justify-center min-w-[44px] px-3 text-gray-600 hover:text-gray-300 transition-colors",children:c?(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,t.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),x&&(0,t.jsx)("div",{className:"mt-3 text-sm text-red-300 bg-red-500/5 border border-red-500/10 rounded-lg px-3 py-2",children:x}),(0,t.jsxs)("button",{type:"submit",disabled:g||!i||!n.trim(),className:"mt-5 w-full flex items-center justify-center gap-2 px-4 py-3 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-lg transition-all shadow-lg shadow-cyan-500/10 hover:shadow-cyan-500/20 disabled:shadow-none",children:[g&&(0,t.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),(0,t.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),(0,t.jsx)("span",{children:g?"login"===e?"Signing in…":"Registering…":"login"===e?"Sign in":"Create account"})]})]}),(0,t.jsxs)("p",{className:"text-center text-[11px] text-gray-700 mt-6",children:["Sleep2AGI · Apache-2.0 · ",(0,t.jsx)("a",{href:"https://anet.sh",className:"hover:text-gray-500 transition-colors",children:"anet.sh"}),(0,t.jsx)("span",{className:"mx-1 text-gray-800",children:"·"}),(0,t.jsxs)("span",{className:"font-mono",title:"@sleep2agi/agent-network-dashboard",children:["v",s.DASHBOARD_VERSION]})]})]})]})}])}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,28024,(e,t,r)=>{"use strict";var n=e.r(87854),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=n.useState,u=n.useEffect,a=n.useLayoutEffect,l=n.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!o(e,r)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=i({inst:{value:r,getSnapshot:t}}),o=n[0].inst,c=n[1];return a(function(){o.value=r,o.getSnapshot=t,s(o)&&c({inst:o})},[e,r,t]),u(function(){return s(o)&&c({inst:o}),e(function(){s(o)&&c({inst:o})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},56785,(e,t,r)=>{"use strict";t.exports=e.r(28024)},35644,55480,e=>{"use strict";var t=e.i(87854),r=e.i(56785);e.s(["ERROR_REVALIDATE_EVENT",0,3,"FOCUS_EVENT",0,0,"MUTATE_EVENT",0,2,"RECONNECT_EVENT",0,1],63984);var n=Object.prototype.hasOwnProperty;let o=new WeakMap,i=()=>{},u=i(),a=Object,l=e=>e===u,s=(e,t)=>({...e,...t}),c={},f={},d="undefined",p=typeof window!=d,g=typeof document!=d,h=p&&"Deno"in window,y=(e,t)=>{let r=o.get(e);return[()=>!l(t)&&e.get(t)||c,n=>{if(!l(t)){let o=e.get(t);t in f||(f[t]=o),r[5](t,s(o,n),o||c)}},r[6],()=>!l(t)&&t in f?f[t]:!l(t)&&e.get(t)||c]},v=!0,[m,b]=p&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[i,i],E={initFocus:e=>(g&&document.addEventListener("visibilitychange",e),m("focus",e),()=>{g&&document.removeEventListener("visibilitychange",e),b("focus",e)}),initReconnect:e=>{let t=()=>{v=!0,e()},r=()=>{v=!1};return m("online",t),m("offline",r),()=>{b("online",t),b("offline",r)}}},w=!t.default.useId,_=!p||h,O=_?t.useEffect:t.useLayoutEffect,S="u">typeof navigator&&navigator.connection,T=!_&&S&&(["slow-2g","2g"].includes(S.effectiveType)||S.saveData),R=new WeakMap,P=(e,t)=>e===`[object ${t}]`,C=0,j=e=>{let t,r,n=typeof e,o=a.prototype.toString.call(e),i=P(o,"Date"),u=P(o,"RegExp"),s=P(o,"Object");if(a(e)!==e||i||u)t=i?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=R.get(e))return t;if(t=++C+"~",R.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=j(e[r])+",";R.set(e,t)}if(s){t="#";let n=a.keys(e).sort();for(;!l(r=n.pop());)l(e[r])||(t+=r+":"+j(e[r])+",");R.set(e,t)}}return t},k=e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?j(e):"",t]},L=0,N=()=>++L;async function M(...e){let[t,r,n,i]=e,a=s({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{}),c=a.populateCache,f=a.rollbackOnError,d=a.optimisticData,p=a.throwOnError;if("function"==typeof r){let e=[];for(let n of t.keys())!/^\$(inf|sub)\$/.test(n)&&r(t.get(n)._k)&&e.push(n);return Promise.all(e.map(g))}return g(r);async function g(r){let i,[s]=k(r);if(!s)return;let[g,h]=y(t,s),[v,m,b,E]=o.get(t),w=()=>{let e=v[s];return("function"==typeof a.revalidate?a.revalidate(g().data,r):!1!==a.revalidate)&&(delete b[s],delete E[s],e&&e[0])?e[0](2).then(()=>g().data):g().data};if(e.length<3)return w();let _=n,O=!1,S=N();m[s]=[S,0];let T=!l(d),R=g(),P=R.data,C=R._c,j=l(C)?P:C;if(T&&h({data:d="function"==typeof d?d(j,P):d,_c:j}),"function"==typeof _)try{_=_(j)}catch(e){i=e,O=!0}if(_&&"function"==typeof _.then){let e;if(_=await _.catch(e=>{i=e,O=!0}),S!==m[s][0]){if(O)throw i;return _}O&&T&&(e=i,"function"==typeof f?f(e):!1!==f)&&(c=!0,h({data:j,_c:u}))}if(c&&!O&&("function"==typeof c?h({data:c(_,j),error:u,_c:u}):h({data:_,error:u,_c:u})),m[s][1]=N(),Promise.resolve(w()).then(()=>{h({_c:u})}),O){if(p)throw i;return}return _}}let D=(e,t)=>{for(let r in e)e[r][0]&&e[r][0](t)},A=(e,t)=>{if(!o.has(e)){let r=s(E,t),n=Object.create(null),a=M.bind(u,e),l=i,c=Object.create(null),f=(e,t)=>{let r=c[e]||[];return c[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},d=(t,r,n)=>{e.set(t,r);let o=c[t];if(o)for(let e of o)e(r,n)},p=()=>{if(!o.has(e)&&(o.set(e,[n,Object.create(null),Object.create(null),Object.create(null),a,d,f]),!_)){let t=r.initFocus(setTimeout.bind(u,D.bind(u,n,0))),i=r.initReconnect(setTimeout.bind(u,D.bind(u,n,1)));l=()=>{t&&t(),i&&i(),o.delete(e)}}};return p(),[e,a,p,l]}return[e,o.get(e)[4]]},[I,x]=A(new Map),$=s({onLoadingSlow:i,onSuccess:i,onError:i,onErrorRetry:(e,t,r,n,o)=>{let i=r.errorRetryCount,u=o.retryCount,a=~~((Math.random()+.5)*(1<<(u<8?u:8)))*r.errorRetryInterval;(l(i)||!(u>i))&&setTimeout(n,a,o)},onDiscarded:i,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:T?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:T?5e3:3e3,compare:function e(t,r){var o,i;if(t===r)return!0;if(t&&r&&(o=t.constructor)===r.constructor){if(o===Date)return t.getTime()===r.getTime();if(o===RegExp)return t.toString()===r.toString();if(o===Array){if((i=t.length)===r.length)for(;i--&&e(t[i],r[i]););return -1===i}if(!o||"object"==typeof t){for(o in i=0,t)if(n.call(t,o)&&++i&&!n.call(r,o)||!(o in r)||!e(t[o],r[o]))return!1;return Object.keys(r).length===i}}return t!=t&&r!=r},isPaused:()=>!1,cache:I,mutate:x,fallback:{}},{isOnline:()=>v,isVisible:()=>{let e=g&&document.visibilityState;return l(e)||"hidden"!==e}}),V=(e,t)=>{let r=s(e,t);if(t){let{use:n,fallback:o}=e,{use:i,fallback:u}=t;n&&i&&(r.use=n.concat(i)),o&&u&&(r.fallback=s(o,u))}return r},F=(0,t.createContext)({});var U=e.i(63984);let W=p&&window.__SWR_DEVTOOLS_USE__,B=W?window.__SWR_DEVTOOLS_USE__:[],z=()=>{let e=(0,t.useContext)(F);return(0,t.useMemo)(()=>s($,e),[e])},K=B.concat(e=>(t,r,n)=>{let i=r&&((...e)=>{let[n]=k(t),[,,,i]=o.get(I);if(n.startsWith("$inf$"))return r(...e);let u=i[n];return l(u)?r(...e):(delete i[n],u)});return e(t,i,n)}),q=e=>function(...t){let r,n=z(),[o,i,u]="function"==typeof(r=t)[1]?[r[0],r[1],r[2]||{}]:[r[0],null,(null===r[1]?r[2]:r[1])||{}],a=V(n,u),l=e,{use:s}=a,c=(s||[]).concat(K);for(let e=c.length;e--;)l=c[e](l);return l(o,i||a.fetcher||null,a)},Y=(e,t,r)=>{let n=t[e]||(t[e]=[]);return n.push(r),()=>{let e=n.indexOf(r);e>=0&&(n[e]=n[n.length-1],n.pop())}};W&&(window.__SWR_DEVTOOLS_REACT__=t.default),e.s(["subscribeCallback",0,Y,"useSWRConfig",0,z,"withArgs",0,q],55480);let J=()=>{},Q=J(),X=(new WeakMap,t.default.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}})),Z={dedupe:!0},H=Promise.resolve(u),G=()=>i;a.defineProperty(e=>{let{value:r}=e,n=(0,t.useContext)(F),o="function"==typeof r,i=(0,t.useMemo)(()=>o?r(n):r,[o,n,r]),a=(0,t.useMemo)(()=>o?i:V(n,i),[o,n,i]),l=i&&i.provider,c=(0,t.useRef)(u);l&&!c.current&&(c.current=A(l(a.cache||I),i));let f=c.current;return f&&(a.cache=f[0],a.mutate=f[1]),O(()=>{if(f)return f[2]&&f[2](),f[3]},[]),(0,t.createElement)(F.Provider,s(e,{value:a}))},"defaultValue",{value:$});let ee=q((e,n,i)=>{let{cache:a,compare:c,suspense:f,fallbackData:g,revalidateOnMount:h,revalidateIfStale:v,refreshInterval:m,refreshWhenHidden:b,refreshWhenOffline:E,keepPreviousData:S,strictServerPrefetchWarning:T}=i,[R,P,C,j]=o.get(a),[L,D]=k(e),A=(0,t.useRef)(!1),I=(0,t.useRef)(!1),x=(0,t.useRef)(L),$=(0,t.useRef)(n),V=(0,t.useRef)(i),F=()=>V.current.isVisible()&&V.current.isOnline(),[W,B,z,K]=y(a,L),q=(0,t.useRef)({}).current,J=l(g)?l(i.fallback)?u:i.fallback[L]:g,Q=(e,t)=>{for(let r in q)if("data"===r){if(!c(e[r],t[r])&&(!l(e[r])||!c(el,t[r])))return!1}else if(t[r]!==e[r])return!1;return!0},ee=!A.current,et=(0,t.useMemo)(()=>{let e=W(),t=K(),r=e=>{let t=s(e);return(delete t._k,(()=>{if(!L||!n||V.current.isPaused())return!1;if(ee&&!l(h))return h;let e=l(J)?t.data:J;return l(e)||v})())?{isValidating:!0,isLoading:!0,...t}:t},o=r(e),i=e===t?o:r(t),u=o;return[()=>{let e=r(W());return Q(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>i]},[a,L]),er=(0,r.useSyncExternalStore)((0,t.useCallback)(e=>z(L,(t,r)=>{Q(r,t)||e()}),[a,L]),et[0],et[1]),en=R[L]&&R[L].length>0,eo=er.data,ei=l(eo)?J&&"function"==typeof J.then?X(J):J:eo,eu=er.error,ea=(0,t.useRef)(ei),el=S?l(eo)?l(ea.current)?ei:ea.current:eo:ei,es=L&&l(ei),ec=(0,t.useRef)(null);_||(0,r.useSyncExternalStore)(G,()=>(ec.current=!1,ec),()=>(ec.current=!0,ec));let ef=ec.current;T&&ef&&!f&&es&&console.warn(`Missing pre-initiated data for serialized key "${L}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);let ed=!(!L||!n||V.current.isPaused())&&(!en||!!l(eu))&&(ee&&!l(h)?h:f?!l(ei)&&v:l(ei)||v),ep=ee&&ed,eg=l(er.isValidating)?ep:er.isValidating,eh=l(er.isLoading)?ep:er.isLoading,ey=(0,t.useCallback)(async e=>{let t,r,n=$.current;if(!L||!n||I.current||V.current.isPaused())return!1;let o=!0,a=e||{},s=!C[L]||!a.dedupe,f=()=>w?!I.current&&L===x.current&&A.current:L===x.current,d={isValidating:!1,isLoading:!1},p=()=>{B(d)},g=()=>{let e=C[L];e&&e[1]===r&&delete C[L]},h={isValidating:!0};l(W().data)&&(h.isLoading=!0);try{if(s&&(B(h),i.loadingTimeout&&l(W().data)&&setTimeout(()=>{o&&f()&&V.current.onLoadingSlow(L,i)},i.loadingTimeout),C[L]=[n(D),N()]),[t,r]=C[L],t=await t,s&&setTimeout(g,i.dedupingInterval),!C[L]||C[L][1]!==r)return s&&f()&&V.current.onDiscarded(L),!1;d.error=u;let e=P[L];if(!l(e)&&(r<=e[0]||r<=e[1]||0===e[1]))return p(),s&&f()&&V.current.onDiscarded(L),!1;let a=W().data;d.data=c(a,t)?a:t,s&&f()&&V.current.onSuccess(t,L,i)}catch(r){g();let e=V.current,{shouldRetryOnError:t}=e;!e.isPaused()&&(d.error=r,s&&f())&&(e.onError(r,L,e),(!0===t||"function"==typeof t&&t(r))&&(!V.current.revalidateOnFocus||!V.current.revalidateOnReconnect||F())&&e.onErrorRetry(r,L,e,e=>{let t=R[L];t&&t[0]&&t[0](U.ERROR_REVALIDATE_EVENT,e)},{retryCount:(a.retryCount||0)+1,dedupe:!0}))}return o=!1,p(),!0},[L,a]),ev=(0,t.useCallback)((...e)=>M(a,x.current,...e),[]);if(O(()=>{$.current=n,V.current=i,l(eo)||(ea.current=eo)}),O(()=>{if(!L)return;let e=ey.bind(u,Z),t=0;V.current.revalidateOnFocus&&(t=Date.now()+V.current.focusThrottleInterval);let r=Y(L,R,(r,n={})=>{if(r==U.FOCUS_EVENT){let r=Date.now();V.current.revalidateOnFocus&&r>t&&F()&&(t=r+V.current.focusThrottleInterval,e())}else if(r==U.RECONNECT_EVENT)V.current.revalidateOnReconnect&&F()&&e();else if(r==U.MUTATE_EVENT)return ey();else if(r==U.ERROR_REVALIDATE_EVENT)return ey(n)});if(I.current=!1,x.current=L,A.current=!0,B({_k:D}),ed&&!C[L])if(l(ei)||_)e();else p&&typeof window.requestAnimationFrame!=d?window.requestAnimationFrame(e):setTimeout(e,1);return()=>{I.current=!0,r()}},[L]),O(()=>{let e;function t(){let t="function"==typeof m?m(W().data):m;t&&-1!==e&&(e=setTimeout(r,t))}function r(){!W().error&&(b||V.current.isVisible())&&(E||V.current.isOnline())?ey(Z).then(t):t()}return t(),()=>{e&&(clearTimeout(e),e=-1)}},[m,b,E,L]),(0,t.useDebugValue)(el),f){if(!w&&_&&es)throw Error("Fallback data is required when using Suspense in SSR.");es&&($.current=n,V.current=i,I.current=!1);let e=j[L];if(X(!l(e)&&es?ev(e):H),!l(eu)&&es)throw eu;let t=es?ey(Z):H;!l(el)&&es&&(t.status="fulfilled",t.value=!0),X(t)}return{mutate:ev,get data(){return q.data=!0,el},get error(){return q.error=!0,eu},get isValidating(){return q.isValidating=!0,eg},get isLoading(){return q.isLoading=!0,eh}}});e.s(["default",0,ee],35644)},82610,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={assign:function(){return l},searchParamsToUrlQuery:function(){return i},urlQueryToSearchParams:function(){return a}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function i(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function u(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function a(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,u(e));else t.set(r,u(n));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},23079,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return v},MiddlewareNotFoundError:function(){return w},MissingStaticPage:function(){return E},NormalizeError:function(){return m},PageNotFoundError:function(){return b},SP:function(){return h},ST:function(){return y},WEB_VITALS:function(){return i},execOnce:function(){return u},getDisplayName:function(){return f},getLocationOrigin:function(){return s},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return d},loadGetInitialProps:function(){return g},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return _}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=["CLS","FCP","FID","INP","LCP","TTFB"];function u(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let a=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>a.test(e);function s(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=s();return e.substring(t.length)}function f(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function d(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function g(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await g(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&d(r))return n;if(!n)throw Object.defineProperty(Error(`"${f(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E1025",enumerable:!1,configurable:!0});return n}let h="u">typeof performance,y=h&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class v extends Error{}class m extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class E extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class w extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function _(e){return JSON.stringify({message:e.message,stack:e.stack})}},79243,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},92416,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return a},formatWithValidation:function(){return s},urlObjectKeys:function(){return l}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=e.r(72012)._(e.r(82610)),u=/https?|ftp|gopher|file/;function a(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",a=e.hash||"",l=e.query||"",s=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?s=t+e.host:r&&(s=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(s+=":"+e.port)),l&&"object"==typeof l&&(l=String(i.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||u.test(n))&&!1!==s?(s="//"+(s||""),o&&"/"!==o[0]&&(o="/"+o)):s||(s=""),a&&"#"!==a[0]&&(a="#"+a),c&&"?"!==c[0]&&(c="?"+c),o=o.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${s}${o}${c}${a}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function s(e){return a(e)}},87442,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=e.r(87854);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=i(e,n)),t&&(o.current=i(t,n))},[e,t])}function i(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},33956,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return i}});let n=e.r(23079),o=e.r(60071);function i(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},32693,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},60449,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return v},useLinkStatus:function(){return b}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=e.r(72012),u=e.r(90724),a=i._(e.r(87854)),l=e.r(92416),s=e.r(47067),c=e.r(87442),f=e.r(23079),d=e.r(54201);e.r(79243);let p=e.r(29117),g=e.r(10009),h=e.r(33956),y=e.r(42194);function v(t){var r,n;let o,i,v,[b,E]=(0,a.useOptimistic)(g.IDLE_LINK_STATUS),w=(0,a.useRef)(null),{href:_,as:O,children:S,prefetch:T=null,passHref:R,replace:P,shallow:C,scroll:j,onClick:k,onMouseEnter:L,onTouchStart:N,legacyBehavior:M=!1,onNavigate:D,transitionTypes:A,ref:I,unstable_dynamicOnHover:x,...$}=t;o=S,M&&("string"==typeof o||"number"==typeof o)&&(o=(0,u.jsx)("a",{children:o}));let V=a.default.useContext(s.AppRouterContext),F=!1!==T,U=!1!==T?null===(n=T)||"auto"===n?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,W="string"==typeof(r=O||_)?r:(0,l.formatUrl)(r);if(M){if(o?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});i=a.default.Children.only(o)}let B=M?i&&"object"==typeof i&&i.ref:I,z=a.default.useCallback(e=>(null!==V&&(w.current=(0,g.mountLinkInstance)(e,W,V,U,F,E)),()=>{w.current&&((0,g.unmountLinkForCurrentNavigation)(w.current),w.current=null),(0,g.unmountPrefetchableInstance)(e)}),[F,W,V,U,E]),K={ref:(0,c.useMergedRef)(z,B),onClick(t){M||"function"!=typeof k||k(t),M&&i.props&&"function"==typeof i.props.onClick&&i.props.onClick(t),!V||t.defaultPrevented||function(t,r,n,o,i,u,l){if("u">typeof window){let s,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((s=t.currentTarget.getAttribute("target"))&&"_self"!==s||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,h.isLocalURL)(r)){o&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),u){let e=!1;if(u({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:f}=e.r(93154);a.default.startTransition(()=>{f(r,o?"replace":"push",!1===i?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,n.current,l)})}}(t,W,w,P,j,D,A)},onMouseEnter(e){M||"function"!=typeof L||L(e),M&&i.props&&"function"==typeof i.props.onMouseEnter&&i.props.onMouseEnter(e),V&&F&&(0,g.onNavigationIntent)(e.currentTarget,!0===x)},onTouchStart:function(e){M||"function"!=typeof N||N(e),M&&i.props&&"function"==typeof i.props.onTouchStart&&i.props.onTouchStart(e),V&&F&&(0,g.onNavigationIntent)(e.currentTarget,!0===x)}};return(0,f.isAbsoluteUrl)(W)?K.href=W:M&&!R&&("a"!==i.type||"href"in i.props)||(K.href=(0,d.addBasePath)(W)),v=M?a.default.cloneElement(i,K):(0,u.jsx)("a",{...$,...K,children:o}),(0,u.jsx)(m.Provider,{value:b,children:v})}e.r(32693);let m=(0,a.createContext)(g.IDLE_LINK_STATUS),b=()=>(0,a.useContext)(m);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},25599,e=>{"use strict";function t(e){if(!e)return null;let t=Date.parse(e.includes("T")?e:e.replace(" ","T")+"Z");return Number.isFinite(t)?t:null}e.s(["formatWeChatTime",0,function(e){let r=t(e);if(null===r)return"";let n=new Date(r),o=new Date,i="u">typeof navigator&&(navigator.language||"").toLowerCase().startsWith("zh"),u=`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`,a=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),l=Math.round((a(o)-a(n))/864e5);if(0===l)return u;if(1===l)return i?`昨天 ${u}`:`Yesterday ${u}`;if(l>1&&l<7){let e=new Intl.DateTimeFormat(i?"zh-CN":void 0,{weekday:i?"long":"short"}).format(n);return`${e} ${u}`}let s=new Intl.DateTimeFormat(i?"zh-CN":void 0,{month:i?"long":"short",day:"numeric",...n.getFullYear()!==o.getFullYear()?{year:"numeric"}:{}}).format(n);return`${s} ${u}`},"parseHubTime",0,t,"relativeAgo",0,function(e){let r=t(e);if(null===r)return null;let n=Math.floor((Date.now()-r)/1e3);return n<0?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}])},25879,e=>{"use strict";var t=e.i(90724),r=e.i(87854);let n=(0,r.createContext)({networkId:"",setNetworkId:()=>{}});e.s(["NetworkProvider",0,function({children:e}){let[o,i]=(0,r.useState)("");return(0,r.useEffect)(()=>{let e=sessionStorage.getItem("anet_network_id");e&&i(e)},[]),(0,t.jsx)(n.Provider,{value:{networkId:o,setNetworkId:e=>{i(e),sessionStorage.setItem("anet_network_id",e)}},children:e})},"useNetworkId",0,function(){return(0,r.useContext)(n)}])}]);
|