The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): gate browser shortcut defaults by capability
Tekniuma4392f1a3206
diff --git a/apps/desktop/src/lib/host-capabilities.test.ts b/apps/desktop/src/lib/host-capabilities.test.tsindex 9f12b04f5eb..03f5a1ee53b 100644--- a/apps/desktop/src/lib/host-capabilities.test.ts+++ b/apps/desktop/src/lib/host-capabilities.test.ts@@ -74,6 +74,7 @@ const CALL_SITES: [site: string, old: (browser: boolean) => boolean, now: () =>['lib/clipboard.ts:61', b => !b, () => hostHas('clipboardIpc')],['lib/desktop-fs.ts:48', b => b, () => !hostHas('nativeHostFiles')],['lib/external-link.tsx:272', b => b, () => !hostHas('inAppLinks')],+ ['lib/keybinds/actions.ts:31', b => !b, () => !hostHas('browserShortcutDefaults')],['lib/media.ts:125', b => !b, () => hostHas('nativeHostFiles')],['lib/media.ts:286', b => !b, () => hostHas('urlTokenAuth')],['store/browser-tab-title.ts:86', b => !b, () => !hostHas('tabTitleStatus')],diff --git a/apps/desktop/src/lib/host-capabilities.ts b/apps/desktop/src/lib/host-capabilities.tsindex 21aca5d1670..c7fd4c3982b 100644--- a/apps/desktop/src/lib/host-capabilities.ts+++ b/apps/desktop/src/lib/host-capabilities.ts@@ -21,6 +21,8 @@ export const HOST_CAPABILITIES = Object.freeze({appMouseHistoryButtons: 'native',/** The browser opens its own context menu, which the app menu must cancel or let through. */browserContextMenu: 'browser',+ /** Shortcuts whose native chord the browser takes first (new tab, close tab) default to another chord. */+ browserShortcutDefaults: 'browser',/** Writes go through Electron's clipboard IPC before `navigator.clipboard`. */clipboardIpc: 'native',/** Gateway connection management (switch, connect, recover) lives on this host. */diff --git a/apps/desktop/src/lib/keybinds/actions.ts b/apps/desktop/src/lib/keybinds/actions.tsindex 1486df7af69..67aaaedc519 100644--- a/apps/desktop/src/lib/keybinds/actions.ts+++ b/apps/desktop/src/lib/keybinds/actions.ts@@ -7,7 +7,8 @@import { registry } from '@/contrib/registry'import type { Contribution } from '@/contrib/types'-import { isBrowserHostedDesktop, isMacPlatform } from '@/lib/platform'+import { hostHas } from '@/lib/host-capabilities'+import { isMacPlatform } from '@/lib/platform'export type KeybindCategory = 'composer' | 'profiles' | 'session' | 'navigation' | 'view'@@ -28,7 +29,7 @@ interface BrowserChords {type HostDefaults = Pick<KeybindActionMeta, 'defaults' | 'editableTargetPolicy'>function hostDefaults(native: readonly string[], browser: BrowserChords): HostDefaults {- if (!isBrowserHostedDesktop()) {+ if (!hostHas('browserShortcutDefaults')) {return { defaults: native }}