-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Add kref-presence for E() on vat objects #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rekm/caplet-implementation
Are you sure you want to change the base?
Conversation
| } | ||
| } | ||
| return arg; // Pass primitive through | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nested presences not converted to kref strings in args
Medium Severity
The sendToKernel function only converts top-level presence objects to kref strings, not presences nested within objects or arrays. When calling E(presence).method({ nested: anotherPresence }), the nested presence won't be converted to its kref string before being passed to CapTP. This creates an asymmetry with convertKrefsToStandins on the kernel side, which does recursively convert nested kref strings. The nested presence may be incorrectly serialized by CapTP since it doesn't know about presences created by the presence manager.
451a6dd to
605f8d9
Compare
8b56b6b to
565d843
Compare
605f8d9 to
f08383c
Compare
565d843 to
544344e
Compare
f08383c to
34a1f08
Compare
544344e to
bad09bc
Compare
34a1f08 to
4caf528
Compare
Set globalThis.kernel in the extension and omnium to the kernel itself. Remove ping and getKernel methods from background console interface. The kernel exposes ping().
…ects Implement slot translation pattern to enable E() (eventual sends) on vat objects from the extension background. This creates presences from kernel krefs that forward method calls to kernel.queueMessage() via the existing CapTP connection. Key changes: - Add background-kref.ts with makeBackgroundKref() factory - Add node-endoify.js to kernel-shims for Node.js environments - Update kernel-facade to convert kref strings to standins - Fix launch-subcluster RPC result to use null for JSON compatibility - Integrate resolveKref/krefOf into omnium background The new approach uses @endo/marshal with smallcaps format (matching the kernel) rather than trying to hook into CapTP internal marshalling, which uses incompatible capdata format. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…ntegration Split the vitest configuration into two separate files to fix issues with tests running from the repo root: - vitest.config.ts: Unit tests with mock-endoify - vitest.integration.config.ts: Integration tests with node-endoify Add test:integration script to run integration tests separately. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…helpers - Remove packages/nodejs/src/env/endoify.ts re-export, use @metamask/kernel-shims/node-endoify directly - Update vitest configs to use kernel-shims for setup files - Remove inline endoify imports from test files (now handled by vitest setup) - Fix test helpers to handle SubclusterLaunchResult return type from launchSubcluster() - Add kernel-shims dependency to kernel-test and nodejs-test-workers packages - Set coverage thresholds to 0 temporarily Co-Authored-By: Claude Opus 4.5 <[email protected]>
…e configs - Fix accidentally broken nodejs vat worker (which broke all tests relying on it) - Rename node-endoify.js to endoify-node.js for consistency - Update package.json export from ./node-endoify to ./endoify-node - Update all vitest configs to use the new export path - Update depcheckrc.yml ignore pattern Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Import and initialize makeBackgroundKref to enable E() calls on vat objects - Expose captp.resolveKref and captp.krefOf on globalThis for console access - Refactor startDefaultSubcluster to return the bootstrap vat rootKref - Add greetBootstrapVat function that automatically calls hello() on the bootstrap vat after subcluster launch on startup - Update global.d.ts with captp type declaration for IDE support Co-Authored-By: Claude <[email protected]>
- Rename background-kref.ts to kref-presence.ts - Rename makeBackgroundKref to makePresenceManager - Rename BackgroundKref type to PresenceManager - Rename BackgroundKrefOptions to PresenceManagerOptions - Update all imports and references across affected packages - Update JSDoc comments to reflect new naming - All tests pass for kernel-browser-runtime, extension, omnium-gatherum Co-Authored-By: Claude <[email protected]>
…nvertKrefsToStandins - Move convertKrefsToStandins from kernel-facade.ts to kref-presence.ts for better organization - Export convertKrefsToStandins for use by kernel-facade - Add comprehensive unit tests for convertKrefsToStandins (20 tests covering kref conversion, arrays, objects, primitives) - Add unit tests for makePresenceManager (3 tests for kref resolution and memoization) - Add integration test in kernel-facade.test.ts verifying kref conversion in queueMessage Co-Authored-By: Claude <[email protected]>
bad09bc to
88b8378
Compare
Summary
Test plan
Part 4 of 4 in PR stack for omnium-III
Depends on: #753
🤖 Generated with Claude Code
Note
Enables E()-style calls on vat objects and improves test/runtime setup across packages.
kref-presenceutilities: newmakePresenceManagerandconvertKrefsToStandins; exported from@metamask/kernel-browser-runtime; unit and integration tests addedglobalThis.kernelto a promise, attaches CapTPPresenceManageronglobalThis.captp/omnium(exposesresolveKref/krefOf), pings kernel on action, and greets bootstrap vat after launching default subclusterqueueMessageconverts kref strings to standins;launchSubclusterhandler returns JSON-compatible result with nullablebootstrapResult; tests updated@metamask/kernel-shims/endoify-node(optional@libp2p/webrtcpeer) and packages/tests switched to it; remove old local endoify importstest:integrationscript; GitHub Actions runs build + integrationWritten by Cursor Bugbot for commit 8b56b6b. This will update automatically on new commits. Configure here.