agent-relay 1.3.0 → 1.3.1
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/dist/dashboard/out/404.html +1 -1
- package/dist/dashboard/out/_next/static/chunks/{899-bb19a9b3d9b39ea6.js → 899-fc02ed79e3de4302.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/app/onboarding/page-8553743baca53a00.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/app/{page-5af1b6b439858aa6.js → page-c617745b81344f4f.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/connect-repos/page-3538dfe0ffe984b8.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/history/{page-8c8bed33beb2bf1c.js → page-abb9ab2d329f56e9.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/layout-c0d118c0f92d969c.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/login/{page-16f3b49e55b1e0ed.js → page-c22d080201cbd9fb.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/metrics/{page-ac39dc0cc3c26fa7.js → page-f829604fb75a831a.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/{page-4a5938c18a11a654.js → page-dc786c183425c2ac.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/pricing/page-b08ed1c34d14434a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/providers/page-84322991d7244499.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/providers/setup/[provider]/{page-09f9caae98a18c09.js → page-05606941a8e2be83.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/signup/{page-547dd0ca55ecd0ba.js → page-68d34f50baa8ab6b.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/{main-app-5d692157a8eb1fd9.js → main-app-6e8e8d3ef4e0192a.js} +1 -1
- package/dist/dashboard/out/_next/static/css/48a8fbe3e659080e.css +1 -0
- package/dist/dashboard/out/app/onboarding.html +1 -1
- package/dist/dashboard/out/app/onboarding.txt +2 -2
- package/dist/dashboard/out/app.html +1 -1
- package/dist/dashboard/out/app.txt +2 -2
- package/dist/dashboard/out/connect-repos.html +1 -1
- package/dist/dashboard/out/connect-repos.txt +2 -2
- package/dist/dashboard/out/history.html +1 -1
- package/dist/dashboard/out/history.txt +2 -2
- package/dist/dashboard/out/index.html +1 -1
- package/dist/dashboard/out/index.txt +2 -2
- package/dist/dashboard/out/login.html +2 -2
- package/dist/dashboard/out/login.txt +2 -2
- package/dist/dashboard/out/metrics.html +1 -1
- package/dist/dashboard/out/metrics.txt +2 -2
- package/dist/dashboard/out/pricing.html +2 -2
- package/dist/dashboard/out/pricing.txt +2 -2
- package/dist/dashboard/out/providers/setup/claude.html +1 -1
- package/dist/dashboard/out/providers/setup/claude.txt +2 -2
- package/dist/dashboard/out/providers/setup/codex.html +1 -1
- package/dist/dashboard/out/providers/setup/codex.txt +2 -2
- package/dist/dashboard/out/providers.html +1 -1
- package/dist/dashboard/out/providers.txt +2 -2
- package/dist/dashboard/out/signup.html +2 -2
- package/dist/dashboard/out/signup.txt +2 -2
- package/package.json +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/app/onboarding/page-8939b0fc700f7eca.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/connect-repos/page-f45ecbc3e06134fc.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/layout-2433bb48965f4333.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/pricing/page-982a7000fee44014.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/providers/page-ac3a6ac433fd6001.js +0 -1
- package/dist/dashboard/out/_next/static/css/85d2af9c7ac74d62.css +0 -1
- /package/dist/dashboard/out/_next/static/{T1tgCqVWHFIkV7ClEtzD7 → sDcbGRTYLcpPvyTs_rsNb}/_buildManifest.js +0 -0
- /package/dist/dashboard/out/_next/static/{T1tgCqVWHFIkV7ClEtzD7 → sDcbGRTYLcpPvyTs_rsNb}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[615],{573:function(e,t,r){Promise.resolve().then(r.bind(r,4011))},4011:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return c}});var s=r(7437),a=r(2265),n=r(9376),o=r(6272);function i(){let e=(0,n.useSearchParams)().get("reason")||"new",[t,r]=(0,a.useState)([]),[i,c]=(0,a.useState)(!0),[l,d]=(0,a.useState)(!1),[x,u]=(0,a.useState)(null),[h,m]=(0,a.useState)(null),{trackEvent:p}={trackEvent:(0,a.useCallback)((e,t)=>{try{fetch("/api/analytics/track",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({event:e,properties:t,timestamp:Date.now()})}).catch(()=>{})}catch(e){}},[])};(0,a.useEffect)(()=>{(async()=>{try{let t=await fetch("/api/auth/session",{credentials:"include"});if(404===t.status){window.location.href="/app";return}let s=t.headers.get("X-CSRF-Token");if(s&&m(s),!(await t.json()).authenticated){window.location.href="/login";return}let a=await fetch("/api/workspaces",{credentials:"include"});if(a.ok&&((await a.json()).workspaces||[]).length>0){window.location.href="/app";return}let n=await fetch("/api/github-app/repos",{credentials:"include"});if(n.ok){let e=await n.json();r(e.repositories||[])}p("onboarding_page_view",{reason:e}),c(!1)}catch(e){console.error("Onboarding init error:",e),u(e instanceof Error?e.message:"Failed to initialize"),c(!1)}})()},[e,p]);let f=(0,a.useCallback)(async e=>{d(!0),u(null),p("onboarding_repo_selected",{repository:e});try{let t={"Content-Type":"application/json"};h&&(t["X-CSRF-Token"]=h);let r=await fetch("/api/workspaces/quick",{method:"POST",credentials:"include",headers:t,body:JSON.stringify({repositoryFullName:e})}),s=await r.json();if(!r.ok)throw Error(s.error||"Failed to create workspace");p("onboarding_workspace_created",{workspaceId:s.workspaceId,repository:e}),window.location.href="/app"}catch(e){console.error("Create workspace error:",e),u(e instanceof Error?e.message:"Failed to create workspace"),d(!1)}},[h,p]),b=(0,a.useCallback)(()=>{p("onboarding_connect_repos_clicked",{reason:e}),window.location.href="/connect-repos"},[e,p]);if(i)return(0,s.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:"Loading..."})]})});if(l)return(0,s.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,s.jsx)("p",{className:"mt-4 text-white font-medium",children:"Creating your workspace..."}),(0,s.jsx)("p",{className:"mt-2 text-text-muted text-sm",children:"This may take a few minutes"})]})});let g="deleted"===e;return(0,s.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex flex-col items-center justify-center p-4",children:[(0,s.jsx)("div",{className:"fixed inset-0 opacity-10 pointer-events-none",children:(0,s.jsx)("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(0, 217, 255, 0.1) 1px, transparent 1px)",backgroundSize:"50px 50px"}})}),(0,s.jsxs)("div",{className:"relative z-10 w-full max-w-2xl",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center mb-8",children:[(0,s.jsx)(o.K7,{size:56,withGlow:!0}),(0,s.jsx)("h1",{className:"mt-6 text-3xl font-bold text-white",children:g?"Workspace Deleted":"Welcome to Agent Relay"}),(0,s.jsx)("p",{className:"mt-3 text-text-muted text-center max-w-md",children:g?"Your workspace has been deleted. Create a new one to continue working with AI agents.":"Get started by creating your first workspace. Connect a repository and let AI agents help you build."})]}),x&&(0,s.jsx)("div",{className:"mb-6 p-4 bg-error/10 border border-error/20 rounded-xl",children:(0,s.jsx)("p",{className:"text-error text-center",children:x})}),(0,s.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-8",children:[!g&&(0,s.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-8",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-accent-cyan flex items-center justify-center text-bg-deep font-semibold text-sm",children:"1"}),(0,s.jsx)("span",{className:"text-white font-medium",children:"Select Repository"})]}),(0,s.jsx)("div",{className:"w-12 h-px bg-border-subtle"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-bg-tertiary border border-border-subtle flex items-center justify-center text-text-muted font-semibold text-sm",children:"2"}),(0,s.jsx)("span",{className:"text-text-muted",children:"Connect AI Provider"})]}),(0,s.jsx)("div",{className:"w-12 h-px bg-border-subtle"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-bg-tertiary border border-border-subtle flex items-center justify-center text-text-muted font-semibold text-sm",children:"3"}),(0,s.jsx)("span",{className:"text-text-muted",children:"Start Building"})]})]}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:g?"Create a New Workspace":"Choose a Repository"}),(0,s.jsx)("p",{className:"text-text-muted mb-6",children:g?"Select a repository to create a new workspace for your AI agents.":"Your workspace will be set up with this repository. You can add more repos later."}),t.length>0?(0,s.jsx)("div",{className:"space-y-3",children:t.map(e=>(0,s.jsxs)("button",{onClick:()=>f(e.fullName),disabled:l,className:"w-full flex items-center gap-4 p-4 bg-bg-tertiary rounded-xl border border-border-subtle hover:border-accent-cyan/50 hover:bg-bg-hover transition-all text-left group disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("div",{className:"w-12 h-12 rounded-lg bg-bg-card border border-border-subtle flex items-center justify-center flex-shrink-0 group-hover:border-accent-cyan/30 transition-colors",children:(0,s.jsx)("svg",{className:"w-6 h-6 text-text-muted group-hover:text-accent-cyan transition-colors",fill:"currentColor",viewBox:"0 0 16 16",children:(0,s.jsx)("path",{d:"M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8z"})})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-white font-medium truncate group-hover:text-accent-cyan transition-colors",children:e.fullName}),(0,s.jsxs)("p",{className:"text-text-muted text-sm mt-0.5",children:[e.isPrivate?"Private repository":"Public repository"," \xb7 ",e.defaultBranch]})]}),(0,s.jsx)("svg",{className:"w-5 h-5 text-text-muted group-hover:text-accent-cyan group-hover:translate-x-1 transition-all",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},e.id))}):(0,s.jsxs)("div",{className:"text-center py-12 bg-bg-tertiary rounded-xl border border-border-subtle",children:[(0,s.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-bg-card rounded-full flex items-center justify-center",children:(0,s.jsx)("svg",{className:"w-8 h-8 text-text-muted",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})})}),(0,s.jsx)("h3",{className:"text-lg font-semibold text-white mb-2",children:"No Repositories Connected"}),(0,s.jsx)("p",{className:"text-text-muted mb-6 max-w-sm mx-auto",children:"Connect your GitHub repositories to create a workspace and start working with AI agents."}),(0,s.jsxs)("button",{onClick:b,className:"inline-flex items-center gap-2 py-3 px-6 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:[(0,s.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Connect GitHub"]})]})]}),(0,s.jsxs)("div",{className:"mt-8 flex justify-center gap-6 text-sm",children:[t.length>0&&(0,s.jsx)("button",{onClick:b,className:"text-text-muted hover:text-white transition-colors",children:"Connect More Repositories"}),(0,s.jsx)("a",{href:"/app",className:"text-text-muted hover:text-white transition-colors",children:"Back to Dashboard"}),(0,s.jsx)("button",{onClick:async()=>{let e={};h&&(e["X-CSRF-Token"]=h),await fetch("/api/auth/logout",{method:"POST",credentials:"include",headers:e}),window.location.href="/login"},className:"text-text-muted hover:text-white transition-colors",children:"Sign Out"})]})]})]})}function c(){return(0,s.jsx)(a.Suspense,{fallback:(0,s.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:"Loading..."})]})}),children:(0,s.jsx)(i,{})})}},9376:function(e,t,r){"use strict";var s=r(5475);r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(t,{useSearchParams:function(){return s.useSearchParams}})},6272:function(e,t,r){"use strict";r.d(t,{K7:function(){return a}});var s=r(7437);function a(e){let{size:t=24,className:r="",withGlow:a=!1}=e;return(0,s.jsxs)("svg",{width:t,height:t,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"\n transition-all duration-300\n ".concat(a?"drop-shadow-[0_0_8px_rgba(0,217,255,0.3)]":"","\n ").concat(r,"\n "),"aria-label":"Agent Relay Logo",role:"img",children:[(0,s.jsx)("path",{d:"M30 80 L 50 20 L 70 80",stroke:"#00d9ff",strokeWidth:"5",strokeLinejoin:"round",strokeLinecap:"round",fill:"none"}),(0,s.jsx)("line",{x1:"40",y1:"50",x2:"60",y2:"50",stroke:"#00d9ff",strokeWidth:"5",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M50 20 L 50 80",stroke:"#00ffc8",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.7"}),(0,s.jsx)("path",{d:"M50 20 C 80 20 80 50 50 50 L 80 80",stroke:"#00ffc8",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:"0.7"})]})}r(2265)}},function(e){e.O(0,[971,117,744],function(){return e(e.s=573)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[191],{3561:function(e,n,t){Promise.resolve().then(t.bind(t,3330))},3330:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return f}});var r=t(7437),s=t(2265),a=t(5899),i=t(5372),o=t(6272),l=t(9116),c=t(3083);let d=[{id:"creating",name:"Initialize",description:"Creating workspace container",estimatedSeconds:5,icon:"◈"},{id:"networking",name:"Network",description:"Configuring DNS & IP allocation",estimatedSeconds:8,icon:"◇"},{id:"secrets",name:"Secure",description:"Encrypting credentials",estimatedSeconds:3,icon:"◆"},{id:"machine",name:"Deploy",description:"Launching cloud instance",estimatedSeconds:25,icon:"▣"},{id:"booting",name:"Boot",description:"Starting relay services",estimatedSeconds:20,icon:"▢"},{id:"health",name:"Verify",description:"Running health checks",estimatedSeconds:15,icon:"◉"}],p=["> Establishing secure connection...","> Allocating compute resources...","> Configuring agent protocols...","> Initializing relay daemon...","> Syncing workspace state...","> Warming up inference engine...","> Connecting to neural mesh...","> Deploying agent swarm..."];function m(e){let{currentStage:n,isProvisioning:t,workspaceName:a,error:i,onCancel:o}=e,[l,c]=(0,s.useState)(0),[m,h]=(0,s.useState)([]),[g,b]=(0,s.useState)(!0);(0,s.useEffect)(()=>{if(!t){c(0);return}let e=setInterval(()=>{c(e=>e+1)},1e3);return()=>clearInterval(e)},[t]),(0,s.useEffect)(()=>{let e=setInterval(()=>{b(e=>!e)},530);return()=>clearInterval(e)},[]),(0,s.useEffect)(()=>{if(!t){h([]);return}let e=()=>{let e=p[Math.floor(Math.random()*p.length)];h(n=>[...n.slice(-4),e])};e();let n=setInterval(e,3500);return()=>clearInterval(n)},[t]);let f=(0,s.useMemo)(()=>{if(n){let e=d.findIndex(e=>e.id===n);return e>=0?e:0}let e=0;for(let n=0;n<d.length;n++)if(l<(e+=d[n].estimatedSeconds))return n;return d.length-1},[n,l]),w=(0,s.useMemo)(()=>d.reduce((e,n)=>e+n.estimatedSeconds,0),[]),j=(0,s.useMemo)(()=>Math.min(95,Math.round(l/w*100)),[l,w]);return i?(0,r.jsxs)("div",{className:"prov-container prov-error",children:[(0,r.jsx)("div",{className:"error-glitch",children:(0,r.jsx)("span",{className:"error-icon",children:"✕"})}),(0,r.jsx)("h3",{className:"error-title",children:"PROVISIONING FAILED"}),(0,r.jsx)("p",{className:"error-message",children:i}),o&&(0,r.jsx)("button",{onClick:o,className:"retry-btn",children:(0,r.jsx)("span",{children:"RETRY"})}),(0,r.jsx)("style",{children:u})]}):(0,r.jsxs)("div",{className:"prov-container",children:[(0,r.jsx)("div",{className:"ambient-glow"}),(0,r.jsx)("div",{className:"scan-line"}),(0,r.jsxs)("header",{className:"prov-header",children:[(0,r.jsx)("div",{className:"header-badge",children:"PROVISIONING"}),(0,r.jsx)("h1",{className:"header-title",children:a||"Workspace"}),(0,r.jsxs)("div",{className:"header-meta",children:[(0,r.jsx)("span",{className:"meta-time",children:(e=>{let n=Math.floor(e/60),t=e%60;return n>0?"".concat(n,":").concat(t.toString().padStart(2,"0")):"0:".concat(t.toString().padStart(2,"0"))})(l)}),(0,r.jsx)("span",{className:"meta-sep",children:"•"}),(0,r.jsxs)("span",{className:"meta-percent",children:[j,"%"]})]})]}),(0,r.jsxs)("div",{className:"progress-track",children:[(0,r.jsx)("div",{className:"progress-fill",style:{width:"".concat(j,"%")}}),(0,r.jsx)("div",{className:"progress-glow",style:{left:"".concat(j,"%")}})]}),(0,r.jsx)("div",{className:"stages-timeline",children:d.map((e,n)=>{let t=n<f,s=n===f,a=n>f;return(0,r.jsxs)("div",{className:"stage-row ".concat(t?"completed":""," ").concat(s?"current":""," ").concat(a?"pending":""),children:[n>0&&(0,r.jsxs)("div",{className:"stage-connector ".concat(t?"active":""),children:[(0,r.jsx)("div",{className:"connector-line"}),t&&(0,r.jsx)("div",{className:"connector-pulse"})]}),(0,r.jsxs)("div",{className:"stage-node",children:[(0,r.jsx)("span",{className:"node-icon",children:e.icon}),s&&(0,r.jsx)("div",{className:"node-ring"})]}),(0,r.jsxs)("div",{className:"stage-content",children:[(0,r.jsx)("span",{className:"stage-name",children:e.name}),s&&(0,r.jsx)("span",{className:"stage-desc",children:e.description})]}),(0,r.jsxs)("div",{className:"stage-status",children:[t&&(0,r.jsx)("span",{className:"status-done",children:"DONE"}),s&&(0,r.jsx)("span",{className:"status-active",children:"ACTIVE"}),a&&(0,r.jsxs)("span",{className:"status-wait",children:["~",e.estimatedSeconds,"s"]})]})]},e.id)})}),(0,r.jsxs)("div",{className:"terminal-window",children:[(0,r.jsxs)("div",{className:"terminal-header",children:[(0,r.jsx)("span",{className:"terminal-dot red"}),(0,r.jsx)("span",{className:"terminal-dot yellow"}),(0,r.jsx)("span",{className:"terminal-dot green"}),(0,r.jsx)("span",{className:"terminal-title",children:"agent-relay"})]}),(0,r.jsxs)("div",{className:"terminal-body",children:[m.map((e,n)=>(0,r.jsx)("div",{className:"terminal-line",style:{animationDelay:"".concat(.1*n,"s")},children:e},n)),(0,r.jsxs)("div",{className:"terminal-cursor",children:[(0,r.jsx)("span",{className:"cursor-prompt",children:"$"}),(0,r.jsx)("span",{className:"cursor-block ".concat(g?"visible":""),children:"_"})]})]})]}),o&&(0,r.jsx)("button",{onClick:o,className:"cancel-btn",children:"Cancel"}),(0,r.jsx)("style",{children:x})]})}let x="\n .prov-container {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 40px 32px;\n background: linear-gradient(145deg, rgba(10, 15, 25, 0.95) 0%, rgba(5, 10, 18, 0.98) 100%);\n border: 1px solid rgba(6, 182, 212, 0.15);\n border-radius: 16px;\n overflow: hidden;\n font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;\n }\n\n /* Ambient effects */\n .ambient-glow {\n position: absolute;\n top: -100px;\n left: 50%;\n transform: translateX(-50%);\n width: 300px;\n height: 200px;\n background: radial-gradient(ellipse, rgba(6, 182, 212, 0.12) 0%, transparent 70%);\n pointer-events: none;\n }\n\n .scan-line {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 2px;\n background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.4), transparent);\n animation: scanMove 3s ease-in-out infinite;\n pointer-events: none;\n }\n\n @keyframes scanMove {\n 0%, 100% { top: 0; opacity: 0.5; }\n 50% { top: 100%; opacity: 0.2; }\n }\n\n /* Header */\n .prov-header {\n text-align: center;\n position: relative;\n z-index: 1;\n }\n\n .header-badge {\n display: inline-block;\n padding: 4px 12px;\n background: rgba(6, 182, 212, 0.1);\n border: 1px solid rgba(6, 182, 212, 0.3);\n border-radius: 4px;\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 2px;\n color: #06b6d4;\n margin-bottom: 12px;\n }\n\n .header-title {\n font-size: 22px;\n font-weight: 600;\n color: #f1f5f9;\n margin: 0 0 8px 0;\n letter-spacing: -0.5px;\n }\n\n .header-meta {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n font-size: 13px;\n color: #64748b;\n }\n\n .meta-time {\n font-variant-numeric: tabular-nums;\n }\n\n .meta-percent {\n color: #06b6d4;\n font-weight: 500;\n }\n\n .meta-sep {\n opacity: 0.3;\n }\n\n /* Progress bar */\n .progress-track {\n position: relative;\n height: 4px;\n background: rgba(100, 116, 139, 0.2);\n border-radius: 2px;\n overflow: visible;\n }\n\n .progress-fill {\n height: 100%;\n background: linear-gradient(90deg, #0891b2, #06b6d4, #22d3ee);\n border-radius: 2px;\n transition: width 0.5s ease;\n }\n\n .progress-glow {\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 8px;\n height: 8px;\n background: #22d3ee;\n border-radius: 50%;\n box-shadow: 0 0 16px rgba(34, 211, 238, 0.6);\n transition: left 0.5s ease;\n }\n\n /* Stages */\n .stages-timeline {\n display: flex;\n flex-direction: column;\n gap: 0;\n padding: 16px 0;\n }\n\n .stage-row {\n display: grid;\n grid-template-columns: 40px 1fr auto;\n align-items: center;\n gap: 12px;\n padding: 10px 0;\n position: relative;\n }\n\n .stage-connector {\n position: absolute;\n left: 19px;\n top: -10px;\n width: 2px;\n height: 20px;\n }\n\n .connector-line {\n width: 100%;\n height: 100%;\n background: rgba(100, 116, 139, 0.3);\n transition: background 0.3s ease;\n }\n\n .stage-connector.active .connector-line {\n background: linear-gradient(180deg, #06b6d4, rgba(6, 182, 212, 0.3));\n }\n\n .connector-pulse {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(180deg, rgba(34, 211, 238, 0.8), transparent);\n animation: pulseLine 1.5s ease-out infinite;\n }\n\n @keyframes pulseLine {\n 0% { opacity: 1; transform: translateY(-100%); }\n 100% { opacity: 0; transform: translateY(100%); }\n }\n\n .stage-node {\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n }\n\n .node-icon {\n font-size: 18px;\n color: #475569;\n transition: all 0.3s ease;\n }\n\n .stage-row.completed .node-icon {\n color: #06b6d4;\n }\n\n .stage-row.current .node-icon {\n color: #22d3ee;\n text-shadow: 0 0 12px rgba(34, 211, 238, 0.5);\n }\n\n .node-ring {\n position: absolute;\n inset: 4px;\n border: 2px solid rgba(34, 211, 238, 0.4);\n border-radius: 50%;\n animation: ringPulse 2s ease-in-out infinite;\n }\n\n @keyframes ringPulse {\n 0%, 100% { transform: scale(1); opacity: 1; }\n 50% { transform: scale(1.2); opacity: 0.5; }\n }\n\n .stage-content {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n }\n\n .stage-name {\n font-size: 13px;\n font-weight: 500;\n color: #64748b;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n transition: color 0.3s ease;\n }\n\n .stage-row.completed .stage-name {\n color: #475569;\n }\n\n .stage-row.current .stage-name {\n color: #f1f5f9;\n }\n\n .stage-desc {\n font-size: 11px;\n color: #64748b;\n animation: fadeSlideIn 0.3s ease;\n }\n\n @keyframes fadeSlideIn {\n from { opacity: 0; transform: translateX(-8px); }\n to { opacity: 1; transform: translateX(0); }\n }\n\n .stage-status {\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 1px;\n }\n\n .status-done {\n color: #06b6d4;\n }\n\n .status-active {\n color: #22d3ee;\n animation: blink 1s ease-in-out infinite;\n }\n\n @keyframes blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n\n .status-wait {\n color: #475569;\n font-variant-numeric: tabular-nums;\n }\n\n /* Terminal */\n .terminal-window {\n background: rgba(0, 0, 0, 0.4);\n border: 1px solid rgba(100, 116, 139, 0.2);\n border-radius: 8px;\n overflow: hidden;\n }\n\n .terminal-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: rgba(30, 41, 59, 0.5);\n border-bottom: 1px solid rgba(100, 116, 139, 0.15);\n }\n\n .terminal-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n }\n\n .terminal-dot.red { background: #ef4444; }\n .terminal-dot.yellow { background: #eab308; }\n .terminal-dot.green { background: #22c55e; }\n\n .terminal-title {\n margin-left: auto;\n font-size: 11px;\n color: #64748b;\n }\n\n .terminal-body {\n padding: 12px;\n min-height: 100px;\n }\n\n .terminal-line {\n font-size: 12px;\n color: #94a3b8;\n padding: 2px 0;\n animation: typeIn 0.3s ease;\n }\n\n @keyframes typeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n .terminal-cursor {\n display: flex;\n align-items: center;\n gap: 4px;\n margin-top: 8px;\n }\n\n .cursor-prompt {\n color: #06b6d4;\n font-weight: 600;\n }\n\n .cursor-block {\n color: #22d3ee;\n opacity: 0;\n transition: opacity 0.1s;\n }\n\n .cursor-block.visible {\n opacity: 1;\n }\n\n /* Cancel button */\n .cancel-btn {\n align-self: center;\n padding: 8px 20px;\n background: transparent;\n border: 1px solid rgba(100, 116, 139, 0.3);\n border-radius: 6px;\n color: #64748b;\n font-family: inherit;\n font-size: 12px;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .cancel-btn:hover {\n border-color: rgba(239, 68, 68, 0.5);\n color: #ef4444;\n }\n",u="\n .prov-container.prov-error {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 16px;\n padding: 48px 32px;\n background: linear-gradient(145deg, rgba(25, 10, 10, 0.95) 0%, rgba(15, 5, 8, 0.98) 100%);\n border: 1px solid rgba(239, 68, 68, 0.2);\n border-radius: 16px;\n text-align: center;\n font-family: 'SF Mono', 'JetBrains Mono', monospace;\n }\n\n .error-glitch {\n position: relative;\n width: 64px;\n height: 64px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(239, 68, 68, 0.1);\n border: 1px solid rgba(239, 68, 68, 0.3);\n border-radius: 12px;\n }\n\n .error-icon {\n font-size: 28px;\n color: #ef4444;\n animation: glitch 0.3s ease infinite;\n }\n\n @keyframes glitch {\n 0%, 100% { transform: translate(0); }\n 25% { transform: translate(-2px, 1px); }\n 50% { transform: translate(2px, -1px); }\n 75% { transform: translate(-1px, -1px); }\n }\n\n .error-title {\n font-size: 14px;\n font-weight: 600;\n letter-spacing: 2px;\n color: #ef4444;\n margin: 0;\n }\n\n .error-message {\n font-size: 13px;\n color: #94a3b8;\n max-width: 350px;\n margin: 0;\n line-height: 1.5;\n }\n\n .retry-btn {\n margin-top: 8px;\n padding: 10px 28px;\n background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);\n border: 1px solid rgba(239, 68, 68, 0.4);\n border-radius: 6px;\n color: #ef4444;\n font-family: inherit;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 1px;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .retry-btn:hover {\n background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.3) 100%);\n border-color: rgba(239, 68, 68, 0.6);\n transform: translateY(-1px);\n }\n";var h=t(257);let g=[{id:"anthropic",name:"Anthropic",displayName:"Claude",color:"#D97757",cliCommand:"claude"},{id:"codex",name:"OpenAI",displayName:"Codex",color:"#10A37F",cliCommand:"codex login",supportsDeviceFlow:!0,requiresUrlCopy:!0},{id:"opencode",name:"OpenCode",displayName:"OpenCode",color:"#00D4AA",cliCommand:"opencode"},{id:"droid",name:"Factory",displayName:"Droid",color:"#6366F1",cliCommand:"droid"}],b="true"===h.env.NEXT_PUBLIC_FORCE_CLOUD_MODE;function f(){let[e,n]=(0,s.useState)("loading"),[t,d]=(0,s.useState)([]),[p,x]=(0,s.useState)([]),[u,h]=(0,s.useState)(null),[f,w]=(0,s.useState)(void 0),[j,v]=(0,s.useState)(null),[N,y]=(0,s.useState)(b),[k,C]=(0,s.useState)(null),[S,I]=(0,s.useState)(null),[M,L]=(0,s.useState)(null),[z,E]=(0,s.useState)([]);(0,s.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/auth/session",{credentials:"include"});if(404===e.status){if(b)throw Error("Cloud mode enforced but session endpoint returned 404. Is the cloud server running?");y(!1),n("local");return}let t=e.headers.get("X-CSRF-Token");t&&C(t);let r=await e.json();if(!r.authenticated){window.location.href="/login";return}y(!0);let s={openai:"codex"};if(r.connectedProviders){let e=[];r.connectedProviders.forEach(n=>{e.push(n.provider);let t=s[n.provider];t&&e.push(t)}),E(e)}let[a,i]=await Promise.all([fetch("/api/workspaces/accessible",{credentials:"include"}),fetch("/api/github-app/repos",{credentials:"include"})]);if(!a.ok){if(401===a.status){window.location.href="/login";return}throw Error("Failed to fetch workspaces")}let o=await a.json(),l=i.ok?await i.json():{repositories:[]};d(o.workspaces||[]),x(l.repositories||[]);let c=(o.workspaces||[]).filter(e=>"running"===e.status&&e.publicUrl);1===c.length?F(c[0]):c.length>1?n("select-workspace"):(o.workspaces||[]).length>0?n("select-workspace"):(l.repositories||[]).length>0?n("no-workspaces"):window.location.href="/connect-repos"}catch(e){if(e instanceof TypeError&&e.message.includes("Failed to fetch")){if(b){console.error("Cloud mode enforced but network request failed:",e),v("Cloud mode enforced but failed to connect to server. Is the cloud server running?"),n("error");return}y(!1),n("local");return}console.error("Init error:",e),v(e instanceof Error?e.message:"Failed to initialize"),n("error")}})()},[]);let F=(0,s.useCallback)(e=>{if(!e.publicUrl){v("Workspace has no public URL"),n("error");return}h(e),n("connecting"),(0,l.hc)(e.id);let t=new URL(e.publicUrl),r="https:"===t.protocol?"wss:":"ws:";w("".concat(r,"//").concat(t.host,"/ws")),n("connected")},[]),P=(0,s.useCallback)(async e=>{v(null);try{let t={"Content-Type":"application/json"};k&&(t["X-CSRF-Token"]=k);let r=await fetch("/api/workspaces/quick",{method:"POST",credentials:"include",headers:t,body:JSON.stringify({repositoryFullName:e})}),s=await r.json();if(!r.ok)throw Error(s.error||"Failed to create workspace");let a=Date.now();L({workspaceId:s.workspaceId,workspaceName:e.split("/")[1]||e,stage:null,startedAt:a}),n("provisioning");let i=async e=>{let t=0;for(;t<150;){var r;let s=await fetch("/api/workspaces/".concat(e,"/status"),{credentials:"include"}),a=await s.json();if((null===(r=a.provisioning)||void 0===r?void 0:r.stage)&&L(e=>e?{...e,stage:a.provisioning.stage}:null),"running"===a.status){let t=await fetch("/api/workspaces/".concat(e),{credentials:"include"}),r=await t.json();if(r.publicUrl){L(null),h(r),n("connect-provider");return}}else if("error"===a.status){let e=a.errorMessage||"Workspace provisioning failed";throw Error(e)}await new Promise(e=>setTimeout(e,2e3)),++t%15==0&&console.log("[workspace] Still provisioning... (".concat(Math.floor(2e3*t/1e3),"s elapsed)"))}throw Error("Workspace provisioning timed out after 5 minutes. Please try again or contact support.")};await i(s.workspaceId)}catch(e){console.error("Create workspace error:",e),L(null),v(e instanceof Error?e.message:"Failed to create workspace"),n("no-workspaces")}},[F,k]),O=(0,s.useCallback)(e=>{if(u){if("anthropic"===e.id){window.location.href="/providers/setup/claude?workspace=".concat(u.id);return}I(e.id)}},[u]),A=(0,s.useCallback)(()=>{u&&(I(null),F(u))},[u,F]),T=(0,s.useCallback)(()=>{I(null)},[]),W=(0,s.useCallback)(async e=>{n("loading"),v(null);try{let n={};k&&(n["X-CSRF-Token"]=k);let t=await fetch("/api/workspaces/".concat(e.id,"/restart"),{method:"POST",credentials:"include",headers:n});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to start workspace")}let r=0;for(;r<60;){let n=await fetch("/api/workspaces/".concat(e.id,"/status"),{credentials:"include"}),t=await n.json();if("running"===t.status){let n=await fetch("/api/workspaces/".concat(e.id),{credentials:"include"}),t=await n.json();if(t.publicUrl){F({...e,...t});return}}await new Promise(e=>setTimeout(e,2e3)),r++}throw Error("Workspace start timed out")}catch(e){console.error("Start workspace error:",e),v(e instanceof Error?e.message:"Failed to start workspace"),n("select-workspace")}},[F,k]);return"loading"===e?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:"Loading..."})]})}):"local"===e?(0,r.jsx)(a.g,{}):"connected"===e&&f?(0,r.jsx)(i.TI,{cloudMode:!0,children:(0,r.jsx)(a.g,{wsUrl:f})}):"connecting"===e?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsxs)("p",{className:"mt-4 text-white font-medium",children:["Connecting to ",null==u?void 0:u.name,"..."]}),(0,r.jsx)("p",{className:"mt-2 text-text-muted text-sm",children:null==u?void 0:u.publicUrl})]})}):"provisioning"===e&&M?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,r.jsx)("div",{className:"w-full max-w-xl",children:(0,r.jsx)(m,{isProvisioning:!0,currentStage:M.stage,workspaceName:M.workspaceName,error:j,onCancel:()=>{L(null),n("no-workspaces")}})})}):"error"===e?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center p-4",children:(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-8 max-w-md w-full text-center",children:[(0,r.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-error/20 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-error",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Something went wrong"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:j}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"w-full py-3 px-4 bg-bg-tertiary border border-border-subtle rounded-xl text-white font-medium hover:bg-bg-hover transition-colors",children:"Try Again"})]})}):"connect-provider"===e&&u?(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex flex-col items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"fixed inset-0 opacity-10 pointer-events-none",children:(0,r.jsx)("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(0, 217, 255, 0.1) 1px, transparent 1px)",backgroundSize:"50px 50px"}})}),(0,r.jsxs)("div",{className:"relative z-10 w-full max-w-xl",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center mb-8",children:[(0,r.jsx)(o.K7,{size:48,withGlow:!0}),(0,r.jsx)("h1",{className:"mt-4 text-2xl font-bold text-white",children:"Connect AI Provider"}),(0,r.jsxs)("p",{className:"mt-2 text-text-muted text-center",children:["Your workspace ",(0,r.jsx)("span",{className:"text-white",children:u.name})," is ready!",(0,r.jsx)("br",{}),"Connect an AI provider to start using agents."]})]}),S&&(()=>{let e=g.find(e=>e.id===S);return e?(0,r.jsxs)("div",{className:"mb-6 bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)(c.j,{provider:{id:e.id,name:e.name,displayName:e.displayName,color:e.color,requiresUrlCopy:e.requiresUrlCopy,supportsDeviceFlow:e.supportsDeviceFlow},workspaceId:u.id,csrfToken:k||void 0,onSuccess:()=>{E(n=>[...new Set([...n,e.id])]),I(null)},onCancel:()=>{I(null)},onError:()=>{I(null)}}),(0,r.jsxs)("div",{className:"mt-4 pt-4 border-t border-border-subtle space-y-3",children:[(0,r.jsx)("button",{onClick:T,className:"w-full py-3 px-4 bg-bg-tertiary border border-border-subtle text-white rounded-xl text-center hover:border-accent-cyan/50 transition-colors",children:"Connect Another Provider"}),(0,r.jsx)("button",{onClick:A,className:"w-full py-3 px-4 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl text-center hover:shadow-glow-cyan transition-all",children:"Continue to Dashboard"})]})]}):null})(),!S&&(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white mb-4",children:"Choose an AI Provider"}),(0,r.jsx)("div",{className:"space-y-3",children:g.map(e=>(0,r.jsx)("div",{children:"anthropic"===e.id?(0,r.jsxs)("div",{className:"p-4 bg-bg-tertiary rounded-xl border space-y-4 ".concat(z.includes(e.id)?"border-green-500/50":"border-border-subtle"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold flex-shrink-0 relative",style:{backgroundColor:e.color},children:[e.displayName[0],z.includes(e.id)&&(0,r.jsx)("div",{className:"absolute -top-1 -right-1 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-white font-medium",children:e.displayName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.name})]}),z.includes(e.id)&&(0,r.jsx)("span",{className:"text-green-400 text-sm font-medium",children:"Connected"})]}),!z.includes(e.id)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"p-3 bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-accent-cyan font-medium mb-1",children:"Interactive terminal setup"}),(0,r.jsx)("p",{className:"text-xs text-accent-cyan/80",children:"Connect Claude using an interactive terminal. You'll see the Claude CLI start up and can complete the OAuth login directly in the terminal."})]}),(0,r.jsxs)("button",{onClick:()=>O(e),className:"w-full flex items-center justify-center gap-2 p-3 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),"Connect with Claude"]}),(0,r.jsx)("button",{onClick:()=>I(e.id),className:"w-full text-center text-xs text-text-muted hover:text-white transition-colors",children:"Having issues? Try the popup-based login instead"})]})]}):"codex"===e.id?(0,r.jsxs)("div",{className:"p-4 bg-bg-tertiary rounded-xl border space-y-4 ".concat(z.includes(e.id)||z.includes("openai")?"border-green-500/50":"border-border-subtle"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold flex-shrink-0 relative",style:{backgroundColor:e.color},children:[e.displayName[0],(z.includes(e.id)||z.includes("openai"))&&(0,r.jsx)("div",{className:"absolute -top-1 -right-1 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-white font-medium",children:e.displayName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.name})]}),(z.includes(e.id)||z.includes("openai"))&&(0,r.jsx)("span",{className:"text-green-400 text-sm font-medium",children:"Connected"})]}),!(z.includes(e.id)||z.includes("openai"))&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"p-3 bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-accent-cyan font-medium mb-1",children:"CLI-assisted authentication"}),(0,r.jsx)("p",{className:"text-xs text-accent-cyan/80",children:"Codex auth uses a CLI command to capture the OAuth callback locally. Click the button below and we'll show you a command with a unique session token to run in your terminal before signing in with OpenAI."})]}),(0,r.jsxs)("button",{onClick:()=>O(e),className:"w-full flex items-center justify-center gap-2 p-3 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),"Connect with Codex"]})]})]}):(0,r.jsxs)("button",{onClick:()=>O(e),className:"w-full flex items-center gap-3 p-4 bg-bg-tertiary rounded-xl border transition-colors text-left ".concat(z.includes(e.id)?"border-green-500/50":"border-border-subtle hover:border-accent-cyan/50"),children:[(0,r.jsxs)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold flex-shrink-0 relative",style:{backgroundColor:e.color},children:[e.displayName[0],z.includes(e.id)&&(0,r.jsx)("div",{className:"absolute -top-1 -right-1 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-white font-medium",children:e.displayName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.name})]}),z.includes(e.id)?(0,r.jsx)("span",{className:"text-green-400 text-sm font-medium",children:"Connected"}):(0,r.jsx)("svg",{className:"w-5 h-5 text-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})},e.id))})]}),(0,r.jsx)("div",{className:"mt-6 text-center",children:(0,r.jsx)("button",{onClick:A,className:"text-text-muted hover:text-white transition-colors text-sm",children:"Skip for now - I'll connect later"})})]})]}):(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex flex-col items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"fixed inset-0 opacity-10 pointer-events-none",children:(0,r.jsx)("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(0, 217, 255, 0.1) 1px, transparent 1px)",backgroundSize:"50px 50px"}})}),(0,r.jsxs)("div",{className:"relative z-10 w-full max-w-2xl",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center mb-8",children:[(0,r.jsx)(o.K7,{size:48,withGlow:!0}),(0,r.jsx)("h1",{className:"mt-4 text-2xl font-bold text-white",children:"Agent Relay"}),(0,r.jsx)("p",{className:"mt-2 text-text-muted",children:"no-workspaces"===e?"Create a workspace to get started":"Select a workspace"})]}),j&&(0,r.jsx)("div",{className:"mb-4 p-4 bg-error/10 border border-error/20 rounded-xl",children:(0,r.jsx)("p",{className:"text-error",children:j})}),"select-workspace"===e&&t.length>0&&(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white mb-4",children:"Your Workspaces"}),(0,r.jsx)("div",{className:"space-y-3",children:t.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 bg-bg-tertiary rounded-xl border border-border-subtle hover:border-accent-cyan/50 transition-colors",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full ".concat("running"===e.status?"bg-success":"provisioning"===e.status?"bg-warning animate-pulse":"error"===e.status?"bg-error":"bg-gray-500")}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-medium text-white",children:e.name}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"running"===e.status?"Running":"provisioning"===e.status?"Starting...":"stopped"===e.status?"Stopped":"Error"})]})]}),(0,r.jsx)("div",{children:"running"===e.status&&e.publicUrl?(0,r.jsx)("button",{onClick:()=>F(e),className:"py-2 px-4 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-lg hover:shadow-glow-cyan transition-all",children:"Connect"}):"stopped"===e.status?(0,r.jsx)("button",{onClick:()=>W(e),className:"py-2 px-4 bg-bg-card border border-border-subtle rounded-lg text-white hover:border-accent-cyan/50 transition-colors",children:"Start"}):"provisioning"===e.status?(0,r.jsx)("span",{className:"text-text-muted text-sm",children:"Starting..."}):(0,r.jsx)("span",{className:"text-error text-sm",children:"Failed"})})]},e.id))}),p.length>0&&(0,r.jsxs)("div",{className:"mt-6 pt-6 border-t border-border-subtle",children:[(0,r.jsx)("p",{className:"text-text-muted text-sm mb-3",children:"Or create a new workspace:"}),(0,r.jsx)("div",{className:"flex gap-2 flex-wrap",children:p.slice(0,3).map(e=>(0,r.jsxs)("button",{onClick:()=>P(e.fullName),className:"py-2 px-3 bg-bg-card border border-border-subtle rounded-lg text-sm text-text-muted hover:text-white hover:border-accent-cyan/50 transition-colors",children:["+ ",e.fullName.split("/")[1]]},e.id))})]})]}),"no-workspaces"===e&&(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white mb-4",children:"Create Your First Workspace"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:"Select a repository to create a workspace where agents can work on your code."}),p.length>0?(0,r.jsx)("div",{className:"space-y-3",children:p.map(e=>(0,r.jsxs)("button",{onClick:()=>P(e.fullName),className:"w-full flex items-center gap-3 p-4 bg-bg-tertiary rounded-xl border border-border-subtle hover:border-accent-cyan/50 transition-colors text-left",children:[(0,r.jsx)("svg",{className:"w-5 h-5 text-text-muted flex-shrink-0",fill:"currentColor",viewBox:"0 0 16 16",children:(0,r.jsx)("path",{d:"M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8z"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-white font-medium truncate",children:e.fullName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.isPrivate?"Private":"Public"})]}),(0,r.jsx)("svg",{className:"w-5 h-5 text-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},e.id))}):(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("p",{className:"text-text-muted mb-4",children:"No repositories connected yet."}),(0,r.jsxs)("a",{href:"/connect-repos",className:"inline-flex items-center gap-2 py-3 px-6 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:[(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Connect GitHub"]})]})]}),(0,r.jsxs)("div",{className:"mt-6 flex justify-center gap-4 text-sm",children:[(0,r.jsx)("a",{href:"/connect-repos",className:"text-text-muted hover:text-white transition-colors",children:"Manage Repositories"}),(0,r.jsx)("span",{className:"text-text-muted",children:"\xb7"}),(0,r.jsx)("button",{onClick:async()=>{let e={};k&&(e["X-CSRF-Token"]=k),await fetch("/api/auth/logout",{method:"POST",credentials:"include",headers:e}),window.location.href="/login"},className:"text-text-muted hover:text-white transition-colors",children:"Sign Out"})]})]})]})}}},function(e){e.O(0,[30,532,891,116,83,899,971,117,744],function(){return e(e.s=3561)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[191],{5346:function(e,n,t){Promise.resolve().then(t.bind(t,3330))},3330:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return f}});var r=t(7437),s=t(2265),a=t(5899),i=t(5372),o=t(6272),l=t(9116),c=t(3083);let d=[{id:"creating",name:"Initialize",description:"Creating workspace container",estimatedSeconds:5,icon:"◈"},{id:"networking",name:"Network",description:"Configuring DNS & IP allocation",estimatedSeconds:8,icon:"◇"},{id:"secrets",name:"Secure",description:"Encrypting credentials",estimatedSeconds:3,icon:"◆"},{id:"machine",name:"Deploy",description:"Launching cloud instance",estimatedSeconds:25,icon:"▣"},{id:"booting",name:"Boot",description:"Starting relay services",estimatedSeconds:20,icon:"▢"},{id:"health",name:"Verify",description:"Running health checks",estimatedSeconds:15,icon:"◉"}],p=["> Establishing secure connection...","> Allocating compute resources...","> Configuring agent protocols...","> Initializing relay daemon...","> Syncing workspace state...","> Warming up inference engine...","> Connecting to neural mesh...","> Deploying agent swarm..."];function m(e){let{currentStage:n,isProvisioning:t,workspaceName:a,error:i,onCancel:o}=e,[l,c]=(0,s.useState)(0),[m,h]=(0,s.useState)([]),[g,b]=(0,s.useState)(!0);(0,s.useEffect)(()=>{if(!t){c(0);return}let e=setInterval(()=>{c(e=>e+1)},1e3);return()=>clearInterval(e)},[t]),(0,s.useEffect)(()=>{let e=setInterval(()=>{b(e=>!e)},530);return()=>clearInterval(e)},[]),(0,s.useEffect)(()=>{if(!t){h([]);return}let e=()=>{let e=p[Math.floor(Math.random()*p.length)];h(n=>[...n.slice(-4),e])};e();let n=setInterval(e,3500);return()=>clearInterval(n)},[t]);let f=(0,s.useMemo)(()=>{if(n){let e=d.findIndex(e=>e.id===n);return e>=0?e:0}let e=0;for(let n=0;n<d.length;n++)if(l<(e+=d[n].estimatedSeconds))return n;return d.length-1},[n,l]),w=(0,s.useMemo)(()=>d.reduce((e,n)=>e+n.estimatedSeconds,0),[]),j=(0,s.useMemo)(()=>Math.min(95,Math.round(l/w*100)),[l,w]);return i?(0,r.jsxs)("div",{className:"prov-container prov-error",children:[(0,r.jsx)("div",{className:"error-glitch",children:(0,r.jsx)("span",{className:"error-icon",children:"✕"})}),(0,r.jsx)("h3",{className:"error-title",children:"PROVISIONING FAILED"}),(0,r.jsx)("p",{className:"error-message",children:i}),o&&(0,r.jsx)("button",{onClick:o,className:"retry-btn",children:(0,r.jsx)("span",{children:"RETRY"})}),(0,r.jsx)("style",{children:u})]}):(0,r.jsxs)("div",{className:"prov-container",children:[(0,r.jsx)("div",{className:"ambient-glow"}),(0,r.jsx)("div",{className:"scan-line"}),(0,r.jsxs)("header",{className:"prov-header",children:[(0,r.jsx)("div",{className:"header-badge",children:"PROVISIONING"}),(0,r.jsx)("h1",{className:"header-title",children:a||"Workspace"}),(0,r.jsxs)("div",{className:"header-meta",children:[(0,r.jsx)("span",{className:"meta-time",children:(e=>{let n=Math.floor(e/60),t=e%60;return n>0?"".concat(n,":").concat(t.toString().padStart(2,"0")):"0:".concat(t.toString().padStart(2,"0"))})(l)}),(0,r.jsx)("span",{className:"meta-sep",children:"•"}),(0,r.jsxs)("span",{className:"meta-percent",children:[j,"%"]})]})]}),(0,r.jsxs)("div",{className:"progress-track",children:[(0,r.jsx)("div",{className:"progress-fill",style:{width:"".concat(j,"%")}}),(0,r.jsx)("div",{className:"progress-glow",style:{left:"".concat(j,"%")}})]}),(0,r.jsx)("div",{className:"stages-timeline",children:d.map((e,n)=>{let t=n<f,s=n===f,a=n>f;return(0,r.jsxs)("div",{className:"stage-row ".concat(t?"completed":""," ").concat(s?"current":""," ").concat(a?"pending":""),children:[n>0&&(0,r.jsxs)("div",{className:"stage-connector ".concat(t?"active":""),children:[(0,r.jsx)("div",{className:"connector-line"}),t&&(0,r.jsx)("div",{className:"connector-pulse"})]}),(0,r.jsxs)("div",{className:"stage-node",children:[(0,r.jsx)("span",{className:"node-icon",children:e.icon}),s&&(0,r.jsx)("div",{className:"node-ring"})]}),(0,r.jsxs)("div",{className:"stage-content",children:[(0,r.jsx)("span",{className:"stage-name",children:e.name}),s&&(0,r.jsx)("span",{className:"stage-desc",children:e.description})]}),(0,r.jsxs)("div",{className:"stage-status",children:[t&&(0,r.jsx)("span",{className:"status-done",children:"DONE"}),s&&(0,r.jsx)("span",{className:"status-active",children:"ACTIVE"}),a&&(0,r.jsxs)("span",{className:"status-wait",children:["~",e.estimatedSeconds,"s"]})]})]},e.id)})}),(0,r.jsxs)("div",{className:"terminal-window",children:[(0,r.jsxs)("div",{className:"terminal-header",children:[(0,r.jsx)("span",{className:"terminal-dot red"}),(0,r.jsx)("span",{className:"terminal-dot yellow"}),(0,r.jsx)("span",{className:"terminal-dot green"}),(0,r.jsx)("span",{className:"terminal-title",children:"agent-relay"})]}),(0,r.jsxs)("div",{className:"terminal-body",children:[m.map((e,n)=>(0,r.jsx)("div",{className:"terminal-line",style:{animationDelay:"".concat(.1*n,"s")},children:e},n)),(0,r.jsxs)("div",{className:"terminal-cursor",children:[(0,r.jsx)("span",{className:"cursor-prompt",children:"$"}),(0,r.jsx)("span",{className:"cursor-block ".concat(g?"visible":""),children:"_"})]})]})]}),o&&(0,r.jsx)("button",{onClick:o,className:"cancel-btn",children:"Cancel"}),(0,r.jsx)("style",{children:x})]})}let x="\n .prov-container {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 40px 32px;\n background: linear-gradient(145deg, rgba(10, 15, 25, 0.95) 0%, rgba(5, 10, 18, 0.98) 100%);\n border: 1px solid rgba(6, 182, 212, 0.15);\n border-radius: 16px;\n overflow: hidden;\n font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;\n }\n\n /* Ambient effects */\n .ambient-glow {\n position: absolute;\n top: -100px;\n left: 50%;\n transform: translateX(-50%);\n width: 300px;\n height: 200px;\n background: radial-gradient(ellipse, rgba(6, 182, 212, 0.12) 0%, transparent 70%);\n pointer-events: none;\n }\n\n .scan-line {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 2px;\n background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.4), transparent);\n animation: scanMove 3s ease-in-out infinite;\n pointer-events: none;\n }\n\n @keyframes scanMove {\n 0%, 100% { top: 0; opacity: 0.5; }\n 50% { top: 100%; opacity: 0.2; }\n }\n\n /* Header */\n .prov-header {\n text-align: center;\n position: relative;\n z-index: 1;\n }\n\n .header-badge {\n display: inline-block;\n padding: 4px 12px;\n background: rgba(6, 182, 212, 0.1);\n border: 1px solid rgba(6, 182, 212, 0.3);\n border-radius: 4px;\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 2px;\n color: #06b6d4;\n margin-bottom: 12px;\n }\n\n .header-title {\n font-size: 22px;\n font-weight: 600;\n color: #f1f5f9;\n margin: 0 0 8px 0;\n letter-spacing: -0.5px;\n }\n\n .header-meta {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n font-size: 13px;\n color: #64748b;\n }\n\n .meta-time {\n font-variant-numeric: tabular-nums;\n }\n\n .meta-percent {\n color: #06b6d4;\n font-weight: 500;\n }\n\n .meta-sep {\n opacity: 0.3;\n }\n\n /* Progress bar */\n .progress-track {\n position: relative;\n height: 4px;\n background: rgba(100, 116, 139, 0.2);\n border-radius: 2px;\n overflow: visible;\n }\n\n .progress-fill {\n height: 100%;\n background: linear-gradient(90deg, #0891b2, #06b6d4, #22d3ee);\n border-radius: 2px;\n transition: width 0.5s ease;\n }\n\n .progress-glow {\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 8px;\n height: 8px;\n background: #22d3ee;\n border-radius: 50%;\n box-shadow: 0 0 16px rgba(34, 211, 238, 0.6);\n transition: left 0.5s ease;\n }\n\n /* Stages */\n .stages-timeline {\n display: flex;\n flex-direction: column;\n gap: 0;\n padding: 16px 0;\n }\n\n .stage-row {\n display: grid;\n grid-template-columns: 40px 1fr auto;\n align-items: center;\n gap: 12px;\n padding: 10px 0;\n position: relative;\n }\n\n .stage-connector {\n position: absolute;\n left: 19px;\n top: -10px;\n width: 2px;\n height: 20px;\n }\n\n .connector-line {\n width: 100%;\n height: 100%;\n background: rgba(100, 116, 139, 0.3);\n transition: background 0.3s ease;\n }\n\n .stage-connector.active .connector-line {\n background: linear-gradient(180deg, #06b6d4, rgba(6, 182, 212, 0.3));\n }\n\n .connector-pulse {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(180deg, rgba(34, 211, 238, 0.8), transparent);\n animation: pulseLine 1.5s ease-out infinite;\n }\n\n @keyframes pulseLine {\n 0% { opacity: 1; transform: translateY(-100%); }\n 100% { opacity: 0; transform: translateY(100%); }\n }\n\n .stage-node {\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n }\n\n .node-icon {\n font-size: 18px;\n color: #475569;\n transition: all 0.3s ease;\n }\n\n .stage-row.completed .node-icon {\n color: #06b6d4;\n }\n\n .stage-row.current .node-icon {\n color: #22d3ee;\n text-shadow: 0 0 12px rgba(34, 211, 238, 0.5);\n }\n\n .node-ring {\n position: absolute;\n inset: 4px;\n border: 2px solid rgba(34, 211, 238, 0.4);\n border-radius: 50%;\n animation: ringPulse 2s ease-in-out infinite;\n }\n\n @keyframes ringPulse {\n 0%, 100% { transform: scale(1); opacity: 1; }\n 50% { transform: scale(1.2); opacity: 0.5; }\n }\n\n .stage-content {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n }\n\n .stage-name {\n font-size: 13px;\n font-weight: 500;\n color: #64748b;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n transition: color 0.3s ease;\n }\n\n .stage-row.completed .stage-name {\n color: #475569;\n }\n\n .stage-row.current .stage-name {\n color: #f1f5f9;\n }\n\n .stage-desc {\n font-size: 11px;\n color: #64748b;\n animation: fadeSlideIn 0.3s ease;\n }\n\n @keyframes fadeSlideIn {\n from { opacity: 0; transform: translateX(-8px); }\n to { opacity: 1; transform: translateX(0); }\n }\n\n .stage-status {\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 1px;\n }\n\n .status-done {\n color: #06b6d4;\n }\n\n .status-active {\n color: #22d3ee;\n animation: blink 1s ease-in-out infinite;\n }\n\n @keyframes blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n\n .status-wait {\n color: #475569;\n font-variant-numeric: tabular-nums;\n }\n\n /* Terminal */\n .terminal-window {\n background: rgba(0, 0, 0, 0.4);\n border: 1px solid rgba(100, 116, 139, 0.2);\n border-radius: 8px;\n overflow: hidden;\n }\n\n .terminal-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: rgba(30, 41, 59, 0.5);\n border-bottom: 1px solid rgba(100, 116, 139, 0.15);\n }\n\n .terminal-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n }\n\n .terminal-dot.red { background: #ef4444; }\n .terminal-dot.yellow { background: #eab308; }\n .terminal-dot.green { background: #22c55e; }\n\n .terminal-title {\n margin-left: auto;\n font-size: 11px;\n color: #64748b;\n }\n\n .terminal-body {\n padding: 12px;\n min-height: 100px;\n }\n\n .terminal-line {\n font-size: 12px;\n color: #94a3b8;\n padding: 2px 0;\n animation: typeIn 0.3s ease;\n }\n\n @keyframes typeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n .terminal-cursor {\n display: flex;\n align-items: center;\n gap: 4px;\n margin-top: 8px;\n }\n\n .cursor-prompt {\n color: #06b6d4;\n font-weight: 600;\n }\n\n .cursor-block {\n color: #22d3ee;\n opacity: 0;\n transition: opacity 0.1s;\n }\n\n .cursor-block.visible {\n opacity: 1;\n }\n\n /* Cancel button */\n .cancel-btn {\n align-self: center;\n padding: 8px 20px;\n background: transparent;\n border: 1px solid rgba(100, 116, 139, 0.3);\n border-radius: 6px;\n color: #64748b;\n font-family: inherit;\n font-size: 12px;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .cancel-btn:hover {\n border-color: rgba(239, 68, 68, 0.5);\n color: #ef4444;\n }\n",u="\n .prov-container.prov-error {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 16px;\n padding: 48px 32px;\n background: linear-gradient(145deg, rgba(25, 10, 10, 0.95) 0%, rgba(15, 5, 8, 0.98) 100%);\n border: 1px solid rgba(239, 68, 68, 0.2);\n border-radius: 16px;\n text-align: center;\n font-family: 'SF Mono', 'JetBrains Mono', monospace;\n }\n\n .error-glitch {\n position: relative;\n width: 64px;\n height: 64px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(239, 68, 68, 0.1);\n border: 1px solid rgba(239, 68, 68, 0.3);\n border-radius: 12px;\n }\n\n .error-icon {\n font-size: 28px;\n color: #ef4444;\n animation: glitch 0.3s ease infinite;\n }\n\n @keyframes glitch {\n 0%, 100% { transform: translate(0); }\n 25% { transform: translate(-2px, 1px); }\n 50% { transform: translate(2px, -1px); }\n 75% { transform: translate(-1px, -1px); }\n }\n\n .error-title {\n font-size: 14px;\n font-weight: 600;\n letter-spacing: 2px;\n color: #ef4444;\n margin: 0;\n }\n\n .error-message {\n font-size: 13px;\n color: #94a3b8;\n max-width: 350px;\n margin: 0;\n line-height: 1.5;\n }\n\n .retry-btn {\n margin-top: 8px;\n padding: 10px 28px;\n background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);\n border: 1px solid rgba(239, 68, 68, 0.4);\n border-radius: 6px;\n color: #ef4444;\n font-family: inherit;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 1px;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .retry-btn:hover {\n background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.3) 100%);\n border-color: rgba(239, 68, 68, 0.6);\n transform: translateY(-1px);\n }\n";var h=t(257);let g=[{id:"anthropic",name:"Anthropic",displayName:"Claude",color:"#D97757",cliCommand:"claude"},{id:"codex",name:"OpenAI",displayName:"Codex",color:"#10A37F",cliCommand:"codex login",supportsDeviceFlow:!0,requiresUrlCopy:!0},{id:"opencode",name:"OpenCode",displayName:"OpenCode",color:"#00D4AA",cliCommand:"opencode"},{id:"droid",name:"Factory",displayName:"Droid",color:"#6366F1",cliCommand:"droid"}],b="true"===h.env.NEXT_PUBLIC_FORCE_CLOUD_MODE;function f(){let[e,n]=(0,s.useState)("loading"),[t,d]=(0,s.useState)([]),[p,x]=(0,s.useState)([]),[u,h]=(0,s.useState)(null),[f,w]=(0,s.useState)(void 0),[j,v]=(0,s.useState)(null),[N,y]=(0,s.useState)(b),[k,C]=(0,s.useState)(null),[S,I]=(0,s.useState)(null),[M,L]=(0,s.useState)(null),[z,E]=(0,s.useState)([]);(0,s.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/auth/session",{credentials:"include"});if(404===e.status){if(b)throw Error("Cloud mode enforced but session endpoint returned 404. Is the cloud server running?");y(!1),n("local");return}let t=e.headers.get("X-CSRF-Token");t&&C(t);let r=await e.json();if(!r.authenticated){window.location.href="/login";return}y(!0);let s={openai:"codex"};if(r.connectedProviders){let e=[];r.connectedProviders.forEach(n=>{e.push(n.provider);let t=s[n.provider];t&&e.push(t)}),E(e)}let[a,i]=await Promise.all([fetch("/api/workspaces/accessible",{credentials:"include"}),fetch("/api/github-app/repos",{credentials:"include"})]);if(!a.ok){if(401===a.status){window.location.href="/login";return}throw Error("Failed to fetch workspaces")}let o=await a.json(),l=i.ok?await i.json():{repositories:[]};d(o.workspaces||[]),x(l.repositories||[]);let c=(o.workspaces||[]).filter(e=>"running"===e.status&&e.publicUrl);1===c.length?F(c[0]):c.length>1?n("select-workspace"):(o.workspaces||[]).length>0?n("select-workspace"):(l.repositories||[]).length>0?n("no-workspaces"):window.location.href="/connect-repos"}catch(e){if(e instanceof TypeError&&e.message.includes("Failed to fetch")){if(b){console.error("Cloud mode enforced but network request failed:",e),v("Cloud mode enforced but failed to connect to server. Is the cloud server running?"),n("error");return}y(!1),n("local");return}console.error("Init error:",e),v(e instanceof Error?e.message:"Failed to initialize"),n("error")}})()},[]);let F=(0,s.useCallback)(e=>{if(!e.publicUrl){v("Workspace has no public URL"),n("error");return}h(e),n("connecting"),(0,l.hc)(e.id);let t=new URL(e.publicUrl),r="https:"===t.protocol?"wss:":"ws:";w("".concat(r,"//").concat(t.host,"/ws")),n("connected")},[]),P=(0,s.useCallback)(async e=>{v(null);try{let t={"Content-Type":"application/json"};k&&(t["X-CSRF-Token"]=k);let r=await fetch("/api/workspaces/quick",{method:"POST",credentials:"include",headers:t,body:JSON.stringify({repositoryFullName:e})}),s=await r.json();if(!r.ok)throw Error(s.error||"Failed to create workspace");let a=Date.now();L({workspaceId:s.workspaceId,workspaceName:e.split("/")[1]||e,stage:null,startedAt:a}),n("provisioning");let i=async e=>{let t=0;for(;t<150;){var r;let s=await fetch("/api/workspaces/".concat(e,"/status"),{credentials:"include"}),a=await s.json();if((null===(r=a.provisioning)||void 0===r?void 0:r.stage)&&L(e=>e?{...e,stage:a.provisioning.stage}:null),"running"===a.status){let t=await fetch("/api/workspaces/".concat(e),{credentials:"include"}),r=await t.json();if(r.publicUrl){L(null),h(r),n("connect-provider");return}}else if("error"===a.status){let e=a.errorMessage||"Workspace provisioning failed";throw Error(e)}await new Promise(e=>setTimeout(e,2e3)),++t%15==0&&console.log("[workspace] Still provisioning... (".concat(Math.floor(2e3*t/1e3),"s elapsed)"))}throw Error("Workspace provisioning timed out after 5 minutes. Please try again or contact support.")};await i(s.workspaceId)}catch(e){console.error("Create workspace error:",e),L(null),v(e instanceof Error?e.message:"Failed to create workspace"),n("no-workspaces")}},[F,k]),O=(0,s.useCallback)(e=>{if(u){if("anthropic"===e.id){window.location.href="/providers/setup/claude?workspace=".concat(u.id);return}I(e.id)}},[u]),A=(0,s.useCallback)(()=>{u&&(I(null),F(u))},[u,F]),T=(0,s.useCallback)(()=>{I(null)},[]),W=(0,s.useCallback)(async e=>{n("loading"),v(null);try{let n={};k&&(n["X-CSRF-Token"]=k);let t=await fetch("/api/workspaces/".concat(e.id,"/restart"),{method:"POST",credentials:"include",headers:n});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to start workspace")}let r=0;for(;r<60;){let n=await fetch("/api/workspaces/".concat(e.id,"/status"),{credentials:"include"}),t=await n.json();if("running"===t.status){let n=await fetch("/api/workspaces/".concat(e.id),{credentials:"include"}),t=await n.json();if(t.publicUrl){F({...e,...t});return}}await new Promise(e=>setTimeout(e,2e3)),r++}throw Error("Workspace start timed out")}catch(e){console.error("Start workspace error:",e),v(e instanceof Error?e.message:"Failed to start workspace"),n("select-workspace")}},[F,k]);return"loading"===e?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:"Loading..."})]})}):"local"===e?(0,r.jsx)(a.g,{}):"connected"===e&&f?(0,r.jsx)(i.TI,{cloudMode:!0,children:(0,r.jsx)(a.g,{wsUrl:f})}):"connecting"===e?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsxs)("p",{className:"mt-4 text-white font-medium",children:["Connecting to ",null==u?void 0:u.name,"..."]}),(0,r.jsx)("p",{className:"mt-2 text-text-muted text-sm",children:null==u?void 0:u.publicUrl})]})}):"provisioning"===e&&M?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,r.jsx)("div",{className:"w-full max-w-xl",children:(0,r.jsx)(m,{isProvisioning:!0,currentStage:M.stage,workspaceName:M.workspaceName,error:j,onCancel:()=>{L(null),n("no-workspaces")}})})}):"error"===e?(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center p-4",children:(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-8 max-w-md w-full text-center",children:[(0,r.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-error/20 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-error",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Something went wrong"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:j}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"w-full py-3 px-4 bg-bg-tertiary border border-border-subtle rounded-xl text-white font-medium hover:bg-bg-hover transition-colors",children:"Try Again"})]})}):"connect-provider"===e&&u?(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex flex-col items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"fixed inset-0 opacity-10 pointer-events-none",children:(0,r.jsx)("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(0, 217, 255, 0.1) 1px, transparent 1px)",backgroundSize:"50px 50px"}})}),(0,r.jsxs)("div",{className:"relative z-10 w-full max-w-xl",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center mb-8",children:[(0,r.jsx)(o.K7,{size:48,withGlow:!0}),(0,r.jsx)("h1",{className:"mt-4 text-2xl font-bold text-white",children:"Connect AI Provider"}),(0,r.jsxs)("p",{className:"mt-2 text-text-muted text-center",children:["Your workspace ",(0,r.jsx)("span",{className:"text-white",children:u.name})," is ready!",(0,r.jsx)("br",{}),"Connect an AI provider to start using agents."]})]}),S&&(()=>{let e=g.find(e=>e.id===S);return e?(0,r.jsxs)("div",{className:"mb-6 bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)(c.j,{provider:{id:e.id,name:e.name,displayName:e.displayName,color:e.color,requiresUrlCopy:e.requiresUrlCopy,supportsDeviceFlow:e.supportsDeviceFlow},workspaceId:u.id,csrfToken:k||void 0,onSuccess:()=>{E(n=>[...new Set([...n,e.id])]),I(null)},onCancel:()=>{I(null)},onError:()=>{I(null)}}),(0,r.jsxs)("div",{className:"mt-4 pt-4 border-t border-border-subtle space-y-3",children:[(0,r.jsx)("button",{onClick:T,className:"w-full py-3 px-4 bg-bg-tertiary border border-border-subtle text-white rounded-xl text-center hover:border-accent-cyan/50 transition-colors",children:"Connect Another Provider"}),(0,r.jsx)("button",{onClick:A,className:"w-full py-3 px-4 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl text-center hover:shadow-glow-cyan transition-all",children:"Continue to Dashboard"})]})]}):null})(),!S&&(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white mb-4",children:"Choose an AI Provider"}),(0,r.jsx)("div",{className:"space-y-3",children:g.map(e=>(0,r.jsx)("div",{children:"anthropic"===e.id?(0,r.jsxs)("div",{className:"p-4 bg-bg-tertiary rounded-xl border space-y-4 ".concat(z.includes(e.id)?"border-green-500/50":"border-border-subtle"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold flex-shrink-0 relative",style:{backgroundColor:e.color},children:[e.displayName[0],z.includes(e.id)&&(0,r.jsx)("div",{className:"absolute -top-1 -right-1 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-white font-medium",children:e.displayName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.name})]}),z.includes(e.id)&&(0,r.jsx)("span",{className:"text-green-400 text-sm font-medium",children:"Connected"})]}),!z.includes(e.id)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"p-3 bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-accent-cyan font-medium mb-1",children:"Interactive terminal setup"}),(0,r.jsx)("p",{className:"text-xs text-accent-cyan/80",children:"Connect Claude using an interactive terminal. You'll see the Claude CLI start up and can complete the OAuth login directly in the terminal."})]}),(0,r.jsxs)("button",{onClick:()=>O(e),className:"w-full flex items-center justify-center gap-2 p-3 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),"Connect with Claude"]}),(0,r.jsx)("button",{onClick:()=>I(e.id),className:"w-full text-center text-xs text-text-muted hover:text-white transition-colors",children:"Having issues? Try the popup-based login instead"})]})]}):"codex"===e.id?(0,r.jsxs)("div",{className:"p-4 bg-bg-tertiary rounded-xl border space-y-4 ".concat(z.includes(e.id)||z.includes("openai")?"border-green-500/50":"border-border-subtle"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold flex-shrink-0 relative",style:{backgroundColor:e.color},children:[e.displayName[0],(z.includes(e.id)||z.includes("openai"))&&(0,r.jsx)("div",{className:"absolute -top-1 -right-1 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-white font-medium",children:e.displayName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.name})]}),(z.includes(e.id)||z.includes("openai"))&&(0,r.jsx)("span",{className:"text-green-400 text-sm font-medium",children:"Connected"})]}),!(z.includes(e.id)||z.includes("openai"))&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"p-3 bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg",children:[(0,r.jsx)("p",{className:"text-sm text-accent-cyan font-medium mb-1",children:"CLI-assisted authentication"}),(0,r.jsx)("p",{className:"text-xs text-accent-cyan/80",children:"Codex auth uses a CLI command to capture the OAuth callback locally. Click the button below and we'll show you a command with a unique session token to run in your terminal before signing in with OpenAI."})]}),(0,r.jsxs)("button",{onClick:()=>O(e),className:"w-full flex items-center justify-center gap-2 p-3 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),"Connect with Codex"]})]})]}):(0,r.jsxs)("button",{onClick:()=>O(e),className:"w-full flex items-center gap-3 p-4 bg-bg-tertiary rounded-xl border transition-colors text-left ".concat(z.includes(e.id)?"border-green-500/50":"border-border-subtle hover:border-accent-cyan/50"),children:[(0,r.jsxs)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold flex-shrink-0 relative",style:{backgroundColor:e.color},children:[e.displayName[0],z.includes(e.id)&&(0,r.jsx)("div",{className:"absolute -top-1 -right-1 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-white font-medium",children:e.displayName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.name})]}),z.includes(e.id)?(0,r.jsx)("span",{className:"text-green-400 text-sm font-medium",children:"Connected"}):(0,r.jsx)("svg",{className:"w-5 h-5 text-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})},e.id))})]}),(0,r.jsx)("div",{className:"mt-6 text-center",children:(0,r.jsx)("button",{onClick:A,className:"text-text-muted hover:text-white transition-colors text-sm",children:"Skip for now - I'll connect later"})})]})]}):(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex flex-col items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"fixed inset-0 opacity-10 pointer-events-none",children:(0,r.jsx)("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(0, 217, 255, 0.1) 1px, transparent 1px)",backgroundSize:"50px 50px"}})}),(0,r.jsxs)("div",{className:"relative z-10 w-full max-w-2xl",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center mb-8",children:[(0,r.jsx)(o.K7,{size:48,withGlow:!0}),(0,r.jsx)("h1",{className:"mt-4 text-2xl font-bold text-white",children:"Agent Relay"}),(0,r.jsx)("p",{className:"mt-2 text-text-muted",children:"no-workspaces"===e?"Create a workspace to get started":"Select a workspace"})]}),j&&(0,r.jsx)("div",{className:"mb-4 p-4 bg-error/10 border border-error/20 rounded-xl",children:(0,r.jsx)("p",{className:"text-error",children:j})}),"select-workspace"===e&&t.length>0&&(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white mb-4",children:"Your Workspaces"}),(0,r.jsx)("div",{className:"space-y-3",children:t.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 bg-bg-tertiary rounded-xl border border-border-subtle hover:border-accent-cyan/50 transition-colors",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full ".concat("running"===e.status?"bg-success":"provisioning"===e.status?"bg-warning animate-pulse":"error"===e.status?"bg-error":"bg-gray-500")}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-medium text-white",children:e.name}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"running"===e.status?"Running":"provisioning"===e.status?"Starting...":"stopped"===e.status?"Stopped":"Error"})]})]}),(0,r.jsx)("div",{children:"running"===e.status&&e.publicUrl?(0,r.jsx)("button",{onClick:()=>F(e),className:"py-2 px-4 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-lg hover:shadow-glow-cyan transition-all",children:"Connect"}):"stopped"===e.status?(0,r.jsx)("button",{onClick:()=>W(e),className:"py-2 px-4 bg-bg-card border border-border-subtle rounded-lg text-white hover:border-accent-cyan/50 transition-colors",children:"Start"}):"provisioning"===e.status?(0,r.jsx)("span",{className:"text-text-muted text-sm",children:"Starting..."}):(0,r.jsx)("span",{className:"text-error text-sm",children:"Failed"})})]},e.id))}),p.length>0&&(0,r.jsxs)("div",{className:"mt-6 pt-6 border-t border-border-subtle",children:[(0,r.jsx)("p",{className:"text-text-muted text-sm mb-3",children:"Or create a new workspace:"}),(0,r.jsx)("div",{className:"flex gap-2 flex-wrap",children:p.slice(0,3).map(e=>(0,r.jsxs)("button",{onClick:()=>P(e.fullName),className:"py-2 px-3 bg-bg-card border border-border-subtle rounded-lg text-sm text-text-muted hover:text-white hover:border-accent-cyan/50 transition-colors",children:["+ ",e.fullName.split("/")[1]]},e.id))})]})]}),"no-workspaces"===e&&(0,r.jsxs)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white mb-4",children:"Create Your First Workspace"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:"Select a repository to create a workspace where agents can work on your code."}),p.length>0?(0,r.jsx)("div",{className:"space-y-3",children:p.map(e=>(0,r.jsxs)("button",{onClick:()=>P(e.fullName),className:"w-full flex items-center gap-3 p-4 bg-bg-tertiary rounded-xl border border-border-subtle hover:border-accent-cyan/50 transition-colors text-left",children:[(0,r.jsx)("svg",{className:"w-5 h-5 text-text-muted flex-shrink-0",fill:"currentColor",viewBox:"0 0 16 16",children:(0,r.jsx)("path",{d:"M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8z"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-white font-medium truncate",children:e.fullName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.isPrivate?"Private":"Public"})]}),(0,r.jsx)("svg",{className:"w-5 h-5 text-text-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},e.id))}):(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("p",{className:"text-text-muted mb-4",children:"No repositories connected yet."}),(0,r.jsxs)("a",{href:"/connect-repos",className:"inline-flex items-center gap-2 py-3 px-6 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:[(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Connect GitHub"]})]})]}),(0,r.jsxs)("div",{className:"mt-6 flex justify-center gap-4 text-sm",children:[(0,r.jsx)("a",{href:"/connect-repos",className:"text-text-muted hover:text-white transition-colors",children:"Manage Repositories"}),(0,r.jsx)("span",{className:"text-text-muted",children:"\xb7"}),(0,r.jsx)("button",{onClick:async()=>{let e={};k&&(e["X-CSRF-Token"]=k),await fetch("/api/auth/logout",{method:"POST",credentials:"include",headers:e}),window.location.href="/login"},className:"text-text-muted hover:text-white transition-colors",children:"Sign Out"})]})]})]})}}},function(e){e.O(0,[30,532,891,116,83,899,971,117,744],function(){return e(e.s=5346)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[70],{449:function(e,t,s){Promise.resolve().then(s.bind(s,9992))},9992:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return a}});var r=s(7437),n=s(2265),i=s(282),o=s(6272);function a(){let[e,t]=(0,n.useState)("checking"),[s,a]=(0,n.useState)(null),[l,c]=(0,n.useState)([]),[d,x]=(0,n.useState)(null),[h,u]=(0,n.useState)(""),m=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=!0;return(async()=>{try{let s=await fetch("/api/auth/session",{credentials:"include"});if(!(await s.json()).authenticated){window.location.href="/login";return}if(!e)return;let r=await fetch("/api/auth/nango/repo-session",{credentials:"include"}),n=await r.json();if(!e)return;if(!r.ok||!n.sessionToken){if((null==n?void 0:n.sessionExpired)||(null==n?void 0:n.code)==="SESSION_EXPIRED"){window.location.href="/login";return}a("Failed to initialize. Please refresh the page."),t("error");return}m.current=new i.ZP({connectSessionToken:n.sessionToken}),t("ready")}catch(t){e&&(window.location.href="/login")}})(),()=>{e=!1}},[]);let p=async e=>{let t=await fetch("/api/auth/nango/repo-status/".concat(e),{credentials:"include"});if(!t.ok)throw Error("Status not ready");return t.json()},f=async e=>{try{t("polling"),u("Syncing repositories...");let s=Date.now(),r=async()=>{if(Date.now()-s>3e5)throw Error("Connection timed out. Please try again.");try{let s=await p(e);if(s.pendingApproval){t("pending-approval"),x(s.message||"Waiting for organization admin approval");return}if(s.ready&&s.repos){c(s.repos),t("success");return}return await new Promise(e=>setTimeout(e,2e3)),r()}catch(e){return await new Promise(e=>setTimeout(e,2e3)),r()}};await r()}catch(e){console.error("[AUTH] Error:",e),a(e instanceof Error?e.message:"Connection failed"),t("error"),u("")}},g=async()=>{if(!m.current){a("Not ready. Please refresh the page.");return}t("connecting"),a(null),u("Connecting to GitHub...");try{let e=await m.current.auth("github-app-oauth");if(e&&"connectionId"in e)await f(e.connectionId);else throw Error("No connection ID returned")}catch(s){var e;if(console.error("GitHub App auth error:",s),"user_cancelled"===s.type||(null===(e=s.message)||void 0===e?void 0:e.includes("closed"))){u(""),fetch("/api/auth/nango/repo-session",{credentials:"include"}).then(e=>e.json()).then(e=>{e.sessionToken&&(m.current=new i.ZP({connectSessionToken:e.sessionToken}),t("ready"))});return}a(s.message||"Connection failed"),t("error"),u("")}},b=async()=>{a(null),c([]),x(null),u(""),t("checking");try{let e=await fetch("/api/auth/nango/repo-session",{credentials:"include"}),s=await e.json();if(!e.ok||!s.sessionToken){if((null==s?void 0:s.sessionExpired)||(null==s?void 0:s.code)==="SESSION_EXPIRED"){window.location.href="/login";return}a("Failed to initialize. Please refresh the page."),t("error");return}m.current=new i.ZP({connectSessionToken:s.sessionToken}),t("ready")}catch(e){a("Failed to initialize. Please refresh the page."),t("error")}},j=()=>{window.location.href="/app"};if("checking"===e)return(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin mx-auto",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("p",{className:"mt-4 text-text-muted",children:"Loading..."})]})});let w="connecting"===e||"polling"===e;return(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex flex-col items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"fixed inset-0 opacity-10",children:(0,r.jsx)("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(0, 217, 255, 0.1) 1px, transparent 1px)",backgroundSize:"50px 50px"}})}),(0,r.jsxs)("div",{className:"relative z-10 w-full max-w-lg",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center mb-8",children:[(0,r.jsx)(o.K7,{size:48,withGlow:!0}),(0,r.jsx)("h1",{className:"mt-4 text-2xl font-bold text-white",children:"Connect Repositories"}),(0,r.jsx)("p",{className:"mt-2 text-text-muted text-center",children:"Connect your GitHub repositories to enable agent access"})]}),(0,r.jsx)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-8 shadow-xl",children:"success"===e?(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-success/20 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-success",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-4 text-center",children:"Repositories Connected!"}),(0,r.jsx)("div",{className:"max-h-60 overflow-y-auto mb-6 space-y-2",children:l.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-bg-tertiary rounded-lg",children:[(0,r.jsx)("svg",{className:"w-5 h-5 text-text-muted flex-shrink-0",fill:"currentColor",viewBox:"0 0 16 16",children:(0,r.jsx)("path",{d:"M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8z"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-white font-medium truncate",children:e.fullName}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:e.isPrivate?"Private":"Public"})]})]},e.id))}),(0,r.jsx)("button",{onClick:j,className:"w-full py-3 px-4 bg-gradient-to-r from-accent-cyan to-[#00b8d9] text-bg-deep font-semibold rounded-xl hover:shadow-glow-cyan transition-all",children:"Continue to Dashboard"})]}):"pending-approval"===e?(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-warning/20 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-warning",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Approval Pending"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:d}),(0,r.jsx)("p",{className:"text-sm text-text-muted mb-6",children:"An organization admin needs to approve the GitHub App installation."}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("button",{onClick:b,className:"flex-1 py-3 px-4 bg-bg-tertiary border border-border-subtle rounded-xl text-white font-medium hover:bg-bg-hover transition-colors",children:"Try Again"}),(0,r.jsx)("button",{onClick:j,className:"flex-1 py-3 px-4 bg-bg-tertiary border border-border-subtle rounded-xl text-white font-medium hover:bg-bg-hover transition-colors",children:"Skip for Now"})]})]}):"error"===e?(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-error/20 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-error",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Connection Failed"}),(0,r.jsx)("p",{className:"text-text-muted mb-6",children:s}),(0,r.jsx)("button",{onClick:b,className:"w-full py-3 px-4 bg-bg-tertiary border border-border-subtle rounded-xl text-white font-medium hover:bg-bg-hover transition-colors",children:"Try Again"})]}):"polling"===e?(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 flex items-center justify-center",children:(0,r.jsxs)("svg",{className:"w-8 h-8 text-accent-cyan animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Syncing Repositories"}),(0,r.jsx)("p",{className:"text-text-muted",children:h||"Fetching your repositories..."})]}):(0,r.jsxs)("div",{children:[s&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-error text-sm",children:s})}),(0,r.jsxs)("div",{className:"mb-6 p-4 bg-bg-tertiary rounded-lg border border-border-subtle",children:[(0,r.jsx)("h3",{className:"font-medium text-white mb-2",children:"What this enables:"}),(0,r.jsxs)("ul",{className:"space-y-2 text-sm text-text-muted",children:[(0,r.jsxs)("li",{className:"flex items-start gap-2",children:[(0,r.jsx)("svg",{className:"w-4 h-4 text-success mt-0.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,r.jsx)("span",{children:"Agents can clone and work on your repositories"})]}),(0,r.jsxs)("li",{className:"flex items-start gap-2",children:[(0,r.jsx)("svg",{className:"w-4 h-4 text-success mt-0.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,r.jsx)("span",{children:"Create issues, PRs, and comments on your behalf"})]}),(0,r.jsxs)("li",{className:"flex items-start gap-2",children:[(0,r.jsx)("svg",{className:"w-4 h-4 text-success mt-0.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,r.jsx)("span",{children:"Secure token management - we never store your password"})]})]})]}),(0,r.jsx)("button",{onClick:g,disabled:"ready"!==e||w,className:"w-full py-4 px-6 bg-[#24292e] hover:bg-[#2f363d] border border-[#444d56] rounded-xl text-white font-medium flex items-center justify-center gap-3 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:w?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"w-5 h-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:h||"Connecting..."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"w-6 h-6",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),(0,r.jsx)("span",{children:"Connect GitHub Repositories"})]})}),(0,r.jsx)("button",{onClick:j,className:"w-full mt-3 py-3 px-4 text-text-muted hover:text-white transition-colors text-sm",children:"Skip for now"})]})}),(0,r.jsx)("div",{className:"mt-6 text-center",children:(0,r.jsx)("a",{href:"/app",className:"text-text-muted hover:text-white transition-colors",children:"Back to dashboard"})})]})]})}},6272:function(e,t,s){"use strict";s.d(t,{K7:function(){return n}});var r=s(7437);function n(e){let{size:t=24,className:s="",withGlow:n=!1}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"\n transition-all duration-300\n ".concat(n?"drop-shadow-[0_0_8px_rgba(0,217,255,0.3)]":"","\n ").concat(s,"\n "),"aria-label":"Agent Relay Logo",role:"img",children:[(0,r.jsx)("path",{d:"M30 80 L 50 20 L 70 80",stroke:"#00d9ff",strokeWidth:"5",strokeLinejoin:"round",strokeLinecap:"round",fill:"none"}),(0,r.jsx)("line",{x1:"40",y1:"50",x2:"60",y2:"50",stroke:"#00d9ff",strokeWidth:"5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M50 20 L 50 80",stroke:"#00ffc8",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.7"}),(0,r.jsx)("path",{d:"M50 20 C 80 20 80 50 50 50 L 80 80",stroke:"#00ffc8",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:"0.7"})]})}s(2265)}},function(e){e.O(0,[282,971,117,744],function(){return e(e.s=449)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[811],{5924:function(e,t,s){Promise.resolve().then(s.bind(s,8615))},8615:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return c}});var r=s(7437),a=s(2265),n=s(7648),i=s(9116),l=s(637);function c(){let[e,t]=(0,a.useState)("conversations"),[s,l]=(0,a.useState)([]),[c,m]=(0,a.useState)([]),[u,p]=(0,a.useState)([]),[k,C]=(0,a.useState)(null),[S,M]=(0,a.useState)(!0),[B,W]=(0,a.useState)(null),[H,L]=(0,a.useState)(""),[A,D]=(0,a.useState)(""),[E,T]=(0,a.useState)(null);(0,a.useEffect)(()=>{(async()=>{let e=await i.hi.getHistoryStats();e.success&&e.data&&C(e.data)})()},[]),(0,a.useEffect)(()=>{(async()=>{M(!0),W(null);try{if("conversations"===e){let e=await i.hi.getHistoryConversations();e.success&&e.data?l(e.data.conversations):W(e.error||"Failed to fetch conversations")}else if("sessions"===e){let e=await i.hi.getHistorySessions({agent:A||void 0,limit:100});e.success&&e.data?m(e.data.sessions):W(e.error||"Failed to fetch sessions")}else if("messages"===e){let e={limit:200,order:"desc"};if(H&&(e.search=H),E){let[r,a]=E.participants,n=await i.hi.getHistoryMessages({...e,from:r,to:a}),l=await i.hi.getHistoryMessages({...e,from:a,to:r});if(n.success&&l.success){var t,s;let e=[...(null===(t=n.data)||void 0===t?void 0:t.messages)||[],...(null===(s=l.data)||void 0===s?void 0:s.messages)||[]].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());p(e)}}else{let t=await i.hi.getHistoryMessages(e);t.success&&t.data?p(t.data.messages):W(t.error||"Failed to fetch messages")}}}catch(e){W("Failed to load data")}finally{M(!1)}})()},[e,A,H,E]);let P=(0,a.useCallback)(e=>{T(e),t("messages")},[]),U=(0,a.useCallback)(()=>{T(null),t("conversations")},[]);return(0,r.jsxs)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:[(0,r.jsx)("header",{className:"sticky top-0 z-50 bg-sidebar-bg border-b border-sidebar-border px-4 md:px-8 py-4",children:(0,r.jsxs)("div",{className:"max-w-[1400px] mx-auto flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)(n.default,{href:"/",className:"flex items-center gap-2 text-text-muted text-sm font-medium px-3 py-2 rounded-md transition-all hover:text-accent hover:bg-accent/10",children:[(0,r.jsx)(g,{}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Dashboard"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-accent/80 to-accent rounded-lg flex items-center justify-center border border-accent/30",children:(0,r.jsx)(b,{})}),(0,r.jsxs)("div",{className:"text-lg font-semibold tracking-tight",children:["Conversation ",(0,r.jsx)("span",{className:"text-accent",children:"History"})]})]})]}),k&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-4 text-sm",children:[(0,r.jsx)(d,{label:"Messages",value:k.messageCount}),(0,r.jsx)(d,{label:"Sessions",value:k.sessionCount}),(0,r.jsx)(d,{label:"Agents",value:k.uniqueAgents})]})]})}),(0,r.jsxs)("main",{className:"max-w-[1400px] mx-auto px-4 md:px-8 py-6",children:[(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"flex gap-1 bg-bg-secondary rounded-lg p-1 border border-border",children:[(0,r.jsxs)(o,{active:"conversations"===e,onClick:()=>{T(null),t("conversations")},children:[(0,r.jsx)(y,{}),"Conversations"]}),(0,r.jsxs)(o,{active:"sessions"===e,onClick:()=>t("sessions"),children:[(0,r.jsx)(v,{}),"Sessions"]}),(0,r.jsxs)(o,{active:"messages"===e,onClick:()=>t("messages"),children:[(0,r.jsx)(N,{}),"Messages"]})]}),(0,r.jsxs)("div",{className:"flex-1 flex items-center gap-3",children:["messages"===e&&(0,r.jsx)("div",{className:"flex-1 max-w-md",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(j,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted"}),(0,r.jsx)("input",{type:"text",placeholder:"Search messages...",value:H,onChange:e=>L(e.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-bg-secondary border border-border rounded-lg text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent transition-colors"})]})}),"sessions"===e&&(0,r.jsx)("div",{className:"flex-1 max-w-md",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(j,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted"}),(0,r.jsx)("input",{type:"text",placeholder:"Filter by agent name...",value:A,onChange:e=>D(e.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-bg-secondary border border-border rounded-lg text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent transition-colors"})]})}),E&&(0,r.jsxs)("button",{onClick:U,className:"flex items-center gap-2 px-4 py-2 text-sm text-text-muted hover:text-text-primary bg-bg-secondary border border-border rounded-lg transition-colors hover:bg-bg-tertiary",children:[(0,r.jsx)(g,{}),"Back to conversations"]})]})]}),S?(0,r.jsx)("div",{className:"flex items-center justify-center h-[60vh]",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"w-10 h-10 border-2 border-border border-t-accent rounded-full animate-spin"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"Loading history..."})]})}):B?(0,r.jsx)("div",{className:"flex items-center justify-center h-[60vh]",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-error/10 flex items-center justify-center",children:(0,r.jsx)(w,{})}),(0,r.jsx)("p",{className:"text-text-secondary",children:B}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"px-5 py-2.5 bg-accent text-white rounded-lg text-sm font-medium transition-colors hover:bg-accent-hover",children:"Retry"})]})}):"conversations"===e?(0,r.jsx)(x,{conversations:s,onConversationClick:P}):"sessions"===e?(0,r.jsx)(f,{sessions:c}):(0,r.jsx)(h,{messages:u,conversationTitle:E?"".concat(E.participants[0]," & ").concat(E.participants[1]):void 0})]})]})}function o(e){let{active:t,onClick:s,children:a}=e;return(0,r.jsx)("button",{onClick:s,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md transition-colors ".concat(t?"bg-accent text-white":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"),children:a})}function d(e){let{label:t,value:s}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-bg-secondary/50 border border-border/50 rounded-lg",children:[(0,r.jsxs)("span",{className:"text-text-muted text-xs",children:[t,":"]}),(0,r.jsx)("span",{className:"text-accent font-mono font-semibold",children:s})]})}function x(e){let{conversations:t,onConversationClick:s}=e;return 0===t.length?(0,r.jsx)(u,{icon:(0,r.jsx)(y,{className:"w-12 h-12"}),title:"No conversations yet",description:"Start messaging between agents to see conversation history here."}):(0,r.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map((e,t)=>{let[a,n]=e.participants,i=(0,l.GW)(a),c=(0,l.GW)(n);return(0,r.jsxs)("div",{onClick:()=>s(e),className:"p-5 bg-bg-secondary border border-border rounded-xl cursor-pointer transition-all hover:border-accent/50 hover:bg-bg-tertiary group",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsxs)("div",{className:"flex -space-x-2",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-xs font-bold border-2 border-bg-secondary",style:{backgroundColor:i.primary,color:i.text},children:(0,l.hP)(a)}),(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-xs font-bold border-2 border-bg-secondary",style:{backgroundColor:c.primary,color:c.text},children:(0,l.hP)(n)})]}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"font-semibold text-text-primary truncate",children:[a," & ",n]}),(0,r.jsxs)("div",{className:"text-xs text-text-muted",children:[e.messageCount," messages"]})]}),(0,r.jsx)("div",{className:"text-xs text-text-muted",children:p(e.lastTimestamp)})]}),(0,r.jsx)("p",{className:"text-sm text-text-muted truncate",children:e.lastMessage}),(0,r.jsxs)("div",{className:"mt-3 flex items-center gap-2 text-xs text-accent opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,r.jsx)("span",{children:"View conversation"}),(0,r.jsx)(k,{})]})]},t)})})}function f(e){let{sessions:t}=e;return 0===t.length?(0,r.jsx)(u,{icon:(0,r.jsx)(v,{className:"w-12 h-12"}),title:"No sessions found",description:"Agent sessions will appear here when agents connect."}):(0,r.jsx)("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[700px]",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"bg-bg-tertiary border-b border-border",children:[(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Agent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Status"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"CLI"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Messages"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Started"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Duration"})]})}),(0,r.jsx)("tbody",{children:t.map(e=>{let t=(0,l.GW)(e.agentName);return(0,r.jsxs)("tr",{className:"border-b border-border/50 last:border-0 transition-colors hover:bg-bg-hover",children:[(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center text-xs font-semibold",style:{backgroundColor:t.primary,color:t.text},children:(0,l.hP)(e.agentName)}),(0,r.jsx)("span",{className:"font-medium text-text-primary",children:e.agentName})]})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(m,{isActive:e.isActive,closedBy:e.closedBy})}),(0,r.jsx)("td",{className:"py-3 px-4",children:e.cli&&(0,r.jsx)("span",{className:"text-xs px-2 py-1 bg-bg-tertiary text-text-muted rounded font-mono",children:e.cli})}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-accent",children:e.messageCount}),(0,r.jsx)("td",{className:"py-3 px-4 text-sm text-text-muted",children:new Date(e.startedAt).toLocaleString()}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:e.duration})]},e.id)})})]})})})}function m(e){let{isActive:t,closedBy:s}=e;if(t)return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full bg-success/15 text-success",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 bg-success rounded-full animate-pulse"}),"Active"]});let a={agent:{label:"Closed",className:"bg-text-muted/10 text-text-muted"},disconnect:{label:"Disconnected",className:"bg-warning/15 text-warning"},error:{label:"Error",className:"bg-error/15 text-error"}},n=s?a[s]:a.agent;return(0,r.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 text-xs font-medium rounded-full ".concat(n.className),children:n.label})}function h(e){let{messages:t,conversationTitle:s}=e;return 0===t.length?(0,r.jsx)(u,{icon:(0,r.jsx)(N,{className:"w-12 h-12"}),title:"No messages found",description:s?"No messages in this conversation yet.":"Try adjusting your search or filters."}):(0,r.jsxs)("div",{className:"space-y-4",children:[s&&(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-4",children:s}),t.map(e=>{let t=(0,l.GW)(e.from);return(0,r.jsx)("div",{className:"p-4 bg-bg-secondary border border-border rounded-xl transition-colors hover:border-border-dark",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"shrink-0 w-9 h-9 rounded-lg flex items-center justify-center text-xs font-bold",style:{backgroundColor:t.primary,color:t.text},children:(0,l.hP)(e.from)}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center flex-wrap gap-2 mb-2",children:[(0,r.jsx)("span",{className:"font-semibold text-accent",children:e.from}),(0,r.jsx)("span",{className:"text-text-muted",children:"to"}),(0,r.jsx)("span",{className:"font-medium text-text-primary",children:"*"===e.to?"Everyone":e.to}),e.isBroadcast&&(0,r.jsx)("span",{className:"text-[10px] px-2 py-0.5 bg-warning/15 text-warning rounded-full font-medium",children:"Broadcast"}),e.isUrgent&&(0,r.jsx)("span",{className:"text-[10px] px-2 py-0.5 bg-error/15 text-error rounded-full font-medium",children:"Urgent"}),e.thread&&(0,r.jsx)("span",{className:"text-[10px] px-2 py-0.5 bg-accent/15 text-accent rounded-full font-medium",children:e.thread}),(0,r.jsx)("span",{className:"text-xs text-text-muted ml-auto",children:p(e.timestamp)})]}),(0,r.jsx)("p",{className:"text-sm text-text-primary whitespace-pre-wrap break-words",children:e.content})]})]})},e.id)})]})}function u(e){let{icon:t,title:s,description:a}=e;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,r.jsx)("div",{className:"text-text-muted opacity-50 mb-4",children:t}),(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-2",children:s}),(0,r.jsx)("p",{className:"text-sm text-text-muted max-w-md",children:a})]})}function p(e){let t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/6e4),a=Math.floor(s/36e5),n=Math.floor(s/864e5);return r<1?"just now":r<60?"".concat(r,"m ago"):a<24?"".concat(a,"h ago"):n<7?"".concat(n,"d ago"):t.toLocaleDateString()}function g(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function b(){return(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}function j(e){let{className:t}=e;return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function y(e){let{className:t}=e;return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:(0,r.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function v(e){let{className:t}=e;return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:[(0,r.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,r.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,r.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}function N(e){let{className:t}=e;return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:[(0,r.jsx)("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),(0,r.jsx)("polyline",{points:"22,6 12,13 2,6"})]})}function w(){return(0,r.jsx)("svg",{className:"w-6 h-6 text-error",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function k(){return(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,r.jsx)("polyline",{points:"12 5 19 12 12 19"})]})}},637:function(e,t,s){"use strict";s.d(t,{GW:function(){return c},hP:function(){return o},oU:function(){return l},yh:function(){return n}});let r={backend:{primary:"#1264a3",light:"#e8f4fd",dark:"#0d4f82",text:"#ffffff"},frontend:{primary:"#7c3aed",light:"#f3e8ff",dark:"#5b21b6",text:"#ffffff"},infra:{primary:"#ea580c",light:"#fff7ed",dark:"#c2410c",text:"#ffffff"},lead:{primary:"#2bac76",light:"#ecfdf5",dark:"#059669",text:"#ffffff"},test:{primary:"#0d9488",light:"#f0fdfa",dark:"#0f766e",text:"#ffffff"},data:{primary:"#dc2626",light:"#fef2f2",dark:"#b91c1c",text:"#ffffff"},api:{primary:"#2563eb",light:"#eff6ff",dark:"#1d4ed8",text:"#ffffff"},worker:{primary:"#9333ea",light:"#faf5ff",dark:"#7e22ce",text:"#ffffff"},monitor:{primary:"#0891b2",light:"#ecfeff",dark:"#0e7490",text:"#ffffff"},security:{primary:"#be123c",light:"#fff1f2",dark:"#9f1239",text:"#ffffff"}},a=[{primary:"#6366f1",light:"#eef2ff",dark:"#4f46e5",text:"#ffffff"},{primary:"#ec4899",light:"#fdf2f8",dark:"#db2777",text:"#ffffff"},{primary:"#14b8a6",light:"#f0fdfa",dark:"#0d9488",text:"#ffffff"},{primary:"#f59e0b",light:"#fffbeb",dark:"#d97706",text:"#000000"},{primary:"#8b5cf6",light:"#f5f3ff",dark:"#7c3aed",text:"#ffffff"},{primary:"#06b6d4",light:"#ecfeff",dark:"#0891b2",text:"#ffffff"},{primary:"#f43f5e",light:"#fff1f2",dark:"#e11d48",text:"#ffffff"},{primary:"#84cc16",light:"#f7fee7",dark:"#65a30d",text:"#000000"}],n={online:"#22c55e",offline:"#6b7280",busy:"#eab308",processing:"#6366f1",error:"#ef4444",attention:"#ef4444",stuck:"#f97316"};function i(e){return e.toLowerCase().split("-").filter(Boolean)}function l(e){return i(e)[0]||e.toLowerCase()}function c(e){let t=l(e);return t in r?r[t]:a[function(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s),t&=t;return Math.abs(t)}(t)%a.length]}function o(e){let t=i(e);return 0===t.length?e.substring(0,2).toUpperCase():t.length>=2?(t[0][0]+t[1][0]).toUpperCase():t[0].substring(0,2).toUpperCase()}}},function(e){e.O(0,[648,116,971,117,744],function(){return e(e.s=5924)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[811],{5590:function(e,t,s){Promise.resolve().then(s.bind(s,8615))},8615:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return c}});var r=s(7437),a=s(2265),n=s(7648),i=s(9116),l=s(637);function c(){let[e,t]=(0,a.useState)("conversations"),[s,l]=(0,a.useState)([]),[c,m]=(0,a.useState)([]),[u,p]=(0,a.useState)([]),[k,C]=(0,a.useState)(null),[S,M]=(0,a.useState)(!0),[B,W]=(0,a.useState)(null),[H,L]=(0,a.useState)(""),[A,D]=(0,a.useState)(""),[E,T]=(0,a.useState)(null);(0,a.useEffect)(()=>{(async()=>{let e=await i.hi.getHistoryStats();e.success&&e.data&&C(e.data)})()},[]),(0,a.useEffect)(()=>{(async()=>{M(!0),W(null);try{if("conversations"===e){let e=await i.hi.getHistoryConversations();e.success&&e.data?l(e.data.conversations):W(e.error||"Failed to fetch conversations")}else if("sessions"===e){let e=await i.hi.getHistorySessions({agent:A||void 0,limit:100});e.success&&e.data?m(e.data.sessions):W(e.error||"Failed to fetch sessions")}else if("messages"===e){let e={limit:200,order:"desc"};if(H&&(e.search=H),E){let[r,a]=E.participants,n=await i.hi.getHistoryMessages({...e,from:r,to:a}),l=await i.hi.getHistoryMessages({...e,from:a,to:r});if(n.success&&l.success){var t,s;let e=[...(null===(t=n.data)||void 0===t?void 0:t.messages)||[],...(null===(s=l.data)||void 0===s?void 0:s.messages)||[]].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());p(e)}}else{let t=await i.hi.getHistoryMessages(e);t.success&&t.data?p(t.data.messages):W(t.error||"Failed to fetch messages")}}}catch(e){W("Failed to load data")}finally{M(!1)}})()},[e,A,H,E]);let P=(0,a.useCallback)(e=>{T(e),t("messages")},[]),U=(0,a.useCallback)(()=>{T(null),t("conversations")},[]);return(0,r.jsxs)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:[(0,r.jsx)("header",{className:"sticky top-0 z-50 bg-sidebar-bg border-b border-sidebar-border px-4 md:px-8 py-4",children:(0,r.jsxs)("div",{className:"max-w-[1400px] mx-auto flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)(n.default,{href:"/",className:"flex items-center gap-2 text-text-muted text-sm font-medium px-3 py-2 rounded-md transition-all hover:text-accent hover:bg-accent/10",children:[(0,r.jsx)(g,{}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Dashboard"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-accent/80 to-accent rounded-lg flex items-center justify-center border border-accent/30",children:(0,r.jsx)(b,{})}),(0,r.jsxs)("div",{className:"text-lg font-semibold tracking-tight",children:["Conversation ",(0,r.jsx)("span",{className:"text-accent",children:"History"})]})]})]}),k&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-4 text-sm",children:[(0,r.jsx)(d,{label:"Messages",value:k.messageCount}),(0,r.jsx)(d,{label:"Sessions",value:k.sessionCount}),(0,r.jsx)(d,{label:"Agents",value:k.uniqueAgents})]})]})}),(0,r.jsxs)("main",{className:"max-w-[1400px] mx-auto px-4 md:px-8 py-6",children:[(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"flex gap-1 bg-bg-secondary rounded-lg p-1 border border-border",children:[(0,r.jsxs)(o,{active:"conversations"===e,onClick:()=>{T(null),t("conversations")},children:[(0,r.jsx)(y,{}),"Conversations"]}),(0,r.jsxs)(o,{active:"sessions"===e,onClick:()=>t("sessions"),children:[(0,r.jsx)(v,{}),"Sessions"]}),(0,r.jsxs)(o,{active:"messages"===e,onClick:()=>t("messages"),children:[(0,r.jsx)(N,{}),"Messages"]})]}),(0,r.jsxs)("div",{className:"flex-1 flex items-center gap-3",children:["messages"===e&&(0,r.jsx)("div",{className:"flex-1 max-w-md",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(j,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted"}),(0,r.jsx)("input",{type:"text",placeholder:"Search messages...",value:H,onChange:e=>L(e.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-bg-secondary border border-border rounded-lg text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent transition-colors"})]})}),"sessions"===e&&(0,r.jsx)("div",{className:"flex-1 max-w-md",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(j,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-text-muted"}),(0,r.jsx)("input",{type:"text",placeholder:"Filter by agent name...",value:A,onChange:e=>D(e.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-bg-secondary border border-border rounded-lg text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent transition-colors"})]})}),E&&(0,r.jsxs)("button",{onClick:U,className:"flex items-center gap-2 px-4 py-2 text-sm text-text-muted hover:text-text-primary bg-bg-secondary border border-border rounded-lg transition-colors hover:bg-bg-tertiary",children:[(0,r.jsx)(g,{}),"Back to conversations"]})]})]}),S?(0,r.jsx)("div",{className:"flex items-center justify-center h-[60vh]",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"w-10 h-10 border-2 border-border border-t-accent rounded-full animate-spin"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"Loading history..."})]})}):B?(0,r.jsx)("div",{className:"flex items-center justify-center h-[60vh]",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-error/10 flex items-center justify-center",children:(0,r.jsx)(w,{})}),(0,r.jsx)("p",{className:"text-text-secondary",children:B}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"px-5 py-2.5 bg-accent text-white rounded-lg text-sm font-medium transition-colors hover:bg-accent-hover",children:"Retry"})]})}):"conversations"===e?(0,r.jsx)(x,{conversations:s,onConversationClick:P}):"sessions"===e?(0,r.jsx)(f,{sessions:c}):(0,r.jsx)(h,{messages:u,conversationTitle:E?"".concat(E.participants[0]," & ").concat(E.participants[1]):void 0})]})]})}function o(e){let{active:t,onClick:s,children:a}=e;return(0,r.jsx)("button",{onClick:s,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md transition-colors ".concat(t?"bg-accent text-white":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"),children:a})}function d(e){let{label:t,value:s}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-bg-secondary/50 border border-border/50 rounded-lg",children:[(0,r.jsxs)("span",{className:"text-text-muted text-xs",children:[t,":"]}),(0,r.jsx)("span",{className:"text-accent font-mono font-semibold",children:s})]})}function x(e){let{conversations:t,onConversationClick:s}=e;return 0===t.length?(0,r.jsx)(u,{icon:(0,r.jsx)(y,{className:"w-12 h-12"}),title:"No conversations yet",description:"Start messaging between agents to see conversation history here."}):(0,r.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map((e,t)=>{let[a,n]=e.participants,i=(0,l.GW)(a),c=(0,l.GW)(n);return(0,r.jsxs)("div",{onClick:()=>s(e),className:"p-5 bg-bg-secondary border border-border rounded-xl cursor-pointer transition-all hover:border-accent/50 hover:bg-bg-tertiary group",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsxs)("div",{className:"flex -space-x-2",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-xs font-bold border-2 border-bg-secondary",style:{backgroundColor:i.primary,color:i.text},children:(0,l.hP)(a)}),(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-xs font-bold border-2 border-bg-secondary",style:{backgroundColor:c.primary,color:c.text},children:(0,l.hP)(n)})]}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"font-semibold text-text-primary truncate",children:[a," & ",n]}),(0,r.jsxs)("div",{className:"text-xs text-text-muted",children:[e.messageCount," messages"]})]}),(0,r.jsx)("div",{className:"text-xs text-text-muted",children:p(e.lastTimestamp)})]}),(0,r.jsx)("p",{className:"text-sm text-text-muted truncate",children:e.lastMessage}),(0,r.jsxs)("div",{className:"mt-3 flex items-center gap-2 text-xs text-accent opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,r.jsx)("span",{children:"View conversation"}),(0,r.jsx)(k,{})]})]},t)})})}function f(e){let{sessions:t}=e;return 0===t.length?(0,r.jsx)(u,{icon:(0,r.jsx)(v,{className:"w-12 h-12"}),title:"No sessions found",description:"Agent sessions will appear here when agents connect."}):(0,r.jsx)("div",{className:"bg-bg-secondary border border-border rounded-xl overflow-hidden",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[700px]",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"bg-bg-tertiary border-b border-border",children:[(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Agent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Status"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"CLI"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Messages"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Started"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Duration"})]})}),(0,r.jsx)("tbody",{children:t.map(e=>{let t=(0,l.GW)(e.agentName);return(0,r.jsxs)("tr",{className:"border-b border-border/50 last:border-0 transition-colors hover:bg-bg-hover",children:[(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center text-xs font-semibold",style:{backgroundColor:t.primary,color:t.text},children:(0,l.hP)(e.agentName)}),(0,r.jsx)("span",{className:"font-medium text-text-primary",children:e.agentName})]})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(m,{isActive:e.isActive,closedBy:e.closedBy})}),(0,r.jsx)("td",{className:"py-3 px-4",children:e.cli&&(0,r.jsx)("span",{className:"text-xs px-2 py-1 bg-bg-tertiary text-text-muted rounded font-mono",children:e.cli})}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-accent",children:e.messageCount}),(0,r.jsx)("td",{className:"py-3 px-4 text-sm text-text-muted",children:new Date(e.startedAt).toLocaleString()}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:e.duration})]},e.id)})})]})})})}function m(e){let{isActive:t,closedBy:s}=e;if(t)return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full bg-success/15 text-success",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 bg-success rounded-full animate-pulse"}),"Active"]});let a={agent:{label:"Closed",className:"bg-text-muted/10 text-text-muted"},disconnect:{label:"Disconnected",className:"bg-warning/15 text-warning"},error:{label:"Error",className:"bg-error/15 text-error"}},n=s?a[s]:a.agent;return(0,r.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 text-xs font-medium rounded-full ".concat(n.className),children:n.label})}function h(e){let{messages:t,conversationTitle:s}=e;return 0===t.length?(0,r.jsx)(u,{icon:(0,r.jsx)(N,{className:"w-12 h-12"}),title:"No messages found",description:s?"No messages in this conversation yet.":"Try adjusting your search or filters."}):(0,r.jsxs)("div",{className:"space-y-4",children:[s&&(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-4",children:s}),t.map(e=>{let t=(0,l.GW)(e.from);return(0,r.jsx)("div",{className:"p-4 bg-bg-secondary border border-border rounded-xl transition-colors hover:border-border-dark",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"shrink-0 w-9 h-9 rounded-lg flex items-center justify-center text-xs font-bold",style:{backgroundColor:t.primary,color:t.text},children:(0,l.hP)(e.from)}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center flex-wrap gap-2 mb-2",children:[(0,r.jsx)("span",{className:"font-semibold text-accent",children:e.from}),(0,r.jsx)("span",{className:"text-text-muted",children:"to"}),(0,r.jsx)("span",{className:"font-medium text-text-primary",children:"*"===e.to?"Everyone":e.to}),e.isBroadcast&&(0,r.jsx)("span",{className:"text-[10px] px-2 py-0.5 bg-warning/15 text-warning rounded-full font-medium",children:"Broadcast"}),e.isUrgent&&(0,r.jsx)("span",{className:"text-[10px] px-2 py-0.5 bg-error/15 text-error rounded-full font-medium",children:"Urgent"}),e.thread&&(0,r.jsx)("span",{className:"text-[10px] px-2 py-0.5 bg-accent/15 text-accent rounded-full font-medium",children:e.thread}),(0,r.jsx)("span",{className:"text-xs text-text-muted ml-auto",children:p(e.timestamp)})]}),(0,r.jsx)("p",{className:"text-sm text-text-primary whitespace-pre-wrap break-words",children:e.content})]})]})},e.id)})]})}function u(e){let{icon:t,title:s,description:a}=e;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,r.jsx)("div",{className:"text-text-muted opacity-50 mb-4",children:t}),(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-2",children:s}),(0,r.jsx)("p",{className:"text-sm text-text-muted max-w-md",children:a})]})}function p(e){let t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/6e4),a=Math.floor(s/36e5),n=Math.floor(s/864e5);return r<1?"just now":r<60?"".concat(r,"m ago"):a<24?"".concat(a,"h ago"):n<7?"".concat(n,"d ago"):t.toLocaleDateString()}function g(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function b(){return(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}function j(e){let{className:t}=e;return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function y(e){let{className:t}=e;return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:(0,r.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function v(e){let{className:t}=e;return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:[(0,r.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,r.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,r.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}function N(e){let{className:t}=e;return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:t,children:[(0,r.jsx)("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),(0,r.jsx)("polyline",{points:"22,6 12,13 2,6"})]})}function w(){return(0,r.jsx)("svg",{className:"w-6 h-6 text-error",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function k(){return(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,r.jsx)("polyline",{points:"12 5 19 12 12 19"})]})}},637:function(e,t,s){"use strict";s.d(t,{GW:function(){return c},hP:function(){return o},oU:function(){return l},yh:function(){return n}});let r={backend:{primary:"#1264a3",light:"#e8f4fd",dark:"#0d4f82",text:"#ffffff"},frontend:{primary:"#7c3aed",light:"#f3e8ff",dark:"#5b21b6",text:"#ffffff"},infra:{primary:"#ea580c",light:"#fff7ed",dark:"#c2410c",text:"#ffffff"},lead:{primary:"#2bac76",light:"#ecfdf5",dark:"#059669",text:"#ffffff"},test:{primary:"#0d9488",light:"#f0fdfa",dark:"#0f766e",text:"#ffffff"},data:{primary:"#dc2626",light:"#fef2f2",dark:"#b91c1c",text:"#ffffff"},api:{primary:"#2563eb",light:"#eff6ff",dark:"#1d4ed8",text:"#ffffff"},worker:{primary:"#9333ea",light:"#faf5ff",dark:"#7e22ce",text:"#ffffff"},monitor:{primary:"#0891b2",light:"#ecfeff",dark:"#0e7490",text:"#ffffff"},security:{primary:"#be123c",light:"#fff1f2",dark:"#9f1239",text:"#ffffff"}},a=[{primary:"#6366f1",light:"#eef2ff",dark:"#4f46e5",text:"#ffffff"},{primary:"#ec4899",light:"#fdf2f8",dark:"#db2777",text:"#ffffff"},{primary:"#14b8a6",light:"#f0fdfa",dark:"#0d9488",text:"#ffffff"},{primary:"#f59e0b",light:"#fffbeb",dark:"#d97706",text:"#000000"},{primary:"#8b5cf6",light:"#f5f3ff",dark:"#7c3aed",text:"#ffffff"},{primary:"#06b6d4",light:"#ecfeff",dark:"#0891b2",text:"#ffffff"},{primary:"#f43f5e",light:"#fff1f2",dark:"#e11d48",text:"#ffffff"},{primary:"#84cc16",light:"#f7fee7",dark:"#65a30d",text:"#000000"}],n={online:"#22c55e",offline:"#6b7280",busy:"#eab308",processing:"#6366f1",error:"#ef4444",attention:"#ef4444",stuck:"#f97316"};function i(e){return e.toLowerCase().split("-").filter(Boolean)}function l(e){return i(e)[0]||e.toLowerCase()}function c(e){let t=l(e);return t in r?r[t]:a[function(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s),t&=t;return Math.abs(t)}(t)%a.length]}function o(e){let t=i(e);return 0===t.length?e.substring(0,2).toUpperCase():t.length>=2?(t[0][0]+t[1][0]).toUpperCase():t[0].substring(0,2).toUpperCase()}}},function(e){e.O(0,[648,116,971,117,744],function(){return e(e.s=5590)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{6416:function(n,e,u){Promise.resolve().then(u.t.bind(u,7960,23))},7960:function(){}},function(n){n.O(0,[587,971,117,744],function(){return n(n.s=6416)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[626],{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[626],{9356:function(e,t,n){Promise.resolve().then(n.bind(n,6374))},6374:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(7437),s=n(2265),a=n(282),i=n(6272);function o(){let[e,t]=(0,s.useState)(!1),[n,o]=(0,s.useState)(!1),[c,l]=(0,s.useState)(""),[d,u]=(0,s.useState)(""),h=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=!0;return(async()=>{try{let n=await fetch("/api/auth/nango/login-session",{credentials:"include"}),r=await n.json();if(!e)return;if(!n.ok||!r.sessionToken){u("Failed to initialize. Please refresh the page.");return}h.current=new a.ZP({connectSessionToken:r.sessionToken}),t(!0)}catch(t){e&&(console.error("Init error:",t),u("Failed to initialize. Please refresh the page."))}})(),()=>{e=!1}},[]);let x=async e=>{let t=await fetch("/api/auth/nango/login-status/".concat(e),{credentials:"include"});if(!t.ok)throw Error("Auth status not ready");return t.json()},m=async e=>{try{l("Completing authentication...");let t=Date.now(),n=async()=>{if(Date.now()-t>3e4)throw Error("Authentication timed out. Please try again.");try{let t=await x(e);if(t&&t.ready){window.location.href=t.hasRepos?"/app":"/connect-repos";return}return await new Promise(e=>setTimeout(e,1e3)),n()}catch(e){return await new Promise(e=>setTimeout(e,1e3)),n()}};await n()}catch(e){console.error("[AUTH] Authentication error:",e),u(e instanceof Error?e.message:"Authentication failed"),o(!1),l("")}},f=async()=>{if(!h.current){u("Not ready. Please refresh the page.");return}o(!0),u(""),l("Connecting to GitHub...");try{let e=await h.current.auth("github");if(e&&"connectionId"in e)await m(e.connectionId);else throw Error("No connection ID returned")}catch(n){var e;if(console.error("GitHub auth error:",n),"user_cancelled"===n.type||(null===(e=n.message)||void 0===e?void 0:e.includes("closed"))){o(!1),l(""),fetch("/api/auth/nango/login-session",{credentials:"include"}).then(e=>e.json()).then(e=>{e.sessionToken&&(h.current=new a.ZP({connectSessionToken:e.sessionToken}),t(!0))});return}u(n.message||"Authentication failed"),o(!1),l("")}};return(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-[#0a0a0f] via-[#0d1117] to-[#0a0a0f] flex flex-col items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"fixed inset-0 opacity-10",children:(0,r.jsx)("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(0, 217, 255, 0.1) 1px, transparent 1px)",backgroundSize:"50px 50px"}})}),(0,r.jsxs)("div",{className:"relative z-10 w-full max-w-md",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center mb-8",children:[(0,r.jsx)(i.K7,{size:48,withGlow:!0}),(0,r.jsx)("h1",{className:"mt-4 text-2xl font-bold text-white",children:"Agent Relay"}),(0,r.jsx)("p",{className:"mt-2 text-text-muted",children:"Sign in to continue"})]}),(0,r.jsx)("div",{className:"bg-bg-primary/80 backdrop-blur-sm border border-border-subtle rounded-2xl p-8 shadow-xl",children:(0,r.jsxs)("div",{children:[d&&(0,r.jsx)("div",{className:"mb-4 p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,r.jsx)("p",{className:"text-error text-sm",children:d})}),(0,r.jsx)("button",{type:"button",onClick:f,disabled:!e||n,className:"w-full py-4 px-6 bg-[#24292e] hover:bg-[#2f363d] border border-[#444d56] rounded-xl text-white font-medium flex items-center justify-center gap-3 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:e?n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"w-5 h-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:c||"Connecting..."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"w-6 h-6",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),(0,r.jsx)("span",{children:"Continue with GitHub"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"w-5 h-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:"Loading..."})]})}),(0,r.jsxs)("p",{className:"mt-6 text-center text-text-muted text-sm",children:["By signing in, you agree to our"," ",(0,r.jsx)("a",{href:"/terms",className:"text-accent-cyan hover:underline",children:"Terms of Service"})," ","and"," ",(0,r.jsx)("a",{href:"/privacy",className:"text-accent-cyan hover:underline",children:"Privacy Policy"})]})]})}),(0,r.jsx)("div",{className:"mt-6 text-center",children:(0,r.jsxs)("p",{className:"text-text-muted",children:["Don't have an account?"," ",(0,r.jsx)("a",{href:"/signup",className:"text-accent-cyan hover:underline font-medium",children:"Sign up"})]})}),(0,r.jsx)("div",{className:"mt-4 text-center",children:(0,r.jsx)("a",{href:"/",className:"text-text-muted hover:text-white transition-colors text-sm",children:"Back to home"})})]})]})}},6272:function(e,t,n){"use strict";n.d(t,{K7:function(){return s}});var r=n(7437);function s(e){let{size:t=24,className:n="",withGlow:s=!1}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"\n transition-all duration-300\n ".concat(s?"drop-shadow-[0_0_8px_rgba(0,217,255,0.3)]":"","\n ").concat(n,"\n "),"aria-label":"Agent Relay Logo",role:"img",children:[(0,r.jsx)("path",{d:"M30 80 L 50 20 L 70 80",stroke:"#00d9ff",strokeWidth:"5",strokeLinejoin:"round",strokeLinecap:"round",fill:"none"}),(0,r.jsx)("line",{x1:"40",y1:"50",x2:"60",y2:"50",stroke:"#00d9ff",strokeWidth:"5",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"M50 20 L 50 80",stroke:"#00ffc8",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.7"}),(0,r.jsx)("path",{d:"M50 20 C 80 20 80 50 50 50 L 80 80",stroke:"#00ffc8",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:"0.7"})]})}n(2265)}},function(e){e.O(0,[282,971,117,744],function(){return e(e.s=9356)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[860],{3047:function(e,t,s){Promise.resolve().then(s.bind(s,5804))},5804:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return m}});var r=s(7437),n=s(2265),a=s(7648),l=s(9116);let c=["#4a9eff","#b388ff","#ff9e40","#00e676","#ff5c5c","#00ffc8"];function i(e){let t=0;for(let s=0;s<e.length;s++)t=e.charCodeAt(s)+((t<<5)-t);return c[Math.abs(t)%c.length]}function o(e){return e.slice(0,2).toUpperCase()}function d(e){return e<60?"".concat(e,"s"):e<3600?"".concat(Math.floor(e/60),"m"):e<86400?"".concat(Math.floor(e/3600),"h ").concat(Math.floor(e%3600/60),"m"):"".concat(Math.floor(e/86400),"d ").concat(Math.floor(e%86400/3600),"h")}function x(e){return new Date(e).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function m(){var e,t,s,c;let[i,o]=(0,n.useState)(null),[m,N]=(0,n.useState)(null),[M,S]=(0,n.useState)(null),[L,A]=(0,n.useState)(!0),[B,C]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{let e=(0,l.$3)(),t=async()=>{try{let t=await fetch("/api/auth/session",{credentials:"include"});if(404!==t.status&&(C(!0),!e))return window.location.href="/app",!1;return!0}catch(e){return!0}},s=async()=>{try{if(!await t())return;let[e,s]=await Promise.all([fetch((0,l.kG)("/api/metrics"),{credentials:"include"}),fetch((0,l.kG)("/api/metrics/agents"),{credentials:"include"})]);if(!e.ok)throw Error("Failed to fetch metrics");let r=await e.json();if(o(r),s.ok){let e=await s.json();N(e)}S(null)}catch(e){S(e instanceof Error?e.message:"Failed to load metrics")}finally{A(!1)}};s();let r=setInterval(s,5e3);return()=>clearInterval(r)},[]),L)return(0,r.jsx)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-screen gap-4",children:[(0,r.jsx)("div",{className:"w-8 h-8 border-2 border-border border-t-accent rounded-full animate-spin"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"Loading metrics..."})]})});if(M||!i)return(0,r.jsx)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-screen gap-4",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-error/10 flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-6 h-6 text-error",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,r.jsx)("p",{className:"text-text-secondary",children:M||"No metrics available"}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"px-5 py-2.5 bg-accent text-white rounded-lg text-sm font-medium transition-colors hover:bg-accent-hover",children:"Retry"})]})});let _=(null!==(s=null===(e=i.sessions)||void 0===e?void 0:e.errorRate)&&void 0!==s?s:0)<=1?"healthy":(null!==(c=null===(t=i.sessions)||void 0===t?void 0:t.errorRate)&&void 0!==c?c:0)<=5?"warning":"critical";return(0,r.jsxs)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:[(0,r.jsx)("header",{className:"sticky top-0 z-50 bg-sidebar-bg border-b border-sidebar-border px-4 md:px-8 py-4",children:(0,r.jsxs)("div",{className:"max-w-[1400px] mx-auto flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)(a.default,{href:"/app",className:"flex items-center gap-2 text-text-muted text-sm font-medium px-3 py-2 rounded-md transition-all hover:text-accent hover:bg-accent/10",children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Dashboard"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-accent/80 to-accent rounded-lg flex items-center justify-center border border-accent/30",children:(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",children:[(0,r.jsx)("path",{d:"M3 3v18h18"}),(0,r.jsx)("path",{d:"M18 17V9"}),(0,r.jsx)("path",{d:"M13 17V5"}),(0,r.jsx)("path",{d:"M8 17v-3"})]})}),(0,r.jsxs)("div",{className:"text-lg font-semibold tracking-tight",children:["Agent ",(0,r.jsx)("span",{className:"text-accent",children:"Metrics"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-success/10 border border-success/30 rounded-full",children:[(0,r.jsx)("span",{className:"w-2 h-2 bg-success rounded-full animate-pulse shadow-[0_0_8px_rgba(43,172,118,0.5)]"}),(0,r.jsx)("span",{className:"text-success text-xs font-semibold font-mono tracking-wide",children:"LIVE"})]})]})}),(0,r.jsxs)("main",{className:"max-w-[1400px] mx-auto px-4 md:px-8 py-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[(0,r.jsx)(u,{label:"Total Agents",value:i.totalAgents,subtext:"".concat(i.onlineAgents," online / ").concat(i.offlineAgents," offline"),accent:"cyan"}),(0,r.jsx)(u,{label:"Online Now",value:i.onlineAgents,subtext:"".concat(i.totalAgents>0?Math.round(i.onlineAgents/i.totalAgents*100):0,"% availability"),accent:"green"}),(0,r.jsx)(u,{label:"Total Messages",value:i.totalMessages.toLocaleString(),subtext:"all time",accent:"purple"}),(0,r.jsx)(u,{label:"Avg. Throughput",value:i.throughput.avgMessagesPerMinute,subtext:"messages / minute",accent:"orange"})]}),(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsx)(h,{title:"Message Throughput"}),(0,r.jsx)("div",{className:"bg-bg-secondary border border-border rounded-lg p-6",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6",children:[(0,r.jsx)(g,{value:i.throughput.messagesLastMinute,label:"Last Minute",max:10}),(0,r.jsx)(g,{value:i.throughput.messagesLastHour,label:"Last Hour",max:100}),(0,r.jsx)(g,{value:i.throughput.messagesLast24Hours,label:"Last 24 Hours",max:1e3}),(0,r.jsx)(g,{value:i.throughput.avgMessagesPerMinute,label:"Avg / Min",max:5})]})})]}),i.sessions&&(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)(h,{title:"Session Lifecycle"}),(0,r.jsx)(p,{rate:i.sessions.errorRate||0,status:_})]}),(0,r.jsxs)("div",{className:"bg-bg-secondary border border-border rounded-lg p-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-5 mb-6",children:[(0,r.jsx)(b,{value:i.sessions.totalSessions,label:"Total Sessions",accent:"purple"}),(0,r.jsx)(b,{value:i.sessions.activeSessions,label:"Active",accent:"blue"}),(0,r.jsx)(b,{value:i.sessions.closedByAgent,label:"Clean Close",accent:"green"}),(0,r.jsx)(b,{value:i.sessions.closedByDisconnect,label:"Disconnect",accent:"orange"}),(0,r.jsx)(b,{value:i.sessions.closedByError,label:"Error",accent:"red"})]}),i.sessions.recentSessions&&i.sessions.recentSessions.length>0&&(0,r.jsx)("div",{className:"overflow-x-auto -mx-6 px-6",children:(0,r.jsxs)("table",{className:"w-full min-w-[500px]",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"border-b border-border",children:[(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Agent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Status"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Messages"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Started"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Duration"})]})}),(0,r.jsx)("tbody",{children:i.sessions.recentSessions.slice(0,5).map((e,t)=>{let s=new Date(e.startedAt),n=Math.floor(((e.endedAt?new Date(e.endedAt):new Date).getTime()-s.getTime())/1e3);return(0,r.jsxs)("tr",{className:"border-b border-border/50 last:border-0",children:[(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(f,{name:e.agentName})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(v,{closedBy:e.closedBy})}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-accent",children:e.messageCount}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:x(e.startedAt)}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:d(n)})]},t)})})]})})]})]}),(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsx)(h,{title:"Agent Health"}),(0,r.jsx)("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:0===i.agents.length?(0,r.jsxs)("div",{className:"py-12 text-center",children:[(0,r.jsxs)("svg",{className:"w-12 h-12 mx-auto mb-4 text-text-muted opacity-50",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,r.jsx)("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),(0,r.jsx)("circle",{cx:"12",cy:"7",r:"4"})]}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"No agents registered yet"})]}):(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[700px]",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"bg-bg-tertiary border-b border-border",children:[(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Agent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Status"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Sent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Received"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Uptime"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Last Seen"})]})}),(0,r.jsx)("tbody",{children:i.agents.map(e=>(0,r.jsxs)("tr",{className:"border-b border-border/50 last:border-0 transition-colors hover:bg-bg-hover",children:[(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(f,{name:e.name})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(j,{isOnline:e.isOnline})}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-accent",children:e.messagesSent.toLocaleString()}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-[#a78bfa]",children:e.messagesReceived.toLocaleString()}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:d(e.uptimeSeconds)}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:x(e.lastSeen)})]},e.name))})]})})})]}),m&&m.agents.length>0&&(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)(h,{title:"Agent Memory & Resources"}),(0,r.jsx)(y,{system:m.system})]}),(0,r.jsxs)("div",{className:"bg-bg-secondary border border-border rounded-lg p-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[(0,r.jsx)(w,{label:"Total Agents",value:m.agents.length,subtext:"being monitored",accent:"cyan"}),(0,r.jsx)(w,{label:"Healthy",value:m.agents.filter(e=>"normal"===e.alertLevel).length,subtext:"normal memory",accent:"green"}),(0,r.jsx)(w,{label:"Warning",value:m.agents.filter(e=>"warning"===e.alertLevel).length,subtext:"elevated usage",accent:"orange"}),(0,r.jsx)(w,{label:"Critical",value:m.agents.filter(e=>"critical"===e.alertLevel||"oom_imminent"===e.alertLevel).length,subtext:"needs attention",accent:"red"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:m.agents.map(e=>(0,r.jsx)(k,{agent:e},e.name))})]})]}),(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted text-xs font-mono",children:["Last updated: ",x(i.timestamp)]})]})]})}function u(e){let{label:t,value:s,subtext:n,accent:a}=e;return(0,r.jsxs)("div",{className:"bg-bg-secondary border border-border rounded-lg p-5 transition-all hover:border-border-dark hover:bg-bg-tertiary group",children:[(0,r.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-text-muted mb-2",children:t}),(0,r.jsx)("div",{className:"font-mono text-3xl font-bold ".concat({cyan:"text-accent",green:"text-success",purple:"text-[#a78bfa]",orange:"text-warning"}[a]," transition-transform group-hover:scale-105 origin-left"),children:s}),(0,r.jsx)("div",{className:"text-xs text-text-muted font-mono mt-2",children:n})]})}function h(e){let{title:t}=e;return(0,r.jsxs)("h2",{className:"flex items-center gap-2.5 text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:[(0,r.jsx)("span",{className:"w-[3px] h-3.5 bg-accent rounded-sm"}),t]})}function g(e){let{value:t,label:s,max:n}=e,a=Math.min(t/n*100,100);return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"font-mono text-4xl font-bold text-accent leading-none",children:t}),(0,r.jsx)("div",{className:"text-xs text-text-muted uppercase tracking-wide mt-2",children:s}),(0,r.jsx)("div",{className:"h-1 bg-border rounded-full mt-3 overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-gradient-to-r from-accent to-[#6366f1] rounded-full transition-all duration-500",style:{width:"".concat(a,"%")}})})]})}function b(e){let{value:t,label:s,accent:n}=e;return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"font-mono text-3xl font-bold ".concat({purple:"text-[#a78bfa]",blue:"text-accent",green:"text-success",orange:"text-warning",red:"text-error"}[n]," leading-none"),children:t}),(0,r.jsx)("div",{className:"text-[11px] text-text-muted uppercase tracking-wide mt-2",children:s})]})}function p(e){let{rate:t,status:s}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold font-mono border ".concat({healthy:"bg-success/15 text-success border-success/30",warning:"bg-warning/15 text-warning border-warning/30",critical:"bg-error/15 text-error border-error/30"}[s]),children:[t.toFixed(1),"% error rate"]})}function f(e){let{name:t}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center text-white text-xs font-semibold",style:{backgroundColor:i(t)},children:o(t)}),(0,r.jsx)("span",{className:"font-semibold font-mono text-sm",children:t})]})}function j(e){let{isOnline:t}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium ".concat(t?"bg-success/15 text-success":"bg-bg-hover text-text-muted"),children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full ".concat(t?"bg-success":"bg-text-muted")}),t?"Online":"Offline"]})}function v(e){let{closedBy:t}=e,s={agent:{label:"Clean",className:"bg-success/15 text-success"},disconnect:{label:"Disconnect",className:"bg-warning/15 text-warning"},error:{label:"Error",className:"bg-error/15 text-error"},active:{label:"Active",className:"bg-accent/15 text-accent"}}[t||"active"];return(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-lg text-[11px] font-medium ".concat(s.className),children:s.label})}function N(e){if(0===e)return"0 B";let t=Math.floor(Math.log(Math.abs(e))/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(1)," ").concat(["B","KB","MB","GB","TB"][t])}function y(e){let{system:t}=e,s=Math.round((t.totalMemory-t.freeMemory)/t.totalMemory*100);return(0,r.jsxs)("div",{className:"flex items-center gap-3 px-3 py-1.5 bg-bg-tertiary border border-border rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("svg",{className:"w-4 h-4 text-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",fill:"currentColor",opacity:"0.3"})]}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"System:"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-24 h-2 bg-border rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all ".concat(s>90?"bg-error":s>70?"bg-warning":"bg-accent"),style:{width:"".concat(s,"%")}})}),(0,r.jsxs)("span",{className:"text-xs font-mono text-text-muted",children:[s,"%"]})]}),(0,r.jsxs)("span",{className:"text-xs font-mono text-text-muted",children:[N(t.freeMemory)," free"]})]})}function w(e){let{label:t,value:s,subtext:n,accent:a}=e;return(0,r.jsxs)("div",{className:"bg-bg-tertiary border border-border/50 rounded-lg p-4 text-center",children:[(0,r.jsx)("div",{className:"font-mono text-3xl font-bold ".concat({cyan:"text-accent",green:"text-success",orange:"text-warning",red:"text-error"}[a]," leading-none"),children:s}),(0,r.jsx)("div",{className:"text-[11px] text-text-muted uppercase tracking-wide mt-2",children:t}),(0,r.jsx)("div",{className:"text-xs text-text-muted mt-1",children:n})]})}function k(e){var t;let{agent:s}=e,n=s.rssBytes?s.rssBytes/1048576:0,a={normal:{bg:"bg-success/10",border:"border-success/30",text:"text-success",label:"Healthy"},warning:{bg:"bg-warning/10",border:"border-warning/30",text:"text-warning",label:"Warning"},critical:{bg:"bg-error/10",border:"border-error/30",text:"text-error",label:"Critical"},oom_imminent:{bg:"bg-error/20",border:"border-error/50",text:"text-error",label:"OOM Risk"}}[s.alertLevel||"normal"],l={growing:{icon:"↑",color:"text-warning",label:"Growing"},stable:{icon:"→",color:"text-success",label:"Stable"},shrinking:{icon:"↓",color:"text-accent",label:"Shrinking"},unknown:{icon:"?",color:"text-text-muted",label:"Unknown"}}[s.trend||"unknown"];return(0,r.jsxs)("div",{className:"".concat(a.bg," border ").concat(a.border," rounded-lg p-4 transition-all hover:scale-[1.01]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white text-sm font-semibold",style:{backgroundColor:i(s.name)},children:o(s.name)}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-semibold font-mono text-sm text-text-primary",children:s.name}),(0,r.jsxs)("div",{className:"text-xs text-text-muted",children:["PID: ",s.pid||"N/A"," • ",s.status]})]})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ".concat(a.bg," ").concat(a.text),children:a.label})})]}),(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"Memory Usage"}),(0,r.jsx)("span",{className:"text-sm font-mono font-semibold text-text-primary",children:N(s.rssBytes||0)})]}),(0,r.jsx)("div",{className:"h-3 bg-bg-primary rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all duration-500 ".concat("critical"===s.alertLevel||"oom_imminent"===s.alertLevel?"bg-gradient-to-r from-error to-error/70":"warning"===s.alertLevel?"bg-gradient-to-r from-warning to-warning/70":"bg-gradient-to-r from-accent to-[#6366f1]"),style:{width:"".concat(Math.min(n/2048*100,100),"%")}})}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"0"}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"2 GB"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"text-lg font-mono font-bold text-accent",children:[(null===(t=s.cpuPercent)||void 0===t?void 0:t.toFixed(1))||"0","%"]}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted uppercase",children:"CPU"})]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"text-lg font-mono font-bold ".concat(l.color," flex items-center justify-center gap-1"),children:[(0,r.jsx)("span",{children:l.icon}),(0,r.jsx)("span",{className:"text-xs",children:l.label})]}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted uppercase",children:"Trend"})]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"text-lg font-mono font-bold text-[#a78bfa]",children:N(s.highWatermark||0)}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted uppercase",children:"Peak"})]})]}),s.uptimeMs&&(0,r.jsxs)("div",{className:"mt-3 pt-3 border-t border-border/30 flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"Uptime"}),(0,r.jsx)("span",{className:"text-xs font-mono text-text-muted",children:d(Math.floor(s.uptimeMs/1e3))})]})]})}}},function(e){e.O(0,[648,116,971,117,744],function(){return e(e.s=3047)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[860],{8639:function(e,t,s){Promise.resolve().then(s.bind(s,5804))},5804:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return m}});var r=s(7437),n=s(2265),a=s(7648),l=s(9116);let c=["#4a9eff","#b388ff","#ff9e40","#00e676","#ff5c5c","#00ffc8"];function i(e){let t=0;for(let s=0;s<e.length;s++)t=e.charCodeAt(s)+((t<<5)-t);return c[Math.abs(t)%c.length]}function o(e){return e.slice(0,2).toUpperCase()}function d(e){return e<60?"".concat(e,"s"):e<3600?"".concat(Math.floor(e/60),"m"):e<86400?"".concat(Math.floor(e/3600),"h ").concat(Math.floor(e%3600/60),"m"):"".concat(Math.floor(e/86400),"d ").concat(Math.floor(e%86400/3600),"h")}function x(e){return new Date(e).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function m(){var e,t,s,c;let[i,o]=(0,n.useState)(null),[m,N]=(0,n.useState)(null),[M,S]=(0,n.useState)(null),[L,A]=(0,n.useState)(!0),[B,C]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{let e=(0,l.$3)(),t=async()=>{try{let t=await fetch("/api/auth/session",{credentials:"include"});if(404!==t.status&&(C(!0),!e))return window.location.href="/app",!1;return!0}catch(e){return!0}},s=async()=>{try{if(!await t())return;let[e,s]=await Promise.all([fetch((0,l.kG)("/api/metrics"),{credentials:"include"}),fetch((0,l.kG)("/api/metrics/agents"),{credentials:"include"})]);if(!e.ok)throw Error("Failed to fetch metrics");let r=await e.json();if(o(r),s.ok){let e=await s.json();N(e)}S(null)}catch(e){S(e instanceof Error?e.message:"Failed to load metrics")}finally{A(!1)}};s();let r=setInterval(s,5e3);return()=>clearInterval(r)},[]),L)return(0,r.jsx)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-screen gap-4",children:[(0,r.jsx)("div",{className:"w-8 h-8 border-2 border-border border-t-accent rounded-full animate-spin"}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"Loading metrics..."})]})});if(M||!i)return(0,r.jsx)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-screen gap-4",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-error/10 flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-6 h-6 text-error",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,r.jsx)("p",{className:"text-text-secondary",children:M||"No metrics available"}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),className:"px-5 py-2.5 bg-accent text-white rounded-lg text-sm font-medium transition-colors hover:bg-accent-hover",children:"Retry"})]})});let _=(null!==(s=null===(e=i.sessions)||void 0===e?void 0:e.errorRate)&&void 0!==s?s:0)<=1?"healthy":(null!==(c=null===(t=i.sessions)||void 0===t?void 0:t.errorRate)&&void 0!==c?c:0)<=5?"warning":"critical";return(0,r.jsxs)("div",{className:"min-h-screen bg-bg-primary text-text-primary font-sans",children:[(0,r.jsx)("header",{className:"sticky top-0 z-50 bg-sidebar-bg border-b border-sidebar-border px-4 md:px-8 py-4",children:(0,r.jsxs)("div",{className:"max-w-[1400px] mx-auto flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)(a.default,{href:"/app",className:"flex items-center gap-2 text-text-muted text-sm font-medium px-3 py-2 rounded-md transition-all hover:text-accent hover:bg-accent/10",children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Dashboard"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-accent/80 to-accent rounded-lg flex items-center justify-center border border-accent/30",children:(0,r.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",children:[(0,r.jsx)("path",{d:"M3 3v18h18"}),(0,r.jsx)("path",{d:"M18 17V9"}),(0,r.jsx)("path",{d:"M13 17V5"}),(0,r.jsx)("path",{d:"M8 17v-3"})]})}),(0,r.jsxs)("div",{className:"text-lg font-semibold tracking-tight",children:["Agent ",(0,r.jsx)("span",{className:"text-accent",children:"Metrics"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-success/10 border border-success/30 rounded-full",children:[(0,r.jsx)("span",{className:"w-2 h-2 bg-success rounded-full animate-pulse shadow-[0_0_8px_rgba(43,172,118,0.5)]"}),(0,r.jsx)("span",{className:"text-success text-xs font-semibold font-mono tracking-wide",children:"LIVE"})]})]})}),(0,r.jsxs)("main",{className:"max-w-[1400px] mx-auto px-4 md:px-8 py-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[(0,r.jsx)(u,{label:"Total Agents",value:i.totalAgents,subtext:"".concat(i.onlineAgents," online / ").concat(i.offlineAgents," offline"),accent:"cyan"}),(0,r.jsx)(u,{label:"Online Now",value:i.onlineAgents,subtext:"".concat(i.totalAgents>0?Math.round(i.onlineAgents/i.totalAgents*100):0,"% availability"),accent:"green"}),(0,r.jsx)(u,{label:"Total Messages",value:i.totalMessages.toLocaleString(),subtext:"all time",accent:"purple"}),(0,r.jsx)(u,{label:"Avg. Throughput",value:i.throughput.avgMessagesPerMinute,subtext:"messages / minute",accent:"orange"})]}),(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsx)(h,{title:"Message Throughput"}),(0,r.jsx)("div",{className:"bg-bg-secondary border border-border rounded-lg p-6",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6",children:[(0,r.jsx)(g,{value:i.throughput.messagesLastMinute,label:"Last Minute",max:10}),(0,r.jsx)(g,{value:i.throughput.messagesLastHour,label:"Last Hour",max:100}),(0,r.jsx)(g,{value:i.throughput.messagesLast24Hours,label:"Last 24 Hours",max:1e3}),(0,r.jsx)(g,{value:i.throughput.avgMessagesPerMinute,label:"Avg / Min",max:5})]})})]}),i.sessions&&(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)(h,{title:"Session Lifecycle"}),(0,r.jsx)(p,{rate:i.sessions.errorRate||0,status:_})]}),(0,r.jsxs)("div",{className:"bg-bg-secondary border border-border rounded-lg p-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-5 mb-6",children:[(0,r.jsx)(b,{value:i.sessions.totalSessions,label:"Total Sessions",accent:"purple"}),(0,r.jsx)(b,{value:i.sessions.activeSessions,label:"Active",accent:"blue"}),(0,r.jsx)(b,{value:i.sessions.closedByAgent,label:"Clean Close",accent:"green"}),(0,r.jsx)(b,{value:i.sessions.closedByDisconnect,label:"Disconnect",accent:"orange"}),(0,r.jsx)(b,{value:i.sessions.closedByError,label:"Error",accent:"red"})]}),i.sessions.recentSessions&&i.sessions.recentSessions.length>0&&(0,r.jsx)("div",{className:"overflow-x-auto -mx-6 px-6",children:(0,r.jsxs)("table",{className:"w-full min-w-[500px]",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"border-b border-border",children:[(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Agent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Status"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Messages"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Started"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Duration"})]})}),(0,r.jsx)("tbody",{children:i.sessions.recentSessions.slice(0,5).map((e,t)=>{let s=new Date(e.startedAt),n=Math.floor(((e.endedAt?new Date(e.endedAt):new Date).getTime()-s.getTime())/1e3);return(0,r.jsxs)("tr",{className:"border-b border-border/50 last:border-0",children:[(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(f,{name:e.agentName})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(v,{closedBy:e.closedBy})}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-accent",children:e.messageCount}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:x(e.startedAt)}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:d(n)})]},t)})})]})})]})]}),(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsx)(h,{title:"Agent Health"}),(0,r.jsx)("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:0===i.agents.length?(0,r.jsxs)("div",{className:"py-12 text-center",children:[(0,r.jsxs)("svg",{className:"w-12 h-12 mx-auto mb-4 text-text-muted opacity-50",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,r.jsx)("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),(0,r.jsx)("circle",{cx:"12",cy:"7",r:"4"})]}),(0,r.jsx)("p",{className:"text-text-muted text-sm",children:"No agents registered yet"})]}):(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[700px]",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"bg-bg-tertiary border-b border-border",children:[(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Agent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Status"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Sent"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Received"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Uptime"}),(0,r.jsx)("th",{className:"text-left py-3 px-4 text-xs font-semibold uppercase tracking-wider text-text-muted",children:"Last Seen"})]})}),(0,r.jsx)("tbody",{children:i.agents.map(e=>(0,r.jsxs)("tr",{className:"border-b border-border/50 last:border-0 transition-colors hover:bg-bg-hover",children:[(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(f,{name:e.name})}),(0,r.jsx)("td",{className:"py-3 px-4",children:(0,r.jsx)(j,{isOnline:e.isOnline})}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-accent",children:e.messagesSent.toLocaleString()}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-[#a78bfa]",children:e.messagesReceived.toLocaleString()}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:d(e.uptimeSeconds)}),(0,r.jsx)("td",{className:"py-3 px-4 font-mono text-sm text-text-muted",children:x(e.lastSeen)})]},e.name))})]})})})]}),m&&m.agents.length>0&&(0,r.jsxs)("section",{className:"mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)(h,{title:"Agent Memory & Resources"}),(0,r.jsx)(y,{system:m.system})]}),(0,r.jsxs)("div",{className:"bg-bg-secondary border border-border rounded-lg p-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[(0,r.jsx)(w,{label:"Total Agents",value:m.agents.length,subtext:"being monitored",accent:"cyan"}),(0,r.jsx)(w,{label:"Healthy",value:m.agents.filter(e=>"normal"===e.alertLevel).length,subtext:"normal memory",accent:"green"}),(0,r.jsx)(w,{label:"Warning",value:m.agents.filter(e=>"warning"===e.alertLevel).length,subtext:"elevated usage",accent:"orange"}),(0,r.jsx)(w,{label:"Critical",value:m.agents.filter(e=>"critical"===e.alertLevel||"oom_imminent"===e.alertLevel).length,subtext:"needs attention",accent:"red"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:m.agents.map(e=>(0,r.jsx)(k,{agent:e},e.name))})]})]}),(0,r.jsxs)("div",{className:"text-center py-4 text-text-muted text-xs font-mono",children:["Last updated: ",x(i.timestamp)]})]})]})}function u(e){let{label:t,value:s,subtext:n,accent:a}=e;return(0,r.jsxs)("div",{className:"bg-bg-secondary border border-border rounded-lg p-5 transition-all hover:border-border-dark hover:bg-bg-tertiary group",children:[(0,r.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-text-muted mb-2",children:t}),(0,r.jsx)("div",{className:"font-mono text-3xl font-bold ".concat({cyan:"text-accent",green:"text-success",purple:"text-[#a78bfa]",orange:"text-warning"}[a]," transition-transform group-hover:scale-105 origin-left"),children:s}),(0,r.jsx)("div",{className:"text-xs text-text-muted font-mono mt-2",children:n})]})}function h(e){let{title:t}=e;return(0,r.jsxs)("h2",{className:"flex items-center gap-2.5 text-xs font-semibold uppercase tracking-wider text-text-muted mb-3",children:[(0,r.jsx)("span",{className:"w-[3px] h-3.5 bg-accent rounded-sm"}),t]})}function g(e){let{value:t,label:s,max:n}=e,a=Math.min(t/n*100,100);return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"font-mono text-4xl font-bold text-accent leading-none",children:t}),(0,r.jsx)("div",{className:"text-xs text-text-muted uppercase tracking-wide mt-2",children:s}),(0,r.jsx)("div",{className:"h-1 bg-border rounded-full mt-3 overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-gradient-to-r from-accent to-[#6366f1] rounded-full transition-all duration-500",style:{width:"".concat(a,"%")}})})]})}function b(e){let{value:t,label:s,accent:n}=e;return(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"font-mono text-3xl font-bold ".concat({purple:"text-[#a78bfa]",blue:"text-accent",green:"text-success",orange:"text-warning",red:"text-error"}[n]," leading-none"),children:t}),(0,r.jsx)("div",{className:"text-[11px] text-text-muted uppercase tracking-wide mt-2",children:s})]})}function p(e){let{rate:t,status:s}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold font-mono border ".concat({healthy:"bg-success/15 text-success border-success/30",warning:"bg-warning/15 text-warning border-warning/30",critical:"bg-error/15 text-error border-error/30"}[s]),children:[t.toFixed(1),"% error rate"]})}function f(e){let{name:t}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center text-white text-xs font-semibold",style:{backgroundColor:i(t)},children:o(t)}),(0,r.jsx)("span",{className:"font-semibold font-mono text-sm",children:t})]})}function j(e){let{isOnline:t}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium ".concat(t?"bg-success/15 text-success":"bg-bg-hover text-text-muted"),children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full ".concat(t?"bg-success":"bg-text-muted")}),t?"Online":"Offline"]})}function v(e){let{closedBy:t}=e,s={agent:{label:"Clean",className:"bg-success/15 text-success"},disconnect:{label:"Disconnect",className:"bg-warning/15 text-warning"},error:{label:"Error",className:"bg-error/15 text-error"},active:{label:"Active",className:"bg-accent/15 text-accent"}}[t||"active"];return(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-lg text-[11px] font-medium ".concat(s.className),children:s.label})}function N(e){if(0===e)return"0 B";let t=Math.floor(Math.log(Math.abs(e))/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(1)," ").concat(["B","KB","MB","GB","TB"][t])}function y(e){let{system:t}=e,s=Math.round((t.totalMemory-t.freeMemory)/t.totalMemory*100);return(0,r.jsxs)("div",{className:"flex items-center gap-3 px-3 py-1.5 bg-bg-tertiary border border-border rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("svg",{className:"w-4 h-4 text-accent",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",fill:"currentColor",opacity:"0.3"})]}),(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"System:"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-24 h-2 bg-border rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all ".concat(s>90?"bg-error":s>70?"bg-warning":"bg-accent"),style:{width:"".concat(s,"%")}})}),(0,r.jsxs)("span",{className:"text-xs font-mono text-text-muted",children:[s,"%"]})]}),(0,r.jsxs)("span",{className:"text-xs font-mono text-text-muted",children:[N(t.freeMemory)," free"]})]})}function w(e){let{label:t,value:s,subtext:n,accent:a}=e;return(0,r.jsxs)("div",{className:"bg-bg-tertiary border border-border/50 rounded-lg p-4 text-center",children:[(0,r.jsx)("div",{className:"font-mono text-3xl font-bold ".concat({cyan:"text-accent",green:"text-success",orange:"text-warning",red:"text-error"}[a]," leading-none"),children:s}),(0,r.jsx)("div",{className:"text-[11px] text-text-muted uppercase tracking-wide mt-2",children:t}),(0,r.jsx)("div",{className:"text-xs text-text-muted mt-1",children:n})]})}function k(e){var t;let{agent:s}=e,n=s.rssBytes?s.rssBytes/1048576:0,a={normal:{bg:"bg-success/10",border:"border-success/30",text:"text-success",label:"Healthy"},warning:{bg:"bg-warning/10",border:"border-warning/30",text:"text-warning",label:"Warning"},critical:{bg:"bg-error/10",border:"border-error/30",text:"text-error",label:"Critical"},oom_imminent:{bg:"bg-error/20",border:"border-error/50",text:"text-error",label:"OOM Risk"}}[s.alertLevel||"normal"],l={growing:{icon:"↑",color:"text-warning",label:"Growing"},stable:{icon:"→",color:"text-success",label:"Stable"},shrinking:{icon:"↓",color:"text-accent",label:"Shrinking"},unknown:{icon:"?",color:"text-text-muted",label:"Unknown"}}[s.trend||"unknown"];return(0,r.jsxs)("div",{className:"".concat(a.bg," border ").concat(a.border," rounded-lg p-4 transition-all hover:scale-[1.01]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white text-sm font-semibold",style:{backgroundColor:i(s.name)},children:o(s.name)}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-semibold font-mono text-sm text-text-primary",children:s.name}),(0,r.jsxs)("div",{className:"text-xs text-text-muted",children:["PID: ",s.pid||"N/A"," • ",s.status]})]})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ".concat(a.bg," ").concat(a.text),children:a.label})})]}),(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"Memory Usage"}),(0,r.jsx)("span",{className:"text-sm font-mono font-semibold text-text-primary",children:N(s.rssBytes||0)})]}),(0,r.jsx)("div",{className:"h-3 bg-bg-primary rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all duration-500 ".concat("critical"===s.alertLevel||"oom_imminent"===s.alertLevel?"bg-gradient-to-r from-error to-error/70":"warning"===s.alertLevel?"bg-gradient-to-r from-warning to-warning/70":"bg-gradient-to-r from-accent to-[#6366f1]"),style:{width:"".concat(Math.min(n/2048*100,100),"%")}})}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"0"}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:"2 GB"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"text-lg font-mono font-bold text-accent",children:[(null===(t=s.cpuPercent)||void 0===t?void 0:t.toFixed(1))||"0","%"]}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted uppercase",children:"CPU"})]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"text-lg font-mono font-bold ".concat(l.color," flex items-center justify-center gap-1"),children:[(0,r.jsx)("span",{children:l.icon}),(0,r.jsx)("span",{className:"text-xs",children:l.label})]}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted uppercase",children:"Trend"})]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"text-lg font-mono font-bold text-[#a78bfa]",children:N(s.highWatermark||0)}),(0,r.jsx)("div",{className:"text-[10px] text-text-muted uppercase",children:"Peak"})]})]}),s.uptimeMs&&(0,r.jsxs)("div",{className:"mt-3 pt-3 border-t border-border/30 flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"Uptime"}),(0,r.jsx)("span",{className:"text-xs font-mono text-text-muted",children:d(Math.floor(s.uptimeMs/1e3))})]})]})}}},function(e){e.O(0,[648,116,971,117,744],function(){return e(e.s=8639)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{7773:function(e,t,n){Promise.resolve().then(n.bind(n,7340))},7340:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(7437),u=n(2265),a=n(8766),c=n(5899);function l(){let[e,t]=(0,u.useState)(!1),[n,l]=(0,u.useState)(!1);return((0,u.useEffect)(()=>{t(function(){let e=window.location.hostname,t=new URLSearchParams(window.location.search);if("true"===t.get("landing")||"true"===t.get("cloud")||e.includes("agent-relay.com")||e.includes("agentrelay.dev")||e.includes(".fly.dev"))return!0;let n=document.querySelector('meta[name="agent-relay-cloud"]');return(null==n?void 0:n.getAttribute("content"))==="true"||"true"===localStorage.getItem("agent-relay-cloud-mode")}()),l(!0)},[]),n)?e?(0,r.jsx)(a.fy,{}):(0,r.jsx)(c.g,{}):(0,r.jsx)("div",{className:"flex h-screen bg-bg-deep font-sans text-text-primary items-center justify-center",children:(0,r.jsx)("div",{className:"text-text-muted",children:"Loading..."})})}}},function(e){e.O(0,[732,30,532,891,116,83,899,766,971,117,744],function(){return e(e.s=7773)}),_N_E=e.O()}]);
|