Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
List archived rooms on Your Rooms, and open them
Simon Flack8cc0b04e67f0
diff --git a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.ts b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.tsindex f538c2764..5483a75ad 100644--- a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.ts+++ b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.ts@@ -3298,6 +3298,7 @@ type RoomSummaryJson = {is_console_chat?: boolean;archived: boolean;created_at: string;+ write_visibility?: string;};function mapRoomSummary(r: RoomSummaryJson): RemoteRoomSummary {@@ -3315,6 +3316,9 @@ function mapRoomSummary(r: RoomSummaryJson): RemoteRoomSummary {isConsoleChat: r.is_console_chat ?? false,archived: r.archived,createdAt: r.created_at,+ ...(r.write_visibility !== undefined+ ? { writeVisibility: visibilityOf(r.write_visibility) }+ : {}),};}@@ -3335,7 +3339,6 @@ type RoomDetailJson = RoomSummaryJson & {channel_on_delete?: ChannelRetirement | null;linked_channel_name?: string | null;read_visibility?: string;- write_visibility?: string;group_id?: string | null;group_name?: string | null;owner_name?: string | null;diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-rooms-view.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-rooms-view.tsxindex dc15e68ce..d49de6e58 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-rooms-view.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-rooms-view.tsx@@ -1,3 +1,4 @@+import { useQuery, useQueryClient } from '@tanstack/react-query';import { ChevronDown, DoorOpen, MessagesSquare, Plus } from 'lucide-react';import { observer } from 'mobx-react-lite';import { useEffect, useState } from 'react';@@ -14,6 +15,7 @@ import { AgentAvatar } from '@renderer/lib/components/agent-avatar';import { BridgeIcon, hasBridgeIcon } from '@renderer/lib/components/bridge-icon';import { failureText } from '@renderer/lib/errors/describe-failure';import { toast } from '@renderer/lib/hooks/use-toast';+import { rpc } from '@renderer/lib/ipc';import { useParams } from '@renderer/lib/layout/navigation-provider';import { useShowModal } from '@renderer/lib/modal/modal-provider';import { useWorkspaceAgents } from '@renderer/lib/stores/use-workspace-agents';@@ -69,6 +71,31 @@ const ServerRoomsPanel = observer(function ServerRoomsPanel() {.filter((chat) => query === '' || chat.name.toLowerCase().includes(query)).sort((a, b) => a.name.localeCompare(b.name)): [];+ // Archived rooms in a messaging app; archived group chats come from the chats list above.+ const queryClient = useQueryClient();+ const archivedRoomsQuery = useQuery({+ queryKey: ['archived-rooms', workspaceId],+ queryFn: async () => {+ const found = await rpc.workspaces.listArchivedRooms({ workspaceId: workspaceId as string });+ switchRoomsStore.noteRooms(workspaceId as string, found);+ return found.filter((room) => !room.isConsoleChat);+ },+ enabled: workspaceId !== null && !signedOut,+ });+ const archivedRooms = (archivedRoomsQuery.data ?? [])+ .filter((room) => query === '' || room.name.toLowerCase().includes(query))+ .sort((a, b) => a.name.localeCompare(b.name));+ async function unarchiveRoom(room: RemoteRoomSummary) {+ if (workspaceId === null) return;+ try {+ await rpc.workspaces.setRoomArchived({ workspaceId, roomId: room.id, archived: false });+ await queryClient.invalidateQueries({ queryKey: ['archived-rooms', workspaceId] });+ await switchRoomsStore.refreshRoomState();+ void refreshSidebarRoomState(true);+ } catch (error) {+ toast({ title: failureText(error, 'Could not unarchive the room.'), variant: 'destructive' });+ }+ }return (<ServerPage@@ -152,10 +179,37 @@ const ServerRoomsPanel = observer(function ServerRoomsPanel() {)))}<ArchivedFold- count={archived.length}- error={chatsStore.serverId === serverId ? chatsStore.archivedError : null}+ count={archived.length + archivedRooms.length}+ error={+ (chatsStore.serverId === serverId ? chatsStore.archivedError : null) ??+ (archivedRoomsQuery.isError+ ? failureText(archivedRoomsQuery.error, 'Could not list the archived rooms.')+ : null)+ }><div className="divide-y divide-border overflow-hidden rounded-[10px] border border-border">+ {archivedRooms.map((room) => (+ <div key={room.id} className="flex items-center gap-3 bg-background px-4 py-3">+ {hasBridgeIcon(room.bridgeType) ? (+ <BridgeIcon bridgeType={room.bridgeType} size={16} className="shrink-0" />+ ) : (+ <DoorOpen className="size-4 shrink-0 text-foreground-muted" />+ )}+ <button+ type="button"+ onClick={() => void openRoom(room.id)}+ className="min-w-0 flex-1 cursor-pointer truncate text-left text-sm font-medium text-foreground hover:underline"+ >+ {roomTitle(room)}+ </button>+ {workspaceId !== null &&+ switchRoomsStore.roomPermissions(workspaceId, room).canWrite && (+ <Button size="sm" variant="outline" onClick={() => void unarchiveRoom(room)}>+ Unarchive+ </Button>+ )}+ </div>+ ))}{archived.map((chat) => (<div key={chat.roomId} className="flex items-center gap-3 bg-background px-4 py-3"><buttondiff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.tsindex 18c6ff949..8f77832c8 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.ts@@ -120,6 +120,20 @@ export class SwitchRoomsStore {return this.channelUrlByRoom.get(roomId) ?? null;}+ /**+ * Remember rooms read outside the room list — archived ones, which the list+ * leaves out — so a room page opened on one can still say where it lives and+ * address calls about it. They are not added to any list.+ */+ noteRooms(workspaceId: string, rooms: RemoteRoomSummary[]): void {+ for (const room of rooms) {+ this.roomNames.set(room.id, room.name);+ this.roomWorkspaceById.set(room.id, workspaceId);+ if (room.bridgeType) this.bridgeTypeByRoom.set(room.id, room.bridgeType);+ if (room.externalChannelUrl) this.channelUrlByRoom.set(room.id, room.externalChannelUrl);+ }+ }+/** Id of the workspace a room belongs to, or null if not yet loaded. This is* what a call about the room is addressed with. */roomWorkspaceId(roomId: string): string | null {diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/your-rooms-view.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/your-rooms-view.test.tsxindex 70e3d2c5e..c3f0ad800 100644--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/your-rooms-view.test.tsx+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/your-rooms-view.test.tsx@@ -1,9 +1,10 @@-import { observable, runInAction } from 'mobx';/*** Your Rooms lists the rooms the sidebar lists. Someone who can read more (an* admin, or public rooms) can switch to All rooms, which never offers a Switch* Console chat they are not in: the server would not open it.*/+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';+import { observable, runInAction } from 'mobx';import { act } from 'react';import { createRoot, type Root } from 'react-dom/client';import { afterEach, beforeEach, expect, it, vi } from 'vitest';@@ -18,8 +19,13 @@ vi.hoisted(() => {});const rooms = vi.hoisted(() => ({ list: null as unknown as { all: RemoteRoomSummary[] } }));+const archivedRooms = vi.hoisted(() => ({ list: [] as RemoteRoomSummary[] }));+const setRoomArchived = vi.hoisted(() => vi.fn(async () => ({})));-vi.mock('@renderer/lib/ipc', () => ({ events: { on: () => () => {} }, rpc: {} }));+vi.mock('@renderer/lib/ipc', () => ({+ events: { on: () => () => {} },+ rpc: { workspaces: { listArchivedRooms: async () => archivedRooms.list, setRoomArchived } },+}));vi.mock('@renderer/lib/layout/navigation-provider', () => ({useParams: () => ({ params: { serverId: 'srv' } }),}));@@ -71,6 +77,9 @@ vi.mock('@renderer/features/switch-servers/switch-rooms-store', () => ({listedRoomsInWorkspace: () =>rooms.list.all.filter((room) => room.ownerId === 'me' || room.viewerIsMember),readableRoomsInWorkspace: () => rooms.list.all,+ noteRooms: () => {},+ roomPermissions: () => ({ canWrite: true, canManage: false }),+ refreshRoomState: async () => {},},}));@@ -111,6 +120,8 @@ function chat(id: string) {}beforeEach(() => {+ archivedRooms.list = [];+ setRoomArchived.mockClear();rooms.list = observable({all: [room('bobs-chat', {@@ -155,7 +166,14 @@ async function render(): Promise<void> {document.body.appendChild(container);root = createRoot(container);const Panel = serverRoomsView.MainPanel;- await act(async () => root.render(<Panel />));+ const client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });+ await act(async () =>+ root.render(+ <QueryClientProvider client={client}>+ <Panel />+ </QueryClientProvider>+ )+ );}const names = () =>@@ -189,3 +207,23 @@ it('offers no choice to someone who can read only their own rooms', async () =>await render();expect(toggle('All rooms')).toBeUndefined();});++it('lists archived rooms under Archived, and brings one back', async () => {+ archivedRooms.list = [+ room('old-slack', { bridgeType: 'slack', bridgeDisplayName: 'Slack', archived: true }),+ ];+ await render();+ for (let i = 0; i < 4; i++) await act(async () => await Promise.resolve());+ const fold = [...container.querySelectorAll('button')].find((b) =>+ /^Archived/.test(b.textContent ?? '')+ );+ expect(fold?.textContent).toBe('Archived (1)');+ await act(async () => fold!.click());+ expect(container.textContent).toContain('#old-slack');+ await act(async () => toggle('Unarchive')!.click());+ expect(setRoomArchived).toHaveBeenCalledWith({+ workspaceId: 'ws',+ roomId: 'old-slack',+ archived: false,+ });+});diff --git a/console/apps/switch-console-desktop/src/shared/core/switch-servers/switch-servers.ts b/console/apps/switch-console-desktop/src/shared/core/switch-servers/switch-servers.tsindex 3c0bc8509..ebf9d8fa6 100644--- a/console/apps/switch-console-desktop/src/shared/core/switch-servers/switch-servers.ts+++ b/console/apps/switch-console-desktop/src/shared/core/switch-servers/switch-servers.ts@@ -360,6 +360,8 @@ export type RemoteRoomSummary = {isConsoleChat: boolean;archived: boolean;createdAt: string;+ /** Who may write to the room, when the server says (see `RoomDetail`); absent from an older server. */+ writeVisibility?: RoomVisibility;};/**