Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

feat(admin): restructure console sidebar IA + unify the agent selector (#645)

Call Whitef6ca08af6690
diff --git a/docs/plans/admin-console-restructure.md b/docs/plans/admin-console-restructure.md
new file mode 100644
index 000000000..ca1c44518
--- /dev/null
+++ b/docs/plans/admin-console-restructure.md
@@ -0,0 +1,37 @@
+# Admin Console Restructure
+
+Page-feedback-driven information-architecture pass on the `/admin` console (the
+"Control Panel"). Final scope confirmed with the user (see the Show Page proposal).
+
+## New sidebar order (desktop `AppShell` adminItems — now supports nesting)
+1. **控制台** (Dashboard) → `/admin/dashboard` · LayoutDashboard
+2. **远程访问** (Remote Access, extracted page) → `/admin/remote-access` · Globe
+3. **通讯平台** (nested parent, Link icon) — collapsible submenu:
+ - 平台 → `/admin/settings/platforms` · PlugZap
+ - 群组 → `/admin/groups` · Hash (conditional on channel platforms)
+ - 私聊 → `/admin/users` · MessageCircle
+4. **后端** (extracted from settings tab) → `/admin/settings/backends` · Bot
+5. **展示页面** (Show Pages) → `/admin/show-pages` · MonitorPlay
+6. **高级设置** (renamed from 设置) → `/admin/settings/messaging` · Settings
+
+## Changes
+1. **Sidebar nesting** — `ShellNavItem.children[]`; `ShellNavGroup` collapsible
+ submenu (auto-expands when a child is active). Mobile tab bar flattens parents
+ to their first child.
+2. **Settings tabs** (`SettingsPageShell`) — drop platforms + backends (now their
+ own sidebar destinations); reorder remaining to 消息·服务·依赖·诊断; auto-hide
+ the tab bar on pages whose `activeTab` isn't a remaining tab (platforms/backends
+ render standalone). 设置 nav label → `nav.advancedSettings` (高级设置).
+3. **Remote Access** — extract the `#remote-access` block from `SettingsServicePage`
+ into `RemoteAccessPage` at `/admin/remote-access`; repoint every link to the old
+ `/admin/settings/service#remote` (incl. the dashboard Avibe card).
+4. **Agent selector unification** — replace `RoutingConfigPanel`'s 3 selects
+ (agent/model/reasoning) with the workbench `AgentRoutePicker` in `UserList` (私聊)
+ + `ChannelList` (群组). The picker's built-in "+ new agent → /agents" covers the
+ original "manage / add agents" asks.
+5. **Entry rename** — `appShell.openControlPanel` 控制面板 → 设置.
+6. **Small tweaks** — `/admin/users` workdir input → ~40% width; dashboard Avibe
+ (remote) card → leftmost + relinked to `/admin/remote-access`.
+
+## Evidence
+UI build (`cd ui && npm run build`) per commit; manual sanity on the admin console.
diff --git a/ui/src/App.tsx b/ui/src/App.tsx
index 2e26b1cd4..7ca8b3f94 100644
--- a/ui/src/App.tsx
+++ b/ui/src/App.tsx
@@ -15,6 +15,7 @@ import { Dashboard } from './components/Dashboard';
import { ChannelList } from './components/steps/ChannelList';
import { UserList } from './components/steps/UserList';
import { ShowPagesPage } from './components/ShowPagesPage';
+import { RemoteAccessPage } from './components/RemoteAccessPage';
import { SettingsDiagnosticsPage } from './components/settings/SettingsDiagnosticsPage';
import { SettingsBackendsPage } from './components/settings/SettingsBackendsPage';
import { SettingsDependenciesPage } from './components/settings/SettingsDependenciesPage';
@@ -288,6 +289,7 @@ function AppRoutes() {
{/* 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/remote-access" element={<RemoteAccessPage />} />
<Route path="/admin/groups" element={<ChannelList isPage />} />
<Route path="/admin/users" element={<UserList />} />
<Route path="/admin/show-pages" element={<ShowPagesPage />} />
@@ -328,7 +330,7 @@ function AppRoutes() {
<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/settings/service" 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 />} />
</Route>
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsx
index afc2b66bf..27a9bcfa7 100644
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { Link, NavLink, Outlet, useLocation } from 'react-router-dom';
-import { ArrowLeft, ArrowRight, FolderTree, Hash, Inbox, LayoutDashboard, LayoutGrid, Menu, MonitorPlay, Plus, Settings, SlidersHorizontal, Sparkles, Users } from 'lucide-react';
+import { ArrowLeft, ArrowRight, Bot, ChevronDown, FolderTree, Globe, Hash, Inbox, LayoutDashboard, LayoutGrid, Link as LinkIcon, Menu, MessageCircle, MonitorPlay, PlugZap, Plus, Settings, SlidersHorizontal, Sparkles } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
@@ -21,23 +21,34 @@ import { getEnabledPlatforms, platformSupportsChannels } from '../lib/platforms'
import { useViewportHeightVar } from '../lib/useViewportHeightVar';
type ShellNavItem = {
- to: string;
+ // 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[];
};
+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}
+ 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
@@ -51,6 +62,42 @@ const ShellNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {
);
};
+// 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);
+ 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' : '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;
@@ -58,7 +105,7 @@ const MobileNavLink: React.FC<{ item: ShellNavItem }> = ({ item }) => {
return (
<NavLink
- to={item.to}
+ to={item.to ?? '#'}
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',
active ? 'bg-mint/[0.08] text-mint' : 'text-muted'
@@ -188,19 +235,53 @@ export const AppShell: React.FC = () => {
const adminItems: ShellNavItem[] = [
{ to: '/admin/dashboard', label: t('nav.dashboard'), icon: LayoutDashboard },
- ...(hasChannelPlatforms ? [{ to: '/admin/groups', label: t('nav.channels'), icon: Hash }] : []),
- { to: '/admin/users', label: t('nav.users'), icon: Users },
+ { 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 },
+ ],
+ },
+ {
+ to: '/admin/settings/backends',
+ label: t('nav.backends'),
+ icon: Bot,
+ match: (p) => p.startsWith('/admin/settings/backends'),
+ },
{ to: '/admin/show-pages', label: t('nav.showPages'), icon: MonitorPlay },
{
- to: '/admin/settings/service',
- label: t('nav.settings'),
+ // 高级设置: the remaining Settings tabs (messaging leads). Platforms +
+ // backends moved out to their own sidebar destinations above, so exclude
+ // their routes from the active match.
+ to: '/admin/settings/messaging',
+ label: t('nav.advancedSettings'),
icon: Settings,
- match: (pathname) => pathname.startsWith('/admin/settings'),
+ match: (p) =>
+ p.startsWith('/admin/settings') &&
+ !p.startsWith('/admin/settings/platforms') &&
+ !p.startsWith('/admin/settings/backends'),
},
];
const items: ShellNavItem[] = shellMode === 'admin' ? adminItems : [];
+ // Mobile can't nest, so a parent collapses to a single tab that opens its
+ // first child (e.g. 通讯平台 → 平台).
+ const mobileAdminItems: ShellNavItem[] = adminItems.map((item) =>
+ item.children && item.children.length > 0
+ ? { ...item, to: item.children[0].to, children: undefined }
+ : 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
@@ -374,7 +455,7 @@ export const AppShell: React.FC = () => {
{showBottomNav && (
shellMode === 'admin' ? (
<MobileTabBar
- items={[{ to: '/', label: t('nav.workbench'), icon: Sparkles }, ...adminItems]}
+ items={[{ to: '/', label: t('nav.workbench'), icon: Sparkles }, ...mobileAdminItems]}
/>
) : (
<MobileTabBar
diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsx
index acc7282d6..d657f914b 100644
--- a/ui/src/components/Dashboard.tsx
+++ b/ui/src/components/Dashboard.tsx
@@ -402,6 +402,16 @@ export const Dashboard: React.FC = () => {
{/* 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}`}
@@ -423,15 +433,6 @@ export const Dashboard: React.FC = () => {
icon={<MessageSquare className="size-4" />}
to="/admin/users"
/>
- <CloudStatCard
- label={t('dashboard.metricCloud')}
- value={cloudValue}
- hint={cloudHint}
- icon={<Cloud className="size-4" />}
- cloudHomeUrl="https://avibe.bot"
- settingsHref="/admin/settings/service#remote-access"
- publicUrl={cloudPublicHref}
- />
</div>
{/* Mirrors design.pen l0yMzY (twoCol) — platformsCard 1.2fr / activityCard 420px.
diff --git a/ui/src/components/RemoteAccessPage.tsx b/ui/src/components/RemoteAccessPage.tsx
new file mode 100644
index 000000000..82d7140e1
--- /dev/null
+++ b/ui/src/components/RemoteAccessPage.tsx
@@ -0,0 +1,10 @@
+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
+// the full pairing/tunnel UI including its own header, so this page is a thin host.
+export const RemoteAccessPage: React.FC = () => <RemoteAccess />;
+
+export default RemoteAccessPage;
diff --git a/ui/src/components/ShowPagesPage.tsx b/ui/src/components/ShowPagesPage.tsx
index fe7be8354..0f5ecab42 100644
--- a/ui/src/components/ShowPagesPage.tsx
+++ b/ui/src/components/ShowPagesPage.tsx
@@ -219,7 +219,7 @@ function ShowPageRow({ page, expanded, busy, copied, onToggle, onSetVisibility,
<div className="flex flex-wrap items-center gap-1.5 text-[11px]">
<TriangleAlert size={13} className="text-gold" />
<span className="text-muted">{t('showPages.cloudOff')}</span>
- <a href="/admin/settings/service" className="font-semibold text-gold hover:underline">
+ <a href="/admin/remote-access" className="font-semibold text-gold hover:underline">
{t('showPages.connectCloud')} →
</a>
</div>
diff --git a/ui/src/components/settings/SettingsPageShell.tsx b/ui/src/components/settings/SettingsPageShell.tsx
index 1e2f547b9..ed6f601ca 100644
--- a/ui/src/components/settings/SettingsPageShell.tsx
+++ b/ui/src/components/settings/SettingsPageShell.tsx
@@ -5,9 +5,7 @@ import { useTranslation } from 'react-i18next';
import {
MessageSquare,
Package,
- PlugZap,
Server,
- Sparkles,
Stethoscope,
} from 'lucide-react';
@@ -19,11 +17,12 @@ const TABS: Array<{
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: 'platforms', href: '/settings/platforms', label: 'settings.tabs.platforms', icon: PlugZap },
- { key: 'backends', href: '/settings/backends', label: 'settings.tabs.backends', icon: Sparkles },
{ key: 'dependencies', href: '/settings/dependencies', label: 'settings.tabs.dependencies', icon: Package },
- { key: 'messaging', href: '/settings/messaging', label: 'settings.tabs.messaging', icon: MessageSquare },
{ key: 'diagnostics', href: '/settings/diagnostics', label: 'settings.tabs.diagnostics', icon: Stethoscope },
];
@@ -49,6 +48,10 @@ export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({
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);
return (
<div className="flex flex-col gap-6">
@@ -60,29 +63,31 @@ export const SettingsPageShell: React.FC<SettingsPageShellProps> = ({
{actions && <div className="shrink-0">{actions}</div>}
</div>
- <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' : 'text-muted')} />
- {t(tab.label)}
- </Link>
- );
- })}
- </nav>
- </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' : '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
diff --git a/ui/src/components/settings/SettingsServicePage.tsx b/ui/src/components/settings/SettingsServicePage.tsx
index 8575cba19..283d97ad2 100644
--- a/ui/src/components/settings/SettingsServicePage.tsx
+++ b/ui/src/components/settings/SettingsServicePage.tsx
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react';
+import { useNavigate } from 'react-router-dom';
import { FileText, Globe2, Play, RotateCw, Server, Square } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
@@ -6,7 +7,6 @@ import clsx from 'clsx';
import { useStatus } from '@/context/StatusContext';
import { useApi } from '@/context/ApiContext';
import { apiFetch } from '@/lib/apiFetch';
-import { RemoteAccess } from '@/components/RemoteAccess';
import { SettingsPageShell } from './SettingsPageShell';
import { CompactField, SettingsPanel, SettingsRow } from './SettingsPrimitives';
import { Button } from '@/components/ui/button';
@@ -18,6 +18,14 @@ export const SettingsServicePage: React.FC = () => {
const { t } = useTranslation();
const { status, control } = useStatus();
const api = useApi();
+ const navigate = useNavigate();
+ // Back-compat: Remote Access moved to its own page. Old deep links to the
+ // 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]);
const [config, setConfig] = useState<any>(null);
const [loading, setLoading] = useState(false);
const [uiSaving, setUiSaving] = useState(false);
@@ -119,9 +127,6 @@ export const SettingsServicePage: React.FC = () => {
title={t('settings.serviceTitle')}
subtitle={t('settings.serviceSubtitle')}
>
- {/* Remote access leads the page: it's the primary thing users come here to
- set up, so it sits at the top with a prominent cyan board + glow. */}
- <RemoteAccess />
<SettingsPanel
title={
diff --git a/ui/src/components/shared/RoutingConfigPanel.tsx b/ui/src/components/shared/RoutingConfigPanel.tsx
index 708781e04..1c33091b6 100644
--- a/ui/src/components/shared/RoutingConfigPanel.tsx
+++ b/ui/src/components/shared/RoutingConfigPanel.tsx
@@ -2,16 +2,19 @@ import React, { useEffect, useState } from 'react';
import { Bot, FolderOpen, HelpCircle } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
-import { Combobox } from '../ui/combobox';
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
-import { BackendIcon } from '../visual';
-import { CompactSelect } from '../settings/SettingsPrimitives';
-import { modelOptionLabel } from '../../lib/backendModels';
+import { AgentRoutePicker } from '../workbench/AgentRoutePicker';
+import type { VibeAgentBrief } from '../../context/ApiContext';
// Mirrors design.pen `asPXu` (VR/RoutingConfig). Shared between groups (channels)
// and users — same form, same fields, same styles. The only difference is whether
// the @mention requirement segmented toggle is shown.
+//
+// The agent/model/effort route is the SAME AgentRoutePicker used by the workbench
+// chat header + create surfaces (one source of truth), replacing the former three
+// separate selects. Its built-in "+ new agent → /agents" entry covers managing /
+// adding agents from wherever a route is chosen.
export interface RoutingConfigValue {
custom_cwd: string;
@@ -43,15 +46,12 @@ export interface RoutingConfigPanelProps {
showRequireMention?: boolean;
/** Platform key used to derive inherited @mention default (e.g., 'slack', 'discord'). */
inheritsFromKey?: string;
- /** Backend lookup data — pass already-loaded values from the parent. */
- vibeAgents?: {
- name: string;
- description?: string | null;
- backend: string;
- model?: string | null;
- reasoning_effort?: string | null;
- }[];
+ /** Vibe Agent catalog — passed already-loaded from the parent. */
+ vibeAgents?: VibeAgentBrief[];
defaultAgentName?: string | null;
+ // Legacy backend-model props: no longer read here (AgentRoutePicker self-loads
+ // models + effort options). Kept on the interface so existing callers still
+ // type-check; a follow-up can drop them and the parents' model preloading.
opencodeOptions?: any;
claudeAgents?: { id: string; name: string }[];
claudeModels?: string[];
@@ -59,7 +59,7 @@ export interface RoutingConfigPanelProps {
claudeReasoningOptions?: Record<string, { value: string; label: string }[]>;
codexAgents?: { id: string; name: string }[];
codexModels?: string[];
- /** Optional footer slot — e.g., admin/remove actions on the users page. */
+ /** Custom footer slot — e.g., admin/remove actions on the users page. */
footerActions?: React.ReactNode;
/** Wrapper class — controls outer padding/border. Default: 'border-t border-border/60 px-5 py-4'. */
containerClass?: string;
@@ -92,11 +92,6 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
inheritsFromKey,
vibeAgents = [],
defaultAgentName,
- opencodeOptions,
- claudeModels = [],
- claudeModelLabels = {},
- claudeReasoningOptions = {},
- codexModels = [],
footerActions,
containerClass = 'border-t border-border/60 px-5 py-4',
}) => {
@@ -104,47 +99,9 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
const selectedVibeAgent = vibeAgents.find((agent) => agent.name === value.routing.agent_name) || null;
const defaultVibeAgent = vibeAgents.find((agent) => agent.name === defaultAgentName) || null;
- const inheritedVibeAgent = selectedVibeAgent || defaultVibeAgent;
- const effectiveBackend = selectedVibeAgent?.backend || defaultVibeAgent?.backend || 'opencode';
- const effectiveModel = value.routing.model || inheritedVibeAgent?.model || '';
-
- const getOpenCodeReasoningOptions = (modelKey: string) => {
- const lookup = opencodeOptions?.reasoning_options || {};
- if (lookup && typeof lookup === 'object') {
- return (lookup as Record<string, { value: string; label: string }[]>)[modelKey] || [];
- }
- return [];
- };
-
- const getClaudeReasoning = (model: string) => {
- const modelKey = model || '';
- const cached = claudeReasoningOptions[modelKey];
- if (cached?.length) return cached;
- const fallback = claudeReasoningOptions[''] || [];
- const normalized = modelKey.toLowerCase();
- if (normalized.includes('claude-opus-4-7') || normalized.includes('claude-fable-5') || normalized === 'opus' || normalized === 'opus[1m]') {
- const opts = [...fallback];
- if (!opts.some((o) => o.value === 'xhigh')) opts.push({ value: 'xhigh', label: 'Extra High' });
- if (!opts.some((o) => o.value === 'max')) opts.push({ value: 'max', label: 'Max' });
- return opts;
- }
- if (normalized.includes('claude-opus-4-6') || normalized.includes('claude-sonnet-4-6')) {
- return fallback.some((o) => o.value === 'max') ? fallback : [...fallback, { value: 'max', label: 'Max' }];
- }
- return fallback;
- };
-
- const getReasoningLabel = (val: string, fallback: string) => {
- switch (val) {
- case 'low': return t('channelList.reasoningLow');
- case 'medium': return t('channelList.reasoningMedium');
- case 'high': return t('channelList.reasoningHigh');
- case 'xhigh': return t('channelList.reasoningXHigh');
- case 'max': return t('channelList.reasoningMax');
- default: return fallback;
- }
- };
+ // Picking an agent re-seeds model/effort, so always clear the deprecated
+ // per-backend overrides on any route change (kept for back-compat on read).
const clearLegacyOverrides = (routing: RoutingConfigValue['routing']) => ({
...routing,
opencode_model: null,
@@ -155,96 +112,16 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
codex_reasoning_effort: null,
});
- const buildModelRoutingPatch = (model: string | null) => {
- return clearLegacyOverrides({
- ...value.routing,
- model,
- reasoning_effort: null,
- });
- };
-
- const buildReasoningRoutingPatch = (reasoningEffort: string | null) => {
- return clearLegacyOverrides({
- ...value.routing,
- reasoning_effort: reasoningEffort,
- });
- };
-
- const modelOverrideControl = (() => {
- if (effectiveBackend === 'opencode') {
- return (
- <CompactSelect
- value={value.routing.model || ''}
- onChange={(e) => onChange({
- routing: buildModelRoutingPatch(e.target.value || null),
- })}
- className="w-full"
- >
- <option value="">{t('common.default')}</option>
- {(opencodeOptions?.models?.providers || []).flatMap((provider: any) => {
- const pid = provider.id || provider.provider_id || provider.name;
- const pLabel = provider.name || pid;
- const models = provider.models || {};
- if (Array.isArray(models)) {
- return models.map((m: any) => {
- const mid = typeof m === 'string' ? m : m.id;
- return <option key={`${pid}:${mid}`} value={`${pid}/${mid}`}>{pLabel}/{mid}</option>;
- });
- }
- return Object.keys(models).map((mid) => (
- <option key={`${pid}:${mid}`} value={`${pid}/${mid}`}>{pLabel}/{mid}</option>
- ));
- })}
- </CompactSelect>
- );
- }
- const models = effectiveBackend === 'claude' ? claudeModels : codexModels;
- const placeholder = effectiveBackend === 'claude'
- ? t('channelList.claudeModelPlaceholder')
- : t('channelList.codexModelPlaceholder');
- return (
- <Combobox
- options={[
- { value: '', label: t('common.default') },
- ...models.map(m => ({
- value: m,
- label: effectiveBackend === 'claude' ? modelOptionLabel(m, claudeModelLabels) : m,
- })),
- ]}
- value={value.routing.model || ''}
- onValueChange={(v) => onChange({
- routing: buildModelRoutingPatch(v || null),
- })}
- placeholder={placeholder}
- searchPlaceholder={t('channelList.searchModel')}
- allowCustomValue={true}
- />
- );
- })();
-
- const reasoningOptions = (() => {
- if (effectiveBackend === 'claude') {
- return getClaudeReasoning(effectiveModel)
- .filter((option) => option.value !== '__default__')
- .map((option) => ({ value: option.value, label: getReasoningLabel(option.value, option.label) }));
- }
- if (effectiveBackend === 'opencode') {
- const options = getOpenCodeReasoningOptions(effectiveModel);
- if (options.length) return options;
- }
- return ['low', 'medium', 'high', 'xhigh'].map((value) => ({ value, label: getReasoningLabel(value, value) }));
- })();
-
// Access row: working dir (+ optional require_mention / require_bind for
- // channels). The Agent selector lives in the routing row below so it shares a
- // line with Model + Reasoning effort.
+ // channels). The Agent route picker lives in the row below.
const accessGridCols = showRequireMention ? 'md:grid-cols-3' : 'md:grid-cols-1';
return (
<div className={clsx('space-y-4', containerClass)}>
<div className={clsx('grid grid-cols-1 gap-3', accessGridCols)}>
- {/* Working directory */}
- <div className="space-y-1">
+ {/* Working directory. On the users page (no require-mention column) it
+ would otherwise stretch the full row, so cap it at ~40%. */}
+ <div className={clsx('space-y-1', !showRequireMention && 'md:max-w-[40%]')}>
<label className="text-xs font-medium uppercase text-muted">{t('channelList.workingDirectory')}</label>
<div className="flex gap-1.5">
<BlurInput
@@ -371,74 +248,65 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
})()}
</div>
- {/* Routing: Agent + Model + Reasoning effort share one row */}
- <div className="grid grid-cols-1 gap-3 md:grid-cols-3">
- {/* Vibe Agent — the Bot glyph lives on the label so the select keeps the
- same plain chrome as Model / Reasoning. The inherited backend shows
- below; per-agent backend/model/effort are intentionally omitted from
- the options and the hint to avoid repeating what the row already
- conveys. */}
- <div className="space-y-1">
- <label className="flex items-center gap-1.5 text-xs font-medium uppercase text-muted">
- <Bot size={12} className="text-muted" />
- {t('channelList.agent')}
- </label>
- <CompactSelect
- value={value.routing.agent_name || ''}
- onChange={(e) => {
- const nextName = e.target.value || null;
- onChange({
- routing: {
- ...value.routing,
- agent_name: nextName,
- model: null,
- reasoning_effort: null,
- opencode_model: null,
- opencode_reasoning_effort: null,
- claude_model: null,
- claude_reasoning_effort: null,
- codex_model: null,
- codex_reasoning_effort: null,
- },
- });
- }}
- className="w-full"
- >
- <option value="">
- {defaultVibeAgent ? `${t('common.default')} · ${defaultVibeAgent.name}` : t('common.default')}
- </option>
- {vibeAgents.map((agent) => (
- <option key={agent.name} value={agent.name}>
- {agent.name}
- </option>
- ))}
- </CompactSelect>
- {inheritedVibeAgent && (
- <div className="flex items-center gap-1.5 text-[11px] text-muted">
- <BackendIcon backend={inheritedVibeAgent.backend} variant="glyph" size={12} />
- <span className="truncate">{inheritedVibeAgent.backend}</span>
- </div>
- )}
- </div>
- <div className="space-y-1">
- <label className="text-xs font-medium uppercase text-muted">{t('channelList.model')}</label>
- {modelOverrideControl}
- </div>
- <div className="space-y-1">
- <label className="text-xs font-medium uppercase text-muted">{t('channelList.reasoningEffort')}</label>
- <CompactSelect
- value={value.routing.reasoning_effort || ''}
- onChange={(e) => onChange({
- routing: buildReasoningRoutingPatch(e.target.value || null),
- })}
- className="w-full"
- >
- <option value="">{t('common.default')}</option>
- {reasoningOptions.map((option) => (
- <option key={option.value} value={option.value}>{option.label}</option>
- ))}
- </CompactSelect>
- </div>
+ {/* Routing: one unified Agent picker (agent → model → effort), shared with
+ the workbench chat/create surfaces. Empty = inherit the global default. */}
+ <div className="space-y-1">
+ <label className="flex items-center gap-1.5 text-xs font-medium uppercase text-muted">
+ <Bot size={12} className="text-muted" />
+ {t('channelList.agent')}
+ </label>
+ <AgentRoutePicker
+ value={{
+ // Resolve the DISPLAYED route. An explicit agent with an empty
+ // model/effort means "inherit that agent's", so fall back to the
+ // selected agent's own model/effort — otherwise the effort column
+ // resolves options against the backend defaults instead of the
+ // inherited model (e.g. a Claude agent's xhigh/max would vanish).
+ // agent_backend also falls back to the default agent so the columns
+ // resolve while inheriting the global default.
+ agent_backend: selectedVibeAgent?.backend ?? defaultVibeAgent?.backend ?? null,
+ agent_name: value.routing.agent_name ?? null,
+ model: value.routing.model ?? selectedVibeAgent?.model ?? null,
+ reasoning_effort: value.routing.reasoning_effort ?? selectedVibeAgent?.reasoning_effort ?? null,
+ }}
+ agents={vibeAgents}
+ onChange={(patch) => {
+ // Concrete routes, matching the workbench picker + the other call
+ // sites: merge only the keys PRESENT in the (partial) patch. A
+ // present field wins (incl. an explicit null that clears it); an
+ // absent field keeps its stored value. We deliberately do NOT
+ // special-case agent picks to null model/effort — that discarded the
+ // first model pick on an inherited-default route, where the pick
+ // arrives as the materialized agent_name + the chosen model together.
+ const next = { ...value.routing };
+ if ('agent_name' in patch) next.agent_name = patch.agent_name ?? null;
+ if ('model' in patch) next.model = patch.model ?? null;
+ if ('reasoning_effort' in patch) next.reasoning_effort = patch.reasoning_effort ?? null;
+ onChange({ routing: clearLegacyOverrides(next) });
+ }}
+ defaultLabel={
+ defaultVibeAgent ? `${t('common.default')} · ${defaultVibeAgent.name}` : t('common.default')
+ }
+ defaultRoute={
+ defaultVibeAgent
+ ? {
+ agent_backend: defaultVibeAgent.backend,
+ agent_name: defaultVibeAgent.name,
+ model: defaultVibeAgent.model,
+ reasoning_effort: defaultVibeAgent.reasoning_effort,
+ }
+ : undefined
+ }
+ // Only a FULLY-inheriting scope (no overrides at all) displays the
+ // default route. A scope that inherits the agent but overrides
+ // model/effort must show its own values, not the default agent's,
+ // otherwise the override is masked and silently overwritten.
+ isDefaultRoute={
+ !value.routing.agent_name && !value.routing.model && !value.routing.reasoning_effort
+ }
+ align="start"
+ triggerClassName="w-full"
+ />
</div>
{/* Show message types chips */}
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index de2c360e0..0b5a871aa 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -83,6 +83,9 @@
"users": "Direct Messages",
"showPages": "Show Pages",
"settings": "Settings",
+ "advancedSettings": "Advanced Settings",
+ "messagingPlatforms": "Messaging Platforms",
+ "backends": "Backends",
"remoteAccess": "Remote Access",
"doctor": "Doctor",
"inbox": "Inbox",
@@ -558,7 +561,7 @@
"title": "Avibe OS",
"subtitle": "Agent OS · Workbench",
"workspaceLabel": "Workspace",
- "openControlPanel": "Control Panel",
+ "openControlPanel": "Settings",
"backToWorkbench": "Back to Workbench",
"newSession": "New",
"navigationLabel": "Console",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 1d1664b02..03b6859c9 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -78,11 +78,14 @@
"proxyUrlCollapsedHint": "(留空则尝试系统代理,否则直连)"
},
"nav": {
- "dashboard": "仪表盘",
+ "dashboard": "控制台",
"channels": "群组",
"users": "私聊",
"showPages": "展示页面",
"settings": "设置",
+ "advancedSettings": "高级设置",
+ "messagingPlatforms": "通讯平台",
+ "backends": "后端",
"remoteAccess": "远程访问",
"doctor": "诊断",
"inbox": "收件箱",
@@ -558,7 +561,7 @@
"title": "Avibe OS",
"subtitle": "Agent操作系统 · 工作台",
"workspaceLabel": "工作区",
- "openControlPanel": "控制面板",
+ "openControlPanel": "设置",
"backToWorkbench": "返回工作台",
"newSession": "新建",
"navigationLabel": "控制台",