Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
Merge branch 'feat/universal-tabs' into feat/evendrive-explorer
Diego Zacariasb1109f74f616
diff --cc desktop-app/ui/src/hooks/domain/__tests__/useNavigationController.test.tsindex b36f3cddc,f357facde..e69c869d5--- a/desktop-app/ui/src/hooks/domain/__tests__/useNavigationController.test.ts+++ b/desktop-app/ui/src/hooks/domain/__tests__/useNavigationController.test.ts@@@ -60,55 -65,40 +65,89 @@@ describe('useNavigationController — aexpect(result.current.lastActiveChatTabId).toBeNull()})+ it('openPreviewSection opens a preview tab and derives the preview route (spec 18)', () => {+ const { result } = renderHook(() => useNavigationController())+ act(() =>+ result.current.openPreviewSection({+ gfsUri: 'gfs://main/image-1',+ kind: 'image',+ mimeType: 'image/png',+ name: 'diagram.png',+ bytes: 3,+ })+ )+ expect(result.current.activeTab?.kind).toBe('preview')+ expect(result.current.activeTab?.title).toBe('diagram.png')+ expect(result.current.activeTab?.preview).toEqual({+ gfsUri: 'gfs://main/image-1',+ fileKind: 'image',+ mimeType: 'image/png',+ byteLength: 3,+ })+ expect(result.current.navItem).toBe(DESKTOP_ROUTES.preview)+ })++ it('openPreviewSection dedupes by gfsUri: re-opening the same file focuses its tab', () => {+ const { result } = renderHook(() => useNavigationController())+ act(() =>+ result.current.openPreviewSection({+ gfsUri: 'gfs://main/image-1',+ kind: 'image',+ mimeType: 'image/png',+ name: 'diagram.png',+ bytes: 3,+ })+ )+ const firstId = result.current.activeTab?.id+ // Navigate away, then re-open the same file: it focuses the existing tab.+ act(() => result.current.handleNavSelect(DESKTOP_ROUTES.files))+ act(() =>+ result.current.openPreviewSection({+ gfsUri: 'gfs://main/image-1',+ kind: 'image',+ mimeType: 'image/png',+ name: 'diagram.png',+ bytes: 3,+ })+ )+ expect(result.current.activeTab?.id).toBe(firstId)+ expect(result.current.workspaceTabs.tabs.filter(t => t.kind === 'preview')).toHaveLength(1)+ })++ it('resumes the last active chat, not the last chat by array order, on re-entry (§1, R4-B1)', () => {+ const { result } = renderHook(() => useNavigationController())+ // Build [blank chat, files, A, B] with all real store producers, then leave+ // A as the last active chat while B sits after it in array order.+ act(() => result.current.handleNavSelect(DESKTOP_ROUTES.files))+ act(() =>+ result.current.setWorkspaceTabs(state =>+ openChatTab(state, { id: 'chat-a', agentRef: 'alpha', chatId: 'c1' })+ )+ )+ act(() =>+ result.current.setWorkspaceTabs(state =>+ openChatTab(state, { id: 'chat-b', agentRef: 'beta', chatId: 'c2' })+ )+ )+ // Re-activate A so it is the LAST ACTIVE chat while B is the last by order.+ act(() => result.current.setWorkspaceTabs(state => selectWorkspaceTab(state, 'chat-a')))+ expect(result.current.lastActiveChatTabId).toBe('chat-a')++ // Leave the chat section for files (the "return to Chats later" scenario).+ act(() => result.current.setWorkspaceTabs(state => openFilesTab(state, { id: 'files-2' })))+ expect(result.current.activeTab?.kind).toBe('files')+ expect(result.current.lastActiveChatTabId).toBe('chat-a')++ // Re-entering Chats must resume A (the chat the user left), not B (the last+ // chat by array order that the pre-fix precedence would pick).+ let focused: { agentRef: string; chatId: string } | null = null+ act(() => {+ focused = result.current.handleNavSelect(DESKTOP_ROUTES.chat)+ })+ expect(result.current.activeTab?.id).toBe('chat-a')+ expect(focused).toEqual({ agentRef: 'alpha', chatId: 'c1' })+ })+it('no longer exposes the removed context/teams handlers or state', () => {const { result } = renderHook(() => useNavigationController())const controller = result.current as Record<string, unknown>