feat(ocap-kernel): use E() for kernel service invocation to support remote presences#872
Merged
feat(ocap-kernel): use E() for kernel service invocation to support remote presences#872
Conversation
…emote presences Switch invokeKernelService from direct property access to E() from @endo/eventual-send, enabling CapTP remote presences to be registered as kernel service objects. Expose registerKernelServiceObject on the kernel facet so callers over CapTP can register services. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mote presence Proves the full round-trip: a worker thread creates an exo, registers it on the kernel over CapTP, a real vat invokes a method on it, the call traverses CapTP back to the worker, and the result returns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
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.
Description
Switches
KernelServiceManager.invokeKernelService()to useE()from@endo/eventual-sendinstead of direct property access. This enables CapTP remote presences (whose methods aren't enumerable) to be registered as kernel service objects — a separate process can now create an exo, register it on the kernel over CapTP, and have vats invoke methods on it seamlessly.Changes
KernelServiceManager.ts— Replace directservice[method]()invocation withE(service)[method](), removing the manual method-exists check (E() handles this natively)kernel-facet.ts— AddregisterKernelServiceObjectto the kernel facet so it's callable over CapTPcaptp-service-client.js(new) — Worker thread that sets up a CapTP connection to the kernel, creates a test exo, and registers it as a kernel servicecaptp-service-vat.ts(new) — Minimal vat that callsE(testService).doSomething(3, 4)and returns the resultcaptp-service.test.ts(new) — E2E test proving the full round-trip: worker registers exo over CapTP → vat invokes method → call traverses CapTP → result returnsservice.test.ts— Fix assertion for error message format change (exact match → regex)captp.integration.test.ts— AddregisterKernelServiceObjectto mock kernel (required bymakeKernelFacet)Testing
The core behavior change is unit-tested in
KernelServiceManager.test.ts(updated to cover both local exo and remote presence scenarios). The new e2e test inpackages/nodejs/test/e2e/captp-service.test.tsvalidates the full CapTP round-trip: a real kernel, a worker thread acting as a CapTP client, and a bundled vat that invokes the remotely-registered service. The existingkernel-testservice test andkernel-browser-runtimeintegration tests continue to pass with the updated assertions.Note
Medium Risk
Changes the kernel’s service invocation path to use
E()(asynchronous eventual-send) and exposes service registration over the kernel facet, which can affect error propagation and method resolution for all kernel services.Overview
Kernel services can now be implemented as remote CapTP presences.
KernelServiceManager.invokeKernelService()switches from directservice[method](...)calls toE(service)[method](...), enabling proxy/presence objects whose methods aren’t enumerable.The kernel facet now exposes
registerKernelServiceObject, and tests/mocks are updated accordingly (including looser assertions around error formatting under eventual-send/SES).Adds a Node.js e2e that spawns a worker CapTP client to register a service exo over CapTP and verifies a vat can call it end-to-end; updates dependencies (
@endo/eventual-sendinocap-kernel,@endo/captpfor nodejs tests).Written by Cursor Bugbot for commit e9cd1c0. This will update automatically on new commits. Configure here.