Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Sidebar threads peek: list a snoozed conversation when its snooze ends
luishron1231599d3d8d5fe
diff --git a/src/components/SidebarBotThreadsPeek.dom.test.ts b/src/components/SidebarBotThreadsPeek.dom.test.tsindex db4b3fd09e..f4cf783319 100644--- a/src/components/SidebarBotThreadsPeek.dom.test.ts+++ b/src/components/SidebarBotThreadsPeek.dom.test.ts@@ -194,6 +194,19 @@ describe("the hover sheet of a bot's other conversations", () => {expect(watchers.filter((entry) => entry.live)).toEqual([]);});+ it("lists a snoozed conversation once its snooze ends, with nothing else changing", async () => {+ const tasks = [task("a", { snoozedUntil: Date.now() + 60_000 })];+ await mount(tasks);+ expect(row.querySelector("[data-bot-new-thread]")).not.toBeNull();+ expect(row.querySelector("[data-bot-threads-peek]")).toBeNull();+ await wait(60_000);+ expect(row.querySelector("[data-bot-threads-peek]")).toBeNull();+ await wait(1);+ expect(row.querySelector("[data-bot-new-thread]")).toBeNull();+ await open();+ expect([...sheet()!.querySelectorAll<HTMLElement>("[data-peek-thread]")].map((entry) => entry.dataset.peekThread)).toEqual(["main", "a"]);+ });+it("offers neither action for a conversation that is working", async () => {await mount([task("a", { busy: true })]);await open();diff --git a/src/components/SidebarBotThreadsPeek.tsx b/src/components/SidebarBotThreadsPeek.tsxindex 24c9086d65..872ed0e197 100644--- a/src/components/SidebarBotThreadsPeek.tsx+++ b/src/components/SidebarBotThreadsPeek.tsx@@ -11,7 +11,7 @@ import { botOpensTo } from "@/state/thread-navigation";import { ConfirmDialog } from "./ConfirmDialog";import { MENU_GUTTER, MENU_ICON, MENU_META, MENU_ROW, MENU_SEPARATOR, MENU_SHEET } from "./menu-recipe";import { useHeldMenuMotion } from "./MenuMotion";-import { isArchived, isSnoozed, isWorking, threadRecency, threadRowActions, threadUpdatedLabel } from "./SidebarThreadRow";+import { isArchived, isSnoozed, isWorking, nextSnoozeExpiry, threadRecency, threadRowActions, threadUpdatedLabel, useSnoozeExpiry } from "./SidebarThreadRow";export const PEEK_LIMIT = 3;/** Long enough that sweeping the pointer down the list opens nothing. */@@ -53,7 +53,11 @@ const ROW_TIME_YIELDS = "transition-opacity group-hover/peek:opacity-0 group-focexport function SidebarBotThreadsPeek({ bot, onScreen = false, dispatch }: { bot: PeekBot; onScreen?: boolean; dispatch: Dispatch<Action> }) {const main = botOpensTo(bot, false), current = onScreen ? bot.switchingTo ?? bot.threadId : undefined;- const threads = useMemo(() => peekThreads(bot, current), [bot.tasks, bot.mainThreadId, bot.threadId, current]);+ const tasks = bot.tasks ?? [];+ useSnoozeExpiry(tasks);+ // A snooze ends by the clock alone, so the nearest deadline still ahead stands in for it.+ const wake = nextSnoozeExpiry(tasks);+ const threads = useMemo(() => peekThreads(bot, current), [bot.tasks, bot.mainThreadId, bot.threadId, current, wake]);const others = threads.filter((task) => task.threadId !== main).length;const [place, setPlace] = useState<Place | null>(null);const motion = useHeldMenuMotion(place);