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(console): the participant field takes no pick while one is being added
raullopez-sandbox3a84edfaabf0
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 fb4cbafee..a74fa1589 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@@ -277,7 +277,6 @@ const ChatAddParticipantPanel = observer(function ChatAddParticipantPanel({];async function add(participant: Participant) {- if (adding !== null) return;setAdding(participant.id);setError(null);try {@@ -296,6 +295,7 @@ const ChatAddParticipantPanel = observer(function ChatAddParticipantPanel({<ParticipantPickerinputId="chat-add-participant"autoFocus+ busy={adding !== null}candidates={candidates}picked={[]}onChange={(next) => {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.tsxindex 953cdb586..6eed816ba 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@@ -242,6 +242,7 @@ export const CreateRoomModal = observer(function CreateRoomModal({<ParticipantPickerinputId="new-room-participants"autoFocus={false}+ busy={isSubmitting}candidates={candidates}picked={picked}onChange={setPicked}diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.tsindex 43a88e496..44cf2e369 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.ts@@ -85,6 +85,7 @@ describe('ParticipantPicker', () => {loading: false,inputId: 'participants',autoFocus: false,+ busy: false,}));expect(html).toContain('aria-label="Remove helper"');diff --git a/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsx b/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsxindex 0f669a914..07c85c54e 100644--- a/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsx+++ b/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsx@@ -1,4 +1,4 @@-import { X } from 'lucide-react';+import { Loader2, X } from 'lucide-react';import { useState } from 'react';import { useAgentAccent } from '@renderer/lib/components/agent-accent';import { AgentAvatar } from '@renderer/lib/components/agent-avatar';@@ -88,6 +88,7 @@ export function ParticipantPicker({loading,inputId,autoFocus,+ busy,}: {candidates: Participant[];picked: Participant[];@@ -97,6 +98,8 @@ export function ParticipantPicker({/** For the field's label. */inputId: string;autoFocus: boolean;+ /** A pick is being applied: the field takes no other until it is, and says so. */+ busy: boolean;}) {const [query, setQuery] = useState('');const [open, setOpen] = useState(false);@@ -105,6 +108,7 @@ export function ParticipantPicker({const current = Math.min(active, Math.max(results.length - 1, 0));const add = (participant: Participant) => {+ if (busy) return;onChange([...picked, participant]);setQuery('');setActive(0);@@ -135,7 +139,10 @@ export function ParticipantPicker({aria-controls={`${inputId}-results`}aria-label="Add agents or people"placeholder={picked.length === 0 ? 'Add agents or people…' : ''}- className="h-6 min-w-32 flex-1 bg-transparent px-1.5 text-sm outline-none placeholder:text-foreground-passive"+ className="h-6 min-w-32 flex-1 bg-transparent px-1.5 text-sm outline-none placeholder:text-foreground-passive aria-disabled:opacity-50"+ // Read-only rather than disabled while busy, so focus stays for the next pick.+ readOnly={busy}+ aria-disabled={busy}value={query}onChange={(event) => {setQuery(event.target.value);@@ -165,6 +172,15 @@ export function ParticipantPicker({else setOpen(false);}}/>+ {busy && (+ <span+ role="status"+ className="flex items-center gap-1 px-1.5 text-xs text-foreground-muted"+ >+ <Loader2 className="size-3 animate-spin" />+ Adding…+ </span>+ )}</div>{open && (// In the flow rather than floating: the dialog clips what overflows it, so the list grows it instead.@@ -187,12 +203,13 @@ export function ParticipantPicker({key={`${participant.kind}:${participant.id}`}role="option"aria-selected={index === current}+ aria-disabled={busy}// Keeps focus in the field, so the list stays open for the next pick.onMouseDown={(event) => event.preventDefault()}onMouseEnter={() => setActive(index)}onClick={() => add(participant)}className={cn(- 'flex cursor-pointer items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm',+ 'flex cursor-pointer items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm aria-disabled:cursor-wait aria-disabled:opacity-50',index === current && 'bg-[var(--sel-soft)]')}>diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsxindex 83e05f489..43e17d8f5 100644--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsx+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsx@@ -4,7 +4,7 @@* the room. A plain Enter still does both.*/import { QueryClient, QueryClientProvider } from '@tanstack/react-query';-import { act } from 'react';+import { act, useState } from 'react';import { createRoot, type Root } from 'react-dom/client';import { afterEach, describe, expect, it, vi } from 'vitest';import { RoomNameInput } from '@renderer/features/switch-servers/room-name-input';@@ -56,6 +56,7 @@ describe('New room IME', () => {loading={false}inputId="participants"autoFocus={false}+ busy={false}/>);await act(async () => input.focus());@@ -78,3 +79,44 @@ describe('New room IME', () => {expect(onSubmit).toHaveBeenCalledTimes(1);});});++describe('Participant field while a pick is being added', () => {+ it('takes no second pick until the first is added, and says it is adding', async () => {+ const bob: Participant = { kind: 'person', id: 'u2', name: 'Bob', detail: '[email protected]' };+ let finish!: () => void;+ const added: string[] = [];+ function Harness() {+ const [busy, setBusy] = useState(false);+ return (+ <ParticipantPicker+ candidates={[helper, bob]}+ picked={[]}+ onChange={(next) => {+ const pick = next.at(-1)!;+ added.push(pick.id);+ setBusy(true);+ // The first add answers late.+ void new Promise<void>((resolve) => (finish = resolve)).then(() => setBusy(false));+ }}+ serverId={null}+ loading={false}+ inputId="add"+ autoFocus={false}+ busy={busy}+ />+ );+ }+ const input = await render(<Harness />);+ await act(async () => input.focus());+ await act(async () => enter(input, { keyCode: 13 }));+ expect(added).toEqual(['a1']);+ expect(input.readOnly).toBe(true);+ expect(container!.textContent).toContain('Adding…');+ await act(async () => enter(input, { keyCode: 13 }));+ expect(added).toEqual(['a1']);+ await act(async () => finish());+ expect(input.readOnly).toBe(false);+ await act(async () => enter(input, { keyCode: 13 }));+ expect(added).toEqual(['a1', 'a1']);+ });+});