Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Bot panel: ended conversations leave the list for a folded Ended (N) group under the active ones
luishron123873660d33306
diff --git a/src/components/bot-panel/Conversations.dom.test.ts b/src/components/bot-panel/Conversations.dom.test.tsindex 582f6ec074..8335053d88 100644--- a/src/components/bot-panel/Conversations.dom.test.ts+++ b/src/components/bot-panel/Conversations.dom.test.ts@@ -361,4 +361,31 @@ describe("a bot's conversations in its panel", () => {click(unarchive);expect(fixture.dispatch.mock.calls).toEqual([[{ type: "updateTask", botId: "research", threadId: "deck", patch: { archivedAt: null } }]]);});+ it("moves ended conversations out of the list into Ended (N), folded under the active ones", () => {+ const lead = { botId: "lead", name: "Lead", at: now };+ const endedTasks = tasks.map((task) => task.threadId === "launch" || task.threadId === "pricing" ? { ...task, busy: false, activity: undefined, closedBy: lead } : task);+ render(research({ tasks: endedTasks }));+ expect(listed()).toEqual(["hiring", "who", "deck"]);+ const toggle = host.querySelector("[data-conversations-ended]")!;+ expect(toggle.textContent).toBe("Ended (2)");+ expect(toggle.getAttribute("aria-expanded")).toBe("false");+ expect(host.querySelector("[data-conversations-more]")!.textContent).toBe("Show 5 more");+ click(toggle);+ expect(toggle.getAttribute("aria-expanded")).toBe("true");+ expect(listed()).toEqual(["hiring", "who", "deck", "launch", "pricing"]);+ click(toggle);+ expect(listed()).toEqual(["hiring", "who", "deck"]);+ });++ it("keeps an ended conversation in the list while it is open or the main one, and finds ended ones in search", () => {+ const lead = { botId: "lead", name: "Lead", at: now };+ const endedTasks = tasks.map((task) => ["who", "gift", "deck"].includes(task.threadId) ? { ...task, closedBy: lead } : task);+ render(research({ mainThreadId: "gift", tasks: endedTasks }));+ expect(listed()).toEqual(["gift", "hiring", "launch", "who"]);+ expect(host.querySelector("[data-conversations-ended]")!.textContent).toBe("Ended (1)");+ click(host.querySelector("[data-conversations-search]"));+ type(host.querySelector<HTMLInputElement>("[data-conversations-query]")!, "board");+ expect(listed()).toEqual(["deck"]);+ expect(host.querySelector("[data-conversations-ended]")).toBeNull();+ });});diff --git a/src/components/bot-panel/Conversations.tsx b/src/components/bot-panel/Conversations.tsxindex be39948dca..776561d01f 100644--- a/src/components/bot-panel/Conversations.tsx+++ b/src/components/bot-panel/Conversations.tsx@@ -80,6 +80,7 @@ export function BotConversations({ bot }: { bot: Bot }) {return () => { showAllListeners.delete(listener); };}, [bot.id]);const [showArchived, setShowArchived] = useState(false);+ const [showEnded, setShowEnded] = useState(false);const actions = useMemo(() => {const { onRename, onRegenerateTitle, onDelete, onMove, onPin, onSetMain, onArchive, onMemory } = threadRowActions(bot.id, dispatch);return { onRename, onRegenerateTitle, onDelete, onMove, onPin, onSetMain, onArchive, onMemory };@@ -96,18 +97,21 @@ export function BotConversations({ bot }: { bot: Bot }) {turnStartedAt: thread.turnStartedAt ?? undefined, queued: Boolean(state.pendingQueued[task.threadId]?.length),};});- const conversations = mainThreadFirst(orderedThreadList(threads.filter((task) => !isArchived(task) || task.threadId === bot.threadId)), bot.mainThreadId);- const archived = orderedThreadList(threads.filter((task) => isArchived(task) && task.threadId !== bot.threadId));+ const kept = (task: (typeof threads)[number]) => task.threadId === bot.threadId || task.threadId === bot.mainThreadId;+ const conversations = mainThreadFirst(orderedThreadList(threads.filter((task) => kept(task) || (!isArchived(task) && !task.closedBy))), bot.mainThreadId);+ const ended = orderedThreadList(threads.filter((task) => !kept(task) && !isArchived(task) && Boolean(task.closedBy)));+ const archived = orderedThreadList(threads.filter((task) => isArchived(task) && !kept(task)));const needle = query.trim();const collapsed = conversations.filter((task, index) => index < CONVERSATIONS_SHOWN || task.threadId === bot.threadId || task.threadId === bot.mainThreadId);- const recent = useRecentMessages(bot, [...(needle || expanded ? conversations : collapsed), ...(showArchived ? archived : [])]);+ const recent = useRecentMessages(bot, [...(needle || expanded ? conversations : collapsed), ...(needle || showEnded ? ended : []), ...(showArchived ? archived : [])]);const preview = (threadId: string) => {const messages = recent(threadId);return messages ? lastLine(currentTaskBot(bot, threadId), messages, state.instances, false) : undefined;};- const byTitle = filterTasks(conversations, needle);+ const searched = [...conversations, ...ended];+ const byTitle = filterTasks(searched, needle);const matches = needle- ? [...byTitle, ...conversations.filter((task) => !byTitle.includes(task) && preview(task.threadId)?.toLowerCase().includes(needle.toLowerCase()))]+ ? [...byTitle, ...searched.filter((task) => !byTitle.includes(task) && preview(task.threadId)?.toLowerCase().includes(needle.toLowerCase()))]: conversations;const shown = needle ? matches : expanded ? conversations : collapsed;const hidden = conversations.length - collapsed.length;@@ -207,6 +211,23 @@ export function BotConversations({ bot }: { bot: Bot }) {{expanded ? t("botPanel.conversations.showFewer") : t("botPanel.conversations.showMore", { count: hidden })}</button>)}+ {!needle && ended.length > 0 && (+ <button+ type="button"+ data-conversations-ended+ aria-expanded={showEnded}+ onClick={() => setShowEnded((open) => !open)}+ className="mt-0.5 flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-ink/[0.04] hover:text-ink"+ >+ {showEnded ? <ChevronUp size={14} aria-hidden="true" /> : <ChevronDown size={14} aria-hidden="true" />}+ {t("task.endedList", { count: ended.length })}+ </button>+ )}+ {!needle && showEnded && ended.length > 0 && (+ <div role="list" aria-label={t("task.endedList", { count: ended.length })} className={cn("flex flex-col gap-px", PANEL_ROW_LOOK)}>+ {ended.map(row)}+ </div>+ )}{!needle && archived.length > 0 && (<buttontype="button"diff --git a/src/locales/en.json b/src/locales/en.jsonindex 0efb4ccdd6..5f369a48ef 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -3424,6 +3424,7 @@"task.bulk.retitleResult": "Named by content: {count}.","task.bulk.retitleFailed": "Couldn't name {count}: {message}","task.archivedList": "Archived ({count})",+ "task.endedList": "Ended ({count})","task.empty": "No threads yet","task.newIn": "New thread in {name}","task.actions": "Actions for {title}",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 213b6cf5a9..07b36021ae 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -3211,6 +3211,7 @@"task.bulk.retitleResult": "Nomeadas pelo conteúdo: {count}.","task.bulk.retitleFailed": "Não foi possível nomear {count}: {message}","task.archivedList": "Arquivadas ({count})",+ "task.endedList": "Encerradas ({count})","task.empty": "Nenhuma conversa ainda","task.newIn": "Nova conversa em {name}","task.actions": "Ações de {title}",