Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix: close an unpinned tray when a newly added bot takes the chat
AdityaUmale86686ae792d5
diff --git a/src/state/store.test.ts b/src/state/store.test.tsindex 278a743f45..253cd5bba4 100644--- a/src/state/store.test.ts+++ b/src/state/store.test.ts@@ -3191,6 +3191,15 @@ describe("notifications feed", () => {expect(reducer(open, { type: "newTask", botId: "bot-1" }).notificationsOpen).toBe(false);});+ it("unpinned, adding a bot that takes the chat closes it; a background add keeps it", () => {+ const open = reducer(initialState, { type: "toggleNotifications", open: true });+ const bot = { id: "bot-new", threadId: "thread-new", name: "New", messages: [] } as never as Bot;+ expect(reducer(open, { type: "botAdded", bot }).notificationsOpen).toBe(false);+ expect(reducer(open, { type: "botAdded", bot, preserveSelection: true }).notificationsOpen).toBe(true);+ const pinned = { ...open, notificationsPinned: true };+ expect(reducer(pinned, { type: "botAdded", bot }).notificationsOpen).toBe(true);+ });+it("pinned, the feed survives Computer/Inspector/Activity/AppSettings opening", () => {const open = { ...reducer(initialState, { type: "toggleNotifications", open: true }), notificationsPinned: true };for (const action of [diff --git a/src/state/store.tsx b/src/state/store.tsxindex 1463e5815d..67bb3c8d5b 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -1143,7 +1143,7 @@ export function reducer(state: AppState, action: Action): AppState {return state;case "botAdded":return withMascotMotion({- ...state,+ ...(action.preserveSelection || action.bot.id === state.selectedId ? state : closeUnpinnedTray(state)),// The HTTP response and its SSE broadcast race; fold both without showing the bot twice.bots: [action.bot.messages ? action.bot : { ...action.bot, messages: [] }, ...state.bots.filter((bot) => bot.id !== action.bot.id)],...(action.preserveSelection ? {} : { activeView: "chat" as const, selectedId: action.bot.id }),