Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(desktop): add core command palette actions
Josuéf89fb18a9bcf
diff --git a/desktop-app/src/__tests__/desktopCommands.test.ts b/desktop-app/src/__tests__/desktopCommands.test.tsindex fba1430c7..d0341c75a 100644--- a/desktop-app/src/__tests__/desktopCommands.test.ts+++ b/desktop-app/src/__tests__/desktopCommands.test.ts@@ -79,6 +79,23 @@ describe('Desktop command registry', () => {).toBe('search.current')})+ it('binds only Open Settings in the approved core palette action set', () => {+ const settings = getDesktopCommand('settings.open')+ expect(formatDesktopShortcut(settings.defaultBinding!, 'darwin')).toBe('⌘,')+ expect(formatDesktopShortcut(settings.defaultBinding!, 'win32')).toBe('Ctrl+,')+ expect(matchDesktopCommand(input({ key: ',' }), 'darwin', 'sandbox')?.id).toBe('settings.open')+ for (const id of [+ 'auth.logout',+ 'navigate.chat',+ 'navigate.apps',+ 'navigate.agents',+ 'notifications.open',+ ] as const) {+ expect(getDesktopCommand(id).defaultBinding).toBeNull()+ expect(getDesktopCommand(id).visibleInSettings).toBe(false)+ }+ })+it('ignores repeat, composition, AltGr-like input, and wrong platform modifiers', () => {expect(matchDesktopCommand(input({ isAutoRepeat: true }), 'darwin', 'host')).toBeNull()expect(matchDesktopCommand(input({ isComposing: true }), 'darwin', 'host')).toBeNull()diff --git a/desktop-app/src/desktopCommands.ts b/desktop-app/src/desktopCommands.tsindex aaa1c80e6..72cbbfed7 100644--- a/desktop-app/src/desktopCommands.ts+++ b/desktop-app/src/desktopCommands.ts@@ -1,6 +1,12 @@export type DesktopShortcutPlatform = 'darwin' | 'win32' | 'linux'export type DesktopCommandSource = 'host' | 'sandbox'-export type DesktopCommandGroup = 'Chat' | 'Navigation' | 'Search' | 'Commands'+export type DesktopCommandGroup =+ | 'Chat'+ | 'Navigation'+ | 'Search'+ | 'Commands'+ | 'Workspace'+ | 'Account'export type DesktopCommandEligibility =| 'always'| 'tab-exists'@@ -209,12 +215,27 @@ const definitions = [visibleInPalette: true,visibleInSettings: true,},+ {+ id: 'settings.open',+ label: 'Open Settings',+ description: 'Open Desktop settings.',+ group: 'Workspace',+ order: 110,+ defaultBinding: { key: ',', modifier: 'mod' },+ sources: ['host', 'sandbox'],+ eligibility: 'always',+ editingPolicy: 'allow',+ modalPolicy: 'block',+ actionOwner: 'renderer',+ visibleInPalette: true,+ visibleInSettings: true,+ },{id: 'settings.shortcuts',label: 'Keyboard shortcuts',description: 'Open the read-only keyboard shortcuts reference.',group: 'Commands',- order: 110,+ order: 120,defaultBinding: null,sources: ['host', 'sandbox'],eligibility: 'always',@@ -224,6 +245,81 @@ const definitions = [visibleInPalette: true,visibleInSettings: false,},+ {+ id: 'auth.logout',+ label: 'Log out',+ description: 'Log out of the current Desktop session.',+ group: 'Account',+ order: 130,+ defaultBinding: null,+ sources: ['host', 'sandbox'],+ eligibility: 'always',+ editingPolicy: 'suppress',+ modalPolicy: 'block',+ actionOwner: 'renderer',+ visibleInPalette: true,+ visibleInSettings: false,+ },+ {+ id: 'navigate.chat',+ label: 'Go to Chat',+ description: 'Open the Chat workspace.',+ group: 'Navigation',+ order: 140,+ defaultBinding: null,+ sources: ['host', 'sandbox'],+ eligibility: 'always',+ editingPolicy: 'suppress',+ modalPolicy: 'block',+ actionOwner: 'renderer',+ visibleInPalette: true,+ visibleInSettings: false,+ },+ {+ id: 'navigate.apps',+ label: 'Go to Apps',+ description: 'Open the Apps workspace.',+ group: 'Navigation',+ order: 150,+ defaultBinding: null,+ sources: ['host', 'sandbox'],+ eligibility: 'always',+ editingPolicy: 'suppress',+ modalPolicy: 'block',+ actionOwner: 'renderer',+ visibleInPalette: true,+ visibleInSettings: false,+ },+ {+ id: 'navigate.agents',+ label: 'Go to Agents',+ description: 'Open the Agents workspace.',+ group: 'Navigation',+ order: 160,+ defaultBinding: null,+ sources: ['host', 'sandbox'],+ eligibility: 'always',+ editingPolicy: 'suppress',+ modalPolicy: 'block',+ actionOwner: 'renderer',+ visibleInPalette: true,+ visibleInSettings: false,+ },+ {+ id: 'notifications.open',+ label: 'Open notifications and approvals',+ description: 'Open the existing notifications and approvals tray.',+ group: 'Workspace',+ order: 170,+ defaultBinding: null,+ sources: ['host', 'sandbox'],+ eligibility: 'always',+ editingPolicy: 'suppress',+ modalPolicy: 'block',+ actionOwner: 'renderer',+ visibleInPalette: true,+ visibleInSettings: false,+ },] as const satisfies readonly DesktopCommandDefinition[]export type DesktopCommandId = (typeof definitions)[number]['id']diff --git a/desktop-app/src/preload.ts b/desktop-app/src/preload.tsindex d761e70ad..b7d45e549 100644--- a/desktop-app/src/preload.ts+++ b/desktop-app/src/preload.ts@@ -29,6 +29,12 @@ const DESKTOP_COMMAND_IDS = new Set<DesktopCommandId>(['composer.focus','commands.open','settings.shortcuts',+ 'settings.open',+ 'auth.logout',+ 'navigate.chat',+ 'navigate.apps',+ 'navigate.agents',+ 'notifications.open',])function isDesktopCommandId(value: unknown): value is DesktopCommandId {diff --git a/desktop-app/ui/src/App.tsx b/desktop-app/ui/src/App.tsxindex 28391ff8f..8ebcd5c92 100644--- a/desktop-app/ui/src/App.tsx+++ b/desktop-app/ui/src/App.tsx@@ -269,6 +269,7 @@ export function App() {const chatViewTabsRef = React.useRef(chatViewTabs)const [composerFocusRequestId, setComposerFocusRequestId] = React.useState(0)const [globalSearchFocusRequestId, setGlobalSearchFocusRequestId] = React.useState(0)+ const [notificationOpenRequestId, setNotificationOpenRequestId] = React.useState(0)const [chatLocalSearchOpen, setChatLocalSearchOpen] = React.useState(false)const [chatLocalSearchState, setChatLocalSearchState] = React.useState<{query: string@@ -1142,6 +1143,33 @@ export function App() {setSettingsShortcutsRequestId(value => value + 1)return}+ if (commandId === 'settings.open') {+ closeChatLocalSearch(false)+ handleSidebarNavSelect(DESKTOP_ROUTES.settings)+ return+ }+ if (commandId === 'auth.logout') {+ void vm.handleLogout()+ return+ }+ if (+ commandId === 'navigate.chat' ||+ commandId === 'navigate.apps' ||+ commandId === 'navigate.agents'+ ) {+ const route =+ commandId === 'navigate.chat'+ ? DESKTOP_ROUTES.chat+ : commandId === 'navigate.apps'+ ? DESKTOP_ROUTES.apps+ : DESKTOP_ROUTES.agents+ handleSidebarNavSelect(route)+ return+ }+ if (commandId === 'notifications.open') {+ setNotificationOpenRequestId(value => value + 1)+ return+ }if (commandId === 'chat.newTab') {closeChatLocalSearch(false)handleNewChatViewTab()@@ -1202,9 +1230,11 @@ export function App() {desktopCommandContext,handleCloseChatViewTab,handleNewChatViewTab,+ handleSidebarNavSelect,revealChatViewTab,vm.activeChatId,vm.handleNavSelect,+ vm.handleLogout,vm.isAuthenticated,vm.navItem,]@@ -1713,6 +1743,7 @@ export function App() {><AppHeadersearchFocusRequestId={globalSearchFocusRequestId}+ notificationOpenRequestId={notificationOpenRequestId}notificationTrayMode={notificationTrayUsesDrawer ? 'drawer' : 'overlay'}diff --git a/desktop-app/ui/src/__tests__/App.deepLinks.test.tsx b/desktop-app/ui/src/__tests__/App.deepLinks.test.tsxindex 31314fa22..bacaef7ea 100644--- a/desktop-app/ui/src/__tests__/App.deepLinks.test.tsx+++ b/desktop-app/ui/src/__tests__/App.deepLinks.test.tsx@@ -17,7 +17,7 @@ const confirmDialogHarness = vi.hoisted(() => ({}))const appHeaderHarness = vi.hoisted(() => ({- props: null as null | { searchFocusRequestId?: number },+ props: null as null | { searchFocusRequestId?: number; notificationOpenRequestId?: number },}))const chatLocalSearchHarness = vi.hoisted(() => ({ rendered: vi.fn() }))@@ -180,6 +180,7 @@ function makeController(overrides: Partial<AppController> = {}): AppController {getCurrentTeamId: vi.fn(() => liveTeamId),handleSelectChatAgent: vi.fn(),handleNavSelect,+ handleLogout: vi.fn(),pushToast: vi.fn(),setStatus: noop,setBooting: noop,@@ -369,6 +370,27 @@ describe('App deep-link orchestration', () => {expect(settingsPageHarness.props?.shortcutsFocusRequestId).toBe(1)})+ it('routes approved core palette actions through their existing owners', () => {+ currentController = makeController({ initialExperienceLoading: false })+ render(<App />)+ act(() => emitCommand?.('commands.open'))++ act(() => commandPaletteHarness.props?.onExecute('settings.open'))+ expect(currentController.handleNavSelect).toHaveBeenLastCalledWith(DESKTOP_ROUTES.settings)++ act(() => commandPaletteHarness.props?.onExecute('navigate.chat'))+ expect(currentController.handleNavSelect).toHaveBeenLastCalledWith(DESKTOP_ROUTES.chat)+ act(() => commandPaletteHarness.props?.onExecute('navigate.apps'))+ expect(currentController.handleNavSelect).toHaveBeenLastCalledWith(DESKTOP_ROUTES.apps)+ act(() => commandPaletteHarness.props?.onExecute('navigate.agents'))+ expect(currentController.handleNavSelect).toHaveBeenLastCalledWith(DESKTOP_ROUTES.agents)++ act(() => commandPaletteHarness.props?.onExecute('notifications.open'))+ expect(appHeaderHarness.props?.notificationOpenRequestId).toBe(1)+ act(() => commandPaletteHarness.props?.onExecute('auth.logout'))+ expect(currentController.handleLogout).toHaveBeenCalledOnce()+ })+afterEach(() => {vi.useRealTimers()})diff --git a/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsx b/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsxindex 57c7ae466..6e6a6b880 100644--- a/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsx+++ b/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsx@@ -97,6 +97,15 @@ describe('AppHeader notification tray presentation', () => {expect(screen.queryByRole('dialog', { name: 'Notifications and approvals' })).toBeNull()})+ it('opens through the controlled command request and preserves tray lifecycle', async () => {+ const { rerender } = render(<AppHeader notificationOpenRequestId={0} />)++ rerender(<AppHeader notificationOpenRequestId={1} />)++ expect(screen.getByRole('dialog', { name: 'Notifications and approvals' })).toBeTruthy()+ await waitFor(() => expect(notificationMocks.refresh).toHaveBeenCalledOnce())+ })+it('opens a clickable notification card with the keyboard', () => {const notification = {id: 'notification-1',diff --git a/desktop-app/ui/src/components/AppHeader/index.tsx b/desktop-app/ui/src/components/AppHeader/index.tsxindex 3f85079c1..4b280b420 100644--- a/desktop-app/ui/src/components/AppHeader/index.tsx+++ b/desktop-app/ui/src/components/AppHeader/index.tsx@@ -84,6 +84,7 @@ function notificationPillLabel(kind: AppNotificationKind): string {export const AppHeader = React.memo(function AppHeader({searchFocusRequestId = 0,+ notificationOpenRequestId = 0,notificationTrayMode = 'overlay',notificationTrayReady = true,onNotificationTrayOpenChange,@@ -161,6 +162,12 @@ export const AppHeader = React.memo(function AppHeader({searchInputRef.current?.focus()}, [searchFocusRequestId])+ useEffect(() => {+ if (notificationOpenRequestId <= 0) return+ setSearchOpen(false)+ setNotificationsOpen(true)+ }, [notificationOpenRequestId])+React.useLayoutEffect(() => {onShellOverlayOpenChange?.(searchOpen || (notificationsOpen && !notificationTrayUsesDrawer))onNotificationTrayOpenChange?.(notificationsOpen)diff --git a/desktop-app/ui/src/components/AppHeader/types.ts b/desktop-app/ui/src/components/AppHeader/types.tsindex 59dcda261..47319ca9c 100644--- a/desktop-app/ui/src/components/AppHeader/types.ts+++ b/desktop-app/ui/src/components/AppHeader/types.ts@@ -1,5 +1,6 @@export type AppHeaderProps = {searchFocusRequestId?: number+ notificationOpenRequestId?: numbernotificationTrayMode?: 'overlay' | 'drawer'notificationTrayReady?: booleanonNotificationTrayOpenChange?: (open: boolean) => void