Repository navigation
feat(web-extension): optional rrweb Cloud mode, connected from the dashboard - #2017
roggernaut wants to merge 27 commits into
Conversation
- Popup in rrweb branding with a dominant sign-up action, log in, and an offline "Record offline" path that keeps working with no account. - Signing in on the rrweb site signs the extension in (Clerk sync host); the popup picks a Clerk organization, fetches its public key from /get-public-key and stores it with the user it belongs to. A named validating state blocks recording until the cached account matches the current user. - Signed-in recordings upload through @rrweb/browser-client tagged jsEntrypoint: 'chrome-extension', with Cloud masking defaults. - One recording is one tab: the recorder is injected on demand with activeTab + scripting (no all-sites content script), and it finishes like Stop when the tab navigates or closes. Stop opens the recording in the dashboard or the local player. - Account page (organization, log out) and rebranded session pages. feat(browser-client): export createTransport for callers that own the recording ID. stop(true) now delivers buffered events in order before the close marker, and the socket resumes after a reconnect. See changeset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 2ed9d01 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The session list, player and Account pages drop the left sidebar for the floating glass bar used in the rrweb dashboard, with Sessions and Account links. The session list shows the stored organization name and no longer loads Clerk, so opening it offline leaves the saved account alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Cloud start now names the account shown in the popup, and the worker refuses it when the stored account differs. Recording events are accepted only from the recorded tab's top frame with the recording's token. When the final upload fails, the recording is kept in the extension and the popup offers Retry upload or Discard; logging out removes that user's failed uploads. browser-client: stop() resolves to a delivery result instead of always succeeding, postEvents() is exported for retries, large events whose POST failed are only ever re-sent over HTTP, and flush() also posts while the first socket is connecting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rrweb/all
@rrweb/browser-client
@rrweb/packer
@rrweb/record
@rrweb/replay
rrdom
rrdom-nodejs
rrvideo
rrweb
rrweb-player
rrweb-snapshot
@rrweb/types
@rrweb/utils
@rrweb/rrweb-plugin-canvas-webrtc-record
@rrweb/rrweb-plugin-canvas-webrtc-replay
@rrweb/rrweb-plugin-console-record
@rrweb/rrweb-plugin-console-replay
@rrweb/rrweb-plugin-network-record
@rrweb/rrweb-plugin-network-replay
@rrweb/rrweb-plugin-sequential-id-record
@rrweb/rrweb-plugin-sequential-id-replay
commit: |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The player page now imports rrweb-player's stylesheet from the package instead of loading it from a CDN, so it also works offline. The manifest gains a description, and the Firefox-only browser_style key is no longer in the Chrome build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The background sets an uninstall URL pointing at a Google Form. No user data is added to the URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…form Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chrome refuses to inject a script file containing a noncharacter such as
U+FFFE ("isn't UTF-8 encoded"). The inlined postcss compares against
"￾" and the minifier writes it as the raw character, which broke
injecting content/inject.js when recording starts. A small build plugin
writes noncharacters back as \u escapes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The signed-in popup gains an "Offline sessions" link next to "Open dashboard", and the signed-out header button is labelled "Offline sessions". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Offline sessions get a Share action on the session list and the player
page (Chrome only). Sharing asks for confirmation first, because offline
recordings don't mask form fields, and links to the privacy policy. The
upload goes to the signed-in organization under a new recording ID, with
event times shifted to the moment of sharing. An interrupted share resumes
to the same recording and organization; deleting a session also removes
anything kept for its share. Once shared, the action opens the recording.
The background worker now registers its message handlers before any async
start-up, so a message that wakes a suspended worker is no longer lost
("Receiving end does not exist").
Also: the session list is titled "Offline Stored Sessions", the popup shows
a labelled "Offline sessions" button in both views and drops the settings
button, "Cloud dashboard" replaces "Open dashboard" and is linked from the
extension pages, and long recording names are truncated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The popup has one record button and a Cloud / Offline switch above it, so a signed-in person can also record offline. Each side of the switch has its own link underneath (Cloud dashboard, Offline sessions), replacing the separate buttons at the bottom. The button label and the line under it follow the switch, and the choice is remembered. Signed out, Offline is chosen and Cloud asks you to sign in; while Cloud is setting up, Offline still works. The switch is locked to the running recording's mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gn-out The service worker now stays awake until a stopped recording's final upload is delivered or kept for retry, so a slow final POST can no longer be cut off. Logging out stops any upload still finishing for that user from re-saving a failed upload, and signing out on the rrweb website now removes that user's failed uploads too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picking an organization that has no public recording key now says it isn't set up for recording yet and links to the Cloud dashboard, instead of a retry that can never work. A failed switch moves the session back to the previous organization, so the extension and the dashboard stay on the same one. During setup, an organization without a key is skipped in favour of one that has a key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While a tab is being recorded, the toolbar icon shows a red badge on that tab only (a muted red while paused). It is cleared when the recording ends or the tab goes away. Badge errors are logged and never affect recording. Also reword the Cloud note to "Form fields are masked." Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cks it Signed out, the Cloud side of the switch is selectable and shows a short Cloud screen (sharing by link, AI narration) with Sign up free and Log in in place of the record button. Offline stays the default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Firefox warns about version_name as an unknown manifest key, so only the Chrome build sets it. Recordings fall back to the manifest version when there is no version_name, so Firefox recordings no longer say "unknown". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The icons are now the rounded dark rrweb square with the mark drawn 25% larger and centred. The 16 and 48 px sizes use slightly heavier lines so the R stays legible in the toolbar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The extension no longer signs in with Clerk or streams through @rrweb/browser-client. The rrweb dashboard hands it the organization's public key through externally_connectable, and every recording is kept in the background like an offline one. In Cloud mode it is stored, then uploaded through the public ingest API when the person presses Stop, on the same path Share uses. A failed upload stays in Offline sessions, where Share finishes it. This reverts the browser-client transport changes, drops the Clerk SDK, the cookies permission, the Clerk host permissions and the separate failed-upload store. A start the page never confirms now gives up after 15 seconds, and the popup names the organization a running recording started with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The recorder keeps one phase (idle, finding the tab, starting, recording, pausing, paused or resuming), and each step waiting on the page applies its reply only while that phase is still current. The stored status is a union with one Destination type, so no -1, null or placeholder token stands in for a state. A second pause or resume click while one is in flight does nothing, a stale resume never restarts the page with an earlier recording's token, and stopping during a resume also stops the page. Uploads save what is still unsent after each accepted chunk, so a worker that stops part way resumes there. A pending share no longer keeps its own copy of the public key and retries with the connected one. Share uploads keep the worker alive, and open session lists drop a recording once its upload succeeds. The external disconnect message is removed (disconnect is a popup action), the listener derives the dashboard origin from the build config, and leftover compatibility code for never-released builds is gone. Masking copy now says typed form input is masked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ok this is a real improvement especially as we don't need those blanket scary permissions to 'access all websites'... However it does mean we drop all multi-page navigation. There is another way wondering if you considered it; basically when user hits 'record' they could be prompted for permissions to all origins/domains associated with the active tab, that way it would follow normal navigation on a website as well as real multi-page flows hop subdomains — www.example.com → app.example.com → checkout.example.com
const url = new URL(tab.url); Getting eTLD+1 right technically needs the Public Suffix List (so you don't compute *.co.uk), but a pragmatic heuristic (last two labels, with a small PSL exception list) covers most of it. Navigation within app.example.com is followed; navigation to stripe.com or anywhere else ends the recording.
|
A recording used to finish when the recorded tab's page went away. It now follows the tab: when the page goes away the recorder waits up to 30 seconds for the next one to load, injects into it and records it under the same token, starting with its own FullSnapshot. Whether a page may be followed is the browser's call: Chrome keeps activeTab access within the origin of the record click, Firefox drops it on any navigation, and a refused injection finishes the recording as Stop does. No permission is added. A paused recording stays paused across a navigation, and Pause while the next page loads pauses at once. Stop claims the recording before it waits, so nothing can follow or finish it meanwhile, and a page still starting stops itself when it finds the recording gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, same-site navigation and reloads are followed now (2ed9d01), with the navigating phase you describe and no new permission. Following subdomains through optional_host_permissions makes sense to me as a follow-up PR, so this one stays reviewable. Does that work for you? |
Motivation
The extension records and replays sessions locally, so a recording stays in the browser that made it. This adds an optional rrweb Cloud mode that uploads a recording when you stop it. Offline recording works as before, with no account.
On the earlier question about
createTransportin@rrweb/browser-client: that change is gone, andpackages/browser-clientmatchesmain. The extension now keeps a recording's events in the service worker, as offline mode already did, and uploads the finished recording with a small uploader of its own (background/upload.ts) to the publicPOST /recordings/{id}/eventsendpoint. There is no WebSocket and no recording ID insessionStorage, so browser-client needs nothing new.Behaviour changes in offline mode
<all_urls>content script is gone; the recorder is injected into the current tab withactiveTabandscriptingwhen recording starts. This keeps the Web Store listing free of the "read and change all your data on all websites" warning.Change
{ orgId, orgName, publicKey }throughexternally_connectable. The extension accepts a status and a connect message, and only from the dashboard origin it was built with. It has no sign-in of its own and no host permissions.background/recorder.tskeeps one phase: idle, finding the tab, starting, recording, pausing, paused, resuming, navigating, reattaching or finishing. A step waiting on the page applies its reply only while its phase is current, so a late reply can't touch a newer recording. A start the page never confirms gives up after 15 seconds.Reviewing
Most of the logic is in
background/:recorder.ts,sinks.ts,upload.ts,shareSession.tsandexternal.ts. The popup and pages are UI on top of that.theme.ts,PageChrome.tsx, the icons and the options page are branding, about 900 lines. Tests are about half of the added lines.The commit history includes an earlier design with a Clerk sign-in inside the extension and the browser-client transport, replaced in e4bf0b1. The full diff against
mainis easier to read than the commits one by one.Testing
packages/web-extension: 179 tests, covering the recorder phases and their races, the uploader and its progress, the dashboard messages, sharing and the popup states.