The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): Settings ▸ Plugins, one home for every plugin's settings pages
Tekniumea0e4299ec5b
diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsxindex 0232edbdc0d..f6ef4ba9819 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx@@ -1,6 +1,7 @@import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { createPluginContext } from '@/contrib/plugin'import { $pluginDecisions, $pluginRecords, dropPlugin, patchPlugin, publishPlugin } from '@/contrib/plugins-store'import { queryClient } from '@/lib/query-client'import { $agentPlugins, $agentPluginsStatus } from '@/store/agent-plugins'@@ -719,4 +720,47 @@ describe('PluginsTab catalog UX', () => {await waitFor(() => expect($pluginInstallRequest.get()).not.toBeNull())})+ // The gear no longer unfolds an inline form under the row: plugin settings+ // live in Settings ▸ Plugins (one entry per plugin, WoW-AddOns style) and the+ // gear deep-links there.+ it('sends the settings gear to the plugin’s page in Settings ▸ Plugins', () => {+ $agentPlugins.set([+ {+ description: '',+ key: 'notes',+ name: 'notes',+ settings_schema: [{ description: '', key: 'region', label: 'Region', required: false, type: 'string' }],+ source: 'user',+ status: 'enabled',+ version: '1.0.0'+ }+ ])++ render(<PluginsTab profile={null} />)+ fireEvent.click(screen.getByRole('button', { name: 'Settings: notes' }))++ expect(window.location.hash).toBe('#/settings?tab=plugins&plugin=agent%3Anotes')+ expect(screen.queryByTestId('plugin-settings-notes-settings-form')).toBeNull()+ })++ it('gives a desktop plugin that registered a settings page a gear too', () => {+ publishPlugin(+ { id: 'weather', kind: 'disk', name: 'Weather', status: 'loaded' },+ {+ activate: () => undefined,+ deactivate: () => undefined+ }+ )+ const ctx = createPluginContext('weather')+ const dispose = ctx.registerSettingsPage({ id: 'main', render: () => null, title: 'Weather' })++ try {+ render(<PluginsTab profile={null} />)+ fireEvent.click(screen.getByRole('button', { name: 'Settings: Weather' }))+ expect(window.location.hash).toBe('#/settings?tab=plugins&plugin=weather')+ } finally {+ dispose()+ dropPlugin('weather')+ }+ })})diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsxindex 90d01851990..00e7d561111 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx@@ -9,7 +9,6 @@ import {useState} from 'react'-import { setEnvVar } from '@/api/config'import { getToolsets, setToolsetEnabled } from '@/api/toolsets'import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'import { Button } from '@/components/ui/button'@@ -17,7 +16,9 @@ import { Codicon } from '@/components/ui/codicon'import { Switch } from '@/components/ui/switch'import { Tip } from '@/components/ui/tooltip'import { $pluginRecords, type PluginRecord, setPluginEnabled } from '@/contrib/plugins-store'+import { useContributions } from '@/contrib/react/use-contributions'import { discoverRuntimePlugins, uninstallDiskPlugin } from '@/contrib/runtime-loader'+import { pluginSettingsHref, SETTINGS_PLUGINS_AREA } from '@/contrib/settings-pages'import type { ProfileScope } from '@/hermes'import { useI18n } from '@/i18n'import { DESKTOP_PLUGIN_TOOLSETS } from '@/lib/desktop-toolsets'@@ -38,7 +39,6 @@ import {isDesktopRelevantPlugin,loadAgentPlugins,removeAgentPlugin,- saveAgentPluginSettings,toggleAgentPlugin,updateAgentPlugin} from '@/store/agent-plugins'@@ -55,7 +55,6 @@ import { useDeepLinkHighlight } from '../../settings/use-deep-link-highlight'import { TOOLSETS_QUERY_KEY } from '../toolsets/toolsets-data'import { mergePluginPackages, type PackageKind, type PluginPackage } from './plugin-packages'-import { PluginSettingsForm } from './plugin-settings-form'// The REAL Plugin Catalog page (docs site) embedded as a one-click picker —// the same pattern as the Skills tab's EmbeddedHubPicker. `?embed=picker`@@ -245,7 +244,6 @@ function PackageRow({profile,scopeLabel,busy,- request,onAgentToggle,onAgentUpdate,onAgentRemove,@@ -256,7 +254,6 @@ function PackageRow({profile: ProfileScopescopeLabel: stringbusy: boolean- request: GatewayRequestonAgentToggle: (row: AgentPluginRow, enable: boolean) => voidonAgentUpdate: (row: AgentPluginRow) => voidonAgentRemove: (row: AgentPluginRow) => void@@ -267,10 +264,20 @@ function PackageRow({const d = t.settings.pluginsconst desktop = pkg.desktopconst agent = pkg.agent- // Manifest `config_schema` → an inline settings form under the row (#46600, #87934).- const settingsFields = agent?.settings_schema ?? []- const hasSettings = Boolean(agent?.key) && settingsFields.length > 0- const [settingsOpen, setSettingsOpen] = useState(false)+ // Settings live in Settings ▸ Plugins: a manifest `config_schema` gets an+ // automatic page there, a desktop half may register its own. The gear is+ // the shortcut to that page (#46600, #87934).+ const settingsPages = useContributions(SETTINGS_PLUGINS_AREA)+ const desktopSettings = Boolean(desktop && settingsPages.some(page => page.source === `plugin:${desktop.id}`))+ const agentSettings = Boolean(agent?.key) && Boolean(agent?.settings_schema?.length)+ const hasSettings = desktopSettings || agentSettings++ const openSettings = () => {+ // A desktop page absorbs the package's schema form as a sub-page, so its+ // plugin id is the one entry that covers both halves.+ window.location.hash = `#${pluginSettingsHref(desktopSettings ? desktop!.id : `agent:${agent!.key}`)}`+ }+const [desktopBusy, setDesktopBusy] = useState(false)const desktopOn = desktop ? desktop.status !== 'disabled' : falseconst agentOn = agent?.status === 'enabled'@@ -340,10 +347,7 @@ function PackageRow({return (<><div- className={cn(- 'flex items-center gap-3 border-b border-(--ui-stroke-tertiary) px-3 py-2.5',- !settingsOpen && 'last:border-b-0'- )}+ className="flex items-center gap-3 border-b border-(--ui-stroke-tertiary) px-3 py-2.5 last:border-b-0"data-testid={`plugin-row-${pkg.key}`}id={pluginElementId(agent?.key ?? agent?.name ?? desktop?.id ?? pkg.key)}role="row"@@ -395,19 +399,12 @@ function PackageRow({</Tip>)}</span>- {/* Fixed slot for the settings gear: only plugins whose manifest declares- a config_schema get one. */}+ {/* Fixed slot for the settings gear: only plugins with a page in+ Settings ▸ Plugins (config_schema or a registered page) get one. */}<span className="flex size-7 shrink-0 items-center justify-center">{hasSettings && (<Tip label={p.settingsToggle(pkg.name)}>- <Button- aria-expanded={settingsOpen}- aria-label={p.settingsToggle(pkg.name)}- className={cn(settingsOpen && 'text-foreground')}- onClick={() => setSettingsOpen(open => !open)}- size="icon"- variant="ghost"- >+ <Button aria-label={p.settingsToggle(pkg.name)} onClick={openSettings} size="icon" variant="ghost"><Codicon name="settings-gear" size="0.85rem" /></Button></Tip>@@ -521,31 +518,6 @@ function PackageRow({)}</HalfCell></div>- {hasSettings && settingsOpen && agent?.key && (- <div className="border-b border-(--ui-stroke-tertiary) bg-(--ui-bg-secondary,transparent) px-3 py-3 last:border-b-0">- <PluginSettingsForm- disabled={busy}- fields={settingsFields}- idPrefix={`plugin-settings-${agent.key}`}- onSave={async changes => {- const ok = await saveAgentPluginSettings(request, {- key: agent.key!,- values: changes.values,- secrets: changes.secrets,- writeSecret: (env, value) => setEnvVar(env, value, profile),- failMessage: p.settingsForm.saveFailed(pkg.name),- profile: scope- })-- if (ok) {- notify({ kind: 'success', message: p.settingsForm.saved(pkg.name) })- }-- return ok- }}- />- </div>- )}</>)}@@ -831,7 +803,6 @@ export const PluginsTab = memo(function PluginsTab({}}pkg={pkg}profile={profile}- request={requestGateway}scope={scope}scopeLabel={label}/>diff --git a/apps/desktop/src/app/command-palette/index.tsx b/apps/desktop/src/app/command-palette/index.tsxindex a0131d66c90..854b16ed13b 100644--- a/apps/desktop/src/app/command-palette/index.tsx+++ b/apps/desktop/src/app/command-palette/index.tsx@@ -404,7 +404,15 @@ const sessionKeywords = (session: SessionEntry, ...tags: string[]): string[] =>[...tags, 'chat', 'session', session.preview, session.git_branch].filter((word): word is string => !!word)type NonConfigSettingsLabel =- 'about' | 'archivedChats' | 'gateway' | 'keysSettings' | 'keysTools' | 'mcp' | 'providerAccounts' | 'providerApiKeys'+ | 'about'+ | 'archivedChats'+ | 'gateway'+ | 'keysSettings'+ | 'keysTools'+ | 'mcp'+ | 'plugins'+ | 'providerAccounts'+ | 'providerApiKeys'const NON_CONFIG_SETTINGS: ReadonlyArray<{icon: IconComponent@@ -455,6 +463,12 @@ const NON_CONFIG_SETTINGS: ReadonlyArray<{tab: 'keys&kview=settings'},{ icon: Archive, keywords: ['history', 'archived'], labelKey: 'archivedChats', tab: 'sessions' },+ {+ icon: codiconIcon('extensions'),+ keywords: ['plugins', 'plugin settings', 'plugin options', 'addons', 'add-ons', 'extensions'],+ labelKey: 'plugins',+ tab: 'plugins'+ },{ icon: Info, keywords: ['version', 'about'], labelKey: 'about', tab: 'about' }]diff --git a/apps/desktop/src/app/overlays/overlay-breadcrumb-header.tsx b/apps/desktop/src/app/overlays/overlay-breadcrumb-header.tsxindex a98501bc5b2..570763dd09c 100644--- a/apps/desktop/src/app/overlays/overlay-breadcrumb-header.tsx+++ b/apps/desktop/src/app/overlays/overlay-breadcrumb-header.tsx@@ -10,12 +10,20 @@ import type { OverlayNavGroup, OverlayNavLink } from './overlay-split-layout'interface OverlayBreadcrumbHeaderProps {child?: OverlayNavLink+ /** A child's own sub-page (third nav level). */+ grandchild?: OverlayNavLinkgroup: OverlayNavGrouprootLabel: stringtrailing?: ReactNode}-export function OverlayBreadcrumbHeader({ child, group, rootLabel, trailing }: OverlayBreadcrumbHeaderProps) {+export function OverlayBreadcrumbHeader({+ child,+ grandchild,+ group,+ rootLabel,+ trailing+}: OverlayBreadcrumbHeaderProps) {return (<div className={cn('mb-3 flex shrink-0 items-start justify-between gap-3', PAGE_INSET_X)}><nav aria-label={group.label} className="flex min-w-0 items-center gap-1.5 text-xs text-(--ui-text-tertiary)">@@ -27,9 +35,21 @@ export function OverlayBreadcrumbHeader({ child, group, rootLabel, trailing }: O{group.label}</Button><ChevronRight aria-hidden className="size-3 shrink-0" />- <span aria-current="page" className="truncate text-foreground">- {child.label}- </span>+ {grandchild ? (+ <>+ <Button className="min-w-0 truncate" onClick={child.onSelect} size="inline" variant="text">+ {child.label}+ </Button>+ <ChevronRight aria-hidden className="size-3 shrink-0" />+ <span aria-current="page" className="truncate text-foreground">+ {grandchild.label}+ </span>+ </>+ ) : (+ <span aria-current="page" className="truncate text-foreground">+ {child.label}+ </span>+ )}</>) : (<span aria-current="page" className="truncate text-foreground">diff --git a/apps/desktop/src/app/overlays/overlay-split-layout.tsx b/apps/desktop/src/app/overlays/overlay-split-layout.tsxindex 562d83dea76..d4938275b41 100644--- a/apps/desktop/src/app/overlays/overlay-split-layout.tsx+++ b/apps/desktop/src/app/overlays/overlay-split-layout.tsx@@ -152,6 +152,9 @@ export interface OverlayNavLink {id: stringlabel: stringonSelect: () => void+ /** Third level (a group child's own sub-pages, e.g. Settings ▸ Plugins ▸+ * <plugin> ▸ <sub-page>): listed under the child while it is active. */+ children?: OverlayNavLink[]}export interface OverlayNavGroup extends OverlayNavLink {@@ -254,15 +257,32 @@ export function OverlayNav({ footer, groups }: { footer?: ReactNode; groups: Oveid={childrenId}>{group.children?.map(child => (- <OverlayNavItem- active={child.active}- icon={child.icon}- id={child.id}- key={child.id}- label={child.label}- nested- onClick={child.onSelect}- />+ <Fragment key={child.id}>+ <OverlayNavItem+ active={child.active}+ current={child.active && !child.children?.some(grandchild => grandchild.active)}+ icon={child.icon}+ id={child.id}+ label={child.label}+ nested+ onClick={child.onSelect}+ />+ {child.active && Boolean(child.children?.length) && (+ <div className="ml-3 flex flex-col gap-0.5 pl-1.5">+ {child.children?.map(grandchild => (+ <OverlayNavItem+ active={grandchild.active}+ icon={grandchild.icon}+ id={grandchild.id}+ key={grandchild.id}+ label={grandchild.label}+ nested+ onClick={grandchild.onSelect}+ />+ ))}+ </div>+ )}+ </Fragment>))}</div>)}@@ -295,14 +315,24 @@ export function OverlayNav({ footer, groups }: { footer?: ReactNode; groups: OveonSelect: group.onSelect,separatorBefore: group.gapBefore},- ...(group.children ?? []).map(child => ({- active: child.active,- icon: child.icon,- id: child.id,- indent: true,- label: child.label,- onSelect: child.onSelect- }))+ ...(group.children ?? []).flatMap(child => [+ {+ active: child.active && !child.children?.some(grandchild => grandchild.active),+ icon: child.icon,+ id: child.id,+ indent: true,+ label: child.label,+ onSelect: child.onSelect+ },+ ...(child.children ?? []).map(grandchild => ({+ active: grandchild.active,+ icon: grandchild.icon,+ id: grandchild.id,+ indent: true,+ label: `${child.label} › ${grandchild.label}`,+ onSelect: grandchild.onSelect+ }))+ ])])}/></div>diff --git a/apps/desktop/src/app/settings/index.tsx b/apps/desktop/src/app/settings/index.tsxindex befd85956d6..11424a0e72c 100644--- a/apps/desktop/src/app/settings/index.tsx+++ b/apps/desktop/src/app/settings/index.tsx@@ -1,5 +1,5 @@import { useStore } from '@nanostores/react'-import { useCallback, useEffect, useMemo, useRef } from 'react'+import { type ComponentType, useCallback, useEffect, useMemo, useRef } from 'react'import { Navigate, useLocation, useNavigate } from 'react-router'import { codiconIcon } from '@/components/ui/codicon'@@ -54,6 +54,13 @@ import { KeybindSettings } from './keybind-settings'import { KEYS_VIEWS, KeysSettings, type KeysView } from './keys-settings'import { movedSettingsTabRedirect } from './moved-tabs'import { NotificationsSettings } from './notifications-settings'+import {+ PAGE_SCOPED_PARAMS,+ PLUGINS_NAV_ICON,+ pluginSettingsNavChildren,+ PluginSettingsPane,+ usePluginSettingsRoute+} from './plugin-settings'import { SettingsBreadcrumbContext } from './primitives'import { PROVIDER_VIEWS, ProvidersSettings, type ProviderView } from './providers-settings'import { SessionsSettings } from './sessions-settings'@@ -75,9 +82,22 @@ const SETTINGS_VIEWS: readonly SettingsViewId[] = ['notifications','billing','sessions',+ 'plugins','about']+// Pages that take nothing but the resolved sub-page.+const SUBPAGE_VIEWS: Partial<Record<SettingsViewId, ComponentType<{ subpage?: string }>>> = {+ 'config:appearance': AppearanceSettings,+ about: AboutSettings,+ // 'connections' renders the unified page too so the frame before the alias+ // redirect lands doesn't flash the fallback view.+ connections: GatewaySettings,+ gateway: GatewaySettings,+ keybinds: KeybindSettings,+ notifications: NotificationsSettings+}+export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: SettingsPageProps) {const scopeProfile = useStore($settingsScopeProfile)const activeConnectionId = useStore($activeConnectionId)@@ -85,9 +105,10 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Setconst navigate = useNavigate()const { hash, pathname, search } = useLocation()- // MCP and Plugins moved out of Settings into Capabilities. Keep old- // `/settings?tab=mcp|plugins` deep links working — `useRouteEnumParam` would- // silently coerce the unknown tab to the default view otherwise.+ // MCP moved out of Settings into Capabilities. Keep old `/settings?tab=mcp`+ // deep links working — `useRouteEnumParam` would silently coerce the unknown+ // tab to the default view otherwise. (`tab=plugins` is live: Settings ▸+ // Plugins hosts each plugin's own settings pages.)useEffect(() => {const redirect = movedSettingsTabRedirect(search)@@ -113,20 +134,7 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Set(view: SettingsViewId, page?: string) => {const next = new URLSearchParams(search)- for (const key of [- 'page',- 'field',- 'setting',- 'key',- 'aux',- 'session',- 'kind',- 'label',- 'origin',- 'pview',- 'kview',- 'bview'- ]) {+ for (const key of [...PAGE_SCOPED_PARAMS, 'pview', 'kview', 'bview']) {next.delete(key)}@@ -168,7 +176,7 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Set(tab: SettingsViewId, param: string, value: string, fallback: string) => {const params = new URLSearchParams(search)- for (const key of ['page', 'field', 'setting', 'key', 'aux', 'session', 'kind', 'label', 'origin']) {+ for (const key of PAGE_SCOPED_PARAMS) {params.delete(key)}@@ -193,6 +201,8 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Setconst openKeysView = useCallback((view: KeysView) => openSubView('keys', 'kview', view, 'tools'), [openSubView])+ const plugins = usePluginSettingsRoute(activeView === 'plugins')+const importInputRef = useRef<HTMLInputElement | null>(null)const exportConfig = async () => {@@ -387,6 +397,15 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Setlabel: t.settings.nav.sessions,onSelect: () => setActiveView('sessions')},+ {+ active: activeView === 'plugins',+ children: pluginSettingsNavChildren(plugins.entries, plugins.target, plugins.open),+ gapBefore: true,+ icon: PLUGINS_NAV_ICON,+ id: 'plugins',+ label: t.settings.nav.plugins,+ onSelect: () => plugins.open(null)+ },{active: activeView === 'about',gapBefore: true,@@ -418,6 +437,7 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: SetbillingView,canViewPlans,keysView,+ plugins,providerView,subpage,t,@@ -515,45 +535,43 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Set</>)- const activeSettingsContent =- activeView === 'config:appearance' ? (- <AppearanceSettings subpage={subpage} />- ) : activeView === 'about' ? (- <AboutSettings subpage={subpage} />- ) : activeView === 'gateway' || activeView === 'connections' ? (- // 'connections' renders the unified page too so the frame before- // the alias redirect lands doesn't flash the fallback view.- <GatewaySettings subpage={subpage} />- ) : activeView === 'keybinds' ? (- <KeybindSettings subpage={subpage} />- ) : activeView.startsWith('config:') ? (- <ConfigSettings- activeSectionId={activeView.slice('config:'.length)}- importInputRef={importInputRef}- onConfigSaved={onConfigSaved}- onMainModelChanged={onMainModelChanged}- subpage={subpage}- />- ) : activeView === 'providers' ? (- <ProvidersSettings- key={scopeProfile}- onClose={onClose}- onConfigSaved={onConfigSaved}- onMainModelChanged={onMainModelChanged}- onViewChange={setProviderView}- view={providerView}- />- ) : activeView === 'keys' ? (- <KeysSettings view={keysView} />- ) : activeView === 'notifications' ? (- <NotificationsSettings subpage={subpage} />- ) : activeView === 'billing' ? (- <BillingSettings />- ) : activeView === 'vault' ? (- <VaultSettings key={vaultOwnerKey(activeConnectionId, scopeProfile)} subpage={subpage} />- ) : (- <SessionsSettings subpage={subpage} />- )+ const SubpageView = SUBPAGE_VIEWS[activeView]++ const activeSettingsContent = SubpageView ? (+ <SubpageView subpage={subpage} />+ ) : activeView.startsWith('config:') ? (+ <ConfigSettings+ activeSectionId={activeView.slice('config:'.length)}+ importInputRef={importInputRef}+ onConfigSaved={onConfigSaved}+ onMainModelChanged={onMainModelChanged}+ subpage={subpage}+ />+ ) : activeView === 'providers' ? (+ <ProvidersSettings+ key={scopeProfile}+ onClose={onClose}+ onConfigSaved={onConfigSaved}+ onMainModelChanged={onMainModelChanged}+ onViewChange={setProviderView}+ view={providerView}+ />+ ) : activeView === 'keys' ? (+ <KeysSettings view={keysView} />+ ) : activeView === 'billing' ? (+ <BillingSettings />+ ) : activeView === 'plugins' ? (+ <PluginSettingsPane+ entries={plugins.entries}+ missing={plugins.missing}+ onOpen={plugins.open}+ target={plugins.target}+ />+ ) : activeView === 'vault' ? (+ <VaultSettings key={vaultOwnerKey(activeConnectionId, scopeProfile)} subpage={subpage} />+ ) : (+ <SessionsSettings subpage={subpage} />+ )return (<OverlayView closeLabel={t.settings.closeSettings} edgeBadge={searchPill} onClose={onClose}>diff --git a/apps/desktop/src/app/settings/moved-tabs.test.ts b/apps/desktop/src/app/settings/moved-tabs.test.tsindex 3a0aa7a0624..5cf9033b4fb 100644--- a/apps/desktop/src/app/settings/moved-tabs.test.ts+++ b/apps/desktop/src/app/settings/moved-tabs.test.ts@@ -3,15 +3,14 @@ import { describe, expect, it } from 'vitest'import { movedSettingsTabRedirect } from './moved-tabs'describe('movedSettingsTabRedirect', () => {- it('sends the retired Settings plugin/MCP tabs to Capabilities, keeping the row selector', () => {- expect(movedSettingsTabRedirect('?tab=plugins')).toBe('/capabilities?tab=plugins')- expect(movedSettingsTabRedirect('?tab=plugins&plugin=demo%2Fplugin')).toBe(- '/capabilities?tab=plugins&plugin=demo%2Fplugin'- )+ it('sends the retired Settings MCP tab to Capabilities, keeping the row selector', () => {expect(movedSettingsTabRedirect('?tab=mcp&server=github')).toBe('/capabilities?tab=connectors&server=github')})it('leaves live Settings tabs alone', () => {+ // `tab=plugins` is live again: Settings ▸ Plugins hosts every plugin's+ // own settings pages (the inventory stays in Capabilities ▸ Plugins).+ expect(movedSettingsTabRedirect('?tab=plugins&plugin=agent%3Anotes')).toBeNull()expect(movedSettingsTabRedirect('?tab=providers&pview=keys')).toBeNull()expect(movedSettingsTabRedirect('')).toBeNull()})diff --git a/apps/desktop/src/app/settings/moved-tabs.ts b/apps/desktop/src/app/settings/moved-tabs.tsindex 551f9f48e48..f9536850a2d 100644--- a/apps/desktop/src/app/settings/moved-tabs.ts+++ b/apps/desktop/src/app/settings/moved-tabs.ts@@ -1,8 +1,9 @@import { CAPABILITIES_ROUTE } from '../routes'+// `plugins` used to redirect here too; it is a live Settings view again+// (Settings ▸ Plugins = each plugin's own settings pages).const MOVED_TO_CAPABILITIES: Record<string, { param: string; tab: string }> = {- mcp: { param: 'server', tab: 'connectors' },- plugins: { param: 'plugin', tab: 'plugins' }+ mcp: { param: 'server', tab: 'connectors' }}export function movedSettingsTabRedirect(search: string): null | string {diff --git a/apps/desktop/src/app/settings/plugin-install-modal.tsx b/apps/desktop/src/app/settings/plugin-install-modal.tsxindex 4b6d9116260..52343cf592f 100644--- a/apps/desktop/src/app/settings/plugin-install-modal.tsx+++ b/apps/desktop/src/app/settings/plugin-install-modal.tsx@@ -331,8 +331,9 @@ export function PluginInstallModal() {}closePluginInstallRequest()- // Catalog picks come from Capabilities → Plugins; land back there.- navigate(request.catalogName ? '/capabilities?tab=plugins' : '/settings?tab=plugins')+ // Land on the inventory (Capabilities → Plugins) — Git installs too;+ // `/settings?tab=plugins` is the plugin settings pages now.+ navigate('/capabilities?tab=plugins')return}diff --git a/apps/desktop/src/app/capabilities/plugins/plugin-settings-form.test.tsx b/apps/desktop/src/app/settings/plugin-settings-form.test.tsxsimilarity index 100%rename from apps/desktop/src/app/capabilities/plugins/plugin-settings-form.test.tsxrename to apps/desktop/src/app/settings/plugin-settings-form.test.tsxdiff --git a/apps/desktop/src/app/capabilities/plugins/plugin-settings-form.tsx b/apps/desktop/src/app/settings/plugin-settings-form.tsxsimilarity index 100%rename from apps/desktop/src/app/capabilities/plugins/plugin-settings-form.tsxrename to apps/desktop/src/app/settings/plugin-settings-form.tsxdiff --git a/apps/desktop/src/app/settings/plugin-settings.test.tsx b/apps/desktop/src/app/settings/plugin-settings.test.tsxnew file mode 100644index 00000000000..690675a9465--- /dev/null+++ b/apps/desktop/src/app/settings/plugin-settings.test.tsx@@ -0,0 +1,157 @@+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'+import { useState } from 'react'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'++import { createPluginContext } from '@/contrib/plugin'+import { resolvePluginSettingsTarget } from '@/contrib/settings-pages'+import { $agentPlugins, $agentPluginsStatus, type AgentPluginRow } from '@/store/agent-plugins'++import { OverlayNav } from '../overlays/overlay-split-layout'++import { pluginSettingsNavChildren, PluginSettingsPane, usePluginSettingsEntries } from './plugin-settings'++const notesRow: AgentPluginRow = {+ description: 'Daily notes',+ key: 'notes',+ name: 'notes',+ settings_schema: [{ description: '', key: 'region', label: 'Region', required: false, type: 'string', value: 'us' }],+ source: 'user',+ status: 'enabled',+ version: '1.0.0'+}++const requestGateway = vi.fn(async (method: string, params?: Record<string, unknown>): Promise<unknown> => {+ if (method === 'plugins.manage' && params?.action === 'list') {+ return { plugins: [notesRow] }+ }++ if (method === 'plugins.manage' && params?.action === 'settings') {+ return { ok: true, plugin: notesRow }+ }++ return {}+})++vi.mock('@/app/gateway/hooks/use-gateway-request', () => ({+ useGatewayRequest: () => ({ requestGateway })+}))++const Icon = () => null++function Harness() {+ const entries = usePluginSettingsEntries()+ const [selection, setSelection] = useState<{ page: null | string; plugin: null | string }>({+ page: null,+ plugin: null+ })+ const target = resolvePluginSettingsTarget(entries, selection.plugin, selection.page)+ const open = (plugin: null | string, page?: string) => setSelection({ page: page ?? null, plugin })++ return (+ <>+ <OverlayNav+ groups={[+ {+ active: true,+ children: pluginSettingsNavChildren(entries, target, open),+ icon: Icon,+ id: 'plugins',+ label: 'Plugins',+ onSelect: () => open(null)+ }+ ]}+ />+ <PluginSettingsPane entries={entries} onOpen={open} target={target} />+ </>+ )+}++const railItem = (id: string) => document.querySelector<HTMLButtonElement>(`[data-tour="nav-${id}"]`)++describe('Settings ▸ Plugins', () => {+ const disposers: Array<() => void> = []++ beforeEach(() => {+ $agentPlugins.set([])+ $agentPluginsStatus.set('idle')+ requestGateway.mockClear()+ })++ afterEach(() => {+ cleanup()+ disposers.splice(0).forEach(dispose => dispose())+ })++ it('lists every plugin with settings and walks into a sub-page, WoW-AddOns style', async () => {+ const ctx = createPluginContext('weather', dispose => disposers.push(dispose))++ ctx.registerSettingsPage({+ children: [+ { id: 'units', render: () => <p>Units content</p>, title: 'Units' },+ { id: 'alerts', render: () => <p>Alerts content</p>, title: 'Alerts' }+ ],+ id: 'main',+ render: () => <p>Weather home</p>,+ title: 'Weather'+ })++ render(<Harness />)++ // The automatic config_schema page arrives with the agent plugin list.+ await waitFor(() => expect(railItem('plugins:agent:notes')).toBeTruthy())+ expect(railItem('plugins:weather:main')?.textContent).toBe('Weather')+ // Sub-pages stay folded until their plugin is selected.+ expect(railItem('plugins:weather:main:units')).toBeNull()++ fireEvent.click(railItem('plugins:weather:main')!)+ expect(screen.getByText('Weather home')).toBeTruthy()+ expect(railItem('plugins:weather:main:alerts')?.textContent).toBe('Alerts')++ fireEvent.click(railItem('plugins:weather:main:units')!)+ expect(screen.getByText('Units content')).toBeTruthy()+ expect(screen.queryByText('Weather home')).toBeNull()+ })++ it('renders a config_schema page that saves through plugins.manage settings', async () => {+ render(<Harness />)++ await waitFor(() => expect(railItem('plugins:agent:notes')).toBeTruthy())+ fireEvent.click(railItem('plugins:agent:notes')!)++ const region = screen.getByLabelText(/Region/) as HTMLInputElement++ expect(region.value).toBe('us')+ fireEvent.change(region, { target: { value: 'eu' } })+ fireEvent.click(screen.getByRole('button', { name: 'Save settings' }))++ await waitFor(() =>+ expect(requestGateway).toHaveBeenCalledWith('plugins.manage', {+ action: 'settings',+ key: 'notes',+ // Scoped to the Settings profile selector (the active profile here).+ profile: 'default',+ values: { region: 'eu' }+ })+ )+ })++ it('drops a disabled plugin’s page from the list', async () => {+ const ctx = createPluginContext('weather', dispose => disposers.push(dispose))++ ctx.registerSettingsPage({ id: 'main', render: () => <p>Weather home</p>, title: 'Weather' })+ render(<Harness />)+ expect(railItem('plugins:weather:main')).toBeTruthy()++ // Disable = the loader runs every tracked disposer.+ disposers.splice(0).forEach(dispose => dispose())+ await waitFor(() => expect(railItem('plugins:weather:main')).toBeNull())+ })++ it('shows an overview with an empty state when no plugin has settings', async () => {+ requestGateway.mockImplementationOnce(async () => ({ plugins: [] }))+ render(<Harness />)++ await waitFor(() => expect(screen.getByText('No plugin has settings yet.')).toBeTruthy())+ expect(screen.getByRole('link', { name: /Manage plugins/ }).getAttribute('href')).toBe('#/capabilities?tab=plugins')+ })+})diff --git a/apps/desktop/src/app/settings/plugin-settings.tsx b/apps/desktop/src/app/settings/plugin-settings.tsxnew file mode 100644index 00000000000..596d64fc9f7--- /dev/null+++ b/apps/desktop/src/app/settings/plugin-settings.tsx@@ -0,0 +1,347 @@+import { useStore } from '@nanostores/react'+import { useCallback, useEffect, useMemo } from 'react'+import { useLocation, useNavigate } from 'react-router'++import { setEnvVar } from '@/api/config'+import { useGatewayRequest } from '@/app/gateway/hooks/use-gateway-request'+import { Codicon, codiconIcon } from '@/components/ui/codicon'+import { $pluginRecords } from '@/contrib/plugins-store'+import { ContribBoundary, ContribRender } from '@/contrib/react/boundary'+import { useContributions } from '@/contrib/react/use-contributions'+import {+ pluginSettingsEntries,+ type PluginSettingsEntry,+ type PluginSettingsTarget,+ resolvePluginSettingsTarget,+ SETTINGS_PLUGINS_AREA+} from '@/contrib/settings-pages'+import { useI18n } from '@/i18n'+import type { IconComponent } from '@/lib/icons'+import {+ $agentPluginBusy,+ $agentPlugins,+ $agentPluginsStatus,+ isDesktopRelevantPlugin,+ loadAgentPlugins,+ saveAgentPluginSettings+} from '@/store/agent-plugins'+import { notify } from '@/store/notifications'+import { $settingsRequestProfile } from '@/store/settings-scope'++import { desktopPackageName } from '../capabilities/plugins/plugin-packages'+import type { OverlayNavLink } from '../overlays/overlay-split-layout'+import { CAPABILITIES_ROUTE } from '../routes'++import { PluginSettingsForm } from './plugin-settings-form'+import { EmptyState, ListRowSkeleton, SettingsContent } from './primitives'+import { SettingsProfileScope } from './profile-scope'++/** Opens Settings ▸ Plugins at an entry (by key) and optional sub-page;+ * `null` = the overview. */+export type OpenPluginSettings = (plugin: null | string, page?: string) => void++const MANAGE_PLUGINS_HREF = `#${CAPABILITIES_ROUTE}?tab=plugins`++// codiconIcon mints a component per call; cache so rail rows keep a stable+// element type across renders (no icon remount on every navigation).+const iconCache = new Map<string, IconComponent>()++function iconFor(name: string): IconComponent {+ let icon = iconCache.get(name)++ if (!icon) {+ icon = codiconIcon(name)+ iconCache.set(name, icon)+ }++ return icon+}++export const PLUGINS_NAV_ICON = iconFor('extensions')++const entryIcon = (entry: PluginSettingsEntry) => iconFor(entry.icon ?? 'plug')++/** Query params owned by one settings page; switching pages drops them. */+export const PAGE_SCOPED_PARAMS = [+ 'page',+ 'field',+ 'setting',+ 'key',+ 'aux',+ 'session',+ 'kind',+ 'label',+ 'origin',+ 'plugin',+ 'ppage'+] as const++/** Settings ▸ Plugins routing: `?tab=plugins&plugin=<entry key | plugin id |+ * agent:<key>>&ppage=<sub-page>`. `active` = the Plugins view is showing. */+export function usePluginSettingsRoute(active: boolean) {+ const navigate = useNavigate()+ const { hash, pathname, search } = useLocation()+ const entries = usePluginSettingsEntries()+ const status = useStore($agentPluginsStatus)+ const params = new URLSearchParams(search)+ const requested = params.get('plugin')+ const target = active ? resolvePluginSettingsTarget(entries, requested, params.get('ppage')) : null+ // A deep link to an agent plugin's page can't resolve until the list loads;+ // only call it missing once the load has settled.+ const settled = status !== 'idle' && status !== 'loading'++ const open = useCallback<OpenPluginSettings>(+ (plugin, page) => {+ const next = new URLSearchParams(search)++ for (const key of PAGE_SCOPED_PARAMS) {+ next.delete(key)+ }++ next.set('tab', 'plugins')++ if (plugin) {+ next.set('plugin', plugin)+ }++ if (plugin && page) {+ next.set('ppage', page)+ }++ navigate({ hash, pathname, search: `?${next}` }, { replace: true })+ },+ [hash, navigate, pathname, search]+ )++ return { entries, missing: Boolean(requested) && !target && settled, open, target }+}++/** Every plugin settings page, live: Desktop plugins' registered pages plus an+ * automatic page for each agent plugin that declares a `config_schema`+ * (scoped to the Settings profile selector). */+export function usePluginSettingsEntries(): PluginSettingsEntry[] {+ const { t } = useI18n()+ const { requestGateway } = useGatewayRequest()+ const contributions = useContributions(SETTINGS_PLUGINS_AREA)+ const rows = useStore($agentPlugins)+ const records = useStore($pluginRecords)+ const scope = useStore($settingsRequestProfile)++ // Cheap backend disk scan; the same loader Capabilities ▸ Plugins uses.+ useEffect(() => {+ void loadAgentPlugins(requestGateway, scope ?? null)+ }, [requestGateway, scope])++ const configTitle = t.settings.pluginPages.agentSettings++ return useMemo(+ () =>+ pluginSettingsEntries({+ configTitle,+ contributions,+ packageOf: pluginId => {+ const record = records[pluginId]++ return record ? desktopPackageName(record) : null+ },+ rows: rows.filter(isDesktopRelevantPlugin)+ }),+ [configTitle, contributions, records, rows]+ )+}++/** The Settings rail's children under "Plugins": one row per entry, its+ * sub-pages folded beneath it while it is selected. */+export function pluginSettingsNavChildren(+ entries: readonly PluginSettingsEntry[],+ target: null | PluginSettingsTarget,+ open: OpenPluginSettings+): OverlayNavLink[] {+ return entries.map(entry => {+ const active = target?.entry.key === entry.key++ return {+ active,+ children: entry.children.map(child => ({+ active: active && target?.child?.id === child.id,+ icon: iconFor(child.agentKey ? 'settings-gear' : 'list-flat'),+ id: `plugins:${entry.key}:${child.id}`,+ label: child.title,+ onSelect: () => open(entry.key, child.id)+ })),+ icon: entryIcon(entry),+ id: `plugins:${entry.key}`,+ label: entry.title,+ onSelect: () => open(entry.key)+ }+ })+}++function ManagePluginsLink() {+ const { t } = useI18n()++ return (+ <a+ className="inline-flex items-center gap-1 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-secondary) underline-offset-2 hover:text-foreground hover:underline"+ href={MANAGE_PLUGINS_HREF}+ >+ {t.settings.pluginPages.manage}+ <Codicon name="arrow-right" size="0.75rem" />+ </a>+ )+}++function PluginSettingsOverview({+ entries,+ missing,+ onOpen+}: {+ entries: readonly PluginSettingsEntry[]+ missing: boolean+ onOpen: OpenPluginSettings+}) {+ const { t } = useI18n()+ const copy = t.settings.pluginPages++ return (+ <SettingsContent>+ <div className="grid max-w-3xl gap-4">+ <div className="flex flex-wrap items-baseline justify-between gap-2">+ <p className="text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-(--ui-text-tertiary)">+ {copy.blurb}+ </p>+ <ManagePluginsLink />+ </div>+ {missing && (+ <p className="text-[length:var(--conversation-caption-font-size)] text-(--ui-text-secondary)" role="status">+ {copy.missing}+ </p>+ )}+ {entries.length === 0 ? (+ <EmptyState title={copy.empty} />+ ) : (+ <div className="grid overflow-hidden rounded-lg border border-(--ui-stroke-tertiary)">+ {entries.map(entry => {+ const Icon = entryIcon(entry)+ // The landing page counts as one; sub-pages add to it.+ const pages = entry.children.length + 1++ return (+ <button+ className="flex min-h-11 items-center gap-3 border-b border-(--ui-stroke-tertiary) px-3 text-left transition-colors last:border-b-0 hover:bg-(--chrome-action-hover)"+ data-testid={`plugin-settings-row-${entry.key}`}+ key={entry.key}+ onClick={() => onOpen(entry.key)}+ type="button"+ >+ <Icon className="size-4 shrink-0 text-(--ui-text-tertiary)" />+ <span className="min-w-0 flex-1 truncate text-[length:var(--conversation-text-font-size)]">+ {entry.title}+ </span>+ {pages > 1 && (+ <span className="shrink-0 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">+ {copy.pageCount(pages)}+ </span>+ )}+ <Codicon className="text-(--ui-text-tertiary)" name="chevron-right" size="0.8rem" />+ </button>+ )+ })}+ </div>+ )}+ </div>+ </SettingsContent>+ )+}++/** Automatic page for an agent plugin's manifest `config_schema`: the schema+ * form, saved through `plugins.manage settings` (+ `.env` for secrets) for+ * the profile the Settings scope selector targets. */+function PluginSchemaSettingsPage({ agentKey }: { agentKey: string }) {+ const { t } = useI18n()+ const p = t.skills.plugins+ const { requestGateway } = useGatewayRequest()+ const row = useStore($agentPlugins).find(candidate => candidate.key === agentKey)+ const busy = useStore($agentPluginBusy) === agentKey+ const scope = useStore($settingsRequestProfile)++ return (+ <SettingsContent>+ <div className="grid max-w-3xl gap-4">+ <SettingsProfileScope />+ {row?.description && (+ <p className="text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-(--ui-text-tertiary)">+ {row.description}+ </p>+ )}+ {row?.settings_schema?.length ? (+ <PluginSettingsForm+ disabled={busy}+ fields={row.settings_schema}+ idPrefix={`plugin-settings-${agentKey}`}+ onSave={async changes => {+ const ok = await saveAgentPluginSettings(requestGateway, {+ failMessage: p.settingsForm.saveFailed(row.name),+ key: agentKey,+ profile: scope ?? null,+ secrets: changes.secrets,+ values: changes.values,+ writeSecret: (env, value) => setEnvVar(env, value, scope)+ })++ if (ok) {+ notify({ kind: 'success', message: p.settingsForm.saved(row.name) })+ }++ return ok+ }}+ />+ ) : (+ <ListRowSkeleton />+ )}+ </div>+ </SettingsContent>+ )+}++/** Right-hand side of Settings ▸ Plugins: the selected page, or the overview+ * (every plugin with settings) when nothing — or something stale — is+ * selected. */+export function PluginSettingsPane({+ entries,+ missing = false,+ onOpen,+ target+}: {+ entries: readonly PluginSettingsEntry[]+ /** A `?plugin=` was requested but matches no page (disabled/uninstalled). */+ missing?: boolean+ onOpen: OpenPluginSettings+ target: null | PluginSettingsTarget+}) {+ if (!target) {+ return <PluginSettingsOverview entries={entries} missing={missing} onOpen={onOpen} />+ }++ const node = target.child ?? target.entry++ if (node.agentKey) {+ return <PluginSchemaSettingsPage agentKey={node.agentKey} key={node.agentKey} />+ }++ const render = node.render++ if (!render) {+ return <PluginSettingsOverview entries={entries} missing onOpen={onOpen} />+ }++ // Keyed per page so a sub-page switch remounts the plugin's tree (fresh+ // hook state, fresh error boundary) instead of reconciling across pages.+ return (+ <SettingsContent key={`${target.entry.key}:${target.child?.id ?? ''}`}>+ <ContribBoundary id={target.entry.key}>+ <ContribRender render={render} />+ </ContribBoundary>+ </SettingsContent>+ )+}diff --git a/apps/desktop/src/app/settings/subpage-navigation.tsx b/apps/desktop/src/app/settings/subpage-navigation.tsxindex 22f4bbc2241..3ffb942405a 100644--- a/apps/desktop/src/app/settings/subpage-navigation.tsx+++ b/apps/desktop/src/app/settings/subpage-navigation.tsx@@ -6,5 +6,10 @@ import type { OverlayNavGroup, OverlayNavLink } from '../overlays/overlay-split-export function SettingsSubpageHeader({ group, child }: { group: OverlayNavGroup; child?: OverlayNavLink }) {const { t } = useI18n()- return <OverlayBreadcrumbHeader child={child} group={group} rootLabel={t.commandCenter.settings} />+ // A third rail level (a plugin's sub-page under Settings ▸ Plugins).+ const grandchild = child?.children?.find(link => link.active)++ return (+ <OverlayBreadcrumbHeader child={child} grandchild={grandchild} group={group} rootLabel={t.commandCenter.settings} />+ )}diff --git a/apps/desktop/src/app/settings/types.ts b/apps/desktop/src/app/settings/types.tsindex 6452e91d5c9..b266cdf1afc 100644--- a/apps/desktop/src/app/settings/types.ts+++ b/apps/desktop/src/app/settings/types.ts@@ -12,6 +12,7 @@ export type SettingsView =| 'keybinds'| 'keys'| 'notifications'+ | 'plugins'| 'providers'| 'sessions'| 'vault'diff --git a/apps/desktop/src/contrib/plugin.ts b/apps/desktop/src/contrib/plugin.tsindex 076d7b6f15f..c3909e24b61 100644--- a/apps/desktop/src/contrib/plugin.ts+++ b/apps/desktop/src/contrib/plugin.ts@@ -19,6 +19,9 @@ import { dispatchPluginNativeNotification, type PluginNativeNotificationInput }import { type GatewayEventListener, onGatewayEvent } from './events'import { registry } from './registry'+import { type PluginSettingsPage, settingsPageContribution } from './settings-pages'++export type { PluginSettingsPage, PluginSettingsSubpage } from './settings-pages'import type { Contribution } from './types'export type { PluginRestOptions } from '@/hermes'@@ -80,6 +83,10 @@ export interface PluginContext {register: (c: PluginContribution) => () => void/** Register several at once; the returned disposer removes all of them. */registerMany: (cs: PluginContribution[]) => () => void+ /** Add this plugin's page (and optional sub-pages) to Settings ▸ Plugins.+ * Removed with the plugin on disable/unload. Feature-detect on older hosts:+ * `ctx.registerSettingsPage?.(...)`. */+ registerSettingsPage: (page: PluginSettingsPage) => () => void/** Register an arbitrary cleanup to run on unload/disable — for side effects* that aren't contributions or sockets (store subscriptions, timers). Runs* alongside every other disposer when the plugin deactivates. */@@ -286,6 +293,7 @@ export function createPluginContext(pluginId: string, onDispose?: (dispose: () =source,register: c => track(registry.register(scope(c))),registerMany: cs => track(registry.registerMany(cs.map(scope))),+ registerSettingsPage: page => track(registry.register(scope(settingsPageContribution(page)))),onDispose: fn => void track(fn),onEvent: (type, listener) => track(onGatewayEvent(type, listener)),...createPluginLifetime(track),diff --git a/apps/desktop/src/contrib/settings-pages.test.ts b/apps/desktop/src/contrib/settings-pages.test.tsnew file mode 100644index 00000000000..f8181f3ec2f--- /dev/null+++ b/apps/desktop/src/contrib/settings-pages.test.ts@@ -0,0 +1,170 @@+import { afterEach, describe, expect, it } from 'vitest'++import type { AgentPluginRow } from '@/store/agent-plugins'++import { createPluginContext } from './plugin'+import { registry } from './registry'+import {+ pluginSettingsEntries,+ pluginSettingsHref,+ resolvePluginSettingsTarget,+ SETTINGS_PLUGINS_AREA+} from './settings-pages'+import type { Contribution } from './types'++const render = () => null++const row = (over: Partial<AgentPluginRow>): AgentPluginRow => ({+ description: '',+ name: 'demo',+ source: 'user',+ status: 'enabled',+ version: '1.0.0',+ ...over+})++const field = { description: '', key: 'region', label: 'Region', required: false, type: 'string' as const }++const page = (id: string, title: string, over: Partial<Contribution> = {}): Contribution => ({+ area: SETTINGS_PLUGINS_AREA,+ id,+ render,+ source: `plugin:${id.split(':')[0]}`,+ title,+ ...over+})++describe('ctx.registerSettingsPage', () => {+ const disposers: Array<() => void> = []++ afterEach(() => {+ disposers.splice(0).forEach(dispose => dispose())+ })++ it('lands in the Settings ▸ Plugins area scoped to the registering plugin, and leaves with it', () => {+ const ctx = createPluginContext('weather', dispose => disposers.push(dispose))++ ctx.registerSettingsPage({+ children: [{ id: 'units', render, title: 'Units' }],+ icon: 'cloud',+ id: 'main',+ render,+ title: 'Weather'+ })++ const [registered] = registry.getArea(SETTINGS_PLUGINS_AREA).filter(c => c.source === 'plugin:weather')++ expect(registered).toMatchObject({ id: 'weather:main', source: 'plugin:weather', title: 'Weather' })+ expect(registered?.data).toMatchObject({ children: [{ id: 'units', title: 'Units' }], icon: 'cloud' })++ // The loader's disable/unload runs every tracked disposer.+ disposers.splice(0).forEach(dispose => dispose())+ expect(registry.getArea(SETTINGS_PLUGINS_AREA).some(c => c.source === 'plugin:weather')).toBe(false)+ })+})++describe('pluginSettingsEntries', () => {+ it('lists registered pages by order then title, dropping malformed ones', () => {+ const entries = pluginSettingsEntries({+ configTitle: 'Agent settings',+ contributions: [+ page('zeta:main', 'Zeta'),+ page('alpha:main', 'Alpha'),+ page('first:main', 'Last alphabetically', { order: -1 }),+ page('broken:main', '', {}),+ page('norender:main', 'No render', { render: undefined })+ ],+ rows: []+ })++ expect(entries.map(entry => entry.title)).toEqual(['Last alphabetically', 'Alpha', 'Zeta'])+ })++ it('keeps valid sub-pages in declared order and drops malformed or duplicate ones', () => {+ const [entry] = pluginSettingsEntries({+ configTitle: 'Agent settings',+ contributions: [+ page('weather:main', 'Weather', {+ data: {+ children: [+ { id: 'units', render, title: 'Units' },+ { id: 'units', render, title: 'Duplicate' },+ { id: 'alerts', render, title: 'Alerts' },+ { id: 'bad', title: 'No render' },+ null+ ]+ }+ })+ ],+ rows: []+ })++ expect(entry?.children.map(child => child.title)).toEqual(['Units', 'Alerts'])+ })++ it('gives every agent plugin with a config_schema its own automatic page', () => {+ const entries = pluginSettingsEntries({+ configTitle: 'Agent settings',+ contributions: [],+ rows: [+ row({ key: 'no-schema', name: 'no-schema' }),+ row({ key: 'notes', name: 'notes', settings_schema: [field] }),+ row({ name: 'keyless', settings_schema: [field] })+ ]+ })++ expect(entries).toHaveLength(1)+ expect(entries[0]).toMatchObject({ agentKey: 'notes', children: [], key: 'agent:notes', title: 'notes' })+ })++ it('folds a unified package’s schema form into its desktop page as a sub-page', () => {+ const entries = pluginSettingsEntries({+ configTitle: 'Agent settings',+ contributions: [page('pixel-overlay:main', 'Pixel Overlay')],+ packageOf: pluginId => (pluginId === 'pixel-overlay' ? 'pixel_overlay' : null),+ rows: [row({ key: 'pixel_overlay', name: 'pixel_overlay', settings_schema: [field] })]+ })++ expect(entries).toHaveLength(1)+ expect(entries[0]?.children).toEqual([{ agentKey: 'pixel_overlay', id: 'config', title: 'Agent settings' }])+ })+})++describe('resolvePluginSettingsTarget', () => {+ const entries = pluginSettingsEntries({+ configTitle: 'Agent settings',+ contributions: [page('weather:main', 'Weather', { data: { children: [{ id: 'units', render, title: 'Units' }] } })],+ packageOf: pluginId => (pluginId === 'weather' ? 'weather_pkg' : null),+ rows: [+ row({ key: 'weather_pkg', name: 'weather_pkg', settings_schema: [field] }),+ row({ key: 'notes', name: 'notes', settings_schema: [field] })+ ]+ })++ it('finds an entry by its key or by the plugin id, and a sub-page under it', () => {+ expect(resolvePluginSettingsTarget(entries, 'weather:main', null)?.entry.title).toBe('Weather')+ expect(resolvePluginSettingsTarget(entries, 'weather', 'units')?.child?.title).toBe('Units')+ expect(resolvePluginSettingsTarget(entries, 'weather', 'nope')?.child).toBeUndefined()+ })++ it('routes an agent:<key> deep link to the folded sub-page or the standalone page', () => {+ const folded = resolvePluginSettingsTarget(entries, 'agent:weather_pkg', null)++ expect(folded?.entry.key).toBe('weather:main')+ expect(folded?.child?.agentKey).toBe('weather_pkg')+ expect(resolvePluginSettingsTarget(entries, 'agent:notes', null)?.entry.agentKey).toBe('notes')+ })++ it('returns null for an unknown plugin (overview fallback)', () => {+ expect(resolvePluginSettingsTarget(entries, 'gone', null)).toBeNull()+ expect(resolvePluginSettingsTarget(entries, null, null)).toBeNull()+ })+})++describe('pluginSettingsHref', () => {+ it('builds the Settings ▸ Plugins deep link', () => {+ expect(pluginSettingsHref()).toBe('/settings?tab=plugins')+ expect(pluginSettingsHref('agent:image_gen/fal')).toBe('/settings?tab=plugins&plugin=agent%3Aimage_gen%2Ffal')+ expect(pluginSettingsHref('weather', 'units')).toBe('/settings?tab=plugins&plugin=weather&ppage=units')+ })+})diff --git a/apps/desktop/src/contrib/settings-pages.ts b/apps/desktop/src/contrib/settings-pages.tsnew file mode 100644index 00000000000..1f39995900a--- /dev/null+++ b/apps/desktop/src/contrib/settings-pages.ts@@ -0,0 +1,253 @@+/**+ * Settings ▸ Plugins — one home for every plugin's preferences, WoW-AddOns+ * style: each plugin gets an entry in the Settings rail, optionally with its+ * own sub-pages beneath it.+ *+ * Two feeds produce entries:+ * - Desktop plugins call `ctx.registerSettingsPage(...)` (a contribution in+ * `SETTINGS_PLUGINS_AREA`, so provenance + disable/unload cleanup come from+ * the registry like every other contribution).+ * - Agent plugins whose `plugin.yaml` declares a `config_schema` get an+ * automatic page rendering the schema form — no Desktop code required. A+ * unified package that does both shows ONE entry; the schema form becomes+ * its "Agent settings" sub-page.+ *+ * Pure: no React, no stores. The Settings view feeds it the live registry+ * area and the agent plugin list.+ */++import type { ReactNode } from 'react'++import type { AgentPluginRow } from '@/store/agent-plugins'++import type { Contribution } from './types'++/** Contribution area for plugin settings pages. Same id as the section area+ * proposed in #91935, so a plugin written against that draft registers here. */+export const SETTINGS_PLUGINS_AREA = 'settings.plugins'++/** Entry-key prefix for automatic config_schema pages (`agent:<key>`). */+export const AGENT_SETTINGS_PREFIX = 'agent:'++/** Sub-page id the schema form takes when folded under a desktop page. */+export const AGENT_SETTINGS_SUBPAGE = 'config'++export interface PluginSettingsSubpage {+ /** Unique within the page; becomes the `ppage` URL param. */+ id: string+ title: string+ render: () => ReactNode+}++/** What `ctx.registerSettingsPage` accepts. */+export interface PluginSettingsPage {+ /** Unique within the plugin (namespaced to `<pluginId>:<id>` on register). */+ id: string+ /** Rail label and breadcrumb. */+ title: string+ /** Codicon name for the rail (e.g. `'cloud'`); a plug when omitted. */+ icon?: string+ /** Ascending; ties sort alphabetically by title. */+ order?: number+ /** The page's landing content. */+ render: () => ReactNode+ /** Sub-pages listed beneath the entry when it is selected. */+ children?: PluginSettingsSubpage[]+}++export interface PluginSettingsNode {+ id: string+ title: string+ /** Plugin-rendered content. Absent on schema-form nodes. */+ render?: () => ReactNode+ /** Agent plugin key whose `config_schema` form this node renders. */+ agentKey?: string+}++export interface PluginSettingsEntry extends PluginSettingsNode {+ /** URL key: the contribution id (`<pluginId>:<pageId>`) or `agent:<key>`. */+ key: string+ icon?: string+ order: number+ /** Registering desktop plugin id, when contributed by one. */+ pluginId?: string+ children: PluginSettingsNode[]+}++export interface PluginSettingsTarget {+ entry: PluginSettingsEntry+ child?: PluginSettingsNode+}++/** Shape a registration into a registry contribution (the plugin context+ * namespaces the id and stamps the source). */+export function settingsPageContribution(page: PluginSettingsPage): Omit<Contribution, 'source'> {+ return {+ area: SETTINGS_PLUGINS_AREA,+ data: { children: page.children ?? [], icon: page.icon },+ id: page.id,+ order: page.order,+ render: page.render,+ title: page.title+ }+}++const isRecord = (value: unknown): value is Record<string, unknown> =>+ typeof value === 'object' && value !== null && !Array.isArray(value)++const nonEmpty = (value: unknown): value is string => typeof value === 'string' && value.trim().length > 0++/** Runtime plugins are untrusted JS: validate the sub-page list rather than+ * trusting the TypeScript shape. Malformed and duplicate ids are dropped. */+function subpagesOf(data: unknown): PluginSettingsNode[] {+ const raw = isRecord(data) && Array.isArray(data.children) ? data.children : []+ const seen = new Set<string>()+ const nodes: PluginSettingsNode[] = []++ for (const child of raw) {+ if (!isRecord(child) || !nonEmpty(child.id) || !nonEmpty(child.title) || typeof child.render !== 'function') {+ continue+ }++ if (seen.has(child.id) || child.id === AGENT_SETTINGS_SUBPAGE) {+ continue+ }++ seen.add(child.id)+ nodes.push({ id: child.id, render: child.render as () => ReactNode, title: child.title })+ }++ return nodes+}++const pluginIdOf = (source: string | undefined) =>+ source?.startsWith('plugin:') ? source.slice('plugin:'.length) : undefined++export interface PluginSettingsEntriesInput {+ /** Live `SETTINGS_PLUGINS_AREA` contributions. */+ contributions: readonly Contribution[]+ /** Agent plugin rows (already filtered to what the user can manage). */+ rows: readonly AgentPluginRow[]+ /** Label for a schema form folded under a desktop page. */+ configTitle: string+ /** Desktop plugin id → its package folder name (the agent row's `name`),+ * for unified packages. */+ packageOf?: (pluginId: string) => null | string | undefined+}++export function pluginSettingsEntries({+ configTitle,+ contributions,+ packageOf,+ rows+}: PluginSettingsEntriesInput): PluginSettingsEntry[] {+ const entries: PluginSettingsEntry[] = []++ for (const contribution of contributions) {+ if (!nonEmpty(contribution.title) || typeof contribution.render !== 'function') {+ continue+ }++ const icon = isRecord(contribution.data) && nonEmpty(contribution.data.icon) ? contribution.data.icon : undefined++ entries.push({+ children: subpagesOf(contribution.data),+ icon,+ id: contribution.id,+ key: contribution.id,+ order: typeof contribution.order === 'number' ? contribution.order : 0,+ pluginId: pluginIdOf(contribution.source),+ render: contribution.render,+ title: contribution.title+ })+ }++ for (const row of rows) {+ if (!row.key || !row.settings_schema?.length) {+ continue+ }++ const owner = entries.find(entry => {+ if (!entry.pluginId || entry.agentKey) {+ return false+ }++ const pkg = packageOf?.(entry.pluginId)++ return row.name === pkg || row.name === entry.pluginId || row.key === entry.pluginId+ })++ if (owner) {+ if (!owner.children.some(child => child.agentKey)) {+ owner.children.push({ agentKey: row.key, id: AGENT_SETTINGS_SUBPAGE, title: configTitle })+ }++ continue+ }++ entries.push({+ agentKey: row.key,+ children: [],+ id: `${AGENT_SETTINGS_PREFIX}${row.key}`,+ key: `${AGENT_SETTINGS_PREFIX}${row.key}`,+ order: 0,+ title: row.name || row.key+ })+ }++ return entries.sort((a, b) => a.order - b.order || a.title.localeCompare(b.title))+}++/** Resolve `?plugin=&ppage=` to an entry (+ sub-page). `plugin` may be the+ * entry key, the registering plugin id, or `agent:<key>` (the Capabilities+ * gear) — which also finds a schema form folded under a desktop page.+ * Null = show the overview. */+export function resolvePluginSettingsTarget(+ entries: readonly PluginSettingsEntry[],+ plugin: null | string,+ page: null | string+): null | PluginSettingsTarget {+ if (!plugin) {+ return null+ }++ const pick = (entry: PluginSettingsEntry): PluginSettingsTarget => ({+ child: page ? entry.children.find(child => child.id === page) : undefined,+ entry+ })++ const direct = entries.find(entry => entry.key === plugin) ?? entries.find(entry => entry.pluginId === plugin)++ if (direct) {+ return pick(direct)+ }++ if (plugin.startsWith(AGENT_SETTINGS_PREFIX)) {+ const agentKey = plugin.slice(AGENT_SETTINGS_PREFIX.length)++ for (const entry of entries) {+ const child = entry.children.find(node => node.agentKey === agentKey)++ if (child) {+ return { child, entry }+ }+ }+ }++ return null+}++/** Hash-route path to Settings ▸ Plugins (▸ entry (▸ sub-page)). */+export function pluginSettingsHref(plugin?: string, page?: string): string {+ const params = new URLSearchParams({ tab: 'plugins' })++ if (plugin) {+ params.set('plugin', plugin)+ }++ if (plugin && page) {+ params.set('ppage', page)+ }++ return `/settings?${params}`+}diff --git a/apps/desktop/src/i18n/ar_settings.ts b/apps/desktop/src/i18n/ar_settings.tsindex 78026a60cb7..5f04e8cb229 100644--- a/apps/desktop/src/i18n/ar_settings.ts+++ b/apps/desktop/src/i18n/ar_settings.ts@@ -69,6 +69,14 @@ export const arSettings = {resetConfirm: 'هل تريد إعادة كل الإعدادات إلى افتراضيات Hermes؟',exportFailed: 'فشل التصدير',resetFailed: 'فشلت إعادة الضبط',+ pluginPages: {+ blurb: 'خيارات تضيفها الإضافات المثبّتة. لكل إضافة صفحتها الخاصة، وبعضها يضيف صفحات فرعية.',+ empty: 'لا توجد إضافة لها إعدادات بعد.',+ manage: 'إدارة الإضافات',+ agentSettings: 'إعدادات الوكيل',+ pageCount: (n: number) => `${n} صفحات`,+ missing: 'هذه الإضافة ليس لها صفحة إعدادات. ربما عُطّلت أو أُزيلت.'+ },nav: {providers: 'المزودون',providerAccounts: 'الحسابات',@@ -83,7 +91,8 @@ export const arSettings = {about: 'حول',notifications: 'الإشعارات',keybinds: 'اختصارات لوحة المفاتيح',- vault: 'كلمات المرور وتسجيلات الدخول'+ vault: 'كلمات المرور وتسجيلات الدخول',+ plugins: 'الإضافات'},vault: {title: 'كلمات المرور وتسجيلات الدخول',@@ -161,16 +170,10 @@ export const arSettings = {},plugins: {title: 'إضافات سطح المكتب',- blurb:- 'امتدادات واجهة تُحمّل داخل هذا التطبيق — إما مضمّنة مع البناء، أو موضوعة في مجلد desktop-plugins (بما فيها التي يكتبها Hermes). تعطيل الإضافة يفرغها مباشرة ويبقى بعد إعادة التشغيل.',- count: n => `${n} مثبتة`,openFolder: 'فتح مجلد إضافات سطح المكتب',rescan: 'إعادة الفحص',reveal: 'إظهار في مدير الملفات',- enable: 'تفعيل',- disable: 'تعطيل',failed: 'فشل',- empty: 'لا توجد إضافات سطح مكتب مثبتة بعد.',kinds: { bundled: 'مضمّنة', disk: 'على القرص', runtime: 'وقت التشغيل' },installModal: {installUncertain:diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 6f81923f5d2..3b147c848a6 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -869,6 +869,14 @@ export const deOverrides = {resetConfirm: 'Alle Einstellungen auf Hermes-Standard zurücksetzen?',exportFailed: 'Export fehlgeschlagen',resetFailed: 'Zurücksetzen fehlgeschlagen',+ pluginPages: {+ blurb: 'Optionen installierter Plugins. Jedes Plugin hat eine eigene Seite, manche mit Unterseiten.',+ empty: 'Noch kein Plugin hat Einstellungen.',+ manage: 'Plugins verwalten',+ agentSettings: 'Agent-Einstellungen',+ pageCount: (n: number) => (n === 1 ? '1 Seite' : `${n} Seiten`),+ missing: 'Dieses Plugin hat keine Einstellungsseite. Es ist eventuell deaktiviert oder deinstalliert.'+ },nav: {providers: 'Anbieter',providerAccounts: 'Konten',@@ -890,23 +898,15 @@ export const deOverrides = {},plugins: {title: 'Desktop-Plugins',- blurb: 'Gebündelt oder im Ordner „Desktop-Plugins“ abgelegt. Deaktivieren, um live zu entladen.',- count: n => `${n} installiert`,openFolder: 'Ordner für Desktop-Plugins öffnen',rescan: 'Erneut scannen',reveal: 'Im Dateimanager anzeigen',- enable: 'Aktivieren',- disable: 'Deaktivieren',failed: 'fehlgeschlagen',- empty: 'Noch keine Desktop-Plugins installiert.',kinds: {bundled: 'gebündelt',disk: 'auf Datenträger',runtime: 'Laufzeit'},- agentHalfMissing: 'Agent-Hälfte fehlt hier',- agentHalfMissingTip:- 'Das ist die Desktop-Hälfte eines gebündelten Plugins, aber seine Agent-Hälfte ist auf dem aktuell verbundenen Backend/Profil nicht installiert. Installieren Sie sie unter Fähigkeiten → Plugins.',installModal: {installFromGit: 'Von Git installieren',reviewRepository: 'Repository prüfen',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex d9c25a3c5da..e01584e844d 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -870,6 +870,14 @@ export const en: Translations = {resetConfirm: 'Reset all settings to Hermes defaults?',exportFailed: 'Export failed',resetFailed: 'Reset failed',+ pluginPages: {+ blurb: 'Options that installed plugins add. Each plugin gets its own page, and some add sub-pages under it.',+ empty: 'No plugin has settings yet.',+ manage: 'Manage plugins',+ agentSettings: 'Agent settings',+ pageCount: (n: number) => (n === 1 ? '1 page' : `${n} pages`),+ missing: 'That plugin has no settings page. It may be disabled or uninstalled.'+ },nav: {providers: 'Providers',providerAccounts: 'Accounts',@@ -887,24 +895,16 @@ export const en: Translations = {about: 'About',billing: 'Billing',notifications: 'Notifications',- vault: 'Passwords & Logins'+ vault: 'Passwords & Logins',+ plugins: 'Plugins'},plugins: {title: 'Desktop plugins',- blurb:- 'Extend this app, not an agent — installed once for the whole app, whichever profile, gateway, or machine you connect to. Bundled or dropped into the desktop-plugins folder; toggles apply live.',- count: n => `${n} installed`,openFolder: 'Open Desktop plugins folder',rescan: 'Rescan',reveal: 'Reveal in file manager',- enable: 'Enable',- disable: 'Disable',failed: 'failed',- empty: 'No desktop plugins installed yet.',kinds: { bundled: 'bundled', disk: 'on disk', runtime: 'runtime' },- agentHalfMissing: 'agent half missing here',- agentHalfMissingTip:- 'This is the desktop half of a bundled plugin, but its agent half is not installed on the currently connected backend/profile. Install it from Capabilities → Plugins.',installModal: {installFromGit: 'Install from Git',reviewRepository: 'Review repository',diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex 5891c704387..17245f15292 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -870,6 +870,15 @@ export const esOverrides = {resetConfirm: '¿Restablecer toda la configuración a los valores predeterminados de Hermes?',exportFailed: 'Falló la exportación',resetFailed: 'Falló el restablecimiento',+ pluginPages: {+ blurb:+ 'Opciones que añaden los plugins instalados. Cada plugin tiene su propia página y algunos añaden subpáginas.',+ empty: 'Ningún plugin tiene ajustes todavía.',+ manage: 'Gestionar plugins',+ agentSettings: 'Ajustes del agente',+ pageCount: (n: number) => (n === 1 ? '1 página' : `${n} páginas`),+ missing: 'Este plugin no tiene página de ajustes. Puede que esté desactivado o desinstalado.'+ },nav: {providers: 'Proveedores',providerAccounts: 'Cuentas',@@ -891,24 +900,15 @@ export const esOverrides = {},plugins: {title: 'Plugins de escritorio',- blurb:- 'Amplía esta app, no un agente: se instala una sola vez para toda la app, sea cual sea el perfil, gateway o equipo al que te conectes. Incluidos o copiados en la carpeta desktop-plugins; los interruptores se aplican al instante.',- count: n => `${n} instalados`,openFolder: 'Abrir la carpeta de plugins de escritorio',rescan: 'Volver a buscar',reveal: 'Mostrar en el gestor de archivos',- enable: 'Activar',- disable: 'Desactivar',failed: 'falló',- empty: 'Aún no hay plugins de escritorio instalados.',kinds: {bundled: 'incluido',disk: 'en disco',runtime: 'en ejecución'},- agentHalfMissing: 'falta la parte del agente aquí',- agentHalfMissingTip:- 'Esta es la parte de escritorio de un plugin incluido, pero su parte del agente no está instalada en el backend o perfil conectado. Instálala desde Capacidades → Plugins.',installModal: {installFromGit: 'Instalar desde Git',reviewRepository: 'Revisar repositorio',diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 05778e07ebb..1019efea710 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -869,6 +869,15 @@ export const frOverrides = {resetConfirm: 'Réinitialiser tous les paramètres aux valeurs par défaut de Hermes ?',exportFailed: "Échec de l'export",resetFailed: 'Échec de la réinitialisation',+ pluginPages: {+ blurb:+ 'Options ajoutées par les plugins installés. Chaque plugin a sa propre page, et certains ajoutent des sous-pages.',+ empty: "Aucun plugin n'a encore de réglages.",+ manage: 'Gérer les plugins',+ agentSettings: "Réglages de l'agent",+ pageCount: (n: number) => (n === 1 ? '1 page' : `${n} pages`),+ missing: "Ce plugin n'a pas de page de réglages. Il est peut-être désactivé ou désinstallé."+ },nav: {providers: 'Fournisseurs',providerAccounts: 'Comptes',@@ -890,24 +899,15 @@ export const frOverrides = {},plugins: {title: 'Plugins du desktop',- blurb:- "Étendez cette application, et non un agent : ces plugins sont installés une seule fois pour toute l'application, quel que soit le profil, le gateway ou la machine connectée. Les interrupteurs s'appliquent immédiatement.",- count: n => `${n} installés`,openFolder: 'Ouvrir le dossier des plugins Desktop',rescan: 'Re-analyser',reveal: 'Afficher dans le gestionnaire de fichiers',- enable: 'Activer',- disable: 'Désactiver',failed: 'échec',- empty: 'Aucun plugin desktop installé pour le moment.',kinds: {bundled: 'intégré',disk: 'sur le disque',runtime: "à l'exécution"},- agentHalfMissing: 'partie agent absente ici',- agentHalfMissingTip:- "Il s'agit de la partie Desktop d'un plugin groupé, mais sa partie agent n'est pas installée sur le backend ou profil actuellement connecté. Installez-la depuis Capacités → Plugins.",installModal: {installFromGit: 'Installer depuis Git',reviewRepository: 'Examiner le dépôt',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 8c69e43f627..09b9e254dd0 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3,6 +3,7 @@ import { defineFieldCopy } from '@/app/settings/field-copy'import { defineLocale } from './define-locale'import { introJa } from './intro-ja'import { jaModelMenu } from './ja_model_menu'+import { jaPluginSettings } from './ja_plugins'export const ja = defineLocale({externalOpenFailed: {@@ -440,22 +441,7 @@ export const ja = defineLocale({billingOverview: '概要',billingPlans: 'プラン'},- plugins: {- openFolder: 'デスクトッププラグインフォルダーを開く',- installModal: {- installUncertain:- 'Hermes はインストール結果の待機を終了しましたが、プラグインのインストールはまだ進行中の可能性があります。この画面を閉じ、再インストールする前にプラグイン一覧を再スキャンしてください。',- installFromGit: 'Git からインストール',- reviewRepository: 'リポジトリを確認',- repoPlaceholder: 'https://github.com/owner/repo',- toolsConnected: n => `${n} 個のツールを接続しました`,- skillsReady: names =>- names.length === 1 ? `スキル ${names[0]} の準備ができました` : `${names.length} 個のスキルの準備ができました`,- nextChat: 'ほかのツールは次のチャットで使えます',- serverNotConnected: (server, reason) =>- `MCP サーバー ${server} は接続されていません${reason ? `: ${reason}` : '。'}`- }- },+ plugins: jaPluginSettings.plugins,closeSettings: '設定を閉じる',exportConfig: '設定を書き出す',importConfig: '設定を読み込む',@@ -463,6 +449,7 @@ export const ja = defineLocale({resetConfirm: 'すべての設定を Hermes のデフォルトに戻しますか?',exportFailed: '書き出しに失敗しました',resetFailed: 'リセットに失敗しました',+ pluginPages: jaPluginSettings.pluginPages,nav: {providers: 'プロバイダー',providerAccounts: 'アカウント',@@ -480,7 +467,8 @@ export const ja = defineLocale({about: '情報',billing: '請求',notifications: '通知',- vault: 'パスワードとログイン'+ vault: 'パスワードとログイン',+ plugins: 'プラグイン'},vault: {title: 'パスワードとログイン',diff --git a/apps/desktop/src/i18n/ja_plugins.ts b/apps/desktop/src/i18n/ja_plugins.tsnew file mode 100644index 00000000000..3e97855e95a--- /dev/null+++ b/apps/desktop/src/i18n/ja_plugins.ts@@ -0,0 +1,33 @@+import type { TranslationOverrides } from './define-locale'++type SettingsOverrides = NonNullable<TranslationOverrides['settings']>++/** Japanese copy for the plugin settings surfaces: Settings ▸ Plugins pages and+ * the Desktop plugin install flow. */+export const jaPluginSettings = {+ pluginPages: {+ blurb:+ 'インストール済みプラグインが追加するオプションです。各プラグインに専用ページがあり、サブページを持つものもあります。',+ empty: '設定を持つプラグインはまだありません。',+ manage: 'プラグインを管理',+ agentSettings: 'エージェント設定',+ pageCount: (n: number) => `${n} ページ`,+ missing: 'このプラグインには設定ページがありません。無効化またはアンインストールされた可能性があります。'+ },+ plugins: {+ openFolder: 'デスクトッププラグインフォルダーを開く',+ installModal: {+ installUncertain:+ 'Hermes はインストール結果の待機を終了しましたが、プラグインのインストールはまだ進行中の可能性があります。この画面を閉じ、再インストールする前にプラグイン一覧を再スキャンしてください。',+ installFromGit: 'Git からインストール',+ reviewRepository: 'リポジトリを確認',+ repoPlaceholder: 'https://github.com/owner/repo',+ toolsConnected: n => `${n} 個のツールを接続しました`,+ skillsReady: names =>+ names.length === 1 ? `スキル ${names[0]} の準備ができました` : `${names.length} 個のスキルの準備ができました`,+ nextChat: 'ほかのツールは次のチャットで使えます',+ serverNotConnected: (server, reason) =>+ `MCP サーバー ${server} は接続されていません${reason ? `: ${reason}` : '。'}`+ }+ }+} satisfies Pick<SettingsOverrides, 'pluginPages' | 'plugins'>diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 4d20b63f2e5..27d080fd858 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -2,6 +2,7 @@ import { defineFieldCopy } from '@/app/settings/field-copy'import { defineLocale } from './define-locale'import { ruModelMenu } from './ru_model_menu'+import { ruPluginSettings } from './ru_plugins'// RU_PLURAL: (count, one, few, many) — русские формы сущ. падежа// RU_NOUN: (count, one, few, many) — формы род. множественного@@ -515,6 +516,7 @@ export const ru = defineLocale({resetConfirm: 'Сбросить все настройки к значениям Hermes по умолчанию?',exportFailed: 'Не удалось экспортировать',resetFailed: 'Не удалось сбросить',+ pluginPages: ruPluginSettings.pluginPages,nav: {providers: 'Провайдеры',providerAccounts: 'Аккаунты',@@ -530,67 +532,10 @@ export const ru = defineLocale({sessions: 'Сеансы',about: 'О программе',billing: 'Оплата',- notifications: 'Уведомления'- },- plugins: {- title: 'Плагины приложения',- blurb: 'Встроенные или добавленные в папку desktop-plugins. Отключите, чтобы выгрузить без перезапуска.',- count: n => `Установлено: ${n}`,- openFolder: 'Открыть папку плагинов приложения',- rescan: 'Пересканировать',- reveal: 'Показать в файловом менеджере',- enable: 'Включить',- disable: 'Отключить',- failed: 'ошибка',- empty: 'Плагины приложения пока не установлены.',- kinds: { bundled: 'встроенный', disk: 'на диске', runtime: 'runtime' },- installModal: {- title: 'Установка плагина',- description: 'Перед установкой посмотрите, что содержит этот репозиторий.',- repoLabel: 'Репозиторий',- includesHeading: 'Состав пакета',- agentLabel: 'Плагин агента',- desktopLabel: 'UI приложения',- profileLabel: 'Установить для профиля',- agentTargetLocal: (profile, dir) => `Устанавливается в локальный бэкенд ${profile} (${dir})`,- agentTargetRemote: profile => `Устанавливается в подключённый бэкенд ${profile}`,- desktopTarget: 'Устанавливается в локальную папку desktop-plugins этого приложения',- desktopOnlyNote: 'Пакеты только для приложения не устанавливают плагин агента.',- insecureWarning:- 'Этот URL использует небезопасную или локальную схему. Для боевой установки предпочитайте https:// или git@.',- securityHeading: 'Перед установкой',- securityIntro:- 'Устанавливайте только из проверенных источников — при желании просмотрите репозиторий ниже, чтобы увидеть, что будет добавлено.',- sourceHeading: 'Исходный код',- viewRepository: 'Посмотреть репозиторий',- viewPluginFiles: 'Посмотреть файлы плагина',- gitCloneLabel: 'URL для git clone',- enableAgent: 'Включить плагин агента после установки',- forceReinstall: 'Принудительная переустановка (заменить, если уже установлен)',- pinToCommit: 'Закрепить на коммите (необязательно)',- pinToCommitPlaceholder: 'Полный SHA коммита (40 символов)',- pinToCommitHint:- 'Все, кто установит этот SHA, получат одинаковый код; плагин перестанет обновляться до смены пина. Оставьте пустым для последнего коммита.',- pinToCommitInvalid: 'Нужен полный SHA коммита из 40 символов (ветки и теги не принимаются).',- install: 'Установить',- installing: 'Установка…',- probing: 'Осмотр репозитория…',- probeUnavailable: 'Осмотр плагинов недоступен в этом окружении.',- desktopUnavailable: 'Установка плагинов приложения недоступна в этом окружении.',- selectComponent: 'Выберите хотя бы один компонент для установки.',- agentSuccess: name => `Плагин агента ${name} установлен`,- desktopSuccess: name => `Плагин приложения ${name} установлен`,- agentFailed: 'Не удалось установить плагин агента',- installUncertain:- 'Hermes перестал ждать результат установки, но плагин может всё ещё устанавливаться. Закройте это окно и обновите список плагинов перед повторной установкой.',- desktopFailed: 'Не удалось установить плагин приложения',- missingEnv: (_name, vars) => `Не хватает переменных окружения: ${vars}. Добавьте их в Настройки → Ключи.`,- toolsConnected: n => `Подключено инструментов: ${n}`,- skillsReady: names => (names.length === 1 ? `навык ${names[0]} готов` : `готово навыков: ${names.length}`),- nextChat: 'остальные инструменты появятся в следующем чате',- serverNotConnected: (server, reason) => `MCP-сервер ${server} не подключён${reason ? `: ${reason}` : '.'}`- }+ notifications: 'Уведомления',+ plugins: 'Плагины'},+ plugins: ruPluginSettings.plugins,notifications: {title: 'Уведомления',intro: 'Системные уведомления (не всплывающие внутри приложения). Настраивается для каждого устройства.',diff --git a/apps/desktop/src/i18n/ru_plugins.ts b/apps/desktop/src/i18n/ru_plugins.tsnew file mode 100644index 00000000000..a0b4ccea169--- /dev/null+++ b/apps/desktop/src/i18n/ru_plugins.ts@@ -0,0 +1,71 @@+import type { TranslationOverrides } from './define-locale'++type SettingsOverrides = NonNullable<TranslationOverrides['settings']>++/** Russian copy for the plugin settings surfaces: Settings ▸ Plugins pages and+ * the Desktop plugin install flow. */+export const ruPluginSettings = {+ pluginPages: {+ blurb:+ 'Параметры, которые добавляют установленные плагины. У каждого плагина своя страница, у некоторых есть подстраницы.',+ empty: 'Пока ни у одного плагина нет настроек.',+ manage: 'Управление плагинами',+ agentSettings: 'Настройки агента',+ pageCount: (n: number) => `Страниц: ${n}`,+ missing: 'У этого плагина нет страницы настроек. Возможно, он отключён или удалён.'+ },+ plugins: {+ title: 'Плагины приложения',+ openFolder: 'Открыть папку плагинов приложения',+ rescan: 'Пересканировать',+ reveal: 'Показать в файловом менеджере',+ failed: 'ошибка',+ kinds: { bundled: 'встроенный', disk: 'на диске', runtime: 'runtime' },+ installModal: {+ title: 'Установка плагина',+ description: 'Перед установкой посмотрите, что содержит этот репозиторий.',+ repoLabel: 'Репозиторий',+ includesHeading: 'Состав пакета',+ agentLabel: 'Плагин агента',+ desktopLabel: 'UI приложения',+ profileLabel: 'Установить для профиля',+ agentTargetLocal: (profile, dir) => `Устанавливается в локальный бэкенд ${profile} (${dir})`,+ agentTargetRemote: profile => `Устанавливается в подключённый бэкенд ${profile}`,+ desktopTarget: 'Устанавливается в локальную папку desktop-plugins этого приложения',+ desktopOnlyNote: 'Пакеты только для приложения не устанавливают плагин агента.',+ insecureWarning:+ 'Этот URL использует небезопасную или локальную схему. Для боевой установки предпочитайте https:// или git@.',+ securityHeading: 'Перед установкой',+ securityIntro:+ 'Устанавливайте только из проверенных источников — при желании просмотрите репозиторий ниже, чтобы увидеть, что будет добавлено.',+ sourceHeading: 'Исходный код',+ viewRepository: 'Посмотреть репозиторий',+ viewPluginFiles: 'Посмотреть файлы плагина',+ gitCloneLabel: 'URL для git clone',+ enableAgent: 'Включить плагин агента после установки',+ forceReinstall: 'Принудительная переустановка (заменить, если уже установлен)',+ pinToCommit: 'Закрепить на коммите (необязательно)',+ pinToCommitPlaceholder: 'Полный SHA коммита (40 символов)',+ pinToCommitHint:+ 'Все, кто установит этот SHA, получат одинаковый код; плагин перестанет обновляться до смены пина. Оставьте пустым для последнего коммита.',+ pinToCommitInvalid: 'Нужен полный SHA коммита из 40 символов (ветки и теги не принимаются).',+ install: 'Установить',+ installing: 'Установка…',+ probing: 'Осмотр репозитория…',+ probeUnavailable: 'Осмотр плагинов недоступен в этом окружении.',+ desktopUnavailable: 'Установка плагинов приложения недоступна в этом окружении.',+ selectComponent: 'Выберите хотя бы один компонент для установки.',+ agentSuccess: name => `Плагин агента ${name} установлен`,+ desktopSuccess: name => `Плагин приложения ${name} установлен`,+ agentFailed: 'Не удалось установить плагин агента',+ installUncertain:+ 'Hermes перестал ждать результат установки, но плагин может всё ещё устанавливаться. Закройте это окно и обновите список плагинов перед повторной установкой.',+ desktopFailed: 'Не удалось установить плагин приложения',+ missingEnv: (_name, vars) => `Не хватает переменных окружения: ${vars}. Добавьте их в Настройки → Ключи.`,+ toolsConnected: n => `Подключено инструментов: ${n}`,+ skillsReady: names => (names.length === 1 ? `навык ${names[0]} готов` : `готово навыков: ${names.length}`),+ nextChat: 'остальные инструменты появятся в следующем чате',+ serverNotConnected: (server, reason) => `MCP-сервер ${server} не подключён${reason ? `: ${reason}` : '.'}`+ }+ }+} satisfies Pick<SettingsOverrides, 'pluginPages' | 'plugins'>diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 179711e3ad9..d0d6125dbc2 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -727,6 +727,9 @@ export interface Translations {resetConfirm: stringexportFailed: stringresetFailed: string+ pluginPages: Record<'agentSettings' | 'blurb' | 'empty' | 'manage' | 'missing', string> & {+ pageCount: (n: number) => string+ }nav: {providers: stringproviderAccounts: string@@ -745,21 +748,15 @@ export interface Translations {billing: stringnotifications: stringvault: string+ plugins: string}plugins: {title: string- blurb: string- count: (n: number) => stringopenFolder: stringrescan: stringreveal: string- enable: string- disable: stringfailed: string- empty: stringkinds: { bundled: string; disk: string; runtime: string }- agentHalfMissing: string- agentHalfMissingTip: stringinstallModal: {installFromGit: stringreviewRepository: stringdiff --git a/apps/desktop/src/i18n/zh-hant_settings.ts b/apps/desktop/src/i18n/zh-hant_settings.tsindex 4f323d14fb0..a58e426ec75 100644--- a/apps/desktop/src/i18n/zh-hant_settings.ts+++ b/apps/desktop/src/i18n/zh-hant_settings.ts@@ -86,6 +86,14 @@ export const zhHantSettings = {resetConfirm: '要將所有設定恢復為 Hermes 預設值嗎?',exportFailed: '匯出失敗',resetFailed: '重設失敗',+ pluginPages: {+ blurb: '已安裝外掛程式加入的選項。每個外掛程式都有自己的頁面,有些還有子頁面。',+ empty: '還沒有外掛程式提供設定。',+ manage: '管理外掛程式',+ agentSettings: '代理程式設定',+ pageCount: (n: number) => `${n} 個頁面`,+ missing: '這個外掛程式沒有設定頁面,可能已停用或解除安裝。'+ },nav: {providers: '提供方',providerAccounts: '帳號',@@ -103,7 +111,8 @@ export const zhHantSettings = {about: '關於',billing: '帳單',notifications: '通知',- vault: '密碼與登入'+ vault: '密碼與登入',+ plugins: '外掛程式'},vault: {title: '密碼與登入',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex c50721c5cf5..e5698d08b50 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -562,6 +562,14 @@ export const zh = defineLocale({resetConfirm: '将所有设置恢复为 Hermes 默认值?',exportFailed: '导出失败',resetFailed: '重置失败',+ pluginPages: {+ blurb: '已安装插件添加的选项。每个插件都有自己的页面,有些还带子页面。',+ empty: '还没有插件提供设置。',+ manage: '管理插件',+ agentSettings: '智能体设置',+ pageCount: (n: number) => `${n} 个页面`,+ missing: '该插件没有设置页面,可能已被禁用或卸载。'+ },nav: {providers: '提供方',providerAccounts: '账号',@@ -579,7 +587,8 @@ export const zh = defineLocale({about: '关于',billing: '账单',notifications: '通知',- vault: '密码与登录'+ vault: '密码与登录',+ plugins: '插件'},vault: {title: '密码与登录',@@ -655,20 +664,11 @@ export const zh = defineLocale({},plugins: {title: '桌面插件',- blurb:- '加载到此应用中的界面扩展——随构建捆绑,或放入 desktop-plugins 文件夹(包括 Hermes 编写的插件)。禁用会即时卸载插件并在重启后保持。',- count: n => `已安装 ${n} 个`,openFolder: '打开桌面插件文件夹',rescan: '重新扫描',reveal: '在文件管理器中显示',- enable: '启用',- disable: '禁用',failed: '失败',- empty: '尚未安装桌面插件。',kinds: { bundled: '内置', disk: '磁盘', runtime: '运行时' },- agentHalfMissing: '此处缺少 agent 部分',- agentHalfMissingTip:- '这是捆绑插件的桌面部分,但其 agent 部分未安装在当前连接的后端/配置上。请在 能力 → 插件 中安装。',installModal: {installFromGit: '从 Git 安装',reviewRepository: '检查仓库',diff --git a/apps/desktop/src/sdk/areas.ts b/apps/desktop/src/sdk/areas.tsnew file mode 100644index 00000000000..4b7fc4b4da5--- /dev/null+++ b/apps/desktop/src/sdk/areas.ts@@ -0,0 +1,10 @@+// Host-owned contribution areas with no feature module of their own; the SDK+// barrel re-exports them.++export const PANES_AREA = 'panes'+export const STATUSBAR_AREAS = { left: 'statusBar.left', right: 'statusBar.right' } as const+/** Titlebar slots are PERMANENT mount points: a component registered here+ * stays mounted across chat ↔ page navigation, so `useEffect` setup/cleanup+ * runs once per registration, not once per route. Page-owned controls that+ * should exist only while a page is up go to `WORKSPACE_PAGE_HEADER_AREA`. */+export const TITLEBAR_AREAS = { center: 'titleBar.center', left: 'titleBar.left', right: 'titleBar.right' } as constdiff --git a/apps/desktop/src/sdk/index.ts b/apps/desktop/src/sdk/index.tsindex 29900893e82..98e532ad965 100644--- a/apps/desktop/src/sdk/index.ts+++ b/apps/desktop/src/sdk/index.ts@@ -114,7 +114,8 @@ import { planPluginOpenSession } from './plugin-open-session-plan'import { sessionsHost } from './sessions'import { desktopSettings } from './settings'-export type { DesktopSettingKey, DesktopSettingValues } from './settings'+/** Pane, status bar and titlebar slots; see `./areas` for the mount rules. */+export { PANES_AREA, STATUSBAR_AREAS, TITLEBAR_AREAS } from './areas'// -- state: readonly views over the app's live atoms -------------------------@@ -1650,6 +1651,10 @@ export const host = {// -- react bridge -------------------------------------------------------------+export type { DesktopSettingKey, DesktopSettingValues } from './settings'++// -- ui: the design language --------------------------------------------------+/** THE whole Capabilities surface (Skills / Tools / MCP tabs, installed* lists, full-skill detail pane, embedded hub picker with one-click* installs). For plugin dialogs pass `embedded` (tab state stays local —@@ -1660,9 +1665,6 @@ export const host = {* builds without it would route the pin to the ACTIVE gateway. Bot Mode's* Advanced section is the reference consumer. */export { CapabilitiesView } from '@/app/capabilities'--// -- ui: the design language ---------------------------------------------------/** THE Connectors tab core Capabilities renders — managed apps, the user's* own MCP servers, plugin servers and the catalog, with per-server enable,* sign-in and live probes. Renders anywhere under the app router (a plugin@@ -1747,13 +1749,13 @@ export {type SidebarNavContribution,WORKSPACE_PAGE_HEADER_AREA} from '@/app/routes'+/** Appearance settings' plugin seam: register a render contribution at* `APPEARANCE_AREAS.extra` to add controls at the end of the Appearance page.* `ColorSwatches` is the app's own swatch grid (profile rail / project dialog* look) — use it for colour picking instead of driving app widgets through* React internals; pair it with `host.sessions.setColor` for session colours. */export { APPEARANCE_AREAS } from '@/app/settings/appearance-contrib'-/** THE settings rows: `ListRow` is label + description with the control beside* it (wide) or under it (narrow); `ToggleRow` is the one on/off row — a Switch,* never an Off/On pill pair. Use them for preference rows in plugin panes and@@ -1886,6 +1888,8 @@ export type {PluginNotificationAction,PluginOs,PluginRestOptions,+ PluginSettingsPage,+ PluginSettingsSubpage,PluginStorage} from '@/contrib/plugin'/** Mount-scoped contribution: while the rendering component is mounted, its@@ -1897,6 +1901,8 @@ export { Contribute, type ContributeProps } from '@/contrib/react/contribute'// -- contracts ----------------------------------------------------------------+/** Settings ▸ Plugins entries (`ctx.registerSettingsPage`); `pluginSettingsHref` deep-links one. */+export { pluginSettingsHref, SETTINGS_PLUGINS_AREA } from '@/contrib/settings-pages'export type { Contribution } from '@/contrib/types'/** The live gateway instance type — for typing the `gateway` prop `ConnectorsTab`* takes; obtain the instance from `host.getGateway()`. */@@ -1977,18 +1983,11 @@ export { PROFILE_SWATCHES, profileColor, profileColorSoft } from '@/lib/profile-* `ctx.socket` frame invalidating a query). Inside components keep using* `useQueryClient`. */export { queryClient } from '@/lib/query-client'+/** Compact labels for the reasoning levels exported from @hermes/shared, so a* plugin surfacing a thinking depth uses the same spelling as the app. */export { reasoningEffortLabel } from '@/lib/reasoning-effort'-export const PANES_AREA = 'panes'-export const STATUSBAR_AREAS = { left: 'statusBar.left', right: 'statusBar.right' } as const-/** Titlebar slots are PERMANENT mount points: a component registered here- * stays mounted across chat ↔ page navigation, so `useEffect` setup/cleanup- * runs once per registration, not once per route. Page-owned controls that- * should exist only while a page is up go to `WORKSPACE_PAGE_HEADER_AREA`. */-export const TITLEBAR_AREAS = { center: 'titleBar.center', left: 'titleBar.left', right: 'titleBar.right' } as const-/** The app's own gateway-readiness evaluation (setup.status +* setup.runtime_check, reconciled) — pass `host.request`. Don't hand-roll* readiness from raw RPC shapes. */