Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(browser): offer the install in the panel the person is already on (#4066)
Lovin Maxwellaf125b41d293
diff --git a/src/components/BrowserPanel.test.ts b/src/components/BrowserPanel.test.tsindex b8fa8b3f03..b089510de5 100644--- a/src/components/BrowserPanel.test.ts+++ b/src/components/BrowserPanel.test.ts@@ -13,7 +13,7 @@ const fixture = vi.hoisted(() => ({}));vi.mock("@/state/store", async (importOriginal) => ({ ...await importOriginal<typeof import("@/state/store")>(), api: fixture.api, useStore: () => ({ state: fixture.state }) }));vi.mock("./BrowserProfilesManager", () => ({ BrowserProfilesManager: () => null }));-const { LiveBrowser } = await import("./BrowserPanel");+const { BrowserPanel, LiveBrowser } = await import("./BrowserPanel");(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;@@ -480,3 +480,25 @@ describe("a sign-in that stops at a passkey", () => {expect(notice()?.textContent).toContain(t("browser.passkey.lendPc", { name: "Pepper" }));});});++describe("the browser panel before the browser is installed", () => {+ async function renderUninstalled(scopes: string[]) {+ fixture.state = { config: { browserProfiles: [], browserEngine: { kind: "unavailable", installable: true } }, computerControl: {} };+ fixture.api.mockImplementation(async (path: string) => path === "/api/auth/session" ? { scopes } : { ok: true });+ await act(async () => root.render(createElement(BrowserPanel, { bot })));+ await flush();+ }++ it("offers the install here instead of sending an admin to the panel they are on", async () => {+ await renderUninstalled(["admin"]);+ expect(host.textContent).toContain(t("browser.panel.engineNotInstalledHelp", { name: "Pepper" }));+ expect(host.textContent).not.toContain(t("browser.notInstalled"));+ expect(button(t("browser.panel.installEngine")).disabled).toBe(false);+ });++ it("keeps the setup steps for someone who cannot install", async () => {+ await renderUninstalled([]);+ expect(host.textContent).toContain(t("browser.notInstalled"));+ expect(button(t("browser.panel.installEngine")).disabled).toBe(true);+ });+});diff --git a/src/components/BrowserPanel.tsx b/src/components/BrowserPanel.tsxindex 969c72bf95..c0455ea33d 100644--- a/src/components/BrowserPanel.tsx+++ b/src/components/BrowserPanel.tsx@@ -388,7 +388,7 @@ export function BrowserPanel({ bot, signIn, page }: { bot: Bot; signIn?: Browserif (engine?.kind === "engine" && !installing && !engine.installError) return <LiveBrowser key={bot.id} bot={bot} signIn={signIn} page={page} />;return <div className="flex min-h-0 flex-1 flex-col items-start justify-center gap-3 rounded-xl bg-card p-5"><div className="text-[15px] font-medium text-ink">{engine?.kind === "engine" ? t("browser.panel.installIncomplete") : t("browser.panel.engineNotInstalled")}</div>- <p className="text-[13px] leading-relaxed text-ink-secondary">{engine?.kind === "engine" ? t("browser.panel.installIncompleteHelp") : browserUnavailableReason(state.config)}</p>+ <p className="text-[13px] leading-relaxed text-ink-secondary">{engine?.kind === "engine" ? t("browser.panel.installIncompleteHelp") : engine?.installable && admin !== false ? t("browser.panel.engineNotInstalledHelp", { name: bot.name }) : browserUnavailableReason(state.config)}</p>{engine?.installable || engine?.kind === "engine" ? <button type="button" onClick={() => void install()} disabled={installing || admin !== true} className="rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-accent-ink disabled:opacity-60">{installing ? t("browser.panel.installing") : engine?.kind === "engine" ? t("browser.panel.retryInstall") : t("browser.panel.installEngine")}</button> : null}{(engine?.installError || error) && <p role="alert" className="text-[12px] text-danger">{error ?? engine?.installError}</p>}</div>;diff --git a/src/locales/en.json b/src/locales/en.jsonindex d7cdcc2a3c..2a1462a5f3 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -3247,6 +3247,7 @@"browser.panel.enableBot": "Enable the browser in this bot's profile to use it.","browser.panel.installIncomplete": "Browser installation incomplete","browser.panel.engineNotInstalled": "The browser isn't installed",+ "browser.panel.engineNotInstalledHelp": "Install it so {name} can open web pages. It's a one-time download of about 160 MB.","browser.panel.installIncompleteHelp": "agent-browser is installed, but Chrome setup has not finished. Retry the browser installation.","browser.panel.installing": "Installing… (a one-time download of about 160 MB)","browser.panel.retryInstall": "Retry browser installation",