Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
UI polish round 2: one bubble per rich reply, Auto thinking, one panel action style
aivsomkar2f6975fe18a3
diff --git a/src/components/BotSettingsDialog.simple.test.ts b/src/components/BotSettingsDialog.simple.test.tsindex eef31b7c81..64b585e4f3 100644--- a/src/components/BotSettingsDialog.simple.test.ts+++ b/src/components/BotSettingsDialog.simple.test.ts@@ -624,7 +624,7 @@ describe("the Details tab", () => {expect(empty.html).toContain(">Routines are recurring tasks this bot runs on a schedule. Ask it in chat to set one up.<");expect(empty.html.match(/data-panel-page="routines"/g)).toHaveLength(1);const add = find(empty, "data-panel-page", "routines");- expect(add.props.children).toBe("Add a routine");+ expect(empty.html).toMatch(/data-panel-page="routines"[^>]*>.*<span class="truncate">Add a routine<\/span><\/button>/);click(add);expect(onOpen).toHaveBeenLastCalledWith("routines");fixture.derived.botRoutines = [routine()];diff --git a/src/components/ChatMarkdown.test.ts b/src/components/ChatMarkdown.test.tsindex da0adfd24b..2d6f5818d0 100644--- a/src/components/ChatMarkdown.test.ts+++ b/src/components/ChatMarkdown.test.ts@@ -1385,7 +1385,7 @@ describe("Simple mode's code block", () => {it("drops the header bar for a quiet surface, with Copy and a ⋯ menu on a hover plate", () => {const html = simple(() => renderToStaticMarkup(createElement(CodeBlock, { code: "const a = 1;", lang: "js" })));- expect(html).toMatch(/class="chat-code-block group\/code relative my-2\.5 overflow-hidden rounded-lg bg-ink\/\[0\.04\]"/);+ expect(html).toMatch(/class="chat-code-block group\/code relative my-2\.5 overflow-hidden rounded-xl bg-ink\/\[0\.04\]"/);expect(html).not.toContain("border-hairline");expect(html).not.toContain('aria-label="Wrap long lines"');const plate = html.match(/<div data-code-plate="[^"]*" class="([^"]*)"/)?.[1] ?? "";diff --git a/src/components/ChatMarkdown.tsx b/src/components/ChatMarkdown.tsxindex 249f88dec9..dd5c0fa28d 100644--- a/src/components/ChatMarkdown.tsx+++ b/src/components/ChatMarkdown.tsx@@ -257,7 +257,7 @@ export function MermaidDiagram({ code }: MermaidDiagramProps) {</>;if (simple) {return (- <div ref={frame} dir="ltr" className="group/code relative my-2.5 overflow-hidden rounded-lg bg-ink/[0.04]">+ <div ref={frame} dir="ltr" className="group/code relative my-2.5 overflow-hidden rounded-xl bg-ink/[0.04]"><CodePlate copied={copied} onCopy={copy} copyLabel={t("code.copySource")} items={[{ key: "source", label: t(showSource ? "code.hideSource" : "code.showSource"), icon: <WrapText size={14} aria-hidden="true" />, active: showSource, onSelect: () => setShowSource((shown) => !shown) },{ key: "about", label: t("code.mermaid"), disabled: true, separatorBefore: true, onSelect: () => {} },diff --git a/src/components/CodeBlock.tsx b/src/components/CodeBlock.tsxindex 56ce48677f..7d7e8a03cf 100644--- a/src/components/CodeBlock.tsx+++ b/src/components/CodeBlock.tsx@@ -253,7 +253,7 @@ export function CodeBlock({ code, lang, initialWrap = false }: CodeBlockProps) {if (simple) {return (- <div ref={frame} dir="ltr" className="chat-code-block group/code relative my-2.5 overflow-hidden rounded-lg bg-ink/[0.04]">+ <div ref={frame} dir="ltr" className="chat-code-block group/code relative my-2.5 overflow-hidden rounded-xl bg-ink/[0.04]"><CodePlate copied={copied} onCopy={copy} copyLabel={t("code.copyTitle")} items={[{ key: "wrap", label: t("code.wrapLines"), icon: <WrapText size={14} aria-hidden="true" />, active: wrapLines, onSelect: () => setWrapLines((wrap) => !wrap) },{ key: "save", label: t("code.saveAsFile"), icon: <Download size={14} aria-hidden="true" />, onSelect: download },diff --git a/src/components/ModelPicker.dom.test.ts b/src/components/ModelPicker.dom.test.tsindex f3a1db081f..5af3475bdb 100644--- a/src/components/ModelPicker.dom.test.ts+++ b/src/components/ModelPicker.dom.test.ts@@ -163,7 +163,7 @@ describe("choosing a model with the keyboard", () => {it("moves through the Thinking steps with the arrow keys and applies one only on Enter, staying open", async () => {await openWith("click");- const low = document.querySelector<HTMLElement>("[data-effort-pill]")!;+ const low = document.querySelector<HTMLElement>("[data-effort-pill]:not([data-effort-auto])")!;low.focus();press("ArrowRight");expect(focused()?.textContent).toBe("Medium");diff --git a/src/components/ModelPicker.simple.test.ts b/src/components/ModelPicker.simple.test.tsindex 859c654b4e..f7d9aa03e5 100644--- a/src/components/ModelPicker.simple.test.ts+++ b/src/components/ModelPicker.simple.test.ts@@ -350,7 +350,7 @@ describe("the model picker in Simple mode", () => {expect(bottom).toContain('role="group" aria-labelledby=');expect(bottom).toMatch(/data-simple-effort="true"[^>]*class="[^"]*rounded-full bg-ink\/\[0.05\] p-\[3px\]/);expect(bottom).toContain('title="High thinking. Higher is slower but more careful."');- expect(bottom).toMatch(/title="The model decides how hard to think."[^>]*>Use default<\/button>/);+ expect(bottom).toMatch(/data-effort-auto="true" aria-pressed="false"[^>]*title="The model decides how hard to think."[^>]*>Auto<\/button>/);thinking(opened).onReset();expect(fixture.dispatch).toHaveBeenLastCalledWith({type: "setModel", botId: "scout", threadId: "thread-scout", updateBotDefault: true,@@ -358,8 +358,8 @@ describe("the model picker in Simple mode", () => {});fixture.values = [];const atDefault = region(menu(open(bot()).html), "data-simple-effort-band");- expect(atDefault).not.toContain('aria-pressed="true"');- expect(atDefault).not.toContain("Use default");+ expect(atDefault.match(/aria-pressed="true"/g)).toHaveLength(1);+ expect(atDefault).toMatch(/data-effort-auto="true" aria-pressed="true"[^>]*>Auto<\/button>/);expect(atDefault).toContain('data-simple-effort-auto="true" class="px-2 pb-1 text-[12px] leading-4 text-ink-tertiary">The model decides how hard to think.</p>');});@@ -980,7 +980,7 @@ describe("every capability of the picker stays reachable", () => {"a signed-out account signs in": body("claude-work") === "signIn","a managed provider says who manages it": body("openai") === "policy" && html.includes("Managed by Acme"),"a provider with nothing listed checks again": body("chatgpt") === "empty" && html.includes("data-simple-refresh"),- "thinking levels in the provider's own names, and back to Default": html.includes(">X-High</button>") && html.includes(">Use default</button>"),+ "thinking levels in the provider's own names, and back to Default": html.includes(">X-High</button>") && html.includes(">Auto</button>"),"AI accounts in Settings": html.includes("data-simple-manage"),};expect(missingFrom(before)).toEqual([]);diff --git a/src/components/ReplyBlocks.tsx b/src/components/ReplyBlocks.tsxindex 61bef1d918..8b2e0e842a 100644--- a/src/components/ReplyBlocks.tsx+++ b/src/components/ReplyBlocks.tsx@@ -2,11 +2,10 @@ import type { ReactNode } from "react";import { cn } from "@/lib/cn";import type { ReplyBlock } from "@/lib/formatted-reply";-import { joinedCorners, SIMPLE_BOT_BUBBLE, SIMPLE_BUBBLE_MAX, type BubbleJoin } from "./chat-bubble";+import { joinedCorners, SIMPLE_BOT_BUBBLE, type BubbleJoin } from "./chat-bubble";-/** Simple mode's reply with tables: the prose in bubbles and each table in its own card at the message's full width, so- * every column shows. The first and last prose bubbles take the row's join corners; a table breaks the join. The hover- * tray sits beside the first block. */+/** Simple mode's reply with tables: one bubble holding the prose and each table in order. The bubble may grow to the+ * message's card width so a table's columns show; its prose keeps the reading width. The hover tray sits beside it. */export function ReplyBlocks({ blocks, join, citation, tray, render }: {blocks: readonly ReplyBlock[];join?: BubbleJoin;@@ -14,27 +13,22 @@ export function ReplyBlocks({ blocks, join, citation, tray, render }: {tray?: ReactNode;render: (text: string) => ReactNode;}) {- const last = blocks.length - 1;return (<divdata-reply-blocks- className="flex w-full flex-col items-start gap-1"+ className="flex w-full items-center gap-1.5"data-citation-source={citation.messageId}data-citation-owner-type={citation.ownerType}data-citation-owner={citation.ownerId}data-citation-thread={citation.threadId}>- {blocks.map((block, index) => {- const body = block.kind === "table"- ? <div key={index} data-reply-table className="w-full max-w-[var(--chat-card-pct)]">{render(block.text)}</div>- : (- <div key={index} data-chat-bubble="simple" className={cn("w-fit", SIMPLE_BUBBLE_MAX, SIMPLE_BOT_BUBBLE,- joinedCorners("start", { above: index === 0 && Boolean(join?.above), below: index === last && Boolean(join?.below) }))}>- {render(block.text)}- </div>- );- return index === 0 && tray ? <div key={index} className="flex w-full items-center gap-1.5">{body}{tray}</div> : body;- })}+ <div data-chat-bubble="simple" data-reply-bubble className={cn("flex w-fit min-w-0 max-w-[var(--chat-card-pct)] flex-col gap-3", SIMPLE_BOT_BUBBLE,+ joinedCorners("start", { above: Boolean(join?.above), below: Boolean(join?.below) }))}>+ {blocks.map((block, index) => block.kind === "table"+ ? <div key={index} data-reply-table className="min-w-0">{render(block.text)}</div>+ : <div key={index} className="max-w-[var(--chat-bubble-max)]">{render(block.text)}</div>)}+ </div>+ {tray}</div>);}diff --git a/src/components/SetupOffer.tsx b/src/components/SetupOffer.tsxindex ba596c39e1..eef54bf142 100644--- a/src/components/SetupOffer.tsx+++ b/src/components/SetupOffer.tsx@@ -125,11 +125,11 @@ export function SetupOffer({ botId, threadId, message, transcript }: { botId: st</div>))}</div> : <div key={choices.join("\n")} data-setup-updating={updating ? "" : undefined}- className={cn("mt-1.5 flex flex-col", updating ? "motion-safe:animate-pulse" : waitedOnce.current && "motion-safe:animate-msg-in")}>+ className={cn("mt-2 flex flex-col gap-1", updating ? "motion-safe:animate-pulse" : waitedOnce.current && "motion-safe:animate-msg-in")}>{options.map((option, index) => (<button key={option.label} type="button" data-ask-choice="" disabled={quiet || busy} onClick={option.pick}className={cn("group flex min-h-10 items-center gap-3 rounded-lg px-3 py-2 text-start",- quiet ? "cursor-default" : "hover:bg-ink/[0.05] disabled:cursor-default")}>+ quiet ? "cursor-default" : "bg-ink/[0.03] hover:bg-ink/[0.07] disabled:cursor-default")}><kbd className={cn("flex size-6 shrink-0 items-center justify-center rounded-md font-sans text-[12px] font-medium",quiet ? "bg-ink/[0.04] text-ink-tertiary" : "bg-ink/[0.07] text-ink-secondary group-hover:bg-ink/[0.1]")}>{LETTERS[index]}diff --git a/src/components/SimpleModelMenu.tsx b/src/components/SimpleModelMenu.tsxindex b3dea02c65..580435a189 100644--- a/src/components/SimpleModelMenu.tsx+++ b/src/components/SimpleModelMenu.tsx@@ -158,41 +158,38 @@ function GroupBody({ group, props }: { group: MenuGroup; props: SimpleModelMenuPfunction Thinking({ thinking, labelId }: { thinking: SimpleThinking; labelId: string }) {if ("variants" in thinking) return <div data-simple-thinking>{thinking.variants}</div>;const levels = thinking;- const tabStop = Math.max(0, levels.levels.findIndex((level) => level === levels.current));+ const auto = levels.current === undefined;+ const pill = (pressed: boolean) => cn(+ "h-6 min-w-0 truncate rounded-full px-1 text-[12px] leading-4 transition-colors touch:h-8",+ pressed ? "bg-ink/[0.1] font-medium text-ink" : "text-ink-secondary hover:text-ink",+ );return (<div data-simple-thinking className="flex flex-col"><div className="flex h-6 items-end justify-between gap-2 px-2 pb-0.5"><span id={labelId} className="text-[12px] font-medium leading-4 text-ink-tertiary">{t("botSettings.simple.thinking")}</span>- {(levels.current === undefined- ? null- : (- <button type="button" data-simple-effort-default onClick={levels.onReset} title={t("model.simple.thinkingDefault")}- className="-mr-1 rounded-[6px] px-1 text-[12px] leading-4 text-ink-secondary hover:bg-ink/[0.06] hover:text-ink">- {t("model.simple.useDefault")}- </button>- ))}</div><div data-simple-effort role="group" aria-labelledby={labelId} className="m-1 grid rounded-full bg-ink/[0.05] p-[3px]"- style={{ gridTemplateColumns: `repeat(${levels.levels.length}, minmax(0, 1fr))` }}>- {levels.levels.map((level, index) => (+ style={{ gridTemplateColumns: `repeat(${levels.levels.length + 1}, minmax(0, 1fr))` }}>+ <button type="button" data-effort-pill data-effort-auto aria-pressed={auto} tabIndex={auto ? 0 : -1}+ title={t("model.simple.thinkingDefault")} onClick={levels.onReset} className={pill(auto)}>+ {t("model.simple.auto")}+ </button>+ {levels.levels.map((level) => (<buttonkey={level}type="button"data-effort-pillaria-pressed={levels.current === level}- tabIndex={index === tabStop ? 0 : -1}+ tabIndex={levels.current === level ? 0 : -1}title={t("model.simple.thinkingLevel", { level: effortLabel(level) })}onClick={() => levels.onPick(level)}- className={cn(- "h-6 min-w-0 truncate rounded-full px-1 text-[12px] leading-4 transition-colors touch:h-8",- levels.current === level ? "bg-ink/[0.1] font-medium text-ink" : "text-ink-secondary hover:text-ink",- )}+ className={pill(levels.current === level)}>{effortLabel(level)}</button>))}</div>- {levels.current === undefined && (+ {auto && (<p data-simple-effort-auto className="px-2 pb-1 text-[12px] leading-4 text-ink-tertiary">{t("model.simple.thinkingDefault")}</p>)}</div>diff --git a/src/components/bot-panel/Conversations.tsx b/src/components/bot-panel/Conversations.tsxindex b14183951c..03a8b74652 100644--- a/src/components/bot-panel/Conversations.tsx+++ b/src/components/bot-panel/Conversations.tsx@@ -9,7 +9,7 @@ import { api, currentTaskBot, openBotThread, useStore, visibleMessages, type Botimport { lastLine } from "../sidebar-preview";import { isArchived, orderedThreadList, SidebarThreadRow, stampClock, threadRecency, threadRowActions, useRelativeNow } from "../SidebarThreadRow";import { filterTasks } from "../TaskPicker";-import { CardLabel } from "./rows";+import { CardLabel, panelActionCls } from "./rows";export const CONVERSATIONS_SHOWN = 3;const PANEL_ROW_LOOK = "[&_.font-semibold]:font-medium [&_time]:text-[12px] [&_time]:text-ink-tertiary [&_span.bg-accent]:size-2";@@ -129,7 +129,7 @@ export function BotConversations({ bot }: { bot: Bot }) {data-conversations-newaria-label={t("botPanel.conversations.new")}onClick={startNew}- className="flex h-9 min-w-0 flex-1 items-center gap-2.5 rounded-full bg-ink/[0.05] px-3.5 text-[14px] font-medium text-ink transition-colors hover:bg-ink/[0.09]"+ className={cn(panelActionCls, "flex-1")}><SquarePen size={15} aria-hidden="true" className="shrink-0 text-ink-secondary" /><span className="truncate">{t("botPanel.conversations.new")}</span>diff --git a/src/components/bot-panel/DetailsTab.tsx b/src/components/bot-panel/DetailsTab.tsxindex 1bdf7c46f4..1ba8aa774e 100644--- a/src/components/bot-panel/DetailsTab.tsx+++ b/src/components/bot-panel/DetailsTab.tsx@@ -1,4 +1,4 @@-import { Calendar, Sparkles } from "lucide-react";+import { Calendar, CalendarPlus, Sparkles } from "lucide-react";import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";@@ -10,7 +10,7 @@ import type { useBotSettingsDerived } from "../bot-settings/useBotSettingsDeriveimport { BotConversations } from "./Conversations";import type { SimplePageId } from "./page-registry";import { TryAsking } from "./TryAsking";-import { buttonCls, Card, CardLabel, NavRow, RowIcon, rowCls, RowText } from "./rows";+import { Card, CardLabel, panelActionCls, NavRow, RowIcon, rowCls, RowText } from "./rows";type Derived = ReturnType<typeof useBotSettingsDerived>;@@ -55,7 +55,7 @@ export function DetailsTab({ bot, derived, onOpen }: {bot={bot}containedthreadId={bot.threadId}- label={<span className="flex min-w-0 flex-1 items-center gap-2.5"><RowIcon icon={Sparkles} /><RowText title={t("model.simple.model")} /></span>}+ label={<span className="flex shrink-0 items-center gap-2.5"><RowIcon icon={Sparkles} /><RowText title={t("model.simple.model")} /></span>}/></div></Card>@@ -70,9 +70,10 @@ export function DetailsTab({ bot, derived, onOpen }: {type="button"data-panel-page="routines"onClick={() => onOpen("routines")}- className={cn(buttonCls, "mx-1 mt-2.5")}+ className={cn(panelActionCls, "mt-2.5 w-full")}>- {t("botPanel.routines.add")}+ <CalendarPlus size={15} aria-hidden="true" className="shrink-0 text-ink-secondary" />+ <span className="truncate">{t("botPanel.routines.add")}</span></button></section>) : (diff --git a/src/components/bot-panel/rows.tsx b/src/components/bot-panel/rows.tsxindex 1bba347787..d4b023d963 100644--- a/src/components/bot-panel/rows.tsx+++ b/src/components/bot-panel/rows.tsx@@ -13,6 +13,8 @@ const titleCls = "text-[14px] font-medium text-ink";const hintCls = "mt-px text-[13px] leading-[1.35] text-ink-secondary";export const buttonCls ="inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] bg-control px-3.5 text-[13px] font-medium text-ink hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50";+/** The panel's one action row: New conversation, Add a routine. */+export const panelActionCls = "flex h-9 min-w-0 items-center gap-2.5 rounded-full bg-ink/[0.05] px-3.5 text-[14px] font-medium text-ink transition-colors hover:bg-ink/[0.09]";export const chipCls = (on: boolean) =>cn("rounded-full px-2.5 py-1 text-[12px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",diff --git a/src/locales/en.json b/src/locales/en.jsonindex 6cd7a15e18..1ef0ab5384 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -3026,6 +3026,7 @@"model.orgBlocked": "Turned off by your organization","model.simple.signIn": "Sign in","model.simple.lookingModels": "Looking for models…",+ "model.simple.auto": "Auto","model.simple.useDefault": "Use default","model.simple.back": "Back","model.simple.clearSearch": "Clear search",diff --git a/src/styles.css b/src/styles.cssindex 619fb53ea1..76d97a41bb 100644--- a/src/styles.css+++ b/src/styles.css@@ -1139,20 +1139,19 @@[data-chat-bubble="simple"] .chat-md > .md-heading:first-child {margin-top: 0;}-/* One reply's prose bubbles and table cards stack as one group: where two meet, their start corners tighten to 6px. */-[data-reply-blocks] > * + * [data-table-card],-[data-reply-blocks] > * + [data-chat-bubble] {- border-start-start-radius: 6px;-}-[data-reply-blocks] > :has(+ *) [data-table-card],-[data-reply-blocks] > [data-chat-bubble]:has(+ *),-[data-reply-blocks] > :has(+ *) > [data-chat-bubble] {- border-end-start-radius: 6px;-}/* A short line keeps the tight chat bubble; a structured reply gets room to breathe. */-[data-chat-bubble="simple"]:has(.chat-md > :is(.md-heading, ul, ol, blockquote), .chat-md pre) {+[data-chat-bubble="simple"]:has(> .chat-md > :is(.md-heading, ul, ol, blockquote), > .chat-md pre),+[data-reply-bubble] {padding: 12px 16px;}+/* A table inside a reply sits on the bubble as an inset card, like a code block. */+[data-reply-bubble] [data-table-card],+[data-reply-bubble] [data-table-card] thead {+ background: color-mix(in srgb, var(--color-card), var(--color-ink) 4%);+}+[data-reply-bubble] [data-table-card] {+ border-radius: 12px;+}/* A card under its own bot's bubble (and a bubble under its card) sits 12px below it, not the 16px between senders. */[data-simple-rows] > [data-tuck] > :first-child {margin-top: -4px;