Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Bot panel: keep Details' memory row off other bots' turns

luishron123c8c59e8028b5
diff --git a/scripts/testing/org-library-ui.e2e.test.ts b/scripts/testing/org-library-ui.e2e.test.ts
index 1ca8cc9109..a2ba8b1745 100644
--- a/scripts/testing/org-library-ui.e2e.test.ts
+++ b/scripts/testing/org-library-ui.e2e.test.ts
@@ -131,7 +131,7 @@ describe("the organization library in the real renderer", () => {
.find(([, entry]) => entry.role === "button" && /Open .+ profile/.test(entry.name));
expect(profile).toBeDefined();
await ui("click", "--ref", `@${profile![0]}`);
- // The bot's panel: where it came from on Bot settings, the organization's skills on Library → Skills.
+ // The bot's panel: where it came from on Bot settings, the organization's skills on Details → Skills.
// The gear is visible to the browser while the panel is still sliding in.
await expect.poll(async () => {
const settings = await ui("eval", "--js", "Boolean(document.querySelector('[data-panel-gear][aria-current=page]'))");
@@ -141,7 +141,6 @@ describe("the organization library in the real renderer", () => {
}, { timeout: 10_000 }).toBe(true);
await expect.poll(snapshot, { timeout: 10_000 }).toContain("From Sales desk 1.3.0 · Acme Partners");
await click("Details");
- await click("Library");
await ui("eval", "--js", "document.querySelector('[data-panel-page=\"skills\"]').click(); true");
await expect.poll(snapshot, { timeout: 10_000 }).toContain("Skills your organization shares");
await evidence("org-library-bot-skills.png");
diff --git a/src/components/background-turn.render-count.test.ts b/src/components/background-turn.render-count.test.ts
index 734c5ab67e..af78f05c4b 100644
--- a/src/components/background-turn.render-count.test.ts
+++ b/src/components/background-turn.render-count.test.ts
@@ -113,6 +113,7 @@ beforeAll(async () => {
const path = String(input).replace(/\?.*$/, "");
if (path === "/api/bots") return json({ bots: Array.from({ length: 12 }, (_, i) => ({ ...announced(i), messages: [] })), groups: [] });
if (path in answers) return json(answers[path]);
+ if (/^\/api\/bots\/[^/]+\/memory\/file$/.test(path)) return json({ path: "MEMORY.md", text: "" });
return /^\/api\/bots\/[^/]+\/overview$/.test(path) ? missing() : json({});
});
const container = document.createElement("div");
diff --git a/src/components/bot-panel/use-memory-doc.ts b/src/components/bot-panel/use-memory-doc.ts
index 58a990bce8..fa8d4bdd21 100644
--- a/src/components/bot-panel/use-memory-doc.ts
+++ b/src/components/bot-panel/use-memory-doc.ts
@@ -1,7 +1,8 @@
import { useEffect, useState } from "react";
import { fetchMemoryDoc, fetchMemoryOverview, fetchThreadNotes, MEMORY_INDEX, type MemoryDoc, type ThreadNotesDoc } from "@/lib/memory";
-import { useStore, type Bot } from "@/state/store";
+import type { Bot } from "@/state/store";
+import { useStoreSelector } from "@/state/store-select";
export interface MemoryNotesState {
/** MEMORY.md first; on a Team Cloud also the person's topic files. Null until read. */
@@ -24,7 +25,7 @@ async function readDocs(botId: string, mine: boolean): Promise<MemoryDoc[]> {
/** The notes the bot panel shows for a bot whose memory is on. They are read again as a turn starts and ends, so a note
* the bot just saved shows. */
export function useMemoryDoc(bot: Pick<Bot, "id" | "memoryEnabled" | "busy" | "threadId">): MemoryNotesState {
- const mine = Boolean(useStore().state.config?.team);
+ const mine = useStoreSelector((state) => Boolean(state.config?.team));
const [state, setState] = useState<{ botId: string; threadId: string; docs: MemoryDoc[] | null; thread: ThreadNotesDoc | null; error: boolean }>({ botId: bot.id, threadId: bot.threadId, docs: null, thread: null, error: false });
const memoryOn = bot.memoryEnabled !== false;