Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(web): unify Cua identity and dashboard design (#6941)

Francesco Bonacci7e1a8fa23307
diff --git a/libs/fleet/Dockerfile b/libs/fleet/Dockerfile
index cb977db2de..69842e548f 100644
--- a/libs/fleet/Dockerfile
+++ b/libs/fleet/Dockerfile
@@ -9,7 +9,7 @@ RUN apt-get update \
ENV PATH="/root/.cargo/bin:${PATH}"
-COPY . .
+COPY cyclops-cs/ .
RUN ./scripts/build-browser-sdk-binding.sh
# Build stage — produces /app/dist (Vite output).
@@ -19,16 +19,26 @@ WORKDIR /app
# pnpm via corepack (matches the repo's pnpm-based workflow).
RUN corepack enable && corepack prepare [email protected] --activate
+# Build the runtime-neutral design dependency from its canonical source. The
+# root Docker context is required because this package is a sibling of the app.
+COPY packages/cua-design/package.json /packages/cua-design/package.json
+COPY packages/cua-design/assets /packages/cua-design/assets
+COPY packages/cua-design/src /packages/cua-design/src
+COPY packages/cua-design/scripts /packages/cua-design/scripts
+RUN node /packages/cua-design/scripts/build.mjs
+
# Install deps first (better layer caching). patches/ must be present before
# install so pnpm can apply pnpm.patchedDependencies (e.g. the @novnc BGR fix).
-COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
-COPY patches ./patches
+COPY cyclops-cs/package.json cyclops-cs/pnpm-lock.yaml cyclops-cs/pnpm-workspace.yaml ./
+COPY cyclops-cs/patches ./patches
RUN pnpm install --frozen-lockfile
# Build.
-COPY . .
+COPY cyclops-cs/ .
COPY --from=sdk-builder /workspace/cyclops-cs/sdk-bindings/ts-uniffi-browser/ts/index.web.ts ./sdk-bindings/ts-uniffi-browser/ts/index.web.ts
COPY --from=sdk-builder /workspace/cyclops-cs/sdk-bindings/ts-uniffi-browser/ts/wasm-bindgen ./sdk-bindings/ts-uniffi-browser/ts/wasm-bindgen
+ARG VITE_CUA_REVIEW_VISUAL_PREVIEW=false
+ENV VITE_CUA_REVIEW_VISUAL_PREVIEW=${VITE_CUA_REVIEW_VISUAL_PREVIEW}
RUN pnpm build:app
# Runtime stage — nginx serves static files and proxies /api to the backend.
@@ -50,5 +60,5 @@ ENV CYCLOPS_CS_BACKEND=http://cyclops-cs-backend:8080
# loads before the React bundle (window.__CYCLOPS_CS_CFG__).
ENV CYCLOPS_CS_CONFIG_JSON='{"kcUrl":"https://auth.cua.ai","kcRealm":"cyclops-cs","kcClientId":"cyclops-cs-spa"}'
-COPY nginx.conf /etc/nginx/templates/default.conf.template
+COPY cyclops-cs/nginx.conf /etc/nginx/templates/default.conf.template
COPY --from=builder /app/dist /usr/share/nginx/html
diff --git a/libs/fleet/e2e/agent-chat.spec.ts b/libs/fleet/e2e/agent-chat.spec.ts
index 272afc7a5a..022a0c16b0 100644
--- a/libs/fleet/e2e/agent-chat.spec.ts
+++ b/libs/fleet/e2e/agent-chat.spec.ts
@@ -1,6 +1,103 @@
import { expect, test } from "@playwright/test"
import { mockAuth, mockChatApi } from "./fixtures/mock-api"
+import { expectSharedPageShell } from "./fixtures/shell-geometry"
+
+test.describe("shared Chat page shell", () => {
+ for (const viewport of [
+ { name: "desktop", width: 1440, height: 900 },
+ { name: "mobile", width: 390, height: 844 },
+ ]) {
+ test(`keeps the shared shell and composer in view on ${viewport.name}`, async ({
+ page,
+ }) => {
+ await page.setViewportSize(viewport)
+ await mockAuth(page, { admin: false, chat: true })
+ await mockChatApi(page)
+ await page.goto("/agent")
+
+ await expectSharedPageShell(page)
+ await expect(page.getByRole("heading", { name: "Chat" })).toBeVisible()
+ await expect(
+ page.getByText("Run fleet and browser tasks with the Cua agent."),
+ ).toHaveCount(viewport.width > 700 ? 1 : 0)
+ await expect(page.locator(".agent-chat-composer")).toBeInViewport()
+ const composerBox = await page.locator(".agent-chat-composer").boundingBox()
+ expect(composerBox).not.toBeNull()
+ expect(
+ viewport.height - ((composerBox?.y ?? 0) + (composerBox?.height ?? 0)),
+ ).toBeLessThan(40)
+ expect(
+ await page.evaluate(
+ () => document.documentElement.scrollHeight - window.innerHeight,
+ ),
+ ).toBeLessThan(4)
+
+ if (viewport.width > 700) {
+ await expect(page.locator(".agent-chat-timestamp").first()).toHaveCSS(
+ "color",
+ "rgba(164, 173, 187, 0.82)",
+ )
+ const geometry = await page.locator(".cua-pagehead").evaluate(
+ async element => {
+ const samples: string[] = []
+ for (let frame = 0; frame < 30; frame += 1) {
+ await new Promise<void>(resolve =>
+ requestAnimationFrame(() => resolve()),
+ )
+ const box = element.getBoundingClientRect()
+ samples.push(`${box.x}:${box.y}:${box.width}:${box.height}`)
+ }
+ return samples
+ },
+ )
+ expect(new Set(geometry).size).toBe(1)
+ }
+ })
+ }
+})
+
+test("renders and exercises Chat through the standalone visual preview", async ({
+ page,
+}) => {
+ await page.goto("/agent?cua-visual-preview")
+
+ await expect(page).toHaveTitle("Chat · Cua")
+ await expect(page.getByRole("heading", { name: "Chat" })).toBeVisible()
+ await expect(page.getByRole("link", { name: "Chat" })).toBeVisible()
+ await page
+ .getByRole("button", { name: "Inspect the browser fleet" })
+ .click()
+ await expect(
+ page.getByText("Check the browser fleet and summarize its availability."),
+ ).toBeVisible()
+ await expect(page.getByText("Command completed")).toBeVisible()
+ await expect(
+ page.getByText("The browser fleet is healthy:", { exact: false }),
+ ).toBeVisible()
+
+ const prompt = page.getByPlaceholder("Ask a question")
+ await prompt.fill("Show me the preview response")
+ await page.getByRole("button", { name: "Send message" }).click()
+ await expect(
+ page.getByText("Preview mode is connected.", { exact: false }),
+ ).toBeVisible()
+ await expect(prompt).toBeEnabled()
+})
+
+test("offers a useful first-run Chat state in the standalone preview", async ({
+ page,
+}) => {
+ await page.goto("/agent?cua-visual-preview&cua-preview-state=empty")
+
+ await expect(
+ page.getByRole("heading", { name: "Start a conversation" }),
+ ).toBeVisible()
+ await expect(
+ page.getByText("Ask a question below to create your first conversation."),
+ ).toBeVisible()
+ await expect(page.getByPlaceholder("Ask a question")).toBeEnabled()
+})
test("shows chat history, transcript region, prompt shell, and authenticated history time", async ({ page }) => {
await mockAuth(page, { admin: false, chat: true })
@@ -74,6 +171,7 @@ test("loads a selected conversation with message skeletons and accessible author
await expect(page.getByText("Open the example site.")).toBeVisible()
await expect(page.getByText("The example site is ready.")).toBeVisible()
+ await expect(page.getByLabel("Your avatar")).toHaveText("Y")
await expect(page.getByLabel(/^You at /)).toBeVisible()
await expect(page.getByLabel(/^Assistant at /)).toBeVisible()
})
@@ -127,6 +225,10 @@ test("renders and sanitizes Markdown in user and assistant messages", async ({ p
const assistantBubble = page.getByLabel(/^Assistant at /)
await expect(userBubble.getByRole("table")).toBeVisible()
await expect(userBubble.getByRole("link", { name: "Safe link" })).toHaveAttribute("href", "https://example.com")
+ await expect(userBubble.getByRole("link", { name: "Safe link" })).toHaveCSS(
+ "color",
+ "rgb(159, 215, 255)",
+ )
await expect(userBubble.getByText("Unsafe link")).not.toHaveAttribute("href", /.+/)
await expect(assistantBubble.getByRole("table")).toBeVisible()
await expect(assistantBubble.locator("pre code")).toContainText("const ready = true")
@@ -165,14 +267,16 @@ test("manages mobile history modal focus, keyboard, inert background, and close
await trigger.focus()
await trigger.press("Enter")
const dialog = page.getByRole("dialog", { name: "Conversations" })
+ const drawer = dialog.locator(".agent-chat-mobile-drawer")
const closeButton = dialog.getByRole("button", { name: "Close conversations" })
await expect(dialog).toBeVisible()
+ await expect(drawer).toHaveCSS("background-color", "rgb(24, 24, 24)")
await expect(closeButton).toBeFocused()
await expect(dialog.getByRole("heading", { name: "Conversations", exact: true })).toHaveCount(1)
await expect(page.locator("#root")).toHaveAttribute("inert", "")
- const poolsNavigation = page.getByRole("link", { name: "Pools", exact: true }).first()
- await poolsNavigation.focus()
- await expect(poolsNavigation).not.toBeFocused()
+ const cuaIdentity = page.getByRole("link", { name: "Cua", exact: true }).first()
+ await cuaIdentity.focus()
+ await expect(cuaIdentity).not.toBeFocused()
await expect(closeButton).toBeFocused()
const lastFocusable = dialog.locator('button:not([disabled])').last()
diff --git a/libs/fleet/e2e/auth-session.spec.ts b/libs/fleet/e2e/auth-session.spec.ts
new file mode 100644
index 0000000000..c21fe8f9fc
--- /dev/null
+++ b/libs/fleet/e2e/auth-session.spec.ts
@@ -0,0 +1,132 @@
+import { expect, test } from "@playwright/test"
+import {
+ mockAuth,
+ mockGitHubTrustPoliciesApi,
+ mockNamespacesApi,
+} from "./fixtures/mock-api"
+
+interface MockKeycloakState {
+ initOptions: Record<string, unknown> | null
+ loginOptions: Record<string, unknown> | null
+ logoutOptions: Record<string, unknown> | null
+ updateTokenMinValidity: number[]
+ clearTokenCalls: number
+}
+
+function keycloakState(): MockKeycloakState {
+ return (window as unknown as { __MOCK_KEYCLOAK__: MockKeycloakState })
+ .__MOCK_KEYCLOAK__
+}
+
+test.beforeEach(async ({ page }) => {
+ await mockNamespacesApi(page)
+ await mockGitHubTrustPoliciesApi(page)
+})
+
+test("gates the protected shell until standard PKCE authentication resolves", async ({
+ page,
+}) => {
+ const auth = await mockAuth(page, {}, { holdAuth: true })
+
+ await page.goto("/settings")
+ await expect(page.getByText("Signing in…")).toBeVisible()
+ await expect(page.getByRole("navigation")).toHaveCount(0)
+
+ const initOptions = await page.evaluate(keycloakState).then(state => state.initOptions)
+ expect(initOptions).toMatchObject({
+ onLoad: "login-required",
+ flow: "standard",
+ pkceMethod: "S256",
+ checkLoginIframe: false,
+ })
+
+ await auth.releaseAuth()
+ await expect(page.getByText("Signing in…")).toHaveCount(0)
+ await expect(page.getByRole("button", { name: "testuser" })).toBeVisible()
+})
+
+test("refreshes API tokens with a thirty-second safety window", async ({ page }) => {
+ await mockAuth(page)
+
+ await page.goto("/settings")
+ await expect(page.getByRole("button", { name: "testuser" })).toBeVisible()
+
+ await expect
+ .poll(() =>
+ page.evaluate(keycloakState).then(state => state.updateTokenMinValidity),
+ )
+ .toContain(30)
+})
+
+test("failed refresh restarts login without replaying callback artifacts", async ({
+ page,
+}) => {
+ await mockAuth(page, {}, { refreshFails: true })
+
+ await page.goto(
+ "/settings?tab=billing&code=one-time&state=opaque&session_state=opaque",
+ )
+
+ await expect
+ .poll(() => page.evaluate(keycloakState).then(state => state.loginOptions))
+ .toEqual({ redirectUri: "http://localhost:5180/settings?tab=billing" })
+ await expect
+ .poll(() => page.evaluate(keycloakState).then(state => state.clearTokenCalls))
+ .toBe(1)
+})
+
+test("rejected callback fails closed without rendering the shell", async ({ page }) => {
+ await mockAuth(page, {}, { initRejects: true })
+
+ await page.goto("/settings?error=access_denied&state=opaque")
+
+ await expect(page.getByText("Auth error: Error: rejected callback")).toBeVisible()
+ await expect(page.getByRole("button", { name: "testuser" })).toHaveCount(0)
+})
+
+test("logout uses the stable same-origin Run entry point", async ({ page }) => {
+ await mockAuth(page)
+
+ await page.goto("/settings?tab=billing")
+ await page.getByRole("button", { name: "testuser" }).click()
+ await page.getByRole("menuitem", { name: "Sign out" }).press("Enter")
+
+ await expect
+ .poll(() => page.evaluate(keycloakState).then(state => state.logoutOptions))
+ .toEqual({ redirectUri: "http://localhost:5180/" })
+})
+
+test("account menu opens without a redundant identity header", async ({ page }) => {
+ await mockAuth(page)
+
+ await page.goto("/settings")
+ await page.getByRole("button", { name: "testuser" }).click()
+
+ const topNavigation = page.locator("#cua-shell-topnav")
+ const signOut = page.getByRole("menuitem", { name: "Sign out" })
+
+ await expect(signOut).toBeVisible()
+ await expect(
+ page.locator('[id^="awsui-button-dropdown__header"]:visible'),
+ ).toHaveCount(0)
+
+ const [topNavigationBox, signOutBox] = await Promise.all([
+ topNavigation.boundingBox(),
+ signOut.boundingBox(),
+ ])
+ expect(topNavigationBox).not.toBeNull()
+ expect(signOutBox).not.toBeNull()
+ expect(signOutBox!.y).toBeGreaterThanOrEqual(
+ topNavigationBox!.y + topNavigationBox!.height,
+ )
+ expect(
+ await signOut.evaluate(element => {
+ const box = element.getBoundingClientRect()
+ const topmost = document.elementFromPoint(
+ box.left + box.width / 2,
+ box.top + box.height / 2,
+ )
+ return topmost === element || element.contains(topmost)
+ }),
+ ).toBe(true)
+})
diff --git a/libs/fleet/e2e/detail-shell.spec.ts b/libs/fleet/e2e/detail-shell.spec.ts
new file mode 100644
index 0000000000..c3a305f8dd
--- /dev/null
+++ b/libs/fleet/e2e/detail-shell.spec.ts
@@ -0,0 +1,44 @@
+import { expect, test } from "@playwright/test"
+import {
+ mockAuth,
+ mockClaimsApi,
+ mockNamespacesApi,
+ mockPoolsApi,
+} from "./fixtures/mock-api"
+import { expectSharedPageShell } from "./fixtures/shell-geometry"
+
+async function mockFleet(page: Parameters<typeof mockAuth>[0]) {
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockPoolsApi(page)
+ await mockClaimsApi(page)
+}
+
+for (const viewport of [
+ { name: "desktop", width: 1440, height: 900 },
+ { name: "mobile", width: 375, height: 900 },
+]) {
+ test(`pool detail uses the shared shell on ${viewport.name}`, async ({ page }) => {
+ await page.setViewportSize(viewport)
+ await mockFleet(page)
+ await page.goto("/pools/demo-pool/demo-pool")
+
+ await expect(page.getByRole("heading", { name: "demo-pool", level: 1 })).toBeVisible()
+ await expect(page.getByRole("heading", { name: "Overview" })).toBeVisible()
+ await expect(page.getByRole("heading", { name: "Claims" })).toBeVisible()
+ await expectSharedPageShell(page)
+ })
+
+ test(`claim detail uses the shared shell on ${viewport.name}`, async ({ page }) => {
+ await page.setViewportSize(viewport)
+ await mockFleet(page)
+ await page.goto(
+ "/pools/demo-pool/demo-pool/claims/claim-abc123",
+ )
+
+ await expect(page.getByRole("heading", { name: "claim-abc123", level: 1 })).toBeVisible()
+ await expect(page.getByRole("heading", { name: "Overview" })).toBeVisible()
+ await expect(page.getByText("vm-xyz789", { exact: true })).toBeVisible()
+ await expectSharedPageShell(page)
+ })
+}
diff --git a/libs/fleet/e2e/fixtures/mock-api.ts b/libs/fleet/e2e/fixtures/mock-api.ts
index b786c368dd..3e5f6da7a1 100644
--- a/libs/fleet/e2e/fixtures/mock-api.ts
+++ b/libs/fleet/e2e/fixtures/mock-api.ts
@@ -59,10 +59,14 @@ export interface MockFeatureFlags {
export interface MockAuthOptions {
holdConfig?: boolean
+ holdAuth?: boolean
+ initRejects?: boolean
+ refreshFails?: boolean
}
export interface MockAuthControl {
releaseConfig(): void
+ releaseAuth(): Promise<void>
}
export async function mockAuth(
@@ -72,6 +76,9 @@ export async function mockAuth(
): Promise<MockAuthControl> {
const config = deferred()
if (!options.holdConfig) config.resolve()
+ const holdAuth = options.holdAuth ?? false
+ const initRejects = options.initRejects ?? false
+ const refreshFails = options.refreshFails ?? false
// Intercept the Vite pre-bundled keycloak-js module. Vite serves
// node_modules deps from /.vite/deps/ or /node_modules/.vite/deps/.
// Replace the entire module with a stub Keycloak class.
@@ -79,6 +86,18 @@ export async function mockAuth(
route.fulfill({
contentType: "application/javascript",
body: `
+ const authReady = new Promise(resolve => {
+ window.__MOCK_KEYCLOAK__ = {
+ initOptions: null,
+ loginOptions: null,
+ logoutOptions: null,
+ updateTokenMinValidity: [],
+ clearTokenCalls: 0,
+ releaseAuth: resolve,
+ };
+ });
+ ${holdAuth ? "" : "window.__MOCK_KEYCLOAK__.releaseAuth();"}
+
class Keycloak {
constructor() {
this.token = "${FAKE_TOKEN}";
@@ -96,10 +115,26 @@ export async function mockAuth(
this.resourceAccess = {};
this.subject = "test-user-id";
}
- async init() { this.authenticated = true; return true; }
- async updateToken() { return true; }
- login() {}
- logout() { window.location.href = "/"; }
+ async init(options) {
+ window.__MOCK_KEYCLOAK__.initOptions = options;
+ await authReady;
+ ${initRejects ? 'throw new Error("rejected callback");' : ""}
+ this.authenticated = true;
+ return true;
+ }
+ async updateToken(minValidity) {
+ window.__MOCK_KEYCLOAK__.updateTokenMinValidity.push(minValidity);
+ ${refreshFails ? 'throw new Error("refresh failed");' : ""}
+ return true;
+ }
+ login(options) {
+ window.__MOCK_KEYCLOAK__.loginOptions = options;
+ return Promise.resolve();
+ }
+ logout(options) {
+ window.__MOCK_KEYCLOAK__.logoutOptions = options;
+ return Promise.resolve();
+ }
register() {}
accountManagement() {}
createLoginUrl() { return "/"; }
@@ -107,7 +142,10 @@ export async function mockAuth(
createRegisterUrl() { return "/"; }
createAccountUrl() { return "/"; }
isTokenExpired() { return false; }
- clearToken() {}
+ clearToken() {
+ window.__MOCK_KEYCLOAK__.clearTokenCalls += 1;
+ this.authenticated = false;
+ }
hasRealmRole() { return false; }
hasResourceRole() { return false; }
loadUserProfile() { return Promise.resolve({ username: "testuser" }); }
@@ -137,7 +175,16 @@ export async function mockAuth(
route.fulfill({ status: 200, contentType: "application/json", body: "{}" }),
)
- return { releaseConfig: config.resolve }
+ return {
+ releaseConfig: config.resolve,
+ releaseAuth: () =>
+ page.evaluate(() => {
+ const control = (window as unknown as {
+ __MOCK_KEYCLOAK__: { releaseAuth(): void }
+ }).__MOCK_KEYCLOAK__
+ control.releaseAuth()
+ }),
+ }
}
// ---------------------------------------------------------------------------
diff --git a/libs/fleet/e2e/fixtures/shell-geometry.ts b/libs/fleet/e2e/fixtures/shell-geometry.ts
new file mode 100644
index 0000000000..e65e179e3c
--- /dev/null
+++ b/libs/fleet/e2e/fixtures/shell-geometry.ts
@@ -0,0 +1,26 @@
+import { expect, type Page } from "@playwright/test"
+
+export async function expectSharedPageShell(page: Page): Promise<void> {
+ const header = page.locator(".cua-pagehead")
+ const body = page.locator(".cua-pagebody")
+ await expect(header).toBeVisible()
+ await expect(body).toBeVisible()
+
+ const [headerBox, bodyBox] = await Promise.all([
+ header.boundingBox(),
+ body.boundingBox(),
+ ])
+ expect(headerBox).not.toBeNull()
+ expect(bodyBox).not.toBeNull()
+ expect(Math.abs(headerBox!.x - bodyBox!.x)).toBeLessThanOrEqual(1)
+ expect(
+ Math.abs(
+ headerBox!.x + headerBox!.width - (bodyBox!.x + bodyBox!.width),
+ ),
+ ).toBeLessThanOrEqual(1)
+ expect(
+ await page.locator("main").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+}
diff --git a/libs/fleet/e2e/pools.spec.ts b/libs/fleet/e2e/pools.spec.ts
index 16e04ced7f..bae8bb5f9d 100644
--- a/libs/fleet/e2e/pools.spec.ts
+++ b/libs/fleet/e2e/pools.spec.ts
@@ -6,6 +6,280 @@ import {
mockClaimsApi,
} from "./fixtures/mock-api"
+test.describe("Pools page header", () => {
+ for (const viewport of [
+ { name: "desktop", width: 1440, height: 900 },
+ { name: "desktop breakpoint", width: 1024, height: 900 },
+ { name: "tablet", width: 768, height: 900 },
+ { name: "narrow", width: 500, height: 900 },
+ { name: "mobile", width: 375, height: 900 },
+ { name: "compact", width: 320, height: 900 },
+ ]) {
+ test(`header stays stable without the shader on ${viewport.name}`, async ({
+ page,
+ }) => {
+ await page.setViewportSize(viewport)
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockPoolsApi(page)
+
+ await page.goto("/pools")
+
+ const mesh = page.locator(".cua-pagehead__mesh")
+ const topNavigation = page.locator("#cua-shell-topnav")
+ const header = page.locator(".cua-pagehead")
+ const semanticMain = page.getByRole("main")
+ const navigation = page.getByRole("navigation", { name: "Main navigation" })
+ const table = page.locator(".cua-pagebody")
+ const title = page.locator(".cua-pagehead__title")
+ const refreshPools = page.getByRole("button", { name: "Refresh pools" })
+ const newPool = page.getByRole("button", { name: "New pool" })
+ const status = page.getByRole("columnheader", { name: "Status" })
+
+ await expect(mesh).toHaveCount(0)
+ await expect(page.locator(".cua-pagehead canvas")).toHaveCount(0)
+ const [topNavigationBox, navigationBox, headerBox, tableBox] = await Promise.all([
+ topNavigation.boundingBox(),
+ navigation.boundingBox(),
+ header.boundingBox(),
+ table.boundingBox(),
+ ])
+ const navigationOpen = await page
+ .getByRole("button", { name: "Close navigation" })
+ .isVisible()
+ expect(topNavigationBox).not.toBeNull()
+ expect(topNavigationBox!.x).toBeLessThanOrEqual(1)
+ expect(Math.abs(topNavigationBox!.width - viewport.width)).toBeLessThanOrEqual(1)
+ expect(headerBox).not.toBeNull()
+ expect(tableBox).not.toBeNull()
+
+ const paneStart = navigationOpen && navigationBox
+ ? navigationBox.x + navigationBox.width
+ : 0
+ expect(headerBox!.x - paneStart).toBeGreaterThan(1)
+ expect(viewport.width - (headerBox!.x + headerBox!.width)).toBeGreaterThan(1)
+ expect(Math.abs(headerBox!.x - tableBox!.x)).toBeLessThanOrEqual(1)
+ expect(
+ Math.abs(
+ headerBox!.x + headerBox!.width - (tableBox!.x + tableBox!.width),
+ ),
+ ).toBeLessThanOrEqual(1)
+ expect(
+ await semanticMain.evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+ expect(
+ await page.locator("html").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+ await expect(page.getByRole("button", { name: "testuser" })).toBeVisible()
+
+ const geometrySamples = await header.evaluate(async element => {
+ const samples: string[] = []
+ for (let frame = 0; frame < 30; frame += 1) {
+ await new Promise<void>(resolve => requestAnimationFrame(() => resolve()))
+ const box = element.getBoundingClientRect()
+ samples.push(
+ [box.x, box.width, document.documentElement.scrollWidth].join(":"),
+ )
+ }
+ return samples
+ })
+ expect(new Set(geometrySamples).size).toBe(1)
+
+ await expect(title).toHaveCSS(
+ "font-family",
+ /Urbanist/,
+ )
+ await expect(title).toHaveCSS(
+ "font-size",
+ viewport.width >= 688 ? "28px" : "24px",
+ )
+ await expect(status).toBeVisible()
+ await expect(newPool).toHaveCSS("border-radius", "10px")
+ await expect(newPool).toHaveCSS("font-size", "13px")
+ await expect(newPool).toHaveCSS("appearance", "none")
+ await expect(newPool).toHaveCSS("box-shadow", "none")
+ expect(await newPool.evaluate(element => getComputedStyle(element).backgroundImage))
+ .toContain("linear-gradient")
+ await page.evaluate(() => {
+ document.body.setAttribute("data-awsui-focus-visible", "true")
+ })
+ await newPool.focus()
+ expect(
+ await newPool.evaluate(
+ element => getComputedStyle(element, "::before").content,
+ ),
+ ).toBe("none")
+ await expect(newPool).toHaveCSS("outline-style", "solid")
+ await expect(newPool).toHaveCSS("outline-width", "2px")
+ await expect(newPool).toHaveCSS("outline-offset", "2px")
+ await newPool.hover()
+ expect(await newPool.evaluate(element => getComputedStyle(element).backgroundImage))
+ .toContain("linear-gradient")
+ await refreshPools.hover()
+ await expect(refreshPools).toHaveCSS("background-color", "rgb(32, 33, 36)")
+
+ const [refreshBox, refreshIconBox] = await Promise.all([
+ refreshPools.boundingBox(),
+ refreshPools.locator("svg").boundingBox(),
+ ])
+ expect(refreshBox).not.toBeNull()
+ expect(refreshIconBox).not.toBeNull()
+ expect(
+ Math.abs(
+ refreshBox!.x + refreshBox!.width / 2 -
+ (refreshIconBox!.x + refreshIconBox!.width / 2),
+ ),
+ ).toBeLessThanOrEqual(0.5)
+ expect(
+ Math.abs(
+ refreshBox!.y + refreshBox!.height / 2 -
+ (refreshIconBox!.y + refreshIconBox!.height / 2),
+ ),
+ ).toBeLessThanOrEqual(0.5)
+
+ expect(navigationOpen).toBe(viewport.width >= 1024)
+
+ if (viewport.width < 1024) {
+ const openNavigation = page.getByRole("button", { name: "Open navigation" })
+ await expect(openNavigation).toHaveCSS("border-radius", "10px")
+ await expect(openNavigation).toHaveCSS("width", "40px")
+ await expect(openNavigation).toHaveCSS("height", "40px")
+ await openNavigation.click()
+ const openNavigationBox = await page
+ .getByRole("navigation", { name: "Main navigation" })
+ .boundingBox()
+ expect(openNavigationBox).not.toBeNull()
+ expect(openNavigationBox!.y).toBeLessThanOrEqual(
+ viewport.width < 688 ? 1 : 50,
+ )
+ }
+ })
+ }
+})
+
+test("Pools remains horizontally usable at 200% zoom and 320 CSS pixels", async ({
+ page,
+}) => {
+ await page.setViewportSize({ width: 640, height: 900 })
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockPoolsApi(page)
+ await page.goto("/pools")
+
+ // CSS zoom exercises the same two-dimensional reflow pressure as 200%
+ // browser zoom while remaining deterministic in headless Chromium.
+ await page.locator("html").evaluate(element => {
+ element.style.zoom = "200%"
+ })
+ await expect(page.locator(".cua-pagebody")).toBeVisible()
+ expect(
+ await page.locator("html").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+ expect(
+ await page.getByRole("main").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+
+ await page.locator("html").evaluate(element => {
+ element.style.zoom = ""
+ })
+ await page.setViewportSize({ width: 320, height: 900 })
+ await expect(page.getByRole("button", { name: "New pool" })).toBeVisible()
+ expect(
+ await page.locator("html").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+})
+
+test("forced colors removes decoration and navigation works from the keyboard", async ({
+ page,
+}) => {
+ await page.setViewportSize({ width: 500, height: 900 })
+ await page.emulateMedia({ forcedColors: "active" })
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockPoolsApi(page)
+ await page.goto("/pools")
+
+ const topNavigation = page.locator(".cua-shell__topnav")
+ const pageHead = page.locator(".cua-pagehead")
+ expect(
+ await topNavigation.evaluate(
+ element => getComputedStyle(element, "::before").display,
+ ),
+ ).toBe("none")
+ expect(
+ await pageHead.evaluate(
+ element => getComputedStyle(element, "::after").display,
+ ),
+ ).toBe("none")
+
+ const openNavigation = page.getByRole("button", { name: "Open navigation" })
+ await openNavigation.focus()
+ await openNavigation.press("Enter")
+ const closeNavigation = page.getByRole("button", {
+ name: "Close navigation",
+ })
+ await expect(closeNavigation).toBeVisible()
+ await closeNavigation.focus()
+ await closeNavigation.press("Space")
+ await expect(openNavigation).toBeVisible()
+
+ expect(
+ await page.locator("main").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+})
+
+test("selection actions stay with the table and deletion requires confirmation", async ({
+ page,
+}) => {
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockPoolsApi(page)
+ await page.goto("/pools")
+
+ await expect(page.getByRole("button", { name: "Duplicate" })).toHaveCount(0)
+ await expect(page.getByRole("button", { name: "Delete" })).toHaveCount(0)
+
+ const row = page.getByRole("row").filter({ hasText: "demo-pool" })
+ await row.getByRole("checkbox").check()
+ await expect(page.getByText("1 pool selected")).toBeVisible()
+ await page.getByRole("button", { name: "Delete" }).click()
+
+ const dialog = page.getByRole("dialog", { name: "Delete 1 pool?" })
+ await expect(dialog).toBeVisible()
+ await expect(dialog.getByText("This action cannot be undone.")).toBeVisible()
+ await dialog.getByRole("button", { name: "Cancel" }).click()
+ await expect(dialog).toBeHidden()
+})
+
+test("local visual preview keeps preview data active on pool detail", async ({
+ page,
+}) => {
+ await page.goto("/pools?cua-visual-preview")
+
+ await page.getByRole("link", { name: "prod-web-fleet" }).click()
+
+ await expect(page).toHaveURL(
+ /\/pools\/preview\/prod-web-fleet\?cua-visual-preview$/,
+ )
+ await expect(
+ page.getByRole("heading", { name: "prod-web-fleet" }),
+ ).toBeVisible()
+ await expect(page.getByText("Failed to load pool")).toHaveCount(0)
+ await expect(page.getByRole("heading", { name: "Claims" })).toBeVisible()
+})
+
test.describe("Pool creation", () => {
test("pool creation form has name field", async ({ page }) => {
await mockAuth(page)
@@ -33,6 +307,27 @@ test.describe("Pool creation", () => {
// Services section has an "Add service" button
await expect(page.getByRole("button", { name: "Add service" })).toBeVisible()
})
+
+ test("invalid submission focuses the name and cancel protects unsaved work", async ({
+ page,
+ }) => {
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockPoolsApi(page)
+ await page.goto("/pools/new")
+
+ const name = page.getByRole("textbox", { name: "Name" })
+ await page.getByRole("button", { name: "Create" }).click()
+ await expect(name).toBeFocused()
+ await expect(page.getByText("Name is required.")).toBeVisible()
+
+ await name.fill("new-fleet")
+ await page.getByRole("button", { name: "Cancel" }).click()
+ const dialog = page.getByRole("dialog", { name: "Discard changes?" })
+ await expect(dialog).toBeVisible()
+ await dialog.getByRole("button", { name: "Keep editing" }).click()
+ await expect(name).toHaveValue("new-fleet")
+ })
})
test.describe("Pool duplication", () => {
@@ -155,6 +450,18 @@ test.describe("Pool detail with claims", () => {
await expect(
page.getByRole("button", { name: "Create claim" }),
).toBeVisible()
+ await expect(page.getByRole("button", { name: "Create claim" })).toHaveCSS(
+ "border-radius",
+ "10px",
+ )
+ await expect(page.getByRole("button", { name: "Refresh claims" })).toHaveCSS(
+ "border-radius",
+ "10px",
+ )
+ await expect(page.getByRole("button", { name: "Refresh claims" })).toHaveCSS(
+ "width",
+ "40px",
+ )
// The existing mock claim should be listed
const claimRow = page.getByRole("row").filter({ hasText: "claim-abc123" })
diff --git a/libs/fleet/e2e/sdk-builders.spec.ts b/libs/fleet/e2e/sdk-builders.spec.ts
index 0ed9ce8451..d78882b542 100644
--- a/libs/fleet/e2e/sdk-builders.spec.ts
+++ b/libs/fleet/e2e/sdk-builders.spec.ts
@@ -17,9 +17,12 @@ test.describe("SDK builders", () => {
test("builds client, claim, and user-key records", async ({ page }) => {
const result = await page.evaluate(async () => {
- const { buildClientConfiguration } = await import("/src/sdk/client.ts")
+ const { buildClientConfiguration, ensureSdkInitialized } = await import(
+ "/src/sdk/client.ts"
+ )
const { buildClaimRequest } = await import("/src/sdk/claims.ts")
const { buildUserApiKeyRequest } = await import("/src/sdk/userKeys.ts")
+ await ensureSdkInitialized()
const pool = {
apiVersion: "osgym.cua.ai/v1alpha1",
kind: "OSGymSandboxWarmPool",
@@ -62,8 +65,10 @@ test.describe("SDK builders", () => {
test("builds nested pool and template requests", async ({ page }) => {
const result = await page.evaluate(async () => {
+ const { ensureSdkInitialized } = await import("/src/sdk/client.ts")
const { buildPoolRequest, buildTemplateRequest } = await import("/src/sdk/pools.ts")
const { Firmware, ServiceProtocol } = await import("/src/sdk/generated.ts")
+ await ensureSdkInitialized()
const values = {
cpu: 4,
ram: "8Gi",
@@ -121,6 +126,7 @@ test.describe("SDK builders", () => {
test("rebuilds template services without mutation", async ({ page }) => {
const result = await page.evaluate(async () => {
+ const { ensureSdkInitialized } = await import("/src/sdk/client.ts")
const { rebuildTemplateWithServices } = await import("/src/sdk/pools.ts")
const {
Firmware,
@@ -130,6 +136,7 @@ test.describe("SDK builders", () => {
RuntimeKind,
SandboxServiceBuilder,
} = await import("/src/sdk/generated.ts")
+ await ensureSdkInitialized()
const originalService = new SandboxServiceBuilder()
.name("old")
.targetPort(8080)
diff --git a/libs/fleet/e2e/settings.spec.ts b/libs/fleet/e2e/settings.spec.ts
index a0ebd35af1..c4e7f4fb18 100644
--- a/libs/fleet/e2e/settings.spec.ts
+++ b/libs/fleet/e2e/settings.spec.ts
@@ -4,6 +4,35 @@ import {
mockNamespacesApi,
mockGitHubTrustPoliciesApi,
} from "./fixtures/mock-api"
+import { expectSharedPageShell } from "./fixtures/shell-geometry"
+
+for (const viewport of [
+ { name: "desktop", width: 1440, height: 900 },
+ { name: "mobile", width: 375, height: 900 },
+]) {
+ test(`Settings uses the shared shell on ${viewport.name}`, async ({ page }) => {
+ await page.setViewportSize(viewport)
+ await mockAuth(page, { billing: true })
+ await mockNamespacesApi(page)
+ await mockGitHubTrustPoliciesApi(page)
+ await page.route("**/api/billing/summary", route =>
+ route.fulfill({
+ contentType: "application/json",
+ body: JSON.stringify({ payment_method_present: false, card: null }),
+ }),
+ )
+
+ await page.goto("/settings")
+
+ await expectSharedPageShell(page)
+ await expect(page.getByLabel("Display name")).toBeHidden()
+ expect(
+ await page.locator("html").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+ })
+}
test.describe("Settings GitHub trust policies", () => {
test.beforeEach(async ({ page }) => {
@@ -85,7 +114,7 @@ test.describe("Settings GitHub trust policies", () => {
).toHaveLength(1)
})
- test("shows GitHub WIF below payment method in a collapsed section", async ({
+ test("orders account, API keys, GitHub OIDC, and payment method", async ({
page,
}) => {
await page.route("**/api/config", route =>
@@ -107,31 +136,63 @@ test.describe("Settings GitHub trust policies", () => {
name: "Payment method",
exact: true,
})
+ const accountHeading = page.getByRole("heading", {
+ name: "Account",
+ exact: true,
+ })
+ const apiKeysHeading = page.getByRole("heading", {
+ name: "API keys",
+ exact: true,
+ })
const githubToggle = page.getByRole("button", {
name: "GitHub Actions OIDC",
})
+ await expect(page.getByRole("heading", { name: "Settings" })).toBeVisible()
+ await expect(accountHeading).toBeVisible()
+ await expect(apiKeysHeading).toBeVisible()
await expect(paymentHeading).toBeVisible()
await expect(githubToggle).toBeVisible()
- const paymentBeforeGitHub = await page.evaluate(() => {
- const payment = [...document.querySelectorAll("h1, h2, h3, h4")].find(
- element => element.textContent?.trim() === "Payment method",
- )
- const github = [...document.querySelectorAll("button, [role=\"button\"]")].find(element =>
- element.textContent?.trim().startsWith("GitHub Actions OIDC"),
- )
- return Boolean(
- payment &&
- github &&
- payment.compareDocumentPosition(github) & Node.DOCUMENT_POSITION_FOLLOWING,
- )
+ const sectionOrder = await page.evaluate(() => {
+ const elements = [...document.querySelectorAll("h1, h2, h3, h4, button")]
+ const indexOf = (label: string) =>
+ elements.findIndex(element => element.textContent?.trim().startsWith(label))
+ return [
+ indexOf("Account"),
+ indexOf("API keys"),
+ indexOf("GitHub Actions OIDC"),
+ indexOf("Payment method"),
+ ]
})
- expect(paymentBeforeGitHub).toBe(true)
+ expect(sectionOrder.every(index => index >= 0)).toBe(true)
+ expect(sectionOrder).toEqual([...sectionOrder].sort((a, b) => a - b))
+ await page.getByRole("button", { name: "Manage API keys" }).click()
+ await expect(page).toHaveURL(/\/user-keys$/)
+ await page.goto("/settings")
await expect(page.getByLabel("Display name")).toBeHidden()
await githubToggle.click()
await expect(page.getByLabel("Display name")).toBeVisible()
})
+ test("keeps account and API keys usable when GitHub settings fail", async ({ page }) => {
+ await page.unroute("**/api/github-trust-policies")
+ await page.route("**/api/github-trust-policies", route =>
+ route.fulfill({ status: 503, body: "temporarily unavailable" }),
+ )
+
+ await page.goto("/settings")
+ await expect(page.getByRole("heading", { name: "Account" })).toBeVisible()
+ await expect(page.getByRole("button", { name: "Manage API keys" })).toBeVisible()
+ await expect(
+ page.getByText("GitHub Actions settings are unavailable. Expand to retry."),
+ ).toBeVisible()
+ await page.getByRole("button", { name: "GitHub Actions OIDC" }).click()
+ await expect(
+ page.getByRole("heading", { name: "GitHub Actions settings are unavailable" }),
+ ).toBeVisible()
+ await expect(page.getByRole("button", { name: "Retry" })).toBeVisible()
+ })
+
test("can create, edit, disable, and delete a trust policy", async ({ page }) => {
await page.goto("/settings")
await page.getByRole("button", { name: "GitHub Actions OIDC" }).click()
@@ -153,7 +214,10 @@ test.describe("Settings GitHub trust policies", () => {
await expect(page.getByText("No").first()).toBeVisible()
await page.getByRole("button", { name: "Delete" }).nth(1).click()
- await page.getByRole("button", { name: "Delete" }).last().click()
+ await page
+ .getByRole("dialog")
+ .getByRole("button", { name: "Delete" })
+ .click()
await expect(page.getByText("preview-ci-updated")).toHaveCount(0)
})
})
diff --git a/libs/fleet/e2e/user-keys.spec.ts b/libs/fleet/e2e/user-keys.spec.ts
index 0585084031..779a6eacb5 100644
--- a/libs/fleet/e2e/user-keys.spec.ts
+++ b/libs/fleet/e2e/user-keys.spec.ts
@@ -4,6 +4,57 @@ import {
mockNamespacesApi,
mockUserKeysApi,
} from "./fixtures/mock-api"
+import { expectSharedPageShell } from "./fixtures/shell-geometry"
+
+for (const viewport of [
+ { name: "desktop", width: 1440, height: 900 },
+ { name: "mobile", width: 375, height: 900 },
+]) {
+ test(`User API keys uses the shared shell on ${viewport.name}`, async ({ page }) => {
+ await page.setViewportSize(viewport)
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockUserKeysApi(page)
+
+ await page.goto("/user-keys")
+
+ await expectSharedPageShell(page)
+ await expect(page.getByRole("button", { name: "Create key" })).toBeVisible()
+ expect(
+ await page.locator("html").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+ })
+}
+
+test("User API keys reflows at 200% zoom and 320 CSS pixels", async ({ page }) => {
+ await page.setViewportSize({ width: 640, height: 900 })
+ await mockAuth(page)
+ await mockNamespacesApi(page)
+ await mockUserKeysApi(page)
+ await page.goto("/user-keys")
+
+ await page.locator("html").evaluate(element => {
+ element.style.zoom = "200%"
+ })
+ expect(
+ await page.locator("html").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+
+ await page.locator("html").evaluate(element => {
+ element.style.zoom = ""
+ })
+ await page.setViewportSize({ width: 320, height: 900 })
+ await expect(page.getByRole("button", { name: "Create key" })).toBeVisible()
+ expect(
+ await page.locator("html").evaluate(
+ element => element.scrollWidth - element.clientWidth,
+ ),
+ ).toBeLessThanOrEqual(1)
+})
test.describe("User API keys", () => {
test.beforeEach(async ({ page }) => {
@@ -15,10 +66,11 @@ test.describe("User API keys", () => {
test("renders the API keys page with existing keys", async ({ page }) => {
await page.goto("/user-keys")
- // The page should have the "Your API keys" table header
+ // The shared page shell and key table should both be visible.
await expect(
- page.getByRole("heading", { name: "Your API keys" }),
+ page.getByRole("heading", { name: "User API keys" }),
).toBeVisible()
+ await expect(page.getByRole("heading", { name: "API keys", exact: true })).toBeVisible()
// The existing mock key should be listed
await expect(page.getByText("my-key")).toBeVisible()
@@ -126,4 +178,17 @@ test.describe("User API keys", () => {
page.getByText(/restrict this key to specific namespaces/i),
).toBeVisible()
})
+
+ test("shows a retryable table error without hiding the create form", async ({ page }) => {
+ await page.unroute("**/api/user-keys")
+ await page.route("**/api/user-keys", route =>
+ route.fulfill({ status: 503, body: "temporarily unavailable" }),
+ )
+
+ await page.goto("/user-keys")
+
+ await expect(page.getByRole("heading", { name: "Create API key" })).toBeVisible()
+ await expect(page.getByText("API keys are unavailable")).toBeVisible()
+ await expect(page.getByRole("button", { name: "Retry" })).toBeVisible()
+ })
})
diff --git a/libs/fleet/index.html b/libs/fleet/index.html
index 3460cfd78e..5f5d351427 100644
--- a/libs/fleet/index.html
+++ b/libs/fleet/index.html
@@ -3,6 +3,8 @@
<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>
<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" />
diff --git a/libs/fleet/package.json b/libs/fleet/package.json
index 49b3e73900..e1f99e3b18 100644
--- a/libs/fleet/package.json
+++ b/libs/fleet/package.json
@@ -14,11 +14,14 @@
"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: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 e2e/sdk-models.unit.ts src/sdk/status.ts --target ES2022 --module NodeNext --moduleResolution NodeNext --outDir target/sdk-model-tests --skipLibCheck && node target/sdk-model-tests/e2e/sdk-models.unit.js",
- "test:agent": "node --test --experimental-strip-types agent.test.ts"
+ "test:agent": "tsx --test agent.test.ts"
},
"dependencies": {
+ "@cua/design": "file:../packages/cua-design",
"@cloudscape-design/collection-hooks": "^1.0.93",
"@cloudscape-design/components": "^3.0.825",
"@cloudscape-design/global-styles": "^1.0.36",
@@ -41,6 +44,7 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4",
+ "tsx": "4.22.3",
"typescript": "^5.7.2",
"vite": "^5.4.11",
"@types/node": "^22.19.17"
diff --git a/libs/fleet/playwright.config.ts b/libs/fleet/playwright.config.ts
index 4547de7778..a9159dab04 100644
--- a/libs/fleet/playwright.config.ts
+++ b/libs/fleet/playwright.config.ts
@@ -1,5 +1,7 @@
import { defineConfig } from "@playwright/test"
+const localChromiumExecutable = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH
+
export default defineConfig({
testDir: "./e2e",
timeout: 30_000,
@@ -7,9 +9,12 @@ export default defineConfig({
use: {
baseURL: "http://localhost:5180",
headless: true,
+ launchOptions: localChromiumExecutable
+ ? { executablePath: localChromiumExecutable }
+ : undefined,
},
webServer: {
- command: "npm run dev",
+ command: "VITE_CUA_LOCAL_VISUAL_PREVIEW=true npm run dev",
port: 5180,
reuseExistingServer: true,
timeout: 30_000,
diff --git a/libs/fleet/pnpm-lock.yaml b/libs/fleet/pnpm-lock.yaml
index e884fb6839..59b2308d76 100644
--- a/libs/fleet/pnpm-lock.yaml
+++ b/libs/fleet/pnpm-lock.yaml
@@ -25,6 +25,9 @@ importers:
'@cloudscape-design/global-styles':
specifier: ^1.0.36
version: 1.0.58
+ '@cua/design':
+ specifier: file:../packages/cua-design
+ version: file:../packages/cua-design
'@modelcontextprotocol/sdk':
specifier: 1.29.0
version: 1.29.0([email protected])
@@ -77,6 +80,9 @@ importers:
'@vitejs/plugin-react':
specifier: ^4.3.4
version: 4.7.0([email protected](@types/[email protected]))
+ tsx:
+ specifier: 4.22.3
+ version: 4.22.3
typescript:
specifier: ^5.7.2
version: 5.9.3
@@ -195,24 +201,28 @@ packages:
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@biomejs/[email protected]':
resolution: {integrity: sha512-owaAMZD/T4LrD0ELNCk0Km3qrRHuM0X6EAyVE1FSqGY0rbLoiDLrO4Us2tllm6cAeB2Ioa9C2C08NZPdr8+0Ug==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@biomejs/[email protected]':
resolution: {integrity: sha512-CNq/9W38SYSH023lfcQ4KKU8K0YX8T//FZUhcgtMMRABDojx5XsMV7jlweAvGSl389wJQB29Qo6Zb/a+jdvt+w==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@biomejs/[email protected]':
resolution: {integrity: sha512-0jj7THz12GbUOLmMibktK6DZjqz2zV64KFxyBtcFTKPiiOIY0a7vns1elpO1dERvxpsZ5ik0oFfz0oGwFde1+g==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@biomejs/[email protected]':
resolution: {integrity: sha512-ouhkYdlhp/1GghEJPdWwD/Vi3gQ1nFxuSpMolWsbq3Lsq3QUR4jl6UdhhscdCugKU5vOEuMiJhvKj66O0OCq+w==}
@@ -259,6 +269,9 @@ packages:
'@cloudscape-design/[email protected]':
resolution: {integrity: sha512-zPE/wkrnjNAut5e3JmAEJ0QWS8firOWzwq4Hzh02KPQr9YDj1tABzcxqXda37NzpTG+/UEgud+39RQiCATJdkw==}
+ '@cua/design@file:../packages/cua-design':
+ resolution: {directory: ../packages/cua-design, type: directory}
+
'@dnd-kit/[email protected]':
resolution: {integrity: sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==}
peerDependencies:
@@ -287,138 +300,294 @@ packages:
cpu: [ppc64]
os: [aix]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==}
+ engines: {node: '>=18'}
+ cpu: [ppc64]
+ os: [aix]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==}
engines: {node: '>=12'}
cpu: [arm64]
os: [android]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [android]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==}
engines: {node: '>=12'}
cpu: [arm]
os: [android]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==}
+ engines: {node: '>=18'}
+ cpu: [arm]
+ os: [android]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==}
engines: {node: '>=12'}
cpu: [x64]
os: [android]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [android]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [darwin]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [darwin]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==}
engines: {node: '>=12'}
cpu: [arm64]
os: [freebsd]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [freebsd]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [freebsd]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [freebsd]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==}
engines: {node: '>=12'}
cpu: [arm]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==}
+ engines: {node: '>=18'}
+ cpu: [arm]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==}
+ engines: {node: '>=18'}
+ cpu: [ia32]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==}
engines: {node: '>=12'}
cpu: [loong64]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==}
+ engines: {node: '>=18'}
+ cpu: [loong64]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==}
engines: {node: '>=12'}
cpu: [mips64el]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==}
+ engines: {node: '>=18'}
+ cpu: [mips64el]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==}
+ engines: {node: '>=18'}
+ cpu: [ppc64]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==}
engines: {node: '>=12'}
cpu: [riscv64]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==}
+ engines: {node: '>=18'}
+ cpu: [riscv64]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==}
engines: {node: '>=12'}
cpu: [s390x]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==}
+ engines: {node: '>=18'}
+ cpu: [s390x]
+ os: [linux]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [linux]
+
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [netbsd]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==}
engines: {node: '>=12'}
cpu: [x64]
os: [netbsd]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [netbsd]
+
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [openbsd]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==}
engines: {node: '>=12'}
cpu: [x64]
os: [openbsd]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [openbsd]
+
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [openharmony]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==}
engines: {node: '>=12'}
cpu: [x64]
os: [sunos]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [sunos]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==}
+ engines: {node: '>=18'}
+ cpu: [arm64]
+ os: [win32]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [win32]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==}
+ engines: {node: '>=18'}
+ cpu: [ia32]
+ os: [win32]
+
'@esbuild/[email protected]':
resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
+ '@esbuild/[email protected]':
+ resolution: {integrity: sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==}
+ engines: {node: '>=18'}
+ cpu: [x64]
+ os: [win32]
+
'@formatjs/[email protected]':
resolution: {integrity: sha512-HJnTFeRM2kVFVr5gr5kH1XP6K0JcJtE7Lzvtr3FS/so5f1kpsqqqxy5JF+FRaO6H2qmcMfAUIox7AJteieRtVw==}
@@ -543,66 +712,79 @@ packages:
resolution: {integrity: sha512-DV6fJoxEYWJOvaZIsok7KrYl0tPvga5OZ2yvKHNNYyk/2roMLqQAbGhr78EQ5YhHpnhLKJD3S1WFusAkmUuV5g==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-mQKoJAzvuOs6F+TZybQO4GOTSMUu7v0WdxEk24krQ/uUxXoPTtHjuaUuPmFhtBcM4K0ons8nrE3JyhTuCFtT/w==}
cpu: [arm]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-Whjj2qoiJ6+OOJMGptTYazaJvjOJm+iKHpXQM1P3LzGjt7Ff++Tp7nH4N8J/BUA7R9IHfDyx4DJIflifwnbmIA==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-4YTNHKqGng5+yiZt3mg77nmyuCfmNfX4fPmyUapBcIk+BdwSwmCWGXOUxhXbBEkFHtoN5boLj/5NON+u5QC9tg==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-SU3kNlhkpI4UqlUc2VXPGK9o886ZsSeGfMAX2ba2b8DKmMXq4AL7KUrkSWVbb7koVqx41Yczx6dx5PNargIrEA==}
cpu: [loong64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-6lDLl5h4TXpB1mTf2rQWnAk/LcXrx9vBfu/DT5TIPhvMhRWaZ5MxkIc8u4lJAmBo6klTe1ywXIUHFjylW505sg==}
cpu: [loong64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-BMo8bOw8evlup/8G+cj5xWtPyp93xPdyoSN16Zy90Q2QZ0ZYRhCt6ZJSwbrRzG9HApFabjwj2p25TUPDWrhzqQ==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-E0L8X1dZN1/Rph+5VPF6Xj2G7JJvMACVXtamTJIDrVI44Y3K+G8gQaMEAavbqCGTa16InptiVrX6eM6pmJ+7qA==}
cpu: [ppc64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-oZJ/WHaVfHUiRAtmTAeo3DcevNsVvH8mbvodjZy7D5QKvCefO371SiKRpxoDcCxB3PTRTLayWBkvmDQKTcX/sw==}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-Dhbyh7j9FybM3YaTgaHmVALwA8AkUwTPccyCQ79TG9AJUsMQqgN1DDEZNr4+QUfwiWvLDumW5vdwzoeUF+TNxQ==}
cpu: [riscv64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-cJd1X5XhHHlltkaypz1UcWLA8AcoIi1aWhsvaWDskD1oz2eKCypnqvTQ8ykMNI0RSmm7NkTdSqSSD7zM0xa6Ig==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-DAZDBHQfG2oQuhY7mc6I3/qB4LU2fQCjRvxbDwd/Jdvb9fypP4IJ4qmtu6lNjes6B531AI8cg1aKC2di97bUxA==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-cRxsE8c13mZOh3vP+wLDxpQBRrOHDIGOWyDL93Sy0Ga8y515fBcC2pjUfFwUe5T7tqvTvWbCpg1URM/AXdWIXA==}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-QaWcIgRxqEdQdhJqW4DJctsH6HCmo5vHxY0krHSX4jMtOqfzC+dqDGuHM87bu4H8JBeibWx7jFz+h6/4C8wA5Q==}
@@ -895,6 +1077,11 @@ packages:
engines: {node: '>=12'}
hasBin: true
+ resolution: {integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==}
+ engines: {node: '>=18'}
+ hasBin: true
+
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
engines: {node: '>=6'}
@@ -1438,6 +1625,11 @@ packages:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+ resolution: {integrity: sha512-mdoNxBC/cSQObGGVQ5Bpn5i+yv7j68gk3Nfm3wFjcJg3Z0Mix9jzAFfP12prmm5eVGmDKtp0yyArrs0Q+8gZHg==}
+ engines: {node: '>=18.0.0'}
+ hasBin: true
+
resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}
@@ -1754,6 +1946,8 @@ snapshots:
'@material/material-color-utilities': 0.3.0
tslib: 2.8.1
+ '@cua/design@file:../packages/cua-design': {}
+
dependencies:
react: 18.3.1
@@ -1782,72 +1976,150 @@ snapshots:
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@esbuild/[email protected]':
optional: true
+ '@esbuild/[email protected]':
+ optional: true
+
'@formatjs/[email protected]':
dependencies:
'@formatjs/fast-memoize': 2.2.7
@@ -2316,6 +2588,35 @@ snapshots:
'@esbuild/win32-ia32': 0.21.5
'@esbuild/win32-x64': 0.21.5
+ optionalDependencies:
+ '@esbuild/aix-ppc64': 0.28.2
+ '@esbuild/android-arm': 0.28.2
+ '@esbuild/android-arm64': 0.28.2
+ '@esbuild/android-x64': 0.28.2
+ '@esbuild/darwin-arm64': 0.28.2
+ '@esbuild/darwin-x64': 0.28.2
+ '@esbuild/freebsd-arm64': 0.28.2
+ '@esbuild/freebsd-x64': 0.28.2
+ '@esbuild/linux-arm': 0.28.2
+ '@esbuild/linux-arm64': 0.28.2
+ '@esbuild/linux-ia32': 0.28.2
+ '@esbuild/linux-loong64': 0.28.2
+ '@esbuild/linux-mips64el': 0.28.2
+ '@esbuild/linux-ppc64': 0.28.2
+ '@esbuild/linux-riscv64': 0.28.2
+ '@esbuild/linux-s390x': 0.28.2
+ '@esbuild/linux-x64': 0.28.2
+ '@esbuild/netbsd-arm64': 0.28.2
+ '@esbuild/netbsd-x64': 0.28.2
+ '@esbuild/openbsd-arm64': 0.28.2
+ '@esbuild/openbsd-x64': 0.28.2
+ '@esbuild/openharmony-arm64': 0.28.2
+ '@esbuild/sunos-x64': 0.28.2
+ '@esbuild/win32-arm64': 0.28.2
+ '@esbuild/win32-ia32': 0.28.2
+ '@esbuild/win32-x64': 0.28.2
+
@@ -2950,6 +3251,12 @@ snapshots:
+ dependencies:
+ esbuild: 0.28.2
+ optionalDependencies:
+ fsevents: 2.3.3
+
dependencies:
safe-buffer: 5.2.1
diff --git a/libs/fleet/pnpm-workspace.yaml b/libs/fleet/pnpm-workspace.yaml
index 2d759adc43..f586fa773c 100644
--- a/libs/fleet/pnpm-workspace.yaml
+++ b/libs/fleet/pnpm-workspace.yaml
@@ -1,6 +1,9 @@
packages:
- .
+allowBuilds:
+ esbuild: set this to true or false
+
onlyBuiltDependencies:
- esbuild
diff --git a/libs/fleet/public/config.js b/libs/fleet/public/config.js
new file mode 100644
index 0000000000..61def6582c
--- /dev/null
+++ b/libs/fleet/public/config.js
@@ -0,0 +1,2 @@
+// Local Vite default. The production nginx exact-match route replaces this.
+window.__CYCLOPS_CS_CFG__ = window.__CYCLOPS_CS_CFG__ || {}
diff --git a/libs/fleet/scripts/capture-chat-checkpoint.mjs b/libs/fleet/scripts/capture-chat-checkpoint.mjs
new file mode 100644
index 0000000000..edb294edd7
--- /dev/null
+++ b/libs/fleet/scripts/capture-chat-checkpoint.mjs
@@ -0,0 +1,68 @@
+import { mkdir } from "node:fs/promises"
+import { resolve } from "node:path"
+import { chromium } from "@playwright/test"
+
+const output = resolve(
+ process.cwd(),
+ "../docs/superpowers/evidence/2026-08-16-chat-checkpoint",
+)
+await mkdir(output, { recursive: true })
+
+const browser = await chromium.launch({
+ headless: true,
+ executablePath:
+ process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH ??
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
+})
+
+async function open(width, height, suffix = "") {
+ const page = await browser.newPage({ viewport: { width, height } })
+ await page.goto(
+ `http://127.0.0.1:5180/agent?cua-visual-preview${suffix}`,
+ )
+ await page.getByRole("heading", { name: "Chat" }).waitFor()
+ return page
+}
+
+async function capture(name, page) {
+ await page.screenshot({ path: resolve(output, `${name}.png`) })
+ await page.close()
+}
+
+{
+ const page = await open(1440, 900)
+ await capture("desktop-empty-1440", page)
+}
+
+{
+ const page = await open(1440, 900)
+ await page
+ .getByRole("button", { name: "Inspect the browser fleet" })
+ .click()
+ await page.getByText("Command completed").waitFor()
+ await capture("desktop-active-1440", page)
+}
+
+{
+ const page = await open(1440, 900, "&cua-preview-state=loading")
+ await page.getByTestId("conversation-skeleton").first().waitFor()
+ await capture("desktop-loading-1440", page)
+}
+
+{
+ const page = await open(390, 844)
+ await page.getByRole("button", { name: "View conversations" }).click()
+ await page.getByRole("dialog", { name: "Conversations" }).waitFor()
+ await capture("mobile-drawer-390", page)
+}
+
+{
+ const page = await open(390, 844)
+ await page
+ .getByPlaceholder("Ask a question")
+ .fill("Check the browser fleet\nand compare availability\nwith the staging pool\nbefore proposing next steps.")
+ await capture("mobile-long-composer-390", page)
+}
+
+await browser.close()
+console.log(output)
diff --git a/libs/fleet/scripts/capture-pools-checkpoint.mjs b/libs/fleet/scripts/capture-pools-checkpoint.mjs
new file mode 100644
index 0000000000..6d6e93c290
--- /dev/null
+++ b/libs/fleet/scripts/capture-pools-checkpoint.mjs
@@ -0,0 +1,89 @@
+import { mkdir } from "node:fs/promises"
+import { resolve } from "node:path"
+import { chromium } from "@playwright/test"
+
+const output = resolve(
+ process.cwd(),
+ "../docs/superpowers/evidence/2026-08-16-pools-checkpoint-b",
+)
+await mkdir(output, { recursive: true })
+
+const browser = await chromium.launch({
+ headless: true,
+ executablePath:
+ process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH ??
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
+})
+
+async function open(width, height = 900, path = "/pools?cua-visual-preview") {
+ const page = await browser.newPage({ viewport: { width, height } })
+ await page.goto(`http://127.0.0.1:5180${path}`)
+ await page.locator("body#cua-dashboard-root").waitFor()
+ return page
+}
+
+async function capture(name, page) {
+ await page.waitForTimeout(250)
+ await page.screenshot({ path: resolve(output, `${name}.png`) })
+ await page.close()
+}
+
+for (const [name, width] of [
+ ["desktop-1440", 1440],
+ ["tablet-768", 768],
+ ["phone-375", 375],
+ ["compact-320", 320],
+]) {
+ const page = await open(width)
+ await page.getByRole("heading", { name: "Pools" }).waitFor()
+ await capture(name, page)
+}
+
+{
+ const page = await open(1440, 900, "/pools?cua-visual-preview&cua-preview-state=loading")
+ await page.getByText("Loading pools").waitFor()
+ await capture("state-loading", page)
+}
+
+{
+ const page = await open(1440, 900, "/pools?cua-visual-preview&cua-preview-state=empty")
+ await page.getByRole("heading", { name: "No pools" }).waitFor()
+ await capture("state-empty", page)
+}
+
+{
+ const page = await open(1440)
+ const filter = page.getByPlaceholder("Filter pools by property")
+ await filter.fill("pool-that-does-not-exist")
+ await filter.press("Enter")
+ await page.getByRole("heading", { name: "No matches" }).waitFor()
+ await capture("state-no-matches", page)
+}
+
+{
+ const page = await open(1440)
+ const row = page.getByRole("row").filter({ hasText: "prod-web-fleet" })
+ await row.getByRole("checkbox").check()
+ await page.getByText("1 pool selected").waitFor()
+ await page.screenshot({ path: resolve(output, "state-selected.png") })
+ await page.getByRole("button", { name: "Delete" }).click()
+ await page.getByRole("dialog", { name: "Delete 1 pool?" }).waitFor()
+ await capture("state-delete-confirmation", page)
+}
+
+{
+ const page = await open(375)
+ await page.getByRole("button", { name: "Open navigation" }).click()
+ await page.getByRole("navigation", { name: "Main navigation" }).waitFor()
+ await capture("state-mobile-navigation", page)
+}
+
+{
+ const page = await open(1440)
+ await page.getByRole("button", { name: "Preview" }).click()
+ await page.getByRole("menuitem", { name: "Sign out" }).waitFor()
+ await capture("state-account-menu", page)
+}
+
+await browser.close()
+console.log(output)
diff --git a/libs/fleet/scripts/capture-settings-checkpoint.mjs b/libs/fleet/scripts/capture-settings-checkpoint.mjs
new file mode 100644
index 0000000000..8b430618ba
--- /dev/null
+++ b/libs/fleet/scripts/capture-settings-checkpoint.mjs
@@ -0,0 +1,35 @@
+import { resolve } from "node:path"
+import { chromium } from "@playwright/test"
+
+const root = resolve(process.cwd(), "..")
+const pageUrl = `file://${resolve(
+ root,
+ "docs/superpowers/evidence/2026-08-16-settings-checkpoint/settings-composition.html",
+)}`
+const output = resolve(
+ root,
+ "docs/superpowers/evidence/2026-08-16-settings-checkpoint",
+)
+const browser = await chromium.launch({
+ headless: true,
+ executablePath:
+ process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH ??
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
+})
+
+for (const [name, width, height] of [
+ ["settings-desktop-1440", 1440, 1200],
+ ["settings-phone-375", 375, 1000],
+]) {
+ const page = await browser.newPage({ viewport: { width, height } })
+ await page.goto(pageUrl)
+ await page.evaluate(() => document.fonts.ready)
+ await page.screenshot({
+ path: resolve(output, `${name}.png`),
+ fullPage: true,
+ })
+ await page.close()
+}
+
+await browser.close()
+console.log(output)
diff --git a/libs/fleet/src/App.tsx b/libs/fleet/src/App.tsx
index 5bee18e111..e0a1332bf9 100644
--- a/libs/fleet/src/App.tsx
+++ b/libs/fleet/src/App.tsx
@@ -22,12 +22,27 @@ import { PoolNew } from "./pages/PoolNew"
import { UserApiKeys } from "./pages/UserApiKeys"
import { Settings } from "./pages/Settings"
import { AgentChat } from "./pages/AgentChat"
+import { PageShell } from "./components/PageShell"
import { FeatureFlagProvider, useFeatureFlags } from "./components/FeatureFlagContext"
import { FlashContext, type FlashMsg } from "./components/FlashContext"
import { logout, userInfo } from "./auth/keycloak"
+import cuaLockup from "@cua/design/assets/brand/cua-lockup-white.svg"
+import designTokens from "@cua/design/tokens.json"
+import { localVisualPreviewPath } from "./local-visual-preview"
const VERSION_CHECK_INTERVAL_MS = 60_000
+function useMediaQuery(query: string): boolean {
+ const [matches, setMatches] = useState(() => window.matchMedia(query).matches)
+ useEffect(() => {
+ const media = window.matchMedia(query)
+ const update = () => setMatches(media.matches)
+ media.addEventListener("change", update)
+ return () => media.removeEventListener("change", update)
+ }, [query])
+ return matches
+}
+
function useStaleCheck(): { stale: boolean } {
const [stale, setStale] = useState(false)
const currentEntry = useRef<string | null>(null)
@@ -80,8 +95,37 @@ function Shell() {
const [flashes, setFlashes] = useState<FlashbarProps.MessageDefinition[]>([])
const { stale } = useStaleCheck()
const [staleDismissed, setStaleDismissed] = useState(false)
+ const [navigationOpen, setNavigationOpen] = useState(
+ () => window.innerWidth >= designTokens.layout.breakpoint.tablet,
+ )
+ const tabletOrWider = useMediaQuery(
+ `(min-width: ${designTokens.layout.breakpoint.tablet}px)`,
+ )
+ const mobile = useMediaQuery(
+ `(max-width: ${designTokens.layout.breakpoint.mobile - 1}px)`,
+ )
+ useEffect(() => {
+ setNavigationOpen(tabletOrWider)
+ }, [tabletOrWider])
const user = userInfo()
const { chat } = useFeatureFlags()
+ useEffect(() => {
+ const path = location.pathname
+ const pageTitle = path === "/agent"
+ ? "Chat"
+ : path === "/user-keys"
+ ? "User API keys"
+ : path === "/settings"
+ ? "Settings"
+ : path === "/pools/new"
+ ? "New pool"
+ : path.includes("/claims/")
+ ? "Claim details"
+ : path.startsWith("/pools/")
+ ? "Pool details"
+ : "Pools"
+ document.title = `${pageTitle} · Cua`
+ }, [location.pathname])
const pushFlash = useCallback((msg: FlashMsg) => {
const id = crypto.randomUUID()
const dismiss = () =>
@@ -103,80 +147,91 @@ function Shell() {
return (
<FlashContext.Provider value={flashContext}>
- <TopNavigation
- identity={{ href: "#/", title: "Pools" }}
- utilities={[
- {
- type: "button",
- text: "Pools",
- href: "#/pools",
- onClick: e => {
- e.preventDefault()
- navigate("/pools")
- },
- },
- {
- type: "menu-dropdown",
- text: user.name ?? user.email ?? "Account",
- description: user.email,
- iconName: "user-profile",
- items: [{ id: "signout", text: "Sign out" }],
- onItemClick: e => {
- if (e.detail.id === "signout") logout()
- },
- },
- ]}
- />
- <AppLayout
- toolsHide
- navigation={
- <div style={{ fontSize: "1.25rem" }}>
- <SideNavigation
- header={{ href: "#/", text: "Pools" }}
- activeHref={`#${location.pathname}`}
- onFollow={e => {
- if (!e.detail.external) {
- e.preventDefault()
- navigate(e.detail.href.replace(/^#/, ""))
- }
- }}
+ <div className="cua-dashboard-theme cua-shell">
+ <div id="cua-shell-topnav" className="cua-shell__topnav">
+ <TopNavigation
+ identity={{
+ href: "#/",
+ logo: { src: cuaLockup, alt: "Cua" },
+ }}
+ utilities={[
+ {
+ type: "menu-dropdown",
+ text: user.name ?? user.email ?? "Account",
+ iconName: "user-profile",
+ items: [{ id: "signout", text: "Sign out" }],
+ onItemClick: e => {
+ if (e.detail.id === "signout") logout()
+ },
+ },
+ ]}
+ />
+ </div>
+ <AppLayout
+ headerSelector="#cua-shell-topnav"
+ ariaLabels={{
+ navigation: "Main navigation",
+ navigationClose: "Close navigation",
+ navigationToggle: "Open navigation",
+ }}
+ toolsHide
+ navigationOpen={navigationOpen}
+ onNavigationChange={({ detail }) => setNavigationOpen(detail.open)}
+ navigation={
+ <div className="cua-shell__nav">
+ <SideNavigation
+ header={mobile ? undefined : { href: "#/pools", text: "Cua" }}
+ activeHref={`#${location.pathname}`}
+ onFollow={e => {
+ if (!e.detail.external) {
+ e.preventDefault()
+ navigate(
+ localVisualPreviewPath(
+ e.detail.href.replace(/^#/, ""),
+ ),
+ )
+ }
+ }}
+ items={[
+ { type: "link", text: "Pools", href: "#/pools" },
+ ...(chat
+ ? [{ type: "link" as const, text: "Chat", href: "#/agent" }]
+ : []),
+ { type: "link", text: "User API keys", href: "#/user-keys" },
+ { type: "link", text: "Settings", href: "#/settings" },
+ ]}
+ />
+ </div>
+ }
+ notifications={
+ <Flashbar
items={[
- { type: "link", text: "Pools", href: "#/pools" },
- ...(chat ? [{ type: "link" as const, text: "Chat", href: "#/agent" }] : []),
- { type: "link", text: "User API keys", href: "#/user-keys" },
- { type: "link", text: "Settings", href: "#/settings" },
+ ...(stale && !staleDismissed
+ ? [
+ {
+ type: "info" as const,
+ header: "A new version is available",
+ content: "Refresh to get the latest features and fixes.",
+ action: (
+ <Button onClick={() => window.location.reload()}>
+ Refresh now
+ </Button>
+ ),
+ dismissible: true,
+ onDismiss: () => setStaleDismissed(true),
+ id: "__stale__",
+ },
+ ]
+ : []),
+ ...flashes,
]}
+ stackItems
/>
- </div>
- }
- notifications={
- <Flashbar
- items={[
- ...(stale && !staleDismissed
- ? [
- {
- type: "info" as const,
- header: "A new version is available",
- content: "Refresh to get the latest features and fixes.",
- action: (
- <Button onClick={() => window.location.reload()}>
- Refresh now
- </Button>
- ),
- dismissible: true,
- onDismiss: () => setStaleDismissed(true),
- id: "__stale__",
- },
- ]
- : []),
- ...flashes,
- ]}
- stackItems
- />
- }
- content={<Outlet />}
- contentType="default"
- />
+ }
+ content={<Outlet />}
+ contentType="default"
+ />
+ </div>
</FlashContext.Provider>
)
}
@@ -224,6 +279,12 @@ function RedirectModule() {
function ChatRoute() {
const { chat, resolved } = useFeatureFlags()
- if (!resolved) return null
+ if (!resolved) {
+ return (
+ <PageShell eyebrow="Agent" title="Chat">
+ <div className="agent-chat-page" />
+ </PageShell>
+ )
+ }
return chat ? <AgentChat /> : <Navigate to="/pools" replace />
}
diff --git a/libs/fleet/src/auth/AuthProvider.tsx b/libs/fleet/src/auth/AuthProvider.tsx
index ea1cb35944..f05b506cbf 100644
--- a/libs/fleet/src/auth/AuthProvider.tsx
+++ b/libs/fleet/src/auth/AuthProvider.tsx
@@ -5,16 +5,19 @@
import { useEffect, useState } from "react"
import { initKc } from "./keycloak"
+import { isLocalVisualPreview } from "../local-visual-preview"
interface Props {
children: React.ReactNode
}
export function AuthProvider({ children }: Props) {
- const [ready, setReady] = useState(false)
+ const visualPreview = isLocalVisualPreview()
+ const [ready, setReady] = useState(visualPreview)
const [error, setError] = useState<string | null>(null)
useEffect(() => {
+ if (visualPreview) return
initKc()
.then(authed => {
if (!authed) {
@@ -24,7 +27,7 @@ export function AuthProvider({ children }: Props) {
setReady(true)
})
.catch(e => setError(String(e)))
- }, [])
+ }, [visualPreview])
if (error) {
return (
diff --git a/libs/fleet/src/auth/keycloak.ts b/libs/fleet/src/auth/keycloak.ts
index 6c28ff41ce..1e897d5960 100644
--- a/libs/fleet/src/auth/keycloak.ts
+++ b/libs/fleet/src/auth/keycloak.ts
@@ -6,6 +6,11 @@
// image works across staging/prod/dev.
import Keycloak from "keycloak-js"
+import { isLocalVisualPreview } from "../local-visual-preview"
+import {
+ appLoginRedirectUri,
+ appLogoutRedirectUri,
+} from "./redirects"
declare global {
interface Window {
@@ -25,23 +30,51 @@ export const kc = new Keycloak({
clientId: cfg.kcClientId ?? "cyclops-cs-spa",
})
-let initialised = false
+let initialisation: Promise<boolean> | null = null
+let reauthentication: Promise<void> | null = null
-export async function initKc(): Promise<boolean> {
- if (initialised) return kc.authenticated ?? false
- initialised = true
- const authed = await kc.init({
- onLoad: "login-required",
- pkceMethod: "S256",
- checkLoginIframe: false,
- })
- // Refresh proactively when the token is about to expire — keycloak-js
- // fires onTokenExpired *after* expiry, which would race the next API
- // call. updateToken(30) refreshes if <30s remain.
- kc.onTokenExpired = () => {
- kc.updateToken(30).catch(() => kc.login())
- }
- return authed
+function currentHref(): string {
+ return window.location.href
+}
+
+function reauthenticate(): Promise<void> {
+ if (reauthentication) return reauthentication
+
+ kc.clearToken()
+ reauthentication = kc
+ .login({ redirectUri: appLoginRedirectUri(currentHref()) })
+ .catch(error => {
+ reauthentication = null
+ throw error
+ })
+ return reauthentication
+}
+
+export function initKc(): Promise<boolean> {
+ if (initialisation) return initialisation
+
+ initialisation = kc
+ .init({
+ onLoad: "login-required",
+ flow: "standard",
+ pkceMethod: "S256",
+ checkLoginIframe: false,
+ })
+ .then(authed => {
+ // Refresh proactively when the token is about to expire — keycloak-js
+ // fires onTokenExpired *after* expiry, which would race the next API
+ // call. updateToken(30) refreshes if <30s remain.
+ kc.onTokenExpired = () => {
+ kc.updateToken(30).catch(() => reauthenticate())
+ }
+ return authed
+ })
+ .catch(error => {
+ initialisation = null
+ throw error
+ })
+
+ return initialisation
}
// getToken returns a fresh access token, refreshing it if it's within
@@ -51,17 +84,20 @@ export async function getToken(): Promise<string | undefined> {
try {
await kc.updateToken(30)
} catch {
- kc.login()
+ await reauthenticate()
return undefined
}
return kc.token
}
-export function logout() {
- kc.logout()
+export function logout(): Promise<void> {
+ return kc.logout({ redirectUri: appLogoutRedirectUri(currentHref()) })
}
export function userInfo(): { sub?: string; email?: string; name?: string } {
+ if (isLocalVisualPreview()) {
+ return { sub: "local-preview", email: "[email protected]", name: "Preview" }
+ }
const t = kc.tokenParsed as Record<string, unknown> | undefined
if (!t) return {}
return {
diff --git a/libs/fleet/src/auth/redirects.ts b/libs/fleet/src/auth/redirects.ts
new file mode 100644
index 0000000000..7e98cf8891
--- /dev/null
+++ b/libs/fleet/src/auth/redirects.ts
@@ -0,0 +1,54 @@
+const oidcTerminalParameters = [
+ "code",
+ "error",
+] as const
+
+const oidcCallbackParameters = [
+ "code",
+ "error",
+ "error_description",
+ "error_uri",
+ "iss",
+ "session_state",
+ "state",
+] as const
+
+function removeOidcCallback(parameters: URLSearchParams): boolean {
+ const isCallback =
+ parameters.has("state") &&
+ oidcTerminalParameters.some(parameter => parameters.has(parameter))
+ if (!isCallback) return false
+
+ for (const parameter of oidcCallbackParameters) {
+ parameters.delete(parameter)
+ }
+ return true
+}
+
+/**
+ * Return a same-origin dashboard URL that is safe to use for a fresh login.
+ *
+ * Keycloak normally removes callback parameters after processing them. This
+ * extra cleanup prevents a failed refresh or rejected callback from sending a
+ * stale code/state pair through another authorization loop. Unrelated search
+ * parameters and fragments remain intact.
+ */
+export function appLoginRedirectUri(currentHref: string): string {
+ const current = new URL(currentHref)
+ removeOidcCallback(current.searchParams)
+
+ if (current.hash.length > 1) {
+ const hashParameters = new URLSearchParams(current.hash.slice(1))
+ if (removeOidcCallback(hashParameters)) {
+ const nextHash = hashParameters.toString()
+ current.hash = nextHash ? `#${nextHash}` : ""
+ }
+ }
+
+ return current.toString()
+}
+
+/** Sign out to a stable allowlisted Run entry point, never caller input. */
+export function appLogoutRedirectUri(currentHref: string): string {
+ return new URL("/", currentHref).toString()
+}
diff --git a/libs/fleet/src/components/CuaButton.tsx b/libs/fleet/src/components/CuaButton.tsx
new file mode 100644
index 0000000000..ef063a7a10
--- /dev/null
+++ b/libs/fleet/src/components/CuaButton.tsx
@@ -0,0 +1,22 @@
+import { forwardRef } from "react"
+import Button, {
+ type ButtonProps,
+} from "@cloudscape-design/components/button"
+
+export type CuaButtonProps = ButtonProps & {
+ tone?: "primary" | "secondary" | "icon" | "danger"
+}
+
+export const CuaButton = forwardRef<ButtonProps.Ref, CuaButtonProps>(
+ function CuaButton({ tone = "secondary", variant, ...props }, ref) {
+ return (
+ <span className={`cua-dashboard-button cua-dashboard-button--${tone}`}>
+ <Button
+ {...props}
+ ref={ref}
+ variant={variant ?? (tone === "primary" ? "primary" : "normal")}
+ />
+ </span>
+ )
+ },
+)
diff --git a/libs/fleet/src/components/FeatureFlagContext.tsx b/libs/fleet/src/components/FeatureFlagContext.tsx
index 4d9e86f973..d297abe487 100644
--- a/libs/fleet/src/components/FeatureFlagContext.tsx
+++ b/libs/fleet/src/components/FeatureFlagContext.tsx
@@ -1,5 +1,6 @@
import { createContext, useContext, useEffect, useState, type ReactNode } from "react"
import { fetchFeatureFlags, type FeatureFlags } from "../sdk/featureFlags"
+import { isLocalVisualPreview } from "../local-visual-preview"
const DEFAULT_FLAGS: FeatureFlags = { admin: false, billing: false, chat: false }
@@ -17,16 +18,20 @@ const FeatureFlagContext = createContext<FeatureFlagContextValue>({
* context. All children can call useFeatureFlags() to read flags.
*/
export function FeatureFlagProvider({ children }: { children: ReactNode }) {
+ const visualPreview = isLocalVisualPreview()
const [value, setValue] = useState<FeatureFlagContextValue>({
- ...DEFAULT_FLAGS,
- resolved: false,
+ ...(visualPreview
+ ? { ...DEFAULT_FLAGS, billing: true, chat: true }
+ : DEFAULT_FLAGS),
+ resolved: visualPreview,
})
useEffect(() => {
+ if (visualPreview) return
fetchFeatureFlags()
.then(flags => setValue({ ...flags, resolved: true }))
.catch(() => setValue({ ...DEFAULT_FLAGS, resolved: true }))
- }, [])
+ }, [visualPreview])
return (
<FeatureFlagContext.Provider value={value}>
diff --git a/libs/fleet/src/components/FlashContext.tsx b/libs/fleet/src/components/FlashContext.tsx
index 6f93f29e9d..20176db0e4 100644
--- a/libs/fleet/src/components/FlashContext.tsx
+++ b/libs/fleet/src/components/FlashContext.tsx
@@ -1,5 +1,5 @@
import { createContext, useContext } from "react"
-import { FlashbarProps } from "@cloudscape-design/components/flashbar"
+import type { FlashbarProps } from "@cloudscape-design/components/flashbar"
export type FlashMsg = Omit<
FlashbarProps.MessageDefinition,
diff --git a/libs/fleet/src/components/PageShell.tsx b/libs/fleet/src/components/PageShell.tsx
new file mode 100644
index 0000000000..47be0dc455
--- /dev/null
+++ b/libs/fleet/src/components/PageShell.tsx
@@ -0,0 +1,63 @@
+import type { ReactNode } from "react"
+import ContentLayout from "@cloudscape-design/components/content-layout"
+import Header from "@cloudscape-design/components/header"
+
+export interface PageShellProps {
+ eyebrow?: string
+ title: ReactNode
+ counter?: string
+ description?: ReactNode
+ actions?: ReactNode
+ secondaryActions?: ReactNode
+ primaryAction?: ReactNode
+ children: ReactNode
+}
+
+export function PageShell({
+ eyebrow,
+ title,
+ counter,
+ description,
+ actions,
+ secondaryActions,
+ primaryAction,
+ children,
+}: PageShellProps) {
+ return (
+ <ContentLayout
+ disableOverlap
+ header={
+ <div className="cua-pagehead">
+ {eyebrow ? <p className="cua-pagehead__eyebrow">{eyebrow}</p> : null}
+ <Header
+ variant="h1"
+ counter={counter}
+ description={description}
+ actions={(actions || secondaryActions || primaryAction) ? (
+ <div className="cua-pagehead__actions">
+ {actions ?? (
+ <>
+ {secondaryActions ? (
+ <div className="cua-pagehead__secondary-actions">
+ {secondaryActions}
+ </div>
+ ) : null}
+ {primaryAction ? (
+ <div className="cua-pagehead__primary-action">
+ {primaryAction}
+ </div>
+ ) : null}
+ </>
+ )}
+ </div>
+ ) : undefined}
+ >
+ <span className="cua-pagehead__title">{title}</span>
+ </Header>
+ </div>
+ }
+ >
+ <div className="cua-pagebody">{children}</div>
+ </ContentLayout>
+ )
+}
diff --git a/libs/fleet/src/components/PageState.tsx b/libs/fleet/src/components/PageState.tsx
new file mode 100644
index 0000000000..0f80182aa5
--- /dev/null
+++ b/libs/fleet/src/components/PageState.tsx
@@ -0,0 +1,40 @@
+import type { ReactNode } from "react"
+import Box from "@cloudscape-design/components/box"
+import SpaceBetween from "@cloudscape-design/components/space-between"
+
+interface PageStateProps {
+ title: ReactNode
+ children?: ReactNode
+ action?: ReactNode
+ role?: "status" | "alert"
+}
+
+function PageState({ title, children, action, role = "status" }: PageStateProps) {
+ return (
+ <Box textAlign="center" padding="m">
+ <div role={role}>
+ <SpaceBetween size="xs">
+ <Box variant="h3">{title}</Box>
+ {children ? (
+ <Box variant="p" color="text-body-secondary">
+ {children}
+ </Box>
+ ) : null}
+ {action}
+ </SpaceBetween>
+ </div>
+ </Box>
+ )
+}
+
+export type PageEmptyProps = Omit<PageStateProps, "role">
+
+export function PageEmpty(props: PageEmptyProps) {
+ return <PageState {...props} role="status" />
+}
+
+export type PageErrorProps = Omit<PageStateProps, "role">
+
+export function PageError(props: PageErrorProps) {
+ return <PageState {...props} role="alert" />
+}
diff --git a/libs/fleet/src/components/PoolStatus.tsx b/libs/fleet/src/components/PoolStatus.tsx
index b5e15b1a80..8d73f62c63 100644
--- a/libs/fleet/src/components/PoolStatus.tsx
+++ b/libs/fleet/src/components/PoolStatus.tsx
@@ -1,5 +1,5 @@
import StatusIndicator, {
- StatusIndicatorProps,
+ type StatusIndicatorProps,
} from "@cloudscape-design/components/status-indicator"
import type { PoolStatus } from "../sdk/status"
@@ -10,10 +10,20 @@ const POOL_STATUS_TYPE: Record<PoolStatus["kind"], StatusIndicatorProps.Type> =
unknown: "pending",
}
-export function PoolStatusPill({ status }: { status: PoolStatus }) {
+export function PoolStatusPill({
+ status,
+ compact = false,
+}: {
+ status: PoolStatus
+ compact?: boolean
+}) {
return (
- <StatusIndicator type={POOL_STATUS_TYPE[status.kind]}>
- {status.label}
- </StatusIndicator>
+ <span title={compact ? status.label : undefined}>
+ <StatusIndicator type={POOL_STATUS_TYPE[status.kind]}>
+ <span className={compact ? "cua-visually-hidden" : undefined}>
+ {status.label}
+ </span>
+ </StatusIndicator>
+ </span>
)
}
diff --git a/libs/fleet/src/error-message.ts b/libs/fleet/src/error-message.ts
new file mode 100644
index 0000000000..ad171e4e3d
--- /dev/null
+++ b/libs/fleet/src/error-message.ts
@@ -0,0 +1,10 @@
+export function errorMessage(error: unknown): string {
+ if (error instanceof Error && error.message) return error.message
+ if (typeof error === "string" && error) return error
+ if (error == null) return "Unknown error"
+ try {
+ return String(error)
+ } catch {
+ return "Unknown error"
+ }
+}
diff --git a/libs/fleet/src/local-visual-preview.ts b/libs/fleet/src/local-visual-preview.ts
new file mode 100644
index 0000000000..8594c1e5dc
--- /dev/null
+++ b/libs/fleet/src/local-visual-preview.ts
@@ -0,0 +1,209 @@
+import type { PoolData, PoolSummary } from "./sdk/models"
+import type {
+ ChatMessage,
+ Conversation,
+ ConversationSummary,
+} from "./sdk/chat"
+
+export function isLocalVisualPreview(): boolean {
+ const localPreview =
+ import.meta.env.DEV &&
+ import.meta.env.VITE_CUA_LOCAL_VISUAL_PREVIEW === "true"
+ const pullRequestPreview =
+ import.meta.env.VITE_CUA_REVIEW_VISUAL_PREVIEW === "true" &&
+ /^cyclops-cs-pr-\d+\.tail204509\.ts\.net$/.test(
+ window.location.hostname,
+ )
+ if (!localPreview && !pullRequestPreview) return false
+ return new URLSearchParams(window.location.search).has("cua-visual-preview")
+}
+
+export function localVisualPreviewPath(path: string): string {
+ if (!isLocalVisualPreview()) return path
+ return `${path}${path.includes("?") ? "&" : "?"}cua-visual-preview`
+}
+
+export const localVisualPreviewPools: PoolSummary[] = [
+ { name: "prod-web-fleet", namespace: "preview", replicas: 120, availableCount: 118, phase: "Ready" },
+ { name: "prod-api-fleet", namespace: "preview", replicas: 80, availableCount: 79, phase: "Ready" },
+ { name: "staging-web-fleet", namespace: "preview", replicas: 40, availableCount: 38, phase: "Ready" },
+ { name: "staging-api-fleet", namespace: "preview", replicas: 30, availableCount: 28, phase: "Scaling" },
+ { name: "dev-tools-fleet", namespace: "preview", replicas: 20, availableCount: 20, phase: "Ready" },
+ { name: "eval-runner-fleet", namespace: "preview", replicas: 16, availableCount: 14, phase: "Scaling" },
+ { name: "batch-jobs-fleet", namespace: "preview", replicas: 64, availableCount: 60, phase: "Degraded" },
+ { name: "canary-fleet", namespace: "preview", replicas: 8, availableCount: 8, phase: "Ready" },
+ { name: "infra-maint-fleet", namespace: "preview", replicas: 12, availableCount: 10, phase: "Degraded" },
+ { name: "data-pipeline-fleet", namespace: "preview", replicas: 24, availableCount: 22, phase: "Ready" },
+ { name: "browser-agent-fleet", namespace: "preview", replicas: 32, availableCount: 31, phase: "Ready" },
+ { name: "desktop-agent-fleet", namespace: "preview", replicas: 18, availableCount: 17, phase: "Ready" },
+]
+
+export async function listLocalVisualPreviewPools(): Promise<PoolSummary[]> {
+ const state = new URLSearchParams(window.location.search).get(
+ "cua-preview-state",
+ )
+ if (state === "loading") {
+ await new Promise(resolve => window.setTimeout(resolve, 2_000))
+ }
+ if (state === "empty") return []
+ if (state === "error") throw new Error("Synthetic preview error")
+ return localVisualPreviewPools
+}
+
+export function getLocalVisualPreviewPool(
+ namespace: string,
+ name: string,
+): PoolData | undefined {
+ const summary = localVisualPreviewPools.find(
+ pool => pool.namespace === namespace && pool.name === name,
+ )
+ if (!summary) return undefined
+
+ return {
+ ...summary,
+ cpu: 4,
+ ram: "8Gi",
+ ociImage: "ghcr.io/trycua/cua:latest",
+ firmware: "efi",
+ services: [
+ { name: "desktop", targetPort: 6901, protocol: "TCP" },
+ { name: "ssh", targetPort: 22, protocol: "TCP" },
+ ],
+ probes: {},
+ autoscaling: {
+ minPoolSize: Math.max(1, Math.floor(summary.replicas * 0.25)),
+ initialPoolSize: summary.replicas,
+ maxPoolSize: Math.ceil(summary.replicas * 1.5),
+ },
+ totalCount: summary.replicas,
+ claimedCount: Math.max(summary.replicas - summary.availableCount, 0),
+ }
+}
+
+const localVisualPreviewTimestamp = "2026-08-16T20:20:00.000Z"
+
+const localVisualPreviewConversations: Conversation[] = [
+ {
+ id: "preview-browser-task",
+ title: "Inspect the browser fleet",
+ created_at: localVisualPreviewTimestamp,
+ updated_at: localVisualPreviewTimestamp,
+ messages: [
+ {
+ id: "preview-message-1",
+ role: "user",
+ content: "Check the browser fleet and summarize its availability.",
+ created_at: localVisualPreviewTimestamp,
+ },
+ {
+ id: "preview-message-2",
+ role: "assistant",
+ content: "",
+ created_at: localVisualPreviewTimestamp,
+ tool_calls: [
+ {
+ id: "preview-tool-1",
+ type: "function",
+ function: {
+ name: "bash",
+ arguments: JSON.stringify({
+ command: "cua pools list --selector fleet=browser",
+ }),
+ },
+ },
+ ],
+ },
+ {
+ id: "preview-message-3",
+ role: "tool",
+ tool_call_id: "preview-tool-1",
+ content: JSON.stringify({
+ stdout: "browser-agent-fleet 31/32 available Ready",
+ stderr: "",
+ exit_code: 0,
+ timed_out: false,
+ truncated: false,
+ }),
+ created_at: localVisualPreviewTimestamp,
+ },
+ {
+ id: "preview-message-4",
+ role: "assistant",
+ content:
+ "The browser fleet is healthy: **31 of 32** workspaces are available. One workspace is currently being replenished.",
+ created_at: localVisualPreviewTimestamp,
+ },
+ ],
+ },
+ {
+ id: "preview-pool-task",
+ title: "Create a staging pool",
+ created_at: "2026-08-15T18:10:00.000Z",
+ updated_at: "2026-08-15T18:10:00.000Z",
+ messages: [],
+ },
+]
+
+export async function listLocalVisualPreviewConversations(): Promise<
+ ConversationSummary[]
+> {
+ const state = new URLSearchParams(window.location.search).get(
+ "cua-preview-state",
+ )
+ if (state === "loading") {
+ await new Promise(resolve => window.setTimeout(resolve, 2_000))
+ }
+ if (state === "empty") return []
+ return localVisualPreviewConversations.map(({ messages: _messages, ...summary }) => ({
+ ...summary,
+ }))
+}
+
+export function getLocalVisualPreviewConversation(
+ id: string,
+): Conversation | undefined {
+ return localVisualPreviewConversations.find(conversation => conversation.id === id)
+}
+
+export function createLocalVisualPreviewConversation(): Conversation {
+ const timestamp = new Date().toISOString()
+ const conversation: Conversation = {
+ id: `preview-conversation-${localVisualPreviewConversations.length + 1}`,
+ title: "New conversation",
+ created_at: timestamp,
+ updated_at: timestamp,
+ messages: [],
+ }
+ localVisualPreviewConversations.unshift(conversation)
+ return conversation
+}
+
+export async function streamLocalVisualPreviewTurn(
+ conversationId: string,
+ messages: ChatMessage[],
+ onDelta: (delta: string) => void,
+): Promise<ChatMessage> {
+ const conversation = getLocalVisualPreviewConversation(conversationId)
+ if (!conversation) throw new Error("Preview conversation not found")
+
+ const timestamp = new Date().toISOString()
+ const content =
+ "Preview mode is connected. In a signed-in environment, Cua would run this request against your available tools."
+ for (const message of messages) {
+ conversation.messages.push({
+ ...message,
+ id: message.id ?? `preview-message-${conversation.messages.length + 1}`,
+ created_at: message.created_at ?? timestamp,
+ })
+ }
+ onDelta(content)
+ const assistant: ChatMessage = {
+ id: `preview-message-${conversation.messages.length + 1}`,
+ role: "assistant",
+ content,
+ created_at: timestamp,
+ }
+ conversation.messages.push(assistant)
+ conversation.updated_at = timestamp
+ return assistant
+}
diff --git a/libs/fleet/src/main.tsx b/libs/fleet/src/main.tsx
index 07f9c6e074..0af9f9ca7f 100644
--- a/libs/fleet/src/main.tsx
+++ b/libs/fleet/src/main.tsx
@@ -1,12 +1,58 @@
import React from "react"
import ReactDOM from "react-dom/client"
+import "@cua/design/dashboard.css"
import "@cloudscape-design/global-styles/index.css"
import { applyMode, Mode } from "@cloudscape-design/global-styles"
+import { applyTheme } from "@cloudscape-design/components/theming"
+import urbanistFont from "@cua/design/assets/fonts/urbanist-normal-latin.woff2"
+import monoFont from "@cua/design/assets/fonts/jetbrains-mono-normal-latin.woff2"
+import 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)
+document.documentElement.classList.add("cua-dashboard-theme")
+document.body.id = "cua-dashboard-root"
+applyTheme({
+ theme: {
+ tokens: {
+ colorBackgroundLayoutMain: "#000000",
+ colorBackgroundLayoutToolbar: "#000000",
+ colorBackgroundContainerContent: "#181818",
+ colorBackgroundContainerHeader: "#181818",
+ colorBackgroundButtonPrimaryDefault: "#9fd7ff",
+ colorBackgroundButtonPrimaryHover: "#b7dcff",
+ colorBackgroundButtonPrimaryActive: "#ecf6ff",
+ colorBorderButtonPrimaryDefault: "#9fd7ff",
+ colorBorderButtonPrimaryHover: "#b7dcff",
+ colorBorderButtonPrimaryActive: "#ecf6ff",
+ colorTextButtonPrimaryDefault: "#000000",
+ colorTextButtonPrimaryHover: "#000000",
+ colorTextButtonPrimaryActive: "#000000",
+ colorTextBodyDefault: "#f6f8fb",
+ colorTextBodySecondary: "rgba(224, 230, 238, 0.84)",
+ colorTextHeadingDefault: "#f6f8fb",
+ colorTextHeadingSecondary: "rgba(224, 230, 238, 0.84)",
+ colorTextLinkDefault: "#9fd7ff",
+ colorTextLinkHover: "#ecf6ff",
+ colorBorderDividerDefault: "rgba(255, 255, 255, 0.12)",
+ colorBorderItemFocused: "#9fd7ff",
+ fontFamilyBase: '"Urbanist", -apple-system, BlinkMacSystemFont, sans-serif',
+ },
+ },
+})
+
+for (const href of [urbanistFont, monoFont, displayFont]) {
+ const link = document.createElement("link")
+ link.rel = "preload"
+ link.as = "font"
+ link.type = "font/woff2"
+ link.crossOrigin = "anonymous"
+ link.href = href
+ document.head.appendChild(link)
+}
const isDeviceAuthorization = window.location.pathname === "/device"
diff --git a/libs/fleet/src/pages/AgentChat.css b/libs/fleet/src/pages/AgentChat.css
index 18cd9be61e..161cb5bab3 100644
--- a/libs/fleet/src/pages/AgentChat.css
+++ b/libs/fleet/src/pages/AgentChat.css
@@ -2,12 +2,19 @@
display: grid;
gap: 24px;
grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
- height: calc(100vh - 160px);
+ height: calc(100dvh - var(--cua-chat-viewport-offset, 160px));
+ margin-block-end: calc(-1 * var(--cua-layout-application-inline));
min-height: 560px;
}
+@supports not (height: 100dvh) {
+ .agent-chat-page {
+ height: calc(100vh - var(--cua-chat-viewport-offset, 160px));
+ }
+}
+
.agent-chat-history {
- border-inline-end: 1px solid var(--color-border-divider-default, #d5dbdb);
+ border-inline-end: 1px solid var(--cua-color-line-soft);
min-width: 0;
overflow-y: auto;
padding-inline-end: 20px;
@@ -46,7 +53,7 @@
}
.agent-chat-composer {
- background: linear-gradient(180deg, transparent, var(--color-background-layout-main, #0f1b2a) 28%);
+ background: linear-gradient(180deg, transparent, var(--cua-dashboard-background) 28%);
bottom: 0;
padding: 24px 8px 12px;
position: sticky;
@@ -63,7 +70,7 @@
}
.agent-chat-timestamp {
- color: var(--color-text-body-secondary, #5f6b7a);
+ color: var(--cua-color-text-muted);
font-size: 0.75rem;
}
@@ -71,12 +78,12 @@
animation: agent-chat-shimmer 1.4s ease-in-out infinite;
background: linear-gradient(
90deg,
- var(--color-background-layout-toggle-default, #eaeded) 25%,
- var(--color-background-layout-toggle-hover, #f2f3f3) 50%,
- var(--color-background-layout-toggle-default, #eaeded) 75%
+ var(--cua-color-surface-elevated-1) 25%,
+ var(--cua-color-surface-elevated-2) 50%,
+ var(--cua-color-surface-elevated-1) 75%
);
background-size: 200% 100%;
- border-radius: 8px;
+ border-radius: var(--cua-radius-control);
}
.agent-chat-skeleton--conversation {
@@ -109,8 +116,12 @@
@media (max-width: 700px) {
.agent-chat-page {
display: block;
- height: calc(100vh - 120px);
- min-height: 480px;
+ min-height: 0;
+ }
+
+ .agent-chat-main {
+ grid-template-rows: auto minmax(0, 1fr) auto;
+ height: 100%;
}
.agent-chat-history {
@@ -142,7 +153,7 @@
.agent-chat-mobile-overlay {
align-items: stretch;
- background: rgb(0 0 0 / 45%);
+ background: var(--cua-color-scrim-overlay);
display: flex;
inset: 0;
position: fixed;
@@ -161,8 +172,8 @@
.agent-chat-mobile-drawer {
position: relative;
z-index: 1;
- background: var(--color-background-layout-main, #fff);
- box-shadow: 2px 0 12px rgb(0 0 0 / 25%);
+ background: var(--cua-color-surface-elevated-1);
+ box-shadow: var(--cua-shadow-medium);
max-width: min(360px, 92vw);
min-width: min(320px, 92vw);
overflow-y: auto;
@@ -175,7 +186,7 @@
}
.agent-chat-command {
- border-inline-start: 3px solid var(--color-border-status-info, #3184c2);
+ border-inline-start: 3px solid var(--cua-color-status-info);
margin-inline: 16px;
padding: 8px 12px;
}
@@ -226,8 +237,8 @@
}
.agent-chat-markdown blockquote {
- border-inline-start: 3px solid var(--color-border-divider-default, #5f6b7a);
- color: var(--color-text-body-secondary, #8d99a8);
+ border-inline-start: 3px solid var(--cua-color-line-strong);
+ color: var(--cua-color-text-muted);
padding-inline-start: 0.75rem;
}
@@ -238,28 +249,28 @@
.agent-chat-markdown th,
.agent-chat-markdown td {
- border: 1px solid var(--color-border-divider-default, #5f6b7a);
+ border: 1px solid var(--cua-color-line-soft);
padding: 0.4rem 0.6rem;
text-align: start;
vertical-align: top;
}
.agent-chat-markdown th {
- background: var(--color-background-container-header, rgb(255 255 255 / 6%));
+ background: var(--cua-color-surface-elevated-2);
font-weight: 700;
}
.agent-chat-markdown code {
- background: var(--color-background-layout-toggle-default, rgb(255 255 255 / 8%));
+ background: var(--cua-color-surface-elevated-1);
border-radius: 4px;
- font-family: "Fira Code", "Cascadia Code", monospace;
+ font-family: var(--cua-font-mono);
font-size: 0.875em;
padding: 0.12em 0.3em;
}
.agent-chat-markdown pre {
- background: var(--color-background-layout-main, #0f1b2a);
- border: 1px solid var(--color-border-divider-default, #5f6b7a);
+ background: var(--cua-color-surface-base);
+ border: 1px solid var(--cua-color-line-soft);
border-radius: 8px;
max-width: 100%;
overflow-x: auto;
@@ -272,7 +283,7 @@
}
.agent-chat-markdown a {
- color: var(--color-text-link-default, #539fe5);
+ color: var(--cua-color-brand-primary);
text-decoration: underline;
text-underline-offset: 0.15em;
}
diff --git a/libs/fleet/src/pages/AgentChat.tsx b/libs/fleet/src/pages/AgentChat.tsx
index 10e2812076..dd1d4756f7 100644
--- a/libs/fleet/src/pages/AgentChat.tsx
+++ b/libs/fleet/src/pages/AgentChat.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useRef, useState } from "react"
+import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"
import { createPortal } from "react-dom"
import Avatar from "@cloudscape-design/chat-components/avatar"
import ChatBubble from "@cloudscape-design/chat-components/chat-bubble"
@@ -14,6 +14,7 @@ import PromptInput from "@cloudscape-design/components/prompt-input"
import SpaceBetween from "@cloudscape-design/components/space-between"
import StatusIndicator from "@cloudscape-design/components/status-indicator"
import { MarkdownMessage } from "../components/MarkdownMessage"
+import { PageShell } from "../components/PageShell"
import { createClaim, deleteClaim, getClaim, listClaims } from "../sdk/claims"
import { createPool, deletePool, getPool, listNamespaces, listPools, updatePoolServices } from "../sdk/pools"
import { createUserKey, deleteUserKey, listUserKeys } from "../sdk/userKeys"
@@ -206,7 +207,7 @@ function MessageBubble({ message, position, loading = false }: { message: ChatMe
const author = incoming ? "Assistant" : "You"
const time = formatTime(message.created_at)
return (
- <ChatBubble ariaLabel={`${author} at ${time.full}, message ${position}`} avatar={incoming ? <Avatar ariaLabel="Assistant avatar" color="gen-ai" iconName="gen-ai" loading={loading} /> : <Avatar ariaLabel="Your avatar" initials="You" />} type={incoming ? "incoming" : "outgoing"}>
+ <ChatBubble ariaLabel={`${author} at ${time.full}, message ${position}`} avatar={incoming ? <Avatar ariaLabel="Assistant avatar" color="gen-ai" iconName="gen-ai" loading={loading} /> : <Avatar ariaLabel="Your avatar" initials="Y" />} type={incoming ? "incoming" : "outgoing"}>
<SpaceBetween size="xxs">
{loading && !message.content ? <div>Generating a response</div> : <MarkdownMessage content={message.content} />}
{!loading && <span className="agent-chat-timestamp" title={time.full}>{author} - {time.local}</span>}
@@ -258,6 +259,7 @@ export function AgentChat() {
const [refreshError, setRefreshError] = useState<string>()
const [initialCreatePrompt, setInitialCreatePrompt] = useState<string>()
const mobileHistory = useMobileHistory()
+ const pageRef = useRef<HTMLDivElement>(null)
const triggerRef = useRef<ButtonProps.Ref>(null)
const closeButtonRef = useRef<ButtonProps.Ref>(null)
const dialogRef = useRef<HTMLDivElement>(null)
@@ -273,6 +275,28 @@ export function AgentChat() {
const selectedConversationIdRef = useRef<string>()
const loadingRunIdRef = useRef<number>()
+ useLayoutEffect(() => {
+ const element = pageRef.current
+ if (!element) return
+
+ const measure = () => {
+ const box = element.getBoundingClientRect()
+ const top = Math.max(0, Math.round(box.top))
+ element.style.setProperty(
+ "--cua-chat-viewport-offset",
+ `${top + 16}px`,
+ )
+ }
+ measure()
+ const observer = new ResizeObserver(measure)
+ observer.observe(document.documentElement)
+ window.addEventListener("resize", measure)
+ return () => {
+ observer.disconnect()
+ window.removeEventListener("resize", measure)
+ }
+ }, [])
+
if (!agentRef.current) {
agentRef.current = new BrowserBashAgent(async (conversationID, messages, signal, onDelta) => {
const message = await streamTurn(conversationID, messages, onDelta ?? (() => undefined), signal)
@@ -542,9 +566,20 @@ export function AgentChat() {
? `Latest ${effectiveMessage.role === "user" ? "user" : "assistant"} message available.`
: ""
const drawerHistory = <ConversationHistory conversations={conversations} disabled={running} loading={listLoading} onSelect={id => { if (selectConversation(id)) closeHistory() }} showHeading={false} />
+ const firstConversation = !listLoading && conversations.length === 0
return (
- <div className="agent-chat-page">
+ <>
+ <PageShell
+ eyebrow="Agent"
+ title="Chat"
+ description={
+ mobileHistory
+ ? undefined
+ : "Run fleet and browser tasks with the Cua agent."
+ }
+ >
+ <div className="agent-chat-page" ref={pageRef}>
<aside className="agent-chat-history"><ConversationHistory conversations={conversations} disabled={running} loading={listLoading} onSelect={selectConversation} /></aside>
<div className="agent-chat-main">
<div className="agent-chat-mobile-history"><Button ariaLabel="View conversations" iconName="menu" onClick={() => setHistoryOpen(true)} ref={triggerRef}>Conversations</Button></div>
@@ -555,7 +590,7 @@ export function AgentChat() {
{liveAssistant && <MessageBubble loading={abortable} message={liveAssistant} position={transcript.length + 1} />}
{!liveAssistant && assistantLoading && <MessageBubble loading message={{ role: "assistant", content: "", created_at: new Date().toISOString() }} position={transcript.length + 1} />}
</SpaceBetween>
- ) : <div className="agent-chat-empty"><Box variant="h2">Select a conversation</Box><Box color="text-body-secondary">Choose a previous conversation to view its transcript.</Box></div>}
+ ) : <div className="agent-chat-empty"><Box variant="h2">{firstConversation ? "Start a conversation" : "Select a conversation"}</Box><Box color="text-body-secondary">{firstConversation ? "Ask a question below to create your first conversation." : "Choose a previous conversation to view its transcript."}</Box></div>}
{turnError && <div role="alert"><Alert action={<Button onClick={initialCreatePrompt ? retryInitialCreate : retryTurn}>Retry</Button>} type="error">{turnError}</Alert></div>}
{refreshError && <div role="alert"><Alert action={<Button disabled={running} onClick={() => { if (selectedId) void recoverRefresh(selectedId) }}>Refresh conversation</Button>} type="error">{refreshError}</Alert></div>}
<div className="agent-chat-announcements">
@@ -570,12 +605,14 @@ export function AgentChat() {
</div>
</div>
</div>
+ </div>
+ </PageShell>
{mobileHistory && historyOpen && createPortal(
<div aria-label="Conversations" aria-modal="true" className="agent-chat-mobile-overlay" onKeyDown={trapDialogFocus} ref={dialogRef} role="dialog">
<div aria-hidden="true" className="agent-chat-mobile-backdrop" data-testid="conversation-history-backdrop" onClick={closeHistory} />
<div className="agent-chat-mobile-drawer"><Drawer header={<h2>Conversations</h2>} headerActions={<Button ariaLabel="Close conversations" iconName="close" onClick={closeHistory} ref={closeButtonRef} variant="icon" />}>{drawerHistory}</Drawer></div>
</div>, document.body,
)}
- </div>
+ </>
)
}
diff --git a/libs/fleet/src/pages/Billing.tsx b/libs/fleet/src/pages/Billing.tsx
index 9653f4af89..799a9ac1da 100644
--- a/libs/fleet/src/pages/Billing.tsx
+++ b/libs/fleet/src/pages/Billing.tsx
@@ -3,12 +3,12 @@
import Alert from "@cloudscape-design/components/alert";
import Box from "@cloudscape-design/components/box";
-import Button from "@cloudscape-design/components/button";
import Container from "@cloudscape-design/components/container";
import Header from "@cloudscape-design/components/header";
import SpaceBetween from "@cloudscape-design/components/space-between";
import Spinner from "@cloudscape-design/components/spinner";
import { useEffect, useState } from "react";
+import { CuaButton } from "../components/CuaButton";
import { billingApi, type BillingSummary } from "../sdk/billing";
function cardBrand(brand: string) {
@@ -61,8 +61,8 @@ export function BillingSettings() {
}
footer={
summary && (
- <Button
- variant="primary"
+ <CuaButton
+ tone="primary"
loading={redirecting}
onClick={() =>
redirect(summary.payment_method_present ? "portal" : "setup")
@@ -71,7 +71,7 @@ export function BillingSettings() {
{summary.payment_method_present
? "Manage payment method"
: "Add payment method"}
- </Button>
+ </CuaButton>
)
}
>
diff --git a/libs/fleet/src/pages/ClaimDetail.tsx b/libs/fleet/src/pages/ClaimDetail.tsx
index 4083fec801..da5cd44c3d 100644
--- a/libs/fleet/src/pages/ClaimDetail.tsx
+++ b/libs/fleet/src/pages/ClaimDetail.tsx
@@ -1,20 +1,21 @@
import { useEffect, useState } from "react"
import { useNavigate, useParams } from "react-router-dom"
import Box from "@cloudscape-design/components/box"
-import Button from "@cloudscape-design/components/button"
import ColumnLayout from "@cloudscape-design/components/column-layout"
import Container from "@cloudscape-design/components/container"
import Header from "@cloudscape-design/components/header"
import Link from "@cloudscape-design/components/link"
import Modal from "@cloudscape-design/components/modal"
import SpaceBetween from "@cloudscape-design/components/space-between"
-import Spinner from "@cloudscape-design/components/spinner"
import StatusIndicator from "@cloudscape-design/components/status-indicator"
import { useFlash } from "../components/FlashContext"
import { DesktopPane } from "../components/DesktopPane"
import { deleteClaim, getClaim } from "../sdk/claims"
import type { Claim } from "../sdk/models"
import { getPool } from "../sdk/pools"
+import { CuaButton } from "../components/CuaButton"
+import { PageEmpty, PageError } from "../components/PageState"
+import { PageShell } from "../components/PageShell"
function phaseType(phase: string): "success" | "pending" | "error" | "info" {
switch (phase) {
@@ -39,9 +40,11 @@ export function ClaimDetail() {
const [loading, setLoading] = useState(true)
const [confirmRelease, setConfirmRelease] = useState(false)
const [releasing, setReleasing] = useState(false)
+ const [loadError, setLoadError] = useState<string | null>(null)
const load = async () => {
setLoading(true)
+ setLoadError(null)
try {
const [claimData, poolData] = await Promise.all([
getClaim(namespace, claimName),
@@ -50,10 +53,12 @@ export function ClaimDetail() {
setClaim(claimData)
setServices(poolData.services)
} catch (e) {
+ const message = String((e as Error).message)
+ setLoadError(message)
flash.push({
type: "error",
header: "Failed to load claim",
- content: String((e as Error).message),
+ content: message,
})
} finally {
setLoading(false)
@@ -99,40 +104,55 @@ export function ClaimDetail() {
if (loading && !claim) {
return (
- <Container header={<Header variant="h1">{claimName}</Header>}>
- <Box textAlign="center" padding="l">
- <Spinner /> Loading claim…
- </Box>
- </Container>
+ <PageShell eyebrow="Fleet / Claim" title={claimName || "Claim"}>
+ <PageEmpty title="Loading claim…" />
+ </PageShell>
+ )
+ }
+ if (!claim) {
+ return (
+ <PageShell eyebrow="Fleet / Claim" title={claimName || "Claim"}>
+ <PageError
+ title="Claim unavailable"
+ action={<CuaButton onClick={load}>Try again</CuaButton>}
+ >
+ {loadError}
+ </PageError>
+ </PageShell>
)
}
- if (!claim) return null
const sandboxName = claim.sandboxName
const isBound = claim.phase === "Bound" && sandboxName
return (
- <SpaceBetween size="l">
- <Container
- header={
- <Header
- variant="h1"
- actions={
- <SpaceBetween direction="horizontal" size="xs">
- <Button iconName="refresh" onClick={load} />
- <Button onClick={() => navigate(`/pools/${namespace}/${poolName}`)}>
- Back to pool
- </Button>
- <Button onClick={() => setConfirmRelease(true)}>
- Release
- </Button>
- </SpaceBetween>
- }
- >
- {claimName}
- </Header>
- }
- >
+ <PageShell
+ eyebrow="Fleet / Claim"
+ title={claimName}
+ description={
+ <StatusIndicator type={phaseType(claim.phase)}>
+ {claim.phase}
+ </StatusIndicator>
+ }
+ secondaryActions={
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton
+ tone="icon"
+ ariaLabel="Refresh claim"
+ iconName="refresh"
+ onClick={load}
+ />
+ <CuaButton onClick={() => navigate(`/pools/${namespace}/${poolName}`)}>
+ Back to pool
+ </CuaButton>
+ <CuaButton onClick={() => setConfirmRelease(true)}>
+ Release
+ </CuaButton>
+ </SpaceBetween>
+ }
+ >
+ <SpaceBetween size="l">
+ <Container header={<Header variant="h2">Overview</Header>}>
<ColumnLayout columns={2} variant="text-grid">
<div>
<Box variant="awsui-key-label">Status</Box>
@@ -225,12 +245,12 @@ export function ClaimDetail() {
footer={
<Box float="right">
<SpaceBetween direction="horizontal" size="xs">
- <Button onClick={() => setConfirmRelease(false)} disabled={releasing}>
+ <CuaButton onClick={() => setConfirmRelease(false)} disabled={releasing}>
Cancel
- </Button>
- <Button variant="primary" onClick={release} loading={releasing}>
+ </CuaButton>
+ <CuaButton tone="danger" onClick={release} loading={releasing}>
Release
- </Button>
+ </CuaButton>
</SpaceBetween>
</Box>
}
@@ -238,6 +258,7 @@ export function ClaimDetail() {
This will delete the claim and return its sandbox VM back to the warm pool.
The VM will be restarted with a clean state.
</Modal>
- </SpaceBetween>
+ </SpaceBetween>
+ </PageShell>
)
}
diff --git a/libs/fleet/src/pages/PoolDetail.tsx b/libs/fleet/src/pages/PoolDetail.tsx
index 3324039b36..2c45dd22a7 100644
--- a/libs/fleet/src/pages/PoolDetail.tsx
+++ b/libs/fleet/src/pages/PoolDetail.tsx
@@ -10,7 +10,6 @@ import Link from "@cloudscape-design/components/link"
import Modal from "@cloudscape-design/components/modal"
import Select from "@cloudscape-design/components/select"
import SpaceBetween from "@cloudscape-design/components/space-between"
-import Spinner from "@cloudscape-design/components/spinner"
import StatusIndicator from "@cloudscape-design/components/status-indicator"
import Table from "@cloudscape-design/components/table"
import Tabs from "@cloudscape-design/components/tabs"
@@ -20,6 +19,9 @@ import { createClaim as createSdkClaim, deleteClaim, listClaims } from "../sdk/c
import type { Claim, PoolData } from "../sdk/models"
import { deletePool, getPool, updatePoolServices } from "../sdk/pools"
import { derivePoolStatus, tombstonePool } from "../sdk/status"
+import { CuaButton } from "../components/CuaButton"
+import { PageEmpty, PageError } from "../components/PageState"
+import { PageShell } from "../components/PageShell"
export function PoolDetail() {
const { namespace = "", name = "" } = useParams()
@@ -30,17 +32,21 @@ export function PoolDetail() {
const [loading, setLoading] = useState(true)
const [confirmingDelete, setConfirmingDelete] = useState(false)
const [deleting, setDeleting] = useState(false)
+ const [loadError, setLoadError] = useState<string | null>(null)
const load = async () => {
setLoading(true)
+ setLoadError(null)
try {
const p = await getPool(namespace, name)
setPool(p)
} catch (e) {
+ const message = String((e as Error).message)
+ setLoadError(message)
flash.push({
type: "error",
header: `Failed to load pool "${name}"`,
- content: String((e as Error).message),
+ content: message,
})
} finally {
setLoading(false)
@@ -70,43 +76,54 @@ export function PoolDetail() {
if (loading && !pool) {
return (
- <Container header={<Header variant="h1">{name}</Header>}>
- <Box textAlign="center" padding="l">
- <Spinner /> Loading pool…
- </Box>
- </Container>
+ <PageShell eyebrow="Fleet / Pool" title={name || "Pool"}>
+ <PageEmpty title="Loading pool…" />
+ </PageShell>
+ )
+ }
+ if (!pool) {
+ return (
+ <PageShell eyebrow="Fleet / Pool" title={name || "Pool"}>
+ <PageError
+ title="Pool unavailable"
+ action={<CuaButton onClick={load}>Try again</CuaButton>}
+ >
+ {loadError}
+ </PageError>
+ </PageShell>
)
}
- if (!pool) return null
const status = derivePoolStatus(pool)
return (
- <SpaceBetween size="l">
- <Container
- header={
- <Header
- variant="h1"
- actions={
- <SpaceBetween direction="horizontal" size="xs">
- <Button iconName="refresh" onClick={load} />
- <Button
- onClick={() =>
- pool && navigate("/pools/new", { state: { source: pool } })
- }
- >
- Duplicate
- </Button>
- <Button onClick={() => setConfirmingDelete(true)}>
- Delete
- </Button>
- </SpaceBetween>
+ <PageShell
+ eyebrow="Fleet / Pool"
+ title={pool.name}
+ description={<PoolStatusPill status={status} />}
+ secondaryActions={
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton
+ tone="icon"
+ ariaLabel="Refresh pool"
+ iconName="refresh"
+ onClick={load}
+ />
+ <CuaButton
+ onClick={() =>
+ navigate("/pools/new", { state: { source: pool } })
}
>
- {pool.name}
- </Header>
- }
- >
+ Duplicate
+ </CuaButton>
+ <CuaButton onClick={() => setConfirmingDelete(true)}>
+ Delete
+ </CuaButton>
+ </SpaceBetween>
+ }
+ >
+ <SpaceBetween size="l">
+ <Container header={<Header variant="h2">Overview</Header>}>
<ColumnLayout columns={2} variant="text-grid">
<div>
<Box variant="awsui-key-label">Status</Box>
@@ -141,12 +158,12 @@ export function PoolDetail() {
footer={
<Box float="right">
<SpaceBetween direction="horizontal" size="xs">
- <Button onClick={() => setConfirmingDelete(false)}>
+ <CuaButton onClick={() => setConfirmingDelete(false)}>
Cancel
- </Button>
- <Button variant="primary" onClick={remove} loading={deleting}>
+ </CuaButton>
+ <CuaButton tone="danger" onClick={remove} loading={deleting}>
Delete
- </Button>
+ </CuaButton>
</SpaceBetween>
</Box>
}
@@ -155,7 +172,8 @@ export function PoolDetail() {
in <b>{pool.namespace}</b>.
</Modal>
- </SpaceBetween>
+ </SpaceBetween>
+ </PageShell>
)
}
@@ -334,12 +352,12 @@ function ServicesEditor({
variant="h2"
actions={
<SpaceBetween direction="horizontal" size="xs">
- <Button iconName="add-plus" onClick={addRow}>
+ <CuaButton iconName="add-plus" onClick={addRow}>
Add service
- </Button>
- <Button variant="primary" loading={saving} onClick={save}>
+ </CuaButton>
+ <CuaButton tone="primary" loading={saving} onClick={save}>
Save
- </Button>
+ </CuaButton>
</SpaceBetween>
}
>
@@ -375,7 +393,12 @@ function ServicesEditor({
}
options={PROTOCOL_OPTIONS}
/>
- <Button iconName="remove" variant="icon" onClick={() => removeRow(row.id)} />
+ <CuaButton
+ tone="icon"
+ ariaLabel={`Remove service ${row.name || "row"}`}
+ iconName="remove"
+ onClick={() => removeRow(row.id)}
+ />
</ColumnLayout>
))}
</SpaceBetween>
@@ -493,10 +516,15 @@ function ClaimsTable({ pool }: { pool: PoolData }) {
counter={`(${claims.length})`}
actions={
<SpaceBetween direction="horizontal" size="xs">
- <Button iconName="refresh" onClick={loadClaims} />
- <Button variant="primary" onClick={() => setShowCreate(true)}>
+ <CuaButton
+ tone="icon"
+ ariaLabel="Refresh claims"
+ iconName="refresh"
+ onClick={loadClaims}
+ />
+ <CuaButton tone="primary" onClick={() => setShowCreate(true)}>
Create claim
- </Button>
+ </CuaButton>
</SpaceBetween>
}
>
@@ -568,19 +596,19 @@ function ClaimsTable({ pool }: { pool: PoolData }) {
footer={
<Box float="right">
<SpaceBetween direction="horizontal" size="xs">
- <Button
+ <CuaButton
onClick={() => setShowCreate(false)}
disabled={creating}
>
Cancel
- </Button>
- <Button
- variant="primary"
+ </CuaButton>
+ <CuaButton
+ tone="primary"
onClick={createClaim}
loading={creating}
>
Create
- </Button>
+ </CuaButton>
</SpaceBetween>
</Box>
}
@@ -605,19 +633,19 @@ function ClaimsTable({ pool }: { pool: PoolData }) {
footer={
<Box float="right">
<SpaceBetween direction="horizontal" size="xs">
- <Button
+ <CuaButton
onClick={() => setConfirmRelease(null)}
disabled={releasing}
>
Cancel
- </Button>
- <Button
- variant="primary"
+ </CuaButton>
+ <CuaButton
+ tone="danger"
onClick={() => confirmRelease && releaseClaim(confirmRelease)}
loading={releasing}
>
Release
- </Button>
+ </CuaButton>
</SpaceBetween>
</Box>
}
diff --git a/libs/fleet/src/pages/PoolNew.tsx b/libs/fleet/src/pages/PoolNew.tsx
index cd57d8390f..ad2a63e193 100644
--- a/libs/fleet/src/pages/PoolNew.tsx
+++ b/libs/fleet/src/pages/PoolNew.tsx
@@ -1,19 +1,21 @@
-import { useMemo, useState } from "react"
-import { useLocation, useNavigate } from "react-router-dom"
+import { useMemo, useRef, useState } from "react"
+import { useBeforeUnload, useLocation, useNavigate } from "react-router-dom"
import Box from "@cloudscape-design/components/box"
-import Button from "@cloudscape-design/components/button"
import ColumnLayout from "@cloudscape-design/components/column-layout"
import Container from "@cloudscape-design/components/container"
import Form from "@cloudscape-design/components/form"
import FormField from "@cloudscape-design/components/form-field"
import Header from "@cloudscape-design/components/header"
-import Input from "@cloudscape-design/components/input"
+import Input, { type InputProps } from "@cloudscape-design/components/input"
+import Modal from "@cloudscape-design/components/modal"
import Select from "@cloudscape-design/components/select"
import SpaceBetween from "@cloudscape-design/components/space-between"
import Toggle from "@cloudscape-design/components/toggle"
import { useFlash } from "../components/FlashContext"
import { createPool } from "../sdk/pools"
import type { PoolTemplateConfig } from "../sdk/models"
+import { CuaButton } from "../components/CuaButton"
+import { PageShell } from "../components/PageShell"
const NAME_PATTERN = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/
@@ -106,16 +108,26 @@ export function PoolNew() {
const [initialPoolSize, setInitialPoolSize] = useState(String(seed.autoscaling?.initialPoolSize ?? 0))
const [maxPoolSize, setMaxPoolSize] = useState(String(seed.autoscaling?.maxPoolSize ?? 20))
const [submitting, setSubmitting] = useState(false)
+ const [dirty, setDirty] = useState(false)
+ const [submitAttempted, setSubmitAttempted] = useState(false)
+ const [discardOpen, setDiscardOpen] = useState(false)
+ const nameRef = useRef<InputProps.Ref>(null)
+
+ useBeforeUnload(event => {
+ if (!dirty || submitting) return
+ event.preventDefault()
+ })
const nameError = useMemo(() => {
- if (!name) return undefined
+ if (!name) return submitAttempted ? "Name is required." : undefined
if (!NAME_PATTERN.test(name)) {
return "Lowercase letters, digits, and dashes only; no leading/trailing dash."
}
return undefined
- }, [name])
+ }, [name, submitAttempted])
const addService = () => {
+ setDirty(true)
setServices(prev => [...prev, { id: genId(), name: "", targetPort: "", protocol: "TCP" }])
}
@@ -124,6 +136,7 @@ export function PoolNew() {
}
const removeService = (id: string) => {
+ setDirty(true)
setServices(prev => prev.filter(s => s.id !== id))
}
@@ -165,11 +178,16 @@ export function PoolNew() {
}
const create = async () => {
- if (!name || nameError) return
+ setSubmitAttempted(true)
+ if (!name || nameError) {
+ nameRef.current?.focus()
+ return
+ }
setSubmitting(true)
try {
await createPool(name, buildValues())
flash.push({ type: "success", header: `Created pool ${name}` })
+ setDirty(false)
// Pool name = namespace name (1:1 mapping).
navigate(`/pools/${name}/${name}`)
} catch (e) {
@@ -183,38 +201,30 @@ export function PoolNew() {
}
}
- const submitDisabled = !name || !!nameError || submitting
+ const cancel = () => {
+ if (dirty) setDiscardOpen(true)
+ else navigate("/pools")
+ }
return (
- <Container
- header={
- <Header
- variant="h1"
- description={
- source
- ? `Duplicating "${source.name}". Edit and save as a new pool.`
- : "Create a new pool."
- }
- >
- {source ? "Duplicate pool" : "New pool"}
- </Header>
+ <PageShell
+ eyebrow="Fleet / Pool"
+ title={source ? "Duplicate pool" : "New pool"}
+ description={
+ source
+ ? `Duplicating "${source.name}". Edit and save as a new pool.`
+ : "Create a new pool."
+ }
+ secondaryActions={<CuaButton onClick={cancel}>Cancel</CuaButton>}
+ primaryAction={
+ <CuaButton tone="primary" loading={submitting} onClick={create}>
+ Create
+ </CuaButton>
}
>
- <Form
- actions={
- <SpaceBetween direction="horizontal" size="xs">
- <Button onClick={() => navigate("/pools")}>Cancel</Button>
- <Button
- variant="primary"
- loading={submitting}
- disabled={submitDisabled}
- onClick={create}
- >
- Create
- </Button>
- </SpaceBetween>
- }
- >
+ <Container header={<Header variant="h2">Configuration</Header>}>
+ <div onChangeCapture={() => setDirty(true)}>
+ <Form>
<SpaceBetween size="l">
<FormField
label="Name"
@@ -226,6 +236,7 @@ export function PoolNew() {
errorText={nameError}
>
<Input
+ ref={nameRef}
value={name}
onChange={({ detail }) => setName(detail.value)}
placeholder="my-pool"
@@ -373,19 +384,51 @@ export function PoolNew() {
onChange={({ detail }) => updateService(svc.id, "protocol", detail.selectedOption.value ?? "TCP")}
options={PROTOCOL_OPTIONS}
/>
- <Button iconName="remove" variant="icon" onClick={() => removeService(svc.id)} />
+ <CuaButton
+ tone="icon"
+ ariaLabel={`Remove service ${svc.name || "row"}`}
+ iconName="remove"
+ onClick={() => removeService(svc.id)}
+ />
</ColumnLayout>
))}
{services.length === 0 && (
<Box color="text-status-inactive">No services defined.</Box>
)}
- <Button iconName="add-plus" onClick={addService}>
+ <CuaButton iconName="add-plus" onClick={addService}>
Add service
- </Button>
+ </CuaButton>
</SpaceBetween>
</FormField>
</SpaceBetween>
</Form>
- </Container>
+ </div>
+ </Container>
+ <Modal
+ visible={discardOpen}
+ onDismiss={() => setDiscardOpen(false)}
+ header="Discard changes?"
+ footer={
+ <Box float="right">
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton onClick={() => setDiscardOpen(false)}>
+ Keep editing
+ </CuaButton>
+ <CuaButton
+ tone="danger"
+ onClick={() => {
+ setDirty(false)
+ navigate("/pools")
+ }}
+ >
+ Discard
+ </CuaButton>
+ </SpaceBetween>
+ </Box>
+ }
+ >
+ Your unsaved pool configuration will be lost.
+ </Modal>
+ </PageShell>
)
}
diff --git a/libs/fleet/src/pages/PoolsList.tsx b/libs/fleet/src/pages/PoolsList.tsx
index 77e97bf46f..ba7d58acf2 100644
--- a/libs/fleet/src/pages/PoolsList.tsx
+++ b/libs/fleet/src/pages/PoolsList.tsx
@@ -2,14 +2,15 @@ import { useEffect, useState } from "react"
import { useNavigate } from "react-router-dom"
import { useCollection } from "@cloudscape-design/collection-hooks"
import Box from "@cloudscape-design/components/box"
-import Button from "@cloudscape-design/components/button"
-import Header from "@cloudscape-design/components/header"
import Link from "@cloudscape-design/components/link"
+import Modal from "@cloudscape-design/components/modal"
+import designTokens from "@cua/design/tokens.json"
import Pagination from "@cloudscape-design/components/pagination"
import PropertyFilter from "@cloudscape-design/components/property-filter"
import SpaceBetween from "@cloudscape-design/components/space-between"
import Table from "@cloudscape-design/components/table"
import { deletePool, getPool, listPools } from "../sdk/pools"
+import { localVisualPreviewPath } from "../local-visual-preview"
import {
derivePoolStatus,
reconcileTombstones,
@@ -17,6 +18,9 @@ import {
} from "../sdk/status"
import { PoolStatusPill } from "../components/PoolStatus"
import { useFlash } from "../components/FlashContext"
+import { CuaButton } from "../components/CuaButton"
+import { PageEmpty } from "../components/PageState"
+import { PageShell } from "../components/PageShell"
interface PoolRow {
name: string
@@ -35,6 +39,21 @@ export function PoolsList() {
const [selected, setSelected] = useState<PoolRow[]>([])
const [busy, setBusy] = useState(false)
const [duplicating, setDuplicating] = useState(false)
+ const [confirmDeleteOpen, setConfirmDeleteOpen] = useState(false)
+ const [compactTable, setCompactTable] = useState(
+ () => window.matchMedia(
+ `(max-width: ${designTokens.layout.breakpoint.mobile - 1}px)`,
+ ).matches,
+ )
+
+ useEffect(() => {
+ const query = window.matchMedia(
+ `(max-width: ${designTokens.layout.breakpoint.mobile - 1}px)`,
+ )
+ const update = () => setCompactTable(query.matches)
+ query.addEventListener("change", update)
+ return () => query.removeEventListener("change", update)
+ }, [])
const load = async () => {
setLoading(true)
@@ -72,6 +91,7 @@ export function PoolsList() {
header: `Deleted ${selected.length} pool${selected.length > 1 ? "s" : ""}`,
})
setSelected([])
+ setConfirmDeleteOpen(false)
await load()
} catch (e) {
flash.push({
@@ -112,7 +132,6 @@ export function PoolsList() {
propertyFilterProps,
filteredItemsCount,
paginationProps,
- actions,
} = useCollection(rows, {
propertyFiltering: {
filteringProperties: [
@@ -121,25 +140,19 @@ export function PoolsList() {
{ key: "statusText", propertyLabel: "Status", groupValuesLabel: "Status values", operators: ["=", "!="] },
],
empty: (
- <Box textAlign="center" padding="m">
- <SpaceBetween size="xs">
- <b>No pools</b>
- <Box variant="p" color="text-body-secondary">
- Create one to get started.
- </Box>
- <Button onClick={() => navigate("/pools/new")}>New pool</Button>
- </SpaceBetween>
- </Box>
+ <PageEmpty
+ title="No pools"
+ action={
+ <CuaButton tone="primary" onClick={() => navigate("/pools/new")}>
+ New pool
+ </CuaButton>
+ }
+ >
+ Create one to get started.
+ </PageEmpty>
),
noMatch: (
- <Box textAlign="center" color="text-body-secondary" padding="m">
- <SpaceBetween size="xs">
- <b>No matches</b>
- <Button onClick={() => actions.setPropertyFiltering({ tokens: [], operation: "and" })}>
- Clear filter
- </Button>
- </SpaceBetween>
- </Box>
+ <PageEmpty title="No matches" />
),
},
pagination: { pageSize: 25 },
@@ -147,41 +160,72 @@ export function PoolsList() {
})
return (
- <Table
+ <PageShell
+ eyebrow="Fleet"
+ title="Pools"
+ counter={loading ? undefined : `(${rows.length})`}
+ secondaryActions={
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton
+ tone="icon"
+ ariaLabel="Refresh pools"
+ iconName="refresh"
+ onClick={load}
+ disabled={loading}
+ />
+ </SpaceBetween>
+ }
+ primaryAction={
+ <CuaButton
+ tone="primary"
+ onClick={() => navigate(localVisualPreviewPath("/pools/new"))}
+ >
+ New pool
+ </CuaButton>
+ }
+ >
+ {selected.length > 0 ? (
+ <div className="cua-selection-actions" aria-live="polite">
+ <span>
+ {selected.length} pool{selected.length === 1 ? "" : "s"} selected
+ </span>
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton
+ disabled={selected.length !== 1 || duplicating}
+ loading={duplicating}
+ onClick={duplicate}
+ >
+ Duplicate
+ </CuaButton>
+ <CuaButton
+ disabled={busy}
+ loading={busy}
+ onClick={() => setConfirmDeleteOpen(true)}
+ >
+ Delete
+ </CuaButton>
+ </SpaceBetween>
+ </div>
+ ) : null}
+ <section
+ className="cua-page-table"
+ aria-label="Pools table"
+ >
+ <Table
{...collectionProps}
- header={
- <Header
- variant="h1"
- counter={loading ? undefined : `(${rows.length})`}
- actions={
- <SpaceBetween direction="horizontal" size="xs">
- <Button iconName="refresh" onClick={load} disabled={loading} />
- <Button
- disabled={selected.length !== 1 || duplicating}
- loading={duplicating}
- onClick={duplicate}
- >
- Duplicate
- </Button>
- <Button
- disabled={selected.length === 0 || busy}
- loading={busy}
- onClick={removeSelected}
- >
- Delete
- </Button>
- <Button
- variant="primary"
- onClick={() => navigate("/pools/new")}
- >
- New pool
- </Button>
- </SpaceBetween>
- }
- >
- Pools
- </Header>
- }
+ ariaLabels={{
+ tableLabel: "Pools",
+ selectionGroupLabel: "Pool selection",
+ allItemsSelectionLabel: ({ selectedItems }) =>
+ selectedItems.length === items.length && items.length > 0
+ ? "Deselect all pools"
+ : "Select all pools",
+ itemSelectionLabel: ({ selectedItems }, item) =>
+ selectedItems.includes(item)
+ ? `Deselect pool ${item.name}`
+ : `Select pool ${item.name}`,
+ }}
+ variant="borderless"
items={items}
loading={loading}
loadingText="Loading pools"
@@ -204,44 +248,106 @@ export function PoolsList() {
}}
/>
}
- pagination={<Pagination {...paginationProps} />}
+ pagination={
+ <Pagination
+ {...paginationProps}
+ ariaLabels={{
+ paginationLabel: "Pools pagination",
+ previousPageLabel: "Previous page",
+ nextPageLabel: "Next page",
+ pageLabel: pageNumber => `Page ${pageNumber}`,
+ }}
+ />
+ }
+ stickyColumns={{ first: 1, last: 1 }}
+ columnDisplay={[
+ { id: "name", visible: true },
+ { id: "replicas", visible: !compactTable },
+ { id: "available", visible: !compactTable },
+ { id: "capacity", visible: compactTable },
+ { id: "status", visible: true },
+ ]}
columnDefinitions={[
{
id: "name",
header: "Name",
cell: p => (
<Link
- href={`#/pools/${p.namespace}/${p.name}`}
+ href={`#${localVisualPreviewPath(`/pools/${p.namespace}/${p.name}`)}`}
onFollow={e => {
e.preventDefault()
- navigate(`/pools/${p.namespace}/${p.name}`)
+ navigate(
+ localVisualPreviewPath(`/pools/${p.namespace}/${p.name}`),
+ )
}}
>
- {p.name}
+ <span className="cua-pool-name" title={p.name}>{p.name}</span>
</Link>
),
sortingField: "name",
isRowHeader: true,
+ minWidth: compactTable ? 112 : 220,
+ width: compactTable ? 120 : undefined,
+ maxWidth: compactTable ? 120 : undefined,
},
{
id: "replicas",
header: "Replicas",
cell: p => p.replicas,
sortingField: "replicas",
+ minWidth: 96,
},
{
id: "available",
header: "Available",
cell: p => p.availableCount,
sortingField: "availableCount",
+ minWidth: 96,
+ },
+ {
+ id: "capacity",
+ header: "Available",
+ cell: p => `${p.availableCount}/${p.replicas}`,
+ minWidth: 72,
+ width: 72,
+ maxWidth: 72,
},
{
id: "status",
header: "Status",
- cell: p => <PoolStatusPill status={derivePoolStatus(p)} />,
- sortingField: "statusText",
+ cell: p => (
+ <PoolStatusPill
+ status={derivePoolStatus(p)}
+ compact={compactTable}
+ />
+ ),
+ sortingField: compactTable ? undefined : "statusText",
+ minWidth: compactTable ? 60 : 140,
+ width: compactTable ? 60 : undefined,
+ maxWidth: compactTable ? 60 : undefined,
},
]}
- />
+ />
+ </section>
+ <Modal
+ visible={confirmDeleteOpen}
+ onDismiss={() => setConfirmDeleteOpen(false)}
+ header={`Delete ${selected.length} pool${selected.length === 1 ? "" : "s"}?`}
+ footer={
+ <Box float="right">
+ <SpaceBetween direction="horizontal" size="xs">
+ <CuaButton onClick={() => setConfirmDeleteOpen(false)}>
+ Cancel
+ </CuaButton>
+ <CuaButton tone="danger" onClick={removeSelected} loading={busy}>
+ Delete
+ </CuaButton>
+ </SpaceBetween>
+ </Box>
+ }
+ >
+ This action cannot be undone.
+ </Modal>
+ </PageShell>
)
}
diff --git a/libs/fleet/src/pages/Settings.tsx b/libs/fleet/src/pages/Settings.tsx
index adf61e7b30..9d118ddc9c 100644
--- a/libs/fleet/src/pages/Settings.tsx
+++ b/libs/fleet/src/pages/Settings.tsx
@@ -2,9 +2,9 @@
// policies for backend automation.
import { useEffect, useMemo, useState } from "react"
+import { useNavigate } from "react-router-dom"
import Alert from "@cloudscape-design/components/alert"
import Box from "@cloudscape-design/components/box"
-import Button from "@cloudscape-design/components/button"
import Container from "@cloudscape-design/components/container"
import CopyToClipboard from "@cloudscape-design/components/copy-to-clipboard"
import ExpandableSection from "@cloudscape-design/components/expandable-section"
@@ -20,7 +20,13 @@ import SpaceBetween from "@cloudscape-design/components/space-between"
import Table from "@cloudscape-design/components/table"
import Toggle from "@cloudscape-design/components/toggle"
import { userInfo } from "../auth/keycloak"
+import { errorMessage } from "../error-message"
+import { CuaButton } from "../components/CuaButton"
import { useFeatureFlags } from "../components/FeatureFlagContext"
+import { useFlash } from "../components/FlashContext"
+import { PageEmpty, PageError } from "../components/PageState"
+import { PageShell } from "../components/PageShell"
+import { localVisualPreviewPath } from "../local-visual-preview"
import {
type GitHubTrustPolicy,
githubTrustPoliciesApi,
@@ -29,6 +35,8 @@ import {
import { BillingSettings } from "./Billing"
export function Settings() {
+ const navigate = useNavigate()
+ const flash = useFlash()
const { sub, name } = userInfo()
const { billing } = useFeatureFlags()
const [policies, setPolicies] = useState<GitHubTrustPolicy[]>([])
@@ -45,7 +53,7 @@ export function Settings() {
const [loading, setLoading] = useState(true)
const [saving, setSaving] = useState(false)
const [busyId, setBusyId] = useState<string | null>(null)
- const [error, setError] = useState<string | null>(null)
+ const [loadError, setLoadError] = useState<string | null>(null)
const [confirmDelete, setConfirmDelete] = useState<GitHubTrustPolicy | null>(null)
const allNamespaceOptions = useMemo(() => {
@@ -76,9 +84,9 @@ export function Settings() {
value: ns.name,
})),
)
- setError(null)
+ setLoadError(null)
} catch (e) {
- setError(String(e))
+ setLoadError(errorMessage(e))
} finally {
setLoading(false)
}
@@ -116,10 +124,21 @@ export function Settings() {
} else {
await githubTrustPoliciesApi.create(payload)
}
+ flash.push({
+ type: "success",
+ header: editingId ? "Trust policy saved" : "Trust policy created",
+ content: "The change is stored remotely and applies immediately.",
+ })
resetForm()
await refresh()
} catch (e) {
- setError(String(e))
+ flash.push({
+ type: "error",
+ header: editingId
+ ? "Failed to save trust policy"
+ : "Failed to create trust policy",
+ content: errorMessage(e),
+ })
} finally {
setSaving(false)
}
@@ -141,9 +160,18 @@ export function Settings() {
await githubTrustPoliciesApi.update(policy.id, {
enabled: !policy.enabled,
})
+ flash.push({
+ type: "success",
+ header: policy.enabled ? "Trust policy disabled" : "Trust policy enabled",
+ content: "The change is stored remotely and applies immediately.",
+ })
await refresh()
} catch (e) {
- setError(String(e))
+ flash.push({
+ type: "error",
+ header: "Failed to update trust policy",
+ content: errorMessage(e),
+ })
} finally {
setBusyId(null)
}
@@ -154,11 +182,20 @@ export function Settings() {
setBusyId(confirmDelete.id)
try {
await githubTrustPoliciesApi.remove(confirmDelete.id)
+ flash.push({
+ type: "success",
+ header: "Trust policy deleted",
+ content: "GitHub workflows using it can no longer authenticate.",
+ })
setConfirmDelete(null)
if (editingId === confirmDelete.id) resetForm()
await refresh()
} catch (e) {
- setError(String(e))
+ flash.push({
+ type: "error",
+ header: "Failed to delete trust policy",
+ content: errorMessage(e),
+ })
} finally {
setBusyId(null)
}
@@ -205,15 +242,23 @@ steps:
--name "$sandbox"
cua sb exec "$sandbox" sh -lc 'uname -a; id; pwd'`
return (
- <SpaceBetween size="l">
- {error && (
- <Alert type="error" dismissible onDismiss={() => setError(null)}>
- {error}
- </Alert>
- )}
-
- <Container header={<Header variant="h2">Account</Header>}>
- <SpaceBetween size="m">
+ <PageShell
+ eyebrow="Account"
+ title="Settings"
+ description="Manage your identity, credentials, automation access, and payment method."
+ >
+ <SpaceBetween size="l">
+ <Container
+ header={
+ <Header
+ variant="h2"
+ description="Identity details from your current Cua session."
+ >
+ Account
+ </Header>
+ }
+ >
+ <SpaceBetween size="m">
<FormField label="Username">
{name ? (
<CopyToClipboard
@@ -242,17 +287,49 @@ steps:
<Box color="text-status-inactive">Unknown</Box>
)}
</FormField>
- </SpaceBetween>
- </Container>
+ </SpaceBetween>
+ </Container>
- {billing && <BillingSettings />}
+ <Container
+ header={
+ <Header
+ variant="h2"
+ description="API keys are managed remotely and changes take effect immediately."
+ actions={
+ <CuaButton
+ onClick={() => navigate(localVisualPreviewPath("/user-keys"))}
+ >
+ Manage API keys
+ </CuaButton>
+ }
+ >
+ API keys
+ </Header>
+ }
+ >
+ <Box color="text-body-secondary">
+ Create scoped credentials for local tools, CI workflows, and other
+ automation that calls Cua on your behalf.
+ </Box>
+ </Container>
<ExpandableSection
variant="container"
+ defaultExpanded={false}
headerText="GitHub Actions OIDC"
- headerDescription="Trust GitHub repositories to call Fleets directly with GitHub Actions OIDC tokens."
+ headerDescription={loadError
+ ? "GitHub Actions settings are unavailable. Expand to retry."
+ : "Trust GitHub repositories to call Fleets with short-lived tokens. Policies are stored remotely and apply immediately."}
>
- <SpaceBetween size="l">
+ {loadError ? (
+ <PageError
+ title="GitHub Actions settings are unavailable"
+ action={<CuaButton onClick={refresh}>Retry</CuaButton>}
+ >
+ {loadError}
+ </PageError>
+ ) : (
+ <SpaceBetween size="l">
<Form
header={
<Header
@@ -264,15 +341,15 @@ steps:
}
actions={
<SpaceBetween direction="horizontal" size="xs">
- {editingId && <Button onClick={resetForm}>Cancel</Button>}
- <Button
- variant="primary"
+ {editingId && <CuaButton onClick={resetForm}>Cancel</CuaButton>}
+ <CuaButton
+ tone="primary"
loading={saving}
disabled={!policyName || !repository}
onClick={submit}
>
{editingId ? "Save policy" : "Create policy"}
- </Button>
+ </CuaButton>
</SpaceBetween>
}
>
@@ -320,7 +397,9 @@ steps:
</Form>
<Table
+ variant="borderless"
loading={loading}
+ loadingText="Loading GitHub trust policies"
items={policies}
columnDefinitions={[
{ id: "name", header: "Name", cell: policy => policy.name },
@@ -349,24 +428,34 @@ steps:
header: "",
cell: policy => (
<SpaceBetween direction="horizontal" size="xs">
- <Button onClick={() => startEdit(policy)}>Edit</Button>
- <Button
+ <CuaButton
+ disabled={busyId !== null}
+ onClick={() => startEdit(policy)}
+ >
+ Edit
+ </CuaButton>
+ <CuaButton
loading={busyId === policy.id}
+ disabled={busyId !== null}
onClick={() => togglePolicy(policy)}
>
{policy.enabled ? "Disable" : "Enable"}
- </Button>
- <Button onClick={() => setConfirmDelete(policy)}>
+ </CuaButton>
+ <CuaButton
+ tone="danger"
+ disabled={busyId !== null}
+ onClick={() => setConfirmDelete(policy)}
+ >
Delete
- </Button>
+ </CuaButton>
</SpaceBetween>
),
},
]}
empty={
- <Box textAlign="center">
- No GitHub trust policies yet.
- </Box>
+ <PageEmpty title="No GitHub trust policies">
+ Create a policy when a repository needs short-lived access to Fleets.
+ </PageEmpty>
}
header={<Header variant="h3">Configured policies</Header>}
/>
@@ -416,9 +505,12 @@ steps:
</Alert>
</SpaceBetween>
</Container>
- </SpaceBetween>
+ </SpaceBetween>
+ )}
</ExpandableSection>
+ {billing && <BillingSettings />}
+
{confirmDelete && (
<Modal
visible
@@ -427,14 +519,14 @@ steps:
footer={
<Box float="right">
<SpaceBetween direction="horizontal" size="xs">
- <Button onClick={() => setConfirmDelete(null)}>Cancel</Button>
- <Button
- variant="primary"
+ <CuaButton onClick={() => setConfirmDelete(null)}>Cancel</CuaButton>
+ <CuaButton
+ tone="danger"
loading={busyId === confirmDelete.id}
onClick={removePolicy}
>
Delete
- </Button>
+ </CuaButton>
</SpaceBetween>
</Box>
}
@@ -444,6 +536,7 @@ steps:
this policy will lose access immediately.
</Modal>
)}
- </SpaceBetween>
+ </SpaceBetween>
+ </PageShell>
)
}
diff --git a/libs/fleet/src/pages/UserApiKeys.tsx b/libs/fleet/src/pages/UserApiKeys.tsx
index ebd375ec17..043aefc096 100644
--- a/libs/fleet/src/pages/UserApiKeys.tsx
+++ b/libs/fleet/src/pages/UserApiKeys.tsx
@@ -6,9 +6,9 @@
// returned once on creation and cannot be retrieved later.
import { useEffect, useState } from "react"
+import designTokens from "@cua/design/tokens.json"
import Alert from "@cloudscape-design/components/alert"
import Box from "@cloudscape-design/components/box"
-import Button from "@cloudscape-design/components/button"
import Container from "@cloudscape-design/components/container"
import CopyToClipboard from "@cloudscape-design/components/copy-to-clipboard"
import Form from "@cloudscape-design/components/form"
@@ -29,11 +29,17 @@ import {
type UserApiKey,
} from "../sdk/userKeys"
import { listNamespaces } from "../sdk/pools"
+import { errorMessage } from "../error-message"
+import { CuaButton } from "../components/CuaButton"
+import { useFlash } from "../components/FlashContext"
+import { PageEmpty, PageError } from "../components/PageState"
+import { PageShell } from "../components/PageShell"
export function UserApiKeys() {
+ const flash = useFlash()
const [keys, setKeys] = useState<UserApiKey[]>([])
const [loading, setLoading] = useState(true)
- const [error, setError] = useState<string | null>(null)
+ const [loadError, setLoadError] = useState<string | null>(null)
const [name, setName] = useState("")
const [selectedScope, setSelectedScope] = useState<
MultiselectProps.Option[]
@@ -42,6 +48,21 @@ export function UserApiKeys() {
const [creating, setCreating] = useState(false)
const [created, setCreated] = useState<NewUserApiKey | null>(null)
const [confirmRevoke, setConfirmRevoke] = useState<string | null>(null)
+ const [revokingId, setRevokingId] = useState<string | null>(null)
+ const [compactTable, setCompactTable] = useState(
+ () => window.matchMedia(
+ `(max-width: ${designTokens.layout.breakpoint.mobile - 1}px)`,
+ ).matches,
+ )
+
+ useEffect(() => {
+ const query = window.matchMedia(
+ `(max-width: ${designTokens.layout.breakpoint.mobile - 1}px)`,
+ )
+ const update = () => setCompactTable(query.matches)
+ query.addEventListener("change", update)
+ return () => query.removeEventListener("change", update)
+ }, [])
const refresh = async () => {
setLoading(true)
@@ -57,14 +78,15 @@ export function UserApiKeys() {
value: ns.name,
})),
)
- setError(null)
+ setLoadError(null)
} catch (e) {
- setError(String(e))
+ setLoadError(errorMessage(e))
} finally {
setLoading(false)
}
}
+ // biome-ignore lint/correctness/useExhaustiveDependencies: one-time page load
useEffect(() => {
refresh()
}, [])
@@ -82,45 +104,83 @@ export function UserApiKeys() {
setSelectedScope([])
await refresh()
} catch (e) {
- setError(String(e))
+ flash.push({
+ type: "error",
+ header: "Failed to create API key",
+ content: errorMessage(e),
+ })
} finally {
setCreating(false)
}
}
const remove = async (id: string) => {
+ setRevokingId(id)
try {
await deleteUserKey(id)
setConfirmRevoke(null)
+ flash.push({
+ type: "success",
+ header: "API key revoked",
+ content: "Systems using this key can no longer authenticate.",
+ })
await refresh()
} catch (e) {
- setError(String(e))
+ flash.push({
+ type: "error",
+ header: "Failed to revoke API key",
+ content: errorMessage(e),
+ })
+ } finally {
+ setRevokingId(null)
}
}
return (
- <SpaceBetween size="l">
- {error && (
- <Alert type="error" dismissible onDismiss={() => setError(null)}>
- {error}
- </Alert>
- )}
-
- <Container header={<Header variant="h2">Create a new API key</Header>}>
- <Form
- actions={
- <Button
- variant="primary"
- loading={creating}
- disabled={!name}
- onClick={create}
+ <PageShell
+ eyebrow="Account"
+ title="User API keys"
+ counter={loading || loadError ? undefined : `(${keys.length})`}
+ description="Create credentials for tools and automation that call Cua on your behalf."
+ secondaryActions={
+ <CuaButton
+ tone="icon"
+ ariaLabel="Refresh API keys"
+ iconName="refresh"
+ disabled={loading}
+ onClick={refresh}
+ />
+ }
+ >
+ <SpaceBetween size="l">
+ <Container
+ header={
+ <Header
+ variant="h2"
+ description="The key is saved to your Cua account as soon as it is created. Its secret is shown only once."
>
- Create key
- </Button>
+ Create API key
+ </Header>
}
>
- <SpaceBetween size="m">
- <FormField label="Name" description="A label to identify this key">
+ <Form
+ actions={
+ <CuaButton
+ tone="primary"
+ loading={creating}
+ disabled={!name}
+ onClick={create}
+ >
+ Create key
+ </CuaButton>
+ }
+ >
+ <SpaceBetween size="m">
+ <FormField
+ controlId="api-key-name"
+ label="Name"
+ description="A label to identify this key"
+ >
<Input value={name} onChange={e => setName(e.detail.value)} />
</FormField>
<FormField
@@ -139,15 +199,40 @@ export function UserApiKeys() {
empty="No namespaces found"
/>
</FormField>
- </SpaceBetween>
- </Form>
- </Container>
+ </SpaceBetween>
+ </Form>
+ </Container>
- <Table
- loading={loading}
- items={keys}
- columnDefinitions={[
- { id: "name", header: "Name", cell: r => r.name },
+ {loadError ? (
+ <Container>
+ <PageError
+ title="API keys are unavailable"
+ action={<CuaButton onClick={refresh}>Retry</CuaButton>}
+ >
+ {loadError}
+ </PageError>
+ </Container>
+ ) : (
+ <section className="cua-page-table">
+ <Table
+ variant="borderless"
+ loading={loading}
+ loadingText="Loading API keys"
+ items={keys}
+ visibleColumns={compactTable
+ ? ["name", "scope", "actions"]
+ : ["name", "client_id", "scope", "actions"]}
+ columnDefinitions={[
+ {
+ id: "name",
+ header: "Name",
+ cell: r => (
+ <SpaceBetween size="xxs">
+ <span>{r.name}</span>
+ {compactTable ? <code>{r.clientId}</code> : null}
+ </SpaceBetween>
+ ),
+ },
{ id: "client_id", header: "Client ID", cell: r => <code>{r.clientId}</code> },
{
id: "scope",
@@ -161,13 +246,43 @@ export function UserApiKeys() {
id: "actions",
header: "",
cell: r => (
- <Button onClick={() => setConfirmRevoke(r.id)}>Revoke</Button>
+ <CuaButton
+ tone="danger"
+ loading={revokingId === r.id}
+ disabled={revokingId !== null}
+ onClick={() => setConfirmRevoke(r.id)}
+ >
+ Revoke
+ </CuaButton>
),
},
- ]}
- empty={<Box textAlign="center">No API keys yet.</Box>}
- header={<Header variant="h2">Your API keys</Header>}
- />
+ ]}
+ empty={
+ <PageEmpty
+ title="No API keys"
+ action={
+ <CuaButton
+ tone="primary"
+ onClick={() => document.getElementById("api-key-name")?.focus()}
+ >
+ Create API key
+ </CuaButton>
+ }
+ >
+ Create a key when a tool or workflow needs to access Cua.
+ </PageEmpty>
+ }
+ header={
+ <Header
+ variant="h2"
+ description="Revocations are saved remotely and take effect immediately."
+ >
+ API keys
+ </Header>
+ }
+ />
+ </section>
+ )}
{/* Key-created modal -- shows credentials once */}
{created && (
@@ -177,9 +292,9 @@ export function UserApiKeys() {
onDismiss={() => setCreated(null)}
footer={
<Box float="right">
- <Button variant="primary" onClick={() => setCreated(null)}>
+ <CuaButton tone="primary" onClick={() => setCreated(null)}>
I have copied the credentials
- </Button>
+ </CuaButton>
</Box>
}
>
@@ -225,13 +340,14 @@ export function UserApiKeys() {
footer={
<Box float="right">
<SpaceBetween direction="horizontal" size="xs">
- <Button onClick={() => setConfirmRevoke(null)}>Cancel</Button>
- <Button
- variant="primary"
+ <CuaButton onClick={() => setConfirmRevoke(null)}>Cancel</CuaButton>
+ <CuaButton
+ tone="danger"
+ loading={revokingId === confirmRevoke}
onClick={() => remove(confirmRevoke)}
>
Revoke
- </Button>
+ </CuaButton>
</SpaceBetween>
</Box>
}
@@ -240,6 +356,7 @@ export function UserApiKeys() {
access immediately.
</Modal>
)}
- </SpaceBetween>
+ </SpaceBetween>
+ </PageShell>
)
}
diff --git a/libs/fleet/src/sdk/billing.ts b/libs/fleet/src/sdk/billing.ts
index 3ff3c386c6..78084ef46e 100644
--- a/libs/fleet/src/sdk/billing.ts
+++ b/libs/fleet/src/sdk/billing.ts
@@ -1,4 +1,8 @@
import { getToken } from "../auth/keycloak";
+import {
+ isLocalVisualPreview,
+ localVisualPreviewPath,
+} from "../local-visual-preview";
export interface SavedCard {
brand: string;
@@ -27,9 +31,23 @@ async function billingRequest<T>(
}
export const billingApi = {
- summary: () => billingRequest<BillingSummary>("/api/billing/summary", "GET"),
+ summary: () =>
+ isLocalVisualPreview()
+ ? Promise.resolve<BillingSummary>({
+ payment_method_present: true,
+ card: { brand: "visa", last4: "4242", exp_month: 12, exp_year: 2030 },
+ })
+ : billingRequest<BillingSummary>("/api/billing/summary", "GET"),
setup: () =>
- billingRequest<{ url: string }>("/api/billing/setup-session", "POST"),
+ isLocalVisualPreview()
+ ? Promise.resolve({
+ url: localVisualPreviewPath("/settings?billing=setup-preview"),
+ })
+ : billingRequest<{ url: string }>("/api/billing/setup-session", "POST"),
portal: () =>
- billingRequest<{ url: string }>("/api/billing/portal-session", "POST"),
+ isLocalVisualPreview()
+ ? Promise.resolve({
+ url: localVisualPreviewPath("/settings?billing=portal-preview"),
+ })
+ : billingRequest<{ url: string }>("/api/billing/portal-session", "POST"),
};
diff --git a/libs/fleet/src/sdk/chat.ts b/libs/fleet/src/sdk/chat.ts
index 214fee60f1..8c4270119f 100644
--- a/libs/fleet/src/sdk/chat.ts
+++ b/libs/fleet/src/sdk/chat.ts
@@ -1,4 +1,11 @@
import { getToken } from "../auth/keycloak"
+import {
+ createLocalVisualPreviewConversation,
+ getLocalVisualPreviewConversation,
+ isLocalVisualPreview,
+ listLocalVisualPreviewConversations,
+ streamLocalVisualPreviewTurn,
+} from "../local-visual-preview"
export type ChatRole = "user" | "assistant" | "tool"
@@ -130,15 +137,22 @@ function parseAssistantMessage(value: unknown): ChatMessage {
}
}
-export function createConversation(): Promise<Conversation> {
+export async function createConversation(): Promise<Conversation> {
+ if (isLocalVisualPreview()) return createLocalVisualPreviewConversation()
return chatJson<Conversation>("/api/chat/conversations", { method: "POST" })
}
-export function listConversations(): Promise<ConversationSummary[]> {
+export async function listConversations(): Promise<ConversationSummary[]> {
+ if (isLocalVisualPreview()) return listLocalVisualPreviewConversations()
return chatJson<ConversationSummary[]>("/api/chat/conversations")
}
-export function getConversation(id: string): Promise<Conversation> {
+export async function getConversation(id: string): Promise<Conversation> {
+ if (isLocalVisualPreview()) {
+ const conversation = getLocalVisualPreviewConversation(id)
+ if (!conversation) throw new ChatApiError("Conversation not found", 404)
+ return conversation
+ }
return chatJson<Conversation>(`/api/chat/conversations/${encodeURIComponent(id)}`)
}
@@ -148,6 +162,9 @@ export async function streamTurn(
onDelta: (delta: string) => void,
signal?: AbortSignal,
): Promise<ChatMessage> {
+ if (isLocalVisualPreview()) {
+ return streamLocalVisualPreviewTurn(conversationId, messages, onDelta)
+ }
const response = await chatFetch(
`/api/chat/conversations/${encodeURIComponent(conversationId)}/turns`,
{ method: "POST", body: JSON.stringify({ messages }), signal },
diff --git a/libs/fleet/src/sdk/claims.ts b/libs/fleet/src/sdk/claims.ts
index 21233e648c..97c3885406 100644
--- a/libs/fleet/src/sdk/claims.ts
+++ b/libs/fleet/src/sdk/claims.ts
@@ -7,6 +7,7 @@ import {
} from "./generated"
import { withClient } from "./client"
import type { Claim } from "./models"
+import { isLocalVisualPreview } from "../local-visual-preview"
export function buildClaimRequest(pool: Pool): CreateClaimRequest {
return new CreateClaimRequestBuilder().pool(pool).build()
@@ -38,6 +39,7 @@ async function findClaim(
}
export async function listClaims(namespace: string): Promise<Claim[]> {
+ if (isLocalVisualPreview()) return []
return withClient(async client =>
(await client.listClaims(namespace)).map(claimModel),
)
diff --git a/libs/fleet/src/sdk/client.ts b/libs/fleet/src/sdk/client.ts
index 45057011d1..0a2dd233d5 100644
--- a/libs/fleet/src/sdk/client.ts
+++ b/libs/fleet/src/sdk/client.ts
@@ -8,6 +8,10 @@ import {
const sdkInitialization = uniffiInitAsync()
+export async function ensureSdkInitialized(): Promise<void> {
+ await sdkInitialization
+}
+
function baseUrl(): string {
return window.location.origin
}
@@ -25,7 +29,7 @@ export function buildClientConfiguration(): CyclopsTokenProviderConfiguration {
export async function withClient<T>(
operation: (client: CyclopsClient) => Promise<T>,
): Promise<T> {
- await sdkInitialization
+ await ensureSdkInitialized()
const token = await getToken()
if (!token) throw new Error("Authentication token is unavailable")
diff --git a/libs/fleet/src/sdk/githubTrustPolicies.ts b/libs/fleet/src/sdk/githubTrustPolicies.ts
index 0d7c918867..24a111ad47 100644
--- a/libs/fleet/src/sdk/githubTrustPolicies.ts
+++ b/libs/fleet/src/sdk/githubTrustPolicies.ts
@@ -1,4 +1,5 @@
import { getToken } from "../auth/keycloak"
+import { isLocalVisualPreview } from "../local-visual-preview"
export interface Namespace {
name: string
@@ -32,6 +33,18 @@ export interface GitHubTrustPolicyInput {
enabled: boolean
}
+let localVisualPreviewPolicies: GitHubTrustPolicy[] = [
+ {
+ id: "preview-policy-1",
+ name: "Cloud CI",
+ repository: "trycua/cloud",
+ allowed_namespaces: ["preview"],
+ enabled: true,
+ created_at: "2026-08-16T20:20:00.000Z",
+ updated_at: "2026-08-16T20:20:00.000Z",
+ },
+]
+
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const token = await getToken()
const response = await fetch(path, {
@@ -51,23 +64,72 @@ async function request<T>(path: string, init?: RequestInit): Promise<T> {
}
export const githubTrustPoliciesApi = {
- list: () => request<GitHubTrustPolicyListResponse>("/api/github-trust-policies"),
- create: (input: GitHubTrustPolicyInput) =>
- request<GitHubTrustPolicy>("/api/github-trust-policies", {
+ list: async () => {
+ if (isLocalVisualPreview()) {
+ return {
+ policies: [...localVisualPreviewPolicies],
+ oidc: {
+ issuer: "https://token.actions.githubusercontent.com",
+ audience: "fleets",
+ },
+ }
+ }
+ return request<GitHubTrustPolicyListResponse>("/api/github-trust-policies")
+ },
+ create: async (input: GitHubTrustPolicyInput) => {
+ if (isLocalVisualPreview()) {
+ const now = new Date().toISOString()
+ const policy: GitHubTrustPolicy = {
+ id: `preview-policy-${localVisualPreviewPolicies.length + 1}`,
+ ...input,
+ created_at: now,
+ updated_at: now,
+ }
+ localVisualPreviewPolicies = [...localVisualPreviewPolicies, policy]
+ return policy
+ }
+ return request<GitHubTrustPolicy>("/api/github-trust-policies", {
method: "POST",
body: JSON.stringify(input),
- }),
- update: (id: string, input: Partial<GitHubTrustPolicyInput>) =>
- request<GitHubTrustPolicy>(`/api/github-trust-policies/${encodeURIComponent(id)}`, {
+ })
+ },
+ update: async (id: string, input: Partial<GitHubTrustPolicyInput>) => {
+ if (isLocalVisualPreview()) {
+ const current = localVisualPreviewPolicies.find(policy => policy.id === id)
+ if (!current) throw new Error("Preview trust policy not found")
+ const policy = { ...current, ...input, updated_at: new Date().toISOString() }
+ localVisualPreviewPolicies = localVisualPreviewPolicies.map(item =>
+ item.id === id ? policy : item,
+ )
+ return policy
+ }
+ return request<GitHubTrustPolicy>(`/api/github-trust-policies/${encodeURIComponent(id)}`, {
method: "PATCH",
body: JSON.stringify(input),
- }),
- remove: (id: string) =>
- request<void>(`/api/github-trust-policies/${encodeURIComponent(id)}`, {
+ })
+ },
+ remove: async (id: string) => {
+ if (isLocalVisualPreview()) {
+ localVisualPreviewPolicies = localVisualPreviewPolicies.filter(
+ policy => policy.id !== id,
+ )
+ return
+ }
+ return request<void>(`/api/github-trust-policies/${encodeURIComponent(id)}`, {
method: "DELETE",
- }),
+ })
+ },
}
export const namespacesApi = {
- list: () => request<Namespace[]>("/api/namespaces"),
+ list: () => isLocalVisualPreview()
+ ? Promise.resolve([
+ {
+ name: "preview",
+ status: "Active",
+ createdAt: "2026-08-16T20:20:00.000Z",
+ labels: null,
+ },
+ ])
+ : request<Namespace[]>("/api/namespaces"),
}
diff --git a/libs/fleet/src/sdk/pools.ts b/libs/fleet/src/sdk/pools.ts
index 4a5c1f0bf5..0de62f161a 100644
--- a/libs/fleet/src/sdk/pools.ts
+++ b/libs/fleet/src/sdk/pools.ts
@@ -32,6 +32,11 @@ import type {
PoolSummary,
PoolTemplateConfig,
} from "./models"
+import {
+ getLocalVisualPreviewPool,
+ isLocalVisualPreview,
+ listLocalVisualPreviewPools,
+} from "../local-visual-preview"
function serviceProtocol(protocol: ServiceProtocol | undefined): string {
return protocol === ServiceProtocol.Udp ? "UDP" : "TCP"
@@ -87,10 +92,21 @@ async function listNamespacesWith(client: CyclopsClient): Promise<Namespace[]> {
}
export async function listNamespaces(): Promise<Namespace[]> {
+ if (isLocalVisualPreview()) {
+ return [
+ {
+ name: "preview",
+ status: "Active",
+ createdAt: "2026-08-16T20:20:00.000Z",
+ labels: undefined,
+ },
+ ]
+ }
return withClient(listNamespacesWith)
}
export async function listPools(): Promise<PoolSummary[]> {
+ if (isLocalVisualPreview()) return listLocalVisualPreviewPools()
return withClient(async client => {
const namespaces = await listNamespacesWith(client)
const pools = await Promise.all(
@@ -123,6 +139,11 @@ async function getPoolWith(
}
export async function getPool(namespace: string, name: string): Promise<PoolData> {
+ if (isLocalVisualPreview()) {
+ const pool = getLocalVisualPreviewPool(namespace, name)
+ if (!pool) throw new Error(`Preview pool ${namespace}/${name} was not found`)
+ return pool
+ }
return withClient(async client => {
const resources = await getPoolWith(client, namespace, name)
return poolData(resources.pool, resources.template)
diff --git a/libs/fleet/src/sdk/userKeys.ts b/libs/fleet/src/sdk/userKeys.ts
index 5c8f85580e..d3b287cd8f 100644
--- a/libs/fleet/src/sdk/userKeys.ts
+++ b/libs/fleet/src/sdk/userKeys.ts
@@ -5,9 +5,19 @@ import {
type UserApiKey,
} from "./generated"
import { withClient } from "./client"
+import { isLocalVisualPreview } from "../local-visual-preview"
export type { NewUserApiKey, UserApiKey } from "./generated"
+let localVisualPreviewKeys: UserApiKey[] = [
+ {
+ id: "preview-key-1",
+ clientId: "cua_preview_automation",
+ name: "Preview automation",
+ scope: ["preview"],
+ },
+]
+
export function buildUserApiKeyRequest(
name: string,
scope?: string[],
@@ -19,6 +29,7 @@ export function buildUserApiKeyRequest(
}
export async function listUserKeys(): Promise<UserApiKey[]> {
+ if (isLocalVisualPreview()) return [...localVisualPreviewKeys]
return withClient(client => client.listUserApiKeys())
}
@@ -26,9 +37,29 @@ export async function createUserKey(
name: string,
scope?: string[],
): Promise<NewUserApiKey> {
+ if (isLocalVisualPreview()) {
+ const key: UserApiKey = {
+ id: `preview-key-${localVisualPreviewKeys.length + 1}`,
+ clientId: `cua_preview_${name.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`,
+ name,
+ scope: scope ?? [],
+ }
+ localVisualPreviewKeys = [...localVisualPreviewKeys, key]
+ return {
+ clientId: key.clientId,
+ clientSecret: "cua_preview_secret_shown_once",
+ tokenUrl: "https://auth.cua.ai/realms/cyclops-cs/protocol/openid-connect/token",
+ name: key.name,
+ scope: key.scope,
+ }
+ }
return withClient(client => client.createUserApiKey(buildUserApiKeyRequest(name, scope)))
}
export async function deleteUserKey(id: string): Promise<void> {
+ if (isLocalVisualPreview()) {
+ localVisualPreviewKeys = localVisualPreviewKeys.filter(key => key.id !== id)
+ return
+ }
await withClient(client => client.deleteUserApiKey(id))
}
diff --git a/libs/fleet/src/shell.css b/libs/fleet/src/shell.css
new file mode 100644
index 0000000000..eae4a194e3
--- /dev/null
+++ b/libs/fleet/src/shell.css
@@ -0,0 +1,306 @@
+html,
+body,
+#root,
+.cua-shell {
+ min-height: 100%;
+ background: var(--cua-dashboard-background, #000000);
+}
+
+.cua-shell {
+ color: var(--cua-dashboard-text);
+ font-family: var(--cua-dashboard-font-body);
+}
+
+.cua-shell__topnav,
+.cua-pagehead {
+ position: relative;
+ isolation: isolate;
+}
+
+.cua-shell__topnav {
+ z-index: 1000;
+ overflow: visible;
+ background: var(--cua-dashboard-background);
+}
+
+.cua-shell__topnav::before {
+ content: "";
+ position: absolute;
+ z-index: -2;
+ inset: 0;
+ pointer-events: none;
+ background: var(--cua-dashboard-band);
+ mask-image: linear-gradient(180deg, #000000 0%, #000000 48%, transparent 100%);
+}
+
+.cua-shell__topnav::after,
+.cua-pagehead::after {
+ content: "";
+ position: absolute;
+ z-index: -1;
+ inset: 0;
+ pointer-events: none;
+ background-image: var(--cua-dashboard-band-grain-image);
+ background-size: var(--cua-dashboard-band-grain-size);
+ opacity: var(--cua-dashboard-band-grain-opacity);
+}
+
+.cua-pagehead::after {
+ inset-block: -24px;
+ inset-inline: calc(-1 * var(--cua-pagehead-bleed));
+}
+
+.cua-shell__topnav > * {
+ position: relative;
+ z-index: 1;
+ background: transparent;
+}
+
+.cua-shell__nav {
+ font-size: 14px;
+}
+
+.cua-pagehead {
+ box-sizing: border-box;
+ min-height: 96px;
+ padding: 18px 0 14px;
+ --cua-pagehead-bleed: var(--cua-layout-application-inline);
+}
+
+.cua-pagehead__eyebrow {
+ margin: 0 0 10px;
+ color: var(--cua-color-text-muted);
+ font-family: var(--cua-dashboard-font-mono);
+ font-size: var(--cua-dashboard-eyebrow-size);
+ font-weight: 500;
+ letter-spacing: var(--cua-dashboard-eyebrow-tracking);
+ line-height: 1.4;
+ text-transform: uppercase;
+}
+
+.cua-pagehead__title {
+ margin: 0;
+ color: var(--cua-dashboard-text);
+ font-family: var(--cua-dashboard-font-body);
+ font-size: var(--cua-font-size-page-title);
+ font-weight: 600;
+ letter-spacing: -0.01em;
+ line-height: 1.2;
+}
+
+.cua-pagehead__actions,
+.cua-pagebody {
+ min-width: 0;
+}
+
+.cua-pagehead__actions {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ justify-content: flex-end;
+}
+
+.cua-selection-actions {
+ display: flex;
+ min-height: 48px;
+ padding: 8px 0;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ color: var(--cua-color-text-body);
+}
+
+.cua-page-table {
+ min-width: 0;
+ overflow-x: auto;
+ border-radius: var(--cua-radius-control);
+}
+
+.cua-visually-hidden {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ white-space: nowrap;
+ border: 0;
+}
+
+.cua-pool-name {
+ display: block;
+ max-width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+#cua-dashboard-root .cua-dashboard-button button {
+ appearance: none;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ min-height: var(--cua-control-height-compact);
+ padding: var(--cua-action-padding-block) var(--cua-action-padding-inline);
+ border-radius: var(--cua-radius-control);
+ font-family: var(--cua-dashboard-font-body);
+ font-size: var(--cua-action-font-size);
+ font-weight: var(--cua-action-font-weight);
+ letter-spacing: var(--cua-action-letter-spacing);
+ line-height: var(--cua-action-line-height);
+}
+
+#cua-dashboard-root .cua-dashboard-button--primary button:not(:disabled),
+#cua-dashboard-root .cua-dashboard-button--primary button:not(:disabled):hover,
+#cua-dashboard-root .cua-dashboard-button--primary button:not(:disabled):active {
+ border-color: transparent;
+ background: var(--cua-action-primary-background);
+ box-shadow: none;
+ color: var(--cua-action-primary-foreground);
+}
+
+#cua-dashboard-root .cua-dashboard-button--primary button:not(:disabled):hover {
+ filter: var(--cua-action-primary-hover-filter);
+}
+
+#cua-dashboard-root .cua-dashboard-button--secondary button:not(:disabled),
+#cua-dashboard-root .cua-dashboard-button--secondary button:not(:disabled):hover,
+#cua-dashboard-root .cua-dashboard-button--secondary button:not(:disabled):active,
+#cua-dashboard-root .cua-dashboard-button--icon button:not(:disabled),
+#cua-dashboard-root .cua-dashboard-button--icon button:not(:disabled):hover,
+#cua-dashboard-root .cua-dashboard-button--icon button:not(:disabled):active {
+ border-color: var(--cua-action-secondary-application-border);
+ background: var(--cua-action-secondary-application-background);
+ color: var(--cua-action-secondary-application-foreground);
+}
+
+#cua-dashboard-root .cua-dashboard-button--secondary button:not(:disabled):hover,
+#cua-dashboard-root .cua-dashboard-button--icon button:not(:disabled):hover {
+ border-color: var(--cua-action-secondary-application-hover-border);
+ background: var(--cua-action-secondary-application-background);
+ color: var(--cua-action-secondary-application-hover-foreground);
+}
+
+#cua-dashboard-root .cua-dashboard-button--icon button {
+ width: 40px;
+ padding-inline: 0;
+}
+
+#cua-dashboard-root .cua-dashboard-button--danger button:not(:disabled),
+#cua-dashboard-root .cua-dashboard-button--danger button:not(:disabled):hover,
+#cua-dashboard-root .cua-dashboard-button--danger button:not(:disabled):active {
+ border-color: var(--cua-action-danger-application-border);
+ background: var(--cua-action-danger-application-background);
+ color: var(--cua-action-danger-application-foreground);
+}
+
+#cua-dashboard-root .cua-dashboard-button--danger button:not(:disabled):hover,
+#cua-dashboard-root .cua-dashboard-button--danger button:not(:disabled):active {
+ border-color: var(--cua-action-danger-application-hover-border);
+ background: var(--cua-action-danger-application-hover-background);
+}
+
+#cua-dashboard-root
+ .cua-dashboard-button.cua-dashboard-button--secondary
+ button:disabled,
+#cua-dashboard-root
+ .cua-dashboard-button.cua-dashboard-button--secondary
+ button[aria-disabled="true"],
+#cua-dashboard-root
+ .cua-dashboard-button.cua-dashboard-button--icon
+ button:disabled,
+#cua-dashboard-root
+ .cua-dashboard-button.cua-dashboard-button--icon
+ button[aria-disabled="true"] {
+ border-color: var(--cua-action-secondary-application-border);
+ background: var(--cua-action-secondary-application-background);
+ color: var(--cua-action-secondary-application-foreground);
+ opacity: 0.55;
+}
+
+/* Cloudscape paints its focus ring on a button::before layer with geometry
+ that does not follow Cua's control radius. Keep its focus behavior, but
+ replace that paint layer with the shared Cua focus tokens. */
+body#cua-dashboard-root[data-awsui-focus-visible="true"]
+ .cua-dashboard-button
+ button:focus::before {
+ content: none;
+}
+
+#cua-dashboard-root .cua-dashboard-button button:focus-visible,
+body#cua-dashboard-root[data-awsui-focus-visible="true"]
+ .cua-dashboard-button
+ button:focus-visible {
+ outline: var(--cua-focus-width) solid var(--cua-focus-color);
+ outline-offset: var(--cua-focus-offset);
+}
+
+#cua-dashboard-root [aria-label="Open navigation"],
+#cua-dashboard-root [aria-label="Close navigation"] {
+ /* Cloudscape's scoped trigger selector contains an ID specificity hack. */
+ width: 40px !important;
+ height: 40px !important;
+ border: 1px solid var(--cua-action-secondary-application-border) !important;
+ border-radius: var(--cua-radius-control) !important;
+ background: var(--cua-action-secondary-application-background) !important;
+ color: var(--cua-action-secondary-application-foreground) !important;
+}
+
+#cua-dashboard-root [aria-label="Open navigation"]:hover,
+#cua-dashboard-root [aria-label="Close navigation"]:hover {
+ border-color: var(--cua-action-secondary-application-hover-border) !important;
+ color: var(--cua-action-secondary-application-hover-foreground) !important;
+}
+
+.cua-pagehead h1 {
+ /* Cloudscape renders the counter beside the full-contrast inner title. */
+ color: var(--cua-color-text-muted);
+}
+
+@media (max-width: 1023px) {
+ #root .cua-shell main > div:has(> nav[aria-label="Main navigation"]) {
+ inset-block-start: 0;
+ block-size: 100dvh;
+ }
+}
+
+@media (max-width: 687px) {
+ .cua-pagehead {
+ min-height: 96px;
+ padding-top: 16px;
+ }
+
+ .cua-pagehead__title {
+ font-size: var(--cua-font-size-page-title-compact);
+ }
+
+ .cua-pagehead {
+ --cua-pagehead-bleed: var(--cua-layout-application-inline-compact);
+ }
+
+ .cua-pagehead__actions {
+ flex-wrap: nowrap;
+ }
+
+ #cua-dashboard-root
+ .cua-pagehead__actions
+ .cua-dashboard-button:not(.cua-dashboard-button--icon)
+ button {
+ padding-inline: var(--cua-action-padding-inline-compact);
+ }
+}
+
+@media (max-width: 374px) {
+ .cua-pagehead {
+ --cua-pagehead-bleed: var(--cua-layout-application-inline-tight);
+ }
+}
+
+@media (forced-colors: active) {
+ .cua-shell__topnav::before,
+ .cua-shell__topnav::after,
+ .cua-pagehead::after {
+ display: none;
+ }
+}
diff --git a/libs/fleet/src/types/assets.d.ts b/libs/fleet/src/types/assets.d.ts
new file mode 100644
index 0000000000..ea84a4a00a
--- /dev/null
+++ b/libs/fleet/src/types/assets.d.ts
@@ -0,0 +1,11 @@
+/// <reference types="vite/client" />
+
+declare module "*.svg" {
+ const url: string
+ export default url
+}
+
+declare module "*.woff2" {
+ const url: string
+ export default url
+}
diff --git a/libs/fleet/tests/auth-redirects.test.ts b/libs/fleet/tests/auth-redirects.test.ts
new file mode 100644
index 0000000000..6fe152bdfb
--- /dev/null
+++ b/libs/fleet/tests/auth-redirects.test.ts
@@ -0,0 +1,49 @@
+import assert from "node:assert/strict"
+import test from "node:test"
+import {
+ appLoginRedirectUri,
+ appLogoutRedirectUri,
+} from "../src/auth/redirects.ts"
+
+test("login redirect preserves the current Run route and ordinary parameters", () => {
+ assert.equal(
+ appLoginRedirectUri("https://run.cua.ai/pools/demo?tab=activity#logs"),
+ "https://run.cua.ai/pools/demo?tab=activity#logs",
+ )
+})
+
+test("login redirect strips a successful OIDC query callback", () => {
+ assert.equal(
+ appLoginRedirectUri(
+ "https://run.cua.ai/settings?tab=billing&code=one-time&state=opaque&session_state=opaque&iss=https%3A%2F%2Fauth.cua.ai%2Frealms%2Fcyclops-cs",
+ ),
+ "https://run.cua.ai/settings?tab=billing",
+ )
+})
+
+test("login redirect strips a rejected OIDC fragment callback", () => {
+ assert.equal(
+ appLoginRedirectUri(
+ "https://run.cua.ai/pools#state=opaque&error=login_required&error_description=expired",
+ ),
+ "https://run.cua.ai/pools",
+ )
+})
+
+test("login redirect does not remove unrelated application errors", () => {
+ assert.equal(
+ appLoginRedirectUri("https://run.cua.ai/pools?error=capacity"),
+ "https://run.cua.ai/pools?error=capacity",
+ )
+})
+
+test("logout redirect is pinned to the same-origin Run root", () => {
+ assert.equal(
+ appLogoutRedirectUri("https://run.cua.ai/settings?tab=billing"),
+ "https://run.cua.ai/",
+ )
+ assert.equal(
+ appLogoutRedirectUri("http://localhost:9090/pools/demo"),
+ "http://localhost:9090/",
+ )
+})
diff --git a/libs/fleet/tests/design-package-boundary.test.mjs b/libs/fleet/tests/design-package-boundary.test.mjs
new file mode 100644
index 0000000000..0991678fe7
--- /dev/null
+++ b/libs/fleet/tests/design-package-boundary.test.mjs
@@ -0,0 +1,148 @@
+import assert from "node:assert/strict"
+import { readdir, readFile } from "node:fs/promises"
+import test from "node:test"
+import path from "node:path"
+import { fileURLToPath } from "node:url"
+
+const __filename = fileURLToPath(import.meta.url)
+const __dirname = path.dirname(__filename)
+const cyclopsRoot = path.resolve(__dirname, "..")
+const repositoryRoot = path.resolve(cyclopsRoot, "..")
+
+async function readCssTree(directory) {
+ const entries = await readdir(directory, { withFileTypes: true })
+ return (
+ await Promise.all(
+ entries.map(entry => {
+ const entryPath = path.join(directory, entry.name)
+ if (entry.isDirectory()) return readCssTree(entryPath)
+ if (entry.isFile() && entry.name.endsWith(".css")) {
+ return readFile(entryPath, "utf8")
+ }
+ return []
+ }),
+ )
+ ).flat()
+}
+
+test("dashboard consumes the runtime-neutral design package", async () => {
+ const [packageJson, entrypoint] = await Promise.all([
+ readFile(path.join(cyclopsRoot, "package.json"), "utf8").then(JSON.parse),
+ readFile(path.join(cyclopsRoot, "src/main.tsx"), "utf8"),
+ ])
+
+ assert.equal(
+ packageJson.dependencies["@cua/design"],
+ "file:../packages/cua-design",
+ )
+ assert.equal(packageJson.dependencies["@cua/mesh"], undefined)
+ assert.equal(packageJson.dependencies["@paper-design/shaders"], undefined)
+
+ const designImport = entrypoint.indexOf(
+ 'import "@cua/design/dashboard.css"',
+ )
+ const cloudscapeImport = entrypoint.indexOf(
+ 'import "@cloudscape-design/global-styles/index.css"',
+ )
+ assert.ok(designImport >= 0, "expected the shared dashboard CSS import")
+ assert.ok(
+ designImport < cloudscapeImport,
+ "shared foundations must load before Cloudscape globals",
+ )
+})
+
+test("frontend image builds from the repository root", async () => {
+ const [dockerfile, workflow] = await Promise.all([
+ readFile(path.join(cyclopsRoot, "Dockerfile"), "utf8"),
+ readFile(
+ path.join(repositoryRoot, ".github/workflows/build-cyclops-cs.yml"),
+ "utf8",
+ ),
+ ])
+
+ assert.match(dockerfile, /COPY packages\/cua-design\/package\.json/)
+ assert.doesNotMatch(dockerfile, /packages\/cua-mesh/)
+ assert.match(dockerfile, /COPY cyclops-cs\/package\.json/)
+ assert.match(
+ workflow,
+ /- image: cyclops-cs[\s\S]*?context: \.[\s\S]*?dockerfile: cyclops-cs\/Dockerfile/,
+ )
+ assert.match(workflow, /- 'packages\/cua-design\/\*\*'/)
+})
+
+test("dashboard activates the shared theme through supported boundaries", async () => {
+ const [entrypoint, shell, shellStyles, visualPreview] = await Promise.all([
+ readFile(path.join(cyclopsRoot, "src/main.tsx"), "utf8"),
+ readFile(path.join(cyclopsRoot, "src/App.tsx"), "utf8"),
+ readFile(path.join(cyclopsRoot, "src/shell.css"), "utf8"),
+ readFile(path.join(cyclopsRoot, "src/local-visual-preview.ts"), "utf8"),
+ ])
+ const allStyles = (await readCssTree(path.join(cyclopsRoot, "src"))).join(
+ "\n",
+ )
+
+ assert.match(entrypoint, /@cloudscape-design\/components\/theming/)
+ assert.match(entrypoint, /applyTheme\(\{/)
+ assert.match(shell, /className="cua-dashboard-theme cua-shell"/)
+ assert.match(shell, /className="cua-shell__topnav"/)
+ assert.match(shell, /id="cua-shell-topnav"/)
+ assert.match(shell, /headerSelector="#cua-shell-topnav"/)
+ assert.match(shell, /navigationToggle: "Open navigation"/)
+ assert.match(shell, /navigationClose: "Close navigation"/)
+ assert.match(
+ shell,
+ /header=\{mobile \? undefined : \{ href: "#\/pools", text: "Cua" \}\}/,
+ )
+ assert.match(entrypoint, /document\.body\.id = "cua-dashboard-root"/)
+ assert.doesNotMatch(shellStyles, /\.cua-pagehead__mesh/)
+ assert.match(shellStyles, /@media \(forced-colors: active\)/)
+ assert.doesNotMatch(shellStyles, /h1 > span:last-child/)
+ assert.doesNotMatch(allStyles, /--awsui-/)
+ assert.doesNotMatch(allStyles, /\.awsui[_-]/)
+ assert.doesNotMatch(allStyles, /--space-[\w-]+-[a-z0-9]{6}/)
+ assert.doesNotMatch(allStyles, /var\(--color-/)
+ assert.doesNotMatch(
+ shellStyles,
+ /linear-gradient\(135deg, #f0f8ff 0%, #9fd7ff 58%, #5f86b4 100%\)/,
+ )
+ assert.doesNotMatch(shellStyles, /color: #07131e/)
+ assert.doesNotMatch(shellStyles, /min-height: 40px/)
+ assert.match(visualPreview, /import\.meta\.env\.DEV/)
+ assert.match(visualPreview, /VITE_CUA_LOCAL_VISUAL_PREVIEW === "true"/)
+ assert.match(
+ visualPreview,
+ /VITE_CUA_REVIEW_VISUAL_PREVIEW === "true"/,
+ )
+ assert.match(
+ visualPreview,
+ /\^cyclops-cs-pr-\\d\+\\\.tail204509\\\.ts\\\.net\$/,
+ )
+})
+
+test("account preview data stays behind the fail-closed visual-preview gate", async () => {
+ const files = await Promise.all(
+ [
+ "src/sdk/userKeys.ts",
+ "src/sdk/githubTrustPolicies.ts",
+ "src/sdk/billing.ts",
+ "src/components/FeatureFlagContext.tsx",
+ ].map(relativePath =>
+ readFile(path.join(cyclopsRoot, relativePath), "utf8"),
+ ),
+ )
+
+ for (const source of files.slice(0, 3)) {
+ assert.match(source, /isLocalVisualPreview\(\)/)
+ assert.match(
+ source,
+ /if \(isLocalVisualPreview\(\)\)|isLocalVisualPreview\(\)\s*\?/,
+ )
+ assert.doesNotMatch(source, /if \(!isLocalVisualPreview\(\)\)/)
+ }
+ assert.match(files[3], /const visualPreview = isLocalVisualPreview\(\)/)
+ assert.match(files[3], /visualPreview\s*\?/)
+ assert.doesNotMatch(files[3], /!visualPreview/)
+ assert.match(files[0], /withClient\(client => client\.listUserApiKeys\(\)\)/)
+ assert.match(files[1], /request<GitHubTrustPolicyListResponse>/)
+ assert.match(files[2], /billingRequest<BillingSummary>/)
+})
diff --git a/libs/fleet/vite.config.ts b/libs/fleet/vite.config.ts
index 0f8049b169..5bb5899969 100644
--- a/libs/fleet/vite.config.ts
+++ b/libs/fleet/vite.config.ts
@@ -25,7 +25,7 @@ export default defineConfig({
proxy: {
// Upstream cyclops-ctrl is retired — every /api route is served by
// the cyclops-cs backend behind the deployed ingress.
- "/api": {
+ "^/api(?:/|$)": {
target: ORCH_API,
changeOrigin: true,
secure: true,