Skip to content

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

Features: with Skill Burger off, the bot panel's Skills count leaves saved burgers out

milind-sonicdb50f455b49
diff --git a/src/components/bot-panel/LibraryTab.dom.test.ts b/src/components/bot-panel/LibraryTab.dom.test.ts
index ea658a8ab9..d29f42db9d 100644
--- a/src/components/bot-panel/LibraryTab.dom.test.ts
+++ b/src/components/bot-panel/LibraryTab.dom.test.ts
@@ -6,7 +6,7 @@ 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[] }));
+const fixture = vi.hoisted(() => ({ dispatch: vi.fn(), opened: [] as string[], skills: [] as unknown[], skillBurger: true }));
vi.mock("@/state/store-select", async (importOriginal) => ({
...await importOriginal<typeof import("@/state/store-select")>(),
useStoreDispatch: () => fixture.dispatch,
@@ -14,8 +14,9 @@ vi.mock("@/state/store-select", async (importOriginal) => ({
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: [], loading: false }),
+ 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");
@@ -46,6 +47,8 @@ let root: Root;
beforeEach(() => {
fixture.dispatch.mockReset();
fixture.opened.length = 0;
+ fixture.skills = [];
+ fixture.skillBurger = true;
requests.length = 0;
library = {
pages: [
@@ -130,3 +133,16 @@ 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 8ccad1e098..68d85ea04b 100644
--- a/src/components/bot-panel/LibraryTab.tsx
+++ b/src/components/bot-panel/LibraryTab.tsx
@@ -2,6 +2,8 @@ import { AppWindow, Brain, ChevronDown, FileText, Folder, Globe, Zap } from "luc
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";
@@ -38,7 +40,7 @@ export function LibraryTab({ bot, onOpen }: { bot: Bot; onOpen: (page: SimplePag
const { capabilities } = useDesktopCapabilities();
const openPage = usePageOpener();
const phone = !useMediaQuery(SIDEBAR_INLINE, true);
- const skills = useManagedSkills(bot);
+ const skills = useManagedSkills(bot), skillBurger = useFeature("skillBurger");
const memory = useMemoryDoc(bot);
const showThreads = useShowThreads();
const remote = useBotLibrary(bot);
@@ -53,7 +55,7 @@ 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(skillSwitchOn).length;
+ 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;