Conversation
…ections Add direct QUIC (UDP) transport for peer-to-peer Node.js kernel communication without requiring a relay server. Users declare `directListenAddresses` in `initRemoteComms` options and the platform layer auto-detects and injects the `@chainsafe/libp2p-quic` transport. Key changes: - ConnectionFactory: options bag API, direct transport merging, conditional bootstrap (allows relay-free operation), getListenAddresses() - Kernel: expose listenAddresses in status, add registerLocationHints() - NodejsPlatformServices: auto-detect QUIC from address strings, dynamic import of @chainsafe/libp2p-quic - E2E tests proving direct QUIC works without any relay Closes #645 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
13 tasks
Pluralize directTransport to directTransports (array) to support multiple simultaneous transports. Add TCP transport auto-detection in NodejsPlatformServices alongside existing QUIC detection. Users can now pass both QUIC and TCP addresses: directListenAddresses: ['/ip4/0.0.0.0/udp/0/quic-v1', '/ip4/0.0.0.0/tcp/0'] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add missing getListenAddresses method to PlatformServices mocks in kernel-test, ocap-kernel test helpers, Kernel.test, and PlatformServicesServer.test to match the updated type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Wrap dynamic QUIC/TCP imports with actionable error messages - Validate unrecognized direct listen addresses (throw instead of silently dropping) - Fix timer leak in ConnectionFactory.stop() via clearTimeout in .finally() - Remove unnecessary `undefined as unknown as Libp2p` type assertion - Add missing listenAddresses to kernel-test status assertion - Add registerLocationHints to mock RemoteManager and unit test in Kernel.test - Add tests for dynamic import failures, empty relays+hints, unsupported addresses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Coverage Report
File Coverage |
Both @chainsafe/libp2p-quic and @libp2p/tcp are hard dependencies that ship with @ocap/nodejs. Wrapping their imports adds noise without value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both packages are hard dependencies of @ocap/nodejs. Dynamic imports added unnecessary indirection with no benefit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
grypez
requested changes
Feb 13, 2026
Contributor
grypez
left a comment
There was a problem hiding this comment.
Looks good, just a few comments for maintainability.
Could declare and reuse this type in a few places.
type DirectTransport = {
transport: unknown;
listenAddresses: string[];
};
packages/ocap-kernel/src/remotes/platform/connection-factory.ts
Outdated
Show resolved
Hide resolved
- Add clarifying comment for conditional peer discovery - Use multiaddr().getPeerId() instead of string matching for direct address detection in candidateAddressStrings() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
packages/ocap-kernel/src/remotes/platform/connection-factory.ts
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…y fallback A malformed hint passed to multiaddr() would throw and abort address generation before relay addresses were built. Now invalid hints are caught and skipped so relay fallback dialing still works. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
grypez
approved these changes
Feb 13, 2026
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
directListenAddressesoption toRemoteCommsOptionsfor users to declare direct listen addressesNodejsPlatformServicesauto-detects QUIC (/quic-v1) and TCP (/tcp/) transports from address stringsConnectionFactoryaccepts multipledirectTransports(array), merging them into the libp2p configcandidateAddressStrings()kernel.getStatus()exposeslistenAddresseswhen remote comms is connectedkernel.registerLocationHints()added for out-of-band address exchange between peersTest plan
yarn workspace @metamask/ocap-kernel test:dev:quiet— all unit tests pass (1944)yarn workspace @ocap/nodejs test:dev:quiet— all Node.js tests pass (50)yarn workspace @metamask/ocap-kernel lint:fix— cleanyarn workspace @ocap/nodejs lint:fix— cleanyarn workspace @ocap/nodejs test:e2e:ci— direct QUIC and TCP between Node.js kernelsCloses #645
🤖 Generated with Claude Code
Note
Medium Risk
Touches core remote-communication setup and dialing behavior and adds new transports/dependencies (QUIC/TCP), which can affect connectivity across environments despite strong test coverage.
Overview
Adds Node.js direct connectivity for remote comms by introducing
directListenAddresses(user-facing) and internally mapping it to injecteddirectTransports(QUIC via@chainsafe/libp2p-quic, TCP via@libp2p/tcp), including validation for unsupported multiaddrs.Updates the libp2p
ConnectionFactoryto acceptdirectTransports, merge their listen addresses/transports into the libp2p config, skip bootstrap discovery when no relays are configured, and prefer direct address hints (skipping malformed hints) before relay-derived dial attempts.Exposes new surface area:
Kernel.registerLocationHints()for out-of-band direct address exchange andKernel.getStatus().remoteComms.listenAddresses(plumbed via newPlatformServices.getListenAddresses()/initTransportreturn value). Browser platform services implementgetListenAddresses()as[].Adds extensive unit coverage plus a new Node.js E2E suite verifying QUIC/TCP direct messaging, and updates mocks/tests accordingly; also broadens
.gitignoreto ignore**/.claude/settings.local.json.Written by Cursor Bugbot for commit 8e56a5e. This will update automatically on new commits. Configure here.