Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Mark the displayed conversation in the recent sidebar
vincentb83e14bc296e
diff --git a/src/components/Sidebar.recent-conversations.dom.test.ts b/src/components/Sidebar.recent-conversations.dom.test.tsindex 16ec00618e..7564a869d8 100644--- a/src/components/Sidebar.recent-conversations.dom.test.ts+++ b/src/components/Sidebar.recent-conversations.dom.test.ts@@ -45,10 +45,10 @@ afterEach(async () => {vi.unstubAllGlobals();});-async function render(bots: Bot[]) {+async function render(bots: Bot[], state: Partial<typeof initialState> = {}) {await act(async () => root.render(createElement(BotEditorStore, {value: {- state: { ...initialState, connected: true, bots, groups: [room], selectedId: "Scout", activeView: "chat" },+ state: { ...initialState, connected: true, bots, groups: [room], selectedId: "Scout", activeView: "chat", ...state },dispatch, flushBotPatches: async () => null, refreshInstances: async () => {}, refreshModels: async () => {},},children: createElement(Sidebar, { open: true, onClose }),@@ -100,3 +100,14 @@ it.each([false, true])("shows cross-department activity and opens the exact convawait act(async () => toggle.click());expect(order()).toEqual(["Scout-main", "Builder-main", "launch-plan"]);});++it("marks the displayed room thread and clears the previous selection while drafting", async () => {+ const scout = bot("Scout", "Research", 10);+ await render([scout], { newChat: { botId: "Scout", session: 1, held: [] } });+ expect(rows().some((row) => row.hasAttribute("aria-current"))).toBe(false);+ await render([scout], { selectedId: room.id, forkPanel: {+ kind: "group", ownerId: room.id, threadId: "launch-plan", messages: [], activeLeafId: null,+ loading: false, loadId: "load", loadFailed: false,+ } });+ expect(rows().find((row) => row.dataset.sidebarRecentThread === "launch-plan")?.getAttribute("aria-current")).toBe("page");+});diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex 5a872d7317..9e20cb9995 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -1352,7 +1352,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =<BotListItem {...botRow(unsectionedChief)} /></div>))}- {!q && density !== "icons" && <SidebarRecentConversations bots={sideLists.bots} groups={sideLists.groups} routineRuns={state.routineRuns} viewerEmail={viewerEmail} welcoming={welcoming} selectedId={state.activeView === "chat" ? state.selectedId : null} onOpen={(target) => { if (openThread(dispatch, target, state, showThreads) && phone) onClose(); }} />}+ {!q && density !== "icons" && <SidebarRecentConversations bots={sideLists.bots} groups={sideLists.groups} routineRuns={state.routineRuns} viewerEmail={viewerEmail} welcoming={welcoming} selectedId={state.activeView === "chat" && state.newChat?.botId !== state.selectedId ? state.selectedId : null} onOpen={(target) => { if (openThread(dispatch, target, state, showThreads) && phone) onClose(); }} />}{sectionIds.map((id, index) => {const sectionName = userSectionName(id), editable = oneList?.mirror ? null : sectionName;const sectionChiefItems = sectionNamediff --git a/src/components/SidebarRecentConversations.tsx b/src/components/SidebarRecentConversations.tsxindex b3b3f8a9d5..e839173349 100644--- a/src/components/SidebarRecentConversations.tsx+++ b/src/components/SidebarRecentConversations.tsx@@ -1,4 +1,5 @@import { useMemo, useState } from "react";+import { useStoreSelector } from "@/state/store-select";import { ChevronRight } from "lucide-react";import { cn } from "@/lib/cn";import { hiddenFromSidebar } from "@/lib/default-bot";@@ -21,6 +22,7 @@ export function SidebarRecentConversations({ bots, groups, routineRuns, viewerEmselectedId: string | null;onOpen: (target: ThreadTarget) => void;}) {+ const openRoomThread = useStoreSelector((state) => state.forkPanel?.kind === "group" && state.forkPanel.ownerId === selectedId ? state.forkPanel.threadId : null);const [expanded, setExpanded] = useState(true);const entries = useMemo(() => {const runThreads = new Set(routineRuns?.map((run) => run.threadId));@@ -45,7 +47,7 @@ export function SidebarRecentConversations({ bots, groups, routineRuns, viewerEm<span className="truncate">{label}</span></button>{expanded && entries.map(({ owner, task }) => {- const current = selectedId === owner.id && task.threadId === owner.threadId;+ const current = selectedId === owner.id && task.threadId === (openRoomThread ?? owner.threadId);const title = task.title ? localizedTaskTitle(task.title) : t("task.untitledChat");return <button key={`${owner.id}:${task.threadId}`} type="button" data-sidebar-recent-thread={task.threadId}aria-current={current ? "page" : undefined} title={`${title} · ${owner.name}`}