Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(auth): brand social sign-in behind the existing Clerk broker (#7212)
Francesco Bonaccic31d5bf7399c
diff --git a/libs/fleet/e2e/auth-session.spec.ts b/libs/fleet/e2e/auth-session.spec.tsindex c21fe8f9fc..80a39e7ee5 100644--- a/libs/fleet/e2e/auth-session.spec.ts+++ b/libs/fleet/e2e/auth-session.spec.ts@@ -29,7 +29,15 @@ test("gates the protected shell until standard PKCE authentication resolves", asconst auth = await mockAuth(page, {}, { holdAuth: true })await page.goto("/settings")- await expect(page.getByText("Signing in…")).toBeVisible()+ const bootSurface = page.locator("#cua-boot")+ await expect(bootSurface).toBeVisible()+ await expect(bootSurface.getByText("Signing you in")).toBeVisible()+ await expect(bootSurface.getByText("Continuing to auth.cua.ai")).toBeVisible()+ await expect+ .poll(() =>+ bootSurface.evaluate(element => getComputedStyle(element).backgroundImage),+ )+ .toContain("radial-gradient")await expect(page.getByRole("navigation")).toHaveCount(0)const initOptions = await page.evaluate(keycloakState).then(state => state.initOptions)@@ -41,7 +49,7 @@ test("gates the protected shell until standard PKCE authentication resolves", as})await auth.releaseAuth()- await expect(page.getByText("Signing in…")).toHaveCount(0)+ await expect(bootSurface).toHaveCount(0)await expect(page.getByRole("button", { name: "testuser" })).toBeVisible()})@@ -80,7 +88,12 @@ test("rejected callback fails closed without rendering the shell", async ({ pageawait page.goto("/settings?error=access_denied&state=opaque")- await expect(page.getByText("Auth error: Error: rejected callback")).toBeVisible()+ await expect(+ page.getByRole("heading", { name: "We couldn't sign you in" }),+ ).toBeVisible()+ await expect(page.getByText("Error: rejected callback")).toBeVisible()+ await expect(page.getByRole("button", { name: "Try again" })).toBeVisible()+ await expect(page.locator("#cua-boot")).toHaveCount(0)await expect(page.getByRole("button", { name: "testuser" })).toHaveCount(0)})diff --git a/libs/fleet/index.html b/libs/fleet/index.htmlindex b5956a94f8..5aad876124 100644--- a/libs/fleet/index.html+++ b/libs/fleet/index.html@@ -3,19 +3,87 @@<head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" />- <meta name="theme-color" content="#000000" />- <style>html { background: #000000; }</style>+ <meta name="theme-color" content="#07080a" />+ <style>+ html,+ body {+ min-height: 100%;+ margin: 0;+ background:+ radial-gradient(ellipse 90% 70% at 6% 104%, #173249 0%, #111d2a 38%, #07080a 74%),+ #07080a;+ }++ #cua-boot {+ position: fixed;+ z-index: 9999;+ inset: 0;+ display: grid;+ place-items: center;+ box-sizing: border-box;+ padding: 32px;+ background:+ radial-gradient(ellipse 90% 70% at 6% 104%, #173249 0%, #111d2a 38%, #07080a 74%),+ #07080a;+ color: #f6f8fb;+ font-family: "Urbanist", -apple-system, BlinkMacSystemFont, sans-serif;+ }++ .cua-boot__content {+ display: grid;+ justify-items: center;+ text-align: center;+ opacity: 0;+ visibility: hidden;+ animation: cua-boot-reveal 0s linear 350ms forwards;+ }++ .cua-boot__mark {+ width: 42px;+ height: 42px;+ margin-bottom: 24px;+ }++ .cua-boot__title {+ margin: 0;+ font-size: 15px;+ font-weight: 650;+ letter-spacing: 0.01em;+ line-height: 1.4;+ }++ .cua-boot__detail {+ margin: 7px 0 0;+ color: rgba(224, 230, 238, 0.68);+ font-size: 13px;+ line-height: 1.45;+ }++ @keyframes cua-boot-reveal {+ to {+ opacity: 1;+ visibility: visible;+ }+ }+ </style><link rel="icon" href="/favicon.svg" type="image/svg+xml" sizes="any" /><link rel="icon" href="/favicon.ico" sizes="32x32" /><link rel="icon" href="/favicon.png" type="image/png" /><link rel="apple-touch-icon" href="/apple-touch-icon.png" />- <title>Pools · Cua</title>+ <title>Cua</title></head><body><!-- Runtime config injected by nginx envsubst (see nginx.conf/config.js block). Loaded before the bundle so AuthProvider canread window.__CYCLOPS_CS_CFG__ on first render. --><script src="/config.js"></script>+ <div id="cua-boot" role="status" aria-live="polite">+ <div class="cua-boot__content">+ <img class="cua-boot__mark" src="/favicon.svg" alt="" aria-hidden="true" />+ <p class="cua-boot__title">Signing you in</p>+ <p class="cua-boot__detail">Continuing to auth.cua.ai</p>+ </div>+ </div><div id="root"></div><script type="module" src="/src/main.tsx"></script></body>diff --git a/libs/fleet/package.json b/libs/fleet/package.jsonindex dc6f0b2db5..7f1491ef14 100644--- a/libs/fleet/package.json+++ b/libs/fleet/package.json@@ -14,7 +14,7 @@"lint:fix": "biome check --write","test:e2e": "npm run sdk:browser && playwright test","test:e2e:ui": "npm run sdk:browser && playwright test --ui",- "test:auth-contract": "tsx --test tests/auth-redirects.test.ts",+ "test:auth-contract": "tsx --test tests/auth-redirects.test.ts && node --test tests/auth-first-paint.test.mjs","test:design-boundary": "node --test tests/design-package-boundary.test.mjs","test:favicon": "node --test tests/favicon.test.mjs","test:sdk-models": "rm -rf target/sdk-model-tests && tsc -p tsconfig.sdk-models.json && node target/sdk-model-tests/e2e/sdk-models.unit.js",diff --git a/libs/fleet/src/auth/AuthProvider.tsx b/libs/fleet/src/auth/AuthProvider.tsxindex f05b506cbf..a1645a0624 100644--- a/libs/fleet/src/auth/AuthProvider.tsx+++ b/libs/fleet/src/auth/AuthProvider.tsx@@ -3,7 +3,7 @@// Keycloak before the React tree mounts; this component only renders// children once we have a valid session.-import { useEffect, useState } from "react"+import { useEffect, useLayoutEffect, useState } from "react"import { initKc } from "./keycloak"import { isLocalVisualPreview } from "../local-visual-preview"@@ -11,6 +11,10 @@ interface Props {children: React.ReactNode}+function removeBootSurface() {+ document.getElementById("cua-boot")?.remove()+}+export function AuthProvider({ children }: Props) {const visualPreview = isLocalVisualPreview()const [ready, setReady] = useState(visualPreview)@@ -29,19 +33,28 @@ export function AuthProvider({ children }: Props) {.catch(e => setError(String(e)))}, [visualPreview])+ useLayoutEffect(() => {+ if (ready || error) removeBootSurface()+ }, [error, ready])+if (error) {return (- <div style={{ padding: 24, fontFamily: "monospace" }}>- Auth error: {error}- </div>- )- }- if (!ready) {- return (- <div style={{ padding: 24, fontFamily: "monospace" }}>- Signing in…- </div>+ <main className="cua-auth-error">+ <div className="cua-auth-error__panel">+ <p className="cua-auth-error__brand">Cua</p>+ <h1>We couldn't sign you in</h1>+ <p>+ Your session didn't complete. Try again, or contact Cua support+ if this keeps happening.+ </p>+ <code>{error}</code>+ <button type="button" onClick={() => window.location.reload()}>+ Try again+ </button>+ </div>+ </main>)}+ if (!ready) return nullreturn <>{children}</>}diff --git a/libs/fleet/src/shell.css b/libs/fleet/src/shell.cssindex 2126105c07..3c7866c969 100644--- a/libs/fleet/src/shell.css+++ b/libs/fleet/src/shell.css@@ -6,6 +6,77 @@ body,background: var(--cua-dashboard-background, #000000);}+.cua-auth-error {+ min-height: 100vh;+ display: grid;+ place-items: center;+ box-sizing: border-box;+ padding: 32px;+ background:+ radial-gradient(ellipse 90% 70% at 6% 104%, #173249 0%, #111d2a 38%, #07080a 74%),+ #07080a;+ color: var(--cua-dashboard-text, #f6f8fb);+ font-family: var(--cua-dashboard-font-body, "Urbanist", sans-serif);+}++.cua-auth-error__panel {+ width: min(100%, 420px);+}++.cua-auth-error__brand {+ margin: 0 0 32px;+ font-size: 16px;+ font-weight: 700;+ letter-spacing: 0.06em;+}++.cua-auth-error h1 {+ margin: 0;+ font-family: var(--cua-dashboard-font-display, "Instrument Serif", serif);+ font-size: clamp(38px, 8vw, 52px);+ font-weight: 400;+ letter-spacing: -0.025em;+ line-height: 1;+}++.cua-auth-error p:not(.cua-auth-error__brand) {+ margin: 18px 0 0;+ color: var(--cua-color-text-muted, rgba(224, 230, 238, 0.72));+ font-size: 15px;+ line-height: 1.55;+}++.cua-auth-error code {+ display: block;+ margin-top: 20px;+ padding: 12px 14px;+ overflow-wrap: anywhere;+ border: 1px solid var(--cua-color-line-soft, rgba(255, 255, 255, 0.12));+ border-radius: var(--cua-radius-control, 10px);+ background: rgba(255, 255, 255, 0.04);+ color: var(--cua-color-text-body, rgba(224, 230, 238, 0.84));+ font-family: var(--cua-dashboard-font-mono, monospace);+ font-size: 12px;+ line-height: 1.5;+}++.cua-auth-error button {+ min-height: 48px;+ margin-top: 24px;+ padding: 0 22px;+ border: 1px solid var(--cua-color-brand-primary, #9fd7ff);+ border-radius: var(--cua-radius-control, 10px);+ background: var(--cua-action-primary-background, #9fd7ff);+ color: var(--cua-action-primary-foreground, #07131e);+ cursor: pointer;+ font: 600 14px/1 var(--cua-dashboard-font-body, "Urbanist", sans-serif);+}++.cua-auth-error button:focus-visible {+ outline: 3px solid var(--cua-color-brand-primary, #9fd7ff);+ outline-offset: 3px;+}+.cua-shell {color: var(--cua-dashboard-text);font-family: var(--cua-dashboard-font-body);diff --git a/libs/fleet/tests/auth-first-paint.test.mjs b/libs/fleet/tests/auth-first-paint.test.mjsnew file mode 100644index 0000000000..d8c7a47dfa--- /dev/null+++ b/libs/fleet/tests/auth-first-paint.test.mjs@@ -0,0 +1,29 @@+import assert from "node:assert/strict"+import { readFile } from "node:fs/promises"+import test from "node:test"+import path from "node:path"+import { fileURLToPath } from "node:url"++const testDirectory = path.dirname(fileURLToPath(import.meta.url))+const appRoot = path.resolve(testDirectory, "..")++test("the auth handoff is present before React without a black or monospace frame", async () => {+ const [index, provider] = await Promise.all([+ readFile(path.join(appRoot, "index.html"), "utf8"),+ readFile(path.join(appRoot, "src/auth/AuthProvider.tsx"), "utf8"),+ ])++ assert.match(index, /<meta name="theme-color" content="#07080a"/)+ assert.match(index, /id="cua-boot"/)+ assert.match(index, /Signing you in/)+ assert.match(index, /Continuing to auth\.cua\.ai/)+ assert.match(index, /350ms/)+ assert.match(index, /radial-gradient/)+ assert.doesNotMatch(index, /Pools · Cua/)++ assert.match(provider, /if \(!ready\) return null/)+ assert.match(provider, /document\.getElementById\("cua-boot"\)\?\.remove\(\)/)+ assert.match(provider, /We couldn't sign you in/)+ assert.doesNotMatch(provider, /fontFamily: "monospace"/)+ assert.doesNotMatch(provider, /Signing in…/)+})