Repository navigation
feat(browser): drive the person's own Chrome through the Redrob extension - #257
Merged
Merged
Conversation
Member
Author
|
Self-review.
|
…sion The browser tool launched its own headless Chromium, so logged-in sites and the Redrob extension were out of reach. Now, when the person's Chrome with the Redrob extension is connected to the same account, the tool runs there. Path: the desk relay, with no change to the extension, Redrob Desktop or the chat server. The extension already takes the desk role in room desk:<user id> and answers paired devices with its forward.ts route set. The daemon now also joins that room as a device (kind "web", "Redrob Code on <host>"), the same handshake Redrob chat's web page uses: desk.hello, the six-digit Allow in Chrome once, then sealed req/res frames. The room is the account, so the browser is signed in to the same Redrob account. - desk/extension.ts: ExtensionLink, the device side. It runs beside the desk relay and shares its token refresh. It only listens until the first request; desk.hello and the pairing notification go out when the tool needs the browser. The device key and the paired browser are kept in the desk secret scope (browserKey, browserDesk). A request waits up to two minutes for Allow, once per pairing request. - crypto.ts: Channel.device and devicePairingCode, the device side of the existing handshake. - POST /desk/browser on the daemon: one request of the extension's route set, for engines that are not the daemon (redrob run, the terminal app). GET /desk/status gains `browser` (off, none, found, pairing with code, ready, denied); `redrob desk status` prints it. - browser/extension.ts: each action (open, read, click, type, scroll, wait) becomes one short task in the same conversation and tab (followUp, chatId code-<session>), and the extension's agent answers with a reading in the tool's shape (URL, title, text, numbered elements). Approvals, payments and sign-ins stay the person's step in Chrome. A question from the browser's agent ends the task and is the result. Screenshot is not available there (the route set has no picture); the tool says to use read. - Every result starts with a line naming the browser used. Without a daemon, relay, browser or Allow, the tool falls back to its own Chromium and says why; a session stays in one browser until the next open. - The tool is offered where a Chromium is installed or an engine service record exists.
…a token On the Windows check the stored refresh token was stale, so the browser link's first tickets failed and it backed off. PUT /desk/token kicked only the desk relay. It now kicks the browser link too, and the link keeps one ticket request in flight at a time, as the relay does.
…shake The browser link stored its device key the first time it said hello, so every pairing request from this engine showed the same six digits (286874 on the Windows check) and the extension's notification kept the same id (`pair:<code>`). An Allow given to an earlier request's prompt could not match the request going on, and nothing in the log said what the extension answered. - The key is kept only once the extension sent desk.accept. Until then each pairing request uses its own key, kept while that request waits, so its code is new; an expired or denied request drops it. - The code is known when the hello goes out, so status and the log show it before the extension answers. - An extension that no longer knows an allowed key (removed in its Settings) gets a new request with a fresh key. - A browser that leaves in the middle of the handshake gets the hello again when it is back, with the same key. - An Allow that arrives while no tool call waits still links. - Every step is logged with a timestamp: browser online, hello with name and code, waiting for Allow, allowed, denied/expired, offline.
its-janghoon
force-pushed
the
feat/extension-browser
branch
from
November 13, 2026 09:44
435e279 to
41491cf
Compare
This was referenced Nov 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's done
The
browsertool now drives the person's own Chrome through the Redrob extension when that Chrome is connected to the same Redrob account. Otherwise it uses its own headless Chromium as before. The first line of every result names the browser used.Path chosen: the existing desk relay, with no change to the extension, Redrob Desktop or the chat server. This is option 1 of the design rule:
desk:<user id>in the desk role. It answers paired devices with the route set in itssrc/remote/forward.ts(POST /browser/task,GET /browser/task/:id, ...). Its AGENTS.md already names Redrob Code as a relay caller.role: ownerfor the same room, so the engine can join as a device, the same way Redrob chat's web page reaches the extension (apps/web/lib/desk/relay-client.ts,want: 'browser').ai.redrob.desktop) was not used. Desktop exposes it only to its own webview, so using it would need a Desktop change. Registering a second native host would need an extension change and a new entry point, which the extension's AGENTS.md forbids without asking.Code:
desk/extension.tsExtensionLink: the device side of the handshake (desk.hellokindwebas "Redrob Code on ",desk.pendingwith the six-digit code,desk.accept, sealedreq/res). It runs beside the desk relay and shares its token refresh, and it is kicked onPUT /desk/token. It only listens until the first request, so Chrome gets no pairing prompt until the tool actually needs the browser. A request waits up to two minutes for Allow, once per pairing request. The device key and the paired browser are stored in the desk secret scope (browserKey,browserDesk).desk/crypto.ts:Channel.deviceanddevicePairingCode. These are the device side of the existing handshake; the desk side is unchanged.POST /desk/browseron the daemon (protocol, server handler, client and SDK regenerated) sends one request of the extension's route set. It is for engines that are not the daemon (redrob run, the terminal app). All engines go through the one daemon link, so two processes never spend the same rotating refresh token.GET /desk/statusgainsbrowser(off,none,found,pairing+ code,ready,denied), andredrob desk statusprints it.browser/extension.ts: the extension takes tasks, not clicks (its AGENTS.md: nothing outside calls the layer directly). Each action becomes one short, exact task in the same conversation and tab (followUp,chatId: code-<session>,origin: code). The extension's agent replies with a reading in the tool's own shape: URL, title, text, and numbered elements[e1] button «Send». Click and type name the element from the last reading. The approval level, payments and sign-ins stay the person's step in Chrome. A question from the browser's agent ends the task and becomes the result. After an engine restart the session finds its task again throughGET /browser/task?chatId=.open.What's not done
readthere instead of showing a picture of a different browser.What to review
desk/extension.ts:ready()(waiting for an announce, then the handshake, then Allow),pick()(the paired browser first), and the denied/expired handling.browser/extension.ts: the task wording (READING,task()), and the fallback rules inact().Intentions
browser extension link: Chrome 0.4.15 connected, andredrob-host.exekept running through the test.Checks
test/desk/extension.test.ts(6: device/desk channel interop and the shared code; no browser; listen-only; Allow then request, then reconnect with the stored key; no Allow in time; Deny).test/browser/extension.test.ts(9: task shape, followUp and element labels, find after restart, fallback and stickiness, approval wait, question, failure, screenshot, chat id shape).bun test test/browser test/desk test/tool test/server test/event-manifest.test.ts: 823 pass, 1 fail. The failure ispublic event manifest > contains every latest public wire type once, which fails on origin/develop too.tsgo --noEmitpasses in redrob, server, client, protocol and sdk/js.redrob runwith the browser tool sent the hello, waited for Allow, then fell back to the PC's Chromium withBrowser: Redrob Code's own Chromium on this machine (headless). The person's Chrome is not used: waiting for Allow in Chrome on Windows (code 286874).and read "Example Domain".redrob desk statusprintedyour Chrome (Redrob extension): waiting for Allow in Chrome on Windows (code 286874).