Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Merge #7345: browser idle timeout with Never, and the new browser keeps session sign-ins
milind-soni3affb1a29a2b
diff --cc server/config.test.tsindex b5e739e6ac,4e0c69cbac..008b897209--- a/server/config.test.ts+++ b/server/config.test.ts@@@ -574,20 -569,8 +574,20 @@@ describe("configuration boundaries", (expect(browserEngineAttachCdpUrl({ browserEngine: { attachCdpUrl: "" } })).toBeNull();});+ it("keeps a private per-profile Chrome address while migrating a legacy partition", () => {+ const configured = { id: "Scout", name: "Scout Chrome", browser: "chrome", cdpUrl: " http://127.0.0.1:9333 " };+ expect(parseStoredConfig({ browserProfiles: [configured] }).browserProfiles).toEqual([+ { ...configured, id: "scout", partitionId: "Scout", cdpUrl: "http://127.0.0.1:9333" },+ ]);+ for (const cdpUrl of ["", "70000", "ftp://localhost:9333", "https://", "https://somehost:70000"]) {+ expect(() => parseStoredConfig({ browserProfiles: [{ ...configured, cdpUrl }] })).toThrow("browserProfiles.0.cdpUrl");+ }+ expect(() => parseStoredConfig({ browserProfiles: [{ id: "scout", name: configured.name, cdpUrl: configured.cdpUrl }] })).toThrow("browserProfiles.0.cdpUrl");+ expect(() => parseConfigPatch({ browserProfiles: [{ ...configured, id: "scout" }] })).toThrow();+ });+- it("takes browserEngine.idleTimeoutMinutes as whole minutes up to the engine's own hour", () => {- for (const value of [1, 10, 60]) {+ it("takes browserEngine.idleTimeoutMinutes as whole minutes from 0 (never) up to the engine's own hour, and clears on null patch", () => {+ for (const value of [0, 1, 10, 60]) {expect(parseStoredConfig({ browserEngine: { idleTimeoutMinutes: value } })).toEqual({ browserEngine: { idleTimeoutMinutes: value } });expect(parseConfigPatch({ browserEngine: { idleTimeoutMinutes: value } })).toEqual({ browserEngine: { idleTimeoutMinutes: value } });}diff --cc server/config.tsindex 07249681cc,136011fcf1..55caf95f92--- a/server/config.ts+++ b/server/config.ts@@@ -31,8 -31,7 +31,8 @@@ import { isRemoteMcpServer, mcpServerSeimport { parseJson, schemaIssue, type JsonObject, type JsonValue } from "./schema.ts";import { deciderConfigSchema, type DeciderConfig } from "./decider/config.ts";import { fishKeyFromLiveKey, liveConfigSchema, liveConfigWithEnv, liveSettingEnv, type LiveConfig } from "./live-config.ts"; import { hearingConfigShape } from "./tts/hearing-config.ts";- import { browserEngineConfigSchema, browserProfileSchema, isValidCdpTarget, legacyBrowserProfileSchema, type BrowserEngineConfig, type BrowserProfile } from "./browser/config.ts";-import { browserEngineConfigSchema, browserEnginePatchSchema, isValidCdpTarget, type BrowserEngineConfig } from "./browser/config.ts";++import { browserEngineConfigSchema, browserEnginePatchSchema, browserProfileSchema, isValidCdpTarget, legacyBrowserProfileSchema, type BrowserEngineConfig, type BrowserProfile } from "./browser/config.ts";+export type { BrowserProfile } from "./browser/config.ts";import { roomContextSettings } from "./room-context-settings.ts"; import { usageCapsSchema, type UsageCapsConfig } from "./usage-caps-config.ts";import { localVmConfigSchema } from "./local-vm-settings.ts";export * from "./local-vm-settings.ts";diff --cc server/host/browser.test.tsindex 7fc643d39c,f3f625a917..4d4acb285a--- a/server/host/browser.test.ts+++ b/server/host/browser.test.ts@@@ -504,41 -504,8 +504,41 @@@ describe("My Chrome on My Cloud, throug});});+describe("configured My Chrome targets", () => {+ it("routes each turn and viewer to its own profile's CDP endpoint, with a global fallback", async () => {+ vi.mocked(browserEngineStatus).mockReturnValue({ kind: "ready", binaryPath: "/fixture/agent-browser", version: "0.37.0", managed: false });+ try {+ const { cfg, host, bots } = setup("chrome", { server: true });+ cfg.browserProfiles = [+ { id: "scout", name: "Scout Chrome", browser: "chrome", cdpUrl: "http://127.0.0.1:9333" },+ { id: "chief", name: "Chief Chrome", browser: "chrome", cdpUrl: "http://127.0.0.1:9444" },+ { id: "shared", name: "Shared Chrome", browser: "chrome" },+ ];+ expect(host.usesMyChrome("scout")).toBe(true);+ expect(host.usesMyChrome("shared")).toBe(false);+ expect(host.browserProfilesForStatus()).toEqual([+ { id: "scout", name: "Scout Chrome", browser: "chrome", attachedChrome: true },+ { id: "chief", name: "Chief Chrome", browser: "chrome", attachedChrome: true },+ { id: "shared", name: "Shared Chrome", browser: "chrome" },+ ]);+ for (const [profile, target] of [["scout", "http://127.0.0.1:9333"], ["chief", "http://127.0.0.1:9444"], ["shared", "9555"]] as const) {+ if (profile !== "scout") cfg.browserEngine = { engine: "chrome", attachCdpUrl: "9555" };+ Object.assign(bots[0]!, { browserProfile: profile });+ const viewer = await host.currentBrowserSpec("scout", profile);+ const agent = await host.browserIntegration("scout", profile, turn);+ expect(agent?.session).toBe(viewer?.session);+ expect(viewer?.spec.env).toMatchObject({ AGENT_BROWSER_CDP: target, AGENT_BROWSER_RESTORE_SAVE: "never" });+ expect(agent?.spec.env).toMatchObject({ AGENT_BROWSER_CDP: target, AGENT_BROWSER_RESTORE_SAVE: "never" });+ }+ expect(host.currentBrowserSession("scout", "scout")).not.toBe(host.currentBrowserSession("scout", "chief"));+ } finally {+ vi.mocked(browserEngineStatus).mockRestore();+ }+ });+});+describe("how long an unused browser stays open", () => {- it("is three minutes on a Cloud home and ten on a desktop, unless config.json sets it", () => {+ it("is three minutes on a Cloud home and ten on a desktop, unless config.json sets it (including 0 for never)", () => {const cloud = setup(undefined, { cloudHome: true });expect(cloud.host.browserIdleMs()).toBe(3 * 60_000);cloud.cfg.browserEngine = { idleTimeoutMinutes: 20 };