agent-relay 1.3.1 → 1.3.3
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/.trajectories/active/traj_3yx9dy148mge.json +42 -0
- package/.trajectories/completed/2026-01/traj_1g7yx6qtg4ai.json +49 -0
- package/.trajectories/completed/2026-01/traj_1g7yx6qtg4ai.md +31 -0
- package/.trajectories/completed/2026-01/traj_4qwd4zmhfwp4.json +49 -0
- package/.trajectories/completed/2026-01/traj_4qwd4zmhfwp4.md +31 -0
- package/.trajectories/completed/2026-01/traj_6unwwmgyj5sq.json +109 -0
- package/.trajectories/completed/2026-01/traj_a0tqx8biw9c4.json +49 -0
- package/.trajectories/completed/2026-01/traj_a0tqx8biw9c4.md +31 -0
- package/.trajectories/completed/2026-01/traj_ax8uungxz2qh.json +66 -0
- package/.trajectories/completed/2026-01/traj_ax8uungxz2qh.md +36 -0
- package/.trajectories/completed/2026-01/traj_c9izbh2snpzf.json +49 -0
- package/.trajectories/completed/2026-01/traj_c9izbh2snpzf.md +31 -0
- package/.trajectories/completed/2026-01/traj_cpn70dw066nt.json +65 -0
- package/.trajectories/completed/2026-01/traj_cpn70dw066nt.md +37 -0
- package/.trajectories/completed/2026-01/traj_erglv2f8t9eh.json +36 -0
- package/.trajectories/completed/2026-01/traj_erglv2f8t9eh.md +21 -0
- package/.trajectories/completed/2026-01/traj_he75f24d1xfm.json +101 -0
- package/.trajectories/completed/2026-01/traj_he75f24d1xfm.md +52 -0
- package/.trajectories/completed/2026-01/traj_lgtodco7dp1n.json +61 -0
- package/.trajectories/completed/2026-01/traj_lgtodco7dp1n.md +36 -0
- package/.trajectories/completed/2026-01/traj_oszg9flv74pk.json +73 -0
- package/.trajectories/completed/2026-01/traj_oszg9flv74pk.md +41 -0
- package/.trajectories/completed/2026-01/traj_pulomd3y8cvj.json +77 -0
- package/.trajectories/completed/2026-01/traj_pulomd3y8cvj.md +42 -0
- package/.trajectories/completed/2026-01/traj_rsavt0jipi3c.json +109 -0
- package/.trajectories/completed/2026-01/traj_rsavt0jipi3c.md +56 -0
- package/.trajectories/completed/2026-01/traj_x721m1j9rzup.json +113 -0
- package/.trajectories/completed/2026-01/traj_x721m1j9rzup.md +57 -0
- package/.trajectories/completed/2026-01/traj_xjqvmep5ed3h.json +61 -0
- package/.trajectories/completed/2026-01/traj_xjqvmep5ed3h.md +36 -0
- package/.trajectories/completed/2026-01/traj_y7n6hfbf7dmg.json +49 -0
- package/.trajectories/completed/2026-01/traj_y7n6hfbf7dmg.md +31 -0
- package/.trajectories/completed/2026-01/traj_yvfkwnkdiso2.json +49 -0
- package/.trajectories/completed/2026-01/traj_yvfkwnkdiso2.md +31 -0
- package/.trajectories/index.json +140 -1
- package/README.md +23 -9
- package/TRAIL_GIT_AUTH_FIX.md +113 -0
- package/deploy/workspace/codex.config.toml +1 -1
- package/deploy/workspace/entrypoint.sh +20 -79
- package/deploy/workspace/gh-relay +156 -0
- package/deploy/workspace/git-credential-relay +5 -1
- package/dist/bridge/multi-project-client.js +13 -10
- package/dist/bridge/spawner.d.ts +2 -0
- package/dist/bridge/spawner.js +58 -76
- package/dist/bridge/types.d.ts +2 -0
- package/dist/cli/index.d.ts +8 -6
- package/dist/cli/index.js +297 -30
- package/dist/cloud/api/admin.js +16 -3
- package/dist/cloud/api/codex-auth-helper.js +28 -8
- package/dist/cloud/api/consensus.d.ts +13 -0
- package/dist/cloud/api/consensus.js +259 -0
- package/dist/cloud/api/daemons.js +205 -1
- package/dist/cloud/api/git.js +37 -7
- package/dist/cloud/api/onboarding.js +4 -1
- package/dist/cloud/api/provider-env.d.ts +5 -0
- package/dist/cloud/api/provider-env.js +27 -0
- package/dist/cloud/api/providers.js +2 -0
- package/dist/cloud/api/test-helpers.js +130 -0
- package/dist/cloud/api/workspaces.js +38 -3
- package/dist/cloud/db/bulk-ingest.d.ts +88 -0
- package/dist/cloud/db/bulk-ingest.js +268 -0
- package/dist/cloud/db/drizzle.d.ts +33 -0
- package/dist/cloud/db/drizzle.js +174 -2
- package/dist/cloud/db/index.d.ts +24 -5
- package/dist/cloud/db/index.js +19 -4
- package/dist/cloud/db/schema.d.ts +397 -3
- package/dist/cloud/db/schema.js +75 -1
- package/dist/cloud/provisioner/index.d.ts +8 -0
- package/dist/cloud/provisioner/index.js +256 -50
- package/dist/cloud/server.js +47 -3
- package/dist/cloud/services/index.d.ts +1 -0
- package/dist/cloud/services/index.js +2 -0
- package/dist/cloud/services/nango.d.ts +3 -4
- package/dist/cloud/services/nango.js +11 -33
- package/dist/cloud/services/workspace-keepalive.d.ts +76 -0
- package/dist/cloud/services/workspace-keepalive.js +234 -0
- package/dist/config/relay-config.d.ts +23 -0
- package/dist/config/relay-config.js +23 -0
- package/dist/daemon/agent-manager.d.ts +20 -1
- package/dist/daemon/agent-manager.js +51 -0
- package/dist/daemon/agent-registry.js +4 -4
- package/dist/daemon/agent-signing.d.ts +158 -0
- package/dist/daemon/agent-signing.js +523 -0
- package/dist/daemon/api.js +18 -1
- package/dist/daemon/cli-auth.d.ts +4 -1
- package/dist/daemon/cli-auth.js +55 -11
- package/dist/daemon/cloud-sync.d.ts +47 -1
- package/dist/daemon/cloud-sync.js +152 -3
- package/dist/daemon/connection.d.ts +28 -0
- package/dist/daemon/connection.js +113 -22
- package/dist/daemon/consensus-integration.d.ts +167 -0
- package/dist/daemon/consensus-integration.js +371 -0
- package/dist/daemon/consensus.d.ts +271 -0
- package/dist/daemon/consensus.js +632 -0
- package/dist/daemon/delivery-tracker.d.ts +34 -0
- package/dist/daemon/delivery-tracker.js +104 -0
- package/dist/daemon/enhanced-features.d.ts +118 -0
- package/dist/daemon/enhanced-features.js +178 -0
- package/dist/daemon/index.d.ts +4 -0
- package/dist/daemon/index.js +5 -0
- package/dist/daemon/rate-limiter.d.ts +68 -0
- package/dist/daemon/rate-limiter.js +130 -0
- package/dist/daemon/router.d.ts +18 -11
- package/dist/daemon/router.js +57 -113
- package/dist/daemon/server.d.ts +13 -1
- package/dist/daemon/server.js +71 -9
- package/dist/daemon/sync-queue.d.ts +116 -0
- package/dist/daemon/sync-queue.js +361 -0
- package/dist/dashboard/out/404.html +1 -1
- package/dist/dashboard/out/_next/static/chunks/116-de2a4ac06e5000dc.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/847-f1f467060f32afff.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/919-87d604a5d76c1fbd.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/app/{page-c617745b81344f4f.js → page-7f64824ae7d06707.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/app/cloud/link/page-3f559d393902aad2.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/login/page-16d1715ddaa874ee.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/{page-dc786c183425c2ac.js → page-814efc4d77b4191d.js} +1 -1
- package/dist/dashboard/out/_next/static/chunks/{main-2ee6beb2ae96d210.js → main-5a40a5ae29646e1b.js} +1 -1
- package/dist/dashboard/out/_next/static/css/44d2b52637b511bc.css +1 -0
- package/dist/dashboard/out/app/onboarding.html +1 -1
- package/dist/dashboard/out/app/onboarding.txt +1 -1
- package/dist/dashboard/out/app.html +1 -1
- package/dist/dashboard/out/app.txt +2 -2
- package/dist/dashboard/out/cloud/link.html +1 -0
- package/dist/dashboard/out/cloud/link.txt +7 -0
- package/dist/dashboard/out/connect-repos.html +1 -1
- package/dist/dashboard/out/connect-repos.txt +1 -1
- 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 -3
- 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 +1 -1
- package/dist/dashboard/out/providers/setup/claude.html +1 -1
- package/dist/dashboard/out/providers/setup/claude.txt +1 -1
- package/dist/dashboard/out/providers/setup/codex.html +1 -1
- package/dist/dashboard/out/providers/setup/codex.txt +1 -1
- package/dist/dashboard/out/providers.html +1 -1
- package/dist/dashboard/out/providers.txt +1 -1
- package/dist/dashboard/out/signup.html +2 -2
- package/dist/dashboard/out/signup.txt +1 -1
- package/dist/dashboard-server/server.js +244 -28
- package/dist/health-worker-manager.d.ts +62 -0
- package/dist/health-worker-manager.js +144 -0
- package/dist/health-worker.d.ts +9 -0
- package/dist/health-worker.js +79 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/dist/memory/context-compaction.d.ts +156 -0
- package/dist/memory/context-compaction.js +453 -0
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.js +1 -0
- package/dist/protocol/channels.js +4 -4
- package/dist/protocol/framing.d.ts +72 -10
- package/dist/protocol/framing.js +194 -25
- package/dist/storage/adapter.d.ts +8 -1
- package/dist/storage/adapter.js +11 -0
- package/dist/storage/batched-sqlite-adapter.d.ts +71 -0
- package/dist/storage/batched-sqlite-adapter.js +183 -0
- package/dist/storage/dead-letter-queue.d.ts +196 -0
- package/dist/storage/dead-letter-queue.js +427 -0
- package/dist/storage/dlq-adapter.d.ts +195 -0
- package/dist/storage/dlq-adapter.js +664 -0
- package/dist/trajectory/config.d.ts +32 -14
- package/dist/trajectory/config.js +38 -16
- package/dist/trajectory/integration.js +217 -64
- package/dist/utils/git-remote.d.ts +47 -0
- package/dist/utils/git-remote.js +125 -0
- package/dist/utils/id-generator.d.ts +35 -0
- package/dist/utils/id-generator.js +60 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/precompiled-patterns.d.ts +110 -0
- package/dist/utils/precompiled-patterns.js +322 -0
- package/dist/wrapper/auth-detection.js +1 -1
- package/dist/wrapper/base-wrapper.d.ts +40 -0
- package/dist/wrapper/base-wrapper.js +60 -6
- package/dist/wrapper/client.d.ts +14 -4
- package/dist/wrapper/client.js +89 -31
- package/dist/wrapper/idle-detector.d.ts +102 -0
- package/dist/wrapper/idle-detector.js +279 -0
- package/dist/wrapper/parser.d.ts +4 -0
- package/dist/wrapper/parser.js +19 -1
- package/dist/wrapper/pty-wrapper.d.ts +14 -2
- package/dist/wrapper/pty-wrapper.js +132 -32
- package/dist/wrapper/shared.d.ts +1 -1
- package/dist/wrapper/shared.js +1 -1
- package/dist/wrapper/tmux-wrapper.d.ts +20 -2
- package/dist/wrapper/tmux-wrapper.js +163 -40
- package/package.json +3 -1
- package/scripts/run-migrations.js +43 -0
- package/scripts/verify-schema.js +134 -0
- package/tests/benchmarks/protocol.bench.ts +310 -0
- package/dist/dashboard/out/_next/static/chunks/116-2502180def231162.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/899-fc02ed79e3de4302.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/login/page-c22d080201cbd9fb.js +0 -1
- package/dist/dashboard/out/_next/static/css/48a8fbe3e659080e.css +0 -1
- /package/dist/dashboard/out/_next/static/{sDcbGRTYLcpPvyTs_rsNb → R-uQOUcOLINtsp6ACeZa9}/_buildManifest.js +0 -0
- /package/dist/dashboard/out/_next/static/{sDcbGRTYLcpPvyTs_rsNb → R-uQOUcOLINtsp6ACeZa9}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
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()}]);
|
|
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(7919),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,116,891,83,919,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([[363],{6482:function(e,a,t){Promise.resolve().then(t.bind(t,4680))},4680:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return x}});var c=t(7437),s=t(29),r=t.n(s),n=t(2265),l=t(9376),d=t(9116);function o(){return(0,c.jsx)("div",{className:"relative min-h-screen flex items-center justify-center p-8 bg-bg-deep overflow-hidden",children:(0,c.jsxs)("div",{className:"bg-gradient-to-br from-bg-secondary to-bg-primary border border-accent-cyan/15 rounded-2xl p-12 shadow-xl backdrop-blur-xl",children:[(0,c.jsx)("div",{className:"w-12 h-12 mx-auto mb-6 border-3 border-accent-cyan/20 border-t-accent-cyan rounded-full animate-spin"}),(0,c.jsx)("p",{className:"text-center text-text-secondary",children:"Loading..."})]})})}function i(){var e;let a=(0,l.useSearchParams)(),[t,s]=(0,n.useState)("loading"),[o,i]=(0,n.useState)(null),[x,f]=(0,n.useState)(null),[m,b]=(0,n.useState)(""),[p,h]=(0,n.useState)(!1),[u,y]=(0,n.useState)([]),[j,g]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=a.get("code"),t=a.get("machine"),c=a.get("name");if(!e||!t||!c){s("error"),b("Invalid link URL. Please run agent-relay cloud link again.");return}i({code:e,machineId:t,machineName:c}),w()},[a]);let w=async()=>{try{var e,a;let t=await d.hi.get("/api/auth/session");if(t.authenticated&&(null===(e=t.user)||void 0===e?void 0:e.id)){let e=await d.hi.get("/api/workspaces");y(e.workspaces||[]),(null===(a=e.workspaces)||void 0===a?void 0:a.length)===1&&g(e.workspaces[0].id),s("ready")}else s("auth-required")}catch(e){console.error("Auth check failed:",e),s("auth-required")}},N=async()=>{if(o){if(u.length>0&&!j){b("Please select a workspace");return}s("linking"),b("");try{let e=await d.hi.post("/api/daemons/link",{machineId:o.machineId,name:o.machineName,workspaceId:j,metadata:{linkedVia:"cli",userAgent:navigator.userAgent}});f({apiKey:e.apiKey,daemonId:e.daemonId,workspaceId:e.workspaceId}),s("success")}catch(e){console.error("Link failed:",e),b(e.message||"Failed to link machine. Please try again."),s("error")}}},k=(0,n.useCallback)(async()=>{if(null==x?void 0:x.apiKey)try{await navigator.clipboard.writeText(x.apiKey),h(!0),setTimeout(()=>h(!1),2e3)}catch(e){console.error("Copy failed:",e)}},[null==x?void 0:x.apiKey]);return(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf relative min-h-screen flex items-center justify-center p-8 bg-bg-deep overflow-hidden",children:[(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf fixed inset-0 pointer-events-none",children:[(0,c.jsx)("div",{style:{backgroundImage:"linear-gradient(rgba(0, 217, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 217, 255, 0.03) 1px, transparent 1px)",backgroundSize:"80px 80px",maskImage:"radial-gradient(ellipse 70% 50% at 50% 50%, black 20%, transparent 80%)",animation:"grid-drift 20s linear infinite"},className:"jsx-9cb8c5914f4e0cdf absolute inset-0 opacity-30"}),(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-accent-cyan/10 rounded-full blur-3xl animate-pulse-glow"}),(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf absolute inset-0",children:[...Array(20)].map((e,a)=>(0,c.jsx)("div",{style:{left:"".concat(100*Math.random(),"%"),top:"".concat(100*Math.random(),"%"),animation:"particle-float ".concat(3+4*Math.random(),"s ease-in-out infinite"),animationDelay:"".concat(5*Math.random(),"s")},className:"jsx-9cb8c5914f4e0cdf absolute w-0.5 h-0.5 bg-accent-cyan rounded-full shadow-glow-cyan opacity-0"},a))})]}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf relative z-10 w-full max-width-[600px] animate-slide-up",children:[(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf text-center mb-12",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf inline-flex mb-6 text-accent-cyan animate-pulse",children:(0,c.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",className:"jsx-9cb8c5914f4e0cdf drop-shadow-glow-cyan",children:[(0,c.jsx)("path",{d:"M16 4L28 11V21L16 28L4 21V11L16 4Z",stroke:"currentColor",strokeWidth:"2",className:"jsx-9cb8c5914f4e0cdf"}),(0,c.jsx)("circle",{cx:"16",cy:"16",r:"4",fill:"currentColor",className:"jsx-9cb8c5914f4e0cdf"})]})}),(0,c.jsx)("h1",{className:"jsx-9cb8c5914f4e0cdf font-display text-4xl font-bold mb-3 bg-gradient-to-r from-text-primary to-accent-cyan bg-clip-text text-transparent",children:"Link Machine"}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-xl text-text-secondary",children:"Connect this machine to Agent Relay Cloud"})]}),"loading"===t&&(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf bg-gradient-to-br from-bg-secondary to-bg-primary border border-accent-cyan/15 rounded-2xl p-12 shadow-xl backdrop-blur-xl",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf w-12 h-12 mx-auto mb-6 border-3 border-accent-cyan/20 border-t-accent-cyan rounded-full animate-spin"}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-center text-text-secondary",children:"Verifying session..."})]}),"auth-required"===t&&(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf bg-gradient-to-br from-bg-secondary to-bg-primary border border-accent-cyan/15 rounded-2xl p-12 shadow-xl backdrop-blur-xl",children:(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf text-center",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf text-5xl mb-6 animate-bounce",children:"\uD83D\uDD10"}),(0,c.jsx)("h2",{className:"jsx-9cb8c5914f4e0cdf font-display text-2xl font-semibold mb-4 text-text-primary",children:"Authentication Required"}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-text-secondary mb-8 leading-relaxed",children:"Sign in to link this machine to your Agent Relay account."}),(0,c.jsx)("button",{onClick:()=>{let e=window.location.href;window.location.href="/login?return=".concat(encodeURIComponent(e))},className:"jsx-9cb8c5914f4e0cdf w-full flex items-center justify-center gap-3 px-8 py-4 bg-gradient-to-r from-accent-cyan to-accent-cyan/80 hover:from-accent-cyan/90 hover:to-accent-cyan/70 text-text-inverse font-display font-semibold text-lg rounded-xl shadow-glow-cyan transition-all duration-200 hover:-translate-y-0.5 hover:shadow-xl",children:"Sign In with GitHub"})]})}),"ready"===t&&o&&(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf bg-gradient-to-br from-bg-secondary to-bg-primary border border-accent-cyan/15 rounded-2xl p-12 shadow-xl backdrop-blur-xl",children:[(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf bg-black/30 border border-border-subtle rounded-xl p-6 mb-8",children:[(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf flex justify-between items-center py-3 border-b border-border-subtle",children:[(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf text-sm font-medium text-text-secondary",children:"Machine Name"}),(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf text-base font-medium text-text-primary",children:o.machineName})]}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf flex justify-between items-center pt-3",children:[(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf text-sm font-medium text-text-secondary",children:"Machine ID"}),(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf font-mono text-sm text-accent-cyan",children:o.machineId})]})]}),u.length>0&&(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf mb-8",children:[(0,c.jsx)("label",{className:"jsx-9cb8c5914f4e0cdf block text-sm font-medium text-text-secondary mb-3",children:"Select Workspace"}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-sm text-text-muted mb-4",children:"Local agents from this machine will appear in the selected workspace's dashboard."}),(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf space-y-2",children:u.map(e=>(0,c.jsxs)("button",{onClick:()=>g(e.id),className:"jsx-9cb8c5914f4e0cdf "+"w-full flex items-center gap-3 p-4 rounded-xl border transition-all ".concat(j===e.id?"bg-accent-cyan/10 border-accent-cyan/50 shadow-glow-cyan":"bg-black/20 border-border-subtle hover:border-accent-cyan/30"),children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf "+"w-3 h-3 rounded-full ".concat("running"===e.status?"bg-success":"bg-gray-500")}),(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf text-text-primary font-medium",children:e.name}),j===e.id&&(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf ml-auto text-accent-cyan",children:"✓"})]},e.id))}),m&&!m.includes("Failed")&&(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf mt-2 text-sm text-error",children:m})]}),0===u.length&&(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf flex gap-4 bg-accent-cyan/8 border border-accent-cyan/20 rounded-xl p-5 mb-8",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf text-2xl flex-shrink-0",children:"\uD83D\uDCC1"}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf",children:[(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-text-primary text-[15px] leading-relaxed mb-2",children:"No workspaces found. Create a workspace first to link this machine."}),(0,c.jsx)("a",{href:"/app",className:"jsx-9cb8c5914f4e0cdf text-accent-cyan hover:underline text-sm",children:"Go to Dashboard →"})]})]}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf flex gap-4 bg-warning/8 border border-warning/20 rounded-xl p-5 mb-8",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf text-2xl flex-shrink-0 animate-kill-pulse",children:"⚠️"}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-text-primary text-[15px] leading-relaxed",children:"This will generate an API key that grants full access to your Agent Relay account. Keep it secure and never share it publicly."})]}),(0,c.jsxs)("button",{onClick:N,disabled:0===u.length,className:"jsx-9cb8c5914f4e0cdf "+"w-full flex items-center justify-center gap-3 px-8 py-4 font-display font-semibold text-lg rounded-xl transition-all duration-200 ".concat(0===u.length?"bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gradient-to-r from-accent-cyan to-success hover:from-accent-cyan/90 hover:to-success/90 text-text-inverse shadow-glow-cyan hover:-translate-y-0.5 hover:shadow-2xl animate-pulse-glow"),children:[(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf text-xl",children:"\uD83D\uDD17"}),(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf",children:"Link This Machine"})]})]}),"linking"===t&&(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf bg-gradient-to-br from-bg-secondary to-bg-primary border border-accent-cyan/15 rounded-2xl p-12 shadow-xl backdrop-blur-xl",children:[(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf relative w-30 h-30 mx-auto mb-8",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf absolute inset-0 border-3 border-accent-cyan rounded-full animate-ping opacity-75"}),(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf absolute inset-10 bg-accent-cyan rounded-full shadow-glow-cyan animate-pulse"})]}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-center text-lg text-text-secondary",children:"Generating API key..."})]}),"success"===t&&x&&(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf bg-gradient-to-br from-bg-secondary to-success/5 border border-success/30 rounded-2xl p-12 shadow-xl backdrop-blur-xl",children:[(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf text-center mb-10",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf inline-flex items-center justify-center w-16 h-16 mb-6 bg-gradient-to-r from-success to-accent-cyan text-text-inverse text-3xl font-bold rounded-full shadow-glow-green animate-bounce",children:"✓"}),(0,c.jsx)("h2",{className:"jsx-9cb8c5914f4e0cdf font-display text-2xl font-semibold mb-3 text-text-primary",children:"Machine Linked Successfully"}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-text-secondary",children:"Copy this API key and paste it into your terminal"}),x.workspaceId&&(0,c.jsxs)("p",{className:"jsx-9cb8c5914f4e0cdf mt-2 text-sm text-accent-cyan",children:["Linked to workspace: ",(null===(e=u.find(e=>e.id===x.workspaceId))||void 0===e?void 0:e.name)||"Unknown"]})]}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf mb-10",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf font-mono text-xs font-semibold uppercase tracking-wide text-accent-cyan mb-3",children:"API Key"}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf relative flex items-center gap-4 bg-black/50 border-2 border-accent-cyan/30 rounded-xl p-5 shadow-glow-cyan",children:[(0,c.jsx)("code",{className:"jsx-9cb8c5914f4e0cdf flex-1 font-mono text-[15px] text-success break-all select-all drop-shadow-glow-green",children:x.apiKey}),(0,c.jsx)("button",{onClick:k,title:"Copy to clipboard",className:"jsx-9cb8c5914f4e0cdf "+"flex-shrink-0 w-11 h-11 flex items-center justify-center rounded-lg text-xl transition-all duration-200 ".concat(p?"bg-success/20 border border-success/50 text-success":"bg-accent-cyan/15 border border-accent-cyan/30 text-accent-cyan hover:bg-accent-cyan/25 hover:border-accent-cyan/50 hover:scale-105"),children:p?"✓":"\uD83D\uDCCB"})]})]}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf bg-black/30 border border-border-subtle rounded-xl p-6 mb-6",children:[(0,c.jsx)("h3",{className:"jsx-9cb8c5914f4e0cdf font-display text-lg font-semibold mb-4 text-text-primary",children:"Next Steps:"}),(0,c.jsxs)("ol",{className:"jsx-9cb8c5914f4e0cdf space-y-2 text-text-secondary leading-relaxed pl-5",children:[(0,c.jsx)("li",{className:"jsx-9cb8c5914f4e0cdf",children:"Copy the API key above"}),(0,c.jsx)("li",{className:"jsx-9cb8c5914f4e0cdf",children:"Return to your terminal"}),(0,c.jsx)("li",{className:"jsx-9cb8c5914f4e0cdf",children:"Paste the key when prompted"}),(0,c.jsx)("li",{className:"jsx-9cb8c5914f4e0cdf",children:"Your machine is now linked to Agent Relay Cloud"})]})]}),(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf p-5 bg-warning/8 border border-warning/20 rounded-xl text-text-primary text-[15px] leading-relaxed",children:[(0,c.jsx)("strong",{className:"jsx-9cb8c5914f4e0cdf text-warning font-semibold",children:"Important:"})," This key will only be shown once. Store it securely if you need it later. You can regenerate a new key by running"," ",(0,c.jsx)("code",{className:"jsx-9cb8c5914f4e0cdf font-mono text-sm px-1.5 py-0.5 bg-black/30 rounded text-accent-cyan",children:"agent-relay cloud link"})," ","again."]})]}),"error"===t&&(0,c.jsxs)("div",{className:"jsx-9cb8c5914f4e0cdf bg-gradient-to-br from-bg-secondary to-error/5 border border-error/30 rounded-2xl p-12 shadow-xl backdrop-blur-xl text-center",children:[(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf inline-flex items-center justify-center w-16 h-16 mb-6 bg-error/15 text-error text-3xl font-bold rounded-full border-2 border-error/30",children:"✕"}),(0,c.jsx)("h2",{className:"jsx-9cb8c5914f4e0cdf font-display text-2xl font-semibold mb-4 text-text-primary",children:"Link Failed"}),(0,c.jsx)("p",{className:"jsx-9cb8c5914f4e0cdf text-error mb-8 leading-relaxed",children:m}),(0,c.jsx)("button",{onClick:()=>window.location.reload(),className:"jsx-9cb8c5914f4e0cdf w-full px-8 py-4 bg-bg-hover hover:bg-bg-active border border-border-light hover:border-border-medium text-text-primary font-display font-semibold text-lg rounded-xl transition-all duration-200",children:"Try Again"})]}),(0,c.jsx)("div",{className:"jsx-9cb8c5914f4e0cdf mt-8 text-center",children:(0,c.jsxs)("a",{href:"/app",className:"jsx-9cb8c5914f4e0cdf inline-flex items-center gap-2 text-text-secondary hover:text-accent-cyan transition-colors duration-200",children:[(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf",children:"←"}),(0,c.jsx)("span",{className:"jsx-9cb8c5914f4e0cdf",children:"Back to Dashboard"})]})})]}),(0,c.jsx)(r(),{id:"9cb8c5914f4e0cdf",children:"@-webkit-keyframes grid-drift{0%{-webkit-transform:translate(0,0);transform:translate(0,0)}100%{-webkit-transform:translate(80px,80px);transform:translate(80px,80px)}}@-moz-keyframes grid-drift{0%{-moz-transform:translate(0,0);transform:translate(0,0)}100%{-moz-transform:translate(80px,80px);transform:translate(80px,80px)}}@-o-keyframes grid-drift{0%{-o-transform:translate(0,0);transform:translate(0,0)}100%{-o-transform:translate(80px,80px);transform:translate(80px,80px)}}@keyframes grid-drift{0%{-webkit-transform:translate(0,0);-moz-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}100%{-webkit-transform:translate(80px,80px);-moz-transform:translate(80px,80px);-o-transform:translate(80px,80px);transform:translate(80px,80px)}}@-webkit-keyframes particle-float{0%{opacity:0;-webkit-transform:translatey(0);transform:translatey(0)}10%{opacity:.6}90%{opacity:.6}100%{opacity:0;-webkit-transform:translatey(-100px);transform:translatey(-100px)}}@-moz-keyframes particle-float{0%{opacity:0;-moz-transform:translatey(0);transform:translatey(0)}10%{opacity:.6}90%{opacity:.6}100%{opacity:0;-moz-transform:translatey(-100px);transform:translatey(-100px)}}@-o-keyframes particle-float{0%{opacity:0;-o-transform:translatey(0);transform:translatey(0)}10%{opacity:.6}90%{opacity:.6}100%{opacity:0;-o-transform:translatey(-100px);transform:translatey(-100px)}}@keyframes particle-float{0%{opacity:0;-webkit-transform:translatey(0);-moz-transform:translatey(0);-o-transform:translatey(0);transform:translatey(0)}10%{opacity:.6}90%{opacity:.6}100%{opacity:0;-webkit-transform:translatey(-100px);-moz-transform:translatey(-100px);-o-transform:translatey(-100px);transform:translatey(-100px)}}"})]})}function x(){return(0,c.jsx)(n.Suspense,{fallback:(0,c.jsx)(o,{}),children:(0,c.jsx)(i,{})})}}},function(e){e.O(0,[847,116,971,117,744],function(){return e(e.s=6482)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
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 d}});var r=n(7437),s=n(2265),a=n(9376),i=n(282),o=n(6272);function c(){return(0,r.jsx)("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:"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)(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:"Loading..."})]})})})}function l(){let e=(0,a.useSearchParams)(),[t,n]=(0,s.useState)(!1),[c,l]=(0,s.useState)(!1),[d,u]=(0,s.useState)(""),[h,x]=(0,s.useState)(""),m=e.get("return"),f=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await fetch("/api/auth/nango/login-session",{credentials:"include"}),r=await t.json();if(!e)return;if(!t.ok||!r.sessionToken){x("Failed to initialize. Please refresh the page.");return}f.current=new i.ZP({connectSessionToken:r.sessionToken}),n(!0)}catch(t){e&&(console.error("Init error:",t),x("Failed to initialize. Please refresh the page."))}})(),()=>{e=!1}},[]);let p=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()},g=async e=>{try{u("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 p(e);if(t&&t.ready){m?window.location.href=m: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),x(e instanceof Error?e.message:"Authentication failed"),l(!1),u("")}},j=async()=>{if(!f.current){x("Not ready. Please refresh the page.");return}l(!0),x(""),u("Connecting to GitHub...");try{let e=await f.current.auth("github");if(e&&"connectionId"in e)await g(e.connectionId);else throw Error("No connection ID returned")}catch(t){var e;if(console.error("GitHub auth error:",t),"user_cancelled"===t.type||(null===(e=t.message)||void 0===e?void 0:e.includes("closed"))){l(!1),u(""),fetch("/api/auth/nango/login-session",{credentials:"include"}).then(e=>e.json()).then(e=>{e.sessionToken&&(f.current=new i.ZP({connectSessionToken:e.sessionToken}),n(!0))});return}x(t.message||"Authentication failed"),l(!1),u("")}};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)(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:"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:[h&&(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:h})}),(0,r.jsx)("button",{type:"button",onClick:j,disabled:!t||c,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:t?c?(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:d||"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"})})]})]})}function d(){return(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)(c,{}),children:(0,r.jsx)(l,{})})}},9376:function(e,t,n){"use strict";var r=n(5475);n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},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([[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(
|
|
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(7919);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,116,891,83,919,766,971,117,744],function(){return e(e.s=7773)}),_N_E=e.O()}]);
|