Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(ui): merge settings into workbench shell (#1647)
Qi Qiadf91d348141
diff --git a/docs/plans/issue-1412-settings-workbench-phase-1-2.md b/docs/plans/issue-1412-settings-workbench-phase-1-2.mdnew file mode 100644index 000000000..af2fb4292--- /dev/null+++ b/docs/plans/issue-1412-settings-workbench-phase-1-2.md@@ -0,0 +1,31 @@+# Issue #1412: Settings in the Workbench shell (phases 1–2)++## Goal++Make Settings a routed page inside the persistent Workbench shell. Replace the+admin sidebar and settings tab bar with one responsive section rail while+preserving old deep links.++## Scope++- Mount the existing settings surfaces under canonical `/settings/*` routes.+- Add Preferences pages and a four-group Settings rail.+- Redirect every retired `/admin/*` destination to its canonical replacement.+- Merge Diagnostics and Logs into one rail destination.+- Keep the Workbench sidebar, Apps launcher, appearance controls, and account+ controls available while Settings is open.+- Retire the Dashboard destination; Service and Platforms remain the canonical+ homes for its runtime and connection information.++## Deferred++- Capability-safe navigation projection and locked/read-only placeholders.+- Platform-owned group and DM detail views.+- Backend provider detail redesign.+- Rail health/error badges.++## Validation++- Route and layout unit tests cover canonical and legacy navigation.+- Existing settings tests remain green.+- `npm run build` verifies the production UI bundle.diff --git a/ui/eslint-baseline.json b/ui/eslint-baseline.jsonindex 20e15b491..200cbb395 100644--- a/ui/eslint-baseline.json+++ b/ui/eslint-baseline.json@@ -11,10 +11,7 @@"violations": {"src/components/AppShell.tsx": {"@typescript-eslint/no-explicit-any": 2,- "react-hooks/set-state-in-effect": 2- },- "src/components/Dashboard.tsx": {- "@typescript-eslint/no-explicit-any": 9+ "react-hooks/set-state-in-effect": 1},"src/components/InstallHint.tsx": {"react-hooks/set-state-in-effect": 1diff --git a/ui/src/App.remoteAuth.test.tsx b/ui/src/App.remoteAuth.test.tsxindex 095890586..0bdf58ec3 100644--- a/ui/src/App.remoteAuth.test.tsx+++ b/ui/src/App.remoteAuth.test.tsx@@ -140,7 +140,7 @@ const CapabilityProbe = () => {const OwnerOnlyGate = () => {const { capabilities } = useInstanceAuthorization();- if (isOwnerOnlyPath('/admin/settings/diagnostics') && !capabilities.can_manage_instance) {+ if (isOwnerOnlyPath('/settings/diagnostics') && !capabilities.can_manage_instance) {return <Navigate to="/" replace />;}return <div>diagnostics-page</div>;@@ -154,7 +154,7 @@ describe('AuthGuard setup-bypass authorization', () => {capabilities: OWNER_INSTANCE_CAPABILITIES,};- it.each(['/admin/settings/diagnostics', '/admin/logs'])(+ it.each(['/settings/diagnostics', '/settings/diagnostics/logs'])('keeps the instance owner on %s instead of treating the setup bypass as denied',async (path) => {api.getAuthSession.mockResolvedValue(localOwnerSession);@@ -176,7 +176,7 @@ describe('AuthGuard setup-bypass authorization', () => {},);- it('lets an owner open Diagnostics from Advanced Settings without bouncing home', async () => {+ it('lets an owner open Diagnostics without bouncing home', async () => {api.getAuthSession.mockResolvedValue(localOwnerSession);api.getConfig.mockResolvedValue({mode: 'v2',@@ -184,10 +184,10 @@ describe('AuthGuard setup-bypass authorization', () => {});render(- <MemoryRouter initialEntries={['/admin/settings/diagnostics']}>+ <MemoryRouter initialEntries={['/settings/diagnostics']}><AuthGuard><Routes>- <Route path="/admin/settings/diagnostics" element={<OwnerOnlyGate />} />+ <Route path="/settings/diagnostics" element={<OwnerOnlyGate />} /><Route path="/" element={<div>workbench-home</div>} /></Routes></AuthGuard>diff --git a/ui/src/App.tsx b/ui/src/App.tsxindex 3b6cdb222..1d28fd0bb 100644--- a/ui/src/App.tsx+++ b/ui/src/App.tsx@@ -21,7 +21,6 @@ import { VaultsPage } from './components/workbench/VaultsPage';import { SettingsMemoryPage } from './components/settings/SettingsMemoryPage';import { ChatPage } from './components/workbench/ChatPage';import { ProjectsPage } from './components/workbench/ProjectsPage';-import { Dashboard } from './components/Dashboard';import { ChannelList } from './components/steps/ChannelList';import { UserList } from './components/steps/UserList';import { RemoteAccessPage } from './components/RemoteAccessPage';@@ -35,6 +34,7 @@ import { SettingsLogsPage } from './components/settings/SettingsLogsPage';import { SettingsMessagingPage } from './components/settings/SettingsMessagingPage';import { SettingsPlatformsPage } from './components/settings/SettingsPlatformsPage';import { SettingsServicePage } from './components/settings/SettingsServicePage';+import { SettingsLayout } from './components/settings/SettingsLayout';import { StatusProvider } from './context/StatusProvider';import { ApiProvider, useApi, ApiError } from './context/ApiContext';import type { SessionInfo } from './context/ApiContext';@@ -89,10 +89,7 @@ const ShowPageRoute = lazy(() =>const SettingsModelsPage = lazy(() =>import('./components/settings/models/SettingsModelsPage').then((m) => ({ default: m.SettingsModelsPage })),);-import {- LegacyModelHubRoute,- ModelHubCapabilityGate,-} from './components/settings/models/ModelHubCapabilityGate';+import { ModelHubCapabilityGate } from './components/settings/models/ModelHubCapabilityGate';import { hasConfiguredPlatformCredentials } from './lib/platforms';import { isIosDevice, isStandalonePwa } from './lib/platform';import {@@ -107,6 +104,12 @@ import { useTranslation } from 'react-i18next';import { Card, CardContent, CardDescription, CardHeader, CardTitle } from './components/ui/card';import { Button } from './components/ui/button';import { PermissionsPage } from './features/permissions/PermissionsPage';+import { legacySettingsRedirectTarget, LEGACY_SETTINGS_REDIRECTS } from './lib/settingsRoutes';++const LegacySettingsRedirectRoute = ({ to }: { to: string }) => {+ const { hash } = useLocation();+ return <Navigate to={legacySettingsRedirectTarget(to, hash)} replace />;+};const RemoteLoginGate = ({ target }: { target: string }) => {const { t } = useTranslation();@@ -741,70 +744,44 @@ const router = createBrowserRouter(/><Route path="/chat/:sessionId" element={<ChatPage />} />- {/* Control Panel mode — existing pages moved under /admin/* */}- <Route path="/admin" element={<Navigate to="/admin/dashboard" replace />} />- <Route path="/admin/dashboard" element={<Dashboard />} />- <Route path="/admin/permissions" element={<PermissionsPage />} />- <Route path="/admin/remote-access" element={<RemoteAccessPage />} />- <Route path="/admin/groups" element={<ChannelList isPage />} />- <Route path="/admin/users" element={<UserList />} />- {/* Show Pages moved into the App Library (workbench). Redirect the old- control-panel page (?view=pages so it lands on the Show Pages tab the- bookmark asked for) so bookmarks + external links keep working. */}- <Route path="/admin/show-pages" element={<Navigate to="/apps/library?view=pages" replace />} />- <Route path="/admin/logs" element={<SettingsLogsPage standalone />} />- {/* No client-side route at /admin/settings: Flask owns GET /settings as- a JSON API. The Flask handler redirects browser-Accept hits to- /admin/settings/service. */}- <Route path="/admin/settings/service" element={<SettingsServicePage />} />- <Route path="/admin/settings/platforms" element={<SettingsPlatformsPage />} />- <Route path="/admin/settings/backends" element={<SettingsBackendsPage />} />- <Route path="/admin/settings/backends/opencode" element={<SettingsOpencodeProviderPage />} />- <Route path="/admin/settings/backends/claude" element={<SettingsClaudeProviderPage />} />- <Route path="/admin/settings/backends/codex" element={<SettingsCodexProviderPage />} />- <Route- path="/admin/settings/models"- element={- <ModelHubCapabilityGate>- <Suspense fallback={<AppsRouteFallback />}>- <SettingsModelsPage />- </Suspense>- </ModelHubCapabilityGate>- }- />- <Route path="/admin/settings/dependencies" element={<SettingsDependenciesPage />} />- <Route path="/admin/settings/memory" element={<SettingsMemoryPage />} />- <Route path="/admin/settings/messaging" element={<SettingsMessagingPage />} />- <Route path="/admin/settings/diagnostics" element={<SettingsDiagnosticsPage />} />- <Route path="/admin/settings/logs" element={<SettingsLogsPage />} />-- {/* Legacy redirects: old top-level paths → /admin/* equivalents.- Bookmarked URLs and external links keep working without a server- round-trip. */}- <Route path="/dashboard" element={<Navigate to="/admin/dashboard" replace />} />- <Route path="/groups" element={<Navigate to="/admin/groups" replace />} />- <Route path="/channels" element={<Navigate to="/admin/groups" replace />} />- <Route path="/users" element={<Navigate to="/admin/users" replace />} />- <Route path="/logs" element={<Navigate to="/admin/logs" replace />} />- {/* Exact /settings — the server used to redirect browser hits here- to the settings UI, but that handler moved to /api/settings in- the route migration. Keep the bookmark working client-side. */}- <Route path="/settings" element={<Navigate to="/admin/settings/service" replace />} />- <Route path="/settings/service" element={<Navigate to="/admin/settings/service" replace />} />- <Route path="/settings/platforms" element={<Navigate to="/admin/settings/platforms" replace />} />- <Route path="/settings/backends" element={<Navigate to="/admin/settings/backends" replace />} />- <Route path="/settings/backends/opencode" element={<Navigate to="/admin/settings/backends/opencode" replace />} />- <Route path="/settings/backends/claude" element={<Navigate to="/admin/settings/backends/claude" replace />} />- <Route path="/settings/backends/codex" element={<Navigate to="/admin/settings/backends/codex" replace />} />- <Route path="/settings/models" element={<LegacyModelHubRoute />} />- <Route path="/settings/dependencies" element={<Navigate to="/admin/settings/dependencies" replace />} />- <Route path="/settings/memory" element={<Navigate to="/admin/settings/memory" replace />} />- <Route path="/settings/messaging" element={<Navigate to="/admin/settings/messaging" replace />} />- <Route path="/settings/diagnostics" element={<Navigate to="/admin/settings/diagnostics" replace />} />- <Route path="/settings/logs" element={<Navigate to="/admin/settings/logs" replace />} />- <Route path="/remote-access" element={<Navigate to="/admin/remote-access" replace />} />- <Route path="/doctor" element={<Navigate to="/admin/settings/diagnostics" replace />} />- <Route path="/doctor/logs" element={<Navigate to="/admin/logs" replace />} />+ {/* Settings stays inside the Workbench shell. The section rail is the+ only second-level navigation; provider/platform routes remain+ inline detail screens beneath their owning section. */}+ <Route path="/settings" element={<SettingsLayout />}>+ <Route index element={null} />+ <Route path="appearance" element={<Navigate to="/settings/replies" replace />} />+ <Route path="account" element={<Navigate to="/settings/replies" replace />} />+ <Route path="service" element={<SettingsServicePage />} />+ <Route path="platforms" element={<SettingsPlatformsPage />} />+ <Route path="platforms/groups" element={<ChannelList isPage />} />+ <Route path="platforms/users" element={<UserList />} />+ <Route path="remote-access" element={<RemoteAccessPage />} />+ <Route path="backends" element={<SettingsBackendsPage />} />+ <Route path="backends/opencode" element={<SettingsOpencodeProviderPage />} />+ <Route path="backends/claude" element={<SettingsClaudeProviderPage />} />+ <Route path="backends/codex" element={<SettingsCodexProviderPage />} />+ <Route+ path="models"+ element={+ <ModelHubCapabilityGate>+ <Suspense fallback={<AppsRouteFallback />}>+ <SettingsModelsPage />+ </Suspense>+ </ModelHubCapabilityGate>+ }+ />+ <Route path="dependencies" element={<SettingsDependenciesPage />} />+ <Route path="memory" element={<SettingsMemoryPage />} />+ <Route path="replies" element={<SettingsMessagingPage />} />+ <Route path="diagnostics" element={<SettingsDiagnosticsPage />} />+ <Route path="diagnostics/logs" element={<SettingsLogsPage />} />+ <Route path="access" element={<PermissionsPage />} />+ </Route>++ {/* Retired admin and top-level routes only translate old deep links. */}+ {LEGACY_SETTINGS_REDIRECTS.map(({ from, to }) => (+ <Route key={from} path={from} element={<LegacySettingsRedirectRoute to={to} />} />+ ))}{/* The server intentionally serves the SPA shell for every extensionlesspath. Keep stale bookmarks and retired push targets inside AuthGuard,then recover authenticated/local clients to the workbench root. */}diff --git a/ui/src/components/AppShell.test.tsx b/ui/src/components/AppShell.test.tsxindex a73d7df33..552891aa0 100644--- a/ui/src/components/AppShell.test.tsx+++ b/ui/src/components/AppShell.test.tsx@@ -1,7 +1,7 @@/* @vitest-environment jsdom */import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { cleanup, render, screen, within } from '@testing-library/react';+import { cleanup, render, screen } from '@testing-library/react';import userEvent from '@testing-library/user-event';import { MemoryRouter, Route, Routes, useNavigate } from 'react-router-dom';import type { ReactNode } from 'react';@@ -79,9 +79,9 @@ vi.mock('../context/ShowPageDragProvider', () => ({ShowPageDragProvider: ({ children }: { children: ReactNode }) => <>{children}</>,}));vi.mock('./AppsLauncher', () => ({ AppsLauncher: () => <div data-testid="apps-launcher" /> }));-vi.mock('./AccountMenu', () => ({ AccountMenu: () => null }));-vi.mock('./LanguageSwitcher', () => ({ LanguageSwitcher: () => null }));-vi.mock('./ThemeToggle', () => ({ ThemeToggle: () => null }));+vi.mock('./AccountMenu', () => ({ AccountMenu: () => <div data-testid="account-menu" /> }));+vi.mock('./LanguageSwitcher', () => ({ LanguageSwitcher: () => <div data-testid="language-switcher" /> }));+vi.mock('./ThemeToggle', () => ({ ThemeToggle: () => <div data-testid="theme-toggle" /> }));vi.mock('./VersionBadge', () => ({ VersionBadge: () => null }));vi.mock('./apps/MobileDockDrawer', () => ({MobileDockDrawer: () => <div data-testid="mobile-dock-drawer" />,@@ -139,7 +139,7 @@ describe('AppShell setup recovery', () => {);expect(await screen.findByText('setup.remoteOwner.title')).toBeTruthy();- expect(screen.getByRole('link', { name: 'setup.remoteOwner.action' }).getAttribute('href')).toBe('/admin/dashboard');+ expect(screen.getByRole('link', { name: 'setup.remoteOwner.action' }).getAttribute('href')).toBe('/settings/service');expect(screen.queryByTestId('wizard')).toBeNull();});});@@ -225,43 +225,57 @@ describe('AppShell workbench sidebar', () => {});});-describe('AppShell Permissions navigation', () => {+describe('AppShell persistent Workbench chrome', () => {it.each(['personal',null,'organization',- ] as const)('keeps current-instance Permissions in More Settings for %s instances', async (instanceKind) => {- const user = userEvent.setup();+ ] as const)('keeps Settings and preferences in the Workbench sidebar for %s instances', async (instanceKind) => {+ viewport.isDesktop = true;instanceAuth.instanceKind = instanceKind;render(- <MemoryRouter initialEntries={['/admin/dashboard']}>+ <MemoryRouter initialEntries={['/']}><Routes><Route element={<AppShell />}>- <Route path="admin/dashboard" element={<div data-testid="dashboard" />} />+ <Route index element={<div data-testid="workbench" />} /></Route></Routes></MemoryRouter>,);- expect(await screen.findByTestId('dashboard')).toBeTruthy();+ expect(await screen.findByTestId('workbench')).toBeTruthy();+ expect(screen.getByRole('link', { name: 'appShell.openControlPanel' }).getAttribute('href')).toBe(+ '/settings/replies',+ );+ expect(screen.getByTestId('language-switcher')).toBeTruthy();+ expect(screen.getByTestId('theme-toggle')).toBeTruthy();+ expect(screen.getByTestId('account-menu')).toBeTruthy();+ const preferencesRow = screen.getByTestId('language-switcher').parentElement!;+ const appsRow = screen.getByTestId('apps-launcher').parentElement!;+ expect(preferencesRow.compareDocumentPosition(appsRow) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ });- const moreTab = screen.getByRole('button', { name: 'nav.more' });- const bottomNav = moreTab.closest('nav');- expect(bottomNav).not.toBeNull();- expect(within(bottomNav!).queryByText('nav.permissions')).toBeNull();+ it('uses the Settings button to close an open Settings surface', async () => {+ viewport.isDesktop = true;+ const user = userEvent.setup();- await user.click(moreTab);- const moreSettings = screen.getByRole('dialog');- expect(within(moreSettings).getByRole('link', { name: 'nav.permissions' }).getAttribute('href')).toBe(- '/admin/permissions',+ render(+ <MemoryRouter initialEntries={['/settings/replies']}>+ <Routes>+ <Route element={<AppShell />}>+ <Route index element={<div data-testid="workbench" />} />+ <Route path="settings/replies" element={<div data-testid="settings" />} />+ </Route>+ </Routes>+ </MemoryRouter>,);- const desktopSidebar = document.querySelector('aside');- expect(desktopSidebar).not.toBeNull();- expect(within(desktopSidebar!).getByRole('link', { name: 'nav.permissions' }).getAttribute('href')).toBe(- '/admin/permissions',- );+ expect(await screen.findByTestId('settings')).toBeTruthy();+ const settingsToggle = screen.getByRole('link', { name: 'appShell.openControlPanel' });+ expect(settingsToggle.getAttribute('href')).toBe('/');+ await user.click(settingsToggle);+ expect(await screen.findByTestId('workbench')).toBeTruthy();});});diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsxindex 422f0e59c..28447e69f 100644--- a/ui/src/components/AppShell.tsx+++ b/ui/src/components/AppShell.tsx@@ -1,13 +1,11 @@import React, { useEffect, useState } from 'react';import { Link, Navigate, NavLink, Outlet, useLocation } from 'react-router-dom';-import { AlertTriangle, ArrowLeft, Bot, Brain, ChevronDown, Cpu, FolderTree, Globe, Grid2x2, Hash, Inbox, LayoutDashboard, LayoutGrid, Link as LinkIcon, Menu, MessageCircle, PlugZap, Plus, Settings, ShieldCheck, Sparkles, X } from 'lucide-react';+import { AlertTriangle, FolderTree, Grid2x2, Inbox, LayoutGrid, Plus, Settings } from 'lucide-react';import { useTranslation } from 'react-i18next';import clsx from 'clsx';import { APP_TAB_PARAM, isStandaloneAppRoutePath, isStandaloneAppTab } from '../apps/appLaunch';import { StandaloneAppTabContext } from '../context/StandaloneAppTabContext';-import { modelHubEnabledFromConfig } from './settings/models/featureFlags';-import { memoryNavShouldBeVisible } from '../lib/memorySettings';import { useApi } from '../context/ApiContext';import { useStatus } from '../context/StatusContext';import { useWorkbenchInbox } from '../context/WorkbenchInboxContext';@@ -30,113 +28,31 @@ import { SearchPalette } from './workbench/search/SearchPalette';import { Button } from './ui/button';import { InstallHint } from './InstallHint';import logoImg from '../assets/logo.png';-import { getEnabledPlatforms, platformSupportsChannels } from '../lib/platforms';import { useViewportHeightVar } from '../lib/useViewportHeightVar';import { APP_SHELL_SCROLL_ID, forgetMobileProjectsListUnlessPreserved } from '../lib/mobileProjectsListMemory';import { useIsDesktop } from '../lib/useIsDesktop';import {- adminLandingPath,- isAdvancedSettingsPath,isOwnerOnlyPath,- isMemorySettingsPath,- visibleAdminNavItems,+ settingsLandingPath,} from '../lib/adminNavigation';type ShellNavItem = {- // Optional: a parent that only groups children (no page of its own) omits `to`- // and renders as a collapsible toggle instead of a link.to?: string;label: string;icon: React.ComponentType<{ className?: string }>;match?: (pathname: string) => boolean;badge?: number;- children?: ShellNavItem[];- // `defaultOpen` makes a group start expanded (used in the mobile 更多 sheet so- // 通讯平台 shows its children without a second tap).- defaultOpen?: boolean;- // Mobile-tab extras: `onClick` makes the tab a button (e.g. 更多 opens the- // nav sheet) instead of a link; `variant: 'workbench'` renders the emphasized- // green circle for the back-to-workbench tab.onClick?: () => void;- variant?: 'workbench';-};--const isItemActive = (item: ShellNavItem, pathname: string): boolean =>- item.match- ? item.match(pathname)- : item.to- ? pathname === item.to || pathname.startsWith(`${item.to}/`)- : false;--// Mirrors design.pen kSWgv (VR/Sidebar): 240px width, fill --surface,-// right border, padding [20,16]. Mint-soft active state with mint glow.-const ShellNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {- const location = useLocation();- if (item.children && item.children.length > 0) return <ShellNavGroup item={item} />;- const active = item.match ? item.match(location.pathname) : location.pathname === item.to;- const Icon = item.icon;-- return (- <NavLink- to={item.to ?? '#'}- className={clsx(- 'group flex items-center gap-2.5 rounded-lg px-3 py-2.5 text-[13px] font-medium transition-colors',- active- ? 'border border-mint/30 bg-mint/[0.08] text-foreground shadow-glow-sm-mint'- : 'border border-transparent text-muted hover:bg-foreground/[0.04] hover:text-foreground'- )}- >- <Icon className={clsx('size-4', active ? 'text-mint-ink' : 'text-muted group-hover:text-foreground')} />- <span>{item.label}</span>- </NavLink>- );-};--// Collapsible parent for a nested submenu (e.g. 通讯平台 → 平台 / 群组 / 私聊).-// Auto-expands when one of its children is the active route; the parent has no-// page of its own, so it's a toggle button rather than a link.-const ShellNavGroup: React.FC<{ item: ShellNavItem }> = ({ item }) => {- const location = useLocation();- const Icon = item.icon;- const childActive = (item.children ?? []).some((child) => isItemActive(child, location.pathname));- const [open, setOpen] = useState(childActive || !!item.defaultOpen);- useEffect(() => {- if (childActive) setOpen(true);- }, [childActive]);-- return (- <div className="flex flex-col gap-0.5">- <button- type="button"- onClick={() => setOpen((v) => !v)}- aria-expanded={open}- className={clsx(- 'group flex w-full items-center gap-2.5 rounded-lg border border-transparent px-3 py-2.5 text-[13px] font-medium transition-colors hover:bg-foreground/[0.04]',- childActive ? 'text-foreground' : 'text-muted hover:text-foreground'- )}- >- <Icon className={clsx('size-4', childActive ? 'text-mint-ink' : 'text-muted group-hover:text-foreground')} />- <span className="flex-1 text-left">{item.label}</span>- <ChevronDown className={clsx('size-3.5 shrink-0 text-muted transition-transform', open && 'rotate-180')} />- </button>- {open && (- <div className="ml-3 flex flex-col gap-0.5 border-l border-border pl-2">- {item.children!.map((child) => <ShellNavLink key={child.to} item={child} />)}- </div>- )}- </div>- );};const MobileNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {const location = useLocation();const active = item.match ? item.match(location.pathname) : location.pathname === item.to;const Icon = item.icon;- const isWorkbench = item.variant === 'workbench';const className = clsx('flex min-w-0 flex-1 flex-col items-center justify-center gap-1 rounded-lg px-1 py-2 text-[10px] transition-colors',- isWorkbench ? 'text-mint-ink' : active ? 'bg-mint/[0.08] text-mint-ink' : 'text-muted'+ active ? 'bg-mint/[0.08] text-mint-ink' : 'text-muted');const inner = (<>@@ -144,16 +60,7 @@ const MobileNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {centers on one line — the workbench circle no longer protrudes aboveits siblings. */}<span className="relative flex h-7 items-center justify-center">- {isWorkbench ? (- // Emphasized green circle — the back-to-workbench tab, mirroring the- // desktop sidebar's distinct mint mode-switch button. Sized to fill the- // slot so it sits on the same baseline as the plain icons.- <span className="grid size-7 place-items-center rounded-full border border-mint/45 bg-mint/[0.14] shadow-glow-xs-mint">- <Icon className="size-4 text-mint-ink" />- </span>- ) : (- <Icon className="size-4" />- )}+ <Icon className="size-4" />{item.badge ? (<span className="absolute -right-2 -top-1.5 min-w-[14px] rounded-full bg-mint px-1 text-center font-mono text-[9px] font-bold leading-[14px] text-primary-foreground">{item.badge > 99 ? '99+' : item.badge}@@ -172,14 +79,9 @@ const MobileNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {type CenterButton = { label: string; icon: React.ComponentType<{ className?: string }>; to?: string; onClick?: () => void };-// Mobile bottom tab bar shared by both shells. Section tabs flank a raised-// center FAB. Workbench: center = + (new session). Control Panel: center =-// Workbench (jump back) — the symmetric counterpart Alex asked for, so each-// shell can reach the other from the tab bar.+// Workbench mobile tabs flank a raised new-session action.const MobileTabBar: React.FC<{ items: ShellNavItem[]; center?: CenterButton }> = ({ items, center }) => {- // No center FAB → a plain even row of tabs. The Control Panel uses this so- // "Workbench" is just the first tab, which reads cleaner than an asymmetric- // raised center button.+ // No center action means a plain even row of tabs.if (!center) {return (<nav className="fixed inset-x-0 bottom-0 z-40 border-t border-border bg-surface/96 px-2 pt-2 pb-[calc(0.5rem+env(safe-area-inset-bottom))] backdrop-blur md:hidden">@@ -247,7 +149,7 @@ const ConfigRecoveryNotice: React.FC<{ config: ConfigRecoveryProjection | null }</p></div><Link- to="/admin/settings/diagnostics"+ to="/settings/diagnostics"className="shrink-0 text-[12px] font-semibold text-gold-ink hover:underline">{t('configRecovery.action')}@@ -275,14 +177,9 @@ export const AppShell: React.FC = () => {useEffect(() => {forgetMobileProjectsListUnlessPreserved(location.pathname);}, [location.pathname]);- const [enabledPlatforms, setEnabledPlatforms] = useState<string[]>([]);const [config, setConfig] = useState<any>(null);- const [memoryNavVisible, setMemoryNavVisible] = useState(false);const [newSessionOpen, setNewSessionOpen] = useState(false);const [searchOpen, setSearchOpen] = useState(false);- // The mobile admin nav sheet (opened from the 更多 tab). Close it whenever the- // route changes so tapping any item in the sheet dismisses it.- const [adminMenuOpen, setAdminMenuOpen] = useState(false);// The mobile Dock drawer (opened from the workbench Apps tab). Like the admin// sheet it closes on any route change — tapping a tile navigates + dismisses.const [appsDrawerOpen, setAppsDrawerOpen] = useState(false);@@ -304,21 +201,9 @@ export const AppShell: React.FC = () => {if (!capabilities.can_manage_instance) return;api.getConfig().then((c: any) => {setConfig(c);- setEnabledPlatforms(getEnabledPlatforms(c));}).catch(() => {});}, [api, capabilities.can_manage_instance]);- useEffect(() => {- const refreshMemoryNav = () => {- void api.getMemorySettings()- .then((memory) => setMemoryNavVisible(memoryNavShouldBeVisible(memory)))- .catch(() => setMemoryNavVisible(false));- };- refreshMemoryNav();- window.addEventListener('avibe:memory-settings-changed', refreshMemoryNav);- return () => window.removeEventListener('avibe:memory-settings-changed', refreshMemoryNav);- }, [api]);-// Global ⌘K / Ctrl+K toggles the message-search palette. Intercept the chord// everywhere (it's a deliberate command, so it wins even from the composer);// the palette's own input/Esc/arrow handling takes over once it is open.@@ -333,10 +218,8 @@ export const AppShell: React.FC = () => {return () => window.removeEventListener('keydown', onKeyDown);}, []);- // Close the mobile transient surfaces (admin nav sheet + Apps Dock drawer) on- // any route change — tapping an item in either navigates, which dismisses it.+ // Close the mobile Dock drawer on navigation.useEffect(() => {- setAdminMenuOpen(false);setAppsDrawerOpen(false);}, [location.pathname]);@@ -387,7 +270,7 @@ export const AppShell: React.FC = () => {<CardContent className="space-y-4"><p className="text-sm leading-relaxed text-muted">{t('setup.remoteOwner.hint')}</p><Button asChild>- <Link to={adminLandingPath(capabilities.can_use_system)}>+ <Link to="/settings/service">{t('setup.remoteOwner.action')}</Link></Button>@@ -397,8 +280,6 @@ export const AppShell: React.FC = () => {);}- const hasChannelPlatforms = enabledPlatforms.some((platform) => platformSupportsChannels(config, platform));- const modelHubEnabled = modelHubEnabledFromConfig(config);const isRunning = status.state === 'running';const canUseApps = capabilities.can_chat;const canUseShowPageApp =@@ -422,107 +303,6 @@ export const AppShell: React.FC = () => {return <><ConfigRecoveryNotice config={config} /><Outlet /></>;}- // Two shell modes share the same chrome (brand + bottom status):- // - admin: control-panel pages under /admin/* (legacy dashboard/groups/...- // paths are now Navigate redirects to /admin/*).- // - workbench: the new `/` entry. Commit 01 ships a placeholder with no- // sidebar nav; commit 02 layers in the capability modules + projects.- const shellMode: 'workbench' | 'admin' =- location.pathname.startsWith('/admin') ? 'admin' : 'workbench';-- const adminItems: ShellNavItem[] = [- { to: '/admin/dashboard', label: t('nav.dashboard'), icon: LayoutDashboard },- // Permanent escape hatch to the App Library (a workbench app) for principals- // covered by the current Apps policy. It stays reachable even when undocked.- ...(canUseApps- ? [{ to: '/apps/library', label: t('nav.appLibrary'), icon: LayoutGrid, match: (p: string) => p.startsWith('/apps/library') }]- : []),- { to: '/admin/remote-access', label: t('nav.remoteAccess'), icon: Globe },- {- // 通讯平台: groups everything about connecting messaging platforms — the- // platform credentials (was a Settings tab), plus the group + DM scopes.- label: t('nav.messagingPlatforms'),- icon: LinkIcon,- match: (p) =>- p.startsWith('/admin/settings/platforms') ||- p.startsWith('/admin/groups') ||- p.startsWith('/admin/users'),- children: [- { to: '/admin/settings/platforms', label: t('settings.tabs.platforms'), icon: PlugZap },- ...(hasChannelPlatforms ? [{ to: '/admin/groups', label: t('nav.channels'), icon: Hash }] : []),- { to: '/admin/users', label: t('nav.users'), icon: MessageCircle },- ],- },- // 模型 (Model Hub, L4): the backend release capability is the only authority.- ...(modelHubEnabled- ? [- {- to: '/admin/settings/models',- label: t('nav.models'),- icon: Cpu,- match: (p: string) => p.startsWith('/admin/settings/models'),- },- ]- : []),- {- to: '/admin/settings/backends',- label: t('nav.backends'),- icon: Bot,- match: (p) => p.startsWith('/admin/settings/backends'),- },- ...(memoryNavVisible- ? [{ to: '/admin/settings/memory', label: t('memory.betaTitle'), icon: Brain, match: isMemorySettingsPath }]- : []),- {- to: '/admin/permissions',- label: t('nav.permissions'),- icon: ShieldCheck,- match: (p: string) => p.startsWith('/admin/permissions'),- },- {- // 高级设置: the remaining Settings tabs (messaging leads). Platforms,- // backends, models, and Memory have their own sidebar destinations, so- // exclude those routes from the active match.- to: '/admin/settings/messaging',- label: t('nav.advancedSettings'),- icon: Settings,- match: (pathname) => isAdvancedSettingsPath(pathname, memoryNavVisible),- },- ];-- // Second half of the runtime-access gate: a page the redirect above withholds- // must not still be advertised, or a non-owner taps a nav entry and lands- // back on the Workbench.- const visibleAdminItems = visibleAdminNavItems(adminItems, capabilities.can_manage_instance);-- const items: ShellNavItem[] = shellMode === 'admin' ? visibleAdminItems : [];-- // A bottom tab bar can't hold the nested admin nav, so mobile keeps a trimmed- // bar with Workbench, Control Panel, More, and Advanced Settings. Permissions- // stays in the More sheet with the other overflow destinations.- const adminMobileTabsAll: ShellNavItem[] = [- { to: '/', label: t('nav.workbench'), icon: Sparkles, variant: 'workbench' },- { to: '/admin/dashboard', label: t('nav.dashboard'), icon: LayoutDashboard },- { label: t('nav.more'), icon: Menu, onClick: () => setAdminMenuOpen(true), match: () => adminMenuOpen },- {- to: '/admin/settings/messaging',- label: t('nav.advancedSettings'),- icon: Settings,- match: (pathname) => isAdvancedSettingsPath(pathname, memoryNavVisible),- },- ];- const adminMobileTabs = visibleAdminNavItems(adminMobileTabsAll, capabilities.can_manage_instance);- // The More sheet shows the overflow: admin sections not already on the bottom- // bar. Keep its filtering aligned with the currently visible primary tabs.- const adminBottomBarPaths = new Set(- adminMobileTabs.map((item) => item.to).filter((to): to is string => !!to && to !== '/'),- );- const adminSheetItems = visibleAdminItems- .filter((item) => !item.to || !adminBottomBarPaths.has(item.to))- // Groups start expanded in the sheet (the sheet is transient — show the- // children up front). The desktop sidebar keeps its collapse-by-default.- .map((item) => (item.children ? { ...item, defaultOpen: true } : item));-// Workbench mobile tabs flatten the (desktop-only) WorkbenchSidebar into a// bottom tab bar: Inbox / Projects / Capabilities / More, around a center// + that opens the workbench canvas (new session). Capabilities routes to@@ -550,9 +330,10 @@ export const AppShell: React.FC = () => {// brand header AND the bottom tab bar are hidden on them.const isChat = location.pathname.startsWith('/chat/');const isSearch = location.pathname === '/search';+ const isSettings = location.pathname === '/settings' || location.pathname.startsWith('/settings/');const isShowPageApp = location.pathname.startsWith('/apps/show/');const isBuiltinApp = isStandaloneAppRoutePath(location.pathname);- const isFullScreenMobile = isChat || isSearch || isShowPageApp || isBuiltinApp;+ const isFullScreenMobile = isChat || isSearch || isSettings || isShowPageApp || isBuiltinApp;const showBottomNav = !isFullScreenMobile && !chromeless && location.pathname !== '/setup';@@ -584,10 +365,6 @@ export const AppShell: React.FC = () => {un-maximize to reach it. */}{!chromeless && (<aside className="fixed inset-y-0 left-0 z-10 hidden w-[240px] flex-col border-r border-border bg-surface md:flex">- {/* Workbench packs more rows (search/inbox/capabilities/projects) into the- sidebar, so it runs a tighter vertical rhythm than admin — less outer- padding and a smaller gap to the bottom cluster — to give the flex-1- Projects list more height. Admin keeps the roomier spacing. */}<div className="flex h-full flex-col">{/* Brand band — flush to the top edge, sharing the chat header'spx-4 py-2.5 row height so the logo centerline lines up with the@@ -608,77 +385,42 @@ export const AppShell: React.FC = () => {</div></Link>- {/* Middle: workspace label + nav list (scrolls). Carries the- horizontal + top padding the outer container used to own; workbench- runs a tighter rhythm than admin to give the flex-1 Projects list- more height. */}- <div className={clsx('flex min-h-0 flex-1 flex-col px-4', shellMode === 'workbench' ? 'gap-3 pt-3' : 'gap-6 pt-4')}>-- {shellMode === 'admin' && items.length > 0 && (- <div className="flex flex-col gap-2">- <div className="px-1 font-mono text-[10px] font-bold uppercase tracking-[0.18em] text-muted">- {t('appShell.workspaceLabel')}- </div>- <nav className="flex flex-col gap-0.5">- {items.map((item) => <ShellNavLink key={item.to} item={item} />)}- </nav>- </div>- )}- {shellMode === 'workbench' && isDesktop && (- <WorkbenchSidebar onOpenSearch={() => setSearchOpen(true)} />- )}+ <div className="flex min-h-0 flex-1 flex-col gap-3 px-4 pt-3">+ {isDesktop && <WorkbenchSidebar onOpenSearch={() => setSearchOpen(true)} />}</div>- {/* Bottom (design.pen NbPMq): row 1 = [Apps | Settings] two equal- buttons; row 2 = [version … run-dot]. Admin keeps its quick-toggles- + hostname between the rows. The whole bottom cluster sits at the+ {/* Bottom (design.pen NbPMq): persistent preferences, Apps + Settings,+ then run state + version. The whole bottom cluster sits at thesidebar's level (z-10) and is covered by a maximized window. Theouter container no longer owns padding (the brand band is flush tothe top edge), so this cluster carries its own px-4 + bottom pad. */}- <div className={clsx('relative flex flex-col gap-3 px-4', shellMode === 'workbench' ? 'pb-4' : 'pb-5')}>- {/* Row 1 — Apps (Dock trigger, left) paired with the mode switch- (right). The Dock rises ABOVE the Apps button, clear of the- centered Chat composer. Workbench → Settings (control panel);- Control Panel → Back to Workbench, the mint counterpart. */}- <div className="flex items-stretch gap-2">- {canUseApps && <AppsLauncher />}- {shellMode === 'workbench' && capabilities.can_manage_instance && (- <Link- to={adminLandingPath(capabilities.can_use_system)}- title={t('appShell.openControlPanel')}- aria-label={t('appShell.openControlPanel')}- className="group flex w-11 shrink-0 items-center justify-center rounded-lg border border-border-strong text-foreground transition-colors hover:bg-foreground/[0.04]"- >- <Settings className="size-[18px] text-muted group-hover:text-foreground" />- </Link>- )}+ <div className="relative flex flex-col gap-3 px-4 pb-4">+ <div className="flex items-center gap-2">+ <LanguageSwitcher openUpward />+ <ThemeToggle />+ <AccountMenu openUpward /></div>- {/* Back-to-Workbench (admin only) gets its own full-width row below- Apps. As a half-width button beside Apps, the English "Workbench"- label + arrow overflowed the 240px sidebar; a full row fits every- locale. */}- {shellMode === 'admin' && (+ <div className="flex items-stretch gap-2">+ {canUseApps && <AppsLauncher />}<Link- to="/"- className="flex items-center justify-center gap-2 rounded-lg border border-mint/30 bg-mint/[0.06] px-3 py-2.5 text-[13px] font-semibold text-mint-ink transition hover:bg-mint/[0.12]"+ to={isSettings+ ? '/'+ : isDesktop+ ? settingsLandingPath(capabilities.can_manage_instance)+ : '/settings'}+ title={t('appShell.openControlPanel')}+ aria-label={t('appShell.openControlPanel')}+ className={clsx(+ 'group flex w-11 shrink-0 items-center justify-center rounded-lg border text-foreground transition-colors',+ isSettings+ ? 'border-mint/40 bg-mint/[0.08]'+ : 'border-border-strong hover:bg-foreground/[0.04]',+ )}>- <ArrowLeft className="size-3.5 shrink-0" />- <span className="truncate">{t('appShell.backToWorkbench')}</span>+ <Settings className={clsx('size-[18px]', isSettings ? 'text-mint-ink' : 'text-muted group-hover:text-foreground')} /></Link>- )}-- {/* Language / theme / account quick-toggles only show in the- Control Panel, which is the operational surface. The- Workbench sidebar stays focused on the agent task itself;- the same controls are reachable by switching modes. */}- {shellMode === 'admin' && (- <div className="flex items-center gap-2">- <LanguageSwitcher openUpward />- <ThemeToggle />- <AccountMenu openUpward />- </div>- )}+ </div>{config?.runtime?.hostname && (<div className="truncate font-mono text-[10px] text-muted">@@ -744,16 +486,17 @@ export const AppShell: React.FC = () => {? 'min-h-0 flex-1 overflow-hidden md:ml-[240px] md:min-h-screen md:flex-none md:overflow-visible md:pb-0': 'flex-1 min-h-0 overflow-y-auto md:ml-[240px] md:min-h-screen md:flex-none md:overflow-visible md:pb-0',!chromeless && (showBottomNav ? 'pb-[calc(5.5rem+env(safe-area-inset-bottom))]' : 'pb-0'),- !chromeless &&- (location.pathname.startsWith('/admin/settings') ? 'page-glow-settings' : 'page-glow-console')+ !chromeless && (isSettings ? 'page-glow-settings' : 'page-glow-console'))}><div className={clsx('w-full',chromeless? 'h-full'- : isFullScreenMobile- ? 'h-full p-0 md:mx-auto md:h-auto md:px-10 md:py-8'+ : isSettings+ ? 'h-full p-0 md:h-auto md:min-h-screen'+ : isFullScreenMobile+ ? 'h-full p-0 md:mx-auto md:h-auto md:px-10 md:py-8': 'mx-auto px-4 py-5 md:px-10 md:py-8',)}>{/* A crashing page only replaces the content area — the sidebar + chrome stay usable, and@@ -766,55 +509,18 @@ export const AppShell: React.FC = () => {</main>{showBottomNav && (- shellMode === 'admin' ? (- <MobileTabBar items={adminMobileTabs} />- ) : (- <MobileTabBar- items={workbenchTabs}- center={capabilities.can_chat- ? { onClick: () => setNewSessionOpen(true), label: t('appShell.newSession'), icon: Plus }- : undefined}- />- )- )}-- {/* Mobile admin nav sheet — the full nested adminItems (groups expand),- opened from the 更多 tab. Mounted only in the admin shell on mobile. */}- {shellMode === 'admin' && adminMenuOpen && (- <div className="fixed inset-0 z-50 md:hidden" role="dialog" aria-modal="true">- <button- type="button"- aria-label={t('common.close')}- onClick={() => setAdminMenuOpen(false)}- className="absolute inset-0 bg-background/70 backdrop-blur-sm"- />- {/* Floats as a card ABOVE the bottom tab bar (not flush to the screen- edge) so the list sits clear of the nav and the thumb-tap zone. */}- <div className="absolute inset-x-2 bottom-[calc(4.5rem+env(safe-area-inset-bottom))] max-h-[68vh] overflow-y-auto rounded-2xl border border-border bg-surface px-3 pb-3 pt-1 shadow-2xl">- <div className="relative flex items-center justify-center py-2">- <span className="font-mono text-[10px] font-bold uppercase tracking-[0.18em] text-muted">- {t('appShell.moreSettings')}- </span>- <button- type="button"- aria-label={t('common.close')}- onClick={() => setAdminMenuOpen(false)}- className="absolute right-1 top-1.5 grid size-8 place-items-center rounded-lg text-muted transition-colors hover:bg-foreground/[0.06] hover:text-foreground"- >- <X className="size-4" />- </button>- </div>- <nav className="flex flex-col gap-0.5 pb-2">- {adminSheetItems.map((item) => <ShellNavLink key={item.to ?? item.label} item={item} />)}- </nav>- </div>- </div>+ <MobileTabBar+ items={workbenchTabs}+ center={capabilities.can_chat+ ? { onClick: () => setNewSessionOpen(true), label: t('appShell.newSession'), icon: Plus }+ : undefined}+ />)}{/* Mobile Dock drawer — the workbench Apps tab summons it (§7.1b). Mobile-only(md:hidden internally); mounted inside DockProvider so it reads the samedocked tiles + order as the desktop Dock. */}- {shellMode === 'workbench' && canUseApps && (+ {canUseApps && (<MobileDockDrawer open={appsDrawerOpen} onClose={() => setAppsDrawerOpen(false)} />)}@@ -826,9 +532,8 @@ export const AppShell: React.FC = () => {/>)}- {/* ⌘K message-search palette. Mounted shell-wide so the shortcut works from- both Workbench and Control Panel; the sidebar field is the workbench- entry point. */}+ {/* ⌘K message-search palette. Mounted shell-wide; the sidebar field is the+ Workbench entry point. */}<SearchPalette open={searchOpen} onClose={() => setSearchOpen(false)} />{/* App windows float over the workbench main area (desktop). The Dock (P2)diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsxdeleted file mode 100644index ad148dd89..000000000--- a/ui/src/components/Dashboard.tsx+++ /dev/null@@ -1,542 +0,0 @@-import React, { useEffect, useMemo, useState } from 'react';-import {- Activity,- ArrowRight,- Cloud,- Clock,- Cpu,- Hash,- MessageSquare,- Play,- PlugZap,- RotateCw,- Square,- Zap,-} from 'lucide-react';-import { Link } from 'react-router-dom';-import { useTranslation } from 'react-i18next';-import clsx from 'clsx';--import { useApi, type LogEntry } from '@/context/ApiContext';-import { useStatus } from '@/context/StatusContext';-import { PlatformIcon } from '@/components/visual';-import { Button } from '@/components/ui/button';-import {- getEnabledPlatforms,- getPlatformCatalog,- isWorkbenchPlatform,- platformSupportsChannels,-} from '@/lib/platforms';--function relativeFromIso(value?: string | null) {- if (!value) return null;- const date = new Date(value);- if (Number.isNaN(date.getTime())) return null;- const diffMs = date.getTime() - Date.now();- const diffSec = Math.round(diffMs / 1000);- const rtf = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });- if (Math.abs(diffSec) < 60) return rtf.format(diffSec, 'second');- const diffMin = Math.round(diffSec / 60);- if (Math.abs(diffMin) < 60) return rtf.format(diffMin, 'minute');- const diffHour = Math.round(diffMin / 60);- return rtf.format(diffHour, 'hour');-}--function absoluteFromIso(value?: string | null) {- if (!value) return null;- const date = new Date(value);- if (Number.isNaN(date.getTime())) return null;- return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit' });-}--function summarizeLog(message: string) {- return message.replace(/^\[[^\]]+\]\s*-?\s*/, '');-}--// Mirrors design.pen NbtYJ (Card/Stat): cornerRadius 12, fill --background,-// stroke --border 1px, padding 20, gap 6. Top row (justify space-between)-// label 13px + icon 16px muted; value 28px bold -0.4 tracking; trend 12px muted.-const statCardClassName =- 'group flex min-h-[126px] flex-col gap-1.5 rounded-xl border border-border bg-background p-5 transition hover:border-border-strong hover:bg-surface-2/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mint/45';--const StatCard: React.FC<{- label: string;- value: string;- hint: string;- icon: React.ReactNode;- to: string;-}> = ({ label, value, hint, icon, to }) => (- <Link to={to} className={statCardClassName}>- <div className="flex items-center justify-between gap-2">- <span className="text-[13px] font-medium text-muted">{label}</span>- <span className="text-muted transition group-hover:text-foreground">{icon}</span>- </div>- <div className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">{value}</div>- <div className="text-[12px] font-medium text-muted">{hint}</div>- </Link>-);--const CloudStatCard: React.FC<{- label: string;- value: string;- hint: string;- icon: React.ReactNode;- cloudHomeUrl: string;- settingsHref: string;- publicUrl?: string | null;-}> = ({ label, value, hint, icon, cloudHomeUrl, settingsHref, publicUrl }) => (- <div className={clsx(statCardClassName, 'relative')}>- <Link- to={settingsHref}- className="absolute inset-0 z-0 rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mint/45"- aria-label={hint}- />- <div className="pointer-events-none relative z-10 flex items-center justify-between gap-2">- <a- href={cloudHomeUrl}- target="_blank"- rel="noreferrer"- className="pointer-events-auto text-[13px] font-medium text-muted transition hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mint/45"- >- {label}- </a>- <span className="text-muted transition group-hover:text-foreground">{icon}</span>- </div>- {publicUrl ? (- <a- href={publicUrl}- target="_blank"- rel="noreferrer"- className="pointer-events-auto relative z-10 w-fit text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground transition hover:text-mint-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mint/45"- >- {value}- </a>- ) : (- <div className="pointer-events-none relative z-10 text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">{value}</div>- )}- <div className="pointer-events-none relative z-10 text-[12px] font-medium text-muted">{hint}</div>- </div>-);--export const Dashboard: React.FC = () => {- const { t } = useTranslation();- const api = useApi();- const { status, control } = useStatus();- const [config, setConfig] = useState<any>(null);- const [doctor, setDoctor] = useState<any>(null);- const [remoteAccess, setRemoteAccess] = useState<any>(null);- const [settingsByPlatform, setSettingsByPlatform] = useState<Record<string, any>>({});- const [usersCount, setUsersCount] = useState(0);- const [recentLogs, setRecentLogs] = useState<LogEntry[]>([]);- const [loading, setLoading] = useState(false);-- useEffect(() => {- let cancelled = false;-- const load = async () => {- try {- const nextConfig = await api.getConfig();- if (cancelled) return;- setConfig(nextConfig);-- const enabledPlatforms = getEnabledPlatforms(nextConfig);- const [doctorRes, remoteAccessRes, logsRes, settingsEntries, usersEntries] = await Promise.all([- api.doctor(),- api.remoteAccessStatus().catch(() => null),- api.getLogs(8, 'service'),- Promise.all(enabledPlatforms.map(async (platform) => [platform, await api.getSettings(platform)] as const)),- Promise.all(enabledPlatforms.map(async (platform) => [platform, await api.getUsers(platform)] as const)),- ]);-- if (cancelled) return;- setDoctor(doctorRes);- setRemoteAccess(remoteAccessRes);- setRecentLogs((logsRes.logs || []).slice(-5).reverse());- setSettingsByPlatform(Object.fromEntries(settingsEntries));- setUsersCount(- usersEntries.reduce((sum, [, payload]) => sum + Object.keys(payload?.users || {}).length, 0)- );- } catch {- if (!cancelled) {- setRecentLogs([]);- }- }- };-- void load();- return () => {- cancelled = true;- };- }, [api]);-- const handleAction = async (action: string) => {- setLoading(true);- try {- await control(action);- } catch (e) {- console.error('Service control action failed', e);- } finally {- setLoading(false);- }- };-- const platformCatalog = useMemo(() => getPlatformCatalog(config), [config]);- const enabledPlatforms = useMemo(() => getEnabledPlatforms(config), [config]);- const lastUpdated = relativeFromIso(status.updated_at);- const startedAtRelative = relativeFromIso(status.started_at);- const startedAtAbsolute = absoluteFromIso(status.started_at);- const totalActiveGroups = useMemo(- () =>- Object.values(settingsByPlatform).reduce(- (sum, payload: any) =>- sum + Object.values(payload?.channels || {}).filter((item: any) => item?.enabled).length,- 0- ),- [settingsByPlatform]- );- const totalDiscoveredGroups = useMemo(- () =>- Object.values(settingsByPlatform).reduce(- (sum, payload: any) => sum + Object.keys(payload?.channels || {}).length,- 0- ),- [settingsByPlatform]- );-- // Surface the always-on Avibe Workbench first; IM transports keep catalog- // order behind it (Array.prototype.sort is stable).- const orderedPlatforms = [...platformCatalog].sort(- (a, b) => Number(isWorkbenchPlatform(b.id)) - Number(isWorkbenchPlatform(a.id))- );-- const platformCards = orderedPlatforms.map((platform) => {- const platformSettings = settingsByPlatform[platform.id] || {};- const groups = platformSettings.channels || {};- const activeGroups = Object.values(groups).filter((item: any) => item?.enabled).length;- const discoveredGroups = Object.keys(groups).length;- const isWorkbench = isWorkbenchPlatform(platform.id);- const enabled = enabledPlatforms.includes(platform.id);- const supportsGroups = platformSupportsChannels(config, platform.id);-- // The workbench has no externally-discovered groups, so the group-count- // summary is meaningless there — leave the subtitle empty.- const hint = isWorkbench- ? null- : supportsGroups- ? t('dashboard.platformGroupsHint')- .replace('{{active}}', String(activeGroups))- .replace('{{discovered}}', String(discoveredGroups))- : t('dashboard.platformNoGroupsHint');-- return {- id: platform.id,- title: t(platform.title_key || `platform.${platform.id}.title`),- // ``enabled`` still drives the "Active platforms" metric titles below,- // which count only configured IM transports. The status pill uses- // ``connected`` instead: the in-process workbench is always live, so it- // can never read as "not configured".- enabled,- connected: isWorkbench || enabled,- hint,- // The workbench's action opens the local workbench home rather than IM- // group routing.- actionHref: isWorkbench ? '/' : supportsGroups ? '/admin/groups' : '/settings/platforms',- actionLabel: isWorkbench || supportsGroups ? t('dashboard.manageRoute') : t('dashboard.configure'),- };- });-- const isRunning = status.state === 'running';- const rawCloudPublicUrl = String(remoteAccess?.public_url || '');- const cloudPublicUrl = rawCloudPublicUrl.replace(/^https?:\/\//, '');- const cloudPublicHref = remoteAccess?.paired && rawCloudPublicUrl- ? rawCloudPublicUrl.match(/^https?:\/\//)- ? rawCloudPublicUrl- : `https://${rawCloudPublicUrl}`- : null;- const cloudValue = remoteAccess?.paired- ? remoteAccess?.running- ? t('dashboard.metricCloudConnected')- : t('dashboard.metricCloudConfigured')- : t('dashboard.metricCloudDisconnected');- const cloudHint = remoteAccess?.paired- ? remoteAccess?.running- ? t('dashboard.metricCloudHintConnected', { url: cloudPublicUrl || 'avibe.bot' })- : t('dashboard.metricCloudHintConfigured')- : t('dashboard.metricCloudHintDisconnected');-- // The always-on Avibe Workbench counts as a connected platform (it can never- // be "not configured"), so the metric value + its titles use ``connected`` —- // consistent with the platform list below and the catalog denominator, which- // both already include the workbench.- const connectedPlatformCards = platformCards.filter((p) => p.connected);- const activePlatformCount = connectedPlatformCards.length;- const enabledPlatformTitles = connectedPlatformCards.map((p) => p.title).join(' · ');-- return (- <div className="flex flex-col gap-8">- <div className="flex flex-col gap-1.5">- <h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">- {t('dashboard.title')}- </h1>- <p className="text-[14px] text-muted">{t('dashboard.subtitle')}</p>- </div>-- {/* Mirrors design.pen kgGuL (heroStatus): cornerRadius 16, fill --surface-2,- mint stroke 33%, padding [28, 32], shadow blur 48 #5BFFA014 y24 spread -12 */}- <div- className={clsx(- 'flex flex-wrap items-center justify-between gap-6 rounded-2xl border bg-surface-2 px-6 py-7 md:px-8',- 'shadow-mint-card',- isRunning ? 'border-mint/30' : 'border-border'- )}- >- <div className="flex min-w-0 items-center gap-5">- {/* heroPulse: 52×52 mint-soft circle, blur 24 spread -6 #5BFFA070 glow */}- <div- className={clsx(- 'flex size-[52px] shrink-0 items-center justify-center rounded-full border',- isRunning- ? 'border-mint/35 bg-mint/[0.08] shadow-glow-md-mint'- : 'border-border bg-foreground/[0.04]'- )}- >- <Zap- className={clsx('size-5', isRunning ? 'text-mint-ink' : 'text-muted')}- strokeWidth={2.25}- />- </div>- <div className="flex min-w-0 flex-col gap-1.5">- <div className="flex flex-wrap items-center gap-2">- <span- className={clsx(- 'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em]',- isRunning- ? 'border-mint/30 bg-mint/[0.08] text-mint-ink'- : 'border-border bg-foreground/[0.04] text-muted'- )}- >- <span- className={clsx(- 'size-1.5 rounded-full',- isRunning ? 'bg-mint shadow-glow-dot-mint' : 'bg-muted'- )}- />- {isRunning ? t('dashboard.runningTitle') : t('dashboard.stoppedTitle')}- </span>- {!doctor?.ok && (- <span className="inline-flex items-center rounded-full border border-gold/30 bg-gold/10 px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em] text-gold-ink">- {t('dashboard.levelAttention')}- </span>- )}- </div>- <div className="text-[18px] font-semibold leading-snug text-foreground">- {t('dashboard.heroTitle')}- </div>- <div className="flex flex-wrap items-center gap-x-2.5 gap-y-1 font-mono text-[11px] leading-none text-muted">- <span className="inline-flex items-center gap-1">- <Cpu className="size-3 shrink-0" strokeWidth={2} />- {status.service_pid || status.pid- ? `PID ${status.service_pid || status.pid}`- : t('common.unknown')}- </span>- {isRunning && startedAtAbsolute && (- <span- className="inline-flex items-center gap-1"- title={status.started_at as string | undefined}- >- <Clock className="size-3 shrink-0" strokeWidth={2} />- {t('dashboard.startedAt', {- time: startedAtAbsolute,- relative: startedAtRelative ?? '',- })}- </span>- )}- {!isRunning && lastUpdated && (- <span className="inline-flex items-center gap-1">- <Clock className="size-3 shrink-0" strokeWidth={2} />- {lastUpdated}- </span>- )}- {status.last_action && <span>· {status.last_action}</span>}- </div>- </div>- </div>-- <div className="flex flex-wrap items-center gap-2">- {!isRunning && (- <Button- type="button"- variant="brand"- size="sm"- onClick={() => void handleAction('start')}- disabled={loading}- >- <Play className="size-3.5" strokeWidth={2.5} />- {t('common.start')}- </Button>- )}- {isRunning && (- <Button- type="button"- variant="secondary"- size="sm"- onClick={() => void handleAction('stop')}- disabled={loading}- >- <Square className="size-3.5" strokeWidth={2.5} />- {t('common.stop')}- </Button>- )}- <Button- type="button"- variant={isRunning ? 'brand' : 'secondary'}- size="sm"- onClick={() => void handleAction('restart')}- disabled={loading}- >- <RotateCw className="size-3.5" strokeWidth={2.5} />- {t('common.restart')}- </Button>- </div>- </div>-- {/* Mirrors design.pen statsRow + NbtYJ Card/Stat */}- <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">- {/* Avibe (remote access) card leads the row. */}- <CloudStatCard- label={t('dashboard.metricCloud')}- value={cloudValue}- hint={cloudHint}- icon={<Cloud className="size-4" />}- cloudHomeUrl="https://avibe.bot"- settingsHref="/admin/remote-access"- publicUrl={cloudPublicHref}- />- <StatCard- label={t('dashboard.metricPlatforms')}- value={`${activePlatformCount} / ${platformCatalog.length}`}- hint={enabledPlatformTitles || t('dashboard.metricPlatformsHint')}- icon={<PlugZap className="size-4" />}- to="/admin/settings/platforms"- />- <StatCard- label={t('dashboard.metricGroups')}- value={String(totalActiveGroups)}- hint={t('dashboard.metricGroupsHint').replace('{{count}}', String(totalDiscoveredGroups))}- icon={<Hash className="size-4" />}- to="/admin/groups"- />- <StatCard- label={t('dashboard.metricUsers')}- value={String(usersCount)}- hint={t('dashboard.metricUsersHint')}- icon={<MessageSquare className="size-4" />}- to="/admin/users"- />- </div>-- {/* Mirrors design.pen l0yMzY (twoCol) — platformsCard 1.2fr / activityCard 420px.- Both: cornerRadius 12, fill --background, stroke --border 1px,- head padding [20, 24] with bottom border, body fill_container. */}- <div className="grid gap-6 xl:grid-cols-[1.2fr_0.8fr]">- <div className="flex flex-col overflow-hidden rounded-xl border border-border bg-background">- <div className="flex items-center justify-between gap-4 border-b border-border px-6 py-5">- <div className="flex flex-col gap-0.5">- <h2 className="text-[15px] font-semibold text-foreground">- {t('dashboard.platformOverviewTitle')}- </h2>- <p className="text-[12px] text-muted">{t('dashboard.platformOverviewSubtitle')}</p>- </div>- <Link- to="/admin/settings/platforms"- className="inline-flex items-center gap-1 rounded-lg border border-border bg-foreground/[0.04] px-3 py-1.5 text-[12px] font-medium text-foreground transition hover:border-border-strong"- >- {t('dashboard.manageAll')}- <ArrowRight className="size-3.5" strokeWidth={2.25} />- </Link>- </div>- <div className="flex flex-col divide-y divide-border">- {platformCards.map((platform) => (- <div key={platform.id} className="flex items-center justify-between gap-4 px-6 py-4">- <div className="flex min-w-0 items-center gap-3">- <div className="flex size-10 shrink-0 items-center justify-center rounded-lg border border-border bg-surface-2">- <PlatformIcon platform={platform.id as any} size={18} />- </div>- <div className="flex min-w-0 flex-col gap-0.5">- <div className="text-[13px] font-semibold text-foreground">{platform.title}</div>- {platform.hint && (- <div className="text-[11px] text-muted">{platform.hint}</div>- )}- </div>- </div>- <div className="flex items-center gap-3">- <span- className={clsx(- 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium',- platform.connected- ? 'border-mint/30 bg-mint/[0.08] text-mint-ink'- : 'border-border bg-foreground/[0.04] text-muted'- )}- >- {platform.connected ? t('dashboard.connected') : t('dashboard.notConfigured')}- </span>- <Link- to={platform.actionHref}- className="inline-flex items-center gap-1 text-[12px] font-medium text-foreground transition hover:text-mint-ink"- >- {platform.actionLabel}- <ArrowRight className="size-3.5" strokeWidth={2.25} />- </Link>- </div>- </div>- ))}- </div>- </div>-- <div className="flex flex-col overflow-hidden rounded-xl border border-border bg-background">- <div className="flex items-center justify-between gap-4 border-b border-border px-6 py-5">- <div className="flex flex-col gap-0.5">- <h2 className="text-[15px] font-semibold text-foreground">- {t('dashboard.recentActivityTitle')}- </h2>- <p className="text-[12px] text-muted">{t('dashboard.recentActivitySubtitle')}</p>- </div>- <Link- to="/admin/logs"- className="inline-flex items-center gap-1 text-[12px] font-medium text-foreground transition hover:text-mint-ink"- >- {t('common.viewLogs')}- <ArrowRight className="size-3.5" strokeWidth={2.25} />- </Link>- </div>- <div className="flex flex-col divide-y divide-border">- {recentLogs.length === 0 ? (- <div className="px-6 py-8 text-center text-[12px] text-muted">- {t('dashboard.recentActivityEmpty')}- </div>- ) : (- recentLogs.map((entry, index) => (- <div- key={`${entry.timestamp}-${index}`}- className="flex items-start gap-3 px-6 py-3.5"- >- <div className="mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full border border-cyan/30 bg-cyan/[0.08] text-cyan-ink">- <Activity className="size-3.5" strokeWidth={2.25} />- </div>- <div className="flex min-w-0 flex-1 flex-col gap-0.5">- <div className="line-clamp-2 text-[12px] font-medium text-foreground">- {summarizeLog(entry.message)}- </div>- <div className="font-mono text-[10px] text-muted">- {relativeFromIso(entry.timestamp) || entry.timestamp} · {entry.logger}- </div>- </div>- </div>- ))- )}- </div>- </div>- </div>- </div>- );-};diff --git a/ui/src/components/LanguageSwitcher.test.tsx b/ui/src/components/LanguageSwitcher.test.tsxnew file mode 100644index 000000000..6f0fe7230--- /dev/null+++ b/ui/src/components/LanguageSwitcher.test.tsx@@ -0,0 +1,60 @@+/* @vitest-environment jsdom */++import { cleanup, render, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { LanguageSwitcher } from './LanguageSwitcher';++const api = vi.hoisted(() => ({ getConfig: vi.fn(), mutateConfig: vi.fn() }));+const authorization = vi.hoisted(() => ({+ capabilities: { can_manage_instance: true },+}));+const i18n = vi.hoisted(() => ({+ language: 'en',+ options: { resources: { en: {}, zh: {} } },+ changeLanguage: vi.fn(),+}));++vi.mock('../context/ApiContext', () => ({ useApi: () => api }));+vi.mock('../context/InstanceAuthorizationContext', () => ({+ useInstanceAuthorization: () => authorization,+}));+vi.mock('react-i18next', () => ({+ useTranslation: () => ({ t: (key: string) => key, i18n }),+}));++beforeEach(() => {+ authorization.capabilities.can_manage_instance = true;+ i18n.language = 'en';+ i18n.changeLanguage.mockResolvedValue(undefined);+ api.getConfig.mockResolvedValue({ language: 'en' });+ api.mutateConfig.mockResolvedValue(undefined);+});++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe('LanguageSwitcher role-aware persistence', () => {+ it('keeps a member browser preference without reading or writing the instance default', async () => {+ authorization.capabilities.can_manage_instance = false;+ const user = userEvent.setup();+ render(<LanguageSwitcher />);++ await user.click(screen.getByRole('button', { name: 'language.en' }));+ await user.click(screen.getByRole('option', { name: 'language.zh' }));++ expect(i18n.changeLanguage).toHaveBeenCalledWith('zh');+ expect(api.getConfig).not.toHaveBeenCalled();+ expect(api.mutateConfig).not.toHaveBeenCalled();+ });++ it('loads the instance default for an owner', async () => {+ api.getConfig.mockResolvedValue({ language: 'zh' });+ render(<LanguageSwitcher />);++ await waitFor(() => expect(i18n.changeLanguage).toHaveBeenCalledWith('zh'));+ });+});diff --git a/ui/src/components/LanguageSwitcher.tsx b/ui/src/components/LanguageSwitcher.tsxindex 8a4dc0de3..ba6d171cb 100644--- a/ui/src/components/LanguageSwitcher.tsx+++ b/ui/src/components/LanguageSwitcher.tsx@@ -3,15 +3,18 @@ import { useTranslation } from 'react-i18next';import { Check } from 'lucide-react';import clsx from 'clsx';import { useApi } from '../context/ApiContext';+import { useInstanceAuthorization } from '../context/InstanceAuthorizationContext';import { setConfigField } from '../lib/configMutations';export const LanguageSwitcher: React.FC<{ openUpward?: boolean }> = ({ openUpward = false }) => {const { i18n, t } = useTranslation();const { getConfig, mutateConfig } = useApi();+ const { capabilities } = useInstanceAuthorization();const [isOpen, setIsOpen] = useState(false);const wrapRef = useRef<HTMLDivElement>(null);useEffect(() => {+ if (!capabilities.can_manage_instance) return;const loadConfig = async () => {try {const cfg = await getConfig();@@ -23,7 +26,7 @@ export const LanguageSwitcher: React.FC<{ openUpward?: boolean }> = ({ openUpwar}};loadConfig();- }, []);+ }, [capabilities.can_manage_instance, getConfig, i18n]);useEffect(() => {const handleClickOutside = (event: MouseEvent) => {@@ -54,6 +57,7 @@ export const LanguageSwitcher: React.FC<{ openUpward?: boolean }> = ({ openUpwarsetIsOpen(false);if (code === i18n.language) return;i18n.changeLanguage(code);+ if (!capabilities.can_manage_instance) return;try {await mutateConfig([setConfigField(['language'], code)]);} catch {diff --git a/ui/src/components/RemoteAccessPage.tsx b/ui/src/components/RemoteAccessPage.tsxindex 82d7140e1..482401f3a 100644--- a/ui/src/components/RemoteAccessPage.tsx+++ b/ui/src/components/RemoteAccessPage.tsx@@ -3,7 +3,7 @@ import React from 'react';import { RemoteAccess } from '@/components/RemoteAccess';// Remote Access was promoted from a block inside the Service settings page to its-// own sidebar destination (/admin/remote-access). The RemoteAccess component owns+// own Settings destination (/settings/remote-access). The RemoteAccess component owns// the full pairing/tunnel UI including its own header, so this page is a thin host.export const RemoteAccessPage: React.FC = () => <RemoteAccess />;diff --git a/ui/src/components/ShowPagesPage.tsx b/ui/src/components/ShowPagesPage.tsxindex ed7ff09a1..e79ccdafc 100644--- a/ui/src/components/ShowPagesPage.tsx+++ b/ui/src/components/ShowPagesPage.tsx@@ -278,7 +278,7 @@ function ShowPageRow({<div className="flex flex-wrap items-center gap-1.5 text-[11px]"><TriangleAlert size={13} className="text-gold-ink" /><span className="text-muted">{t('showPages.cloudOff')}</span>- <a href="/admin/remote-access" className="font-semibold text-gold-ink hover:underline">+ <a href="/settings/remote-access" className="font-semibold text-gold-ink hover:underline">{t('showPages.connectCloud')} →</a></div>diff --git a/ui/src/components/apps/MobileDockDrawer.tsx b/ui/src/components/apps/MobileDockDrawer.tsxindex bfdcf62ce..7c2c75525 100644--- a/ui/src/components/apps/MobileDockDrawer.tsx+++ b/ui/src/components/apps/MobileDockDrawer.tsx@@ -225,7 +225,7 @@ export const MobileDockDrawer: React.FC<{ open: boolean; onClose: () => void }>and 更多 open a small overflow sheet. Appearance lives inside 更多 sothe three English labels fit without truncation. */}<div className="mt-4 flex items-stretch gap-2 border-t border-border pt-3">- <Link to="/admin/dashboard" onClick={onClose} className={chipClass}>+ <Link to="/settings" onClick={onClose} className={chipClass}><Settings className="size-4 shrink-0" /><span className="truncate">{t('more.controlPanel')}</span></Link>diff --git a/ui/src/components/settings/SettingsClaudeProviderPage.tsx b/ui/src/components/settings/SettingsClaudeProviderPage.tsxindex 820fe68fe..183a1668e 100644--- a/ui/src/components/settings/SettingsClaudeProviderPage.tsx+++ b/ui/src/components/settings/SettingsClaudeProviderPage.tsx@@ -15,7 +15,7 @@ export const SettingsClaudeProviderPage: React.FC = () => {title={t('settings.backends.claudeTitle')}subtitle={t('settings.backends.claudeSubtitle')}breadcrumb={- <Link to="/admin/settings/backends" className="inline-flex items-center gap-1.5 hover:text-foreground">+ <Link to="/settings/backends" className="inline-flex items-center gap-1.5 hover:text-foreground"><ArrowLeft className="size-3" />{t('settings.backends.codexBackToBackends')}</Link>diff --git a/ui/src/components/settings/SettingsCodexProviderPage.tsx b/ui/src/components/settings/SettingsCodexProviderPage.tsxindex 1a8a57a15..7cf64d3b8 100644--- a/ui/src/components/settings/SettingsCodexProviderPage.tsx+++ b/ui/src/components/settings/SettingsCodexProviderPage.tsx@@ -15,7 +15,7 @@ export const SettingsCodexProviderPage: React.FC = () => {title={t('settings.backends.codexTitle')}subtitle={t('settings.backends.codexSubtitle')}breadcrumb={- <Link to="/admin/settings/backends" className="inline-flex items-center gap-1.5 hover:text-foreground">+ <Link to="/settings/backends" className="inline-flex items-center gap-1.5 hover:text-foreground"><ArrowLeft className="size-3" />{t('settings.backends.codexBackToBackends')}</Link>diff --git a/ui/src/components/settings/SettingsDependenciesPage.tsx b/ui/src/components/settings/SettingsDependenciesPage.tsxindex f8c37d570..7110e10f5 100644--- a/ui/src/components/settings/SettingsDependenciesPage.tsx+++ b/ui/src/components/settings/SettingsDependenciesPage.tsx@@ -232,7 +232,7 @@ export const SettingsDependenciesPage: React.FC = () => {</Badge>{isMemoryRuntime && d.installed && (<Button asChild variant="secondary" size="xs">- <Link to="/admin/settings/memory">+ <Link to="/settings/memory">{t('common.configure')}<ArrowUpRight className="size-3.5" /></Link>@@ -344,7 +344,7 @@ export const SettingsDependenciesPage: React.FC = () => {detail={t('settings.dependencies.backendsDetail')}actions={<Button asChild variant="secondary" size="xs">- <Link to="/admin/settings/backends">+ <Link to="/settings/backends">{t('settings.dependencies.manageBackends')}<ArrowUpRight className="size-3.5" /></Link>diff --git a/ui/src/components/settings/SettingsDiagnosticsPage.tsx b/ui/src/components/settings/SettingsDiagnosticsPage.tsxindex 44353616e..92e2d79c7 100644--- a/ui/src/components/settings/SettingsDiagnosticsPage.tsx+++ b/ui/src/components/settings/SettingsDiagnosticsPage.tsx@@ -1,9 +1,45 @@import React from 'react';+import { NavLink } from 'react-router-dom';import { useTranslation } from 'react-i18next';+import { FileText, Stethoscope } from 'lucide-react';+import clsx from 'clsx';import { DoctorPanel } from '@/components/steps/DoctorPanel';import { SettingsPageShell } from './SettingsPageShell';+export const DiagnosticsSectionTabs: React.FC = () => {+ const { t } = useTranslation();+ const tabs = [+ { to: '/settings/diagnostics', label: t('settings.diagnosticsTab'), icon: Stethoscope, end: true },+ { to: '/settings/diagnostics/logs', label: t('settings.logsTab'), icon: FileText, end: false },+ ];++ return (+ <nav+ aria-label={t('settings.diagnosticsNavigationLabel')}+ className="inline-flex w-fit rounded-lg border border-border bg-foreground/[0.03] p-1"+ >+ {tabs.map((tab) => {+ const Icon = tab.icon;+ return (+ <NavLink+ key={tab.to}+ to={tab.to}+ end={tab.end}+ className={({ isActive }) => clsx(+ 'inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-[12px] font-medium transition-colors',+ isActive ? 'bg-surface text-foreground shadow-sm' : 'text-muted hover:text-foreground',+ )}+ >+ <Icon className="size-3.5" />+ {tab.label}+ </NavLink>+ );+ })}+ </nav>+ );+};+export const SettingsDiagnosticsPage: React.FC = () => {const { t } = useTranslation();@@ -13,7 +49,8 @@ export const SettingsDiagnosticsPage: React.FC = () => {title={t('settings.diagnosticsTitle')}subtitle={t('settings.diagnosticsSubtitle')}>- <DoctorPanel isPage logsPath="/admin/logs" titleKey="settings.diagnosticsDoctorTitle" />+ <DiagnosticsSectionTabs />+ <DoctorPanel isPage logsPath="/settings/diagnostics/logs" titleKey="settings.diagnosticsDoctorTitle" /></SettingsPageShell>);};diff --git a/ui/src/components/settings/SettingsLayout.test.tsx b/ui/src/components/settings/SettingsLayout.test.tsxnew file mode 100644index 000000000..264d42838--- /dev/null+++ b/ui/src/components/settings/SettingsLayout.test.tsx@@ -0,0 +1,128 @@+/* @vitest-environment jsdom */++import { act, cleanup, render, screen, waitFor } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { MemoryRouter, Route, Routes } from 'react-router-dom';++import { SettingsLayout } from './SettingsLayout';++const api = vi.hoisted(() => ({+ getConfig: vi.fn(),+ getMemorySettings: vi.fn(),+}));+const authorization = vi.hoisted(() => ({+ capabilities: { can_manage_instance: true },+}));+const media = vi.hoisted(() => ({+ matches: false,+ listeners: new Set<(event: MediaQueryListEvent) => void>(),+}));++vi.mock('@/context/ApiContext', () => ({ useApi: () => api }));+vi.mock('@/context/InstanceAuthorizationContext', () => ({+ useInstanceAuthorization: () => authorization,+}));+vi.mock('react-i18next', () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}));++const renderLayout = (path: string) => render(+ <MemoryRouter initialEntries={[path]}>+ <Routes>+ <Route path="/settings" element={<SettingsLayout />}>+ <Route path="replies" element={<div>replies-body</div>} />+ </Route>+ </Routes>+ </MemoryRouter>,+);++beforeEach(() => {+ window.localStorage.clear();+ authorization.capabilities.can_manage_instance = true;+ media.matches = false;+ media.listeners.clear();+ api.getConfig.mockResolvedValue({ capabilities: { model_hub: { enabled: true } } });+ api.getMemorySettings.mockResolvedValue({ status: 'ok', enabled: true });+ vi.stubGlobal('matchMedia', vi.fn().mockReturnValue({+ get matches() {+ return media.matches;+ },+ addEventListener: (_type: string, listener: (event: MediaQueryListEvent) => void) => media.listeners.add(listener),+ removeEventListener: (_type: string, listener: (event: MediaQueryListEvent) => void) => media.listeners.delete(listener),+ }));+});++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+ vi.unstubAllGlobals();+});++describe('SettingsLayout', () => {+ it('renders the three-group rail and feature-gated owner sections', async () => {+ renderLayout('/settings/replies');++ expect(screen.getByText('replies-body')).toBeTruthy();+ expect(screen.getByText('settings.groups.agents')).toBeTruthy();+ expect(screen.getByText('settings.groups.connections')).toBeTruthy();+ expect(screen.getByText('settings.groups.system')).toBeTruthy();+ await waitFor(() => {+ expect(screen.getByRole('link', { name: 'settings.sections.models' })).toBeTruthy();+ expect(screen.getByRole('link', { name: 'settings.sections.memory' })).toBeTruthy();+ });+ });++ it('keeps member preferences, Replies, and Access while preserving the phase-2 permission gate', () => {+ authorization.capabilities.can_manage_instance = false;+ renderLayout('/settings/replies');++ expect(screen.getByText('replies-body')).toBeTruthy();+ expect(screen.getByRole('link', { name: 'settings.sections.replies' })).toBeTruthy();+ expect(screen.getByRole('link', { name: 'settings.sections.access' })).toBeTruthy();+ expect(screen.queryByRole('link', { name: 'settings.sections.service' })).toBeNull();+ expect(api.getConfig).not.toHaveBeenCalled();+ });++ it('selects the landing section when a mobile root viewport becomes desktop', async () => {+ renderLayout('/settings');++ expect(screen.queryByText('replies-body')).toBeNull();+ act(() => {+ media.matches = true;+ media.listeners.forEach((listener) => listener({ matches: true } as MediaQueryListEvent));+ });++ await waitFor(() => expect(screen.getByText('replies-body')).toBeTruthy());+ });++ it('refreshes Memory visibility after its settings change', async () => {+ renderLayout('/settings/replies');+ await waitFor(() => {+ expect(screen.getByRole('link', { name: 'settings.sections.memory' })).toBeTruthy();+ });++ api.getMemorySettings.mockResolvedValueOnce({ status: 'ok', enabled: false });+ act(() => window.dispatchEvent(new Event('avibe:memory-settings-changed')));++ await waitFor(() => {+ expect(screen.queryByRole('link', { name: 'settings.sections.memory' })).toBeNull();+ });+ });++ it('keeps the mobile header below the safe-area inset', () => {+ renderLayout('/settings/replies');++ expect(screen.getByRole('banner').className).toContain('pt-[env(safe-area-inset-top)]');+ });++ it('keeps mobile navigation and detail controls above the bottom safe-area inset', () => {+ renderLayout('/settings/replies');++ expect(screen.getByRole('navigation', { name: 'settings.navigationLabel' }).className).toContain(+ 'env(safe-area-inset-bottom)',+ );+ expect(screen.getByText('replies-body').closest('section')?.firstElementChild?.className).toContain(+ 'env(safe-area-inset-bottom)',+ );+ });+});diff --git a/ui/src/components/settings/SettingsLayout.tsx b/ui/src/components/settings/SettingsLayout.tsxnew file mode 100644index 000000000..9d2e1b88c--- /dev/null+++ b/ui/src/components/settings/SettingsLayout.tsx@@ -0,0 +1,224 @@+import React, { useEffect, useMemo, useState } from 'react';+import { NavLink, Outlet, useLocation, useNavigate } from 'react-router-dom';+import {+ Bot,+ Brain,+ ChevronLeft,+ Cpu,+ Globe,+ MessageSquare,+ Package,+ PlugZap,+ Server,+ Settings,+ ShieldCheck,+ Stethoscope,+ X,+} from 'lucide-react';+import { useTranslation } from 'react-i18next';+import clsx from 'clsx';++import { useApi } from '@/context/ApiContext';+import { useInstanceAuthorization } from '@/context/InstanceAuthorizationContext';+import { memoryNavShouldBeVisible } from '@/lib/memorySettings';+import { rememberSettingsPath, settingsLandingPath } from '@/lib/adminNavigation';+import { useIsDesktop } from '@/lib/useIsDesktop';+import { modelHubEnabledFromConfig } from './models/featureFlags';++type SettingsItem = {+ path: string;+ labelKey: string;+ icon: React.ComponentType<{ className?: string }>;+ ownerOnly?: boolean;+ feature?: 'models' | 'memory';+};++type SettingsGroup = {+ labelKey: string;+ items: SettingsItem[];+};++const SETTINGS_GROUPS: SettingsGroup[] = [+ {+ labelKey: 'settings.groups.agents',+ items: [+ { path: '/settings/backends', labelKey: 'settings.sections.backends', icon: Bot, ownerOnly: true },+ { path: '/settings/models', labelKey: 'settings.sections.models', icon: Cpu, ownerOnly: true, feature: 'models' },+ { path: '/settings/memory', labelKey: 'settings.sections.memory', icon: Brain, ownerOnly: true, feature: 'memory' },+ { path: '/settings/replies', labelKey: 'settings.sections.replies', icon: MessageSquare },+ ],+ },+ {+ labelKey: 'settings.groups.connections',+ items: [+ { path: '/settings/platforms', labelKey: 'settings.sections.platforms', icon: PlugZap, ownerOnly: true },+ { path: '/settings/remote-access', labelKey: 'settings.sections.remoteAccess', icon: Globe, ownerOnly: true },+ ],+ },+ {+ labelKey: 'settings.groups.system',+ items: [+ { path: '/settings/service', labelKey: 'settings.sections.service', icon: Server, ownerOnly: true },+ { path: '/settings/dependencies', labelKey: 'settings.sections.dependencies', icon: Package, ownerOnly: true },+ { path: '/settings/diagnostics', labelKey: 'settings.sections.diagnostics', icon: Stethoscope, ownerOnly: true },+ { path: '/settings/access', labelKey: 'settings.sections.access', icon: ShieldCheck },+ ],+ },+];++const pathMatches = (pathname: string, itemPath: string): boolean =>+ pathname === itemPath || pathname.startsWith(`${itemPath}/`);++export const SettingsLayout: React.FC = () => {+ const { t } = useTranslation();+ const api = useApi();+ const { capabilities } = useInstanceAuthorization();+ const location = useLocation();+ const navigate = useNavigate();+ const isDesktop = useIsDesktop();+ const [modelHubVisible, setModelHubVisible] = useState(false);+ const [memoryVisible, setMemoryVisible] = useState(false);+ const atRoot = location.pathname === '/settings' || location.pathname === '/settings/';++ useEffect(() => {+ if (!capabilities.can_manage_instance) return;+ let cancelled = false;+ let memoryRequest = 0;+ const refreshMemoryVisibility = () => {+ const request = ++memoryRequest;+ void api.getMemorySettings()+ .then((memory) => {+ if (!cancelled && request === memoryRequest) {+ setMemoryVisible(memoryNavShouldBeVisible(memory));+ }+ })+ .catch(() => {+ if (!cancelled && request === memoryRequest) setMemoryVisible(false);+ });+ };+ void api.getConfig()+ .then((config) => {+ if (!cancelled) setModelHubVisible(modelHubEnabledFromConfig(config));+ })+ .catch(() => {+ if (!cancelled) setModelHubVisible(false);+ });+ refreshMemoryVisibility();+ window.addEventListener('avibe:memory-settings-changed', refreshMemoryVisibility);+ return () => {+ cancelled = true;+ window.removeEventListener('avibe:memory-settings-changed', refreshMemoryVisibility);+ };+ }, [api, capabilities.can_manage_instance]);++ const visibleGroups = useMemo(+ () => SETTINGS_GROUPS.map((group) => ({+ ...group,+ items: group.items.filter((item) => {+ if (item.ownerOnly && !capabilities.can_manage_instance) return false;+ if (item.feature === 'models') return modelHubVisible;+ if (item.feature === 'memory') return memoryVisible;+ return true;+ }),+ })).filter((group) => group.items.length > 0),+ [capabilities.can_manage_instance, memoryVisible, modelHubVisible],+ );++ useEffect(() => {+ if (atRoot || !location.pathname.startsWith('/settings/')) return;+ rememberSettingsPath(location.pathname);+ }, [atRoot, location.pathname]);++ useEffect(() => {+ if (!atRoot || !isDesktop) return;+ navigate(settingsLandingPath(capabilities.can_manage_instance), { replace: true });+ }, [atRoot, capabilities.can_manage_instance, isDesktop, navigate]);++ return (+ <div className="flex min-h-full flex-col bg-background md:min-h-screen">+ <header className="flex h-[calc(3.5rem+env(safe-area-inset-top))] shrink-0 items-center justify-between border-b border-border bg-surface px-4 pt-[env(safe-area-inset-top)] md:h-14 md:pt-0">+ <div className="flex min-w-0 items-center gap-2 text-[13px] font-semibold text-foreground">+ <Settings className="size-4 text-mint-ink" />+ <span>{t('nav.settings')}</span>+ {!atRoot && (+ <>+ <span className="text-border-strong">/</span>+ <span className="truncate font-normal text-muted">+ {t(+ visibleGroups.flatMap((group) => group.items)+ .find((item) => pathMatches(location.pathname, item.path))?.labelKey ?? 'nav.settings',+ )}+ </span>+ </>+ )}+ </div>+ <NavLink+ to="/"+ aria-label={t('settings.close')}+ className="grid size-8 place-items-center rounded-lg text-muted transition hover:bg-foreground/[0.05] hover:text-foreground"+ >+ <X className="size-4" />+ </NavLink>+ </header>++ <div className="flex min-h-0 flex-1">+ <nav+ aria-label={t('settings.navigationLabel')}+ className={clsx(+ 'min-h-0 shrink-0 overflow-y-auto border-r border-border bg-surface/70 px-2 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3',+ 'w-full md:flex md:w-14 md:flex-col lg:w-[196px]',+ !atRoot && 'hidden',+ )}+ >+ {visibleGroups.map((group) => (+ <div key={group.labelKey} className="mb-2 last:mb-0">+ <div className="px-2 pb-1 pt-1 font-mono text-[9px] font-bold uppercase tracking-[0.16em] text-muted md:hidden lg:block">+ {t(group.labelKey)}+ </div>+ <div className="flex flex-col gap-0.5">+ {group.items.map((item) => {+ const Icon = item.icon;+ return (+ <NavLink+ key={item.path}+ to={item.path}+ title={t(item.labelKey)}+ className={({ isActive }) => clsx(+ 'flex items-center gap-2 rounded-lg px-2 py-2 text-[12.5px] font-medium transition-colors',+ 'md:justify-center lg:justify-start',+ isActive || pathMatches(location.pathname, item.path)+ ? 'bg-mint/[0.09] text-foreground'+ : 'text-muted hover:bg-foreground/[0.04] hover:text-foreground',+ )}+ >+ <Icon className={clsx(+ 'size-4 shrink-0',+ pathMatches(location.pathname, item.path) ? 'text-mint-ink' : 'text-muted',+ )} />+ <span className="truncate md:hidden lg:block">{t(item.labelKey)}</span>+ </NavLink>+ );+ })}+ </div>+ </div>+ ))}+ </nav>++ <section className={clsx('min-w-0 flex-1 overflow-y-auto', atRoot && 'hidden md:block')}>+ <div className="mx-auto w-full max-w-[1180px] px-4 pb-[calc(1.25rem+env(safe-area-inset-bottom))] pt-5 md:px-6 md:pb-7 md:pt-7 lg:px-8">+ {!atRoot && (+ <NavLink+ to="/settings"+ className="mb-4 inline-flex items-center gap-1.5 text-[12px] font-medium text-muted hover:text-foreground md:hidden"+ >+ <ChevronLeft className="size-3.5" />+ {t('settings.backToSections')}+ </NavLink>+ )}+ <Outlet />+ </div>+ </section>+ </div>+ </div>+ );+};diff --git a/ui/src/components/settings/SettingsLogsPage.tsx b/ui/src/components/settings/SettingsLogsPage.tsxindex c2c303a86..e0ff5d6b5 100644--- a/ui/src/components/settings/SettingsLogsPage.tsx+++ b/ui/src/components/settings/SettingsLogsPage.tsx@@ -3,39 +3,18 @@ import { useTranslation } from 'react-i18next';import { LogsPanel } from '@/components/steps/LogsPanel';import { SettingsPageShell } from './SettingsPageShell';+import { DiagnosticsSectionTabs } from './SettingsDiagnosticsPage';-export const SettingsLogsPage: React.FC<{ standalone?: boolean }> = ({ standalone = false }) => {+export const SettingsLogsPage: React.FC = () => {const { t } = useTranslation();- if (standalone) {- return (- <div className="flex h-full flex-col gap-6">- <div className="flex flex-col gap-1.5">- <h1 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">- {t('settings.logsTitle')}- </h1>- <p className="text-[14px] leading-[1.55] text-muted">{t('settings.logsSubtitle')}</p>- </div>- <LogsPanel titleKey="settings.logsTitle" compactHeader />- </div>- );- }-return (<SettingsPageShellactiveTab="diagnostics"- title={t('settings.logsTitle')}- subtitle={t('settings.logsSubtitle')}- breadcrumb={- <div className="flex items-center gap-2 font-medium">- <span>{t('settings.tabs.serviceRoot')}</span>- <span>›</span>- <span>{t('settings.tabs.diagnostics')}</span>- <span>›</span>- <span className="text-mint-ink">{t('settings.logsTitle')}</span>- </div>- }+ title={t('settings.diagnosticsTitle')}+ subtitle={t('settings.diagnosticsSubtitle')}>+ <DiagnosticsSectionTabs /><LogsPanel titleKey="settings.logsTitle" /></SettingsPageShell>);diff --git a/ui/src/components/settings/SettingsMemoryPage.tsx b/ui/src/components/settings/SettingsMemoryPage.tsxindex f727aae87..80ccd5bd3 100644--- a/ui/src/components/settings/SettingsMemoryPage.tsx+++ b/ui/src/components/settings/SettingsMemoryPage.tsx@@ -280,7 +280,7 @@ export const SettingsMemoryPage: React.FC = () => {</div><p className="text-[12.5px] text-muted">{t('memory.setup.runtimeRequiredHint')}</p><Button asChild variant="secondary" size="sm">- <Link to="/admin/settings/dependencies">+ <Link to="/settings/dependencies">{t('memory.settings.goToDependencies')}<ArrowUpRight className="size-3.5" /></Link>diff --git a/ui/src/components/settings/SettingsMessagingPage.tsx b/ui/src/components/settings/SettingsMessagingPage.tsxindex 18cce7770..6dc6b2fc4 100644--- a/ui/src/components/settings/SettingsMessagingPage.tsx+++ b/ui/src/components/settings/SettingsMessagingPage.tsx@@ -619,7 +619,7 @@ export const SettingsMessagingPage: React.FC = () => {description={t('settings.messagingGroupsHint')}control={<Link- to="/admin/groups"+ to="/settings/platforms/groups"className="inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-foreground/[0.04] px-3 text-[12px] font-medium text-foreground transition hover:border-border-strong">{t('common.manageChannels')}diff --git a/ui/src/components/settings/SettingsOpencodeProviderPage.tsx b/ui/src/components/settings/SettingsOpencodeProviderPage.tsxindex 9a661a241..46668a804 100644--- a/ui/src/components/settings/SettingsOpencodeProviderPage.tsx+++ b/ui/src/components/settings/SettingsOpencodeProviderPage.tsx@@ -15,7 +15,7 @@ export const SettingsOpencodeProviderPage: React.FC = () => {title={t('settings.backends.opencodeTitle')}subtitle={t('settings.backends.opencodeSubtitle')}breadcrumb={- <Link to="/admin/settings/backends" className="inline-flex items-center gap-1.5 hover:text-foreground">+ <Link to="/settings/backends" className="inline-flex items-center gap-1.5 hover:text-foreground"><ArrowLeft className="size-3" />{t('settings.backends.codexBackToBackends')}</Link>diff --git a/ui/src/components/settings/SettingsPageShell.tsx b/ui/src/components/settings/SettingsPageShell.tsxindex 717b405c1..f84548517 100644--- a/ui/src/components/settings/SettingsPageShell.tsx+++ b/ui/src/components/settings/SettingsPageShell.tsx@@ -1,30 +1,6 @@import React from 'react';-import { Link } from 'react-router-dom';-import clsx from 'clsx';-import { useTranslation } from 'react-i18next';-import {- MessageSquare,- Package,- Server,- Stethoscope,-} from 'lucide-react';-type SettingsTab = 'service' | 'platforms' | 'backends' | 'models' | 'dependencies' | 'messaging' | 'diagnostics' | 'memory';--const TABS: Array<{- key: SettingsTab;- href: string;- label: string;- icon: React.ComponentType<{ className?: string }>;-}> = [- // Platforms + Backends were promoted to their own sidebar destinations (平台- // under 通讯平台, and a top-level 后端), so they're no longer Advanced-Settings- // tabs. Messaging leads, per the requested order.- { key: 'messaging', href: '/settings/messaging', label: 'settings.tabs.messaging', icon: MessageSquare },- { key: 'service', href: '/settings/service', label: 'settings.tabs.service', icon: Server },- { key: 'dependencies', href: '/settings/dependencies', label: 'settings.tabs.dependencies', icon: Package },- { key: 'diagnostics', href: '/settings/diagnostics', label: 'settings.tabs.diagnostics', icon: Stethoscope },-];+type SettingsTab = string;export type SettingsPageShellProps = {title: string;@@ -35,10 +11,6 @@ export type SettingsPageShellProps = {children: React.ReactNode;};-// Mirrors design.pen l6PdZd → wH3uC (sTabs):-// underline tabs over a 1px --border baseline. Each tab is padding [10, 16],-// 13px Inter, gap 8 between icon + label. Inactive: muted text/icon, font 500.-// Active: mint 2px bottom border, foreground text, mint icon, font 600.export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({title,subtitle,@@ -47,11 +19,7 @@ export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({actions,children,}) => {- const { t } = useTranslation();- // Platforms + Backends now live in the sidebar, not as Advanced-Settings tabs,- // so when one of those standalone pages renders this shell we hide the tab bar- // (its activeTab isn't one of the remaining tabs).- const showTabs = TABS.some((tab) => tab.key === activeTab);+ void activeTab;return (<div className="flex flex-col gap-6">@@ -63,37 +31,7 @@ export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({{actions && <div className="shrink-0">{actions}</div>}</div>- {showTabs && (- <div className="border-b border-border">- <nav className="-mb-px flex gap-1 overflow-x-auto pb-px" aria-label="Settings sections">- {TABS.map((tab) => {- const Icon = tab.icon;- const active = tab.key === activeTab;- return (- <Link- key={tab.key}- to={tab.href}- className={clsx(- 'inline-flex shrink-0 items-center gap-2 whitespace-nowrap border-b-2 px-4 py-2.5 text-[13px] transition-colors',- active- ? 'border-mint font-semibold text-foreground'- : 'border-transparent font-medium text-muted hover:border-border-strong hover:text-foreground'- )}- >- <Icon className={clsx('size-3.5', active ? 'text-mint-ink' : 'text-muted')} />- {t(tab.label)}- </Link>- );- })}- </nav>- </div>- )}-- {/* Breadcrumb lives below the tabs so it reads as sub-navigation- *within* the active tab (e.g. "← Back to backends" while on the- Backends tab). Placing it above the title/tabs would imply it- navigates out of Settings entirely — a hierarchy mismatch- flagged in page feedback for /settings/backends/{claude,codex}. */}+ {/* Provider/platform detail remains within the active Settings section. */}{breadcrumb && <div className="font-mono text-[11px] text-muted">{breadcrumb}</div>}<div className="flex flex-col gap-4">{children}</div>diff --git a/ui/src/components/settings/SettingsServicePage.tsx b/ui/src/components/settings/SettingsServicePage.tsxindex 21ca46d99..e8cca8aa0 100644--- a/ui/src/components/settings/SettingsServicePage.tsx+++ b/ui/src/components/settings/SettingsServicePage.tsx@@ -25,7 +25,7 @@ export const SettingsServicePage: React.FC = () => {// former in-page anchor (#remote-access) land here, so forward them.useEffect(() => {if (window.location.hash === '#remote-access') {- navigate('/admin/remote-access', { replace: true });+ navigate('/settings/remote-access', { replace: true });}}, [navigate]);const [config, setConfig] = useState<any>(null);diff --git a/ui/src/components/settings/memory/MemorySettingsPanel.tsx b/ui/src/components/settings/memory/MemorySettingsPanel.tsxindex 2be3da426..9ce64dc2b 100644--- a/ui/src/components/settings/memory/MemorySettingsPanel.tsx+++ b/ui/src/components/settings/memory/MemorySettingsPanel.tsx@@ -512,7 +512,7 @@ export const MemorySettingsPanel: React.FC<{<ShieldAlert className="size-3.5 shrink-0" />{t('memory.settings.dependencyNotReady')}<Button asChild variant="secondary" size="xs">- <Link to="/admin/settings/dependencies">+ <Link to="/settings/dependencies">{t('memory.settings.goToDependencies')}<ArrowUpRight className="size-3.5" /></Link>diff --git a/ui/src/components/settings/models/BackendSupplyModeCard.tsx b/ui/src/components/settings/models/BackendSupplyModeCard.tsxindex 90b19054b..a16473911 100644--- a/ui/src/components/settings/models/BackendSupplyModeCard.tsx+++ b/ui/src/components/settings/models/BackendSupplyModeCard.tsx@@ -179,7 +179,7 @@ export const BackendSupplyModeCard: React.FC<{ backend: AgentBackend }> = ({ bac}headerRight={<Link- to="/admin/settings/models"+ to="/settings/models"onClick={(e) => e.stopPropagation()}className="model-hub-action-mint inline-flex shrink-0 items-center gap-1 text-[13px] font-medium transition-colors">diff --git a/ui/src/components/settings/models/ModelHubCapabilityGate.test.tsx b/ui/src/components/settings/models/ModelHubCapabilityGate.test.tsxindex 65e9f2f20..fbbd73b24 100644--- a/ui/src/components/settings/models/ModelHubCapabilityGate.test.tsx+++ b/ui/src/components/settings/models/ModelHubCapabilityGate.test.tsx@@ -9,9 +9,8 @@ import {} from './modelHubRoutes';describe('Model Hub capability route gate', () => {- it('redirects both current and legacy model routes while disabled', () => {+ it('redirects the canonical model route while disabled', () => {expect(modelHubRouteTarget(MODEL_HUB_SETTINGS_PATH, false)).toBe(MODEL_HUB_DISABLED_REDIRECT);- expect(modelHubRouteTarget('/settings/models', false)).toBe(MODEL_HUB_DISABLED_REDIRECT);});it('does not render the Models child while disabled or unresolved', () => {diff --git a/ui/src/components/settings/models/ModelHubCapabilityGate.tsx b/ui/src/components/settings/models/ModelHubCapabilityGate.tsxindex 676929749..e7f1ea43f 100644--- a/ui/src/components/settings/models/ModelHubCapabilityGate.tsx+++ b/ui/src/components/settings/models/ModelHubCapabilityGate.tsx@@ -2,7 +2,7 @@ import * as React from 'react';import { Navigate } from 'react-router-dom';import { useModelHubCapability } from './useModelHubCapability';-import { MODEL_HUB_DISABLED_REDIRECT, MODEL_HUB_SETTINGS_PATH, modelHubRouteTarget } from './modelHubRoutes';+import { MODEL_HUB_DISABLED_REDIRECT } from './modelHubRoutes';export const ModelHubRenderBoundary: React.FC<{enabled: boolean | null;@@ -24,14 +24,3 @@ export const ModelHubCapabilityGate: React.FC<{ children: React.ReactNode }> = (</ModelHubRenderBoundary>);};--export const LegacyModelHubRoute: React.FC = () => {- const enabled = useModelHubCapability();- if (enabled === null) return null;- return (- <Navigate- to={modelHubRouteTarget(MODEL_HUB_SETTINGS_PATH, enabled)}- replace- />- );-};diff --git a/ui/src/components/settings/models/modelHubRoutes.ts b/ui/src/components/settings/models/modelHubRoutes.tsindex 34a65b886..7d079d21f 100644--- a/ui/src/components/settings/models/modelHubRoutes.ts+++ b/ui/src/components/settings/models/modelHubRoutes.ts@@ -1,8 +1,8 @@// Where a Model Hub route lands, by capability. Pure so the redirect contract can be// asserted without mounting the router (see ModelHubCapabilityGate.test.tsx).-export const MODEL_HUB_SETTINGS_PATH = '/admin/settings/models';-export const MODEL_HUB_DISABLED_REDIRECT = '/admin/settings/backends';+export const MODEL_HUB_SETTINGS_PATH = '/settings/models';+export const MODEL_HUB_DISABLED_REDIRECT = '/settings/backends';export const modelHubRouteTarget = (requestedPath: string, enabled: boolean): string =>enabled ? requestedPath : MODEL_HUB_DISABLED_REDIRECT;diff --git a/ui/src/components/steps/ChannelList.tsx b/ui/src/components/steps/ChannelList.tsxindex 690c21e55..466093ee4 100644--- a/ui/src/components/steps/ChannelList.tsx+++ b/ui/src/components/steps/ChannelList.tsx@@ -1146,7 +1146,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBtype="button"variant="brand"size="default"- onClick={() => navigate('/admin/users')}+ onClick={() => navigate('/settings/platforms/users')}><Users size={18} />{t('wechat.manageUserSettings')}diff --git a/ui/src/context/StatusProvider.tsx b/ui/src/context/StatusProvider.tsxindex 59c7c3b0f..bc3f1d365 100644--- a/ui/src/context/StatusProvider.tsx+++ b/ui/src/context/StatusProvider.tsx@@ -37,7 +37,7 @@ export const StatusProvider: React.FC<{ children: React.ReactNode }> = ({ childrconst res = await fetch('/status');if (res.ok) {const data = await res.json();- // Set a fresh object every poll ON PURPOSE. Consumers (notably Dashboard)+ // Set a fresh object every poll ON PURPOSE. Relative-time consumers// recompute "started … ago" / "last updated … ago" relative-time labels// from Date.now() during render and have no timer of their own, so they// rely on this per-poll re-render to keep those labels ticking. Do NOTdiff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 1ef93a334..6d7bd4edb 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -268,6 +268,29 @@}},"settings": {+ "groups": {+ "agents": "Agents",+ "connections": "Connections",+ "system": "System"+ },+ "sections": {+ "backends": "Backends",+ "models": "Models",+ "memory": "Memory",+ "replies": "Replies",+ "platforms": "Platforms",+ "remoteAccess": "Remote Access",+ "service": "Service",+ "dependencies": "Dependencies",+ "diagnostics": "Diagnostics & Logs",+ "access": "Access"+ },+ "navigationLabel": "Settings sections",+ "backToSections": "All settings",+ "close": "Close Settings",+ "diagnosticsTab": "Diagnostics",+ "logsTab": "Logs",+ "diagnosticsNavigationLabel": "Diagnostics and logs","tabs": {"service": "Service","platforms": "Platforms",@@ -278,7 +301,7 @@"serviceRoot": "Settings"},"serviceTitle": "Service",- "serviceSubtitle": "Manage runtime status, console server details, and remote access from one place.",+ "serviceSubtitle": "Manage runtime health, process controls, and console server details from one place.","logFileLabel": "Log file","serviceRuntimeTitle": "Runtime control","serviceRuntimeSubtitle": "Start, stop, and restart the local Avibe service while checking the live process state.",@@ -2713,14 +2736,14 @@"autoUpdateHint": "Automatically install updates when system is idle","usageTips": "Quick Start Guide","tipStartCommand": "Use /start to begin",- "tipStartCommandDesc": "Type /start in any enabled conversation to open the control panel.",+ "tipStartCommandDesc": "Type /start in any enabled conversation to open the Workbench.","tipAgentSwitch": "Switch agents instantly","tipAgentSwitchDesc": "Prefix your message with AgentName: to route to a specific agent. E.g., \"Plan: Design the API\"","tipThread": "Thread = Session","tipThreadDesc": "Each thread is an isolated session. Start multiple threads for parallel tasks.","finishAndStart": "Finish & Start","serviceRunning": "Avibe is running!",- "goToDashboard": "Go to Dashboard",+ "goToDashboard": "Open Workbench","bindCodeTitle": "Your First Bind Code","bindCodeDesc": "Send this command to the bot in a DM to become the first admin:","bindCodeCommand": "bind",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex e53578182..fe363b97a 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -268,6 +268,29 @@}},"settings": {+ "groups": {+ "agents": "Agent",+ "connections": "连接",+ "system": "系统"+ },+ "sections": {+ "backends": "后端",+ "models": "模型",+ "memory": "记忆",+ "replies": "回复",+ "platforms": "通讯平台",+ "remoteAccess": "远程访问",+ "service": "服务",+ "dependencies": "依赖",+ "diagnostics": "诊断与日志",+ "access": "访问"+ },+ "navigationLabel": "设置分区",+ "backToSections": "全部设置",+ "close": "关闭设置",+ "diagnosticsTab": "诊断",+ "logsTab": "日志",+ "diagnosticsNavigationLabel": "诊断与日志","tabs": {"service": "服务","platforms": "平台",@@ -278,7 +301,7 @@"serviceRoot": "设置"},"serviceTitle": "服务",- "serviceSubtitle": "把运行状态、控制台服务配置和远程访问统一收拢到一个页面。",+ "serviceSubtitle": "在一个页面管理运行健康、进程控制和控制台服务配置。","logFileLabel": "日志文件","serviceRuntimeTitle": "运行控制","serviceRuntimeSubtitle": "查看本地 Avibe 进程状态,并执行启动、停止和重启。",@@ -2713,14 +2736,14 @@"autoUpdateHint": "系统空闲时自动安装更新","usageTips": "快速上手","tipStartCommand": "使用 /start 开始",- "tipStartCommandDesc": "在任意已启用的会话中输入 /start 打开控制面板。",+ "tipStartCommandDesc": "在任意已启用的会话中输入 /start 打开工作台。","tipAgentSwitch": "即时切换 Agent","tipAgentSwitchDesc": "在消息前加 AgentName: 前缀即可路由到指定 Agent,如 \"Plan: 设计 API\"","tipThread": "Thread = 会话","tipThreadDesc": "每个 Thread 是独立会话,可开多个 Thread 并行执行任务。","finishAndStart": "完成并启动","serviceRunning": "Avibe 已启动!",- "goToDashboard": "前往控制台",+ "goToDashboard": "打开工作台","bindCodeTitle": "您的首个绑定码","bindCodeDesc": "在私聊中向机器人发送以下命令,成为第一个管理员:","bindCodeCommand": "bind",diff --git a/ui/src/lib/adminNavigation.test.ts b/ui/src/lib/adminNavigation.test.tsindex e352d351c..66ffa1a19 100644--- a/ui/src/lib/adminNavigation.test.ts+++ b/ui/src/lib/adminNavigation.test.ts@@ -1,161 +1,84 @@-import { describe, expect, it } from 'vitest';+/* @vitest-environment jsdom */++import { beforeEach, describe, expect, it } from 'vitest';import {- adminLandingPath,- filterOwnerOnlyNavItems,- isAdvancedSettingsPath,isLocalOnlyMessagingField,- isOwnerOnlyPath,isMemorySettingsPath,- visibleAdminNavItems,+ isOwnerOnlyPath,+ rememberSettingsPath,+ SETTINGS_LAST_PATH_KEY,+ settingsLandingPath,} from './adminNavigation';-describe('isAdvancedSettingsPath', () => {- it('defers to the standalone Memory item when that item is visible', () => {- expect(isAdvancedSettingsPath('/admin/settings/memory', true)).toBe(false);- expect(isAdvancedSettingsPath('/admin/settings/memory/', true)).toBe(false);- });-- it('keeps Memory setup under Advanced Settings when the standalone item is hidden', () => {- expect(isAdvancedSettingsPath('/admin/settings/memory', false)).toBe(true);- expect(isAdvancedSettingsPath('/admin/settings/memory/', false)).toBe(true);- });-- it('keeps the remaining settings pages grouped under Advanced Settings', () => {- expect(isAdvancedSettingsPath('/admin/settings/messaging', true)).toBe(true);- expect(isAdvancedSettingsPath('/admin/settings/service', true)).toBe(true);- expect(isAdvancedSettingsPath('/admin/settings/dependencies', true)).toBe(true);- expect(isAdvancedSettingsPath('/admin/settings/diagnostics', true)).toBe(true);- });-- it('leaves other standalone settings destinations inactive', () => {- expect(isAdvancedSettingsPath('/admin/settings/platforms', true)).toBe(false);- expect(isAdvancedSettingsPath('/admin/settings/backends', true)).toBe(false);- expect(isAdvancedSettingsPath('/admin/settings/models', true)).toBe(false);- });+beforeEach(() => {+ window.localStorage.clear();});describe('isOwnerOnlyPath', () => {- it('covers every destination with an Owner management gate', () => {+ it('covers canonical machine-management destinations and their details', () => {+ const ownerOnly = [+ '/settings/service',+ '/settings/platforms/slack',+ '/settings/remote-access',+ '/settings/backends/claude',+ '/settings/models',+ '/settings/dependencies',+ '/settings/memory',+ '/settings/diagnostics/logs',+ ];+ expect(ownerOnly.every(isOwnerOnlyPath)).toBe(true);+ });++ it('keeps personal preferences, replies, and access readable', () => {+ expect(isOwnerOnlyPath('/settings/replies')).toBe(false);+ expect(isOwnerOnlyPath('/settings/access')).toBe(false);+ });++ it('keeps retired owner routes gated before their redirect runs', () => {expect(isOwnerOnlyPath('/admin/dashboard')).toBe(true);- expect(isOwnerOnlyPath('/admin/remote-access')).toBe(true);- expect(isOwnerOnlyPath('/admin/groups')).toBe(true);- expect(isOwnerOnlyPath('/admin/users')).toBe(true);- expect(isOwnerOnlyPath('/admin/logs')).toBe(true);- expect(isOwnerOnlyPath('/admin/settings/service')).toBe(true);- expect(isOwnerOnlyPath('/admin/settings/platforms')).toBe(true);- expect(isOwnerOnlyPath('/admin/settings/backends')).toBe(true);- expect(isOwnerOnlyPath('/admin/settings/models')).toBe(true);- expect(isOwnerOnlyPath('/admin/settings/dependencies')).toBe(true);- expect(isOwnerOnlyPath('/admin/settings/diagnostics')).toBe(true);- expect(isOwnerOnlyPath('/admin/settings/logs')).toBe(true);- expect(isOwnerOnlyPath('/harness')).toBe(false);- });-- it('matches nested paths under a gated destination', () => {- expect(isOwnerOnlyPath('/admin/settings/platforms/slack')).toBe(true);- expect(isOwnerOnlyPath('/admin/groups/engineering')).toBe(true);- expect(isOwnerOnlyPath('/harness/')).toBe(false);- });-- it('leaves remotely usable destinations open', () => {+ expect(isOwnerOnlyPath('/admin/settings/backends/codex')).toBe(true);expect(isOwnerOnlyPath('/admin/settings/messaging')).toBe(false);expect(isOwnerOnlyPath('/admin/permissions')).toBe(false);- expect(isOwnerOnlyPath('/apps/files')).toBe(false);- expect(isOwnerOnlyPath('/apps/editor')).toBe(false);- expect(isOwnerOnlyPath('/apps/terminal')).toBe(false);- expect(isOwnerOnlyPath('/apps/library')).toBe(false);- expect(isOwnerOnlyPath('/apps/show/session-1')).toBe(false);- expect(isOwnerOnlyPath('/')).toBe(false);- });-- it('does not match a route that only shares a gated prefix', () => {- expect(isOwnerOnlyPath('/admin/dashboards')).toBe(false);- expect(isOwnerOnlyPath('/harness-status')).toBe(false);- expect(isOwnerOnlyPath('/apps/library-picker')).toBe(false);});});-describe('filterOwnerOnlyNavItems', () => {- it('removes Owner-only destinations from nested admin navigation trees', () => {- const visible = filterOwnerOnlyNavItems([- {- children: [- { to: '/admin/settings/platforms' },- { to: '/admin/groups' },- { to: '/admin/settings/messaging' },- ],- },- { onClick: () => undefined },- { to: '/admin/settings/messaging' },- ]);-- expect(visible).toEqual([- {- children: [{ to: '/admin/settings/messaging' }],- },- { onClick: expect.any(Function) },- { to: '/admin/settings/messaging' },- ]);- });-});--describe('visibleAdminNavItems', () => {- const adminItems = [- { to: '/admin/dashboard' },- { to: '/admin/remote-access' },- { to: '/admin/settings/messaging' },- ];-- it('keeps Owner destinations when the caller can manage the instance', () => {- expect(visibleAdminNavItems(adminItems, true)).toEqual(adminItems);+describe('settings landing memory', () => {+ it('remembers the most recent canonical section or detail', () => {+ rememberSettingsPath('/settings/backends/claude');+ expect(window.localStorage.getItem(SETTINGS_LAST_PATH_KEY)).toBe('/settings/backends/claude');+ expect(settingsLandingPath(true)).toBe('/settings/backends/claude');});- it('hides Owner destinations only when the caller cannot manage the instance', () => {- expect(visibleAdminNavItems(adminItems, false)).toEqual([- { to: '/admin/settings/messaging' },- ]);- });-});--describe('adminLandingPath', () => {- it('opens the Dashboard for an owner', () => {- expect(adminLandingPath(true)).toBe('/admin/dashboard');+ it('falls back to Replies for members when an owner-only section was remembered', () => {+ window.localStorage.setItem(SETTINGS_LAST_PATH_KEY, '/settings/service');+ expect(settingsLandingPath(false)).toBe('/settings/replies');});- it('sends a remote owner to an admin page they can actually use', () => {- const destination = adminLandingPath(false);- expect(destination).toBe('/admin/settings/messaging');- expect(isOwnerOnlyPath(destination)).toBe(false);+ it('does not remember transitional platform scope pages as the Settings landing page', () => {+ rememberSettingsPath('/settings/platforms/groups');+ expect(settingsLandingPath(true)).toBe('/settings/replies');});- it('keeps non-owners on messaging settings', () => {- expect(adminLandingPath(false)).toBe('/admin/settings/messaging');+ it.each(['/settings/appearance', '/settings/account'])('retires a remembered preference destination: %s', (path) => {+ window.localStorage.setItem(SETTINGS_LAST_PATH_KEY, path);+ expect(settingsLandingPath(true)).toBe('/settings/replies');});});describe('isLocalOnlyMessagingField', () => {- it('marks messaging controls governed by the Owner capability', () => {+ it('keeps machine-global controls owner-only without gating Replies', () => {expect(isLocalOnlyMessagingField('agents.opencode.error_retry_limit')).toBe(true);expect(isLocalOnlyMessagingField('agents.opencode.active_turn_timeout_seconds')).toBe(true);expect(isLocalOnlyMessagingField('show_pages_prompt')).toBe(true);- });-- it('leaves remote-safe messaging preferences available remotely', () => {- expect(isLocalOnlyMessagingField('ack_mode')).toBe(false);- expect(isLocalOnlyMessagingField('show_duration')).toBe(false);expect(isLocalOnlyMessagingField('reply_enhancements')).toBe(false);});});describe('isMemorySettingsPath', () => {- it('matches the Memory route and nested path boundaries', () => {- expect(isMemorySettingsPath('/admin/settings/memory')).toBe(true);- expect(isMemorySettingsPath('/admin/settings/memory/')).toBe(true);- expect(isMemorySettingsPath('/admin/settings/memory/details')).toBe(true);- });-- it('does not match a route that only shares the Memory prefix', () => {- expect(isMemorySettingsPath('/admin/settings/memory-tools')).toBe(false);+ it('matches the canonical Memory route at a path boundary', () => {+ expect(isMemorySettingsPath('/settings/memory')).toBe(true);+ expect(isMemorySettingsPath('/settings/memory/details')).toBe(true);+ expect(isMemorySettingsPath('/settings/memory-tools')).toBe(false);});});diff --git a/ui/src/lib/adminNavigation.ts b/ui/src/lib/adminNavigation.tsindex 0a05b8ddc..cce64add8 100644--- a/ui/src/lib/adminNavigation.ts+++ b/ui/src/lib/adminNavigation.ts@@ -2,7 +2,9 @@ const matchesRoute = (pathname: string, route: string): boolean =>pathname === route || pathname.startsWith(`${route}/`);export const isMemorySettingsPath = (pathname: string): boolean =>- matchesRoute(pathname, '/admin/settings/memory');+ matchesRoute(pathname, '/settings/memory');++export const SETTINGS_LAST_PATH_KEY = 'avibe.settings.last-path';/*** Destinations that require Instance Owner management capability.@@ -11,6 +13,14 @@ export const isMemorySettingsPath = (pathname: string): boolean =>* `isLocalOnlyMessagingField` below.*/export const OWNER_ONLY_ROUTES = [+ '/settings/service',+ '/settings/platforms',+ '/settings/remote-access',+ '/settings/backends',+ '/settings/models',+ '/settings/dependencies',+ '/settings/memory',+ '/settings/diagnostics','/admin/dashboard','/admin/remote-access','/admin/groups',@@ -34,40 +44,35 @@ const LOCAL_ONLY_MESSAGING_FIELDS = new Set([export const isOwnerOnlyPath = (pathname: string): boolean =>OWNER_ONLY_ROUTES.some((route) => matchesRoute(pathname, route));-export type LocalSystemNavItem = {- to?: string;- onClick?: () => void;- children?: LocalSystemNavItem[];-};--export const filterOwnerOnlyNavItems = <T extends LocalSystemNavItem>(navItems: T[]): T[] =>- navItems- .filter((item) => !item.to || !isOwnerOnlyPath(item.to))- .map((item) =>- item.children ? ({ ...item, children: filterOwnerOnlyNavItems(item.children) } as T) : item,- )- .filter((item) => item.to || item.onClick || (item.children?.length ?? 0) > 0);--export const visibleAdminNavItems = <T extends LocalSystemNavItem>(- navItems: T[],- canManageInstance: boolean,-): T[] => (canManageInstance ? navItems : filterOwnerOnlyNavItems(navItems));-export const isLocalOnlyMessagingField = (field: string): boolean =>LOCAL_ONLY_MESSAGING_FIELDS.has(field);-/**- * Where the "Control Panel" entry points for the current instance role.- */-export const adminLandingPath = (canUseSystem: boolean): string =>- canUseSystem ? '/admin/dashboard' : '/admin/settings/messaging';+const isValidSettingsPath = (pathname: string): boolean =>+ pathname.startsWith('/settings/') &&+ pathname !== '/settings/appearance' &&+ pathname !== '/settings/account' &&+ !pathname.startsWith('/settings/platforms/groups') &&+ !pathname.startsWith('/settings/platforms/users');-export const isAdvancedSettingsPath = (- pathname: string,- memoryNavVisible: boolean,-): boolean =>- pathname.startsWith('/admin/settings') &&- !pathname.startsWith('/admin/settings/platforms') &&- !pathname.startsWith('/admin/settings/backends') &&- !pathname.startsWith('/admin/settings/models') &&- (!memoryNavVisible || !isMemorySettingsPath(pathname));+export const rememberSettingsPath = (pathname: string): void => {+ if (typeof window === 'undefined' || !isValidSettingsPath(pathname)) return;+ try {+ window.localStorage.setItem(SETTINGS_LAST_PATH_KEY, pathname);+ } catch {+ // Storage is an optional convenience; routing keeps a deterministic fallback.+ }+};++export const settingsLandingPath = (canManageInstance: boolean): string => {+ let remembered: string | null = null;+ if (typeof window !== 'undefined') {+ try {+ remembered = window.localStorage.getItem(SETTINGS_LAST_PATH_KEY);+ } catch {+ // Ignore unavailable storage.+ }+ }+ if (!remembered || !isValidSettingsPath(remembered)) return '/settings/replies';+ if (!canManageInstance && isOwnerOnlyPath(remembered)) return '/settings/replies';+ return remembered;+};diff --git a/ui/src/lib/applicationRoutes.test.ts b/ui/src/lib/applicationRoutes.test.tsindex a700087d4..e878e38f4 100644--- a/ui/src/lib/applicationRoutes.test.ts+++ b/ui/src/lib/applicationRoutes.test.ts@@ -9,6 +9,7 @@ import {inAppChatPath,isApplicationRouteHref,} from './applicationRoutes';+import { LEGACY_SETTINGS_REDIRECTS } from './settingsRoutes';function routePath(element: ts.JsxOpeningLikeElement): string | null {if (element.tagName.getText() !== 'Route') return null;@@ -57,9 +58,12 @@ function declaredRoutePaths(sourceText: string): string[] {}describe('AppShell route policy', () => {- it('matches every path declared by App.tsx', () => {+ it('matches every page and generated legacy redirect declared by App.tsx', () => {const appSource = readFileSync(new URL('../App.tsx', import.meta.url), 'utf8');- const declared = declaredRoutePaths(appSource);+ const declared = [+ ...declaredRoutePaths(appSource),+ ...LEGACY_SETTINGS_REDIRECTS.map((redirect) => redirect.from),+ ];const catalog = [...APPLICATION_ROUTE_PATHS, ...APPLICATION_DYNAMIC_ROUTE_PATHS];expect([...declared].sort()).toEqual([...catalog].sort());diff --git a/ui/src/lib/applicationRoutes.ts b/ui/src/lib/applicationRoutes.tsindex d4506cc63..1cceed0dd 100644--- a/ui/src/lib/applicationRoutes.ts+++ b/ui/src/lib/applicationRoutes.ts@@ -44,8 +44,13 @@ export const APPLICATION_ROUTE_PATHS = ['/users','/logs','/settings',+ '/settings/appearance',+ '/settings/account','/settings/service','/settings/platforms',+ '/settings/platforms/groups',+ '/settings/platforms/users',+ '/settings/remote-access','/settings/backends','/settings/backends/opencode','/settings/backends/claude',@@ -53,9 +58,12 @@ export const APPLICATION_ROUTE_PATHS = ['/settings/models','/settings/dependencies','/settings/memory',+ '/settings/replies','/settings/messaging','/settings/diagnostics',+ '/settings/diagnostics/logs','/settings/logs',+ '/settings/access','/remote-access','/doctor','/doctor/logs',diff --git a/ui/src/lib/pwaRouteMemory.ts b/ui/src/lib/pwaRouteMemory.tsindex be478dcd0..f32361c79 100644--- a/ui/src/lib/pwaRouteMemory.ts+++ b/ui/src/lib/pwaRouteMemory.ts@@ -16,6 +16,26 @@ const RESTORABLE_EXACT_PATHS = new Set(['/apps/terminal','/apps/editor','/apps/library',+ '/settings',+ '/settings/appearance',+ '/settings/account',+ '/settings/service',+ '/settings/platforms',+ '/settings/platforms/groups',+ '/settings/platforms/users',+ '/settings/remote-access',+ '/settings/backends',+ '/settings/backends/opencode',+ '/settings/backends/claude',+ '/settings/backends/codex',+ '/settings/models',+ '/settings/dependencies',+ '/settings/memory',+ '/settings/replies',+ '/settings/diagnostics',+ '/settings/diagnostics/logs',+ '/settings/access',+ // Accept stored pre-#1412 paths once so the router can translate them.'/admin/dashboard','/admin/remote-access','/admin/groups',diff --git a/ui/src/lib/remoteAuth.test.ts b/ui/src/lib/remoteAuth.test.tsindex 2f5c86fb5..5f45e9ada 100644--- a/ui/src/lib/remoteAuth.test.ts+++ b/ui/src/lib/remoteAuth.test.ts@@ -54,7 +54,12 @@ describe('remote auth navigation', () => {},);- it.each(['/admin/logs', '/admin/settings/diagnostics'])(+ it.each([+ '/settings/diagnostics',+ '/settings/diagnostics/logs',+ '/admin/logs',+ '/admin/settings/diagnostics',+ ])('keeps remote session authentication enabled while bypassing setup checks for %s',async (path) => {const getSession = vi.fn(async () => ({ remote: true, authenticated: false }));diff --git a/ui/src/lib/remoteAuth.ts b/ui/src/lib/remoteAuth.tsindex c85768721..3a06a8b2e 100644--- a/ui/src/lib/remoteAuth.ts+++ b/ui/src/lib/remoteAuth.ts@@ -3,7 +3,12 @@ import { isIosDevice, isStandalonePwa } from './platform';export const REMOTE_AUTH_REQUIRED_EVENT = 'avibe.remote-auth-required';export const REMOTE_AUTH_STATE_EVENT = 'avibe.remote-auth-state';const REMOTE_LOGIN_PATH = '/auth/login';-const SETUP_CHECK_BYPASS_PATHS = new Set(['/admin/logs', '/admin/settings/diagnostics']);+const SETUP_CHECK_BYPASS_PATHS = new Set([+ '/settings/diagnostics',+ '/settings/diagnostics/logs',+ '/admin/logs',+ '/admin/settings/diagnostics',+]);type PwaContext = {ios: boolean;diff --git a/ui/src/lib/settingsRoutes.test.ts b/ui/src/lib/settingsRoutes.test.tsnew file mode 100644index 000000000..7f17bf8be--- /dev/null+++ b/ui/src/lib/settingsRoutes.test.ts@@ -0,0 +1,29 @@+import { describe, expect, it } from 'vitest';++import { APPLICATION_ROUTE_PATHS } from './applicationRoutes';+import { legacySettingsRedirectTarget, LEGACY_SETTINGS_REDIRECTS } from './settingsRoutes';++describe('legacy Settings redirects', () => {+ it('translates every retired admin route exactly once', () => {+ const adminRoutes = APPLICATION_ROUTE_PATHS.filter((path) => path.startsWith('/admin'));+ const redirectedAdminRoutes = LEGACY_SETTINGS_REDIRECTS+ .map((redirect) => redirect.from)+ .filter((path) => path.startsWith('/admin'));++ expect(new Set(redirectedAdminRoutes)).toEqual(new Set(adminRoutes));+ expect(redirectedAdminRoutes).toHaveLength(new Set(redirectedAdminRoutes).size);+ });++ it('targets a declared application route while preserving optional query state', () => {+ const applicationRoutes = new Set<string>(APPLICATION_ROUTE_PATHS);+ expect(+ LEGACY_SETTINGS_REDIRECTS.every(({ to }) => applicationRoutes.has(to.split(/[?#]/, 1)[0]!)),+ ).toBe(true);+ });++ it('preserves retired anchors for destination-level compatibility handling', () => {+ expect(legacySettingsRedirectTarget('/settings/service', '#remote-access')).toBe(+ '/settings/service#remote-access',+ );+ });+});diff --git a/ui/src/lib/settingsRoutes.ts b/ui/src/lib/settingsRoutes.tsnew file mode 100644index 000000000..981d8432a--- /dev/null+++ b/ui/src/lib/settingsRoutes.ts@@ -0,0 +1,42 @@+export type LegacySettingsRedirect = {+ from: string;+ to: string;+};++export const legacySettingsRedirectTarget = (to: string, hash: string): string =>+ hash && !to.includes('#') ? `${to}${hash}` : to;++// Keep every retired route as a client-side redirect so bookmarks, PWA state,+// and links from older releases all arrive at the canonical Settings surface.+export const LEGACY_SETTINGS_REDIRECTS: LegacySettingsRedirect[] = [+ { from: '/admin', to: '/settings' },+ { from: '/admin/dashboard', to: '/settings/service' },+ { from: '/admin/permissions', to: '/settings/access' },+ { from: '/admin/remote-access', to: '/settings/remote-access' },+ { from: '/admin/groups', to: '/settings/platforms/groups' },+ { from: '/admin/users', to: '/settings/platforms/users' },+ { from: '/admin/show-pages', to: '/apps/library?view=pages' },+ { from: '/admin/logs', to: '/settings/diagnostics/logs' },+ { from: '/admin/settings/service', to: '/settings/service' },+ { from: '/admin/settings/platforms', to: '/settings/platforms' },+ { from: '/admin/settings/backends', to: '/settings/backends' },+ { from: '/admin/settings/backends/opencode', to: '/settings/backends/opencode' },+ { from: '/admin/settings/backends/claude', to: '/settings/backends/claude' },+ { from: '/admin/settings/backends/codex', to: '/settings/backends/codex' },+ { from: '/admin/settings/models', to: '/settings/models' },+ { from: '/admin/settings/dependencies', to: '/settings/dependencies' },+ { from: '/admin/settings/memory', to: '/settings/memory' },+ { from: '/admin/settings/messaging', to: '/settings/replies' },+ { from: '/admin/settings/diagnostics', to: '/settings/diagnostics' },+ { from: '/admin/settings/logs', to: '/settings/diagnostics/logs' },+ { from: '/dashboard', to: '/settings/service' },+ { from: '/groups', to: '/settings/platforms/groups' },+ { from: '/channels', to: '/settings/platforms/groups' },+ { from: '/users', to: '/settings/platforms/users' },+ { from: '/logs', to: '/settings/diagnostics/logs' },+ { from: '/settings/messaging', to: '/settings/replies' },+ { from: '/settings/logs', to: '/settings/diagnostics/logs' },+ { from: '/remote-access', to: '/settings/remote-access' },+ { from: '/doctor', to: '/settings/diagnostics' },+ { from: '/doctor/logs', to: '/settings/diagnostics/logs' },+];