Open-source Grok Bot alternative with a virtual machine that bots can use
My Chrome on My Cloud Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: a bot on My Cloud whose browser profile is My Chrome drives the person's real Chrome on their lent Mac or PC whenever that computer is online.
Architecture: the device link that lends the internet connection gets a second kind of stream, {chrome: true}. The lent computer answers it by connecting to its own Chrome's DevTools port and rewriting only the WebSocket upgrade. On My Cloud, a per-session loopback "door" hands agent-browser a ws:// address. Each connection through the door is checked with the existing mayLend rule, and the door routes it through that link.
Tech Stack: Node 22/24, TypeScript server (vitest), Electron main in .mjs (node --test), React + Tailwind renderer, ws.
Spec: docs/superpowers/specs/2026-10-26-cloud-my-chrome-design.md
Global Constraints
server/index.tsis pinned at 16238 lines byscripts/testing/file-size-ratchet.test.tsand may only shrink. Do every bit of wiring there on existing lines: lengthen a line, never add one.- Personal Cloud home only: the server uses a lent Chrome only when
CLOUD_PERSONAL, and advertisesmyChromeLinkonly whencloudTeam !== true. - Chrome is never lent by default.
defaultGrantkeepschromeonly when the previous grant hadchrome === true. - The Cloud never names a host or port for a Chrome stream. The lent computer connects only to
127.0.0.1:<port from its own DevToolsActivePort>. - No fallback: a My Chrome session on My Cloud never silently uses the built-in browser.
- New UI copy goes in
src/locales/en.jsononly (other locales fall back to English). - Match the surrounding code: short comments that say why, no new abstractions beyond the ones named here.
- Commit after each task. Every message ends with
Co-Authored-By: Claude Opus 5.5 <[email protected]>. Never push and never open a PR. - Known local failures on this Mac (Node 22, sandboxed network), not caused by this work: in
server/device-links.test.ts, "opens only for the session and secret that registered the computer…" times out. Inelectron/device-link.node-test.mjs, subtests 7–11 are cancelled. Don't chase them; CI on Node 24 is the reference.
Review Focus
- A conversation someone else wrote in reuses a browser whose Chrome connection an owner turn opened. Expect the connection to be dropped when that turn claims the browser, and its tool calls refused. Test in Task 6.
- The Mac sleeps or quits mid-turn. Expect the next tool call to explain "offline" in one line instead of a raw CDP error. Tests in Task 5 (
gone→offline) and Task 6 (afterCall). - Chrome is closed but its
DevToolsActivePortfile is left over. Expect "Chrome isn't open with remote debugging on", not "unreachable". Test in Task 2 (ECONNREFUSED →no-chrome). - A request through the Chrome stream that isn't a WebSocket upgrade (for example
GET /json/new?https://…), or an oversized head. Expect403or a destroyed stream; nothing reaches Chrome. Test in Task 2. - Another local process connects to the Cloud door without the token. Expect
404, with no stream opened and no problem recorded for the session. Test in Task 5.
Task 1: The link carries a Chrome stream, and the computer checks its own grant
Files:
- Modify:
electron/device-link-protocol.mjs(header comment;open;onControlcase"open"),electron/device-link-protocol.d.mts - Modify:
electron/device-link.mjs(runDeviceLinkoptions andaccept),electron/device-link.d.mts - Test:
electron/device-link.node-test.mjs
Interfaces:
Produces:
mux.open(target: { host: string; port: number } | { chrome: true }): Promise<LinkOpened>. The control frame is{ t: "open", id, chrome: true }for Chrome, unchanged otherwise.accept(target)receives exactly{ chrome: true }whenmessage.chrome === true, else{ host: message.host, port: message.port }.Produces:
runDeviceLink({ …, lends = () => ({ internet: true, chrome: false }), chrome = {} }).chromeis passed tocreateChromeDoorfrom Task 2 (tests injectdirs,readFile,connect).acceptanswers{ refused: "not-lent" }for a Chrome stream when!lends().chrome, and for a host/port stream when!lends().internet. Otherwise it answerschromeDoor.open()ordeviceEgress.open(target).onStream(target, result)is called for both.Note: Task 2 creates
createChromeDoor. Do Task 2 first if you prefer; this task's tests inject a fake door throughchrome.open(see Step 1), so the order doesn't matter.Step 1: Write the failing tests in
electron/device-link.node-test.mjs:"a Chrome stream reaches the computer as { chrome: true } and never carries a host or port": two muxes wired back to back, the computer side'sacceptrecords its target. Cloud sideopen({ chrome: true }). Assert the recorded targetdeepEqual({ chrome: true }). Assert the first control frame sent is{ t: "open", id: 1, chrome: true }."the computer opens a Chrome stream only while it lends Chrome, and a web stream only while it lends its internet connection":runDeviceLinkagainst a localWebSocketServerplaying My Cloud, withlends: () => ({ internet: false, chrome: false }). Assert{ t: "refused", reason: "not-lent" }for both{ chrome: true }and{ host: "example.com", port: 443 }. Then withlendsreturningchrome: true, andchrome: { open: async () => ({ socket }) }wheresocketis one end of anetsocket pair to a local echo server, assert{ t: "opened" }and bytes echo back.
Step 2: Run them, expect FAIL:
node --test --test-name-pattern="Chrome stream|lends Chrome" electron/device-link.node-test.mjsStep 3: Implement the protocol change and the
runDeviceLinklends/chromeoptions. Whenchrome.openis given, use it as the door (the test seam); otherwisecreateChromeDoor(chrome). Update both.d.mtsfiles and the protocol header comment (one line:open {id, host, port} or {id, chrome: true}).Step 4: Run
node --test electron/device-link.node-test.mjs. Expect the new tests to PASS and subtests 1–6 to still PASS (7–11 are the known local cancellations).Step 5: Commit
feat(lending): the device link carries a Chrome stream, and the computer checks its own grant
Task 2: The lent computer's Chrome door
Files:
- Create:
electron/device-chrome.mjs,electron/device-chrome.d.mts - Test:
electron/device-chrome.node-test.mjs
Interfaces:
Produces:
DEVTOOLS_FILE = "DevToolsActivePort"MAX_HEAD = 16 * 1024chromeDataDirs({ platform, home, localAppData }): string[], in this order:- darwin:
<home>/Library/Application Support/{Google/Chrome, Google/Chrome Canary, BraveSoftware/Brave-Browser} - win32:
<localAppData>/{Google/Chrome/User Data, Google/Chrome SxS/User Data, BraveSoftware/Brave-Browser/User Data} - linux:
<home>/.config/{google-chrome, google-chrome-unstable, BraveSoftware/Brave-Browser}
- darwin:
parseDevtoolsActivePort(text: string): { port: number; path: string } | null. Line 1 is an integer 1–65535. Line 2 matches^/devtools/browser/[A-Za-z0-9-]+$.rewriteHandshake(head: string, target: { port: number; path: string }): string | null.headis the request line plus headers, without the final blank line. Accept onlyGET <p> HTTP/1.1with anUpgrade: websocketheader (case-insensitive name and value). If<p>starts with/devtools/browser(optionally followed by/…or?…), replace it withtarget.path. If<p>matches^/devtools/page/[A-Za-z0-9-]+$, keep it. Refuse anything else. ReplaceHostwith127.0.0.1:<port>and remove everyOriginheader. Return the new head ending in\r\n\r\n, ornullto refuse.createChromeDoor({ dirs?, readFile?, connect?, connectMs = 10_000 } = {}): { open(): Promise<{ socket: import("node:stream").Duplex } | { failed: "no-chrome" | "timeout" | "unreachable" }> }open()reads the first dir whoseDevToolsActivePortparses. With none, it answers{ failed: "no-chrome" }.- It connects to
{ host: "127.0.0.1", port }only.ECONNREFUSED→{ failed: "no-chrome" }(Chrome was closed and the file is left over). Timeout →{ failed: "timeout" }. Any other error →{ failed: "unreachable" }. - On connect it answers
{ socket: guard }.guardis aDuplex: bytes written to it are buffered until\r\n\r\n. If they passrewriteHandshake, the rewritten head plus the bytes after it go to Chrome, and every later byte passes through both ways. If they don't, the guard pushesHTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\nConnection: close\r\n\r\n, ends, and destroys the Chrome socket. A head overMAX_HEADwithout\r\n\r\ndestroys both.pause/resume,endanddestroymap onto the Chrome socket. - Default
dirscome fromchromeDataDirs({ platform: process.platform, home: os.homedir(), localAppData: process.env.LOCALAPPDATA }).
Step 1: Write the failing tests in
electron/device-chrome.node-test.mjs. "Fake Chrome" means anhttpserver plus aWebSocketServer({ noServer: true })that upgrades only/devtools/browser/REAL-IDand records each upgrade request'surl,hostandorigin."reads DevToolsActivePort: a port and Chrome's browser path, nothing else":parseDevtoolsActivePort("9222\n/devtools/browser/abc-1\n")deepEquals{ port: 9222, path: "/devtools/browser/abc-1" }. Each of"","0\n/devtools/browser/x","70000\n/devtools/browser/x","9222\n/json/new"and"9222\n/devtools/browser/../x"givesnull."looks only in Chrome's own folders, in agent-browser's order":chromeDataDirs({ platform: "darwin", home: "/U" })deepEquals the three darwin paths. win32 and linux likewise."rewrites only a WebSocket upgrade to Chrome's browser or a page, with Chrome's own host and no Origin": a head withGET /devtools/browser/TOKEN HTTP/1.1,Host: 127.0.0.1:5555,Origin: https://evil.test,Upgrade: websocketandConnection: Upgradebecomes a head withGET /devtools/browser/REAL-ID HTTP/1.1,Host: 127.0.0.1:9222and noOrigin./devtools/page/AB12is kept.GET /json/new?https://x HTTP/1.1(with upgrade),POST /devtools/browser/x HTTP/1.1, and aGET /devtools/browser/xwithoutUpgradeeach givenull."a door to a running Chrome upgrades end to end and passes frames unchanged": a fake Chrome on an ephemeral port, a temp dir holdingDevToolsActivePort(<port>\n/devtools/browser/REAL-ID), andcreateChromeDoor({ dirs: [tmp] }).open()gives{ socket }. Pipe it to a local TCP server, and have awsclient connect there tows://127.0.0.1:<that>/devtools/browser/TOKEN. Send{"id":1,"method":"Browser.getVersion"}and get the fake's echo back. Assert the fake saw url/devtools/browser/REAL-ID, host127.0.0.1:<fake port>and originundefined."a request that is not a WebSocket upgrade gets 403 and never reaches Chrome": writeGET /json/new?https://x HTTP/1.1\r\nHost: a\r\n\r\nto the guard. ReadHTTP/1.1 403 Forbidden. The fake saw no request."an oversized head is dropped": writeMAX_HEAD + 1bytes with no blank line. The guard is destroyed and the fake saw no request."no DevToolsActivePort, or a stale one whose port refuses, is no-chrome": an empty dir →{ failed: "no-chrome" }. A file pointing at a closed port →{ failed: "no-chrome" }.
Step 2: Run, expect FAIL:
node --test electron/device-chrome.node-test.mjs(module not found)Step 3: Implement
electron/device-chrome.mjsand its.d.mts. The header comment names what the door is: the lent computer's own way to its Chrome. It finds the port itself and lets through only the upgrade.Step 4: Run
node --test electron/device-chrome.node-test.mjs electron/device-link.node-test.mjsand expect PASS (except the known cancellations).Step 5: Commit
feat(lending): the lent computer's door to its own Chrome
Task 3: The desktop lends Chrome when the person turns it on
Files:
- Modify:
electron/computer-sharing.mjs(describe/cloudIdentity,saveCloud, the connect body, thekeepLinkcondition and itsrunDeviceLinkcall,browsed,cloudState),electron/computer-sharing.d.mts - Modify:
electron/cloud-lending-ipc.mjs(pageLending,defaultGrant,choiceand the threesave(env(), await choice({...}))sites),electron/cloud-lending-ipc.d.mts - Test:
electron/cloud-lending.node-test.mjs,electron/cloud-lending-ipc.node-test.mjs
Interfaces:
Consumes: Task 1's
runDeviceLink({ lends, chrome }).Produces:
- Grant field
chrome: boolean. createComputerSharing({ …, chrome = {} })forwardschrometorunDeviceLink, next toegress(the test seam Task 8 uses).saveCloud(env, { …, chrome?: boolean }). "Choose at least one…" countschrome === true, and its message becomes "Choose at least one folder, apps and screen, the internet connection, your Chrome, or the terminal."supportsChrome: Set<envId>, set fromdescriptor.capabilities?.myChromeLink === true.- Connect body adds
...(grant.cloud && supportsChrome.has(env.id) ? { chrome: grant.chrome === true } : {}). - The link is kept when
grant.cloud && supportsLink.has(env.id) && (grant.internet === true || (grant.chrome === true && supportsChrome.has(env.id))). lends: () => ({ internet: grant.internet === true, chrome: grant.chrome === true && supportsChrome.has(env.id) }).cloudState(env)addschrome: booleanand, while lent and connected withchrome,chromeLink: "on" | "connecting" | "unsupported"(same rule asinternetState, usingsupportsChrome).- Activity: each Chrome stream is recorded once per
BROWSE_NOTE_MSas{ action: "chrome", detail: "", ok, error? }. pageLendingaddschrome: on && state.chrome === true.defaultGrantaddschrome: kept?.chrome === true.choice()passeschrome: input?.chrome === trueand treats Chrome alone as a choice.
- Grant field
Step 1: Write the failing tests:
cloud-lending.node-test.mjs→"lends Chrome only when the person turns it on, and tells only a Cloud that takes it". Use the existing fake-Cloud harness. If the descriptor has nomyChromeLink, saving{ chrome: true, folders: [] }registers with nochromekey. WithmyChromeLink: true, it registerschrome: true, the device link is dialled, andcloudState(env).chrome === true. Saving{ folders: [usual], screen: false }registerschrome: false.cloud-lending.node-test.mjs→"a Chrome-only grant keeps the device link open, and the link refuses web streams": with grant{ chrome: true, internet: false }, the fake Cloud's link receives{ t: "refused", reason: "not-lent" }for an{ host, port }open.cloud-lending-ipc.node-test.mjs→"the default grant never lends Chrome unless it was lent before":defaultGrant({ kept: null, … }).chrome === false, anddefaultGrant({ kept: { chrome: true, folders: [] }, … }).chrome === true. AlsopageLending({ state: { enabled: true, chrome: true } }).chrome === true.
Step 2: Run, expect FAIL:
node --test electron/cloud-lending.node-test.mjs electron/cloud-lending-ipc.node-test.mjsStep 3: Implement the interfaces above, keeping each change next to its
internettwin.Step 4: Run
pnpm test:electronand expect PASS (except the known cancellations).Step 5: Commit
feat(lending): the desktop lends its Chrome to My Cloud when the person turns it on
Task 4: My Cloud knows which computer lends Chrome
Files:
- Modify:
server/environment.ts(myChromeLinkcapability,cloudTeaminput), andserver/index.tslines 13060 and 13130 (passcloudTeam: CLOUD_TEAM !== nullon the same lines) - Modify:
server/lent-computers.ts(record andconnectedinputchrome?: boolean) - Modify:
server/shared-computers.ts(registrationchrome,remember, scopes inKnownLentComputer/SharedComputerStatus,linkable, newchromeLender) - Modify:
server/device-links.ts(LinkedComputer.chrome, newchromeRoute) - Test:
server/environment.test.ts,server/lent-computers.test.ts,server/shared-computers.test.ts,server/device-links.test.ts
Interfaces:
Consumes: Task 1's
mux.open({ chrome: true }).Produces:
EnvironmentDescriptor.capabilities.myChromeLink?: true, present whensharedComputers === true && cloudHome === true && cloudTeam !== true.sharedComputerRegistration.chrome: z.boolean().optional(), with the comment "sent only to a server that advertises myChromeLink".scopes.chrome: booleanin both status types.LentComputer.chrome?: boolean.SharedComputers.chromeLender(principal: string): { name: string; device: "PC" | "Mac" | "computer"; online: boolean } | null. This is the newest record (lent.listorder) withchrome === true && stoppedAt === null, andonlinemeans its id is inlist(principal).export interface ChromeRoute { open(): Promise<LinkOpened> }DeviceLinks.chromeRoute(person: string): ChromeRoute | null. This is the newest open, live link ofpersonwithcomputer.chrome.open()callsmux.open({ chrome: true })and marks the computer used the same wayroutedoes.
Step 1: Write the failing tests:
environment.test.ts→"advertises myChromeLink only on a personal Cloud home with lending". AssertmyChromeLink === truefor{ sharedComputers: true, cloudHome: true }. Assert it is absent forcloudTeam: true, forcloudHome: false, and forsharedComputers: false.lent-computers.test.ts→"remembers whether a computer lends its Chrome". Afterconnected(person, { …, chrome: true })and a reload from disk,list(person)[0].chrome === true.shared-computers.test.ts→"chromeLender names the newest computer that lends Chrome, and whether it is online". Register A (chrome: true) and then B (chrome: false). AssertchromeLender(p)deepEquals{ name: "A", device: "Mac", online: true }. After A's session dies,onlineisfalse. After A's lending stops, the result isnull.device-links.test.ts→"a Chrome stream goes only to a computer that lends Chrome, through its own door". Use the existing in-process harness. Run the computer'srunDeviceLinkwithlends: () => ({ internet: false, chrome: true })andchrome: { open: async () => ({ socket }) }, wheresocketgoes to a local echo server.chromeRoute(PERSON)is non-null, andopen()gives{ join }with bytes echoed. Also: a computer registered withoutchromegiveschromeRoute(PERSON) === null, whileroute(PERSON)still works when it lends its internet connection.
Step 2: Run, expect FAIL:
npx vitest run server/environment.test.ts server/lent-computers.test.ts server/shared-computers.test.ts server/device-links.test.tsStep 3: Implement the interfaces. In
index.ts, change only lines 13060 and 13130. Confirm withwc -l server/index.tsthat it is still 16238.Step 4: Run the same command plus
npx vitest run scripts/testing/file-size-ratchet.test.ts, and expect PASS (except the known device-links timeout).Step 5: Commit
feat(cloud): My Cloud knows which lent computer lends its Chrome
Task 5: My Cloud's door for a session's Chrome
Files:
- Create:
server/browser/lent-chrome.ts - Test:
server/browser/lent-chrome.test.ts
Interfaces:
- Consumes: Task 4's
ChromeRoute, andLinkOpenedfromelectron/device-link-protocol.mjs. - Produces:
export type LentChromeProblem = "offline" | "not-lent" | "no-chrome" | "unreachable" | "not-allowed";
export type ChromeLender = { name: string; device: "PC" | "Mac" | "computer"; online: boolean };
export interface LentChromeDeps {
route(): ChromeRoute | null;
/** Whether the session's last holder may use the lent computer (lentDevice's rule). */
allowed(session: string): boolean;
idleMs(): number;
/** For tests; real timers otherwise. */
sweepMs?: number;
}
export class LentChromeDoors {
constructor(deps: LentChromeDeps);
/** The address agent-browser connects to for this session: ws://127.0.0.1:<port>/devtools/browser/<64 hex token>. One per session, reused. */
door(session: string): Promise<string>;
owns(session: string): boolean;
/** Ends every open connection of that session; the next one is checked afresh. */
drop(session: string): void;
/** Why the session's last connection could not reach Chrome; cleared once one does. */
problem(session: string): LentChromeProblem | null;
close(): void;
}
export function lentChromeGuidance(problem: LentChromeProblem, lender: ChromeLender | null): string;
Per-connection rules, in order:
- Read the request head (at most 16 KiB, at most 10 s), else destroy.
- If the path is not exactly
/devtools/browser/<token>(timingSafeEqual), answer404and record no problem. - If
!allowed(session), answer403and recordnot-allowed. - If
route()is null, answer503and recordoffline. - Call
route.open():{ join }→join(socket, Buffer.concat([head, rest])), and clear the problem.{ refused: "not-lent" }→not-lent. Any otherrefused→unreachable.{ failed: "no-chrome" }→no-chrome. Any otherfailed→unreachable.{ gone }→offline.- Every non-join outcome answers
502.
Idle: a joined connection with no bytes from agent-browser for
idleMs()is destroyed. The sweep runs everysweepMs ?? 30_000, and its timers areunref'd.Guidance copy (bot-facing;
nameanddevicecome from the lender, with "your computer" when there is none):offline:${name} is lent but offline: OpenMausBot on it is closed or the ${device} is asleep. Tell the person in one sentence to open OpenMausBot on that ${device}. Do not switch to another browser.not-lent:No computer lends its Chrome to My Cloud now. Tell the person in one sentence to turn on Your Chrome under Settings → MausBot Cloud in OpenMausBot on their Mac or PC.no-chrome:Chrome on ${name} isn't open with remote debugging on. Tell the person in one sentence to open Chrome on that ${device}, turn on remote debugging at chrome://inspect/#remote-debugging, and allow the connection when Chrome asks.unreachable:Chrome on ${name} did not accept the connection; it may be waiting for the person to click Allow. Tell them in one sentence to check Chrome on that ${device}.not-allowed:Someone else wrote in this conversation, so it can't use your Chrome. Start a new conversation to use it.
Step 1: Write the failing tests in
server/browser/lent-chrome.test.ts. The fake route'sopen()returns a scriptedLinkOpened.join(socket, early)pipes to a local echo server after writingearly. The client is a rawnetsocket that writes a WebSocket upgrade head."hands out one tokenized loopback address per session": twodoor("s1")calls give the same URL, matching^ws://127\.0\.0\.1:\d+/devtools/browser/[a-f0-9]{64}$.door("s2")gives a different port and token.owns("s1")is true andowns("x")is false."a connection without the token gets 404, opens no stream and records nothing": wrong token →HTTP/1.1 404. The route'sopenis never called, andproblem("s1") === null."joins the session's connection through the route, head included": the echo receives the exact head bytes, and later bytes round-trip."a refused holder gets 403 and not-allowed":allowed: () => false→403andproblem === "not-allowed", withopennever called."each way of not reaching Chrome is recorded": a table of route outcomes → problem:nullroute →offline,{ gone: true }→offline,{ refused: "not-lent" }→not-lent,{ refused: "port" }→unreachable,{ failed: "no-chrome" }→no-chrome,{ failed: "timeout" }→unreachable. Each answer startsHTTP/1.1 50. A later joined connection clears the problem."drop ends the session's open connections and nothing else's": with s1 and s2 joined, afterdrop("s1")s1's client sees close and s2 still echoes."a connection unused for the idle time is closed": withidleMs: () => 50andsweepMs: 10, the client sees close within 1 s."guidance names the computer and what to do":lentChromeGuidance("offline", { name: "Omkar's MacBook", device: "Mac", online: false })containsOmkar's MacBookandopen OpenMausBot on that Mac.lentChromeGuidance("no-chrome", null)containschrome://inspect/#remote-debugging.
Step 2: Run, expect FAIL:
npx vitest run server/browser/lent-chrome.test.tsStep 3: Implement
server/browser/lent-chrome.ts(node:netserver per session on127.0.0.1:0,randomBytes(32)token).Step 4: Run
npx vitest run server/browser/lent-chrome.test.tsand expect PASS.Step 5: Commit
feat(cloud): a per-session door from the bots' browser to the person's lent Chrome
Task 6: The browser host uses the lent Chrome for My Chrome profiles
Files:
- Modify:
server/turn-resources.ts(onClaim) - Modify:
server/browser/engines.ts(RuntimeRouterOptions.refusalgainssession, newafterCall) - Modify:
server/host/browser.ts(deps,myChromeAvailable,browserSessionSpeccdpUrlargument,browserIntegration/currentBrowserSpec, refusal/afterCall wiring, claim hook,lentChromeSummary,closeAll) - Modify:
server/index.ts, existing lines only: thecreateBrowserHost({...})call at 2529, the destructuring list at 2527, andprogressinbrowserEngineSummaryat 2568 - Test:
server/turn-resources.test.ts,server/browser/engines.test.ts,server/host/browser.test.ts
Interfaces:
Consumes: Task 4's
chromeRouteandchromeLender, and Task 5'sLentChromeDoorsandlentChromeGuidance.Produces:
TurnResources.onClaim(listener: (resource: string, owner: TurnOwner) => void): () => void. It fires only when a claim makesownerthe new holder (afterowners.set), never when an owner re-claims what it already holds.BrowserHostDeps.turnResourcesbecomesPick<TurnResources, "free" | "holder" | "onClaim">.RuntimeRouterOptions.refusal?(session: string, spec, params): string | nullandafterCall?(session: string, spec, result: unknown): unknown.afterCallruns afterannotate, ontools/callonly.BrowserHostDeps.lentChrome?: { route(): ChromeRoute | null; lender(): ChromeLender | null }- Host internals:
lentChromeAllowed(session)remembers each holder'smayLendverdict likelentDevice, defaulting to allowed when no turn has held the session.lentChromeSession(profileId)is!DESKTOP_MANAGED && browserEngineAttachCdpUrl(cfg) === null && doors !== undefined && usesMyChrome(profileId).
myChromeAvailable()isDESKTOP_MANAGED || browserEngineAttachCdpUrl(cfg) !== null || Boolean(deps.lentChrome?.lender()).browserSessionSpec(binaryPath, session, profile, egressPort?, cdpUrl?): whenusesMyChrome(profile),attachis{ cdpUrl: cdpUrl ?? attachCdpUrl }if either is set, else{}.browserIntegrationandcurrentBrowserSpecpassawait doors.door(session)whenlentChromeSession(browserProfileId).- Refusal for a session
doors.owns, in order:!lentChromeAllowed(session)→lentChromeGuidance("not-allowed", lender).- No lender →
"not-lent"guidance. !lender.online→"offline"guidance.- Otherwise null, and the existing egress refusal rule still applies to other sessions.
afterCall: for an owned session whose resultisErrorand whosedoors.problem(session)is set, append one text part with the guidance.- On claim: a resource
browser:<session>wheredoors.owns(session)and!mayLend(owner)→ record the verdict, thendoors.drop(session). lentChromeSummary(): { myChromeOn?: ChromeLender; myChromeLendable?: true }. With a lender →{ myChromeOn }. Withdeps.lentChromebut no lender →{ myChromeLendable: true }. Otherwise{}.index.tspasseslentChrome: CLOUD_PERSONAL ? { route: () => deviceLinks.chromeRoute(CLOUD_HOME_LENDER), lender: () => sharedComputers.chromeLender(CLOUD_HOME_LENDER) } : undefinedand spreads...lentChromeSummary()intoprogress.
Step 1: Write the failing tests:
turn-resources.test.ts→"onClaim fires when a turn becomes a resource's holder, not when it claims again".engines.test.ts→"refusal and afterCall see the session": a router with a stub old runtime records the session passed torefusal.afterCallreceives the annotated result and its return value is whatagentRpcreturns.host/browser.test.ts(use its existing host fixture, withDESKTOP_MANAGED: false,CLOUD_HOME: {}, a stublentChromeandmayLend):"on My Cloud a My Chrome profile attaches through the lent computer's door": with configbrowserProfiles: [{ id: "mine", name: "Mine", browser: "chrome" }]and a lender{ name: "Mac", device: "Mac", online: true },myChromeAvailable() === trueandbrowserIntegration(bot, "mine", turn)givesspec.env.AGENT_BROWSER_CDPmatching the door URL pattern, with noAGENT_BROWSER_AUTO_CONNECT. With lendernull,myChromeAvailable() === false."a conversation that may not lend loses the Chrome connection and is told why":mayLendreturns false for turn B. When B claimsbrowser:<session>throughturnResources.claim,doors.dropis called (spy), andbrowserRuntime.agentRpc(session, spec, "tools/call", …)returnsisErrorwith textSomeone else wrote in this conversation, so it can't use your Chrome."an offline or missing lender is explained before the call reaches the browser": lenderonline: false→ the refusal text containsis lent but offline. Lendernull→ the text containsturn on Your Chrome."the summary says which computer lends Chrome, or that one can":lentChromeSummary()gives{ myChromeOn: lender }with a lender and{ myChromeLendable: true }without one. On the desktop host (nolentChrome) it gives{}.
Step 2: Run, expect FAIL:
npx vitest run server/turn-resources.test.ts server/browser/engines.test.ts server/host/browser.test.tsStep 3: Implement. In
index.ts, edit only lines 2527, 2529 and 2568.wc -l server/index.tsmust still print 16238.Step 4: Run the Step 2 command plus
npx vitest run scripts/testing/file-size-ratchet.test.ts server/cloud-lending-browser.e2e.test.ts server/browser-engine.test.ts, and expect PASS.Step 5: Commit
feat(cloud): My Chrome profiles on My Cloud use the person's lent Chrome
Task 7: Settings say where My Chrome is, and the desktop has the switch
Files:
- Modify:
src/state/config-status.ts(BrowserEngineSummary.myChromeOn?,myChromeLendable?) - Modify:
src/components/BrowserProfilesManager.tsx(thechromeNotelines and the unavailable paragraph) - Modify:
src/components/CloudLending.tsx(lentWhat,choiceOf,lend, the Chrome checkbox after the internet one, the unsupported note),src/components/LendingActivity.tsx(chrome: "lending.action.chrome") - Modify:
src/locales/en.json - Test:
src/components/BrowserProfilesManager.test.ts,src/components/CloudLending.test.ts
Interfaces:
Consumes: Task 6's summary fields and Task 3's
CloudLendingState.chromeandchromeLink.Copy (en.json, exact):
"settings.profiles.myChromeLent": "On My Cloud this is the Chrome on {name}, your {device}. It works while that {device} is awake with OpenMausBot open, in conversations you started yourself.""settings.profiles.myChromeLentOffline": "{name} is offline right now.""settings.profiles.myChromeLend": "To use My Chrome on My Cloud, lend it from your Mac or PC: open OpenMausBot there, go to Settings → MausBot Cloud, and turn on Your Chrome.""lending.chrome": "Your Chrome""lending.chromeHelp": "Bots on My Cloud can use Chrome on this computer, signed in as you, in your own conversations and routines. That reaches every site you're signed in to. Turn on remote debugging at chrome://inspect/#remote-debugging first; Chrome asks you to allow the connection.""lending.chromeUnsupported": "My Cloud is updating. Your bots can use your Chrome once it's done.""lending.page.chrome": "your Chrome""lending.action.chrome": "Used your Chrome"
Rendering:
BrowserProfilesManager: whereverchromeNoteshows andmyChromeOnis set, render themyChromeLentline after the hint, thenmyChromeLentOfflinewhenonline === false. The unavailable paragraph usesmyChromeLendwhenmyChromeLendable === true, else the existingmyChromeUnavailable.CloudLending:lentWhat(folders, screen, internet, terminal, chrome = false)listslending.page.chromeafter the internet connection. The checkbox hasdata-lending-chrome-choice, andchromeLink === "unsupported"showslending.chromeUnsupported.
Step 1: Write the failing tests:
BrowserProfilesManager.test.ts→"on My Cloud, My Chrome names the lent computer and says when it is offline": render withbrowserEngine: { myChrome: true, myChromeOn: { name: "Studio Mac", device: "Mac", online: false } }and a profilebrowser: "chrome". The HTML containsthe Chrome on Studio Mac, your MacandStudio Mac is offline right now., and the My Chrome<option>is not disabled.BrowserProfilesManager.test.ts→"on My Cloud with nothing lent, it says how to lend Chrome":browserEngine: { myChrome: false, myChromeLendable: true }→ containsturn on Your Chrome, and does not containthere is no Chrome of yours to use.CloudLending.test.ts→"lentWhat lists your Chrome":lentWhat([], false, true, false, true)equalsthe internet connection and your Chrome. Use thelistOfoutput the existing tests assert.
Step 2: Run, expect FAIL:
npx vitest run src/components/BrowserProfilesManager.test.ts src/components/CloudLending.test.tsStep 3: Implement.
Step 4: Run the same command plus
npx vitest run src/localesandpnpm exec tsc -b --noEmit(or the repo'spnpm typecheckif present), and expect PASS.Step 5: Commit
feat(ui): My Chrome on My Cloud in browser profiles, and the Your Chrome switch
Task 8: End to end through a real Cloud home, plus the docs
Files:
- Create:
server/cloud-lending-chrome.e2e.test.ts(modelled onserver/cloud-lending-browser.e2e.test.ts: a real Cloud home server, the realcreateComputerSharingconnector) - Modify:
docs/cloud-pro.md(the lending scopes section, and the bullet that refuses DevTools on a lent screen, which should say Chrome is lent only by its own switch, over the device link, to the port the computer finds itself),docs/plans/browser-engine.md("Where it applies"),docs/browser-packaging.md(the "on Cloud and servers profiles stay built-in" line)
Interfaces:
Consumes everything above.
Step 1: Write the e2e tests. The fake Chrome is the Task 2 fixture. The computer's connector gets
chrome: { dirs: [tmpWithDevToolsActivePort] }throughcreateComputerSharing's existing test seams (add achromeoption next toegressif there is none). The client is awsclient playing agent-browser, connecting to the URL from the Cloud'sbrowserIntegrationfor a bot whose profile isbrowser: "chrome"."a Cloud bot's My Chrome browser reaches the person's Chrome through the lent computer": the person lends with{ chrome: true }.GET /api/configshowsbrowserEngine.myChrome === trueandmyChromeOn.online === true. ABrowser.getVersionframe reaches the fake Chrome and its answer comes back. Activity records achromeentry."a computer that stops lending Chrome takes the route with it": re-save the grant withoutchrome. The next connection through the door answersHTTP/1.1 502, and a tool-call refusal saysturn on Your Chrome."a conversation someone else wrote in cannot reach the person's Chrome": a thread with a line from another sender. Its turn's claim drops the open connection, and its tool call is refused with the someone-else sentence.
Step 2: Run
npx vitest run server/cloud-lending-chrome.e2e.test.tsand expect PASS once the seams are added.Step 3: Update the three docs in the same plain style as the surrounding text.
Step 4: Full check:
npx vitest run server/ src/components/BrowserProfilesManager.test.ts src/components/CloudLending.test.tsandpnpm test:electron. Only the known local failures may remain.Step 5: Commit
test(cloud): My Chrome on My Cloud end to end; docs