Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(desktop): transfer sandbox shortcuts to host focus
Josué560b53b4d6ed
diff --git a/desktop-app/src/__tests__/shortcutRouter.test.ts b/desktop-app/src/__tests__/shortcutRouter.test.tsindex ad441df64..df63e8b86 100644--- a/desktop-app/src/__tests__/shortcutRouter.test.ts+++ b/desktop-app/src/__tests__/shortcutRouter.test.ts@@ -21,6 +21,7 @@ function route(source: 'host' | 'sandbox' = 'host'): DesktopShortcutRoute {id: 1,isDestroyed: () => false,isFocused: () => source === 'host',+ focus: vi.fn(),on: vi.fn(),removeListener: vi.fn(),send: vi.fn(),@@ -35,6 +36,7 @@ function route(source: 'host' | 'sandbox' = 'host'): DesktopShortcutRoute {id: 2,isDestroyed: () => false,isFocused: () => true,+ focus: vi.fn(),on: vi.fn(),removeListener: vi.fn(),send: vi.fn(),@@ -50,6 +52,7 @@ describe('main-process Desktop shortcut routing', () => {const preventDefault = vi.fn()expect(routeDesktopShortcut(current, { preventDefault }, input())).toBe(true)expect(preventDefault).toHaveBeenCalledOnce()+ expect(current.trustedRenderer.focus).toHaveBeenCalledOnce()expect(current.trustedRenderer.send).toHaveBeenCalledWith('shortcuts:command', {commandId: 'search.open',source: 'sandbox',@@ -58,6 +61,7 @@ describe('main-process Desktop shortcut routing', () => {current.isCurrentSource = () => falseexpect(routeDesktopShortcut(current, { preventDefault }, input())).toBe(false)expect(current.trustedRenderer.send).toHaveBeenCalledTimes(1)+ expect(current.trustedRenderer.focus).toHaveBeenCalledTimes(1)})it('routes global and contextual search distinctly from sandbox focus', () => {diff --git a/desktop-app/src/shortcutRouter.ts b/desktop-app/src/shortcutRouter.tsindex 6fe81558b..3e6ec1504 100644--- a/desktop-app/src/shortcutRouter.ts+++ b/desktop-app/src/shortcutRouter.ts@@ -10,7 +10,7 @@ import {type ShortcutEvent = { preventDefault(): void }type ShortcutWebContents = Pick<WebContents,- 'id' | 'isDestroyed' | 'isFocused' | 'on' | 'removeListener' | 'send'+ 'focus' | 'id' | 'isDestroyed' | 'isFocused' | 'on' | 'removeListener' | 'send'>export type DesktopShortcutRoute = {@@ -41,6 +41,9 @@ export function routeDesktopShortcut()if (!command) return falseevent.preventDefault()+ if (route.source === 'sandbox' && !route.trustedRenderer.isFocused()) {+ route.trustedRenderer.focus()+ }route.trustedRenderer.send('shortcuts:command', {commandId: command.id,source: route.source,