🙌 OpenHands: AI-Driven Development
Improve agent server onboarding and recovery flow (#59)
Graham Neubig35543b406c91
diff --git a/.pr/issue-56/01-onboarding.png b/.pr/issue-56/01-onboarding.pngnew file mode 100644index 0000000000..24d1521e8fBinary files /dev/null and b/.pr/issue-56/01-onboarding.png differdiff --git a/.pr/issue-56/02-settings.png b/.pr/issue-56/02-settings.pngnew file mode 100644index 0000000000..37268acb67Binary files /dev/null and b/.pr/issue-56/02-settings.png differdiff --git a/.pr/issue-56/03-home.png b/.pr/issue-56/03-home.pngnew file mode 100644index 0000000000..911c3450b4Binary files /dev/null and b/.pr/issue-56/03-home.png differdiff --git a/.pr/issue-56/onboarding-flow.gif b/.pr/issue-56/onboarding-flow.gifnew file mode 100644index 0000000000..abb978f864Binary files /dev/null and b/.pr/issue-56/onboarding-flow.gif differdiff --git a/AGENTS.md b/AGENTS.mdindex 3f03fd29ef..40a446d8fd 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -59,9 +59,14 @@- The root compatibility bootstrap now treats `/server_info` network/timeout failures as a first-class `AgentServerUnavailableError`, uses a short 5s timeout for that probe, and disables React Query retries/toasts for the initial config fetch so missing backends fail fast with an explicit full-screen notice.- For local verification in this repo, setting `VITE_WORKING_DIR=/workspace/project/agent-server-gui` avoids initial Changes-tab 500s from pointing conversations at the non-repo parent `/workspace/project`.- OpenHands Cloud sandbox development note: do **not** reuse the sandbox's existing agent-server for this frontend. Current agent-server releases use a shared `openhands` tmux socket and default `workspace/conversations`, so a naive second server in the same sandbox can kill the cloud session's tmux state or attach to the same persisted conversations. `npm run dev` is now the recommended local workflow and starts an isolated local agent-server for the checkout by overriding `TMUX_TMPDIR`, `OH_CONVERSATIONS_PATH`, `OH_BASH_EVENTS_DIR`, and `OH_VSCODE_PORT` under `.openhands-dev/`; use `npm run dev:frontend` only when intentionally pointing at a separately managed backend, or `npm run dev:mock` for mock mode.-- A successful end-to-end live run in this environment required a real LLM config (`LLM_MODEL` + `LLM_API_KEY`). The default `litellm_proxy/...` model with no `llm_api_key` failed at runtime with a `litellm.AuthenticationError`.+- Agent-server recovery UX gotchas:+ - Keep `/settings/agent-server` in the intermediate-page bypass path (`use-is-on-intermediate-page`) so `useConfig()`-driven layout/sidebar queries do not block the recovery screen behind a global spinner.+ - `PostHogWrapper` should treat config-fetch failures as silent/optional (no user-facing toast), otherwise onboarding/recovery screens show a duplicate incompatible-server toast on top of the friendly guidance.+ - Keep the settings route on the compact `AgentServerConnectionForm` variant with `showSectionHeader={false}` and no checklist; the blocked root onboarding should stay similarly minimal, with only the status card plus a single sentence that links to the repo setup instructions.+ - For local screenshot/GIF capture of SPA routes, serve `build/` with an SPA fallback (for example `sirv build --single`) and restart the static server after each rebuild so hashed asset URLs stay in sync.+- Git provider token persistence note: this direct-agent-server frontend now persists `Settings > Git` provider tokens locally in browser storage instead of posting to an app-backend secrets route. `src/api/secrets-service.ts` writes the token payload to localStorage, mirrors provider hosts into `provider_tokens_set` through `SettingsService.saveSettings()`, and `use-delete-git-providers` clears that local state.- Agent server connection settings now live at `Settings > Agent Server` (`/settings/agent-server`). The page reads deployment defaults from `VITE_BACKEND_BASE_URL` / `VITE_SESSION_API_KEY`, saves user overrides in the `openhands-agent-server-config` localStorage key, and must stay reachable even when the backend compatibility probe fails so users can recover from missing or wrong backend configuration.diff --git a/__tests__/components/providers/posthog-wrapper.test.tsx b/__tests__/components/providers/posthog-wrapper.test.tsxindex 5167c9d27c..29d0d8e270 100644--- a/__tests__/components/providers/posthog-wrapper.test.tsx+++ b/__tests__/components/providers/posthog-wrapper.test.tsx@@ -170,4 +170,18 @@ describe("PostHogWrapper", () => {}),);});++ it("keeps rendering children when config fetch fails", async () => {+ vi.spyOn(OptionService, "getConfig").mockRejectedValueOnce(new Error("boom"));++ renderWithQueryClient(+ <PostHogWrapper>+ <div data-testid="child" />+ </PostHogWrapper>,+ );++ await screen.findByTestId("child");++ expect(mockPostHogProvider).not.toHaveBeenCalled();+ });});diff --git a/__tests__/hooks/use-is-on-intermediate-page.test.ts b/__tests__/hooks/use-is-on-intermediate-page.test.tsindex 0b69b79cfa..9f1f285f7b 100644--- a/__tests__/hooks/use-is-on-intermediate-page.test.ts+++ b/__tests__/hooks/use-is-on-intermediate-page.test.ts@@ -1,5 +1,6 @@import { renderHook } from "@testing-library/react";-import { describe, expect, it, vi } from "vitest";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { useIsOnIntermediatePage } from "#/hooks/use-is-on-intermediate-page";const useLocationMock = vi.fn();@@ -8,15 +9,17 @@ vi.mock("react-router", async () => ({useLocation: () => useLocationMock(),}));+beforeEach(() => {+ useLocationMock.mockReset();+});+describe("useIsOnIntermediatePage", () => {- it("returns false for OSS app routes", async () => {+ it("returns false for OSS app routes", () => {useLocationMock.mockReturnValue({ pathname: "/settings" });- const { useIsOnIntermediatePage } = await import(- "#/hooks/use-is-on-intermediate-page"- );const { result } = renderHook(() => useIsOnIntermediatePage());expect(result.current).toBe(false);});+});diff --git a/__tests__/query-client-config.test.ts b/__tests__/query-client-config.test.tsnew file mode 100644index 0000000000..baa9dae1e1--- /dev/null+++ b/__tests__/query-client-config.test.ts@@ -0,0 +1,45 @@+import { AxiosError } from "axios";+import { afterEach, describe, expect, it, vi } from "vitest";+import { createAgentServerQueryClient } from "#/query-client-config";+import * as ToastHandlers from "#/utils/custom-toast-handlers";++afterEach(() => {+ vi.restoreAllMocks();+});++describe("createAgentServerQueryClient", () => {+ it("does not show a toast when query meta disables toasts", async () => {+ const toastSpy = vi.spyOn(ToastHandlers, "displayErrorToast");+ const client = createAgentServerQueryClient();++ await expect(+ client.fetchQuery({+ queryKey: ["config", "suppressed"],+ queryFn: async () => {+ throw new AxiosError("suppressed query error");+ },+ meta: { disableToast: true },+ retry: false,+ }),+ ).rejects.toThrow("suppressed query error");++ expect(toastSpy).not.toHaveBeenCalled();+ });++ it("shows a toast when query meta does not disable toasts", async () => {+ const toastSpy = vi.spyOn(ToastHandlers, "displayErrorToast");+ const client = createAgentServerQueryClient();++ await expect(+ client.fetchQuery({+ queryKey: ["config", "toast"],+ queryFn: async () => {+ throw new AxiosError("query error with toast");+ },+ retry: false,+ }),+ ).rejects.toThrow("query error with toast");++ expect(toastSpy).toHaveBeenCalledWith("query error with toast");+ });+});diff --git a/__tests__/root.test.tsx b/__tests__/root.test.tsxindex 5d4273a697..99ed3003db 100644--- a/__tests__/root.test.tsx+++ b/__tests__/root.test.tsx@@ -1,12 +1,82 @@import { render, screen, waitFor } from "@testing-library/react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { createRoutesStub } from "react-router";-import { describe, expect, it } from "vitest";+import { describe, expect, it, vi } from "vitest";import { http, HttpResponse } from "msw";import { MINIMUM_SUPPORTED_AGENT_SERVER_VERSION } from "#/api/agent-server-compatibility";import App from "#/root";import { server } from "#/mocks/node";+const TRANSLATIONS: Record<string, string> = {+ "SETTINGS$AGENT_SERVER_UPGRADE_TITLE": "Update your agent server",+ "SETTINGS$AGENT_SERVER_UPGRADE_EYEBROW": "Upgrade required",+ "SETTINGS$AGENT_SERVER_UPGRADE_DESCRIPTION":+ "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "SETTINGS$AGENT_SERVER_UPGRADE_STATUS_TITLE":+ "The connected server is too old",+ "SETTINGS$AGENT_SERVER_UPGRADE_STATUS_MESSAGE":+ "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "SETTINGS$AGENT_SERVER_ONBOARDING_EYEBROW": "Get started",+ "SETTINGS$AGENT_SERVER_ONBOARDING_TITLE": "Connect to your agent server",+ "SETTINGS$AGENT_SERVER_ONBOARDING_DESCRIPTION":+ "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "SETTINGS$AGENT_SERVER_UNAVAILABLE_STATUS_TITLE":+ "We couldn't reach the configured server",+ "SETTINGS$AGENT_SERVER_UNAVAILABLE_STATUS_MESSAGE":+ "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "SETTINGS$AGENT_SERVER_UNKNOWN_VERSION_STATUS_TITLE":+ "We couldn't confirm the server version",+ "SETTINGS$AGENT_SERVER_UNKNOWN_VERSION_STATUS_MESSAGE":+ "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "SETTINGS$AGENT_SERVER_OPEN_SETTINGS_PAGE": "Open full settings page",+ "SETTINGS$AGENT_SERVER_SETUP_GUIDE_HINT":+ "If you need help starting or upgrading the server, see the",+ "SETTINGS$AGENT_SERVER_SETUP_GUIDE_LINK": "setup instructions",+ "SETTINGS$AGENT_SERVER_DETECTED_VERSION": "Detected version: {{version}}",+ "SETTINGS$AGENT_SERVER_DETAILS_LABEL": "Details: {{details}}",+ "SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_TITLE": "Connection details",+ "SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_DESCRIPTION":+ "Paste the agent server URL and optional session API key that this GUI should use.",+ "SETTINGS$AGENT_SERVER_URL": "Agent server URL",+ "SETTINGS$AGENT_SERVER_URL_PLACEHOLDER": "https://agent.example.com",+ "SETTINGS$AGENT_SERVER_API_KEY": "Session API key",+ "SETTINGS$AGENT_SERVER_API_KEY_PLACEHOLDER":+ "Enter the X-Session-API-Key value",+ "SETTINGS$AGENT_SERVER_BROWSER_ONLY_NOTE":+ "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "SETTINGS$AGENT_SERVER_RETRY_CONNECTION": "Retry connection",+ "SETTINGS$SAVE_AND_RECONNECT": "Save and reconnect",+ "SETTINGS$AGENT_SERVER_STEP_LABEL": "Step {{step}}",+ "SETTINGS$AGENT_SERVER_STEP_UPGRADE_TITLE": "Upgrade to {{minimumVersion}}+",+ "SETTINGS$AGENT_SERVER_STEP_UPGRADE_DESCRIPTION":+ "Update the connected agent server so it exposes the APIs this GUI expects.",+ "SETTINGS$AGENT_SERVER_STEP_URL_TITLE": "Enter its URL",+ "SETTINGS$AGENT_SERVER_STEP_URL_DESCRIPTION":+ "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "SETTINGS$AGENT_SERVER_STEP_RECONNECT_TITLE": "Reconnect the GUI",+ "SETTINGS$AGENT_SERVER_STEP_RECONNECT_DESCRIPTION":+ "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "SETTINGS$AGENT_SERVER_STEP_START_TITLE": "Start a compatible server",+ "SETTINGS$AGENT_SERVER_STEP_START_DESCRIPTION":+ "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "SETTINGS$AGENT_SERVER_STEP_SAVE_TITLE": "Save and reconnect",+ "SETTINGS$AGENT_SERVER_STEP_SAVE_DESCRIPTION":+ "We'll store your choice in this browser and reconnect right away.",+ "COMMON$OPTIONAL": "Optional",+};++vi.mock("react-i18next", () => ({+ useTranslation: () => ({+ t: (key: string, options?: Record<string, string | number>) => {+ let value = TRANSLATIONS[key] ?? key;+ for (const [optionKey, optionValue] of Object.entries(options ?? {})) {+ value = value.replaceAll(`{{${optionKey}}}`, String(optionValue));+ }+ return value;+ },+ }),+}));+const RouterStub = createRoutesStub([{Component: App,@@ -44,7 +114,7 @@ const renderApp = (initialEntries: string[] = ["/"]) =>});describe("App root compatibility guard", () => {- it("blocks the app on any page when the connected agent server version is too old", async () => {+ it("shows a friendlier upgrade flow when the connected agent server is too old", async () => {server.use(http.get("/server_info", () =>HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.16.1" }),@@ -54,24 +124,25 @@ describe("App root compatibility guard", () => {renderApp(["/"]);await waitFor(() => {- expect(- screen.getByTestId("agent-server-incompatibility-warning"),- ).toBeInTheDocument();+ expect(screen.getByTestId("agent-server-upgrade-screen")).toBeInTheDocument();});expect(- screen.getByText(/unsupported agent server version/i),+ screen.getByRole("heading", { name: /update your agent server/i }),).toBeInTheDocument();- expect(screen.getAllByText(/1\.16\.1/)).toHaveLength(2);expect(- screen.getByText(- new RegExp(`${MINIMUM_SUPPORTED_AGENT_SERVER_VERSION} or newer`),- ),+ screen.getByText(/detected version: 1\.16\.1/i),).toBeInTheDocument();+ expect(+ screen.getAllByText(+ new RegExp(`${MINIMUM_SUPPORTED_AGENT_SERVER_VERSION} or newer`),+ ).length,+ ).toBeGreaterThan(0);+ expect(screen.queryByText(/connection blocked/i)).not.toBeInTheDocument();expect(screen.queryByTestId("app-outlet")).not.toBeInTheDocument();});- it("fails fast with an agent server not found warning when the backend is unreachable", async () => {+ it("shows the onboarding flow when the backend is unreachable", async () => {let serverInfoRequests = 0;server.use(@@ -85,17 +156,53 @@ describe("App root compatibility guard", () => {await waitFor(() => {expect(- screen.getByTestId("agent-server-unavailable-warning"),+ screen.getByTestId("agent-server-onboarding-screen"),).toBeInTheDocument();});expect(- screen.getByRole("heading", { name: /agent server not found/i }),+ screen.getByRole("heading", { name: /connect to your agent server/i }),).toBeInTheDocument();+ expect(+ screen.getByRole("link", { name: /setup instructions/i }),+ ).toHaveAttribute("href", "https://github.com/OpenHands/agent-server-gui");+ expect(screen.queryByText(/step 1/i)).not.toBeInTheDocument();+ expect(+ screen.queryByRole("link", { name: /open full settings page/i }),+ ).not.toBeInTheDocument();expect(serverInfoRequests).toBe(1);+ expect(screen.queryByText(/connection blocked/i)).not.toBeInTheDocument();expect(screen.queryByTestId("app-outlet")).not.toBeInTheDocument();});+ it("shows the onboarding flow when the server version cannot be determined", async () => {+ server.use(+ http.get("/server_info", () =>+ HttpResponse.json({ uptime: 0, idle_time: 0 }),+ ),+ );++ renderApp(["/"]);++ await waitFor(() => {+ expect(+ screen.getByTestId("agent-server-onboarding-screen"),+ ).toBeInTheDocument();+ });++ expect(+ screen.getByText(/we couldn't confirm the server version/i),+ ).toBeInTheDocument();+ expect(+ screen.getAllByText(+ new RegExp(`${MINIMUM_SUPPORTED_AGENT_SERVER_VERSION} or newer`),+ ).length,+ ).toBeGreaterThan(0);+ expect(+ screen.queryByText(/unsupported agent server version/i),+ ).not.toBeInTheDocument();+ });+it("renders the routed page when the agent server is compatible", async () => {renderApp(["/"]);@@ -104,8 +211,9 @@ describe("App root compatibility guard", () => {});expect(- screen.queryByTestId("agent-server-incompatibility-warning"),+ screen.queryByTestId("agent-server-onboarding-screen"),).not.toBeInTheDocument();+ expect(screen.queryByTestId("agent-server-upgrade-screen")).not.toBeInTheDocument();});it("still allows the agent server settings route when the backend is unreachable", async () => {@@ -120,7 +228,7 @@ describe("App root compatibility guard", () => {});expect(- screen.queryByTestId("agent-server-unavailable-warning"),+ screen.queryByTestId("agent-server-onboarding-screen"),).not.toBeInTheDocument();});});diff --git a/__tests__/routes/agent-server-settings.test.tsx b/__tests__/routes/agent-server-settings.test.tsxindex 867ed218c4..d050fc2ae5 100644--- a/__tests__/routes/agent-server-settings.test.tsx+++ b/__tests__/routes/agent-server-settings.test.tsx@@ -4,6 +4,48 @@ import { afterEach, describe, expect, it, vi } from "vitest";import AgentServerSettingsScreen from "#/routes/agent-server-settings";import { AGENT_SERVER_CONFIG_STORAGE_KEY } from "#/api/agent-server-config";+const TRANSLATIONS: Record<string, string> = {+ "SETTINGS$AGENT_SERVER_ONBOARDING_EYEBROW": "Get started",+ "SETTINGS$AGENT_SERVER_SETTINGS_TITLE": "Agent server connection",+ "SETTINGS$AGENT_SERVER_DESCRIPTION":+ "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_TITLE": "Connection details",+ "SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_DESCRIPTION":+ "Paste the agent server URL and optional session API key that this GUI should use.",+ "SETTINGS$AGENT_SERVER_URL": "Agent server URL",+ "SETTINGS$AGENT_SERVER_URL_PLACEHOLDER": "https://agent.example.com",+ "SETTINGS$AGENT_SERVER_API_KEY": "Session API key",+ "SETTINGS$AGENT_SERVER_API_KEY_PLACEHOLDER":+ "Enter the X-Session-API-Key value",+ "SETTINGS$AGENT_SERVER_BROWSER_ONLY_NOTE":+ "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "SETTINGS$AGENT_SERVER_RETRY_CONNECTION": "Retry connection",+ "SETTINGS$SAVE_AND_RECONNECT": "Save and reconnect",+ "SETTINGS$AGENT_SERVER_STEP_LABEL": "Step {{step}}",+ "SETTINGS$AGENT_SERVER_STEP_START_TITLE": "Start a compatible server",+ "SETTINGS$AGENT_SERVER_STEP_START_DESCRIPTION":+ "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "SETTINGS$AGENT_SERVER_STEP_URL_TITLE": "Enter its URL",+ "SETTINGS$AGENT_SERVER_STEP_URL_DESCRIPTION":+ "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "SETTINGS$AGENT_SERVER_STEP_SAVE_TITLE": "Save and reconnect",+ "SETTINGS$AGENT_SERVER_STEP_SAVE_DESCRIPTION":+ "We'll store your choice in this browser and reconnect right away.",+ "COMMON$OPTIONAL": "Optional",+};++vi.mock("react-i18next", () => ({+ useTranslation: () => ({+ t: (key: string, options?: Record<string, string | number>) => {+ let value = TRANSLATIONS[key] ?? key;+ for (const [optionKey, optionValue] of Object.entries(options ?? {})) {+ value = value.replaceAll(`{{${optionKey}}}`, String(optionValue));+ }+ return value;+ },+ }),+}));+const ORIGINAL_LOCATION = window.location;function mockWindowLocation(url: string, assign = vi.fn()) {@@ -28,18 +70,28 @@ afterEach(() => {});describe("AgentServerSettingsScreen", () => {- it("prefills values from environment defaults", async () => {+ it("renders the simplified settings-style form and prefills environment defaults", async () => {vi.stubEnv("VITE_BACKEND_BASE_URL", "https://env-agent.example.com/");vi.stubEnv("VITE_SESSION_API_KEY", "env-session-key");render(<AgentServerSettingsScreen />);+ expect(+ screen.getByRole("heading", { name: /agent server connection/i }),+ ).toBeInTheDocument();expect(await screen.findByTestId("agent-server-url-input")).toHaveValue("https://env-agent.example.com",);expect(screen.getByTestId("agent-server-api-key-input")).toHaveValue("env-session-key",);+ expect(+ screen.getByRole("button", { name: /retry connection/i }),+ ).toBeInTheDocument();+ expect(screen.queryByTestId("agent-server-checklist")).not.toBeInTheDocument();+ expect(+ screen.queryByText(/connection details/i),+ ).not.toBeInTheDocument();});it("saves agent server settings locally and reconnects", async () => {@@ -65,4 +117,18 @@ describe("AgentServerSettingsScreen", () => {);expect(assignMock).toHaveBeenCalledWith("/");});++ it("lets users retry the connection without editing settings", async () => {+ const assignMock = mockWindowLocation(+ "https://gui.example.com/settings/agent-server",+ );++ render(<AgentServerSettingsScreen />);++ const user = userEvent.setup();+ await user.click(screen.getByRole("button", { name: /retry connection/i }));++ expect(assignMock).toHaveBeenCalledWith("/");+ expect(screen.getByTestId("submit-button")).toBeDisabled();+ });});diff --git a/src/components/features/settings/agent-server-onboarding.tsx b/src/components/features/settings/agent-server-onboarding.tsxnew file mode 100644index 0000000000..4331e55794--- /dev/null+++ b/src/components/features/settings/agent-server-onboarding.tsx@@ -0,0 +1,201 @@+import React from "react";+import { RefreshCw } from "lucide-react";+import { useTranslation } from "react-i18next";+import {+ getAgentServerFormDefaults,+ saveAgentServerConfig,+} from "#/api/agent-server-config";+import { MINIMUM_SUPPORTED_AGENT_SERVER_VERSION } from "#/api/agent-server-compatibility";+import { cn } from "#/utils/utils";+import { BrandButton } from "./brand-button";+import { SettingsInput } from "./settings-input";++type AgentServerChecklistVariant = "connect" | "upgrade";+type AgentServerConnectionFormVariant = "settings" | "onboarding";++interface AgentServerConnectionFormProps {+ className?: string;+ formClassName?: string;+ variant?: AgentServerConnectionFormVariant;+ showSectionHeader?: boolean;+}++interface AgentServerChecklistProps {+ className?: string;+ variant?: AgentServerChecklistVariant;+}++export function AgentServerConnectionForm({+ className,+ formClassName,+ variant = "onboarding",+ showSectionHeader,+}: AgentServerConnectionFormProps) {+ const { t } = useTranslation();+ const defaults = React.useMemo(() => getAgentServerFormDefaults(), []);+ const [baseUrl, setBaseUrl] = React.useState(defaults.baseUrl);+ const [sessionApiKey, setSessionApiKey] = React.useState(+ defaults.sessionApiKey,+ );++ const formIsClean =+ baseUrl === defaults.baseUrl && sessionApiKey === defaults.sessionApiKey;+ const isOnboarding = variant === "onboarding";+ const shouldShowSectionHeader = showSectionHeader ?? isOnboarding;++ const reconnect = () => {+ window.location.assign("/");+ };++ const onSubmit = (event: React.FormEvent<HTMLFormElement>) => {+ event.preventDefault();++ saveAgentServerConfig({+ baseUrl,+ sessionApiKey,+ });++ reconnect();+ };++ return (+ <form+ data-testid="agent-server-connection-form"+ onSubmit={onSubmit}+ className={cn("flex h-full flex-col", className)}+ >+ <div+ className={cn(+ "flex flex-col gap-5",+ isOnboarding &&+ "rounded-3xl border border-white/10 bg-neutral-950/80 p-6 shadow-2xl",+ formClassName,+ )}+ >+ {shouldShowSectionHeader ? (+ <div>+ <p className="text-sm font-medium uppercase tracking-[0.24em] text-primary">+ {t("SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_TITLE")}+ </p>+ <p className="mt-3 max-w-[680px] text-sm leading-7 text-gray-400">+ {t("SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_DESCRIPTION")}+ </p>+ </div>+ ) : null}++ <SettingsInput+ testId="agent-server-url-input"+ name="agent-server-url-input"+ type="text"+ label={t("SETTINGS$AGENT_SERVER_URL")}+ value={baseUrl}+ onChange={setBaseUrl}+ placeholder={t("SETTINGS$AGENT_SERVER_URL_PLACEHOLDER")}+ className="w-full max-w-[680px]"+ />++ <SettingsInput+ testId="agent-server-api-key-input"+ name="agent-server-api-key-input"+ type="password"+ label={t("SETTINGS$AGENT_SERVER_API_KEY")}+ value={sessionApiKey}+ onChange={setSessionApiKey}+ placeholder={t("SETTINGS$AGENT_SERVER_API_KEY_PLACEHOLDER")}+ showOptionalTag+ className="w-full max-w-[680px]"+ />++ <p className="max-w-[680px] text-xs leading-6 text-gray-500">+ {t("SETTINGS$AGENT_SERVER_BROWSER_ONLY_NOTE")}+ </p>+ </div>++ <div className="mt-6 flex flex-wrap gap-3">+ <BrandButton+ testId="retry-connection-button"+ variant="secondary"+ type="button"+ onClick={reconnect}+ startContent={<RefreshCw className="size-4" />}+ >+ {t("SETTINGS$AGENT_SERVER_RETRY_CONNECTION")}+ </BrandButton>+ <BrandButton+ testId="submit-button"+ variant="primary"+ type="submit"+ isDisabled={formIsClean}+ >+ {t("SETTINGS$SAVE_AND_RECONNECT")}+ </BrandButton>+ </div>+ </form>+ );+}++export function AgentServerChecklist({+ className,+ variant = "connect",+}: AgentServerChecklistProps) {+ const { t } = useTranslation();++ const steps =+ variant === "upgrade"+ ? [+ {+ title: t("SETTINGS$AGENT_SERVER_STEP_UPGRADE_TITLE", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ }),+ description: t("SETTINGS$AGENT_SERVER_STEP_UPGRADE_DESCRIPTION", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ }),+ },+ {+ title: t("SETTINGS$AGENT_SERVER_STEP_URL_TITLE"),+ description: t("SETTINGS$AGENT_SERVER_STEP_URL_DESCRIPTION"),+ },+ {+ title: t("SETTINGS$AGENT_SERVER_STEP_RECONNECT_TITLE"),+ description: t("SETTINGS$AGENT_SERVER_STEP_RECONNECT_DESCRIPTION"),+ },+ ]+ : [+ {+ title: t("SETTINGS$AGENT_SERVER_STEP_START_TITLE", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ }),+ description: t("SETTINGS$AGENT_SERVER_STEP_START_DESCRIPTION", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ }),+ },+ {+ title: t("SETTINGS$AGENT_SERVER_STEP_URL_TITLE"),+ description: t("SETTINGS$AGENT_SERVER_STEP_URL_DESCRIPTION"),+ },+ {+ title: t("SETTINGS$AGENT_SERVER_STEP_SAVE_TITLE"),+ description: t("SETTINGS$AGENT_SERVER_STEP_SAVE_DESCRIPTION"),+ },+ ];++ return (+ <ol+ data-testid="agent-server-checklist"+ className={cn(+ "list-decimal space-y-3 pl-5 text-sm text-gray-400 marker:text-gray-500",+ className,+ )}+ >+ {steps.map(({ title, description }, index) => (+ <li key={title} className="pl-1">+ <p className="text-xs font-medium uppercase tracking-[0.22em] text-gray-500">+ {t("SETTINGS$AGENT_SERVER_STEP_LABEL", { step: index + 1 })}+ </p>+ <p className="mt-1 font-semibold text-white">{title}</p>+ <p className="mt-1 leading-6">{description}</p>+ </li>+ ))}+ </ol>+ );+}diff --git a/src/components/providers/posthog-wrapper.tsx b/src/components/providers/posthog-wrapper.tsxindex 3a058dc72e..4efd07df69 100644--- a/src/components/providers/posthog-wrapper.tsx+++ b/src/components/providers/posthog-wrapper.tsx@@ -3,7 +3,6 @@ import { useQueryClient } from "@tanstack/react-query";import { PostHogProvider } from "posthog-js/react";import OptionService from "#/api/option-service/option-service.api";import { QUERY_KEYS, CONFIG_CACHE_OPTIONS } from "#/hooks/query/query-keys";-import { displayErrorToast } from "#/utils/custom-toast-handlers";const POSTHOG_BOOTSTRAP_KEY = "posthog_bootstrap";@@ -54,11 +53,12 @@ export function PostHogWrapper({ children }: { children: React.ReactNode }) {const config = await queryClient.fetchQuery({queryKey: QUERY_KEYS.WEB_CLIENT_CONFIG,queryFn: OptionService.getConfig,+ meta: { disableToast: true },...CONFIG_CACHE_OPTIONS,});setPosthogClientKey(config.posthog_client_key);} catch {- displayErrorToast("Error fetching PostHog client key");+ // Analytics are optional; keep onboarding and recovery flows quiet.} finally {setIsLoading(false);}diff --git a/src/hooks/use-is-on-intermediate-page.ts b/src/hooks/use-is-on-intermediate-page.tsindex a51731bf2f..5e82ea9fb7 100644--- a/src/hooks/use-is-on-intermediate-page.ts+++ b/src/hooks/use-is-on-intermediate-page.ts@@ -1,6 +1,6 @@import { useLocation } from "react-router";-const INTERMEDIATE_PAGE_PATHS: string[] = [];+const INTERMEDIATE_PAGE_PATHS = ["/settings/agent-server"] as const;/*** Checks if the current page is an intermediate page.diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex fc367e5124..3f7bdd9c09 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -5797,21 +5797,21 @@"ca": "Configura el nom d'usuari i el correu electrònic que OpenHands utilitza per confirmar els canvis."},"SETTINGS$AGENT_SERVER_DESCRIPTION": {- "en": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "ja": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "zh-CN": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "zh-TW": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "ko-KR": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "de": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "no": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "it": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "pt": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "es": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "ar": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "fr": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "tr": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "uk": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values.",- "ca": "Set the agent server URL and optional session API key that this GUI should use. Deployment defaults appear here automatically until you save different values."+ "en": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "ja": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "zh-CN": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "zh-TW": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "ko-KR": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "no": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "it": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "pt": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "es": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "ar": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "fr": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "tr": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "de": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "uk": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them.",+ "ca": "Set the agent server URL and optional session API key that this GUI should use. Start or choose a compatible server, then save here to reconnect. Deployment defaults appear automatically until you override them."},"SETTINGS$AGENT_SERVER_URL": {"en": "Agent server URL",@@ -5881,6 +5881,568 @@"uk": "Enter the X-Session-API-Key value","ca": "Enter the X-Session-API-Key value"},+ "SETTINGS$AGENT_SERVER_BROWSER_ONLY_NOTE": {+ "en": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "ja": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "zh-CN": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "zh-TW": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "ko-KR": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "no": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "it": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "pt": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "es": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "ar": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "fr": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "tr": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "de": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "uk": "Saved only in this browser. Deployment defaults stay available until you override them here.",+ "ca": "Saved only in this browser. Deployment defaults stay available until you override them here."+ },+ "SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_TITLE": {+ "en": "Connection details",+ "ja": "Connection details",+ "zh-CN": "Connection details",+ "zh-TW": "Connection details",+ "ko-KR": "Connection details",+ "no": "Connection details",+ "it": "Connection details",+ "pt": "Connection details",+ "es": "Connection details",+ "ar": "Connection details",+ "fr": "Connection details",+ "tr": "Connection details",+ "de": "Connection details",+ "uk": "Connection details",+ "ca": "Connection details"+ },+ "SETTINGS$AGENT_SERVER_CONNECTION_DETAILS_DESCRIPTION": {+ "en": "Paste the agent server URL and optional session API key that this GUI should use.",+ "ja": "Paste the agent server URL and optional session API key that this GUI should use.",+ "zh-CN": "Paste the agent server URL and optional session API key that this GUI should use.",+ "zh-TW": "Paste the agent server URL and optional session API key that this GUI should use.",+ "ko-KR": "Paste the agent server URL and optional session API key that this GUI should use.",+ "no": "Paste the agent server URL and optional session API key that this GUI should use.",+ "it": "Paste the agent server URL and optional session API key that this GUI should use.",+ "pt": "Paste the agent server URL and optional session API key that this GUI should use.",+ "es": "Paste the agent server URL and optional session API key that this GUI should use.",+ "ar": "Paste the agent server URL and optional session API key that this GUI should use.",+ "fr": "Paste the agent server URL and optional session API key that this GUI should use.",+ "tr": "Paste the agent server URL and optional session API key that this GUI should use.",+ "de": "Paste the agent server URL and optional session API key that this GUI should use.",+ "uk": "Paste the agent server URL and optional session API key that this GUI should use.",+ "ca": "Paste the agent server URL and optional session API key that this GUI should use."+ },+ "SETTINGS$AGENT_SERVER_RETRY_CONNECTION": {+ "en": "Retry connection",+ "ja": "Retry connection",+ "zh-CN": "Retry connection",+ "zh-TW": "Retry connection",+ "ko-KR": "Retry connection",+ "no": "Retry connection",+ "it": "Retry connection",+ "pt": "Retry connection",+ "es": "Retry connection",+ "ar": "Retry connection",+ "fr": "Retry connection",+ "tr": "Retry connection",+ "de": "Retry connection",+ "uk": "Retry connection",+ "ca": "Retry connection"+ },+ "SETTINGS$AGENT_SERVER_STEP_LABEL": {+ "en": "Step {{step}}",+ "ja": "Step {{step}}",+ "zh-CN": "Step {{step}}",+ "zh-TW": "Step {{step}}",+ "ko-KR": "Step {{step}}",+ "no": "Step {{step}}",+ "it": "Step {{step}}",+ "pt": "Step {{step}}",+ "es": "Step {{step}}",+ "ar": "Step {{step}}",+ "fr": "Step {{step}}",+ "tr": "Step {{step}}",+ "de": "Step {{step}}",+ "uk": "Step {{step}}",+ "ca": "Step {{step}}"+ },+ "SETTINGS$AGENT_SERVER_STEP_START_TITLE": {+ "en": "Start a compatible server",+ "ja": "Start a compatible server",+ "zh-CN": "Start a compatible server",+ "zh-TW": "Start a compatible server",+ "ko-KR": "Start a compatible server",+ "no": "Start a compatible server",+ "it": "Start a compatible server",+ "pt": "Start a compatible server",+ "es": "Start a compatible server",+ "ar": "Start a compatible server",+ "fr": "Start a compatible server",+ "tr": "Start a compatible server",+ "de": "Start a compatible server",+ "uk": "Start a compatible server",+ "ca": "Start a compatible server"+ },+ "SETTINGS$AGENT_SERVER_STEP_START_DESCRIPTION": {+ "en": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "ja": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "zh-CN": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "zh-TW": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "ko-KR": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "no": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "it": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "pt": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "es": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "ar": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "fr": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "tr": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "de": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "uk": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage.",+ "ca": "Run an agent server version {{minimumVersion}} or newer locally, or use a remote deployment you already manage."+ },+ "SETTINGS$AGENT_SERVER_STEP_URL_TITLE": {+ "en": "Enter its URL",+ "ja": "Enter its URL",+ "zh-CN": "Enter its URL",+ "zh-TW": "Enter its URL",+ "ko-KR": "Enter its URL",+ "no": "Enter its URL",+ "it": "Enter its URL",+ "pt": "Enter its URL",+ "es": "Enter its URL",+ "ar": "Enter its URL",+ "fr": "Enter its URL",+ "tr": "Enter its URL",+ "de": "Enter its URL",+ "uk": "Enter its URL",+ "ca": "Enter its URL"+ },+ "SETTINGS$AGENT_SERVER_STEP_URL_DESCRIPTION": {+ "en": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "ja": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "zh-CN": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "zh-TW": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "ko-KR": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "no": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "it": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "pt": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "es": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "ar": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "fr": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "tr": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "de": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "uk": "Use the address where this browser can reach the server, such as https://agent.example.com.",+ "ca": "Use the address where this browser can reach the server, such as https://agent.example.com."+ },+ "SETTINGS$AGENT_SERVER_STEP_SAVE_TITLE": {+ "en": "Save and reconnect",+ "ja": "Save and reconnect",+ "zh-CN": "Save and reconnect",+ "zh-TW": "Save and reconnect",+ "ko-KR": "Save and reconnect",+ "no": "Save and reconnect",+ "it": "Save and reconnect",+ "pt": "Save and reconnect",+ "es": "Save and reconnect",+ "ar": "Save and reconnect",+ "fr": "Save and reconnect",+ "tr": "Save and reconnect",+ "de": "Save and reconnect",+ "uk": "Save and reconnect",+ "ca": "Save and reconnect"+ },+ "SETTINGS$AGENT_SERVER_STEP_SAVE_DESCRIPTION": {+ "en": "We'll store your choice in this browser and reconnect right away.",+ "ja": "We'll store your choice in this browser and reconnect right away.",+ "zh-CN": "We'll store your choice in this browser and reconnect right away.",+ "zh-TW": "We'll store your choice in this browser and reconnect right away.",+ "ko-KR": "We'll store your choice in this browser and reconnect right away.",+ "no": "We'll store your choice in this browser and reconnect right away.",+ "it": "We'll store your choice in this browser and reconnect right away.",+ "pt": "We'll store your choice in this browser and reconnect right away.",+ "es": "We'll store your choice in this browser and reconnect right away.",+ "ar": "We'll store your choice in this browser and reconnect right away.",+ "fr": "We'll store your choice in this browser and reconnect right away.",+ "tr": "We'll store your choice in this browser and reconnect right away.",+ "de": "We'll store your choice in this browser and reconnect right away.",+ "uk": "We'll store your choice in this browser and reconnect right away.",+ "ca": "We'll store your choice in this browser and reconnect right away."+ },+ "SETTINGS$AGENT_SERVER_STEP_UPGRADE_TITLE": {+ "en": "Upgrade to {{minimumVersion}}+",+ "ja": "Upgrade to {{minimumVersion}}+",+ "zh-CN": "Upgrade to {{minimumVersion}}+",+ "zh-TW": "Upgrade to {{minimumVersion}}+",+ "ko-KR": "Upgrade to {{minimumVersion}}+",+ "no": "Upgrade to {{minimumVersion}}+",+ "it": "Upgrade to {{minimumVersion}}+",+ "pt": "Upgrade to {{minimumVersion}}+",+ "es": "Upgrade to {{minimumVersion}}+",+ "ar": "Upgrade to {{minimumVersion}}+",+ "fr": "Upgrade to {{minimumVersion}}+",+ "tr": "Upgrade to {{minimumVersion}}+",+ "de": "Upgrade to {{minimumVersion}}+",+ "uk": "Upgrade to {{minimumVersion}}+",+ "ca": "Upgrade to {{minimumVersion}}+"+ },+ "SETTINGS$AGENT_SERVER_STEP_UPGRADE_DESCRIPTION": {+ "en": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "ja": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "zh-CN": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "zh-TW": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "ko-KR": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "no": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "it": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "pt": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "es": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "ar": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "fr": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "tr": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "de": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "uk": "Update the connected agent server so it exposes the APIs this GUI expects.",+ "ca": "Update the connected agent server so it exposes the APIs this GUI expects."+ },+ "SETTINGS$AGENT_SERVER_STEP_RECONNECT_TITLE": {+ "en": "Reconnect the GUI",+ "ja": "Reconnect the GUI",+ "zh-CN": "Reconnect the GUI",+ "zh-TW": "Reconnect the GUI",+ "ko-KR": "Reconnect the GUI",+ "no": "Reconnect the GUI",+ "it": "Reconnect the GUI",+ "pt": "Reconnect the GUI",+ "es": "Reconnect the GUI",+ "ar": "Reconnect the GUI",+ "fr": "Reconnect the GUI",+ "tr": "Reconnect the GUI",+ "de": "Reconnect the GUI",+ "uk": "Reconnect the GUI",+ "ca": "Reconnect the GUI"+ },+ "SETTINGS$AGENT_SERVER_STEP_RECONNECT_DESCRIPTION": {+ "en": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "ja": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "zh-CN": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "zh-TW": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "ko-KR": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "no": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "it": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "pt": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "es": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "ar": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "fr": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "tr": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "de": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "uk": "Retry once the server is upgraded, or point this browser at a newer deployment.",+ "ca": "Retry once the server is upgraded, or point this browser at a newer deployment."+ },+ "SETTINGS$AGENT_SERVER_ONBOARDING_EYEBROW": {+ "en": "Get started",+ "ja": "Get started",+ "zh-CN": "Get started",+ "zh-TW": "Get started",+ "ko-KR": "Get started",+ "no": "Get started",+ "it": "Get started",+ "pt": "Get started",+ "es": "Get started",+ "ar": "Get started",+ "fr": "Get started",+ "tr": "Get started",+ "de": "Get started",+ "uk": "Get started",+ "ca": "Get started"+ },+ "SETTINGS$AGENT_SERVER_ONBOARDING_TITLE": {+ "en": "Connect to your agent server",+ "ja": "Connect to your agent server",+ "zh-CN": "Connect to your agent server",+ "zh-TW": "Connect to your agent server",+ "ko-KR": "Connect to your agent server",+ "no": "Connect to your agent server",+ "it": "Connect to your agent server",+ "pt": "Connect to your agent server",+ "es": "Connect to your agent server",+ "ar": "Connect to your agent server",+ "fr": "Connect to your agent server",+ "tr": "Connect to your agent server",+ "de": "Connect to your agent server",+ "uk": "Connect to your agent server",+ "ca": "Connect to your agent server"+ },+ "SETTINGS$AGENT_SERVER_ONBOARDING_DESCRIPTION": {+ "en": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "ja": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "zh-CN": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "zh-TW": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "ko-KR": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "no": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "it": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "pt": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "es": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "ar": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "fr": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "tr": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "de": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "uk": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here.",+ "ca": "This GUI needs an agent server before it can load conversations, tools, and settings. Start or choose a compatible server, then connect it here."+ },+ "SETTINGS$AGENT_SERVER_SETTINGS_TITLE": {+ "en": "Agent server connection",+ "ja": "Agent server connection",+ "zh-CN": "Agent server connection",+ "zh-TW": "Agent server connection",+ "ko-KR": "Agent server connection",+ "no": "Agent server connection",+ "it": "Agent server connection",+ "pt": "Agent server connection",+ "es": "Agent server connection",+ "ar": "Agent server connection",+ "fr": "Agent server connection",+ "tr": "Agent server connection",+ "de": "Agent server connection",+ "uk": "Agent server connection",+ "ca": "Agent server connection"+ },+ "SETTINGS$AGENT_SERVER_UNAVAILABLE_STATUS_TITLE": {+ "en": "We couldn't reach the configured server",+ "ja": "We couldn't reach the configured server",+ "zh-CN": "We couldn't reach the configured server",+ "zh-TW": "We couldn't reach the configured server",+ "ko-KR": "We couldn't reach the configured server",+ "no": "We couldn't reach the configured server",+ "it": "We couldn't reach the configured server",+ "pt": "We couldn't reach the configured server",+ "es": "We couldn't reach the configured server",+ "ar": "We couldn't reach the configured server",+ "fr": "We couldn't reach the configured server",+ "tr": "We couldn't reach the configured server",+ "de": "We couldn't reach the configured server",+ "uk": "We couldn't reach the configured server",+ "ca": "We couldn't reach the configured server"+ },+ "SETTINGS$AGENT_SERVER_UNAVAILABLE_STATUS_MESSAGE": {+ "en": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "ja": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "zh-CN": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "zh-TW": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "ko-KR": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "no": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "it": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "pt": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "es": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "ar": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "fr": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "tr": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "de": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "uk": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment.",+ "ca": "Check the URL, confirm the server is running, and try again. You can also point this GUI at a different deployment."+ },+ "SETTINGS$AGENT_SERVER_UNKNOWN_VERSION_STATUS_TITLE": {+ "en": "We couldn't confirm the server version",+ "ja": "We couldn't confirm the server version",+ "zh-CN": "We couldn't confirm the server version",+ "zh-TW": "We couldn't confirm the server version",+ "ko-KR": "We couldn't confirm the server version",+ "no": "We couldn't confirm the server version",+ "it": "We couldn't confirm the server version",+ "pt": "We couldn't confirm the server version",+ "es": "We couldn't confirm the server version",+ "ar": "We couldn't confirm the server version",+ "fr": "We couldn't confirm the server version",+ "tr": "We couldn't confirm the server version",+ "de": "We couldn't confirm the server version",+ "uk": "We couldn't confirm the server version",+ "ca": "We couldn't confirm the server version"+ },+ "SETTINGS$AGENT_SERVER_UNKNOWN_VERSION_STATUS_MESSAGE": {+ "en": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "ja": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "zh-CN": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "zh-TW": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "ko-KR": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "no": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "it": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "pt": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "es": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "ar": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "fr": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "tr": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "de": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "uk": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server.",+ "ca": "We reached something at that URL, but it did not identify itself as an agent server version {{minimumVersion}} or newer. Double-check the URL or upgrade the server."+ },+ "SETTINGS$AGENT_SERVER_UPGRADE_EYEBROW": {+ "en": "Upgrade required",+ "ja": "Upgrade required",+ "zh-CN": "Upgrade required",+ "zh-TW": "Upgrade required",+ "ko-KR": "Upgrade required",+ "no": "Upgrade required",+ "it": "Upgrade required",+ "pt": "Upgrade required",+ "es": "Upgrade required",+ "ar": "Upgrade required",+ "fr": "Upgrade required",+ "tr": "Upgrade required",+ "de": "Upgrade required",+ "uk": "Upgrade required",+ "ca": "Upgrade required"+ },+ "SETTINGS$AGENT_SERVER_UPGRADE_TITLE": {+ "en": "Update your agent server",+ "ja": "Update your agent server",+ "zh-CN": "Update your agent server",+ "zh-TW": "Update your agent server",+ "ko-KR": "Update your agent server",+ "no": "Update your agent server",+ "it": "Update your agent server",+ "pt": "Update your agent server",+ "es": "Update your agent server",+ "ar": "Update your agent server",+ "fr": "Update your agent server",+ "tr": "Update your agent server",+ "de": "Update your agent server",+ "uk": "Update your agent server",+ "ca": "Update your agent server"+ },+ "SETTINGS$AGENT_SERVER_UPGRADE_DESCRIPTION": {+ "en": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "ja": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "zh-CN": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "zh-TW": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "ko-KR": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "no": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "it": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "pt": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "es": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "ar": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "fr": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "tr": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "de": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "uk": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment.",+ "ca": "This GUI can only connect to agent server version {{minimumVersion}} or newer. Upgrade the server or point this GUI at a newer deployment."+ },+ "SETTINGS$AGENT_SERVER_UPGRADE_STATUS_TITLE": {+ "en": "The connected server is too old",+ "ja": "The connected server is too old",+ "zh-CN": "The connected server is too old",+ "zh-TW": "The connected server is too old",+ "ko-KR": "The connected server is too old",+ "no": "The connected server is too old",+ "it": "The connected server is too old",+ "pt": "The connected server is too old",+ "es": "The connected server is too old",+ "ar": "The connected server is too old",+ "fr": "The connected server is too old",+ "tr": "The connected server is too old",+ "de": "The connected server is too old",+ "uk": "The connected server is too old",+ "ca": "The connected server is too old"+ },+ "SETTINGS$AGENT_SERVER_UPGRADE_STATUS_MESSAGE": {+ "en": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "ja": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "zh-CN": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "zh-TW": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "ko-KR": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "no": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "it": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "pt": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "es": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "ar": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "fr": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "tr": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "de": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "uk": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form.",+ "ca": "Upgrade this agent server to version {{minimumVersion}} or newer, or switch to another deployment from the connection form."+ },+ "SETTINGS$AGENT_SERVER_OPEN_SETTINGS_PAGE": {+ "en": "Open full settings page",+ "ja": "Open full settings page",+ "zh-CN": "Open full settings page",+ "zh-TW": "Open full settings page",+ "ko-KR": "Open full settings page",+ "no": "Open full settings page",+ "it": "Open full settings page",+ "pt": "Open full settings page",+ "es": "Open full settings page",+ "ar": "Open full settings page",+ "fr": "Open full settings page",+ "tr": "Open full settings page",+ "de": "Open full settings page",+ "uk": "Open full settings page",+ "ca": "Open full settings page"+ },+ "SETTINGS$AGENT_SERVER_SETUP_GUIDE_HINT": {+ "en": "If you need help starting or upgrading the server, see the",+ "ja": "If you need help starting or upgrading the server, see the",+ "zh-CN": "If you need help starting or upgrading the server, see the",+ "zh-TW": "If you need help starting or upgrading the server, see the",+ "ko-KR": "If you need help starting or upgrading the server, see the",+ "no": "If you need help starting or upgrading the server, see the",+ "it": "If you need help starting or upgrading the server, see the",+ "pt": "If you need help starting or upgrading the server, see the",+ "es": "If you need help starting or upgrading the server, see the",+ "ar": "If you need help starting or upgrading the server, see the",+ "fr": "If you need help starting or upgrading the server, see the",+ "tr": "If you need help starting or upgrading the server, see the",+ "de": "If you need help starting or upgrading the server, see the",+ "uk": "If you need help starting or upgrading the server, see the",+ "ca": "If you need help starting or upgrading the server, see the"+ },+ "SETTINGS$AGENT_SERVER_SETUP_GUIDE_LINK": {+ "en": "setup instructions",+ "ja": "setup instructions",+ "zh-CN": "setup instructions",+ "zh-TW": "setup instructions",+ "ko-KR": "setup instructions",+ "no": "setup instructions",+ "it": "setup instructions",+ "pt": "setup instructions",+ "es": "setup instructions",+ "ar": "setup instructions",+ "fr": "setup instructions",+ "tr": "setup instructions",+ "de": "setup instructions",+ "uk": "setup instructions",+ "ca": "setup instructions"+ },++ "SETTINGS$AGENT_SERVER_DETAILS_LABEL": {+ "en": "Details: {{details}}",+ "ja": "Details: {{details}}",+ "zh-CN": "Details: {{details}}",+ "zh-TW": "Details: {{details}}",+ "ko-KR": "Details: {{details}}",+ "no": "Details: {{details}}",+ "it": "Details: {{details}}",+ "pt": "Details: {{details}}",+ "es": "Details: {{details}}",+ "ar": "Details: {{details}}",+ "fr": "Details: {{details}}",+ "tr": "Details: {{details}}",+ "de": "Details: {{details}}",+ "uk": "Details: {{details}}",+ "ca": "Details: {{details}}"+ },+ "SETTINGS$AGENT_SERVER_DETECTED_VERSION": {+ "en": "Detected version: {{version}}",+ "ja": "Detected version: {{version}}",+ "zh-CN": "Detected version: {{version}}",+ "zh-TW": "Detected version: {{version}}",+ "ko-KR": "Detected version: {{version}}",+ "no": "Detected version: {{version}}",+ "it": "Detected version: {{version}}",+ "pt": "Detected version: {{version}}",+ "es": "Detected version: {{version}}",+ "ar": "Detected version: {{version}}",+ "fr": "Detected version: {{version}}",+ "tr": "Detected version: {{version}}",+ "de": "Detected version: {{version}}",+ "uk": "Detected version: {{version}}",+ "ca": "Detected version: {{version}}"+ },"SETTINGS$SOUND_NOTIFICATIONS": {"en": "Sound Notifications","ja": "サウンド通知",diff --git a/src/query-client-config.ts b/src/query-client-config.tsindex 0547c5c407..8709b41adb 100644--- a/src/query-client-config.ts+++ b/src/query-client-config.ts@@ -25,7 +25,10 @@ export const createAgentServerQueryClient = () => {handle401Error(error, client);}- if (!query.meta?.disableToast) {+ const disableToast =+ query.meta?.disableToast ?? query.options.meta?.disableToast;++ if (!disableToast) {const errorMessage = retrieveAxiosErrorMessage(error);if (!shownErrors.has(errorMessage || "")) {@@ -43,7 +46,10 @@ export const createAgentServerQueryClient = () => {onError: (error, _, __, mutation) => {handle401Error(error, client);- if (!mutation?.meta?.disableToast) {+ const disableToast =+ mutation?.meta?.disableToast ?? mutation?.options.meta?.disableToast;++ if (!disableToast) {const message = retrieveAxiosErrorMessage(error);displayErrorToast(message || i18n.t(I18nKey.ERROR$GENERIC));}diff --git a/src/root.tsx b/src/root.tsxindex f9f6d44481..5e95e7bf8e 100644--- a/src/root.tsx+++ b/src/root.tsx@@ -1,5 +1,4 @@import {- Link,Links,Meta,MetaFunction,@@ -12,12 +11,16 @@ import "./tailwind.css";import "./index.css";import React from "react";import { Toaster } from "react-hot-toast";+import { useTranslation } from "react-i18next";import {AgentServerIncompatibilityError,AgentServerUnavailableError,isAgentServerIncompatibilityError,isAgentServerUnavailableError,+ MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,} from "#/api/agent-server-compatibility";+import { AgentServerConnectionForm } from "#/components/features/settings/agent-server-onboarding";+import { LoadingSpinner } from "#/components/shared/loading-spinner";import { useConfig } from "#/hooks/query/use-config";export function Layout({ children }: { children: React.ReactNode }) {@@ -40,44 +43,116 @@ export function Layout({ children }: { children: React.ReactNode }) {);}-function AgentServerNotice({- testId,+function AgentServerStatusCard({title,message,- children,+ details,+ version,}: {- testId: string;title: string;message: string;- children?: React.ReactNode;+ details?: string | null;+ version?: string | null;}) {+ const { t } = useTranslation();+return (- <main className="min-h-screen flex items-center justify-center bg-base p-6 text-white">- <div- data-testid={testId}- className="w-full max-w-2xl rounded-2xl border border-danger/30 bg-neutral-900/80 p-8 shadow-2xl"- >- {/* eslint-disable-next-line i18next/no-literal-string */}- <p className="text-sm font-medium uppercase tracking-[0.24em] text-danger">- Connection blocked+ <div className="mt-6 rounded-2xl border border-primary/20 bg-primary/10 p-4">+ <p className="text-sm font-semibold text-white">{title}</p>+ <p className="mt-2 text-sm leading-6 text-neutral-200">{message}</p>+ {version ? (+ <p className="mt-3 text-xs leading-5 text-neutral-400">+ {t("SETTINGS$AGENT_SERVER_DETECTED_VERSION", { version })}</p>- <h1 className="mt-3 text-3xl font-semibold text-white">{title}</h1>- <p className="mt-4 text-base leading-7 text-neutral-200">{message}</p>- {children}+ ) : null}+ {details ? (+ <p className="mt-3 text-xs leading-5 text-neutral-400">+ {t("SETTINGS$AGENT_SERVER_DETAILS_LABEL", { details })}+ </p>+ ) : null}+ </div>+ );+}++function AgentServerBootstrapLoading() {+ return (+ <main className="min-h-screen bg-base px-6 py-10 text-white">+ <div className="mx-auto flex min-h-screen max-w-6xl items-center justify-center">+ <div className="rounded-3xl border border-white/10 bg-neutral-900/80 px-8 py-10 shadow-2xl">+ <LoadingSpinner size="large" />+ </div></div></main>);}-function ConfigureAgentServerLink() {++function AgentServerOnboardingLayout({+ testId,+ eyebrow,+ title,+ description,+ statusTitle,+ statusMessage,+ statusDetails,+ version,+}: {+ testId: string;+ eyebrow: string;+ title: string;+ description: string;+ statusTitle: string;+ statusMessage: string;+ statusDetails?: string | null;+ version?: string | null;+}) {+ const { t } = useTranslation();+return (- <Link- to="/settings/agent-server"- className="mt-6 inline-flex w-fit items-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-white transition-opacity hover:opacity-90"- >- {/* eslint-disable-next-line i18next/no-literal-string */}- Configure agent server- </Link>+ <main className="min-h-screen bg-base px-6 py-10 text-white">+ <div className="mx-auto flex min-h-screen max-w-6xl items-center">+ <div+ data-testid={testId}+ className="grid w-full gap-8 lg:grid-cols-[1.15fr,0.85fr]"+ >+ <section className="rounded-3xl border border-white/10 bg-neutral-900/80 p-8 shadow-2xl">+ <p className="text-sm font-medium uppercase tracking-[0.24em] text-primary">+ {eyebrow}+ </p>+ <h1 className="mt-4 text-4xl font-semibold leading-tight text-white">+ {title}+ </h1>+ <p className="mt-4 max-w-3xl text-base leading-7 text-neutral-200">+ {description}+ </p>++ <AgentServerStatusCard+ title={statusTitle}+ message={statusMessage}+ details={statusDetails}+ version={version}+ />++ <p className="mt-6 max-w-3xl text-sm leading-6 text-gray-400">+ {t("SETTINGS$AGENT_SERVER_SETUP_GUIDE_HINT")}{" "}+ <a+ href="https://github.com/OpenHands/agent-server-gui"+ target="_blank"+ rel="noreferrer noopener"+ className="underline underline-offset-2 transition-colors hover:text-white"+ >+ {t("SETTINGS$AGENT_SERVER_SETUP_GUIDE_LINK")}+ </a>+ .+ </p>+ </section>++ <aside className="lg:pt-6">+ <AgentServerConnectionForm />+ </aside>+ </div>+ </div>+ </main>);}@@ -86,20 +161,41 @@ function UnsupportedAgentServerNotice({}: {error: AgentServerIncompatibilityError;}) {+ const { t } = useTranslation();+return (- <AgentServerNotice- testId="agent-server-incompatibility-warning"- title="Unsupported agent server version"- message={error.message}- >- {error.serverVersion && (- <p className="mt-4 text-sm text-neutral-400">- {/* eslint-disable-next-line i18next/no-literal-string */}- Detected version: <code>{error.serverVersion}</code>- </p>- )}- <ConfigureAgentServerLink />- </AgentServerNotice>+ <AgentServerOnboardingLayout+ testId="agent-server-upgrade-screen"+ eyebrow={t("SETTINGS$AGENT_SERVER_UPGRADE_EYEBROW")}+ title={t("SETTINGS$AGENT_SERVER_UPGRADE_TITLE")}+ description={t("SETTINGS$AGENT_SERVER_UPGRADE_DESCRIPTION", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ })}+ statusTitle={t("SETTINGS$AGENT_SERVER_UPGRADE_STATUS_TITLE")}+ statusMessage={t("SETTINGS$AGENT_SERVER_UPGRADE_STATUS_MESSAGE", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ })}+ version={error.serverVersion}+ />+ );+}++function UnknownAgentServerNotice() {+ const { t } = useTranslation();++ return (+ <AgentServerOnboardingLayout+ testId="agent-server-onboarding-screen"+ eyebrow={t("SETTINGS$AGENT_SERVER_ONBOARDING_EYEBROW")}+ title={t("SETTINGS$AGENT_SERVER_ONBOARDING_TITLE")}+ description={t("SETTINGS$AGENT_SERVER_ONBOARDING_DESCRIPTION", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ })}+ statusTitle={t("SETTINGS$AGENT_SERVER_UNKNOWN_VERSION_STATUS_TITLE")}+ statusMessage={t("SETTINGS$AGENT_SERVER_UNKNOWN_VERSION_STATUS_MESSAGE", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ })}+ />);}@@ -108,20 +204,20 @@ function MissingAgentServerNotice({}: {error: AgentServerUnavailableError;}) {+ const { t } = useTranslation();+return (- <AgentServerNotice- testId="agent-server-unavailable-warning"- title="Agent server not found"- message={error.message}- >- {error.details && (- <p className="mt-4 text-sm text-neutral-400">- {/* eslint-disable-next-line i18next/no-literal-string */}- Details: {error.details}- </p>- )}- <ConfigureAgentServerLink />- </AgentServerNotice>+ <AgentServerOnboardingLayout+ testId="agent-server-onboarding-screen"+ eyebrow={t("SETTINGS$AGENT_SERVER_ONBOARDING_EYEBROW")}+ title={t("SETTINGS$AGENT_SERVER_ONBOARDING_TITLE")}+ description={t("SETTINGS$AGENT_SERVER_ONBOARDING_DESCRIPTION", {+ minimumVersion: MINIMUM_SUPPORTED_AGENT_SERVER_VERSION,+ })}+ statusTitle={t("SETTINGS$AGENT_SERVER_UNAVAILABLE_STATUS_TITLE")}+ statusMessage={t("SETTINGS$AGENT_SERVER_UNAVAILABLE_STATUS_MESSAGE")}+ statusDetails={error.details}+ />);}@@ -132,10 +228,14 @@ export const meta: MetaFunction = () => [export default function App() {const location = useLocation();- const config = useConfig({ enabled: true });+ const config = useConfig();const isAgentServerSettingsRoute =location.pathname === "/settings/agent-server";+ if (!isAgentServerSettingsRoute && (config.isPending || config.isLoading)) {+ return <AgentServerBootstrapLoading />;+ }+if (!isAgentServerSettingsRoute &&isAgentServerUnavailableError(config.error)@@ -147,6 +247,10 @@ export default function App() {!isAgentServerSettingsRoute &&isAgentServerIncompatibilityError(config.error)) {+ if (!config.error.serverVersion) {+ return <UnknownAgentServerNotice />;+ }+return <UnsupportedAgentServerNotice error={config.error} />;}diff --git a/src/routes/agent-server-settings.tsx b/src/routes/agent-server-settings.tsxindex 657c1f941e..1711ecdcbb 100644--- a/src/routes/agent-server-settings.tsx+++ b/src/routes/agent-server-settings.tsx@@ -1,82 +1,32 @@import React from "react";import { useTranslation } from "react-i18next";-import {- getAgentServerFormDefaults,- saveAgentServerConfig,-} from "#/api/agent-server-config";-import { BrandButton } from "#/components/features/settings/brand-button";-import { SettingsInput } from "#/components/features/settings/settings-input";+import { AgentServerConnectionForm } from "#/components/features/settings/agent-server-onboarding";+import { Typography } from "#/ui/typography";export const clientLoader = async () => null;+export const handle = { hideTitle: true };export function AgentServerSettingsScreen() {const { t } = useTranslation();- const defaults = React.useMemo(() => getAgentServerFormDefaults(), []);- const [baseUrl, setBaseUrl] = React.useState(defaults.baseUrl);- const [sessionApiKey, setSessionApiKey] = React.useState(- defaults.sessionApiKey,- );-- const formIsClean =- baseUrl === defaults.baseUrl && sessionApiKey === defaults.sessionApiKey;-- const onSubmit = (event: React.FormEvent<HTMLFormElement>) => {- event.preventDefault();-- saveAgentServerConfig({- baseUrl,- sessionApiKey,- });-- window.location.assign("/");- };return (- <form+ <divdata-testid="agent-server-settings-screen"- onSubmit={onSubmit}- className="flex h-full flex-col justify-between"+ className="flex h-full flex-col gap-6 pb-8">- <div className="flex flex-col gap-6">- <p className="max-w-[680px] text-sm text-gray-400">+ <div>+ <Typography.H2 className="mb-2">+ {t("SETTINGS$AGENT_SERVER_SETTINGS_TITLE")}+ </Typography.H2>+ <Typography.Paragraph className="max-w-3xl text-sm text-[#A3A3A3]">{t("SETTINGS$AGENT_SERVER_DESCRIPTION")}- </p>-- <SettingsInput- testId="agent-server-url-input"- name="agent-server-url-input"- type="text"- label={t("SETTINGS$AGENT_SERVER_URL")}- value={baseUrl}- onChange={setBaseUrl}- placeholder={t("SETTINGS$AGENT_SERVER_URL_PLACEHOLDER")}- className="w-full max-w-[680px]"- />-- <SettingsInput- testId="agent-server-api-key-input"- name="agent-server-api-key-input"- type="password"- label={t("SETTINGS$AGENT_SERVER_API_KEY")}- value={sessionApiKey}- onChange={setSessionApiKey}- placeholder={t("SETTINGS$AGENT_SERVER_API_KEY_PLACEHOLDER")}- showOptionalTag- className="w-full max-w-[680px]"- />+ </Typography.Paragraph></div>- <div className="flex justify-end gap-6 p-6">- <BrandButton- testId="submit-button"- variant="primary"- type="submit"- isDisabled={formIsClean}- >- {t("SETTINGS$SAVE_AND_RECONNECT")}- </BrandButton>+ <div className="max-w-2xl">+ <AgentServerConnectionForm variant="settings" showSectionHeader={false} /></div>- </form>+ </div>);}