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
fix(auth): restore Keycloak device authorization (#7035)
r33drichards4c12f5eca1b8
diff --git a/libs/fleet/e2e/device.spec.ts b/libs/fleet/e2e/device.spec.tsdeleted file mode 100644index 2adcd94457..0000000000--- a/libs/fleet/e2e/device.spec.ts+++ /dev/null@@ -1,38 +0,0 @@-import { expect, test } from "@playwright/test"--test.describe("CLI device authorization", () => {- test("continues sign-in and signup from a normalized user code", async ({ page }) => {- await page.goto("/device?user_code=abcd-efgh")-- await expect(- page.getByRole("heading", { name: "Connect your Cua CLI" }),- ).toBeVisible()- await expect(page.getByText("ABCD-EFGH", { exact: true })).toBeVisible()-- const signIn = page.getByRole("link", { name: "Sign in and continue" })- await expect(signIn).toHaveAttribute(- "href",- "https://auth.cua.ai/realms/cyclops-cs/device?user_code=ABCD-EFGH",- )-- const signUp = page.getByRole("link", { name: "Create an account" })- const signUpHref = await signUp.getAttribute("href")- expect(signUpHref).toBe(- "https://cua.ai/signup?redirect_url=%2Fdevice%3Fuser_code%3DABCD-EFGH",- )- })-- test("rejects missing or malformed user codes", async ({ page }) => {- await page.goto("/device?user_code=not-a-code")-- await expect(page.getByRole("alert")).toContainText(- "Enter the code shown by the CLI",- )- await expect(- page.getByRole("link", { name: "Sign in and continue" }),- ).toHaveCount(0)- await expect(- page.getByRole("link", { name: "Create an account" }),- ).toHaveCount(0)- })-})diff --git a/libs/fleet/nginx.conf b/libs/fleet/nginx.confindex bcf77dcbb9..9f2528448f 100644--- a/libs/fleet/nginx.conf+++ b/libs/fleet/nginx.conf@@ -28,6 +28,10 @@ server {root /usr/share/nginx/html;index index.html;+ location = /device {+ return 302 https://auth.cua.ai/realms/cyclops-cs/device?user_code=$arg_user_code;+ }+location / {try_files $uri $uri/ /index.html;}diff --git a/libs/fleet/src/main.tsx b/libs/fleet/src/main.tsxindex 0af9f9ca7f..8cbc1d8f4d 100644--- a/libs/fleet/src/main.tsx+++ b/libs/fleet/src/main.tsx@@ -9,7 +9,6 @@ import monoFont from "@cua/design/assets/fonts/jetbrains-mono-normal-latin.woff2import displayFont from "@cua/design/assets/fonts/instrument-serif-normal-latin.woff2"import { App } from "./App"import { AuthProvider } from "./auth/AuthProvider"-import { DeviceAuthorization } from "./pages/DeviceAuthorization"import "./shell.css"applyMode(Mode.Dark)@@ -54,16 +53,10 @@ for (const href of [urbanistFont, monoFont, displayFont]) {document.head.appendChild(link)}-const isDeviceAuthorization = window.location.pathname === "/device"-ReactDOM.createRoot(document.getElementById("root")!).render(<React.StrictMode>- {isDeviceAuthorization ? (- <DeviceAuthorization />- ) : (- <AuthProvider>- <App />- </AuthProvider>- )}+ <AuthProvider>+ <App />+ </AuthProvider></React.StrictMode>,)diff --git a/libs/fleet/src/pages/DeviceAuthorization.css b/libs/fleet/src/pages/DeviceAuthorization.cssdeleted file mode 100644index fd848bea6a..0000000000--- a/libs/fleet/src/pages/DeviceAuthorization.css+++ /dev/null@@ -1,210 +0,0 @@-.device-page {- --device-ink: #15231d;- --device-muted: #66736d;- --device-cream: #f4f0e6;- --device-paper: rgba(255, 253, 247, 0.92);- --device-green: #167653;- --device-green-dark: #0c573c;- min-height: 100vh;- display: grid;- place-items: center;- overflow: hidden;- position: relative;- padding: 32px 20px;- color: var(--device-ink);- background:- radial-gradient(circle at 15% 15%, rgba(211, 228, 190, 0.9), transparent 34%),- radial-gradient(circle at 86% 82%, rgba(245, 194, 139, 0.72), transparent 30%),- linear-gradient(135deg, #e7eee3 0%, var(--device-cream) 52%, #f1e3d2 100%);- font-family: Georgia, "Times New Roman", serif;-}--.device-page::before {- content: "";- position: absolute;- inset: 0;- opacity: 0.28;- background-image: linear-gradient(rgba(21, 35, 29, 0.08) 1px, transparent 1px),- linear-gradient(90deg, rgba(21, 35, 29, 0.08) 1px, transparent 1px);- background-size: 32px 32px;- mask-image: linear-gradient(to bottom, black, transparent 88%);-}--.device-orbit {- position: absolute;- border: 1px solid rgba(22, 118, 83, 0.22);- border-radius: 50%;- pointer-events: none;-}--.device-orbit-one {- width: 440px;- height: 440px;- top: -220px;- right: -100px;-}--.device-orbit-two {- width: 300px;- height: 300px;- bottom: -150px;- left: -80px;-}--.device-card {- width: min(100%, 620px);- position: relative;- z-index: 1;- padding: clamp(32px, 6vw, 64px);- border: 1px solid rgba(21, 35, 29, 0.14);- border-radius: 28px 28px 88px 28px;- background: var(--device-paper);- box-shadow: 0 32px 90px rgba(46, 62, 51, 0.18);- backdrop-filter: blur(14px);- animation: device-rise 480ms ease-out both;-}--.device-wordmark {- font: 800 29px/1.1 ui-rounded, "Arial Rounded MT Bold", sans-serif;- letter-spacing: -0.08em;- color: var(--device-green);- margin-bottom: 42px;-}--.device-eyebrow {- margin: 0 0 12px;- color: var(--device-green);- font: 700 12px/1.2 ui-monospace, "SFMono-Regular", Consolas, monospace;- letter-spacing: 0.14em;- text-transform: uppercase;-}--.device-card h1 {- margin: 0;- max-width: 470px;- font-size: clamp(38px, 8vw, 64px);- line-height: 0.96;- letter-spacing: -0.045em;- font-weight: 500;-}--.device-lede {- max-width: 500px;- margin: 24px 0 30px;- color: var(--device-muted);- font: 400 17px/1.65 ui-sans-serif, "Avenir Next", "Segoe UI", sans-serif;-}--.device-code {- display: inline-block;- padding: 16px 20px;- border: 1px solid rgba(21, 35, 29, 0.16);- border-radius: 12px;- color: var(--device-ink);- background: rgba(236, 241, 231, 0.78);- font: 750 clamp(25px, 7vw, 34px)/1 ui-monospace, "SFMono-Regular", Consolas, monospace;- letter-spacing: 0.16em;- box-shadow: inset 0 -3px 0 rgba(22, 118, 83, 0.12);-}--.device-actions {- display: grid;- grid-template-columns: 1fr 1fr;- gap: 12px;- margin-top: 28px;-}--.device-button {- display: inline-flex;- min-height: 50px;- align-items: center;- justify-content: center;- padding: 0 18px;- border-radius: 999px;- text-decoration: none;- font: 700 14px/1 ui-sans-serif, "Avenir Next", "Segoe UI", sans-serif;- transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;-}--.device-button:hover {- transform: translateY(-2px);-}--.device-button:focus-visible {- outline: 3px solid rgba(22, 118, 83, 0.3);- outline-offset: 3px;-}--.device-button-primary {- color: white;- background: var(--device-green);- box-shadow: 0 12px 30px rgba(22, 118, 83, 0.24);-}--.device-button-primary:hover {- background: var(--device-green-dark);-}--.device-button-secondary {- color: var(--device-ink);- border: 1px solid rgba(21, 35, 29, 0.2);- background: rgba(255, 255, 255, 0.55);-}--.device-footnote {- margin: 20px 0 0;- color: var(--device-muted);- font: 400 13px/1.5 ui-sans-serif, "Avenir Next", "Segoe UI", sans-serif;-}--.device-alert {- display: grid;- gap: 8px;- padding: 18px 20px;- border-left: 4px solid #b75b35;- border-radius: 8px;- color: #522d20;- background: rgba(252, 230, 214, 0.8);- font: 400 15px/1.5 ui-sans-serif, "Avenir Next", "Segoe UI", sans-serif;-}--@keyframes device-rise {- from {- opacity: 0;- transform: translateY(18px) scale(0.985);- }- to {- opacity: 1;- transform: translateY(0) scale(1);- }-}--@media (max-width: 600px) {- .device-page {- align-items: start;- padding: 18px 12px;- }-- .device-card {- padding: 30px 24px 38px;- border-radius: 22px 22px 58px 22px;- }-- .device-wordmark {- margin-bottom: 34px;- }-- .device-actions {- grid-template-columns: 1fr;- }-}--@media (prefers-reduced-motion: reduce) {- .device-card {- animation: none;- }-- .device-button {- transition: none;- }-}diff --git a/libs/fleet/src/pages/DeviceAuthorization.tsx b/libs/fleet/src/pages/DeviceAuthorization.tsxdeleted file mode 100644index 3f68d6e02d..0000000000--- a/libs/fleet/src/pages/DeviceAuthorization.tsx+++ /dev/null@@ -1,86 +0,0 @@-import "./DeviceAuthorization.css"--const USER_CODE_PATTERN = /^[A-Z0-9]{4}-[A-Z0-9]{4}$/--function normalizeUserCode(value: string | null): string | null {- if (!value) return null- const normalized = value.trim().toUpperCase()- return USER_CODE_PATTERN.test(normalized) ? normalized : null-}--function keycloakBaseUrl(): string {- return window.__CYCLOPS_CS_CFG__?.kcUrl ?? "https://auth.cua.ai"-}--function keycloakRealm(): string {- return window.__CYCLOPS_CS_CFG__?.kcRealm ?? "cyclops-cs"-}--function deviceVerificationUrl(userCode: string): string {- const base = keycloakBaseUrl().replace(/\/$/, "")- const realm = encodeURIComponent(keycloakRealm())- return `${base}/realms/${realm}/device?user_code=${encodeURIComponent(userCode)}`-}--function signupUrl(userCode: string): string {- const continuation = `/device?user_code=${encodeURIComponent(userCode)}`- return `https://cua.ai/signup?redirect_url=${encodeURIComponent(continuation)}`-}--export function DeviceAuthorization() {- const userCode = normalizeUserCode(- new URLSearchParams(window.location.search).get("user_code"),- )-- return (- <main className="device-page">- <div className="device-orbit device-orbit-one" />- <div className="device-orbit device-orbit-two" />- <section className="device-card" aria-labelledby="device-title">- <div className="device-wordmark">- cua- </div>- <p className="device-eyebrow">Secure device authorization</p>- <h1 id="device-title">Connect your Cua CLI</h1>- <p className="device-lede">- Confirm the code from your terminal, then sign in to authorize this- device. Your CLI never receives your password.- </p>-- {userCode ? (- <>- <div className="device-code">- {userCode}- </div>- <div className="device-actions">- <a- className="device-button device-button-primary"- href={deviceVerificationUrl(userCode)}- >- Sign in and continue- </a>- <a- className="device-button device-button-secondary"- href={signupUrl(userCode)}- >- Create an account- </a>- </div>- <p className="device-footnote">- Only continue if this code exactly matches the one shown by the- CLI. Codes expire automatically.- </p>- </>- ) : (- <div className="device-alert" role="alert">- <strong>Enter the code shown by the CLI.</strong>- <span>- Open the complete verification link printed in your terminal,- including its eight-character code.- </span>- </div>- )}- </section>- </main>- )-}