Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Thread tabs and Settings search follow-ups (#7332)
Milind Soni1ecf9ca2cccd
diff --git a/DESIGN.md b/DESIGN.mdindex 32dd9b5c33..1a876552f7 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -187,7 +187,8 @@ element's job and never a pixel value:chevrons at the end of a row, not before the label.- **Control heights: 24, 28, 32 or 36px.** Menu rows are 30px (32px in thecomposer's menu). The chat header's controls and the sidebar's top buttons- are 36px. On touch screens, targets grow to 40–44px with the `touch:`+ are 36px; beside the thread tabs band both are 32px, on the same centre+ line. On touch screens, targets grow to 40–44px with the `touch:`variant.- **Sidebar rows:** Simple's rows have 8px padding and a 10px gap after the36px avatar; every row hovers at `bg-ink/[0.06]`. The sidebar is 280px widediff --git a/src/components/Sidebar.header.test.ts b/src/components/Sidebar.header.test.tsindex 521bfc0f2b..0e513771fe 100644--- a/src/components/Sidebar.header.test.ts+++ b/src/components/Sidebar.header.test.ts@@ -1,3 +1,6 @@+import { readFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";import { createElement } from "react";import { renderToStaticMarkup } from "react-dom/server";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";@@ -186,12 +189,32 @@ describe("sidebar top row", () => {expect(advanced.indexOf("data-traffic-light-space")).toBeLessThan(advanced.indexOf("data-rail-toggle"));fixture.advanced = false;const simple = topRow(render());- expect(simple, "Simple keeps its own top row, not the frame's corner").toMatch(/^data-sidebar-top-row="true"/);+ expect(simple, "Simple keeps its own top row, not the frame's corner").toMatch(/^data-sidebar-top-row="simple"/);expect(simple.indexOf("data-traffic-light-space")).toBeLessThan(simple.indexOf("data-rail-toggle"));fixture.density = "icons";expect(classesOf(render(), "data-traffic-light-space"), "the column of avatars keeps a strip above for them").toEqual(["h-5", "w-full"]);});+ it("steps Simple's round buttons down to the thread tabs band's 32px, on the same 30px centre line", () => {+ fixture.windowChrome = "mac-inset";+ fixture.windowFrame = false;+ fixture.rail = { available: true, hidden: false };+ fixture.advanced = false;+ desktop();+ const html = render();+ const row = html.slice(html.indexOf("data-sidebar-top-row"), html.indexOf(">", html.indexOf('aria-label="New or share"')));+ expect(row).toMatch(/^data-sidebar-top-row="simple"/);+ expect(classesOf(row, "data-sidebar-top-row")).toEqual(expect.arrayContaining(["h-[60px]", "items-start", "pt-3"]));+ const round = [...row.matchAll(/<button[^>]*class="([^"]*)"/g)].map((match) => match[1].split(" "));+ expect(round.length, "the rail's button, search and +").toBe(3);+ for (const classes of round) expect(classes).toContain("size-9");+ expect(row).toMatch(/data-rail-toggle/);+ const css = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "styles.css"), "utf8").replace(/\r\n/g, "\n");+ const beside = ':root:has([data-chathead-tabs="simple"]) [data-sidebar-top-row="simple"]';+ expect(css).toContain(`${beside} { padding-top: 14px; }`);+ expect(css).toContain(`${beside} :is([data-rail-toggle], [data-sidebar-top-buttons] button.size-9) { width: 32px; height: 32px; }`);+ });+it("with the frame turned off on Windows, its own title bar is back: nothing makes room and nothing drags", () => {fixture.windowChrome = "native";fixture.windowFrame = false;diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex ebe9cd63a5..302351e7fc 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -1243,7 +1243,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =<GlassScrollFrame className="flex-1" fade><PlaceTint /><GlassBar edge="top"><div- data-sidebar-top-row={corner ? "corner" : true}+ data-sidebar-top-row={corner ? "corner" : simpleDesk ? "simple" : true}className={cn("flex items-center",// The corner is no drag region and takes no clicks but its buttons': the tiles rise into the rest of it.diff --git a/src/components/settings/SettingsWindow.peek.dom.test.ts b/src/components/settings/SettingsWindow.peek.dom.test.tsindex cd5c689dfc..fc6223f62a 100644--- a/src/components/settings/SettingsWindow.peek.dom.test.ts+++ b/src/components/settings/SettingsWindow.peek.dom.test.ts@@ -12,6 +12,7 @@ const fx = vi.hoisted(() => ({listeners: new Set<() => void>(),dispatch: vi.fn(),setAdvancedMode: vi.fn(),+ features: {} as Record<string, boolean>,}));const { marker } = vi.hoisted(() => ({ marker: (name: string) => () => `MARKER:${name};` }));@@ -24,7 +25,7 @@ vi.mock("@/state/store", async (original) => {api: () => new Promise(() => {}),useStore: () => {const section = useSyncExternalStore(subscribe, () => fx.section);- return { state: { ...actual.initialState, appSettingsSection: section, config: { composio: { configured: false } }, instances: [], bots: [] }, dispatch: fx.dispatch };+ return { state: { ...actual.initialState, appSettingsSection: section, config: { composio: { configured: false }, features: fx.features }, instances: [], bots: [] }, dispatch: fx.dispatch };},};});@@ -60,6 +61,7 @@ function search(value: string) {beforeEach(() => {setLocale("en");fx.section = "overview";+ fx.features = {};fx.dispatch.mockReset();fx.setAdvancedMode.mockReset();fx.dispatch.mockImplementation((action: { type: string; section?: AppSettingsSection }) => {@@ -135,4 +137,29 @@ describe("an Advanced setting found from Simple", () => {expect(body().textContent).not.toContain("MARKER:backup-model;");expect(fx.setAdvancedMode).not.toHaveBeenCalled();});++ it("opens an old link to Activity at the top of Data in the desktop app, where only a browser has Activity", async () => {+ vi.stubGlobal("ogb", { platform: "darwin" });+ fx.section = "activity";+ flushSync(() => root.render(createElement(SettingsModal)));+ await vi.waitFor(() => expect(body().getAttribute("data-settings-page-body")).toBe("data"));+ expect(body().querySelector('[data-settings-block="storage"]')).not.toBeNull();+ expect(body().querySelector('[data-settings-block="activity"]')).toBeNull();+ expect(header().textContent).toContain("Advanced setting");+ expect(fx.setAdvancedMode).not.toHaveBeenCalled();+ });++ it("finds no Repeat computer tasks without AI where the server can't repeat saved steps, so no mark sits over an empty section", async () => {+ flushSync(() => root.render(createElement(SettingsModal)));+ search("repeat");+ expect(hit("saved-steps")).toBeNull();+ flushSync(() => root.unmount());+ fx.features = { savedStepsHere: true };+ root = createRoot(host);+ flushSync(() => root.render(createElement(SettingsModal)));+ search("repeat");+ flushSync(() => hit("saved-steps").click());+ await vi.waitFor(() => expect(document.querySelector('[data-settings-peek="automation"]')?.textContent).toContain("Advanced setting"));+ expect(body().querySelector('[data-settings-block="automation"]')?.textContent).toContain("Repeat computer tasks without AI");+ });});diff --git a/src/components/settings/pages/PlacePages.tsx b/src/components/settings/pages/PlacePages.tsxindex 01ce68bc08..e1a751fca6 100644--- a/src/components/settings/pages/PlacePages.tsx+++ b/src/components/settings/pages/PlacePages.tsx@@ -198,7 +198,7 @@ export function DesktopsPage() {</SettingsDisclosureRow></AdminOnly>)}- <AdvancedSection anchor="automation"><SettingsGroup label={t("settings.desktops.automation")} block="automation"><SettingsRows><SavedStepsRow /></SettingsRows></SettingsGroup></AdvancedSection>+ {ctx.savedSteps && <AdvancedSection anchor="automation"><SettingsGroup label={t("settings.desktops.automation")} block="automation"><SettingsRows><SavedStepsRow /></SettingsRows></SettingsGroup></AdvancedSection>}</>;}diff --git a/src/components/settings/settings-context.ts b/src/components/settings/settings-context.tsindex db1226f1f3..3441a86237 100644--- a/src/components/settings/settings-context.ts+++ b/src/components/settings/settings-context.ts@@ -1,7 +1,7 @@import { useEffect, useMemo, useState } from "react";import { appVersion } from "@/lib/app-links";import { pageIsThisComputer } from "@/lib/companion-bridge";-import { skillsLibraryEnabled } from "@/lib/feature-flags";+import { savedStepsHere, skillsLibraryEnabled } from "@/lib/feature-flags";import { t } from "@/lib/i18n";export { useSettingsPlace, type PlaceKind, type SettingsPlace } from "./settings-place";import { useAdvancedMode } from "@/lib/interface-mode";@@ -30,10 +30,10 @@ export function useSettingsContext(): SettingsContext {const organization = Boolean(ogb?.organization) && !client;const environments = Boolean(ogb?.environments);const installations = workspacesAvailable(config);- const skills = skillsLibraryEnabled(config);+ const skills = skillsLibraryEnabled(config), savedSteps = savedStepsHere(config);const storage = useStorageReport({ enabled: admin && !client }).status === "ready";- return useMemo(() => ({ desktop, here, home, cloud, team, client, admin, places: placesShown, plan, organization, environments, installations, skills, advanced, storage }),- [desktop, here, home, cloud, team, client, admin, placesShown, plan, organization, environments, installations, skills, advanced, storage]);+ return useMemo(() => ({ desktop, here, home, cloud, team, client, admin, places: placesShown, plan, organization, environments, installations, skills, advanced, storage, savedSteps }),+ [desktop, here, home, cloud, team, client, admin, placesShown, plan, organization, environments, installations, skills, advanced, storage, savedSteps]);}/** How many places this app knows (a hidden rail's included), from main's environments list. */diff --git a/src/components/settings/settings-index.test.ts b/src/components/settings/settings-index.test.tsindex 4226dfaa78..2da4256b47 100644--- a/src/components/settings/settings-index.test.ts+++ b/src/components/settings/settings-index.test.ts@@ -48,7 +48,7 @@ describe("the pages", () => {it("turns Advanced on for a link, a notice or a search hit that asks for an Advanced page or row from Simple", () => {const simple = fullContext({ advanced: false });expect(resolveSettingsTarget("general", simple)).toEqual({ page: "general", advanced: true });- expect(resolveSettingsTarget("activity", simple)).toEqual({ page: "data", anchor: "activity", advanced: true });+ expect(resolveSettingsTarget("activity", { ...simple, desktop: false })).toEqual({ page: "data", anchor: "activity", advanced: true });expect(resolveSettingsTarget("backups", simple)).toEqual({ page: "transfer", anchor: "take-out" });expect(resolveSettingsTarget("import", simple)).toEqual({ page: "transfer", anchor: "bring-in" });expect(resolveSettingsTarget("decisionModel", simple)).toEqual({ page: "ai", anchor: "routing", advanced: true });@@ -142,9 +142,11 @@ describe("old links", () => {expect(where("desktopWorkspaces")).toEqual({ page: "app", anchor: "your-computers" });expect(where("backups")).toEqual({ page: "transfer", anchor: "take-out" });expect(where("import")).toEqual({ page: "transfer", anchor: "bring-in" });- expect(where("activity")).toEqual({ page: "data", anchor: "activity" });+ expect(where("activity")).toEqual({ page: "data" });+ expect(resolveSettingsTarget("activity", fullContext({ desktop: false }))).toEqual({ page: "data", anchor: "activity" });expect(where("experimental")).toEqual({ page: "bots", anchor: "early" });- expect(where("skills")).toEqual({ page: "bots", anchor: "skills" });+ expect(where("skills")).toEqual({ page: "bots" });+ expect(resolveSettingsTarget("skills", fullContext({ skills: true }))).toEqual({ page: "bots", anchor: "skills" });expect(where("updates")).toEqual({ page: "app", anchor: "updates" });expect(resolveSettingsTarget("updates", PEOPLE["My Cloud in a browser (owner)"])).toEqual({ page: "overview" });expect(where("usage")).toEqual({ page: "usage" });@@ -175,6 +177,21 @@ describe("search", () => {it("puts All bots on You and your bots", () => expect(first("all bots")?.page).toBe("bots"));it.each(["kimi", "hidden providers", "unhide"])("puts AI › Providers first for “%s”", (query) => expect(first(query)?.id).toBe("providers"));it("finds AI › Providers for “cursor” beside importing from Cursor", () => expect(find("cursor").map((hit) => hit.entry.id)).toEqual(expect.arrayContaining(["providers", "ai-apps"])));+ it("opens an old link to Activity at the top of Data in the desktop app, where only a browser has it", () => {+ expect(resolveSettingsTarget("activity", fullContext({ advanced: false }))).toEqual({ page: "data", advanced: true });+ expect(resolveSettingsTarget("activity", fullContext())).toEqual({ page: "data" });+ expect(resolveSettingsTarget("activity", fullContext({ desktop: false, admin: false, advanced: false }))).toEqual({ page: "data", advanced: true });+ });++ it("finds Repeat computer tasks without AI only where the server can repeat saved steps", () => {+ const simple = fullContext({ advanced: false });+ expect(find("saved", simple).map((hit) => hit.entry.id)).toContain("saved-steps");+ for (const ctx of [{ ...simple, savedSteps: false }, { ...simple, savedSteps: undefined }, fullContext({ savedSteps: false })]) {+ expect(find("saved", ctx).map((hit) => hit.entry.id)).not.toContain("saved-steps");+ expect(find("repeat", ctx)).toEqual([]);+ }+ });+it("finds Activity in Data where it exists: a browser, for an admin", () => {expect(first("activity", PEOPLE["a team admin"])?.anchor).toBe("activity");expect(find("activity", fullContext()).some((hit) => hit.entry.anchor === "activity")).toBe(false);diff --git a/src/components/settings/settings-index.ts b/src/components/settings/settings-index.tsindex 01fdbfee6d..d044992eb7 100644--- a/src/components/settings/settings-index.ts+++ b/src/components/settings/settings-index.ts@@ -34,6 +34,8 @@ export interface SettingsContext {advanced: boolean;/** this place's server answers with a storage report (a Cloud home), read only by an owner or admin */storage?: boolean;+ /** this place's server can repeat a computer task's saved steps (a Mac) */+ savedSteps?: boolean;}export interface SettingsPage {@@ -47,6 +49,7 @@ export interface SettingsPage {}const notClient = (ctx: SettingsContext) => !ctx.client;+const browserAdmin = (ctx: SettingsContext) => !ctx.desktop && ctx.admin;/** What only an admin can use: a team's member isn't offered it at all (the installation's AI, desktops, spending, data). */const adminPage = (ctx: SettingsContext) => !ctx.client && !(ctx.team && !ctx.admin);/** A page Simple mode leaves out: its everyday rows show elsewhere in Simple (Overview, This app, Plan & billing). */@@ -125,10 +128,11 @@ export const LEGACY_SETTINGS: Record<Exclude<AppSettingsSection, SettingsPageId>computer: () => ({ page: "desktops" }),logins: () => ({ page: "vault" }),botAccess: () => ({ page: "people", anchor: "bot-access" }),- activity: () => ({ page: "data", anchor: "activity" }),+ // Only an admin in a browser has Activity; anyone else lands at the top of Data.+ activity: (ctx) => (browserAdmin(ctx) ? { page: "data", anchor: "activity" } : { page: "data" }),backups: () => ({ page: "transfer", anchor: "take-out" }),workspaces: () => ({ page: "installations" }),- skills: () => ({ page: "bots", anchor: "skills" }),+ skills: (ctx) => (ctx.skills ? { page: "bots", anchor: "skills" } : { page: "bots" }),import: () => ({ page: "transfer", anchor: "bring-in" }),updates: (ctx) => (ctx.desktop ? { page: "app", anchor: "updates" } : { page: "overview" }),};@@ -155,7 +159,7 @@ export function resolveSettingsTarget(requested: AppSettingsSection, ctx: Settin/** A context with every page showing (Advanced mode), for tests and previews to narrow down. */export const fullContext = (over: Partial<SettingsContext> = {}): SettingsContext => ({desktop: true, here: true, home: true, cloud: false, team: false, client: false, admin: true, places: false, plan: true,- organization: false, environments: true, installations: false, skills: false, advanced: true, ...over,+ organization: false, environments: true, installations: false, skills: false, advanced: true, savedSteps: true, ...over,});/** One row, section or page search can open. `label` beats `labelKey` where the name is not a string of the app's. */@@ -181,7 +185,6 @@ export interface SettingsIndexEntry {const desk = (ctx: SettingsContext) => ctx.desktop && !ctx.client;const hereOnly = (ctx: SettingsContext) => ctx.here;-const browserAdmin = (ctx: SettingsContext) => !ctx.desktop && ctx.admin;export const SETTINGS_INDEX: readonly SettingsIndexEntry[] = [{ id: "add-device", page: "devices", anchor: "add", labelKey: "devicesPage.add", topFor: ["add a device", "add device", "new device"], synonyms: ["add a computer", "add a server", "add a phone", "connect a device"] },@@ -221,7 +224,7 @@ export const SETTINGS_INDEX: readonly SettingsIndexEntry[] = [{ id: "all-bots", page: "bots", labelKey: "settings.page.bots", topFor: ["all bots"] },{ id: "browser", page: "desktops", anchor: "browser", labelKey: "settings.experimental.browser", synonyms: ["browser", "profiles", "browser profiles", "open sites", "new browser"] },{ id: "desktop-kinds", page: "desktops", anchor: "desktops", labelKey: "settings.desktops.title", topFor: ["private desktop", "sandbox", "docker", "podman", "container", "vps", "own server"], synonyms: ["cloud desktops", "desktop", "vm"] },- { id: "saved-steps", page: "desktops", anchor: "automation", labelKey: "settings.savedSteps.title", advanced: true, synonyms: ["repeat", "saved steps", "without ai"] },+ { id: "saved-steps", page: "desktops", anchor: "automation", labelKey: "settings.savedSteps.title", advanced: true, when: (ctx) => ctx.savedSteps === true, synonyms: ["repeat", "saved steps", "without ai"] },{ id: "vault", page: "vault", labelKey: "settings.section.vault", topFor: ["password", "passwords", "login", "logins"], synonyms: ["secrets", "1password", "2fa", "totp"] },{ id: "spending", page: "usage", labelKey: "settings.page.spending", topFor: ["spending", "cost", "costs", "tokens", "money"], synonyms: ["usage"] },{ id: "grok-move", page: "transfer", anchor: "grok-move", labelKey: "settings.import.grokTitle", sectionKey: "settings.data.bringIn", topFor: ["grok", "grok bot", "move from"], synonyms: ["import", "bring", "another app"] },diff --git a/src/styles.css b/src/styles.cssindex 491c4df9f9..de22bf93da 100644--- a/src/styles.css+++ b/src/styles.css@@ -3914,7 +3914,9 @@ button:disabled.bg-danger {sits beside the chat). A hairline in the frame's edge colour runs along the card's top, round its corners and downthe sidebar's side. The open tab's ground is the card's and slides between tabs; its foot curves out into the band.Separators sit only between two closed tabs, neither under the pointer. Every control in the band is 32px tall on- the sidebar buttons' centre line, 10px apart as the sidebar's are, and the band's end inset mirrors the sidebar's. */+ the sidebar buttons' centre line, 10px apart as the sidebar's are, and the band's end inset mirrors the sidebar's;+ Simple's sidebar buttons step down to 32px beside it on the same line. Midnight's frame sits a step darker than its+ sidebar elsewhere, so the card's corners read as clearly as Daylight's. */@media (min-width: 768px) {[data-chathead-tabs] {--chat-card-radius: var(--radius-xl);@@ -3930,6 +3932,10 @@ button:disabled.bg-danger {[data-chathead-tabs]:has([data-panel-beside])::after { display: none; }:root:has([data-chathead-tabs="simple"]) [data-sidebar] { border-image: linear-gradient(to bottom, transparent 60px, var(--color-edge) 60px) 1; }:root:has([data-chathead-tabs="advanced"]) [data-sidebar] { border-image: linear-gradient(to bottom, transparent 54px, var(--color-edge) 54px) 1; }+ :root[data-skin="midnight"]:has([data-chathead-tabs]) { --color-frame: #0a0a0a; }+ :root[data-skin="midnight"]:has([data-chathead-tabs]) :is([data-sidebar], [data-places-rail], [data-chathead-tabs]) { --color-panel: #0a0a0a; }+ :root:has([data-chathead-tabs="simple"]) [data-sidebar-top-row="simple"] { padding-top: 14px; }+ :root:has([data-chathead-tabs="simple"]) [data-sidebar-top-row="simple"] :is([data-rail-toggle], [data-sidebar-top-buttons] button.size-9) { width: 32px; height: 32px; }[data-chathead-tabs] [data-chathead-row] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; height: 100%; }[data-chathead-tabs] [data-chathead-identity] { grid-column: 2; justify-self: stretch; align-self: stretch; -webkit-app-region: drag !important; }[data-chathead-tabs] [data-chathead-identity] > :not([data-thread-tabs], [data-chathead-status]) { display: none; }