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
fix(rooms): mark Switch Console chats in the room list, and hide only those you are not in
raullopez-sandboxf1ecc705e685
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 d364544d4..7d5480d8b 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@@ -2900,6 +2900,7 @@ type RoomSummaryJson = {external_channel_url?: string | null;owner_id?: string | null;viewer_is_member?: boolean;+ is_console_chat?: boolean;archived: boolean;created_at: string;};@@ -2916,6 +2917,7 @@ function mapRoomSummary(r: RoomSummaryJson): RemoteRoomSummary {externalChannelUrl: r.external_channel_url ?? null,ownerId: r.owner_id ?? null,viewerIsMember: r.viewer_is_member ?? false,+ isConsoleChat: r.is_console_chat ?? false,archived: r.archived,createdAt: r.created_at,};diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.tsindex 28e9daffd..a96676a9d 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.ts@@ -103,6 +103,7 @@ describe('withConsoleGroupChats', () => {externalChannelUrl: null,ownerId: 'u',viewerIsMember: false,+ isConsoleChat: false,archived: false,createdAt: '',});diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.tsindex 2efab0f16..8afa65288 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.ts@@ -53,6 +53,7 @@ export function withConsoleGroupChats(// shortcut: a chat summary names no owner, so a chat-only row offers no delete; read it from the room detail if one is wanted.ownerId: null,viewerIsMember: true,+ isConsoleChat: true,archived: false,createdAt: chat.lastMessage?.sentAt ?? '',})@@ -73,17 +74,3 @@ export function allReadableRooms(if (more.length === 0) return yours;return [...yours, ...more].sort((a, b) => a.name.localeCompare(b.name));}--/**- * A Switch Console chat: unbridged, direct or private. Whether the user is in it- * is the chat list's to say, not the room list's `viewerIsMember`, which is also- * true for a room one of their agents is in.- */-export function isConsoleChatRoom(- room: Pick<RemoteRoomSummary, 'bridgeType' | 'channelType'>-): boolean {- return (- room.bridgeType === null &&- (room.channelType === 'direct' || room.channelType === 'channel_private')- );-}diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/rooms-by-messaging-app.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/rooms-by-messaging-app.test.tsindex 813190959..2db3554c2 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/rooms-by-messaging-app.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/rooms-by-messaging-app.test.ts@@ -13,6 +13,7 @@ const room = (id: string, bridgeType: string | null): RemoteRoomSummary => ({externalChannelUrl: null,ownerId: null,viewerIsMember: false,+ isConsoleChat: false,archived: false,createdAt: '',});diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.test.tsindex 3ee1fe633..2fa4cbed8 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-rooms-store.test.ts@@ -52,6 +52,7 @@ function room(id: string, ownerId: string | null, overrides: Partial<RemoteRoomSexternalChannelUrl: null,ownerId,viewerIsMember: false,+ isConsoleChat: false,archived: false,createdAt: '2026-01-01T00:00:00Z',...overrides,diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/use-listed-rooms.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/use-listed-rooms.tsindex 08bf70e10..63030ad48 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/use-listed-rooms.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/use-listed-rooms.ts@@ -3,7 +3,7 @@ import { chatsStore } from '@renderer/features/chats/stores/chats';import { workspacesStore } from '@renderer/features/workspaces/workspaces-store';import { useFeatureFlags } from '@renderer/lib/hooks/useFeatureFlags';import type { RemoteRoomSummary } from '@shared/core/switch-servers/switch-servers';-import { isConsoleChatRoom, isConsoleDirectChat, withConsoleGroupChats } from './room-filters';+import { isConsoleDirectChat, withConsoleGroupChats } from './room-filters';import { switchRoomsStore } from './switch-rooms-store';import { switchServersStore } from './switch-servers-store';@@ -22,14 +22,12 @@ function filterConsoleDirectChats(*/function withoutChatsYouAreNotIn(rooms: RemoteRoomSummary[],- serverId: string | null,- chatsOn: boolean+ serverId: string | null): RemoteRoomSummary[] {- if (!chatsOn) return rooms;const following = serverId !== null && chatsStore.serverId === serverId;return rooms.filter((room) =>- !isConsoleChatRoom(room) ||+ !room.isConsoleChat ||(following && (chatsStore.chats.has(room.id) || chatsStore.unlisted.has(room.id))));}@@ -47,8 +45,7 @@ export function useListedRoomsInActiveScope(): RemoteRoomSummary[] {withConsoleGroupChats(withoutChatsYouAreNotIn(filterConsoleDirectChats(switchRoomsStore.listedRoomsInActiveScope, flags.agent_chats),- serverId,- flags.agent_chats || flags.group_chats+ serverId),flags.agent_chats ? chatsStore.chats.values() : [])@@ -80,8 +77,7 @@ function useRoomsInWorkspace(return withConsoleGroupChats(withoutChatsYouAreNotIn(filterConsoleDirectChats(rooms(workspaceId), flags.agent_chats),- active ? serverId : null,- flags.agent_chats || flags.group_chats+ active ? serverId : null),flags.agent_chats && workspaceId === workspacesStore.activeId ? chatsStore.chats.values() : []);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 e3dee74cc..53517867e 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@@ -87,6 +87,7 @@ function room(id: string, extra: Partial<RemoteRoomSummary>): RemoteRoomSummaryexternalChannelUrl: null,ownerId: 'bob',viewerIsMember: false,+ isConsoleChat: false,archived: false,createdAt: '',...extra,@@ -110,11 +111,21 @@ function chat(id: string) {beforeEach(() => {rooms.list = observable({all: [- room('bobs-chat', { viewerIsMember: true, channelType: 'channel_private' }),- // The room list says "member" because the user's agent is in it; the user is not.- room('agent-only-chat', { viewerIsMember: true, channelType: 'channel_private' }),- room('strangers-chat', { channelType: 'channel_private' }),- room('public-room', { channelType: 'channel_public' }),+ room('bobs-chat', {+ viewerIsMember: true,+ channelType: 'channel_private',+ isConsoleChat: true,+ }),+ // The room list says "member" because the user's agent is in it; the user is not in the chat.+ room('agent-only-chat', {+ viewerIsMember: true,+ channelType: 'channel_private',+ isConsoleChat: true,+ }),+ // A private room made from YAML or a tool, not a chat: the usual rules apply.+ room('yaml-room', { viewerIsMember: true, channelType: 'channel_private' }),+ room('strangers-chat', { channelType: 'channel_private', isConsoleChat: true }),+ room('private-tool-room', { channelType: 'channel_private' }),room('public-slack', { bridgeType: 'slack', bridgeDisplayName: 'Slack' }),],});@@ -152,21 +163,27 @@ const toggle = (label: string) =>it('lists your rooms by default, and drops a chat once you are removed from it', async () => {await render();- expect(names()).toEqual(['bobs-chat']);+ expect(names()).toEqual(['bobs-chat', 'yaml-room']);await removeFromBobsChat();- expect(names()).toEqual([]);+ expect(names()).toEqual(['yaml-room']);});it('offers All rooms to someone who can read more: bridged rooms, never chats they are not in', async () => {await render();await act(async () => toggle('All rooms')!.click());- expect(names()).toEqual(['#public-slack', 'bobs-chat', 'public-room']);+ expect(names()).toEqual(['#public-slack', 'bobs-chat', 'private-tool-room', 'yaml-room']);await removeFromBobsChat();- expect(names()).toEqual(['#public-slack', 'public-room']);+ expect(names()).toEqual(['#public-slack', 'private-tool-room', 'yaml-room']);});it('offers no choice to someone who can read only their own rooms', async () => {- rooms.list.all = [room('bobs-chat', { viewerIsMember: true, channelType: 'channel_private' })];+ rooms.list.all = [+ room('bobs-chat', {+ viewerIsMember: true,+ channelType: 'channel_private',+ isConsoleChat: true,+ }),+ ];await render();expect(toggle('All rooms')).toBeUndefined();});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 1f440ad1b..d88d906c1 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@@ -333,6 +333,8 @@ export type RemoteRoomSummary = {ownerId: string | null;/** The signed-in user is a member of the room. False from a server that does not say. */viewerIsMember: boolean;+ /** A Switch Console chat: only its members can open it. False from a server that does not say. */+ isConsoleChat: boolean;archived: boolean;createdAt: string;};diff --git a/core/switch_core/gateway/rooms.py b/core/switch_core/gateway/rooms.pyindex ee7a69e81..c2684c55a 100644--- a/core/switch_core/gateway/rooms.py+++ b/core/switch_core/gateway/rooms.py@@ -391,6 +391,7 @@ async def list_rooms(created_at=str(room.created_at),archived=room.archived_at is not None,viewer_is_member=room.id in involved,+ is_console_chat="chat_operation_id" in (room.metadata_ or {}),))diff --git a/core/switch_core/gateway/schemas.py b/core/switch_core/gateway/schemas.pyindex e94eb0a7e..d647f1ce0 100644--- a/core/switch_core/gateway/schemas.py+++ b/core/switch_core/gateway/schemas.py@@ -88,6 +88,8 @@ class RoomSummary(BaseModel):# The caller owns the room, is in it (in Switch Console or through a# platform account they claimed), or owns an agent in it.viewer_is_member: bool = False+ # A Switch Console chat (made through the chats API): only its members can open it.+ is_console_chat: bool = Falseclass RoomDetail(RoomSummary):diff --git a/core/tests/switch_core/gateway/test_query_counts.py b/core/tests/switch_core/gateway/test_query_counts.pyindex f62bf0d84..529009cc2 100644--- a/core/tests/switch_core/gateway/test_query_counts.py+++ b/core/tests/switch_core/gateway/test_query_counts.py@@ -352,6 +352,40 @@ class TestRoomList:assert all(r["connected_user_count"] == 1 for r in bridged)assert all(not r["name"].startswith("Slack: ") for r in bridged)+ async def test_marks_switch_console_chats_and_no_other_room(+ self,+ session_factory: async_sessionmaker[AsyncSession],+ statement_counts: StatementCounts,+ pool_checkouts: PoolCheckouts,+ adapter: _Adapter,+ ) -> None:+ seed = _Seed(session_factory)+ user = await seed.admin()+ async with session_factory() as session:+ for name, metadata in (+ ("chat", {"chat_operation_id": "op-1"}),+ ("private-room", None),+ ):+ session.add(+ Room(+ transport_room_id=f"!{name}:test",+ name=name,+ description="d",+ channel_type="channel_private",+ metadata_=metadata,+ )+ )+ await session.commit()+ app = _app(session_factory, statement_counts, pool_checkouts)++ async with _client(app, user) as client:+ _, rooms = await _count(client, statement_counts, "/rooms")++ assert {r["name"]: r["is_console_chat"] for r in rooms} == {+ "chat": True,+ "private-room": False,+ }+async def test_the_platform_is_asked_for_deeplinks_holding_no_connection(self,session_factory: async_sessionmaker[AsyncSession],