agent-relay 1.3.2 → 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/README.md +23 -9
- package/dist/bridge/spawner.js +39 -75
- package/dist/cli/index.d.ts +8 -6
- package/dist/cli/index.js +251 -30
- package/dist/daemon/agent-manager.js +4 -0
- package/dist/daemon/connection.js +17 -9
- package/dist/daemon/router.js +2 -2
- package/dist/dashboard/out/404.html +1 -0
- package/dist/dashboard/out/_next/static/R-uQOUcOLINtsp6ACeZa9/_buildManifest.js +1 -0
- package/dist/dashboard/out/_next/static/R-uQOUcOLINtsp6ACeZa9/_ssgManifest.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/116-de2a4ac06e5000dc.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/117-f7b8ab0809342e77.js +2 -0
- package/dist/dashboard/out/_next/static/chunks/282-980c2eb8fff20123.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/532-bace199897eeab37.js +9 -0
- package/dist/dashboard/out/_next/static/chunks/648-5cc6e1921389a58a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/766-b54f0853794b78c3.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/83-b51836037078006c.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/847-f1f467060f32afff.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/891-6cd50de1224f70bb.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/919-87d604a5d76c1fbd.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/_not-found/page-53b8a69f76db17d0.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/app/onboarding/page-8553743baca53a00.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/app/page-7f64824ae7d06707.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/cloud/link/page-3f559d393902aad2.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/connect-repos/page-3538dfe0ffe984b8.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/history/page-abb9ab2d329f56e9.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/layout-c0d118c0f92d969c.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/metrics/page-f829604fb75a831a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/page-814efc4d77b4191d.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/pricing/page-b08ed1c34d14434a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/providers/page-84322991d7244499.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/providers/setup/[provider]/page-05606941a8e2be83.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/app/signup/page-68d34f50baa8ab6b.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/e868780c-48e5f147c90a3a41.js +18 -0
- package/dist/dashboard/out/_next/static/chunks/fd9d1056-609918ca7b6280bb.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/framework-f66176bb897dc684.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/main-5a40a5ae29646e1b.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/main-app-6e8e8d3ef4e0192a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/pages/_app-72b849fbd24ac258.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/pages/_error-7ba65e1336b92748.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/dist/dashboard/out/_next/static/chunks/webpack-1cdd8ed57114d5e1.js +1 -0
- package/dist/dashboard/out/_next/static/css/44d2b52637b511bc.css +1 -0
- package/dist/dashboard/out/_next/static/css/fe4b28883eeff359.css +1 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-128.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-256.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-32.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-512.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-64.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo.svg +45 -0
- package/dist/dashboard/out/alt-logos/logo.svg +38 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-128.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-256.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-32.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-512.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-64.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo.svg +38 -0
- package/dist/dashboard/out/app/onboarding.html +1 -0
- package/dist/dashboard/out/app/onboarding.txt +7 -0
- package/dist/dashboard/out/app.html +1 -0
- package/dist/dashboard/out/app.txt +7 -0
- package/dist/dashboard/out/apple-icon.png +0 -0
- 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 -0
- package/dist/dashboard/out/connect-repos.txt +7 -0
- package/dist/dashboard/out/history.html +1 -0
- package/dist/dashboard/out/history.txt +7 -0
- package/dist/dashboard/out/index.html +1 -0
- package/dist/dashboard/out/index.txt +7 -0
- package/dist/dashboard/out/login.html +5 -0
- package/dist/dashboard/out/login.txt +7 -0
- package/dist/dashboard/out/metrics.html +1 -0
- package/dist/dashboard/out/metrics.txt +7 -0
- package/dist/dashboard/out/pricing.html +13 -0
- package/dist/dashboard/out/pricing.txt +7 -0
- package/dist/dashboard/out/providers/setup/claude.html +1 -0
- package/dist/dashboard/out/providers/setup/claude.txt +8 -0
- package/dist/dashboard/out/providers/setup/codex.html +1 -0
- package/dist/dashboard/out/providers/setup/codex.txt +8 -0
- package/dist/dashboard/out/providers.html +1 -0
- package/dist/dashboard/out/providers.txt +7 -0
- package/dist/dashboard/out/signup.html +6 -0
- package/dist/dashboard/out/signup.txt +7 -0
- package/dist/dashboard-server/metrics.d.ts +105 -0
- package/dist/dashboard-server/metrics.js +193 -0
- package/dist/dashboard-server/needs-attention.d.ts +24 -0
- package/dist/dashboard-server/needs-attention.js +78 -0
- package/dist/dashboard-server/server.d.ts +15 -0
- package/dist/dashboard-server/server.js +3992 -0
- package/dist/dashboard-server/start.d.ts +6 -0
- package/dist/dashboard-server/start.js +13 -0
- package/dist/dashboard-server/user-bridge.d.ts +103 -0
- package/dist/dashboard-server/user-bridge.js +189 -0
- package/dist/wrapper/base-wrapper.d.ts +4 -0
- package/dist/wrapper/base-wrapper.js +12 -4
- package/dist/wrapper/client.js +5 -0
- package/dist/wrapper/parser.js +2 -2
- package/dist/wrapper/pty-wrapper.d.ts +7 -1
- package/dist/wrapper/pty-wrapper.js +81 -5
- package/dist/wrapper/shared.d.ts +1 -1
- package/dist/wrapper/shared.js +1 -1
- package/dist/wrapper/tmux-wrapper.d.ts +8 -1
- package/dist/wrapper/tmux-wrapper.js +103 -28
- package/package.json +5 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[83],{3083:function(e,t,s){s.d(t,{j:function(){return i}});var a=s(7437),n=s(2265);let r={codex:"openai"};function i(e){let{provider:t,workspaceId:s,csrfToken:i,onSuccess:c,onCancel:o,onError:l,useDeviceFlow:d=!1}=e,[u,h]=(0,n.useState)("idle"),[x,m]=(0,n.useState)(null),[p,b]=(0,n.useState)(null),[y,g]=(0,n.useState)(""),[f,w]=(0,n.useState)(null),[j,N]=(0,n.useState)(null),[v,k]=(0,n.useState)(null),[C,S]=(0,n.useState)(null),[T,A]=(0,n.useState)(!1),[I,E]=(0,n.useState)(!1),[O,F]=(0,n.useState)(!1),[L,P]=(0,n.useState)(!1),R=(0,n.useRef)(!1),U=(0,n.useRef)(!1),W=(0,n.useRef)(!1),z=r[t.id]||t.id,B=t.requiresUrlCopy||"codex"===t.id||"openai"===z,M=(0,n.useCallback)(async()=>{h("starting"),w(null),R.current=!1;try{let e={"Content-Type":"application/json"};i&&(e["X-CSRF-Token"]=i);let t=await fetch("/api/onboarding/cli/".concat(z,"/start"),{method:"POST",credentials:"include",headers:e,body:JSON.stringify({workspaceId:s,useDeviceFlow:d})}),a=await t.json();if(!t.ok)throw Error(a.error||"Failed to start authentication");if("success"===a.status||a.alreadyAuthenticated){h("success"),c();return}b(a.sessionId),a.useDeviceFlow&&P(!0),a.authUrl?(m(a.authUrl),h("waiting"),(!B||a.useDeviceFlow)&&J(a.authUrl),K(a.sessionId)):a.sessionId&&K(a.sessionId)}catch(t){let e=t instanceof Error?t.message:"Failed to start authentication";w(e),h("error"),l(e)}},[z,s,i,d,c,l,B]),V=(0,n.useRef)(null),D=(0,n.useRef)(null),X=(0,n.useCallback)((e,t)=>{if(W.current)return;W.current=!0,F(!0);let s=0,a=async()=>{if(s>=120||!W.current){W.current=!1,F(!1);return}try{let n=await fetch("/api/auth/codex-helper/auth-status/".concat(e),{credentials:"include"});if(n.ok&&(await n.json()).authenticated){W.current=!1,F(!1),D.current&&await D.current(t);return}s++,setTimeout(a,5e3)}catch(e){console.error("CLI poll error:",e),s++,setTimeout(a,5e3)}};a()},[]),_=(0,n.useCallback)(async()=>{if(B){A(!0);try{let e={"Content-Type":"application/json"};i&&(e["X-CSRF-Token"]=i);let t=await fetch("/api/auth/codex-helper/cli-session",{method:"POST",credentials:"include",headers:e,body:JSON.stringify({workspaceId:s,authUrl:x,sessionId:p})});if(t.ok){let e=await t.json();N(e.commandWithUrl||e.command),e.workspaceId?(k(e.workspaceId),S(e.workspaceName||null),X(e.workspaceId,p||void 0)):e.authSessionId&&(k(e.authSessionId),X(e.authSessionId,p||void 0))}}catch(e){console.error("Failed to fetch CLI session:",e)}finally{A(!1)}}},[B,s,i,X,p,x]);(0,n.useEffect)(()=>{"waiting"!==u||!B||L||j||_()},[u,B,L,j,_]);let J=(0,n.useCallback)(e=>{let s=window.screenX+(window.outerWidth-600)/2,a=window.screenY+(window.outerHeight-700)/2;window.open(e,"".concat(t.displayName," Login"),"width=".concat(600,",height=").concat(700,",left=").concat(s,",top=").concat(a,",popup=yes")),R.current=!0},[t.displayName]),K=(0,n.useCallback)(e=>{if(U.current)return;U.current=!0;let t=0,s=async()=>{if(t>=60){U.current=!1,w("Authentication timed out. Please try again."),h("error"),l("Authentication timed out");return}try{let a=await fetch("/api/onboarding/cli/".concat(z,"/status/").concat(e),{credentials:"include"}),n=await a.json();if(!a.ok)throw Error(n.error||"Failed to check status");if("success"===n.status){U.current=!1,await H(e);return}if("error"===n.status)throw Error(n.error||"Authentication failed");"waiting_auth"!==n.status||!n.authUrl||(m(n.authUrl),h("waiting"),R.current||B||J(n.authUrl)),t++,setTimeout(s,5e3)}catch(t){U.current=!1;let e=t instanceof Error?t.message:"Auth check failed";w(e),h("error"),l(e)}};s()},[z,J,l,B]),H=(0,n.useCallback)(async e=>{let t=e||p;if(t){h("submitting"),w(null);try{let e={"Content-Type":"application/json"};i&&(e["X-CSRF-Token"]=i);let s=await fetch("/api/onboarding/cli/".concat(z,"/complete/").concat(t),{method:"POST",credentials:"include",headers:e}),a=await s.json();if(!s.ok)throw Error(a.error||"Failed to complete authentication");h("success"),setTimeout(()=>c(),1500)}catch(t){let e=t instanceof Error?t.message:"Failed to complete authentication";w(e),h("error"),l(e)}}},[p,z,i,c,l]);(0,n.useEffect)(()=>{D.current=H},[H]);let Y=(0,n.useCallback)(async()=>{if(!p||!y.trim())return;h("submitting"),w(null);let e=y.trim();if(e.includes("code="))try{let t=new URL(e).searchParams.get("code");t&&(e=t)}catch(s){let t=e.match(/code=([^&\s]+)/);t&&(e=t[1])}try{let t={"Content-Type":"application/json"};i&&(t["X-CSRF-Token"]=i);let s=await fetch("/api/onboarding/cli/".concat(z,"/code/").concat(p),{method:"POST",credentials:"include",headers:t,body:JSON.stringify({code:e})}),a=await s.json();if(!s.ok){if(a.needsRestart){w('The authentication session timed out. Please click "Try Again" to restart.'),h("error");return}throw Error(a.error||"Failed to submit auth code")}g(""),a.success&&await H()}catch(t){let e=t instanceof Error?t.message:"Failed to submit auth code";w(e),h("error"),l(e)}},[p,y,z,i,H,l]);(0,n.useEffect)(()=>{V.current=async(e,t)=>{if(p){h("submitting"),w(null);try{let s={"Content-Type":"application/json"};i&&(s["X-CSRF-Token"]=i);let a=await fetch("/api/onboarding/cli/".concat(z,"/code/").concat(p),{method:"POST",credentials:"include",headers:s,body:JSON.stringify({code:e,state:t})}),n=await a.json();if(!a.ok){if(n.needsRestart){w('The authentication session timed out. Please click "Try Again" to restart.'),h("error");return}throw Error(n.error||"Failed to submit auth code")}n.success&&await H()}catch(t){let e=t instanceof Error?t.message:"Failed to submit auth code";w(e),h("error"),l(e)}}}},[p,z,i,H,l]);let q=(0,n.useCallback)(async()=>{if(U.current=!1,p)try{await fetch("/api/onboarding/cli/".concat(z,"/cancel/").concat(p),{method:"POST",credentials:"include"})}catch(e){}h("idle"),m(null),b(null),g(""),w(null),o()},[p,z,o]);(0,n.useEffect)(()=>("idle"===u&&M(),()=>{U.current=!1,W.current=!1,F(!1)}),[M,u]);let G="anthropic"===t.id||"anthropic"===z;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold",style:{backgroundColor:t.color},children:t.displayName[0]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-medium text-white",children:t.displayName}),(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["starting"===u&&"Starting authentication...","waiting"===u&&"Complete authentication below","submitting"===u&&"Verifying...","success"===u&&"Connected!","error"===u&&(f||"Authentication failed")]})]})]}),"starting"===u&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3 py-4",children:[(0,a.jsxs)("svg",{className:"w-5 h-5 text-accent-cyan animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,a.jsx)("span",{className:"text-text-muted",children:"Preparing authentication..."})]}),"waiting"===u&&x&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"p-4 bg-bg-tertiary rounded-lg border border-border-subtle",children:[(0,a.jsx)("h4",{className:"font-medium text-white mb-2",children:"Complete authentication:"}),B&&L?(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Sign in with your OpenAI account in the popup window. You'll see a device code to enter - this confirms the authorization."}):B?(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Run the CLI command below. It establishes an SSH tunnel to forward the OAuth callback to your workspace."}):G?(0,a.jsxs)("ol",{className:"text-sm text-text-muted space-y-2 list-decimal list-inside",children:[(0,a.jsx)("li",{children:"Click the button below to open the login page"}),(0,a.jsx)("li",{children:"Sign in with your Anthropic account"}),(0,a.jsxs)("li",{children:["After signing in, Anthropic will display an ",(0,a.jsx)("strong",{children:"authentication code"})]}),(0,a.jsx)("li",{children:"Copy that code and paste it in the input below"}),(0,a.jsx)("li",{children:"Click Submit to complete authentication"})]}):(0,a.jsxs)("ol",{className:"text-sm text-text-muted space-y-2 list-decimal list-inside",children:[(0,a.jsx)("li",{children:"Click the button below to open the login page"}),(0,a.jsxs)("li",{children:["Sign in with your ",t.displayName," account"]}),(0,a.jsx)("li",{children:'If you receive a code, paste it below. Otherwise click "I\'ve completed login"'})]})]}),!(B&&j&&!I)&&(0,a.jsxs)("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"block w-full py-2 px-4 bg-bg-tertiary border border-border-subtle text-white font-medium rounded-lg text-center hover:border-accent-cyan/50 transition-all",children:["Open ",t.displayName," Login Page"]}),B&&L?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"p-3 bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg",children:(0,a.jsxs)("p",{className:"text-sm text-accent-cyan",children:[(0,a.jsx)("strong",{children:"Device Authentication:"})," Complete the sign-in in the popup window. After signing in, you'll see a code - enter it on the OpenAI page to authorize."]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-accent-cyan/5 border border-accent-cyan/20 rounded-lg text-sm text-accent-cyan",children:[(0,a.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,a.jsx)("span",{children:"Waiting for authentication to complete..."})]}),(0,a.jsx)("button",{onClick:()=>H(),className:"w-full py-2 text-text-muted hover:text-white transition-colors text-sm",children:"I've completed authentication"})]}):B?(0,a.jsxs)("div",{className:"space-y-4",children:[T&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-bg-tertiary rounded-lg border border-border-subtle",children:[(0,a.jsxs)("svg",{className:"w-5 h-5 text-accent-cyan animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Generating session token..."})]}),j&&!I&&!T&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"p-3 bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg",children:[(0,a.jsxs)("p",{className:"text-sm text-accent-cyan mb-2",children:[(0,a.jsx)("strong",{children:"Step 1:"})," Copy and run this command in your terminal"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-deep rounded-lg text-xs font-mono text-white overflow-x-auto",children:j}),(0,a.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(j)},className:"px-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-muted hover:text-white hover:border-accent-cyan/50 transition-colors text-xs",children:"Copy"})]})]}),(0,a.jsxs)("div",{className:"p-3 bg-bg-tertiary border border-border-subtle rounded-lg",children:[(0,a.jsxs)("p",{className:"text-sm text-white mb-1",children:[(0,a.jsx)("strong",{children:"Step 2:"})," Sign in with OpenAI"]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"The CLI will open your browser to the OpenAI login page. Sign in with your OpenAI account."})]}),(0,a.jsxs)("div",{className:"p-3 bg-bg-tertiary border border-border-subtle rounded-lg",children:[(0,a.jsxs)("p",{className:"text-sm text-white mb-1",children:[(0,a.jsx)("strong",{children:"Step 3:"})," Authentication completes automatically"]}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"After signing in, the CLI will capture the callback and this page will update automatically."})]}),O&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-success/10 border border-success/30 rounded-lg text-sm text-success",children:[(0,a.jsxs)("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,a.jsx)("span",{children:"Waiting for authentication to complete..."})]}),(0,a.jsx)("button",{onClick:()=>E(!0),className:"text-xs text-text-muted hover:text-white transition-colors",children:"CLI not working? Click here for manual method"})]}),!T&&(I||!j)&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg",children:(0,a.jsxs)("p",{className:"text-xs text-amber-400",children:[(0,a.jsx)("strong",{children:"Manual method:"})," After login, you'll see \"This site can't be reached\" - this is expected! Copy the full URL from your browser's address bar and paste it below."]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",placeholder:"Paste the localhost URL here (e.g., http://localhost:...)",value:y,onChange:e=>g(e.target.value),className:"flex-1 px-4 py-3 bg-bg-tertiary border border-border-subtle rounded-xl text-white placeholder-text-muted focus:outline-none focus:border-accent-cyan transition-colors font-mono text-sm",onKeyDown:e=>{"Enter"===e.key&&y.trim()&&Y()}}),(0,a.jsx)("button",{onClick:Y,disabled:!y.trim(),className:"px-6 py-3 bg-accent-cyan text-bg-deep font-semibold rounded-xl hover:bg-accent-cyan/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:"Submit"})]}),j&&(0,a.jsx)("button",{onClick:()=>E(!1),className:"text-xs text-accent-cyan hover:underline",children:"← Back to CLI method"})]})]}):G?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"p-3 bg-accent-cyan/10 border border-accent-cyan/30 rounded-lg",children:(0,a.jsxs)("p",{className:"text-xs text-accent-cyan",children:[(0,a.jsx)("strong",{children:"Look for the code:"})," After signing in, Anthropic will show you an authentication code. Copy it and paste it below."]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",placeholder:"Paste the authentication code here",value:y,onChange:e=>g(e.target.value),className:"flex-1 px-4 py-3 bg-bg-tertiary border border-border-subtle rounded-xl text-white placeholder-text-muted focus:outline-none focus:border-accent-cyan transition-colors font-mono text-sm",onKeyDown:e=>{"Enter"===e.key&&y.trim()&&Y()}}),(0,a.jsx)("button",{onClick:Y,disabled:!y.trim(),className:"px-6 py-3 bg-accent-cyan text-bg-deep font-semibold rounded-xl hover:bg-accent-cyan/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:"Submit"})]})]}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",placeholder:"Paste authentication code (if provided)",value:y,onChange:e=>g(e.target.value),className:"flex-1 px-4 py-3 bg-bg-tertiary border border-border-subtle rounded-xl text-white placeholder-text-muted focus:outline-none focus:border-accent-cyan transition-colors font-mono text-sm",onKeyDown:e=>{"Enter"===e.key&&y.trim()&&Y()}}),(0,a.jsx)("button",{onClick:Y,disabled:!y.trim(),className:"px-6 py-3 bg-accent-cyan text-bg-deep font-semibold rounded-xl hover:bg-accent-cyan/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:"Submit"})]}),(0,a.jsx)("button",{onClick:()=>H(),className:"w-full py-2 text-text-muted hover:text-white transition-colors text-sm",children:"No code? Click here if you've completed login"})]}),(0,a.jsx)("button",{onClick:q,className:"w-full py-2 text-text-muted hover:text-white transition-colors text-sm",children:"Cancel"})]}),"submitting"===u&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3 py-4",children:[(0,a.jsxs)("svg",{className:"w-5 h-5 text-accent-cyan animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,a.jsx)("span",{className:"text-text-muted",children:"Verifying authentication..."})]}),"success"===u&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3 py-4",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-success/20 rounded-full flex items-center justify-center",children:(0,a.jsx)("svg",{className:"w-6 h-6 text-success",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,a.jsxs)("span",{className:"text-white font-medium",children:[t.displayName," connected!"]})]}),"error"===u&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"p-4 bg-error/10 border border-error/30 rounded-lg text-error text-sm",children:f||"Authentication failed. Please try again."}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("button",{onClick:M,className:"flex-1 py-2 px-4 bg-bg-tertiary border border-border-subtle text-white rounded-lg hover:border-accent-cyan/50 transition-colors",children:"Try Again"}),(0,a.jsx)("button",{onClick:q,className:"py-2 px-4 text-text-muted hover:text-white transition-colors",children:"Cancel"})]})]})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[847],{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}})},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4601:function(){},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function u(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var c=[],l=!1,a=-1;function h(){l&&r&&(l=!1,r.length?c=r.concat(c):a=-1,c.length&&d())}function d(){if(!l){var e=u(h);l=!0;for(var t=c.length;t;){for(r=c,c=[];++a<t;)r&&r[a].run();a=-1,t=c.length}r=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new f(e,t)),1!==c.length||l||u(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}},o=!0;try{t[e](s,s.exports,r),o=!1}finally{o&&delete n[e]}return s.exports}r.ab="//";var i=r(229);e.exports=i}()},8975:function(e,t,n){"use strict";var r=n(257);n(4601);var i=n(2265),s=i&&"object"==typeof i&&"default"in i?i:{default:i},o=void 0!==r&&r.env&&!0,u=function(e){return"[object String]"===Object.prototype.toString.call(e)},c=function(){function e(e){var t=void 0===e?{}:e,n=t.name,r=void 0===n?"stylesheet":n,i=t.optimizeForSpeed,s=void 0===i?o:i;l(u(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-deleted-rule____{}",l("boolean"==typeof s,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=s,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var c="undefined"!=typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=c?c.getAttribute("content"):null}var t=e.prototype;return t.setOptimizeForSpeed=function(e){l("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),l(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},t.isOptimizeForSpeed=function(){return this._optimizeForSpeed},t.inject=function(){var e=this;if(l(!this._injected,"sheet already injected"),this._injected=!0,"undefined"!=typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(o||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,n){return"number"==typeof n?e._serverSheet.cssRules[n]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),n},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},t.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},t.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},t.insertRule=function(e,t){if(l(u(e),"`insertRule` accepts only strings"),"undefined"==typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var n=this.getSheet();"number"!=typeof t&&(t=n.cssRules.length);try{n.insertRule(e,t)}catch(t){return o||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},t.replaceRule=function(e,t){if(this._optimizeForSpeed||"undefined"==typeof window){var n="undefined"!=typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!n.cssRules[e])return e;n.deleteRule(e);try{n.insertRule(t,e)}catch(r){o||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),n.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];l(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},t.deleteRule=function(e){if("undefined"==typeof window){this._serverSheet.deleteRule(e);return}if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];l(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},t.flush=function(){this._injected=!1,this._rulesCount=0,"undefined"!=typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},t.cssRules=function(){var e=this;return"undefined"==typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,n){return n?t=t.concat(Array.prototype.map.call(e.getSheetForTag(n).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},t.makeStyleTag=function(e,t,n){t&&l(u(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var i=document.head||document.getElementsByTagName("head")[0];return n?i.insertBefore(r,n):i.appendChild(r),r},function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,[{key:"length",get:function(){return this._rulesCount}}]),e}();function l(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var a=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},h={};function d(e,t){if(!t)return"jsx-"+e;var n=String(t),r=e+n;return h[r]||(h[r]="jsx-"+a(e+"-"+n)),h[r]}function f(e,t){"undefined"==typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var n=e+t;return h[n]||(h[n]=t.replace(/__jsx-style-dynamic-selector/g,e)),h[n]}var p=function(){function e(e){var t=void 0===e?{}:e,n=t.styleSheet,r=void 0===n?null:n,i=t.optimizeForSpeed,s=void 0!==i&&i;this._sheet=r||new c({name:"styled-jsx",optimizeForSpeed:s}),this._sheet.inject(),r&&"boolean"==typeof s&&(this._sheet.setOptimizeForSpeed(s),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"undefined"==typeof window||this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var n=this.getIdAndRules(e),r=n.styleId,i=n.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var s=i.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=s,this._instancesCounts[r]=1},t.remove=function(e){var t=this,n=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(n in this._instancesCounts,"styleId: `"+n+"` not found"),this._instancesCounts[n]-=1,this._instancesCounts[n]<1){var r=this._fromServer&&this._fromServer[n];r?(r.parentNode.removeChild(r),delete this._fromServer[n]):(this._indices[n].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[n]),delete this._instancesCounts[n]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],n=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return n[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,n;return t=this.cssRules(),void 0===(n=e)&&(n={}),t.map(function(e){var t=e[0],r=e[1];return s.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:n.nonce?n.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,n=e.dynamic,r=e.id;if(n){var i=d(r,n);return{styleId:i,rules:Array.isArray(t)?t.map(function(e){return f(i,e)}):[f(i,t)]}}return{styleId:d(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),m=i.createContext(null);m.displayName="StyleSheetContext";var _=s.default.useInsertionEffect||s.default.useLayoutEffect,v="undefined"!=typeof window?new p:void 0;function y(e){var t=v||i.useContext(m);return t&&("undefined"==typeof window?t.add(e):_(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}y.dynamic=function(e){return e.map(function(e){return d(e[0],e[1])}).join(" ")},t.style=y},29:function(e,t,n){"use strict";e.exports=n(8975).style}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[891],{6272:function(e,t,n){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)},4736:function(e,t,n){n.d(t,{$:function(){return i}});var r=n(7437),s=n(2265),o=n(9540),l=n(1561);let c={background:"#0d0f14",foreground:"#c9d1d9",cursor:"#58a6ff",cursorAccent:"#0d0f14",selectionBackground:"#264f78",selectionForeground:"#ffffff",black:"#484f58",red:"#f85149",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ff7b72",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#ffffff"},a=[/https:\/\/console\.anthropic\.com\/oauth/i,/https:\/\/auth\.openai\.com/i,/https:\/\/accounts\.google\.com/i,/https:\/\/github\.com\/login\/oauth/i,/https:\/\/[^\s]+\/oauth/i,/https:\/\/[^\s]+\/auth/i,/https:\/\/[^\s]+\/login/i];function i(e){let{provider:t,workspaceId:n,csrfToken:i,maxHeight:h="400px",onSuccess:f,onError:m,onCancel:p,onConnectAnother:b,showHeader:g=!0,className:y=""}=e,k=(0,s.useRef)(null),j=(0,s.useRef)(null),v=(0,s.useRef)(null),w=(0,s.useRef)(null),N=(0,s.useRef)(null),C=(0,s.useRef)(new Set),[S,R]=(0,s.useState)(!1),[L,E]=(0,s.useState)(!1),[T,F]=(0,s.useState)(!1),[_,W]=(0,s.useState)(null),[M,O]=(0,s.useState)(null),[B,A]=(0,s.useState)(null),[D,P]=(0,s.useState)(!1),[I,U]=(0,s.useState)(!1),[X,z]=(0,s.useState)(!1),[J,H]=(0,s.useState)(i),Y=(0,s.useCallback)(()=>{let e=Date.now().toString(36),n=Math.random().toString(36).substring(2,6);return"__setup__".concat(t.id,"-").concat(e).concat(n)},[t.id]);(0,s.useEffect)(()=>{J||fetch("/api/auth/session",{credentials:"include"}).then(e=>{let t=e.headers.get("X-CSRF-Token");t&&H(t)}).catch(()=>{})},[J]);let G=(0,s.useCallback)(async()=>{if(n&&M)try{let e={};J&&(e["X-CSRF-Token"]=J),await fetch("/api/workspaces/".concat(n,"/agents/").concat(encodeURIComponent(M)),{method:"DELETE",credentials:"include",headers:e})}catch(e){}},[n,M,J]),K=(0,s.useCallback)(async()=>{if(!n||!J)return;R(!0),W(null);let e=Y();try{let r={"Content-Type":"application/json"};J&&(r["X-CSRF-Token"]=J);let s=await fetch("/api/workspaces/".concat(n,"/agents"),{method:"POST",credentials:"include",headers:r,body:JSON.stringify({name:e,provider:"anthropic"===t.id?"claude":t.id,interactive:!0})});if(!s.ok){let e=await s.json();throw Error(e.error||"Failed to spawn agent")}O(e)}catch(t){let e=t instanceof Error?t.message:"Failed to spawn agent";W(e),null==m||m(e)}finally{R(!1)}},[n,J,t.id,Y,m]);(0,s.useEffect)(()=>{if(!k.current)return;let e=new o.o({theme:c,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',fontSize:12,lineHeight:1.4,convertEol:!0,scrollback:1e4,cursorBlink:!0,cursorStyle:"block",disableStdin:!1,allowProposedApi:!0}),t=new l.X;e.loadAddon(t),e.open(k.current),t.fit(),j.current=e,v.current=t;let n=new ResizeObserver(()=>{t.fit()});return n.observe(k.current),()=>{n.disconnect(),e.dispose(),j.current=null,v.current=null}},[]);let $=(0,s.useCallback)(e=>{if(I)return!1;for(let t of a)if(e.match(t)){let t=e.match(/https:\/\/[^\s\])"']+/i);if(t){let e=t[0];if(!C.current.has(e))return C.current.add(e),A(e),P(!0),!0}}return!1},[I]);(0,s.useEffect)(()=>{if(!M||!n)return;let e=()=>{var t;let r="https:"===window.location.protocol?"wss:":"ws:",s="".concat(r,"//").concat(window.location.host,"/ws/logs/").concat(encodeURIComponent(n),"/").concat(encodeURIComponent(M));F(!0);let o=new WebSocket(s);w.current=o,o.onopen=()=>{var e,t;E(!0),F(!1),null===(e=j.current)||void 0===e||e.writeln("\x1b[90m[Connected - Interactive Mode]\x1b[0m"),null===(t=j.current)||void 0===t||t.writeln("\x1b[90m[Type directly to respond to prompts]\x1b[0m\n")},o.onclose=()=>{E(!1),F(!1),N.current=setTimeout(e,2e3)},o.onmessage=e=>{var t,n;try{let n=JSON.parse(e.data);if("history"===n.type&&Array.isArray(n.lines))n.lines.forEach(e=>{var t;null===(t=j.current)||void 0===t||t.writeln(e),$(e)});else if("log"===n.type||"output"===n.type){let e=n.content||n.data||n.message||"";e&&(null===(t=j.current)||void 0===t||t.write(e),$(e))}}catch(t){"string"==typeof e.data&&(null===(n=j.current)||void 0===n||n.write(e.data),$(e.data))}},null===(t=j.current)||void 0===t||t.onData(e=>{o.readyState===WebSocket.OPEN&&o.send(JSON.stringify({type:"input",agent:M,data:e}))})};return e(),()=>{var e;N.current&&clearTimeout(N.current),null===(e=w.current)||void 0===e||e.close()}},[M,n,$]),(0,s.useEffect)(()=>{!J||M||S||K()},[J,M,S,K]),(0,s.useEffect)(()=>()=>{G()},[G]);let q=(0,s.useCallback)(()=>{B&&(window.open(B,"_blank","width=600,height=700"),P(!1))},[B]),Q=(0,s.useCallback)(async()=>{let e=t.name||t.id;try{let t={"Content-Type":"application/json"};J&&(t["X-CSRF-Token"]=J);let n=await fetch("/api/onboarding/mark-connected/".concat(e),{method:"POST",credentials:"include",headers:t});n.ok||console.error("Failed to mark provider as connected:",await n.text())}catch(e){console.error("Error marking provider as connected:",e)}await G(),z(!0)},[G,t.id,t.name,J]),V=(0,s.useCallback)(()=>{null==f||f()},[f]),Z=(0,s.useCallback)(()=>{null==b||b()},[b]),ee=(0,s.useCallback)(async()=>{await G(),null==p||p()},[G,p]);return(0,r.jsxs)("div",{className:"flex flex-col rounded-xl overflow-hidden border border-border-subtle ".concat(y),children:[g&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle bg-bg-tertiary",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-white font-bold text-sm",style:{backgroundColor:t.color},children:t.displayName[0]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h4",{className:"text-sm font-semibold text-text-primary",children:[t.displayName," Setup"]}),(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Interactive terminal"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[L&&(0,r.jsxs)("span",{className:"flex items-center gap-1 px-2 py-1 rounded-full bg-success/15 text-xs text-success",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),"Connected"]}),p&&(0,r.jsx)("button",{onClick:ee,className:"p-1.5 rounded-lg hover:bg-bg-hover text-text-muted hover:text-text-primary transition-colors",children:(0,r.jsx)(d,{})})]})]}),X?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-6",children:[(0,r.jsx)("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-4",style:{backgroundColor:"".concat(t.color,"20")},children:(0,r.jsx)(x,{className:"w-8 h-8",style:{color:t.color}})}),(0,r.jsxs)("h3",{className:"text-lg font-semibold text-text-primary mb-2",children:[t.displayName," Connected!"]}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-6 text-center",children:["Your ",t.displayName," account has been successfully connected."]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[b&&(0,r.jsx)("button",{onClick:Z,className:"px-4 py-2 bg-bg-hover text-text-primary text-sm font-medium rounded-lg hover:bg-bg-tertiary transition-colors border border-border-subtle",children:"Connect Another Provider"}),(0,r.jsx)("button",{onClick:V,className:"px-4 py-2 bg-accent-cyan text-bg-deep text-sm font-semibold rounded-lg hover:bg-accent-cyan/90 transition-colors",children:"Continue to Dashboard"})]})]}):(0,r.jsxs)(r.Fragment,{children:[_&&(0,r.jsxs)("div",{className:"px-4 py-3 bg-error/10 border-b border-error/30 text-sm text-error flex items-center gap-2",children:[(0,r.jsx)(u,{}),(0,r.jsx)("span",{children:_}),(0,r.jsx)("button",{onClick:K,className:"ml-auto text-xs px-2 py-1 rounded bg-error/20 hover:bg-error/30 transition-colors",children:"Retry"})]}),S&&(0,r.jsxs)("div",{className:"px-4 py-3 bg-accent-cyan/10 border-b border-accent-cyan/30 text-sm text-accent-cyan flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-4 h-4 border-2 border-accent-cyan/30 border-t-accent-cyan rounded-full animate-spin"}),(0,r.jsxs)("span",{children:["Starting ",t.displayName,"..."]})]}),(0,r.jsx)("div",{ref:k,className:"flex-1 bg-[#0d0f14]",style:{minHeight:"300px",maxHeight:h},onClick:()=>{var e;return null===(e=j.current)||void 0===e?void 0:e.focus()}}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border-subtle bg-bg-tertiary",children:[(0,r.jsx)("p",{className:"text-xs text-text-muted",children:"Respond to prompts above to complete setup"}),(0,r.jsx)("button",{onClick:Q,className:"px-4 py-2 bg-accent-cyan text-bg-deep text-sm font-semibold rounded-lg hover:bg-accent-cyan/90 transition-colors",children:"Done - Continue"})]})]}),D&&B&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold",style:{backgroundColor:t.color},children:t.displayName[0]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-white font-medium",children:"Login URL Detected"}),(0,r.jsx)("p",{className:"text-sm text-text-muted",children:"We found a login link in the terminal"})]})]}),(0,r.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:[t.displayName," is asking you to sign in. Click below to open the login page."]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("button",{onClick:q,className:"flex-1 py-2 px-4 bg-accent-cyan text-bg-deep font-semibold rounded-lg hover:bg-accent-cyan/90 transition-colors",children:"Open Login Page"}),(0,r.jsx)("button",{onClick:()=>{P(!1),U(!0)},className:"px-4 py-2 bg-bg-hover text-text-secondary rounded-lg hover:bg-bg-tertiary transition-colors",children:"Dismiss"})]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-3",children:"Or copy the URL from the terminal and open it manually."})]})})]})}function d(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function u(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,r.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}function x(e){let{className:t,style:n}=e;return(0,r.jsx)("svg",{className:t,style:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}}}]);
|