Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Room chip reads the store only where one is drawn; tests follow openThread's reveal
milind-soni9f928b645581
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsxindex ecf5b33051..e408d85760 100644--- a/src/components/ChatView.tsx+++ b/src/components/ChatView.tsx@@ -632,18 +632,16 @@ function PeerLabel({ peer }: { peer: PeerLine }) {}const ActivityChip = memo(function ActivityChip({ message, place = "auto" }: { message: Message; place?: EffectivePlace }) {- const { bots, dispatch, threadId } = useChatRows(), liveTools = use(LiveToolsContext), store = useStoreRef();+ const { bots, dispatch, threadId } = useChatRows(), liveTools = use(LiveToolsContext);const tool = message.tool;if (!tool) return null;if (message.threadRef) return <ThreadChip message={message} />; if (message.relay) return <TeammateChip message={message} />;const comm = message.comm;- if (comm) {- return <HandoffChip message={message} bots={bots} title={t("chat.openConversationWith", { name: comm.withName })}- onClick={() => openRoomThread(dispatch, comm, store.state().groups)} />;- }+ if (comm) return <RoomHandoffChip message={message} comm={comm} bots={bots} dispatch={dispatch} />;return <ToolActivity tool={tool} live={liveTools.has(message.id)} place={toolPlace(tool.name, place)} source={{ threadId, messageId: message.id }} />;});+const RoomHandoffChip = ({ message, comm, bots, dispatch }: { message: Message; comm: NonNullable<Message["comm"]>; bots: readonly Bot[]; dispatch: Dispatch<Action> }) => { const store = useStoreRef(); return <HandoffChip message={message} bots={bots} title={t("chat.openConversationWith", { name: comm.withName })} onClick={() => openRoomThread(dispatch, comm, store.state().groups)} />; };const MessagesList = memo(function MessagesList({messages,transcript,diff --git a/src/components/RoutineResultsNavigation.test.ts b/src/components/RoutineResultsNavigation.test.tsindex a15f4cc912..4ccaa9a8a7 100644--- a/src/components/RoutineResultsNavigation.test.ts+++ b/src/components/RoutineResultsNavigation.test.ts@@ -100,20 +100,21 @@ describe("routine results navigation", () => {expect(fixture.dispatch.mock.calls).toEqual([[{ type: "select", id: bot.id }],[{ type: "switchTask", botId: bot.id, threadId: "original-source" }],+ [{ type: "revealThread", threadId: "original-source" }],]);expect(onClose).toHaveBeenCalledOnce();});it("uses the definition's destination only for a definition-only view", () => {details(null).buttons.get("Open results thread")!.onClick!();- expect(fixture.dispatch).toHaveBeenLastCalledWith({ type: "switchTask", botId: bot.id, threadId: "new-results" });+ expect(fixture.dispatch).toHaveBeenCalledWith({ type: "switchTask", botId: bot.id, threadId: "new-results" });});it("opens the bot's main thread for a definition with no thread of its own, never for a run", () => {const { resultsThreadId: _chosen, ...unchosen } = routine;fixture.state!.bots = [{ ...bot, mainThreadId: "original-source" }];details(null, unchosen).buttons.get("Open results thread")!.onClick!();- expect(fixture.dispatch).toHaveBeenLastCalledWith({ type: "switchTask", botId: bot.id, threadId: "original-source" });+ expect(fixture.dispatch).toHaveBeenCalledWith({ type: "switchTask", botId: bot.id, threadId: "original-source" });expect(details({ ...run, sourceThreadId: undefined }, unchosen).buttons.has("Open results thread")).toBe(false);});@@ -127,6 +128,7 @@ describe("routine results navigation", () => {expect(fixture.dispatch.mock.calls).toEqual([[{ type: "select", id: group.id }],[{ type: "switchGroupTask", groupId: group.id, threadId: "original-room-source" }],+ [{ type: "revealThread", threadId: "original-room-source" }],]);});@@ -138,6 +140,7 @@ describe("routine results navigation", () => {expect(fixture.dispatch.mock.calls).toEqual([[{ type: "select", id: group.id }],[{ type: "switchGroupTask", groupId: group.id, threadId: "original-room-source" }],+ [{ type: "revealThread", threadId: "original-room-source" }],]);});@@ -145,7 +148,7 @@ describe("routine results navigation", () => {fixture.showThreads = false;const { buttons } = details();buttons.get("Open results thread")!.onClick!();- expect(fixture.dispatch.mock.calls).toEqual([[{ type: "switchTask", botId: bot.id, threadId: "original-source" }]]);+ expect(fixture.dispatch.mock.calls).toEqual([[{ type: "switchTask", botId: bot.id, threadId: "original-source" }], [{ type: "revealThread", threadId: "original-source" }]]);fixture.dispatch.mockClear();fixture.state!.bots = [{ ...bot, threadId: "new-results" }];details().buttons.get("Open thread")!.onClick!();diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex dd39e8a939..3f4ca93c52 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -2,10 +2,11 @@ import { OrganizationIdentity } from "./OrganizationIdentity";import { memo, useCallback, useEffect, useMemo, useRef, useState, type CSSProperties, type Dispatch } from "react";import { createPortal } from "react-dom";import { Activity, Archive, Bot as BotIcon, Check, ChevronRight, ClipboardCopy, Crown, FolderPlus, Library, Loader2, MessageSquarePlus, MoreHorizontal, Pencil, Phone, Pin, PinOff, Plus, Search, TextQuote, Trash2, Users, X } from "lucide-react";-import { api, useStore, formatTime, visibleMessages, currentTaskBot, botOpensTo, openBot, openBotRow, openThread, type Action, type AppState, type Bot, type BotProject, type Group, type InstanceInfo, type Message } from "@/state/store";+import { api, useStore, formatTime, visibleMessages, currentTaskBot, botOpensTo, openBot, openThread, type Action, type AppState, type Bot, type BotProject, type Group, type InstanceInfo, type Message } from "@/state/store";import { approvalModeFor } from "../../shared/approval-mode";import { liveActivityLabel } from "@/lib/live-activity";import { SidebarWorkingStep } from "./SidebarWorkingStep";+import { openBotRow } from "@/state/thread-navigation";import { llmThreadTitlesEnabled } from "@/lib/feature-flags";import { BotAvatar } from "./Avatar";