Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix: show a hidden MausBot again after a department delete or reviewed setup rename; keep both Chiefs in search
AdityaUmale2ae09cd2c508
diff --git a/server/default-bot.test.ts b/server/default-bot.test.tsindex 4b1f141b69..520d8930cf 100644--- a/server/default-bot.test.ts+++ b/server/default-bot.test.ts@@ -159,6 +159,21 @@ describe("MausBot, every person's helper", () => {expect(hiddenAfter(() => store.updateTeamMembers("Work", [maus.id], []))).toBe(false);});+ it("shows a hidden MausBot again after its department is deleted or a reviewed setup renames it", () => {+ const store = new Store(selection);+ const maus = boot(store)!;+ store.setBotsSection([maus.id], "Work");+ store.patchBot(maus.id, { sidebarHidden: true });+ expect(store.deleteSection("Work")).toBeUndefined();+ expect(store.bot(maus.id)?.sidebarHidden).toBe(false);+ store.patchBot(maus.id, { sidebarHidden: true });+ store.applyTeamSetup({ version: 1, requestId: "setup-rename", botId: maus.id, threadId: maus.threadId,+ reason: "Requested", createdAt: 1, requesterRevision: "fixture", newTeams: [], operations: [+ { action: "update", botId: maus.id, fields: { name: "Nova" } },+ ] });+ expect(store.bot(maus.id)).toMatchObject({ name: "Nova", sidebarHidden: false });+ });+it("knows a renamed MausBot by its mark: no second one on update, Chief tools kept", () => {const store = new Store(selection);store.createBot({ name: "Writer" });diff --git a/server/store.ts b/server/store.tsindex c1b075a902..c5ab7ac3c1 100644--- a/server/store.ts+++ b/server/store.ts@@ -785,7 +785,7 @@ export class Store {return "Stop this department's active work before deleting it";}const nextBots = this.bots.map(bot => ({ ...bot,- ...(sectionKey(bot.section) === name ? { section: undefined } : {}),+ ...(sectionKey(bot.section) === name ? reshowWhenMoved(bot, { section: undefined }) : {}),...(bot.managedSections ? { managedSections: bot.managedSections.filter(section => sectionKey(section) !== name) } : {}),}));if (chiefConflict(nextBots)) {@@ -1400,7 +1400,7 @@ export class Store {} else {if (at < 0) throw new Error("A setup target no longer exists");const previous = nextBots[at];- next = { ...previous, ...operation.fields };+ next = { ...previous, ...reshowWhenMoved(previous, operation.fields) };if (operation.fields.modelSelection) next.tasks = this.withDefaultModel(previous, operation.fields.modelSelection);nextBots[at] = next;}diff --git a/src/lib/sidebar-layout.test.ts b/src/lib/sidebar-layout.test.tsindex 45758cd881..d193c94926 100644--- a/src/lib/sidebar-layout.test.ts+++ b/src/lib/sidebar-layout.test.ts@@ -124,6 +124,11 @@ describe("sidebar virtual sections", () => {expect(partitionSidebarBots([mine, theirs], { viewerEmail: null, searching: true }).sectionedBots).toEqual([mine]);const plain = { id: "plain", sidebarHidden: true, section: "C Suite" };expect(partitionSidebarBots([plain], { viewerEmail: null, searching: true }).sectionedBots).toEqual([]);+ const hiddenMaus = { id: "maus", chiefOfStaff: true, sidebarHidden: true, defaultBot: {} };+ const sharedChief = { id: "shared", chiefOfStaff: true };+ const found = partitionSidebarBots([hiddenMaus, sharedChief], { viewerEmail: null, searching: true });+ expect([found.unsectionedChief, ...found.unsectionedBots]).toEqual([hiddenMaus, sharedChief]);+ expect(partitionSidebarBots([hiddenMaus, sharedChief], { viewerEmail: null }).unsectionedBots).toEqual([]);});it("lists a group's pinned Chief with the pinned bots on every client; the main Chief keeps its own top slot", () => {diff --git a/src/lib/sidebar-layout.ts b/src/lib/sidebar-layout.tsindex 6c78fa7512..e49caee9b9 100644--- a/src/lib/sidebar-layout.ts+++ b/src/lib/sidebar-layout.ts@@ -124,8 +124,9 @@ export function partitionSidebarBots<T extends SidebarBot>(const sectionedBots = visible.filter((bot) => !bot.chiefOfStaff && Boolean(bot.section) && !pinnedIds.has(bot.id),);+ // A search can list two unsectioned Chiefs (the viewer's hidden MausBot and a shared Chief); the second is a bot row.const unsectionedBots = visible.filter(- (bot) => !bot.chiefOfStaff && !bot.section && !pinnedIds.has(bot.id),+ (bot) => (!bot.chiefOfStaff || (options?.searching === true && bot !== unsectionedChief)) && !bot.section && !pinnedIds.has(bot.id),);return { unsectionedChief, pinnedBots, sectionChiefs, sectionedBots, unsectionedBots };}