-
Notifications
You must be signed in to change notification settings - Fork 7
refactor: Make makeJsonAgent bundleable with @endo/bundle-source #750
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
Conversation
d349ac7 to
1cd0e2b
Compare
b817127 to
d269097
Compare
1cd0e2b to
6de5dee
Compare
6de5dee to
6c9d512
Compare
This refactors kernel-utils and kernel-errors to enable makeJsonAgent to be bundled into vats using @endo/bundle-source. Changes: - kernel-utils: Added subpath exports (counter, merge-disjoint-records, schema) - kernel-errors: Added bundleable subpath with simplified error classes - kernel-errors: Extracted ErrorCode to error-codes.ts (no @metamask/utils dep) - ocap-kernel: Moved isRetryableNetworkError from kernel-errors to utils - kernel-agents: Updated to use subpath imports The bundler was failing due to transitive dependencies on @noble/hashes which has ESM/CJS compatibility issues. By using subpath exports and moving libp2p-specific code to ocap-kernel, we avoid pulling in unbundleable dependencies.
23637c2 to
ef88bc2
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ef88bc2 to
3a34ff1
Compare
rekmarks
left a comment
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.
I don't love the idea of complicating our package exports due to deficiencies in @endo/bundle-source, in this case complaining about dependencies that aren't actually used. Since we need to support mainstream bundlers at some point anyway, I'd rather we figure out how to do this with Vite.
|
Superceded by #763 |
Refactors kernel-utils and kernel-errors to enable makeJsonAgent to be bundled into vats using @endo/bundle-source.
Changes:
The bundler was failing due to transitive dependencies on @noble/hashes (through @metamask/utils) which has ESM/CJS compatibility issues. By using subpath exports and moving libp2p-specific code to ocap-kernel, we avoid pulling in unbundleable dependencies.
Note
Makes
makeJsonAgentbundleable with @endo/bundle-source by reducing cross-package deps and introducing bundle-safe entry points.ErrorCodetoerror-codes.ts, addsisSampleGenerationErrortype guard, introducesbundleable/(incl.SampleGenerationError), updates exports, and adds tests; removes libp2p-related dependency.counter,merge-disjoint-records, andschema; re-exportsmakeCounterfrom new module.SampleGenerationError/isSampleGenerationError.isRetryableNetworkErrorhere (utils/), updatesremotesto use it.Written by Cursor Bugbot for commit 3a34ff1. This will update automatically on new commits. Configure here.