Skip to content

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

Bot panel: What it remembers, Skills and Working folder move to Details

luishron123dd5496d61e00
diff --git a/src/components/BotSettingsDialog.library.test.ts b/src/components/BotSettingsDialog.library.test.ts
index 292bd37248..5344f24443 100644
--- a/src/components/BotSettingsDialog.library.test.ts
+++ b/src/components/BotSettingsDialog.library.test.ts
@@ -1,5 +1,6 @@
// @vitest-environment happy-dom
-import { createElement } from "react";
+import { act, createElement } from "react";
+import { createRoot } from "react-dom/client";
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";
@@ -10,41 +11,38 @@ vi.mock("@/lib/interface-mode", () => ({ useAdvancedMode: () => true, setAdvance
vi.mock("@/lib/use-owner-or-admin", () => ({ useOwnerOrAdmin: () => false }));
vi.mock("./bot-settings/useSlackManagement", () => ({ useSlackManagementUrl: () => null }));
vi.mock("./bot-settings/useBotSettingsDerived", () => ({ useBotSettingsDerived: () => ({}) }));
-const fixture = vi.hoisted(() => ({ dispatch: vi.fn(), onOpen: undefined as undefined | ((page: string) => void) }));
+const fixture = vi.hoisted(() => ({ dispatch: vi.fn() }));
vi.mock("@/state/store", async (importOriginal) => {
const store = await importOriginal<typeof import("@/state/store")>();
const state = { ...store.initialState, botSettingsSection: "library", botSettingsExpandAccordion: true };
return { ...store, useStore: () => ({ state, dispatch: fixture.dispatch, flushBotPatches: vi.fn() }) };
});
-vi.mock("./bot-panel/LibraryTab", async (importOriginal) => {
- const original = await importOriginal<typeof import("./bot-panel/LibraryTab")>();
- return {
- ...original,
- LibraryTab: (props: Parameters<typeof original.LibraryTab>[0]) => {
- fixture.onOpen = props.onOpen as (page: string) => void;
- return original.LibraryTab(props);
- },
- };
-});
import { BotSettingsDialog } from "./BotSettingsDialog";
import { DesktopCapabilitiesProvider } from "./DesktopCapabilities";
+(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
const bot = { id: "bot-1", name: "Maily", threadId: "bot-1-main", messages: [], tasks: [] } as never as Bot;
-const html = () => renderToStaticMarkup(createElement(DesktopCapabilitiesProvider, null, createElement(BotSettingsDialog, { bot })));
+const dialog = () => createElement(DesktopCapabilitiesProvider, null, createElement(BotSettingsDialog, { bot }));
describe("Advanced bot settings", () => {
it("has a Library section that shows the bot's library when open", () => {
- const markup = html();
+ const markup = renderToStaticMarkup(dialog());
expect(markup).toContain('data-bot-settings-section="library"');
expect(markup).toContain('data-panel-tabpanel="library"');
});
- it("opens the matching settings section from each Library row", () => {
- html();
- for (const [page, section] of [["memory", "memory"], ["skills", "skills"], ["folder", "access"], ["apps", "overview"]]) {
+ it("keeps memory, skills and the folder in their own sections, not as rows in Library, and their headers open them", async () => {
+ const host = document.createElement("div");
+ document.body.append(host);
+ const root = createRoot(host);
+ await act(async () => root.render(dialog()));
+ expect(host.querySelector('[data-bot-settings-section="library"] [data-panel-page]')).toBeNull();
+ for (const section of ["memory", "skills", "access"]) {
fixture.dispatch.mockClear();
- fixture.onOpen!(page);
+ await act(async () => host.querySelector<HTMLButtonElement>(`[data-bot-settings-section="${section}"] > button`)!.click());
expect(fixture.dispatch).toHaveBeenCalledWith({ type: "toggleSettings", open: true, section });
}
+ await act(async () => root.unmount());
+ host.remove();
});
});
diff --git a/src/components/BotSettingsDialog.simple.test.ts b/src/components/BotSettingsDialog.simple.test.ts
index e7a82467d5..fedd84f0ad 100644
--- a/src/components/BotSettingsDialog.simple.test.ts
+++ b/src/components/BotSettingsDialog.simple.test.ts
@@ -128,6 +128,7 @@ const { DetailsTab } = await import("./bot-panel/DetailsTab");
const { BotConversations } = await import("./bot-panel/Conversations");
const { SettingsPage } = await import("./bot-panel/SettingsPage");
const { LibraryTab } = await import("./bot-panel/LibraryTab");
+const { BotKeeps } = await import("./bot-panel/Keeps");
const { ApprovalChip } = await import("./ComposerPlusMenu");
const { callMode, setCallMode } = await import("@/lib/call-mode");
const { CloudBackendPicker } = await import("./CloudBackendPicker");
@@ -206,7 +207,8 @@ const dialog = (bot: Bot) => capture(() => BotSettingsDialog({ bot }));
const botTab = (bot: Bot) => capture(() => DetailsTab({ bot, derived: derived(), onOpen }));
const settingsPage = (bot: Bot, editingInstructions = false) =>
capture(() => SettingsPage({ bot, derived: derived(), onOpen, editingInstructions, onEditInstructions }));
-const library = (bot: Bot) => capture(() => LibraryTab({ bot, onOpen }));
+const library = (bot: Bot) => capture(() => LibraryTab({ bot }));
+const keeps = (bot: Bot) => capture(() => BotKeeps({ bot, onOpen }));
const computer = (bot: Bot) => capture(() => ComputerTab({ bot, derived: derived(), onOpen }));
const find = (rendered: { nodes: Node[] }, attr: string, value: unknown = true) => {
const found = rendered.nodes.find((node) => node.props[attr] === value);
@@ -341,9 +343,8 @@ describe("the bot panel in Simple mode", () => {
(ofType(page, PageHeader)!.props.onBack as () => void)();
expect(shown(panel(bot))).toEqual({ tab: "details", page: undefined });
- click(find(panel(bot), "data-panel-tab", "library"));
- (ofType(panel(bot), LibraryTab)!.props.onOpen as (page: string) => void)("memory");
- expect(ofType(panel(bot), PageHeader)!.props).toMatchObject({ back: "Library", title: "What it remembers" });
+ (ofType(panel(bot), DetailsTab)!.props.onOpen as (page: string) => void)("memory");
+ expect(ofType(panel(bot), PageHeader)!.props).toMatchObject({ back: "Details", title: "What it remembers" });
(ofType(panel(bot), PageHeader)!.props.onBack as () => void)();
click(find(panel(bot), "data-panel-tab", "computer"));
@@ -386,7 +387,7 @@ describe("the bot panel in Simple mode", () => {
it.each([
["overview", "details", undefined], ["identity", "details", undefined], ["slack", "details", undefined],
- ["soul", "details", "settings"], ["skills", "library", "skills"], ["memory", "library", "memory"],
+ ["soul", "details", "settings"], ["skills", "details", "skills"], ["memory", "details", "memory"],
["routines", "details", "routines"], ["access", "computer", undefined], ["model", "details", undefined],
["permissions", "details", "settings"], ["voice", "details", undefined], ["visibility", "details", undefined],
["history", "details", undefined], ["usage", "details", undefined],
@@ -665,16 +666,16 @@ describe("the avatar editor", () => {
describe("the Details tab", () => {
- it("holds the model, the conversations, this conversation's rows and routines, in that order, with no switch or Thinking row", () => {
+ it("holds the model, what the bot keeps, the conversations, this conversation's rows and routines, in that order, with no switch or Thinking row", () => {
const rendered = botTab(makeBot());
expect(ofType(rendered, ModelPicker)!.props).toMatchObject({ bot: expect.objectContaining({ id: "scout" }), threadId: "thread-scout", contained: true });
expect(ofType(rendered, BotConversations)!.props.bot).toMatchObject({ id: "scout" });
- const order = ['data-panel-row="model"', 'data-panel-card="conversations"', 'data-panel-item="find"', 'data-panel-item="activity"', 'data-panel-empty="routines"']
+ const order = ['data-panel-row="model"', 'data-panel-page="memory"', 'data-panel-page="skills"', 'data-panel-page="folder"', 'data-panel-card="conversations"', 'data-panel-item="find"', 'data-panel-item="activity"', 'data-panel-empty="routines"']
.map((marker) => rendered.html.indexOf(marker));
expect(order.every((index) => index > -1)).toBe(true);
expect([...order].sort((a, b) => a - b)).toEqual(order);
for (const gone of ['data-panel-row="thinking"', 'data-panel-edit="soul"', 'data-panel-row="approval"', 'data-panel-row="goal"', 'data-panel-row="call-mode"',
- 'data-panel-page="apps"', 'data-panel-page="memory"', 'data-panel-page="skills"', 'data-panel-page="folder"']) {
+ 'data-panel-page="apps"']) {
expect(rendered.html, gone).not.toContain(gone);
}
expect(rendered.html).not.toContain(">Settings<");
@@ -1054,45 +1055,45 @@ describe("the Bot settings page", () => {
});
describe("the Library tab", () => {
- it("says what it will hold while the bot has made nothing, then what it remembers, its skills and its folder", () => {
+ it("says what it will hold while the bot has made nothing, and holds nothing else", () => {
const rendered = library(makeBot());
expect(rendered.html).toContain('data-panel-empty="library"');
- const order = ['data-panel-empty="library"', 'data-panel-page="memory"', 'data-panel-page="skills"', 'data-panel-page="folder"'].map((marker) => rendered.html.indexOf(marker));
- expect(order.every((index) => index > -1)).toBe(true);
- expect([...order].sort((a, b) => a - b)).toEqual(order);
+ expect(rendered.html).not.toContain("data-panel-page");
});
+});
+describe("what the bot keeps, on the Details tab", () => {
it("shows no count on What it remembers, only Nothing yet when it is empty or Off, and opens the memory page", () => {
- expect(rowValue(library(makeBot()), "memory")).toBeUndefined();
+ expect(rowValue(keeps(makeBot()), "memory")).toBeUndefined();
fixture.memory.docs = [memoryDoc("# Notes\n- Likes short replies\n- Uses Resolve\n- Works nights\n")];
- const rendered = library(makeBot());
+ const rendered = keeps(makeBot());
expect(rowValue(rendered, "memory")).toBeUndefined();
click(find(rendered, "data-panel-page", "memory"));
expect(onOpen).toHaveBeenLastCalledWith("memory");
fixture.memory.docs = [memoryDoc("# Empty\n")];
- expect(rowValue(library(makeBot()), "memory")).toBe("Nothing yet");
+ expect(rowValue(keeps(makeBot()), "memory")).toBe("Nothing yet");
fixture.memory.thread = { ...memoryDoc("- Acme NDA: two years\n"), path: "memory/threads/t1.md", scoped: true };
- expect(rowValue(library(makeBot()), "memory")).toBeUndefined();
- expect(rowValue(library(makeBot({ memoryEnabled: false })), "memory")).toBe("Off");
+ expect(rowValue(keeps(makeBot()), "memory")).toBeUndefined();
+ expect(rowValue(keeps(makeBot({ memoryEnabled: false })), "memory")).toBe("Off");
});
it("values Skills by how many are on, and opens the skills page", () => {
- expect(rowValue(library(makeBot()), "skills")).toBe("None");
+ expect(rowValue(keeps(makeBot()), "skills")).toBe("None");
fixture.skills.skills = [skill("triage", true), skill("summarise", false), skill("deploy", true)];
- const rendered = library(makeBot());
+ const rendered = keeps(makeBot());
expect(rowValue(rendered, "skills")).toBe(2);
click(find(rendered, "data-panel-page", "skills"));
expect(onOpen).toHaveBeenLastCalledWith("skills");
fixture.skills.loading = true;
- expect(rowValue(library(makeBot()), "skills")).toBeUndefined();
+ expect(rowValue(keeps(makeBot()), "skills")).toBeUndefined();
});
it("values Working folder as Private or the folder's short name, and opens the folder page", () => {
- const rendered = library(makeBot());
+ const rendered = keeps(makeBot());
expect(rowValue(rendered, "folder")).toBe("Private");
click(find(rendered, "data-panel-page", "folder"));
expect(onOpen).toHaveBeenLastCalledWith("folder");
- expect(rowValue(library(makeBot({ cwd: "/Users/omkar/Projects/site" })), "folder")).toBe("/Users/omkar/Projects/site");
+ expect(rowValue(keeps(makeBot({ cwd: "/Users/omkar/Projects/site" })), "folder")).toBe("/Users/omkar/Projects/site");
});
});
diff --git a/src/components/BotSettingsDialog.tsx b/src/components/BotSettingsDialog.tsx
index 37de70e8ab..1bb5d83d81 100644
--- a/src/components/BotSettingsDialog.tsx
+++ b/src/components/BotSettingsDialog.tsx
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState, type ComponentProps } from "react";
import { ChevronDown, Search, X } from "lucide-react";
-import { type Bot, type BotSettingsSection } from "@/state/store";
+import { type Bot } from "@/state/store";
import { cn } from "@/lib/cn";
import { useCaptionChrome } from "./DesktopCapabilities";
import { BOT_SECTIONS, appSearchPhase, searchEmptyText, sectionLabel, sectionMatches } from "./bot-settings/sections";
@@ -26,16 +26,12 @@ import { t } from "@/lib/i18n";
import { useAdvancedMode } from "@/lib/interface-mode";
import { BotPanel } from "./bot-panel/PanelShell";
import { LibraryTab } from "./bot-panel/LibraryTab";
-import type { SimplePageId } from "./bot-panel/page-registry";
import { BOT_PANEL_ID, sidePanelCls, useSidePanelLeave } from "./bot-panel/side-panel";
import { HistoryRollbackDialog, useBotHistory, useBotOverview } from "./bot-settings/useBotOverview";
import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";
import { ShareBotButton, useTeamName } from "./bot-access/ShareBotButton";
import { sameFields, useStoreDispatch, useStoreSelector } from "@/state/store-select";
-/** Where the Library's memory, skills and folder rows lead in Advanced settings. */
-const LIBRARY_LINKS: Partial<Record<SimplePageId, BotSettingsSection>> = { memory: "memory", skills: "skills", folder: "access" };
-
/** The avatar moves with every turn of the bot, so only this section follows its motion. */
function MovingIdentitySection(props: Omit<ComponentProps<typeof IdentitySection>, "mascotMotion">) {
const mascotMotion = useStoreSelector((state) => state.mascotMotion?.botId === props.bot.id ? state.mascotMotion : null);
@@ -141,7 +137,7 @@ export function BotSettingsDialog({ bot, overlay = false }: {
case "memory":
return <MemorySection bot={bot} active={!collapsed && section === "memory"} onToggle={(enabled) => derived.patch({ memoryEnabled: enabled })} />;
case "library":
- return <LibraryTab bot={bot} onOpen={(page) => dispatch({ type: "toggleSettings", open: true, section: LIBRARY_LINKS[page] ?? "overview" })} />;
+ return <LibraryTab bot={bot} />;
case "routines":
return <RoutinesSection bot={bot} routines={derived.botRoutines} runs={state.routineRuns} />;
case "access":
diff --git a/src/components/bot-panel/DetailsTab.tsx b/src/components/bot-panel/DetailsTab.tsx
index 6e36be417f..65af02411f 100644
--- a/src/components/bot-panel/DetailsTab.tsx
+++ b/src/components/bot-panel/DetailsTab.tsx
@@ -8,6 +8,7 @@ import { EffortRow, ModelPicker } from "../ModelPicker";
import type { SidebarMenuItem } from "../SidebarPopoverMenu";
import type { useBotSettingsDerived } from "../bot-settings/useBotSettingsDerived";
import { BotConversations } from "./Conversations";
+import { BotKeeps } from "./Keeps";
import type { SimplePageId } from "./page-registry";
import { Card, CardLabel, LabelAction, panelActionCls, NavRow, RowIcon, rowCls, RowText } from "./rows";
import { useStoreDispatch, useStoreSelector } from "@/state/store-select";
@@ -89,6 +90,8 @@ export function DetailsTab({ bot, derived, onOpen }: {
/>
</section>
+ <BotKeeps bot={bot} onOpen={onOpen} />
+
<BotConversations bot={bot} />
{conversationItems.length > 0 && (
diff --git a/src/components/bot-panel/Keeps.dom.test.ts b/src/components/bot-panel/Keeps.dom.test.ts
new file mode 100644
index 0000000000..62aaf61325
--- /dev/null
+++ b/src/components/bot-panel/Keeps.dom.test.ts
@@ -0,0 +1,60 @@
+// @vitest-environment happy-dom
+import { act, createElement } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+
+import type { Bot } from "@/state/store";
+
+const fixture = vi.hoisted(() => ({ skills: [] as unknown[], skillBurger: true }));
+vi.mock("./use-memory-doc", () => ({ useMemoryDoc: () => ({ docs: null, error: false }) }));
+vi.mock("../bot-settings/SkillsSection", async (importOriginal) => ({
+ ...await importOriginal<typeof import("../bot-settings/SkillsSection")>(),
+ useManagedSkills: () => ({ skills: fixture.skills, loading: false }),
+}));
+vi.mock("@/lib/use-feature", () => ({ useFeature: () => fixture.skillBurger }));
+
+const { BotKeeps } = await import("./Keeps");
+
+(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+const bot = { id: "scout", threadId: "t1", name: "Scout", messages: [], modelSelection: { instanceId: "x", model: "x" } } as unknown as Bot;
+let host: HTMLDivElement;
+let root: Root;
+
+beforeEach(() => {
+ fixture.skills = [];
+ fixture.skillBurger = true;
+ host = document.createElement("div");
+ document.body.append(host);
+ root = createRoot(host);
+});
+afterEach(() => {
+ act(() => root.unmount());
+ host.remove();
+});
+
+const render = async (onOpen: (page: string) => void = () => {}) => {
+ await act(async () => root.render(createElement(BotKeeps, { bot, onOpen })));
+};
+
+it("lists what it remembers, its skills and its folder, and each opens its page", async () => {
+ const opened: string[] = [];
+ await render((page) => opened.push(page));
+ const rows = [...host.querySelectorAll<HTMLButtonElement>("[data-panel-page]")];
+ expect(rows.map((row) => row.dataset.panelPage)).toEqual(["memory", "skills", "folder"]);
+ for (const row of rows) await act(async () => row.click());
+ expect(opened).toEqual(["memory", "skills", "folder"]);
+});
+
+it("counts a saved Skill Burger among the bot's skills only while Skill Burger is on", async () => {
+ fixture.skills = [
+ { name: "weekly-report", source: "skill-burger:scout", enabled: true },
+ { name: "tidy-notes", source: "conversation", enabled: true },
+ ];
+ await render();
+ expect(host.querySelector('[data-panel-page="skills"]')!.textContent).toContain("2");
+ fixture.skillBurger = false;
+ await render();
+ expect(host.querySelector('[data-panel-page="skills"]')!.textContent).toContain("1");
+ expect(host.querySelector('[data-panel-page="skills"]')!.textContent).not.toContain("2");
+});
diff --git a/src/components/bot-panel/Keeps.tsx b/src/components/bot-panel/Keeps.tsx
new file mode 100644
index 0000000000..e677d51390
--- /dev/null
+++ b/src/components/bot-panel/Keeps.tsx
@@ -0,0 +1,43 @@
+import { Brain, Folder, Zap } from "lucide-react";
+
+import { t } from "@/lib/i18n";
+import { useFeature } from "@/lib/use-feature";
+import { shortPath } from "@/lib/short-path";
+import type { Bot } from "@/state/store";
+import { isBurgerSource } from "../../../shared/skill-burger/saved";
+import { useDesktopCapabilities } from "../DesktopCapabilities";
+import { skillSwitchOn, useManagedSkills } from "../bot-settings/SkillsSection";
+import { panelMemoryNotes } from "./memory-notes";
+import type { SimplePageId } from "./page-registry";
+import { NavRow } from "./rows";
+import { useMemoryDoc } from "./use-memory-doc";
+
+/** What the bot keeps: its memory, its skills and its working folder, each a row that opens its page. */
+export function BotKeeps({ bot, onOpen }: { bot: Bot; onOpen: (page: SimplePageId) => void }) {
+ const { capabilities } = useDesktopCapabilities();
+ const skills = useManagedSkills(bot), skillBurger = useFeature("skillBurger");
+ const memory = useMemoryDoc(bot);
+ const skillsOn = skills.skills.filter((skill) => skillSwitchOn(skill) && (skillBurger || !isBurgerSource(skill.source))).length;
+ const remembers = memory.docs ? panelMemoryNotes(memory.docs).length > 0 || Boolean(memory.thread?.text.trim()) : null;
+ const memoryValue = bot.memoryEnabled === false ? t("botPanel.memory.off")
+ : remembers === false || (remembers === null && memory.error) ? t("botPanel.memory.nothingYet") : undefined;
+ return (
+ <section data-panel-card="keeps">
+ <NavRow data-panel-page="memory" icon={Brain} title={t("botPanel.memoryRow")} value={memoryValue} onClick={() => onOpen("memory")} />
+ <NavRow
+ data-panel-page="skills"
+ icon={Zap}
+ title={t("botSettings.simple.skills")}
+ value={skills.loading ? undefined : skillsOn > 0 ? skillsOn : t("botPanel.none")}
+ onClick={() => onOpen("skills")}
+ />
+ <NavRow
+ data-panel-page="folder"
+ icon={Folder}
+ title={t("computer.files.folder")}
+ value={bot.cwd ? shortPath(bot.cwd, capabilities.host?.homeDir) : t("botPanel.folder.private")}
+ onClick={() => onOpen("folder")}
+ />
+ </section>
+ );
+}
diff --git a/src/components/bot-panel/LibraryTab.dom.test.ts b/src/components/bot-panel/LibraryTab.dom.test.ts
index d29f42db9d..5ff2ada0b3 100644
--- a/src/components/bot-panel/LibraryTab.dom.test.ts
+++ b/src/components/bot-panel/LibraryTab.dom.test.ts
@@ -6,17 +6,11 @@ import { afterEach, beforeEach, expect, it, vi } from "vitest";
import type { BotLibrary } from "../../../shared/bot-library";
import type { Bot, Message } from "@/state/store";
-const fixture = vi.hoisted(() => ({ dispatch: vi.fn(), opened: [] as string[], skills: [] as unknown[], skillBurger: true }));
+const fixture = vi.hoisted(() => ({ dispatch: vi.fn(), opened: [] as string[] }));
vi.mock("@/state/store-select", async (importOriginal) => ({
...await importOriginal<typeof import("@/state/store-select")>(),
useStoreDispatch: () => fixture.dispatch,
}));
-vi.mock("./use-memory-doc", () => ({ useMemoryDoc: () => ({ docs: null, error: false }) }));
-vi.mock("../bot-settings/SkillsSection", async (importOriginal) => ({
- ...await importOriginal<typeof import("../bot-settings/SkillsSection")>(),
- useManagedSkills: () => ({ skills: fixture.skills, loading: false }),
-}));
-vi.mock("@/lib/use-feature", () => ({ useFeature: () => fixture.skillBurger }));
vi.mock("@/lib/page-open", () => ({ usePageOpener: () => (url: string) => fixture.opened.push(url) }));
const { LibraryTab, LIBRARY_SHOWN } = await import("./LibraryTab");
@@ -47,8 +41,6 @@ let root: Root;
beforeEach(() => {
fixture.dispatch.mockReset();
fixture.opened.length = 0;
- fixture.skills = [];
- fixture.skillBurger = true;
requests.length = 0;
library = {
pages: [
@@ -81,7 +73,7 @@ afterEach(() => {
const settle = () => act(async () => { for (let i = 0; i < 5; i += 1) await new Promise((resolve) => setTimeout(resolve, 0)); });
const rows = (kind: string) => [...host.querySelectorAll<HTMLElement>(`[data-panel-row="${kind}"]`)];
const render = async (bot: Bot) => {
- await act(async () => root.render(createElement(LibraryTab, { bot, onOpen: () => {} })));
+ await act(async () => root.render(createElement(LibraryTab, { bot })));
await settle();
};
@@ -96,7 +88,7 @@ it("lists what the bot made in every conversation, newest first, each with the c
expect(files).toContain("Old notes");
expect(host.textContent).not.toContain("Gone page");
expect(host.textContent).not.toContain("From this conversation");
- expect(host.querySelector('[data-panel-page="memory"]')).not.toBeNull();
+ expect(host.querySelector("[data-panel-page]")).toBeNull();
});
it("opens a page by its link, and an app from another conversation at its message there", async () => {
@@ -133,16 +125,3 @@ it("shows the newest few of a long group, then Show all opens the rest in place"
expect(host.querySelector('[data-library-more="apps"]')).toBeNull();
expect(host.querySelector('[data-library-more="pages"]')).toBeNull();
});
-
-it("counts a saved Skill Burger among the bot's skills only while Skill Burger is on", async () => {
- fixture.skills = [
- { name: "weekly-report", source: "skill-burger:scout", enabled: true },
- { name: "tidy-notes", source: "conversation", enabled: true },
- ];
- await render(makeBot());
- expect(host.querySelector('[data-panel-page="skills"]')!.textContent).toContain("2");
- fixture.skillBurger = false;
- await render(makeBot());
- expect(host.querySelector('[data-panel-page="skills"]')!.textContent).toContain("1");
- expect(host.querySelector('[data-panel-page="skills"]')!.textContent).not.toContain("2");
-});
diff --git a/src/components/bot-panel/LibraryTab.tsx b/src/components/bot-panel/LibraryTab.tsx
index 68d85ea04b..169bdea1af 100644
--- a/src/components/bot-panel/LibraryTab.tsx
+++ b/src/components/bot-panel/LibraryTab.tsx
@@ -1,21 +1,13 @@
-import { AppWindow, Brain, ChevronDown, FileText, Folder, Globe, Zap } from "lucide-react";
+import { AppWindow, ChevronDown, FileText, Globe } from "lucide-react";
import { useMemo, useState, type ReactNode } from "react";
import { t } from "@/lib/i18n";
-import { useFeature } from "@/lib/use-feature";
-import { isBurgerSource } from "../../../shared/skill-burger/saved";
import { usePageOpener } from "@/lib/page-open";
-import { shortPath } from "@/lib/short-path";
import { useShowThreads } from "@/lib/thread-preferences";
import { SIDEBAR_INLINE, useMediaQuery } from "@/lib/use-media-query";
import { openBotThread, type Bot } from "@/state/store";
import { AttachedFileChip } from "../AttachmentPreview";
-import { useDesktopCapabilities } from "../DesktopCapabilities";
-import { skillSwitchOn, useManagedSkills } from "../bot-settings/SkillsSection";
-import type { SimplePageId } from "./page-registry";
import { Card, CardLabel, NavRow } from "./rows";
-import { panelMemoryNotes } from "./memory-notes";
-import { useMemoryDoc } from "./use-memory-doc";
import { useStoreDispatch } from "@/state/store-select";
import { allLibraryItems, libraryItems, threadLabel } from "./library-items";
import { useBotLibrary } from "./use-bot-library";
@@ -35,13 +27,10 @@ function ShowAll({ group, onClick }: { group: string; onClick: () => void }) {
);
}
-export function LibraryTab({ bot, onOpen }: { bot: Bot; onOpen: (page: SimplePageId) => void }) {
+export function LibraryTab({ bot }: { bot: Bot }) {
const dispatch = useStoreDispatch();
- const { capabilities } = useDesktopCapabilities();
const openPage = usePageOpener();
const phone = !useMediaQuery(SIDEBAR_INLINE, true);
- const skills = useManagedSkills(bot), skillBurger = useFeature("skillBurger");
- const memory = useMemoryDoc(bot);
const showThreads = useShowThreads();
const remote = useBotLibrary(bot);
const local = useMemo(() => libraryItems(bot), [bot]);
@@ -55,29 +44,6 @@ export function LibraryTab({ bot, onOpen }: { bot: Bot; onOpen: (page: SimplePag
dispatch({ type: "focusMessage", threadId, messageId });
if (phone) dispatch({ type: "toggleSettings", open: false });
};
- const skillsOn = skills.skills.filter((skill) => skillSwitchOn(skill) && (skillBurger || !isBurgerSource(skill.source))).length;
- const remembers = memory.docs ? panelMemoryNotes(memory.docs).length > 0 || Boolean(memory.thread?.text.trim()) : null;
- const memoryValue = bot.memoryEnabled === false ? t("botPanel.memory.off")
- : remembers === false || (remembers === null && memory.error) ? t("botPanel.memory.nothingYet") : undefined;
- const keeps = (
- <Card anchor="keeps">
- <NavRow data-panel-page="memory" icon={Brain} title={t("botPanel.memoryRow")} value={memoryValue} onClick={() => onOpen("memory")} />
- <NavRow
- data-panel-page="skills"
- icon={Zap}
- title={t("botSettings.simple.skills")}
- value={skills.loading ? undefined : skillsOn > 0 ? skillsOn : t("botPanel.none")}
- onClick={() => onOpen("skills")}
- />
- <NavRow
- data-panel-page="folder"
- icon={Folder}
- title={t("computer.files.folder")}
- value={bot.cwd ? shortPath(bot.cwd, capabilities.host?.homeDir) : t("botPanel.folder.private")}
- onClick={() => onOpen("folder")}
- />
- </Card>
- );
if (pages.length + apps.length + shared.length + unshared.length === 0) {
return (
@@ -85,7 +51,6 @@ export function LibraryTab({ bot, onOpen }: { bot: Bot; onOpen: (page: SimplePag
<p data-panel-empty="library" className="px-3 py-7 text-center text-[13px] leading-[18px] text-ink-tertiary">
{t("botPanel.library.empty")}
</p>
- {keeps}
</div>
);
}
@@ -130,7 +95,6 @@ export function LibraryTab({ bot, onOpen }: { bot: Bot; onOpen: (page: SimplePag
{more("files", [...shared, ...unshared])}
</section>
)}
- {keeps}
</div>
);
}
diff --git a/src/components/bot-panel/MemoryPage.team.test.ts b/src/components/bot-panel/MemoryPage.team.test.ts
index e3fd39abb1..82289047c7 100644
--- a/src/components/bot-panel/MemoryPage.team.test.ts
+++ b/src/components/bot-panel/MemoryPage.team.test.ts
@@ -12,7 +12,7 @@ vi.mock("@/state/store", async (importOriginal) => {
});
const { MemoryPage } = await import("./pages");
-const { LibraryTab } = await import("./LibraryTab");
+const { BotKeeps } = await import("./Keeps");
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
const bot = { id: "scout", threadId: "t1", name: "Scout", title: "", description: "", notifications: true, color: "green", unread: false, messages: [],
@@ -84,13 +84,13 @@ it("on a Team Cloud shows the person's own notes, topics included, as text they
}
});
-it("shows no count on the Library tab, only whether it remembers anything", async () => {
- await act(async () => root.render(createElement(LibraryTab, { bot, onOpen: () => {} })));
+it("shows no count on the Details tab, only whether it remembers anything", async () => {
+ await act(async () => root.render(createElement(BotKeeps, { bot, onOpen: () => {} })));
await settle();
expect(host.querySelector('[data-panel-page="memory"]')?.textContent).toBe("What it remembers");
files["memory/food.md"] = "";
files["MEMORY.md"] = "";
- await act(async () => root.render(createElement(LibraryTab, { bot: { ...bot, threadId: "t2" }, onOpen: () => {} })));
+ await act(async () => root.render(createElement(BotKeeps, { bot: { ...bot, threadId: "t2" }, onOpen: () => {} })));
await settle();
expect(host.querySelector('[data-panel-page="memory"]')?.textContent).toContain("Nothing yet");
});
diff --git a/src/components/bot-panel/PanelShell.dom.test.ts b/src/components/bot-panel/PanelShell.dom.test.ts
index 06e9675baf..c04984a752 100644
--- a/src/components/bot-panel/PanelShell.dom.test.ts
+++ b/src/components/bot-panel/PanelShell.dom.test.ts
@@ -312,10 +312,10 @@ describe("Escape in the bot panel", () => {
back?.focus();
const event = press(back, "Escape");
expect(event.defaultPrevented).toBe(true);
- expect([tab(), page()]).toEqual(["library", null]);
+ expect([tab(), page()]).toEqual(["details", null]);
expect(dialogCloses).not.toHaveBeenCalled();
// On a tab, Escape is the dialog's: it closes the panel.
- press(host.querySelector('[data-panel-tab="library"]'), "Escape");
+ press(host.querySelector('[data-panel-tab="details"]'), "Escape");
expect(dialogCloses).toHaveBeenCalledTimes(1);
});
@@ -340,7 +340,7 @@ describe("Escape in the bot panel", () => {
expect(menu()).toBeNull();
expect(page()).toBe("skills");
press(moreButton(), "Escape");
- expect([tab(), page()]).toEqual(["library", null]);
+ expect([tab(), page()]).toEqual(["details", null]);
expect(dialogCloses).not.toHaveBeenCalled();
});
});
diff --git a/src/components/bot-panel/PanelShell.tsx b/src/components/bot-panel/PanelShell.tsx
index 3bfb25e238..cd6ce94788 100644
--- a/src/components/bot-panel/PanelShell.tsx
+++ b/src/components/bot-panel/PanelShell.tsx
@@ -158,7 +158,7 @@ export function BotPanel({ bot, derived, linkedSection, onClose }: {
</div>
<div role="tabpanel">
{tab === "details" && <DetailsTab bot={bot} derived={derived} onOpen={openPage} />}
- {tab === "library" && <LibraryTab bot={bot} onOpen={openPage} />}
+ {tab === "library" && <LibraryTab bot={bot} />}
{tab === "computer" && <ComputerTab bot={bot} derived={derived} onOpen={openPage} />}
</div>
</>
diff --git a/src/components/bot-panel/page-registry.test.ts b/src/components/bot-panel/page-registry.test.ts
index 92c0740638..bdc20c8678 100644
--- a/src/components/bot-panel/page-registry.test.ts
+++ b/src/components/bot-panel/page-registry.test.ts
@@ -23,19 +23,19 @@ describe("the bot panel's page registry", () => {
it.each([
["overview", { tab: "details" }], ["identity", { tab: "details" }],
["soul", { tab: "details", page: "settings", anchor: "instructions", editInstructions: true }],
- ["skills", { tab: "library", page: "skills" }], ["memory", { tab: "library", page: "memory" }], ["routines", { tab: "details", page: "routines" }],
+ ["skills", { tab: "details", page: "skills" }], ["memory", { tab: "details", page: "memory" }], ["routines", { tab: "details", page: "routines" }],
["access", { tab: "computer" }], ["model", { tab: "details", anchor: "model" }], ["permissions", { tab: "details", page: "settings", anchor: "approval" }],
["voice", { tab: "details" }], ["visibility", { tab: "details" }], ["history", { tab: "details" }], ["usage", { tab: "details" }], ["slack", { tab: "details" }],
] as const)("sends a %s link to %o", (section, target) => {
expect(sectionTarget(section)).toEqual(target);
});
- it("draws the Simple pages on their tabs: settings on Details, what it keeps on Library, where it works on Computer", () => {
+ it("draws the Simple pages on their tabs: settings and what it keeps on Details, where it works on Computer", () => {
expect(SIMPLE_PAGES).toEqual(["settings", "apps", "routines", "visibility", "memory", "skills", "folder", "browser", "where"]);
const home = Object.fromEntries(SIMPLE_PAGES.map((page) => [page, PAGES[page].home]));
expect(home).toEqual({
settings: "details", apps: "details", routines: "details", visibility: "details",
- memory: "library", skills: "library", folder: "library",
+ memory: "details", skills: "details", folder: "details",
browser: "computer", where: "computer",
});
expect(isSimplePage("mcp")).toBe(false);
diff --git a/src/components/bot-panel/page-registry.ts b/src/components/bot-panel/page-registry.ts
index a1eeb6f811..7f2780d8f4 100644
--- a/src/components/bot-panel/page-registry.ts
+++ b/src/components/bot-panel/page-registry.ts
@@ -41,10 +41,10 @@ export const PAGES: Record<PageId, PageMeta> = {
approvals: { title: "botPanel.page.approvals", home: "details" },
routines: { title: "botSettings.simple.routines", home: "details" },
apps: { title: "botPanel.appsRow", home: "details", intro: "botPanel.apps.intro" },
- memory: { title: "botPanel.memoryRow", home: "library" },
- skills: { title: "botSettings.simple.skills", home: "library", intro: "botSettings.simple.skillsHint" },
+ memory: { title: "botPanel.memoryRow", home: "details" },
+ skills: { title: "botSettings.simple.skills", home: "details", intro: "botSettings.simple.skillsHint" },
browser: { title: "settings.sites.title", home: "computer" },
- folder: { title: "computer.files.folder", home: "library", intro: "botPanel.folder.intro" },
+ folder: { title: "computer.files.folder", home: "details", intro: "botPanel.folder.intro" },
android: { title: "botPanel.page.android", home: "computer" },
voice: { title: "botPanel.page.voice", home: "details" },
blurb: { title: "botPanel.page.blurb", home: "details" },
@@ -76,8 +76,8 @@ const SECTION_TARGET: Record<BotSettingsSection, PanelTarget> = {
identity: { tab: "details" },
slack: { tab: "details" },
soul: { tab: "details", page: "settings", anchor: "instructions", editInstructions: true },
- skills: { tab: "library", page: "skills" },
- memory: { tab: "library", page: "memory" },
+ skills: { tab: "details", page: "skills" },
+ memory: { tab: "details", page: "memory" },
library: { tab: "library" },
routines: { tab: "details", page: "routines" },
access: { tab: "computer" },
diff --git a/src/components/bot-panel/panel-link.test.ts b/src/components/bot-panel/panel-link.test.ts
index 39d572b091..a8565af559 100644
--- a/src/components/bot-panel/panel-link.test.ts
+++ b/src/components/bot-panel/panel-link.test.ts
@@ -22,7 +22,7 @@ describe("named links into a bot's settings", () => {
it("lands the access callers on the Simple page that holds what they are about, else on the Computer tab", () => {
expect(linkTarget("access", link({ section: "access", page: "apps" }))).toEqual({ tab: "details", page: "apps" });
- expect(linkTarget("access", link({ section: "access", page: "folder" }))).toEqual({ tab: "library", page: "folder" });
+ expect(linkTarget("access", link({ section: "access", page: "folder" }))).toEqual({ tab: "details", page: "folder" });
// MCP servers are listed on the apps page; Simple mode has no tool-selection page, so that link opens the Computer tab.
expect(linkTarget("access", link({ section: "access", page: "mcp" }))).toEqual({ tab: "details", page: "apps" });
expect(linkTarget("access", link({ section: "access", page: "tools" }))).toEqual({ tab: "computer" });