The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): gate settings host checks by capability
Teknium5395d12976d8
diff --git a/apps/desktop/src/app/settings/gateway-settings.tsx b/apps/desktop/src/app/settings/gateway-settings.tsxindex b9862d8f5b1..1b285047216 100644--- a/apps/desktop/src/app/settings/gateway-settings.tsx+++ b/apps/desktop/src/app/settings/gateway-settings.tsx@@ -18,6 +18,7 @@ import type {import { useI18n } from '@/i18n'import { reestablishCloudAgentSession } from '@/lib/cloud-agent-session'import { ExternalLink } from '@/lib/external-link'+import { hostHas } from '@/lib/host-capabilities'import {AlertCircle,Check,@@ -31,7 +32,6 @@ import {RefreshCw,Terminal} from '@/lib/icons'-import { isBrowserHostedDesktop } from '@/lib/platform'import { coerceRemoteUrlScheme } from '@/lib/remote-url'import { selectableCardClass } from '@/lib/selectable-card'import { cn } from '@/lib/utils'@@ -177,7 +177,7 @@ interface GatewaySettingsProps {export function GatewaySettings({ embedded = false, subpage }: GatewaySettingsProps = {}) {useSettingDeepLink('gateway', page => subpage === undefined || page === subpage)- if (isBrowserHostedDesktop()) {+ if (!hostHas('gatewayManagement')) {return <WebappGatewaySettings embedded={embedded} />}diff --git a/apps/desktop/src/app/settings/other-subpages.ts b/apps/desktop/src/app/settings/other-subpages.tsindex ca4a1e25b34..f2532f7e43c 100644--- a/apps/desktop/src/app/settings/other-subpages.ts+++ b/apps/desktop/src/app/settings/other-subpages.ts@@ -1,10 +1,10 @@-import { isBrowserHostedDesktop } from '@/lib/platform'+import { hostHas } from '@/lib/host-capabilities'import type { SettingsSubpage } from './subpages'// Gateway tasks and search rows that only native Desktop can act on; the Webapp's// Gateways page is just its serving host (see WebappGatewaySettings).-export const nativeHostOnly = () => !isBrowserHostedDesktop()+export const nativeHostOnly = () => hostHas('gatewayManagement')// Pages with separate tasks expose content-only subpages. Billing keeps its// existing capability-gated bview=overview|plans flow rather than adding adiff --git a/apps/desktop/src/app/settings/sessions-settings.tsx b/apps/desktop/src/app/settings/sessions-settings.tsxindex 906ed2c7ebe..b302129e10f 100644--- a/apps/desktop/src/app/settings/sessions-settings.tsx+++ b/apps/desktop/src/app/settings/sessions-settings.tsx@@ -18,10 +18,10 @@ import { sessionTitle } from '@/lib/chat-runtime'import { selectDesktopPaths } from '@/lib/desktop-fs'import { pathLeaf } from '@/lib/display-path'import { triggerHaptic } from '@/lib/haptics'+import { hostHas } from '@/lib/host-capabilities'import { Archive, ArchiveOff, FolderOpen, Loader2, Trash2 } from '@/lib/icons'import { purgeInFlightTurnJournals } from '@/lib/inflight-turn-journal'import { formatCombo } from '@/lib/keybinds/combo'-import { isBrowserHostedDesktop } from '@/lib/platform'import { confirm } from '@/store/confirm'import { bindingsFor } from '@/store/keybinds'import { notify, notifyError } from '@/store/notifications'@@ -362,7 +362,7 @@ function DefaultProjectDirSetting() {// The folder on screen belongs to the profile this effect loaded. Drop it// on a switch so the next paint and the next save both use the profile// that is open now.- if (isBrowserHostedDesktop()) {+ if (hostHas('originScopedPrefs')) {setDir(null)}@@ -393,7 +393,7 @@ function DefaultProjectDirSetting() {try {// A browser tab has no native dialog for the server's disk: pick through the server// folder browser Projects already use.- const picked = isBrowserHostedDesktop()+ const picked = !hostHas('nativeFolderPicker')? { dir: (await selectDesktopPaths({ defaultPath: dir ?? undefined, directories: true }))[0] ?? null }: await settings.pickDefaultProjectDir()diff --git a/apps/desktop/src/app/settings/web-access-settings.tsx b/apps/desktop/src/app/settings/web-access-settings.tsxindex 1a93a42464b..5afe0bf72bb 100644--- a/apps/desktop/src/app/settings/web-access-settings.tsx+++ b/apps/desktop/src/app/settings/web-access-settings.tsx@@ -18,8 +18,8 @@ import {import { useI18n } from '@/i18n'import type { WebAccessTranslations } from '@/i18n/types_gateway_host'import { ExternalLink } from '@/lib/external-link'+import { hostHas } from '@/lib/host-capabilities'import { Globe, Loader2, Network } from '@/lib/icons'-import { isBrowserHostedDesktop } from '@/lib/platform'import { notify, notifyError } from '@/store/notifications'import { $connection } from '@/store/session'@@ -93,7 +93,7 @@ async function waitForRestart(): Promise<WebAccessStatus> {export function useWebAccessAvailable(): boolean {const connection = useStore($connection)- return !isBrowserHostedDesktop() && connection?.mode !== 'remote'+ return hostHas('webAccessHost') && connection?.mode !== 'remote'}export function WebAccessSettings(): ReactElement | null {