Skip to content

Conversation

@grypez
Copy link
Contributor

@grypez grypez commented Jan 14, 2026

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 (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 makeJsonAgent bundleable with @endo/bundle-source by reducing cross-package deps and introducing bundle-safe entry points.

  • kernel-errors: Extracts ErrorCode to error-codes.ts, adds isSampleGenerationError type guard, introduces bundleable/ (incl. SampleGenerationError), updates exports, and adds tests; removes libp2p-related dependency.
  • kernel-utils: Adds subpath exports for counter, merge-disjoint-records, and schema; re-exports makeCounter from new module.
  • kernel-agents: Switches to new subpath imports and uses bundleable SampleGenerationError/isSampleGenerationError.
  • ocap-kernel: Moves isRetryableNetworkError here (utils/), updates remotes to use it.
  • Minor: lockfile/package updates and import path adjustments across files.

Written by Cursor Bugbot for commit 3a34ff1. This will update automatically on new commits. Configure here.

@grypez grypez changed the base branch from main to grypez/add-skill-create-package January 14, 2026 18:50
@grypez grypez force-pushed the grypez/refactor-kernel-errors-libp2p branch from d349ac7 to 1cd0e2b Compare January 15, 2026 17:09
@grypez grypez force-pushed the grypez/add-skill-create-package branch from b817127 to d269097 Compare January 15, 2026 17:18
@grypez grypez changed the base branch from grypez/add-skill-create-package to main January 15, 2026 17:23
@grypez grypez force-pushed the grypez/refactor-kernel-errors-libp2p branch from 1cd0e2b to 6de5dee Compare January 15, 2026 17:24
@grypez grypez changed the title refactor: Make kernel-errors bundleable with @endo/bundle-source refactor: Make makeJsonAgent bundleable with @endo/bundle-source Jan 15, 2026
@grypez grypez marked this pull request as ready for review January 15, 2026 17:59
@grypez grypez requested a review from a team as a code owner January 15, 2026 17:59
@grypez grypez force-pushed the grypez/refactor-kernel-errors-libp2p branch from 6de5dee to 6c9d512 Compare January 15, 2026 18:02
@grypez grypez enabled auto-merge January 15, 2026 18:02
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.
@grypez grypez force-pushed the grypez/refactor-kernel-errors-libp2p branch 2 times, most recently from 23637c2 to ef88bc2 Compare January 21, 2026 15:59
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@grypez grypez force-pushed the grypez/refactor-kernel-errors-libp2p branch from ef88bc2 to 3a34ff1 Compare January 21, 2026 16:16
Copy link
Member

@rekmarks rekmarks left a 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.

@grypez grypez disabled auto-merge January 22, 2026 01:22
@rekmarks
Copy link
Member

Superceded by #763

@rekmarks rekmarks closed this Jan 23, 2026
@rekmarks rekmarks deleted the grypez/refactor-kernel-errors-libp2p branch January 23, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants