Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Support a CDP address per My Chrome profile
skygunnerc11c91bac6f6
diff --git a/docs/browser-packaging.md b/docs/browser-packaging.mdindex 8d9c49ee7c..289669d1f0 100644--- a/docs/browser-packaging.md+++ b/docs/browser-packaging.md@@ -94,9 +94,26 @@ That computer lends Chrome only by its own **Your Chrome** switch, off bydefault and dropped when lending is turned off; Chrome then travels over thedevice link, to the DevTools port the computer finds itself, and only theperson's own conversations and routines use it. My Chrome works only on a-personal Cloud home: on a Team Cloud and on self-hosted servers profiles stay-built-in. Details: [the browser engine plan, step 5](plans/browser-engine.md)-and [MausBot Cloud](cloud-pro.md#your-chrome).+personal Cloud home when connecting over the device link. Details: [the browser+engine plan, step 5](plans/browser-engine.md) and [MausBot Cloud](cloud-pro.md#your-chrome).++On a self-hosted server, add a `cdpUrl` to each My Chrome profile that needs+its own running browser. Set it in the server’s `config.json` and restart+OpenMausBot. Assign each bot the corresponding profile in its Browser panel.++```json+{+ "browserProfiles": [+ { "id": "scout-chrome", "name": "Scout Chrome", "browser": "chrome", "cdpUrl": "http://127.0.0.1:9333" },+ { "id": "chief-chrome", "name": "Chief Chrome", "browser": "chrome", "cdpUrl": "http://127.0.0.1:9444" }+ ]+}+```++A My Chrome profile without `cdpUrl` uses `browserEngine.attachCdpUrl` when+set. Switching a profile to Built-in in Settings removes its configured+CDP address. Each address must point to a separately running Chrome if you+want separate tabs and sign-ins. Keep DevTools endpoints on a network you control.## What a bot's browser can reachdiff --git a/screenshots/issue-3975/after-768-daylight.png b/screenshots/issue-3975/after-768-daylight.pngnew file mode 100644index 0000000000..b0848d063fBinary files /dev/null and b/screenshots/issue-3975/after-768-daylight.png differdiff --git a/screenshots/issue-3975/after-768-midnight.png b/screenshots/issue-3975/after-768-midnight.pngnew file mode 100644index 0000000000..3ca47e6880Binary files /dev/null and b/screenshots/issue-3975/after-768-midnight.png differdiff --git a/screenshots/issue-3975/before-768-daylight.png b/screenshots/issue-3975/before-768-daylight.pngnew file mode 100644index 0000000000..f758ea432cBinary files /dev/null and b/screenshots/issue-3975/before-768-daylight.png differdiff --git a/screenshots/issue-3975/before-768-midnight.png b/screenshots/issue-3975/before-768-midnight.pngnew file mode 100644index 0000000000..2943fafbaeBinary files /dev/null and b/screenshots/issue-3975/before-768-midnight.png differdiff --git a/server/browser/config.ts b/server/browser/config.tsindex a167e6b6c1..c7d1590d9c 100644--- a/server/browser/config.ts+++ b/server/browser/config.ts@@ -16,6 +16,30 @@ export function isValidCdpTarget(value: unknown): value is string {return CDP_URL.test(value);}+const LEGACY_BROWSER_PROFILE_ID = /^[A-Za-z0-9_-]{1,40}$/;+const BROWSER_PROFILE_ID = /^[a-z0-9_-]{1,40}$/;++/** A named browser session whose id selects a durable Electron partition. */+export const browserProfileSchema = z.object({+ // Lowercase only: Chromium partition directories collide on case-insensitive filesystems.+ id: z.string().regex(BROWSER_PROFILE_ID).refine((id) => id !== "guest", "guest is reserved"),+ name: z.string().trim().min(1).max(40),+ /** "chrome" uses the person's own running Chrome (My Chrome). */+ browser: z.literal("chrome").optional(),+}).strict();++export const legacyBrowserProfileSchema = browserProfileSchema.extend({+ id: z.string().regex(LEGACY_BROWSER_PROFILE_ID).refine((id) => id !== "guest", "guest is reserved"),+ partitionId: z.string().regex(LEGACY_BROWSER_PROFILE_ID).refine((id) => id !== "guest", "guest is reserved").optional(),+ /** DevTools endpoint set only in config.json. It may contain a credential. */+ cdpUrl: z.string().trim().max(2048).refine((value) => isValidCdpTarget(value) && (CDP_PORT.test(value) || URL.canParse(value)),+ { message: "Enter a CDP port (1-65535) or an http(s)/ws(s) URL" }).optional(),+}).refine((profile) => profile.cdpUrl === undefined || profile.browser === "chrome", {+ path: ["cdpUrl"], message: "A CDP address requires a My Chrome profile",+});++export type BrowserProfile = z.output<typeof legacyBrowserProfileSchema>;+export type BrowserEngineKind = "agent-browser" | "chrome";/** `attachCdpUrl`: a running Chrome that My Chrome profiles attach to. Config only, never env: the ambient environment must not redirect a bot's browser. */diff --git a/server/config.test.ts b/server/config.test.tsindex 32aee1cb98..0c67160d63 100644--- a/server/config.test.ts+++ b/server/config.test.ts@@ -569,6 +569,18 @@ 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]) {expect(parseStoredConfig({ browserEngine: { idleTimeoutMinutes: value } })).toEqual({ browserEngine: { idleTimeoutMinutes: value } });@@ -1909,6 +1921,15 @@ describe("credential env preference", () => {});});+ it("preserves per-profile CDP targets through settings edits", () => {+ const profile = { id: "scout", name: "Scout", browser: "chrome", cdpUrl: "9333" };+ writeFileSync(join(DATA_DIR, "config.json"), JSON.stringify({ browserProfiles: [profile] }));+ saveConfig({ browserProfiles: [{ id: "scout", name: "Scout Chrome", browser: "chrome" }] });+ expect(loadConfig().browserProfiles).toEqual([{ ...profile, name: "Scout Chrome" }]);+ saveConfig({ browserProfiles: [{ id: "scout", name: "Scout Built-in" }] });+ expect(loadConfig().browserProfiles).toEqual([{ id: "scout", name: "Scout Built-in" }]);+ });+it("loads legacy browser profiles without resetting config and canonicalizes them on the next write", () => {const path = join(DATA_DIR, "config.json");writeFileSync(path, JSON.stringify({diff --git a/server/config.ts b/server/config.tsindex 502f1b16fa..bca3ff967b 100644--- a/server/config.ts+++ b/server/config.ts@@ -31,15 +31,14 @@ import { isRemoteMcpServer, mcpServerServes, parseStoredMcpServer } from "./mcp-import { 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, isValidCdpTarget, type BrowserEngineConfig } from "./browser/config.ts";+import { browserEngineConfigSchema, 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";export * from "./vps-config.ts";const optionalText = z.string().optional(), secretText = z.string().trim().optional(); // secretText: a saved key without a paste's surrounding whitespace (a trailing newline), so it can go in a header.-const LEGACY_BROWSER_PROFILE_ID = /^[A-Za-z0-9_-]{1,40}$/;-const BROWSER_PROFILE_ID = /^[a-z0-9_-]{1,40}$/;/** Fish Audio speech models (`tts.fishModel`); unset means `s2.1-pro`, and `s2.1-pro-free` is Fish's free tier. */export const FISH_TTS_MODELS = ["s2.1-pro", "s2.1-pro-free"] as const;@@ -71,21 +70,6 @@ const mcpConfigSchema = z.object({.max(MAX_MCP_CALL_TIMEOUT_MINUTES).optional(),}).strict();-/** A named browser session; its id names a durable Electron partition. */-const browserProfileSchema = z.object({- // Lowercase only: Chromium partition directories collide on case-insensitive filesystems.- id: z.string().regex(BROWSER_PROFILE_ID).refine((id) => id !== "guest", "guest is reserved"),- name: z.string().trim().min(1).max(40),- /** "chrome" uses the person's own running Chrome (My Chrome); absent is the built-in browser. */- browser: z.literal("chrome").optional(),-}).strict();-const legacyBrowserProfileSchema = z.object({- id: z.string().regex(LEGACY_BROWSER_PROFILE_ID).refine((id) => id !== "guest", "guest is reserved"),- name: z.string().trim().min(1).max(40),- partitionId: z.string().regex(LEGACY_BROWSER_PROFILE_ID).refine((id) => id !== "guest", "guest is reserved").optional(),- browser: z.literal("chrome").optional(),-}).strict();-interface StoredBrowserProfileMigration {profiles: BrowserProfile[];aliases: ReadonlyMap<string, string>;@@ -171,6 +155,7 @@ function migrateStoredBrowserProfiles(const partitionId = effectivePartitions[index]!;const migrated: BrowserProfile = { id, name: profile.name };if (profile.browser) migrated.browser = profile.browser;+ if (profile.cdpUrl) migrated.cdpUrl = profile.cdpUrl;if (partitionId !== id) migrated.partitionId = partitionId;if (!aliases.has(profile.id)) aliases.set(profile.id, id);return migrated;@@ -473,9 +458,6 @@ export interface AppConfig extends HelperConfig {browserEngine?: BrowserEngineConfig;instances?: InstanceConfigMap;}-export type BrowserProfile = z.output<typeof browserProfileSchema> & {- partitionId?: string;-};export type ConfigPatch = z.output<typeof appConfigPatchSchema>;/** Electron storage must use this, never the profile id. */@@ -937,8 +919,9 @@ export function saveConfig((storedProfiles.success ? storedProfiles.data : []).map((profile) => [profile.id, profile]),);const nextProfiles: BrowserProfile[] = checkedPatch.browserProfiles.map((profile) => {- const partitionId = existingProfiles.get(profile.id)?.partitionId;- return partitionId ? { ...profile, partitionId } : profile;+ const previous = existingProfiles.get(profile.id);+ const cdpUrl = profile.browser === "chrome" ? previous?.cdpUrl : undefined;+ return { ...profile, ...(previous?.partitionId ? { partitionId: previous.partitionId } : {}), ...(cdpUrl ? { cdpUrl } : {}) };});const routingConflict = browserProfileReplacementConflict(storedProfiles.success ? storedProfiles.data : [],diff --git a/server/host/browser.test.ts b/server/host/browser.test.tsindex 9d2b7473dc..7fc643d39c 100644--- a/server/host/browser.test.ts+++ b/server/host/browser.test.ts@@ -504,6 +504,39 @@ describe("My Chrome on My Cloud, through the person's lent Chrome", () => {});});+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", () => {const cloud = setup(undefined, { cloudHome: true });diff --git a/server/host/browser.ts b/server/host/browser.tsindex f0dd46d71c..1b9fbd6b46 100644--- a/server/host/browser.ts+++ b/server/host/browser.ts@@ -219,7 +219,7 @@ export function createBrowserHost(deps: BrowserHostDeps) {// The desktop's idle time, not a Cloud home's shorter one: each reconnect may make Chrome ask the person to Allow again.const doors = lentChrome ? new LentChromeDoors({ route: () => lentChrome.route(), allowed: lentChromeAllowed, idleMs: () => browserIdleMs(cfg, { cloudHome: false }) }) : undefined;const doorUrls = new Map<string, string>();- const leftovers = new Map<string, Promise<void>>();+ const leftovers = new Map<string, Promise<boolean>>();async function lentChromeDoor(session: string): Promise<string | undefined> {if (!doors) return undefined;// A browser already running when this server first opens the session's door was told another address: an earlier@@ -231,11 +231,24 @@ export function createBrowserHost(deps: BrowserHostDeps) {doorUrls.set(session, url);return url;}- async function closeLeftover(session: string): Promise<void> {+ async function closeLeftover(session: string): Promise<boolean> {const engine = browserEngineStatus();- if (engine.kind !== "ready" || !browserRunning(session, undefined)) return;+ if (engine.kind !== "ready" || !browserRunning(session, undefined)) return true;const closed = await closeBrowserSession(engine.binaryPath, browserRuntimeEnv({ AGENT_BROWSER_SESSION: session })).catch(() => false);- if (!closed) console.warn(`browser ${session}: could not close the browser left running before its door to your Chrome opened`);+ if (!closed) console.warn(`browser ${session}: could not close the browser left running before connecting to My Chrome`);+ return closed;+ }+ async function prepareProfileChrome(profileId: string | undefined, session: string): Promise<void> {+ if (!profileCdpUrl(profileId)) return;+ let closed = leftovers.get(session);+ if (!closed) {+ closed = closeLeftover(session);+ leftovers.set(session, closed);+ }+ if (!await closed) {+ if (leftovers.get(session) === closed) leftovers.delete(session);+ throw new Error("Could not disconnect the previous My Chrome session. Reopen the browser to try again.");+ }}/** A profile switched back to the built-in browser keeps its session name and its door, but its calls no longer use it. */function viaDoor(session: string, spec: { env: NodeJS.ProcessEnv }): boolean {@@ -532,12 +545,19 @@ export function createBrowserHost(deps: BrowserHostDeps) {if (closed) await browserRuntime.close(session);else console.warn(`temporary browser ${session}: could not close its session; run agent-browser --session ${session} close on this server`);}+ function profileCdpUrl(profileId: string | undefined): string | undefined {+ if (!profileId || CLOUD_HOME || deps.HOSTED_WORKSPACE) return undefined;+ return cfg.browserProfiles?.find((profile) => profile.id === profileId && profile.browser === "chrome")?.cdpUrl;+ }function myChromeAvailable(): boolean {return DESKTOP_MANAGED || browserEngineAttachCdpUrl(cfg) !== null || Boolean(lentChrome?.lender());}+ function browserProfilesForStatus() {+ return (cfg.browserProfiles ?? []).map(({ cdpUrl, ...profile }) => ({ ...profile, ...(cdpUrl && profileCdpUrl(profile.id) ? { attachedChrome: true as const } : {}) }));+ }/** A My Chrome profile on My Cloud: the person's lent Chrome, through this session's door. */function lentChromeSession(profileId: string | undefined): boolean {- return !DESKTOP_MANAGED && browserEngineAttachCdpUrl(cfg) === null && doors !== undefined && usesMyChrome(profileId);+ return !DESKTOP_MANAGED && !profileCdpUrl(profileId) && browserEngineAttachCdpUrl(cfg) === null && doors !== undefined && usesMyChrome(profileId);}/** Where My Chrome is on My Cloud: the computer that lends it, or that one could. */function lentChromeSummary(): { myChromeOn?: ChromeLender; myChromeLendable?: true } {@@ -548,12 +568,12 @@ export function createBrowserHost(deps: BrowserHostDeps) {/** On My Cloud a My Chrome profile stays the person's Chrome while no computer lends it: its calls say so, and never* fall back to the built-in browser, whose sign-ins differ. */function usesMyChrome(profileId: string | undefined): boolean {- return Boolean(profileId) && (myChromeAvailable() || lentChrome !== undefined)+ return Boolean(profileId) && (Boolean(profileCdpUrl(profileId)) || myChromeAvailable() || lentChrome !== undefined)&& cfg.browserProfiles?.some((profile) => profile.id === profileId && profile.browser === "chrome") === true;}/** `cloudUrl`: the session's browser runs on the bot's cloud computer, reached through this address. */function browserSessionSpec(binaryPath: string, session: string, profile: string | undefined, egressPort?: number, cdpUrl?: string, cloudUrl?: string) {- const attachCdpUrl = cdpUrl ?? browserEngineAttachCdpUrl(cfg);+ const attachCdpUrl = cdpUrl ?? profileCdpUrl(profile) ?? browserEngineAttachCdpUrl(cfg);const locale = browserLanguage(process.env, deps.language?.());return agentBrowserIntegration({binaryPath, session, encryptionKey: browserEngineEncryptionKey(), persistent: profile !== "guest", egressPort,@@ -630,6 +650,7 @@ export function createBrowserHost(deps: BrowserHostDeps) {return null;}const session = currentBrowserSession(botId, profile, audience);+ await prepareProfileChrome(browserProfileId, session);const lent = lentChromeSession(browserProfileId);const cdpUrl = lent ? await lentChromeDoor(session) : undefined;const cloudUrl = lent ? undefined : await cloudBrowserUrl(botId, profile, session, audience, options.opening, options.params);@@ -656,6 +677,7 @@ export function createBrowserHost(deps: BrowserHostDeps) {const used = usedBrowserSessions.get(session);if (used) return { session, spec: used };const profileId = browserProfileIdOf(profile);+ await prepareProfileChrome(profileId, session);const cdpUrl = lentChromeSession(profileId) ? await lentChromeDoor(session) : undefined;const cloudUrl = cloudBrowser?.active(session) ?? undefined;return { session, spec: browserSessionSpec(engine.binaryPath, session, profileId, usesMyChrome(profileId) || cloudUrl ? undefined : await browserEgress.open(session), cdpUrl, cloudUrl) };@@ -893,7 +915,7 @@ export function createBrowserHost(deps: BrowserHostDeps) {return {browserRuntime, browserLive, browserRoom, usedBrowserSessions, browserSweep, temporaryBrowserSessions, browserIdleMs: idleMs,- currentBrowserSession, forgetTemporaryBrowser, myChromeAvailable, lentChromeSummary, usesMyChrome, browserSessionSpec, browserIntegration,+ currentBrowserSession, forgetTemporaryBrowser, myChromeAvailable, browserProfilesForStatus, lentChromeSummary, usesMyChrome, browserSessionSpec, browserIntegration,browserReady, currentBrowserSpec, loginInput, browserSystemPrompt, signedInSitesRefusal, closeBrowser, browserEngineSwitched,eraseDeletedBrowser, engineSummary, engineBrowsers, browserAudience, browserSessionsOf, signedInSitesTarget, uploadPaths,eraseAudienceBrowsers, browserOwners, closeCapBrowsers, signInBackupRoutes,diff --git a/server/index.ts b/server/index.tsindex 2d5930c9d1..e86e6ae8ee 100644--- a/server/index.ts+++ b/server/index.ts@@ -2352,7 +2352,7 @@ function cancelDirectTurnDispatch(botId: string, expectedThreadId?: string): Dirconst {browserRuntime, browserLive, usedBrowserSessions, browserSweep, temporaryBrowserSessions,- currentBrowserSession, forgetTemporaryBrowser, myChromeAvailable, usesMyChrome, lentChromeSummary, browserSessionSpec, browserIntegration,+ currentBrowserSession, forgetTemporaryBrowser, myChromeAvailable, browserProfilesForStatus, usesMyChrome, lentChromeSummary, browserSessionSpec, browserIntegration,browserReady, currentBrowserSpec, loginInput, browserSystemPrompt, closeBrowser, browserEngineSwitched, eraseDeletedBrowser, engineSummary, browserSessionsOf, signedInSitesTarget, uploadPaths, eraseAudienceBrowsers, browserOwners, closeCapBrowsers, cloudBrowserBusy, cloudBrowserReport, signInBackupRoutes,} = createBrowserHost({ cloudBrowser: CLOUD_PERSONAL ? { used: (owner, windowMs) => cloudComputerPower.used(owner, windowMs), folder: (botId) => { const bot = store.bot(botId); return bot ? bot.cwd || workspaceDir(bot.id) : null; } } : undefined, cfg, language: appLanguage, store: () => store, turnResources, activeInternalGenerationByThread, mintInternalCapability, DESKTOP_MANAGED, CLOUD_HOME, HOSTED_WORKSPACE, PORT, engineMemory, audienceOf: teamHost.browserAudience, ...(CLOUD_TEAM ? { browserBox: (fd: number, ro: readonly string[]) => botBox.browserBox(fd, ro) } : {}), lendRefusal: (turn) => cloudLendingRefusal({ botId: store.botByThread(turn.threadId)?.id ?? "", threadId: turn.threadId, generation: turn.generation }), device: () => deviceLinks.route(CLOUD_HOME_LENDER) ?? sharedComputers.internetAway(CLOUD_HOME_LENDER) ?? { unshared: true as const }, lentChrome: CLOUD_PERSONAL ? { route: () => deviceLinks.chromeRoute(CLOUD_HOME_LENDER), lender: () => sharedComputers.chromeLender(CLOUD_HOME_LENDER) } : undefined });@@ -11632,8 +11632,8 @@ function configStatus() {...(cfg.onboarding?.firstTurnAt ? { firstTurnAt: cfg.onboarding.firstTurnAt } : {}),},browserEngine: browserEngineSummary(),- // partitionId is read-only routing metadata: config PATCH rejects callers that try to choose it.- browserProfiles: cfg.browserProfiles ?? [],+ // partitionId and CDP address are read-only routing metadata: config PATCH cannot select either.+ browserProfiles: browserProfilesForStatus(),signIn: { admins: cfg.signIn?.admins ?? [], members: cfg.signIn?.members ?? [] },membership: workspaceMembership(), workspaceBanner: workspaceBannerSummary(),};diff --git a/src/components/BrowserProfilesManager.test.ts b/src/components/BrowserProfilesManager.test.tsindex 2413da1c3a..6d4c6e6b33 100644--- a/src/components/BrowserProfilesManager.test.ts+++ b/src/components/BrowserProfilesManager.test.ts@@ -92,6 +92,17 @@ describe("browser profile manager", () => {expect(html).toContain("Signed-in sites");});+ it("shows the configured Chrome for a profile even without a workspace-wide target", () => {+ fixture.myChrome = false;+ fixture.profiles = [{ id: "work", name: "Work", browser: "chrome", attachedChrome: true }];+ const html = renderToStaticMarkup(createElement(BrowserProfilesManager, { bot }));+ expect(html).toContain('<option value="chrome" selected="">My Chrome</option>');+ expect(html).toContain("This profile uses the Chrome set in the server configuration.");+ expect(html).not.toContain("Signed-in sites");+ expect(html).not.toContain("My Chrome is for the desktop app");+ expect(html).not.toContain("can't browse");+ });+it("on My Cloud, My Chrome names the lent computer and says when it is offline", () => {fixture.engine = { myChrome: true, myChromeOn: { name: "Studio Mac", device: "Mac", online: false } };fixture.profiles = [{ id: "work", name: "Work", browser: "chrome" }];diff --git a/src/components/BrowserProfilesManager.tsx b/src/components/BrowserProfilesManager.tsxindex f766617d13..acca63cd3d 100644--- a/src/components/BrowserProfilesManager.tsx+++ b/src/components/BrowserProfilesManager.tsx@@ -156,12 +156,14 @@ export function BrowserProfilesManager({ bot, onProfileChanged, disabled = falseconst selectedProfile = profiles.find((profile) => profile.id === selected);const usersOf = (profileId: string) => bots.filter((candidate) => candidate.browserProfile === profileId).map((candidate) => candidate.name);// On My Cloud a My Chrome profile keeps waiting for a lent Chrome, so it has no built-in sign-ins to list.- const usesMyChrome = (profile: BrowserProfile | undefined) => profile?.browser === "chrome" && (myChrome || myChromeLendable);- const chromeNote = <>- <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeHint")}</p>- {myChromeOn && <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeLent", { name: myChromeOn.name, device: computerDeviceText(myChromeOn.device) })}</p>}- {myChromeOn?.online === false && <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeLentOffline", { name: myChromeOn.name })}</p>}- </>;+ const usesMyChrome = (profile: BrowserProfile | undefined) => profile?.browser === "chrome" && (profile.attachedChrome || myChrome || myChromeLendable);+ const chromeNote = (profile: BrowserProfile | undefined) => profile?.attachedChrome+ ? <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeConfigured")}</p>+ : <>+ <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeHint")}</p>+ {myChromeOn && <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeLent", { name: myChromeOn.name, device: computerDeviceText(myChromeOn.device) })}</p>}+ {myChromeOn?.online === false && <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeLentOffline", { name: myChromeOn.name })}</p>}+ </>;if (settingsLook && !currentBot) {return (<SettingsGroup label={t("settings.profiles.title")} block="profiles"@@ -185,10 +187,10 @@ export function BrowserProfilesManager({ bot, onProfileChanged, disabled = false<span className="flex items-center gap-2">{t("settings.profiles.browserLabel")}<Select size="sm" value={profile.browser ?? ""} disabled={locked} onChange={(event) => void setBrowser(profile, event.target.value)} aria-label={t("settings.profiles.browserLabel")}><option value="">{t("settings.profiles.builtIn")}</option>- <option value="chrome" disabled={!myChrome}>{t("settings.profiles.myChrome")}</option>+ <option value="chrome" disabled={!myChrome && !profile.attachedChrome}>{t("settings.profiles.myChrome")}</option></Select></span>- {chrome ? chromeNote : <SignedInSites target={{ profile: profile.id }} sharedBy={users} disabled={locked} />}+ {chrome ? chromeNote(profile) : <SignedInSites target={{ profile: profile.id }} sharedBy={users} disabled={locked} />}</span>}><button type="button" disabled={locked} onClick={() => { setRenaming({ id: profile.id, name: profile.name }); setError(""); }} className="settings-quiet cursor-pointer">{t("settings.profiles.rename")}</button><button type="button" onClick={() => void remove(profile)} disabled={locked || Boolean(blocked)} title={blocked ?? t("settings.profiles.deleteTitle")} aria-label={`${t("common.delete")} ${profile.name}`} data-danger="" className="settings-quiet cursor-pointer">{t("common.delete")}</button>@@ -237,8 +239,8 @@ export function BrowserProfilesManager({ bot, onProfileChanged, disabled = false{currentBot.busy ? t("settings.profiles.stopToSwitch") : selected === "guest" ? t("settings.profiles.temporaryHint") : t("settings.profiles.sharedHint")}</p>{usesMyChrome(selectedProfile) ? <>- {chromeNote}- {!myChrome && <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeShare")}</p>}+ {chromeNote(selectedProfile)}+ {!myChrome && !selectedProfile?.attachedChrome && <p className="text-[11px] leading-relaxed text-ink-secondary">{t("settings.profiles.myChromeShare")}</p>}</>: (selected === "" || selectedProfile) && (<SignedInSites key={`${currentBot.id}:${selected}`} target={{ bot: currentBot.id }} scope={browserScope(state.config?.team, bot?.threadId)} sharedBy={selected ? usersOf(selected) : [currentBot.name]} disabled={locked} />@@ -254,7 +256,7 @@ export function BrowserProfilesManager({ bot, onProfileChanged, disabled = false<button type="submit" disabled={locked || !name.trim() || profiles.length >= 20} className={`${buttonClass} flex items-center gap-1`}><Plus size={13} />{t("settings.profiles.create")}</button></form>{profiles.length >= 20 && <p className="text-[11px] text-ink-secondary">{t("settings.profiles.limit")}</p>}- {!myChrome && profiles.length > 0 && <p className="text-[11px] leading-relaxed text-ink-secondary">{t(myChromeLendable ? "settings.profiles.myChromeShare" : "settings.profiles.myChromeUnavailable")}</p>}+ {!myChrome && profiles.length > 0 && profiles.every((profile) => !profile.attachedChrome) && <p className="text-[11px] leading-relaxed text-ink-secondary">{t(myChromeLendable ? "settings.profiles.myChromeShare" : "settings.profiles.myChromeUnavailable")}</p>}{!profiles.length && <p className="text-[12px] text-ink-secondary">{t("settings.profiles.sharedEmpty")}</p>}<div className="divide-y divide-hairline/30">{profiles.map((profile) => {@@ -284,10 +286,10 @@ export function BrowserProfilesManager({ bot, onProfileChanged, disabled = false{t("settings.profiles.browserLabel")}<Select size="sm" value={profile.browser ?? ""} disabled={locked} onChange={(event) => void setBrowser(profile, event.target.value)}><option value="">{t("settings.profiles.builtIn")}</option>- <option value="chrome" disabled={!myChrome}>{t("settings.profiles.myChrome")}</option>+ <option value="chrome" disabled={!myChrome && !profile.attachedChrome}>{t("settings.profiles.myChrome")}</option></Select></label>- {chrome ? chromeNote : <SignedInSites target={{ profile: profile.id }} sharedBy={users} disabled={locked} />}+ {chrome ? chromeNote(profile) : <SignedInSites target={{ profile: profile.id }} sharedBy={users} disabled={locked} />}</div></div>);diff --git a/src/locales/en.json b/src/locales/en.jsonindex cf38252006..2a76fd886e 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -4080,6 +4080,7 @@"settings.profiles.browserLabel": "Browser","settings.profiles.builtIn": "Built-in","settings.profiles.myChrome": "My Chrome",+ "settings.profiles.myChromeConfigured": "This profile uses the Chrome set in the server configuration. Sign in and out of sites in that Chrome.","settings.profiles.myChromeHint": "Bots on this profile act inside your real Chrome, signed in as you, with your cookies and your open tabs. Use it for sites that refuse the built-in browser, such as Google sign-in. To connect, open chrome://inspect/#remote-debugging in Chrome and turn remote debugging on; Chrome asks you to allow the connection. Sign in and out of sites in Chrome itself.","settings.profiles.myChromeUnavailable": "My Chrome is for the desktop app, where bots run on your own computer. Anywhere else, such as the Cloud, there is no Chrome of yours to use, so every profile uses the built-in browser.","settings.profiles.myChromeLent": "On My Cloud this is the Chrome on {name}, your {device}. It works while that {device} is awake with {app} open, in conversations you started yourself.",diff --git a/src/state/config-status.ts b/src/state/config-status.tsindex d2375d98f5..77f3144178 100644--- a/src/state/config-status.ts+++ b/src/state/config-status.ts@@ -248,6 +248,8 @@ export interface BrowserProfile {/** "chrome": the profile's bots use the person's own Chrome (My Chrome).* Absent is the built-in browser. */browser?: "chrome";+ /** The server config supplies a CDP address for this profile. */+ attachedChrome?: true;/** Read-only durable Electron routing inherited from legacy profiles.* Config PATCH payloads must omit it. */partitionId?: string;