Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

New room: More options for the channel, group and access

Simon Flack67bddc8a915e
diff --git a/console/apps/switch-console-desktop/src/main/core/switch-servers/create-room.ts b/console/apps/switch-console-desktop/src/main/core/switch-servers/create-room.ts
index 276f7c679..4683c08a5 100644
--- a/console/apps/switch-console-desktop/src/main/core/switch-servers/create-room.ts
+++ b/console/apps/switch-console-desktop/src/main/core/switch-servers/create-room.ts
@@ -42,6 +42,9 @@ export async function createRoomOnServer(
instructions: params.instructions,
bridgeId: params.bridgeId,
agentIds: params.agentIds,
+ channel: params.channel,
+ groupId: params.groupId,
+ access: params.access,
});
return { kind: 'created', room };
} catch (cause) {
diff --git a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.ts b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.ts
index f5e6ff67b..398b65025 100644
--- a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.ts
+++ b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.ts
@@ -687,6 +687,67 @@ describe('room creation', () => {
expect(room.ownerId).toBe('u1');
});
+ it('asks for a private channel, a group and an access level when chosen', async () => {
+ fetchMock.mockResolvedValue(
+ jsonResponse({
+ id: 'room-1',
+ name: 'design',
+ description: 'd',
+ channel_type: 'channel_private',
+ agent_count: 0,
+ bridge_display_name: 'Slack',
+ archived: false,
+ created_at: '2026-01-01T00:00:00Z',
+ }) as never
+ );
+
+ await createRoom(SERVER, {
+ name: 'design',
+ description: 'd',
+ bridgeId: 'b1',
+ agentIds: [],
+ channel: { kind: 'new', private: true },
+ groupId: 'g1',
+ access: 'read_only',
+ });
+
+ expect(bodyOf(fetchMock.mock.calls[0])).toMatchObject({
+ channel_type: 'channel_private',
+ group_id: 'g1',
+ read_visibility: 'public',
+ write_visibility: 'private',
+ });
+ });
+
+ it('binds an existing channel by id and leaves its type and access to the server', async () => {
+ fetchMock.mockResolvedValue(
+ jsonResponse({
+ id: 'room-1',
+ name: 'design',
+ description: 'd',
+ channel_type: 'channel_public',
+ agent_count: 0,
+ bridge_display_name: 'Slack',
+ archived: false,
+ created_at: '2026-01-01T00:00:00Z',
+ }) as never
+ );
+
+ await createRoom(SERVER, {
+ name: 'design',
+ description: 'd',
+ bridgeId: 'b1',
+ agentIds: [],
+ channel: { kind: 'existing', externalChannelId: 'C123' },
+ });
+
+ const body = bodyOf(fetchMock.mock.calls[0]);
+ expect(body).toMatchObject({ external_channel_id: 'C123' });
+ expect(body).not.toHaveProperty('channel_type');
+ expect(body).not.toHaveProperty('read_visibility');
+ expect(body).not.toHaveProperty('group_id');
+ });
+
it('sends blank instructions as null rather than an empty string', async () => {
fetchMock.mockResolvedValue(
jsonResponse({
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.ts
index 9a07235dc..c78965b6f 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
@@ -114,6 +114,9 @@ import {
type RoomDocumentContent,
type RoomResource,
type RoomResourceKind,
+ type NewRoomChannel,
+ type RoomAccess,
+ visibilityForAccess,
} from '@shared/core/switch-servers/switch-servers';
import type {
Invitation,
@@ -3656,8 +3659,15 @@ export async function createRoom(
/** Null makes an internal room: no channel, not even on the default app. */
bridgeId: string | null;
agentIds: string[];
+ /** A new public channel when absent. */
+ channel?: NewRoomChannel;
+ groupId?: string | null;
+ /** The server's default (open to the workspace) when absent. */
+ access?: RoomAccess;
}
): Promise<RemoteRoomSummary> {
+ const channel = params.channel ?? { kind: 'new', private: false };
+ const visibility = params.access ? visibilityForAccess(params.access) : null;
const res = await gatewayFetch(server, '/rooms', {
authenticated: true,
method: 'POST',
@@ -3667,7 +3677,17 @@ export async function createRoom(
instructions: params.instructions?.trim() ? params.instructions : null,
bridge_id: params.bridgeId,
...(params.bridgeId === null ? { internal_only: true } : {}),
- channel_type: 'channel_public',
+ // An existing channel's type is the platform's, read by the server.
+ ...(channel.kind === 'existing'
+ ? { external_channel_id: channel.externalChannelId }
+ : { channel_type: channel.private ? 'channel_private' : 'channel_public' }),
+ ...(params.groupId ? { group_id: params.groupId } : {}),
+ ...(visibility
+ ? {
+ read_visibility: visibility.readVisibility,
+ write_visibility: visibility.writeVisibility,
+ }
+ : {}),
agent_ids: params.agentIds,
},
});
diff --git a/console/apps/switch-console-desktop/src/main/core/workspaces/controller.ts b/console/apps/switch-console-desktop/src/main/core/workspaces/controller.ts
index b774e389e..8f696e505 100644
--- a/console/apps/switch-console-desktop/src/main/core/workspaces/controller.ts
+++ b/console/apps/switch-console-desktop/src/main/core/workspaces/controller.ts
@@ -764,6 +764,9 @@ export const workspacesController = createRPCController({
instructions: params.instructions,
bridgeId: params.bridgeId,
agentIds: params.agentIds,
+ channel: params.channel,
+ groupId: params.groupId,
+ access: params.access,
})
);
} catch (error) {
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx
index 9618dcad8..32ed6e424 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx
@@ -34,12 +34,16 @@ import { Field, FieldLabel } from '@renderer/lib/ui/field';
import { Input } from '@renderer/lib/ui/input';
import { Textarea } from '@renderer/lib/ui/textarea';
import { knownAgentTypeDisplayName } from '@shared/core/providers/agent-provider-registry';
+import { CreateRoomOptions } from './create-room-options';
import { MessagingAppSelector, SWITCH_CONSOLE } from './messaging-app-selector';
import {
CreateRequestIds,
canCreate,
+ DEFAULT_ROOM_OPTIONS,
dropsStartingAgent,
+ type RoomCreateOptions,
roomCreateRequest,
+ roomOptionsReady,
startingAgentResolution,
} from './room-create-request';
import { RoomNameInput } from './room-name-input';
@@ -81,6 +85,7 @@ export const CreateRoomModal = observer(function CreateRoomModal({
const [description, setDescription] = useState('');
const [instructions, setInstructions] = useState('');
const [where, setWhere] = useState(SWITCH_CONSOLE);
+ const [options, setOptions] = useState<RoomCreateOptions>(DEFAULT_ROOM_OPTIONS);
const [picked, setPicked] = useState<Participant[]>([]);
const [isSubmitting, setIsSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -184,6 +189,7 @@ export const CreateRoomModal = observer(function CreateRoomModal({
startingAgentState !== 'pending' &&
!nowhere &&
canCreate({ name }) &&
+ (selectedBridge === null || roomOptionsReady(options)) &&
!isSubmitting;
async function handleSubmit() {
@@ -204,6 +210,7 @@ export const CreateRoomModal = observer(function CreateRoomModal({
agentIds,
memberUserIds,
requestId: requestIds.for({ bridgeId, name, agentIds, memberUserIds }),
+ options,
});
if (request.kind === 'chat') {
const chat = await rpc.chats.create(request.params);
@@ -279,9 +286,9 @@ export const CreateRoomModal = observer(function CreateRoomModal({
/>
{/* What the name becomes, where it becomes it: a bridged room is a
channel of the same name in its app. */}
- {trimmedName !== '' && selectedBridge && (
+ {trimmedName !== '' && selectedBridge && options.channel.kind === 'new' && (
<span className="text-xs text-foreground-muted">
- Created as #{trimmedName} in {selectedBridge.displayName}.
+ {`Created as ${options.channel.private ? 'private ' : ''}#${trimmedName} in ${selectedBridge.displayName}.`}
</span>
)}
</Field>
@@ -343,6 +350,15 @@ export const CreateRoomModal = observer(function CreateRoomModal({
rows={3}
/>
</Field>
+ <CreateRoomOptions
+ workspaceId={workspaceId}
+ bridge={selectedBridge}
+ value={options}
+ onChange={(next) => {
+ setOptions(next);
+ setError(null);
+ }}
+ />
</>
)}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/create-room-options.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/create-room-options.tsx
new file mode 100644
index 000000000..980d9abc4
--- /dev/null
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/create-room-options.tsx
@@ -0,0 +1,170 @@
+import { useQuery } from '@tanstack/react-query';
+import { useState } from 'react';
+import { ACCESS_LABELS } from '@renderer/features/switch-rooms/room-settings-sections';
+import { failureText } from '@renderer/lib/errors/describe-failure';
+import { rpc } from '@renderer/lib/ipc';
+import { DisclosureRow } from '@renderer/lib/ui/disclosure-row';
+import { Field, FieldLabel } from '@renderer/lib/ui/field';
+import { Input } from '@renderer/lib/ui/input';
+import { SegmentedControl } from '@renderer/lib/ui/segmented-control';
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@renderer/lib/ui/select';
+import type { RemoteBridge, RoomAccess } from '@shared/core/switch-servers/switch-servers';
+import type { RoomCreateOptions } from './room-create-request';
+
+type ChannelChoice = 'public' | 'private' | 'existing';
+
+const NO_GROUP = '__none__';
+const ACCESS_ORDER: RoomAccess[] = ['public', 'read_only', 'private'];
+
+/** The channel choice a set of options holds. */
+function channelChoiceOf(options: RoomCreateOptions): ChannelChoice {
+ if (options.channel.kind === 'existing') return 'existing';
+ return options.channel.private ? 'private' : 'public';
+}
+
+/**
+ * What a room on a messaging app can be made with beyond its name: its
+ * channel, its group and who may see and change it. Shut until opened, so the
+ * plain path stays short; each choice starts where the server would leave it
+ * — a new public channel, no group, open to the workspace.
+ *
+ * Channel type and access stay separate: one is the platform's, the other
+ * Switch's, and choosing a private channel does not change who may see the
+ * room in Switch.
+ */
+export function CreateRoomOptions({
+ workspaceId,
+ bridge,
+ value,
+ onChange,
+}: {
+ workspaceId: string | null;
+ bridge: RemoteBridge;
+ value: RoomCreateOptions;
+ onChange: (next: RoomCreateOptions) => void;
+}) {
+ const [open, setOpen] = useState(false);
+ const groups = useQuery({
+ queryKey: ['room-groups', workspaceId],
+ queryFn: () => rpc.workspaces.listRoomGroups(workspaceId as string),
+ enabled: workspaceId !== null && open,
+ });
+ // A connection shared between organisations cannot be pointed at a channel
+ // by its id: the app says how to add one instead.
+ const existingOffered = bridge.channelIdsRefused === null;
+ const choice = channelChoiceOf(value);
+ const groupName = (groups.data ?? []).find((group) => group.id === value.groupId)?.name;
+
+ const channelOptions = [
+ { value: 'public' as const, label: 'New public' },
+ { value: 'private' as const, label: 'New private' },
+ ...(existingOffered ? [{ value: 'existing' as const, label: 'Existing' }] : []),
+ ];
+
+ return (
+ <div className="flex flex-col gap-4">
+ <DisclosureRow open={open} title="More options" onToggle={() => setOpen(!open)} />
+ {open && (
+ <>
+ <Field>
+ <FieldLabel>Channel in {bridge.displayName}</FieldLabel>
+ <SegmentedControl
+ ariaLabel={`Channel in ${bridge.displayName}`}
+ value={choice}
+ options={channelOptions}
+ onChange={(next) =>
+ onChange({
+ ...value,
+ channel:
+ next === 'existing'
+ ? { kind: 'existing', externalChannelId: '' }
+ : { kind: 'new', private: next === 'private' },
+ })
+ }
+ />
+ {value.channel.kind === 'existing' ? (
+ <>
+ <Input
+ aria-label="Channel id"
+ placeholder="The channel’s id"
+ value={value.channel.externalChannelId}
+ onChange={(event) =>
+ onChange({
+ ...value,
+ channel: { kind: 'existing', externalChannelId: event.target.value },
+ })
+ }
+ />
+ <span className="text-xs text-foreground-muted">
+ The room uses this channel instead of making a new one.
+ </span>
+ </>
+ ) : (
+ <span className="text-xs text-foreground-muted">
+ {choice === 'private'
+ ? `A private channel in ${bridge.displayName}: only people added to it can see it.`
+ : `A public channel in ${bridge.displayName}: anyone there can find and join it.`}
+ </span>
+ )}
+ </Field>
+
+ <Field>
+ <FieldLabel>Group</FieldLabel>
+ <Select
+ value={value.groupId ?? NO_GROUP}
+ onValueChange={(next) =>
+ onChange({ ...value, groupId: next === NO_GROUP ? null : (next as string) })
+ }
+ >
+ <SelectTrigger className="w-full" aria-label="Group">
+ <SelectValue>{groupName ?? 'No group'}</SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={NO_GROUP}>No group</SelectItem>
+ {(groups.data ?? []).map((group) => (
+ <SelectItem key={group.id} value={group.id}>
+ {group.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {groups.isError && (
+ <span className="text-xs text-destructive">
+ {failureText(groups.error, 'Could not list the groups.')}
+ </span>
+ )}
+ </Field>
+
+ <Field>
+ <FieldLabel>Who can see and change it</FieldLabel>
+ <Select
+ value={value.access ?? 'public'}
+ onValueChange={(next) => onChange({ ...value, access: next as RoomAccess })}
+ >
+ <SelectTrigger className="w-full" aria-label="Who can see and change it">
+ <SelectValue>{ACCESS_LABELS[value.access ?? 'public']}</SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {ACCESS_ORDER.map((access) => (
+ <SelectItem key={access} value={access}>
+ {ACCESS_LABELS[access]}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <span className="text-xs text-foreground-muted">
+ Who can see the room in Switch and change its settings, members and resources. It does
+ not decide who can read or post in the channel.
+ </span>
+ </Field>
+ </>
+ )}
+ </div>
+ );
+}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.test.ts
index 5398e585a..f469c3b6d 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.test.ts
@@ -3,7 +3,9 @@ import {
CreateRequestIds,
canCreate,
dropsStartingAgent,
+ DEFAULT_ROOM_OPTIONS,
roomCreateRequest,
+ roomOptionsReady,
startingAgentResolution,
} from './room-create-request';
@@ -55,9 +57,53 @@ describe('roomCreateRequest', () => {
instructions: undefined,
bridgeId: 'b1',
agentIds: [],
+ // A new public channel and the server's default access, as before.
+ channel: { kind: 'new', private: false },
+ groupId: null,
},
});
});
+
+ it('carries the More options: a private channel, a group and an access choice', () => {
+ const request = roomCreateRequest({
+ ...form,
+ bridgeId: 'b1',
+ options: { channel: { kind: 'new', private: true }, groupId: 'g1', access: 'read_only' },
+ });
+ expect(request.kind === 'room' && request.params).toMatchObject({
+ channel: { kind: 'new', private: true },
+ groupId: 'g1',
+ access: 'read_only',
+ });
+ });
+
+ it('binds an existing channel by its id, trimmed', () => {
+ const request = roomCreateRequest({
+ ...form,
+ bridgeId: 'b1',
+ options: {
+ channel: { kind: 'existing', externalChannelId: ' C123 ' },
+ groupId: null,
+ access: null,
+ },
+ });
+ expect(request.kind === 'room' && request.params.channel).toEqual({
+ kind: 'existing',
+ externalChannelId: 'C123',
+ });
+ });
+});
+
+describe('roomOptionsReady', () => {
+ it('needs a channel id only when binding an existing channel', () => {
+ expect(roomOptionsReady(DEFAULT_ROOM_OPTIONS)).toBe(true);
+ const existing = (id: string) => ({
+ ...DEFAULT_ROOM_OPTIONS,
+ channel: { kind: 'existing' as const, externalChannelId: id },
+ });
+ expect(roomOptionsReady(existing(' '))).toBe(false);
+ expect(roomOptionsReady(existing('C1'))).toBe(true);
+ });
});
describe('canCreate', () => {
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.ts
index 64a3c93c2..a2e8d0337 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-create-request.ts
@@ -1,3 +1,5 @@
+import type { NewRoomChannel, RoomAccess } from '@shared/core/switch-servers/switch-servers';
+
/** What the New room dialog asks the server for: a Switch Console chat when no messaging app is chosen, else a room bridged to the chosen one. */
export type RoomCreateRequest =
| {
@@ -22,9 +24,27 @@ export type RoomCreateRequest =
instructions: string | undefined;
bridgeId: string;
agentIds: string[];
+ channel: NewRoomChannel;
+ groupId: string | null;
+ /** Absent leaves the server's default. */
+ access?: RoomAccess;
};
};
+/** The New room dialog's More options, for a room on a messaging app. */
+export type RoomCreateOptions = {
+ channel: NewRoomChannel;
+ groupId: string | null;
+ /** Null leaves the server's default. */
+ access: RoomAccess | null;
+};
+
+export const DEFAULT_ROOM_OPTIONS: RoomCreateOptions = {
+ channel: { kind: 'new', private: false },
+ groupId: null,
+ access: null,
+};
+
export function roomCreateRequest(form: {
serverId: string;
workspaceId: string;
@@ -37,6 +57,8 @@ export function roomCreateRequest(form: {
/** The people to add; a bridged room is created without them. */
memberUserIds: string[];
requestId: string;
+ /** A bridged room's More options; a Switch Console room has none. */
+ options?: RoomCreateOptions;
}): RoomCreateRequest {
const name = form.name.trim();
const agentIds = [...new Set(form.agentIds)];
@@ -62,10 +84,28 @@ export function roomCreateRequest(form: {
instructions: form.instructions.trim() || undefined,
bridgeId: form.bridgeId,
agentIds,
+ ...roomOptionsParams(form.options ?? DEFAULT_ROOM_OPTIONS),
},
};
}
+function roomOptionsParams(options: RoomCreateOptions) {
+ const channel: NewRoomChannel =
+ options.channel.kind === 'existing'
+ ? { kind: 'existing', externalChannelId: options.channel.externalChannelId.trim() }
+ : options.channel;
+ return {
+ channel,
+ groupId: options.groupId,
+ ...(options.access ? { access: options.access } : {}),
+ };
+}
+
+/** Whether More options are complete: an existing channel has to be named. */
+export function roomOptionsReady(options: RoomCreateOptions): boolean {
+ return options.channel.kind !== 'existing' || options.channel.externalChannelId.trim() !== '';
+}
+
/** A room needs only a name; a bridged room's description is optional, as its channel topic is. */
export function canCreate(form: { name: string }) {
return form.name.trim() !== '';
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/create-room-options.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/create-room-options.test.tsx
new file mode 100644
index 000000000..972adfc2e
--- /dev/null
+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/create-room-options.test.tsx
@@ -0,0 +1,118 @@
+/**
+ * The New room dialog's More options for a room on a messaging app: shut at
+ * first, each choice starting where the server would leave it, and binding an
+ * existing channel only where the app allows it.
+ */
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { act, useState } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { RemoteBridge } from '@shared/core/switch-servers/switch-servers';
+
+vi.hoisted(() => {
+ window.electronAPI ??= {
+ invoke: () => Promise.resolve(undefined),
+ eventOn: () => () => {},
+ eventSend: () => {},
+ } as unknown as typeof window.electronAPI;
+});
+
+vi.mock('@renderer/lib/ipc', () => ({
+ events: { on: vi.fn() },
+ rpc: { workspaces: { listRoomGroups: vi.fn(async () => [{ id: 'g1', name: 'Design' }]) } },
+}));
+
+import { CreateRoomOptions } from '@renderer/features/switch-servers/create-room-options';
+import {
+ DEFAULT_ROOM_OPTIONS,
+ type RoomCreateOptions,
+} from '@renderer/features/switch-servers/room-create-request';
+
+const BRIDGE = { id: 'b1', displayName: 'Acme Slack', channelIdsRefused: null } as RemoteBridge;
+
+let container: HTMLDivElement | null = null;
+let root: Root | null = null;
+let latest: RoomCreateOptions = DEFAULT_ROOM_OPTIONS;
+
+afterEach(async () => {
+ if (root) await act(async () => root!.unmount());
+ container?.remove();
+ container = null;
+ root = null;
+ latest = DEFAULT_ROOM_OPTIONS;
+});
+
+function Harness({ bridge }: { bridge: RemoteBridge }) {
+ const [value, setValue] = useState<RoomCreateOptions>(DEFAULT_ROOM_OPTIONS);
+ return (
+ <CreateRoomOptions
+ workspaceId="ws-1"
+ bridge={bridge}
+ value={value}
+ onChange={(next) => {
+ latest = next;
+ setValue(next);
+ }}
+ />
+ );
+}
+
+async function render(bridge: RemoteBridge = BRIDGE): Promise<HTMLDivElement> {
+ container = document.createElement('div');
+ document.body.appendChild(container);
+ root = createRoot(container);
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ await act(async () =>
+ root!.render(
+ <QueryClientProvider client={client}>
+ <Harness bridge={bridge} />
+ </QueryClientProvider>
+ )
+ );
+ return container;
+}
+
+function button(el: HTMLElement, text: string): HTMLButtonElement | undefined {
+ return [...el.querySelectorAll<HTMLButtonElement>('button')].find(
+ (b) => b.textContent?.trim() === text
+ );
+}
+
+async function click(target: HTMLElement) {
+ await act(async () => target.click());
+ for (let i = 0; i < 4; i++) await act(async () => await Promise.resolve());
+}
+
+describe('More options when creating a room on a messaging app', () => {
+ it('starts shut, and opens on a new public channel open to the workspace', async () => {
+ const el = await render();
+ expect(el.textContent).not.toContain('Channel in Acme Slack');
+ await click(button(el, 'More options')!);
+ expect(el.textContent).toContain('Channel in Acme Slack');
+ expect(el.textContent).toContain('A public channel in Acme Slack');
+ expect(el.textContent).toContain('Everyone in the workspace can see and change it');
+ });
+
+ it('asks for a private channel without changing who can see the room in Switch', async () => {
+ const el = await render();
+ await click(button(el, 'More options')!);
+ await click(button(el, 'New private')!);
+ expect(latest.channel).toEqual({ kind: 'new', private: true });
+ expect(latest.access).toBeNull();
+ expect(el.textContent).toContain('only people added to it can see it');
+ });
+
+ it('takes an existing channel by its id', async () => {
+ const el = await render();
+ await click(button(el, 'More options')!);
+ await click(button(el, 'Existing')!);
+ expect(el.querySelector('input[aria-label="Channel id"]')).not.toBeNull();
+ expect(latest.channel).toEqual({ kind: 'existing', externalChannelId: '' });
+ });
+
+ it('offers no existing channel where the app cannot be pointed at one by id', async () => {
+ const el = await render({ ...BRIDGE, channelIdsRefused: 'Add the app to the channel.' });
+ await click(button(el, 'More options')!);
+ expect(button(el, 'Existing')).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.ts
index 321d4786c..accd2ea9e 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
@@ -1204,8 +1204,19 @@ export type CreateRoomParams = {
/** Switch agent ids to add as members. May be empty — a room is valid with
* no agents, and members can be invited later. */
agentIds: string[];
+ /** The bridged room's channel: a new one, public unless asked, or an existing one by its id. */
+ channel?: NewRoomChannel;
+ /** The group to file the room under; none when absent. */
+ groupId?: string | null;
+ /** Who may see and change the room; the server's default when absent. */
+ access?: RoomAccess;
};
+/** A bridged room's channel, as the New room dialog asks for it. */
+export type NewRoomChannel =
+ | { kind: 'new'; private: boolean }
+ | { kind: 'existing'; externalChannelId: string };
+
/**
* Outcome of creating a room. `created` carries the new room; every other
* variant maps a recoverable gateway failure onto something the modal can say