Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(cyclops-cs): add frontend internationalization (#7242)
r33drichardsd5a56695ab9e
diff --git a/libs/fleet/e2e/settings.spec.ts b/libs/fleet/e2e/settings.spec.tsindex 2618593d5a..3cb2a98a80 100644--- a/libs/fleet/e2e/settings.spec.ts+++ b/libs/fleet/e2e/settings.spec.ts@@ -54,6 +54,28 @@ test("keeps account identity in a collapsed drawer", async ({ page }) => {await expect(settingsContent.getByText("test-user-id", { exact: true })).toBeVisible()})+test("switches the shared UI language and persists it", async ({ page }) => {+ await mockAuth(page)+ await mockNamespacesApi(page)+ await mockGitHubTrustPoliciesApi(page)+ await page.goto("/settings")++ await page.getByLabel("Display language").click()+ await page.getByRole("option", { name: "Español" }).click()++ await expect(page).toHaveTitle("Configuración · Cua")+ await expect(page.locator("html")).toHaveAttribute("lang", "es")+ await expect(page.getByRole("heading", { name: "Idioma y región" })).toBeVisible()+ await expect(page.getByRole("link", { name: "Grupos" })).toBeVisible()+ await expect(page.getByRole("link", { name: "Uso" })).toBeVisible()+ await expect(page.getByRole("link", { name: "Claves de API" })).toBeVisible()+ await expect(page.getByRole("link", { name: "Configuración" })).toBeVisible()++ await page.reload()+ await expect(page).toHaveTitle("Configuración · Cua")+ await expect(page.getByLabel("Idioma de la interfaz")).toContainText("Español")+})+test.describe("Settings GitHub trust policies", () => {test.beforeEach(async ({ page }) => {await mockAuth(page)diff --git a/libs/fleet/playwright.config.ts b/libs/fleet/playwright.config.tsindex 0a67a01fbc..220d7424c0 100644--- a/libs/fleet/playwright.config.ts+++ b/libs/fleet/playwright.config.ts@@ -9,7 +9,7 @@ export default defineConfig({workers: process.env.CI ? 2 : undefined,use: {baseURL: "http://localhost:5180",- headless: true,+ headless: process.env.CUA_E2E_HEADED !== "1",launchOptions: localChromiumExecutable? { executablePath: localChromiumExecutable }: undefined,diff --git a/libs/fleet/scripts/ensure-browser-sdk-binding.sh b/libs/fleet/scripts/ensure-browser-sdk-binding.shindex e6a86e1653..4391b5723d 100755--- a/libs/fleet/scripts/ensure-browser-sdk-binding.sh+++ b/libs/fleet/scripts/ensure-browser-sdk-binding.sh@@ -6,6 +6,16 @@ cyclops_root="$repo_root/cyclops-cs"binding_dir="$cyclops_root/sdk-bindings/ts-uniffi-browser"stamp_dir="$cyclops_root/target/browser-sdk"stamp_file="$stamp_dir/input.sha256"+stamp_existing=false++case "${1:-}" in+ "") ;;+ --stamp-existing) stamp_existing=true ;;+ *)+ echo "usage: $0 [--stamp-existing]" >&2+ exit 2+ ;;+esacartifacts=("$binding_dir/ts/index.web.ts"@@ -42,6 +52,16 @@ if [ -f "$stamp_file" ] && [ "$(cat "$stamp_file")" = "$inputs_hash" ]; thenstamp_matches=truefi+if [ "$stamp_existing" = true ]; then+ if [ "$artifacts_ready" != true ]; then+ echo "error: cannot stamp missing browser SDK artifacts" >&2+ exit 1+ fi+ mkdir -p "$stamp_dir"+ printf '%s\n' "$inputs_hash" > "$stamp_file"+ exit 0+fi+if [ "$artifacts_ready" = true ] && [ "$stamp_matches" = true ]; thenexit 0fidiff --git a/libs/fleet/src/App.tsx b/libs/fleet/src/App.tsxindex fb1f9230a7..52db430468 100644--- a/libs/fleet/src/App.tsx+++ b/libs/fleet/src/App.tsx@@ -51,6 +51,7 @@ import {isThreadNavigationHref,useThreadNavigation,} from "./components/ThreadNavigation";+import { useI18n } from "./i18n/I18nProvider";const VERSION_CHECK_INTERVAL_MS = 60_000;@@ -178,6 +179,7 @@ function ShellLayout({const navigate = useNavigate();const [staleDismissed, setStaleDismissed] = useState(false);const { stale } = useStaleCheck();+ const { t } = useI18n();const user = userInfo();const { admin, chat } = useFeatureFlags();const threadNavigation = useThreadNavigation();@@ -240,9 +242,9 @@ function ShellLayout({utilities={[{type: "menu-dropdown",- text: user.name ?? user.email ?? "Account",+ text: user.name ?? user.email ?? t("account.fallback"),iconName: "user-profile",- items: [{ id: "signout", text: "Sign out" }],+ items: [{ id: "signout", text: t("common.signOut") }],onItemClick: (event) => {if (event.detail.id === "signout") logout();},@@ -254,9 +256,9 @@ function ShellLayout({disableBodyScroll={location.pathname.startsWith("/agent")}headerSelector="#cua-shell-topnav"ariaLabels={{- navigation: "Main navigation",- navigationClose: "Close navigation",- navigationToggle: "Open navigation",+ navigation: t("navigation.main"),+ navigationClose: t("navigation.close"),+ navigationToggle: t("navigation.open"),}}toolsHidenavigationOpen={navigationOpen}@@ -289,17 +291,17 @@ function ShellLayout({navigate(localVisualPreviewPath(path));}}items={[- { type: "link", text: "Pools", href: "#/pools" },- { type: "link", text: "Usage", href: "#/usage" },- { type: "link", text: "API keys", href: "#/user-keys" },- { type: "link", text: "Settings", href: "#/settings" },+ { type: "link", text: t("navigation.pools"), href: "#/pools" },+ { type: "link", text: t("navigation.usage"), href: "#/usage" },+ { type: "link", text: t("navigation.apiKeys"), href: "#/user-keys" },+ { type: "link", text: t("navigation.settings"), href: "#/settings" },...(admin? [{type: "link" as const,- text: "Feature flags",+ text: t("navigation.featureFlags"),href: "#/admin/feature-flags",- info: <Badge color="blue">Admin</Badge>,+ info: <Badge color="blue">{t("common.admin")}</Badge>,},]: []),@@ -317,11 +319,11 @@ function ShellLayout({? [{type: "info" as const,- header: "A new version is available",- content: "Refresh to get the latest features and fixes.",+ header: t("stale.header"),+ content: t("stale.content"),action: (<Button onClick={() => window.location.reload()}>- Refresh now+ {t("common.refreshNow")}</Button>),dismissible: true,@@ -343,6 +345,7 @@ function ShellLayout({}export function App() {+ const { t } = useI18n();return (<BrowserRouter><FeatureFlagProvider>@@ -352,7 +355,7 @@ export function App() {<Routepath="/pools"element={- <TitledPage title="Pools">+ <TitledPage title={t("page.pools")}><PoolsList /></TitledPage>}@@ -360,7 +363,7 @@ export function App() {<Routepath="/pools/new"element={- <TitledPage title="New pool">+ <TitledPage title={t("page.newPool")}><PoolNew /></TitledPage>}@@ -372,7 +375,7 @@ export function App() {<Routepath="/pools/:namespace/:name"element={- <TitledPage title="Pool details">+ <TitledPage title={t("page.poolDetails")}><PoolDetail /></TitledPage>}@@ -380,7 +383,7 @@ export function App() {<Routepath="/user-keys"element={- <TitledPage title="API keys">+ <TitledPage title={t("navigation.apiKeys")}><UserApiKeys /></TitledPage>}@@ -388,7 +391,7 @@ export function App() {<Routepath="/settings"element={- <TitledPage title="Settings">+ <TitledPage title={t("page.settings")}><Settings /></TitledPage>}@@ -396,7 +399,7 @@ export function App() {<Routepath="/usage"element={- <TitledPage title="Usage">+ <TitledPage title={t("page.usage")}><BillingUsagePage /></TitledPage>}@@ -404,7 +407,7 @@ export function App() {<Routepath="/agent"element={- <TitledPage title="Threads">+ <TitledPage title={t("page.threads")}><ChatRoute /></TitledPage>}@@ -412,7 +415,7 @@ export function App() {<Routepath="/agent/archived"element={- <TitledPage title="Threads">+ <TitledPage title={t("page.threads")}><ArchivedThreadsRoute /></TitledPage>}@@ -420,7 +423,7 @@ export function App() {<Routepath="/agent/:threadId"element={- <TitledPage title="Threads">+ <TitledPage title={t("page.threads")}><ChatRoute /></TitledPage>}@@ -433,7 +436,7 @@ export function App() {<Routepath="/admin/feature-flags"element={- <TitledPage title="Feature flags">+ <TitledPage title={t("navigation.featureFlags")}><FeatureFlags /></TitledPage>}@@ -442,7 +445,7 @@ export function App() {<Routepath="/pools/:namespace/:poolName/claims/:claimName"element={- <TitledPage title="Claim details">+ <TitledPage title={t("page.claimDetails")}><ClaimDetail /></TitledPage>}@@ -476,9 +479,10 @@ function RedirectModule() {function ChatRoute() {const { chat, resolved } = useFeatureFlags();+ const { t } = useI18n();if (!resolved) {return (- <PageShell eyebrow="Agent" title="Chat">+ <PageShell eyebrow="Agent" title={t("page.chat")}><div className="agent-chat-page" /></PageShell>);@@ -488,9 +492,10 @@ function ChatRoute() {function ArchivedThreadsRoute() {const { chat, resolved } = useFeatureFlags();+ const { t } = useI18n();if (!resolved)return (- <PageShell eyebrow="Agent" title="Archived threads">+ <PageShell eyebrow="Agent" title={t("page.archivedThreads")}><div /></PageShell>);diff --git a/libs/fleet/src/i18n/I18nProvider.tsx b/libs/fleet/src/i18n/I18nProvider.tsxnew file mode 100644index 0000000000..41a84aac93--- /dev/null+++ b/libs/fleet/src/i18n/I18nProvider.tsx@@ -0,0 +1,74 @@+import {+ createContext,+ type ReactNode,+ useContext,+ useEffect,+ useMemo,+ useState,+} from "react"+import {+ type Locale,+ supportedLocales,+ translations,+ type TranslationKey,+} from "./translations"++const STORAGE_KEY = "cua.locale"++type I18nContextValue = {+ locale: Locale+ setLocale: (locale: Locale) => void+ t: (key: TranslationKey) => string+ formatDateTime: (value: string | number | Date) => string+}++const I18nContext = createContext<I18nContextValue | null>(null)++function isLocale(value: string | null): value is Locale {+ return supportedLocales.includes(value as Locale)+}++function initialLocale(): Locale {+ try {+ const storedLocale = window.localStorage.getItem(STORAGE_KEY)+ if (isLocale(storedLocale)) return storedLocale+ } catch {+ // Storage can be unavailable in privacy-restricted browser contexts.+ }++ const browserLocale = navigator.languages+ .map(language => language.toLowerCase().split("-")[0])+ .find(isLocale)+ return browserLocale ?? "en"+}++export function I18nProvider({ children }: { children: ReactNode }) {+ const [locale, setLocale] = useState<Locale>(initialLocale)++ useEffect(() => {+ document.documentElement.lang = locale+ try {+ window.localStorage.setItem(STORAGE_KEY, locale)+ } catch {+ // Keep the in-memory preference when persistent storage is unavailable.+ }+ }, [locale])++ const value = useMemo<I18nContextValue>(() => ({+ locale,+ setLocale,+ t: key => translations[locale][key],+ formatDateTime: value => new Intl.DateTimeFormat(locale, {+ dateStyle: "medium",+ timeStyle: "short",+ }).format(new Date(value)),+ }), [locale])++ return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>+}++export function useI18n(): I18nContextValue {+ const context = useContext(I18nContext)+ if (!context) throw new Error("useI18n must be used within I18nProvider")+ return context+}diff --git a/libs/fleet/src/i18n/translations.ts b/libs/fleet/src/i18n/translations.tsnew file mode 100644index 0000000000..0b0f0f4c04--- /dev/null+++ b/libs/fleet/src/i18n/translations.ts@@ -0,0 +1,92 @@+export const translations = {+ en: {+ "account.fallback": "Account",+ "account.heading": "Account",+ "account.description": "Identity details from your current Cua session.",+ "account.username": "Username",+ "account.subject": "Subject (sub)",+ "account.unknown": "Unknown",+ "account.copyUsername": "Copy username",+ "account.usernameCopied": "Username copied",+ "account.usernameCopyFailed": "Failed to copy username",+ "account.copySubject": "Copy subject",+ "account.subjectCopied": "Subject copied",+ "account.subjectCopyFailed": "Failed to copy subject",+ "common.admin": "Admin",+ "common.refreshNow": "Refresh now",+ "common.signOut": "Sign out",+ "i18n.description": "Choose the language used for shared navigation and page chrome.",+ "i18n.displayLanguage": "Display language",+ "i18n.heading": "Language and region",+ "i18n.selectPlaceholder": "Choose a language",+ "navigation.apiKeys": "API keys",+ "navigation.close": "Close navigation",+ "navigation.featureFlags": "Feature flags",+ "navigation.main": "Main navigation",+ "navigation.open": "Open navigation",+ "navigation.pools": "Pools",+ "navigation.settings": "Settings",+ "navigation.usage": "Usage",+ "page.archivedThreads": "Archived threads",+ "page.chat": "Chat",+ "page.claimDetails": "Claim details",+ "page.newPool": "New pool",+ "page.poolDetails": "Pool details",+ "page.pools": "Pools",+ "page.settings": "Settings",+ "page.threads": "Threads",+ "page.usage": "Usage",+ "stale.content": "A newer version of Cua is available.",+ "stale.header": "Update available",+ },+ es: {+ "account.fallback": "Cuenta",+ "account.heading": "Cuenta",+ "account.description": "Datos de identidad de tu sesión actual de Cua.",+ "account.username": "Nombre de usuario",+ "account.subject": "Identificador (sub)",+ "account.unknown": "Desconocido",+ "account.copyUsername": "Copiar nombre de usuario",+ "account.usernameCopied": "Nombre de usuario copiado",+ "account.usernameCopyFailed": "No se pudo copiar el nombre de usuario",+ "account.copySubject": "Copiar identificador",+ "account.subjectCopied": "Identificador copiado",+ "account.subjectCopyFailed": "No se pudo copiar el identificador",+ "common.admin": "Administración",+ "common.refreshNow": "Actualizar ahora",+ "common.signOut": "Cerrar sesión",+ "i18n.description": "Elige el idioma de la navegación y los elementos compartidos de las páginas.",+ "i18n.displayLanguage": "Idioma de la interfaz",+ "i18n.heading": "Idioma y región",+ "i18n.selectPlaceholder": "Elige un idioma",+ "navigation.apiKeys": "Claves de API",+ "navigation.close": "Cerrar navegación",+ "navigation.featureFlags": "Indicadores de funciones",+ "navigation.main": "Navegación principal",+ "navigation.open": "Abrir navegación",+ "navigation.pools": "Grupos",+ "navigation.settings": "Configuración",+ "navigation.usage": "Uso",+ "page.archivedThreads": "Conversaciones archivadas",+ "page.chat": "Chat",+ "page.claimDetails": "Detalles de la solicitud",+ "page.newPool": "Nuevo grupo",+ "page.poolDetails": "Detalles del grupo",+ "page.pools": "Grupos",+ "page.settings": "Configuración",+ "page.threads": "Conversaciones",+ "page.usage": "Uso",+ "stale.content": "Hay una versión más reciente de Cua disponible.",+ "stale.header": "Actualización disponible",+ },+} as const++export type Locale = keyof typeof translations+export type TranslationKey = keyof (typeof translations)["en"]++export const supportedLocales: readonly Locale[] = ["en", "es"]++export const localeLabels: Record<Locale, string> = {+ en: "English",+ es: "Español",+}diff --git a/libs/fleet/src/main.tsx b/libs/fleet/src/main.tsxindex e3294220b0..8d5ed76cf3 100644--- a/libs/fleet/src/main.tsx+++ b/libs/fleet/src/main.tsx@@ -10,6 +10,7 @@ import displayFont from "@cua/design/assets/fonts/instrument-serif-normal-latin.import { HelmetProvider } from "react-helmet-async"import { App } from "./App"import { AuthProvider } from "./auth/AuthProvider"+import { I18nProvider } from "./i18n/I18nProvider"import "./shell.css"import { captureFleetAttribution } from "./auth/fleet-attribution"@@ -91,9 +92,11 @@ document.head.appendChild(interPreload)ReactDOM.createRoot(document.getElementById("root")!).render(<React.StrictMode><HelmetProvider>- <AuthProvider>- <App />- </AuthProvider>+ <I18nProvider>+ <AuthProvider>+ <App />+ </AuthProvider>+ </I18nProvider></HelmetProvider></React.StrictMode>,)diff --git a/libs/fleet/src/pages/Settings.tsx b/libs/fleet/src/pages/Settings.tsxindex b57faaab7a..d29b79d8de 100644--- a/libs/fleet/src/pages/Settings.tsx+++ b/libs/fleet/src/pages/Settings.tsx@@ -15,6 +15,7 @@ import Modal from "@cloudscape-design/components/modal"import Multiselect, {type MultiselectProps,} from "@cloudscape-design/components/multiselect"+import Select from "@cloudscape-design/components/select"import SpaceBetween from "@cloudscape-design/components/space-between"import Table from "@cloudscape-design/components/table"import Toggle from "@cloudscape-design/components/toggle"@@ -31,9 +32,12 @@ import {namespacesApi,} from "../api/githubTrustPolicies"import { BillingSettings } from "./Billing"+import { useI18n } from "../i18n/I18nProvider"+import { localeLabels, supportedLocales, type Locale } from "../i18n/translations"export function Settings() {const flash = useFlash()+ const { formatDateTime, locale, setLocale, t } = useI18n()const { sub, name } = userInfo()const { billing } = useFeatureFlags()const [policies, setPolicies] = useState<GitHubTrustPolicy[]>([])@@ -240,43 +244,62 @@ steps:cua sb exec "$sandbox" sh -lc 'uname -a; id; pwd'`return (<PageShell- eyebrow="Account"- title="Settings"+ eyebrow={t("account.heading")}+ title={t("page.settings")}><SpaceBetween size="l">+ <Container+ header={+ <Header variant="h2" description={t("i18n.description")}>+ {t("i18n.heading")}+ </Header>+ }+ >+ <FormField label={t("i18n.displayLanguage")}>+ <Select+ selectedOption={{ label: localeLabels[locale], value: locale }}+ onChange={({ detail }) => setLocale(detail.selectedOption.value as Locale)}+ options={supportedLocales.map(value => ({+ label: localeLabels[value],+ value,+ }))}+ placeholder={t("i18n.selectPlaceholder")}+ />+ </FormField>+ </Container><ExpandableSectionvariant="container"defaultExpanded={false}- headerText="Account"- headerDescription="Identity details from your current Cua session."+ headerText={t("account.heading")}+ headerDescription={t("account.description")}><SpaceBetween size="m">- <FormField label="Username">+ <FormField label={t("account.username")}>{name ? (<CopyToClipboardvariant="inline"textToCopy={name}textToDisplay={<code>{name}</code>}- copyButtonAriaLabel="Copy username"- copySuccessText="Username copied"- copyErrorText="Failed to copy username"+ copyButtonAriaLabel={t("account.copyUsername")}+ copySuccessText={t("account.usernameCopied")}+ copyErrorText={t("account.usernameCopyFailed")}/>) : (- <Box color="text-status-inactive">Unknown</Box>+ <Box color="text-status-inactive">{t("account.unknown")}</Box>)}</FormField>- <FormField label="Subject (sub)">+ <FormField label={t("account.subject")}>{sub ? (<CopyToClipboardvariant="inline"textToCopy={sub}textToDisplay={<code>{sub}</code>}- copyButtonAriaLabel="Copy subject"- copySuccessText="Subject copied"- copyErrorText="Failed to copy subject"+ copyButtonAriaLabel={t("account.copySubject")}+ copySuccessText={t("account.subjectCopied")}+ copyErrorText={t("account.subjectCopyFailed")}/>) : (- <Box color="text-status-inactive">Unknown</Box>+ <Box color="text-status-inactive">{t("account.unknown")}</Box>)}</FormField></SpaceBetween>@@ -392,7 +415,7 @@ steps:{id: "updated",header: "Updated",- cell: policy => new Date(policy.updated_at).toLocaleString(),+ cell: policy => formatDateTime(policy.updated_at),},{id: "actions",diff --git a/libs/fleet/tests/design-package-boundary.test.mjs b/libs/fleet/tests/design-package-boundary.test.mjsindex d1a6e3d52e..3f51a9a1c1 100644--- a/libs/fleet/tests/design-package-boundary.test.mjs+++ b/libs/fleet/tests/design-package-boundary.test.mjs@@ -87,8 +87,8 @@ test("dashboard activates the shared theme through supported boundaries", asyncassert.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, /navigationToggle: t\("navigation\.open"\)/)+ assert.match(shell, /navigationClose: t\("navigation\.close"\)/)assert.match(entrypoint, /document\.body\.id = "cua-dashboard-root"/)assert.doesNotMatch(shellStyles, /\.cua-pagehead__mesh/)assert.match(shellStyles, /@media \(forced-colors: active\)/)