feat(kernel-browser-runtime): pass full RemoteCommsOptions via worker URL#881
Merged
feat(kernel-browser-runtime): pass full RemoteCommsOptions via worker URL#881
Conversation
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extract hostnames from plain ws:// relay multiaddrs and merge them into allowedWsHosts automatically, so callers don't need to redundantly specify both relays and allowedWsHosts for the same host. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rekmarks
reviewed
Mar 19, 2026
packages/ocap-kernel/src/remotes/platform/connection-factory.test.ts
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rekmarks
requested changes
Mar 19, 2026
packages/kernel-browser-runtime/src/utils/comms-query-string.ts
Outdated
Show resolved
Hide resolved
Instead of silently ignoring malformed array/number params, fail fast with a TypeError so misconfigurations are caught immediately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
createRelayQueryString/parseRelayQueryString/getRelaysFromCurrentLocation) with typedcomms-query-stringutilities (createCommsQueryString,parseCommsQueryString,getCommsParamsFromCurrentLocation) that support all serializableRemoteCommsOptionsfields (arrays, numeric tuning knobs)@metamask/superstruct; silently ignore invalid values when parsingmnemonicfrom query string serialization (secret — must not appear in URLs)directTransports(internal, platform-injected, not URL-serializable)CommsQueryParamstype for consumers (Omit<RemoteCommsOptions, 'directTransports' | 'mnemonic'>)ws://relay multiaddrs intoallowedWsHostsinConnectionFactory, so callers don't need to redundantly specify bothdocs/usage.mdexamplesTest plan
createCommsQueryString(round-trip, validation errors, empty arrays)parseCommsQueryString(valid/invalid JSON, missing params, no leading?, non-string-array values)getCommsParamsFromCurrentLocation(with/withoutglobalThis.location)comms-query-string.ts(statements, branches, functions, lines)ConnectionFactorytest for auto-allowing ws:// relay hostsconnection-factory.test.tstests pass (77+)index.test.ts,utils/index.test.ts)Note
Medium Risk
Expands how remote comms are configured and parsed from worker URLs and tweaks libp2p WebSocket allowlisting logic, which could affect connectivity and connection gating behavior if misconfigured.
Overview
Updates browser worker remote-comms configuration to pass a full, typed subset of
RemoteCommsOptionsvia URL query params, replacing relay-only helpers with newcreateCommsQueryString/parseCommsQueryString/getCommsParamsFromCurrentLocationutilities (including runtime validation and support for numeric tuning options and additional address lists).Migrates the browser
kernel-workerplus extension and omnium offscreen worker bootstrapping to use the new comms query params and initializesinitRemoteCommswith the parsed options object.Adjusts
ConnectionFactoryto auto-allow plainws://relay hosts by extracting hosts from configured relay multiaddrs intoallowedWsHosts, and updates/adds unit tests and docs to reflect the new APIs andinitRemoteComms({ relays })calling convention.Written by Cursor Bugbot for commit 7a580f4. This will update automatically on new commits. Configure here.