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
Move the room member pieces to their own module
Simon Flackae1bafae3040
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsxindex f155ec43d..57ce606e6 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx@@ -17,7 +17,6 @@ import { confirmLeaveChat } from '@renderer/features/chats/components/chat-actioimport { opensAsConsoleChat } from '@renderer/features/chats/console-chat-redirect';import { chatFailure } from '@renderer/features/chats/stores/chat-errors';import { chatsStore } from '@renderer/features/chats/stores/chats';-import { agentsStore } from '@renderer/features/locations/stores/agents-store';import { refreshSidebarRoomState } from '@renderer/features/sidebar/sidebar-tree-data';import { isConsoleGroupChatSummary } from '@renderer/features/switch-servers/room-filters';import type { RoomPermissions } from '@renderer/features/switch-servers/room-permissions';@@ -50,22 +49,23 @@ import {import { Switch } from '@renderer/lib/ui/switch';import { Textarea } from '@renderer/lib/ui/textarea';import { cn } from '@renderer/utils/utils';-import { agentInitials } from '@shared/core/agents/agent-avatar';import { type ChatSummary, chatAgentLabel } from '@shared/core/chats/chats';-import {- knownAgentTypeDisplayName,- providerDisplayName,-} from '@shared/core/providers/agent-provider-registry';+import { knownAgentTypeDisplayName } from '@shared/core/providers/agent-provider-registry';import { runsOnThisComputer } from '@shared/core/switch-servers/switch-servers';-import type {- RemoteAgentSummary,- RemoteRoomDetail,-} from '@shared/core/switch-servers/switch-servers';+import type { RemoteRoomDetail } from '@shared/core/switch-servers/switch-servers';import { administersWorkspace } from '@shared/core/workspaces/workspaces';import { roomAgentPresence } from './room-agent-presence';import { channelOnDeleteSummary } from './room-delete-wording';import { addableAgents, addablePeople, membershipSummary, roomTitle } from './room-labels';import { openRoomChannel } from './room-links';+import {+ AgentMark,+ agentKindFor,+ agentNameFor,+ localAgentFor,+ PersonMark,+ roomDetailKey,+} from './room-participants';import {AccessAndGroupFields,ArchiveRoomSection,@@ -73,12 +73,6 @@ import {RoomInfoSection,} from './room-settings-sections';-/** Query key for one room's own settings — shared so a save can write the- * server's answer straight back into what the page is reading. */-export function roomDetailKey(workspaceId: string, roomId: string) {- return ['remote-room-detail', workspaceId, roomId] as const;-}-/** One room read from its server; `workspaceId` is null until the room list has loaded. */function useRoomDetail(roomId: string) {const workspaceId = switchRoomsStore.roomWorkspaceId(roomId);@@ -1232,20 +1226,6 @@ const ParticipantList = observer(function ParticipantList({);});-/** A person's initials disc: people have no picture in Switch. */-export function PersonMark({ name, size }: { name: string; size: 'sm' | 'md' }) {- return (- <span- className={cn(- 'flex shrink-0 items-center justify-center rounded-full bg-[var(--fill-2)] font-medium text-foreground',- size === 'md' ? 'size-7 text-xs' : 'size-[22px] text-[10px]'- )}- >- {agentInitials(name)}- </span>- );-}-function ParticipantCard({mark,name,@@ -1475,60 +1455,3 @@ function PanelNotice({</div>);}--/** An agent's own picture, beside the human participants' initials discs. */-export function AgentMark({- agentId,- workspaceId,- remoteById,-}: {- agentId: string;- workspaceId: string | null;- remoteById: Map<string, RemoteAgentSummary>;-}) {- const remote = remoteById.get(agentId) ?? null;- return (- <span className="flex size-7 shrink-0 items-center justify-center">- <AgentAvatar- name={agentNameFor(agentId, workspaceId, remoteById)}- iconUrl={remote?.iconUrl ?? null}- serverId={workspaceId && workspacesStore.serverIdFor(workspaceId)}- size={26}- />- </span>- );-}--/** This install's record of a Switch agent, which is where its provider is- * known — the server says what type an agent is, not what runs it here. */-function localAgentFor(switchAgentId: string, workspaceId: string | null) {- if (workspaceId === null) return null;- return (- agentsStore.agentsInWorkspace(workspaceId).find((a) => a.switchAgentId === switchAgentId) ??- null- );-}--export function agentNameFor(- switchAgentId: string,- workspaceId: string | null,- remoteById: Map<string, RemoteAgentSummary>-): string {- return (- localAgentFor(switchAgentId, workspaceId)?.name ??- remoteById.get(switchAgentId)?.name ??- 'Agent'- );-}--/** What an agent runs, in words: this install's provider when it has one,- * otherwise the type the server knows it by. */-function agentKindFor(- switchAgentId: string,- workspaceId: string | null,- remoteById: Map<string, RemoteAgentSummary>-): string {- const providerId = localAgentFor(switchAgentId, workspaceId)?.providerId ?? null;- const knownType = remoteById.get(switchAgentId)?.knownAgentType ?? null;- return providerDisplayName(providerId) ?? knownAgentTypeDisplayName(knownType) ?? 'agent';-}diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-participants.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-participants.tsxnew file mode 100644index 000000000..0223e2aa6--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-participants.tsx@@ -0,0 +1,92 @@+import { agentsStore } from '@renderer/features/locations/stores/agents-store';+import { workspacesStore } from '@renderer/features/workspaces/workspaces-store';+import { AgentAvatar } from '@renderer/lib/components/agent-avatar';+import { cn } from '@renderer/utils/utils';+import { agentInitials } from '@shared/core/agents/agent-avatar';+import {+ knownAgentTypeDisplayName,+ providerDisplayName,+} from '@shared/core/providers/agent-provider-registry';+import type { RemoteAgentSummary } from '@shared/core/switch-servers/switch-servers';++/*+ * The pieces a room's members are drawn with, shared by the room's side panel+ * and its settings page.+ */++/** Query key for one room's own settings — shared so a save can write the+ * server's answer straight back into what the page is reading. */+export function roomDetailKey(workspaceId: string, roomId: string) {+ return ['remote-room-detail', workspaceId, roomId] as const;+}++/** A person's initials disc: people have no picture in Switch. */+export function PersonMark({ name, size }: { name: string; size: 'sm' | 'md' }) {+ return (+ <span+ className={cn(+ 'flex shrink-0 items-center justify-center rounded-full bg-[var(--fill-2)] font-medium text-foreground',+ size === 'md' ? 'size-7 text-xs' : 'size-[22px] text-[10px]'+ )}+ >+ {agentInitials(name)}+ </span>+ );+}++/** An agent's own picture, beside the human participants' initials discs. */+export function AgentMark({+ agentId,+ workspaceId,+ remoteById,+}: {+ agentId: string;+ workspaceId: string | null;+ remoteById: Map<string, RemoteAgentSummary>;+}) {+ const remote = remoteById.get(agentId) ?? null;+ return (+ <span className="flex size-7 shrink-0 items-center justify-center">+ <AgentAvatar+ name={agentNameFor(agentId, workspaceId, remoteById)}+ iconUrl={remote?.iconUrl ?? null}+ serverId={workspaceId && workspacesStore.serverIdFor(workspaceId)}+ size={26}+ />+ </span>+ );+}++/** This install's record of a Switch agent, which is where its provider is+ * known — the server says what type an agent is, not what runs it here. */+export function localAgentFor(switchAgentId: string, workspaceId: string | null) {+ if (workspaceId === null) return null;+ return (+ agentsStore.agentsInWorkspace(workspaceId).find((a) => a.switchAgentId === switchAgentId) ??+ null+ );+}++export function agentNameFor(+ switchAgentId: string,+ workspaceId: string | null,+ remoteById: Map<string, RemoteAgentSummary>+): string {+ return (+ localAgentFor(switchAgentId, workspaceId)?.name ??+ remoteById.get(switchAgentId)?.name ??+ 'Agent'+ );+}++/** What an agent runs, in words: this install's provider when it has one,+ * otherwise the type the server knows it by. */+export function agentKindFor(+ switchAgentId: string,+ workspaceId: string | null,+ remoteById: Map<string, RemoteAgentSummary>+): string {+ const providerId = localAgentFor(switchAgentId, workspaceId)?.providerId ?? null;+ const knownType = remoteById.get(switchAgentId)?.knownAgentType ?? null;+ return providerDisplayName(providerId) ?? knownAgentTypeDisplayName(knownType) ?? 'agent';+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-side-panel.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-side-panel.tsxindex 55e1786d2..279cc45a5 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-side-panel.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-side-panel.tsx@@ -15,7 +15,7 @@ import { Button } from '@renderer/lib/ui/button';import { cn } from '@renderer/utils/utils';import { chatAgentLabel } from '@shared/core/chats/chats';import { roomAgentPresence } from './room-agent-presence';-import { AgentMark, agentNameFor, PersonMark, roomDetailKey } from './room-configuration-panel';+import { AgentMark, agentNameFor, PersonMark, roomDetailKey } from './room-participants';import { roomTabStore } from './room-tab-store';const TONE_CLASS = {