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 isolating unbundleable deps and switching to subpath imports.

  • kernel-errors: Extracts ErrorCode to error-codes.ts and adds isSampleGenerationError; introduces bundleable/ with SampleGenerationError and re-exports via ./bundleable; updates BaseError import; removes isRetryableNetworkError from public exports; adds tests.
  • kernel-agents: Switches imports to @metamask/kernel-utils/* subpaths and to @metamask/kernel-errors/bundleable; retry logic now uses isSampleGenerationError and SampleGenerationError from bundleable build.
  • kernel-utils: Adds subpath exports for counter, merge-disjoint-records, and schema; splits makeCounter into counter.ts and re-exports from misc for backwards compatibility.
  • ocap-kernel: Moves isRetryableNetworkError into src/utils/isRetryableNetworkError.ts and updates ConnectionFactory/network to use it.
  • Deps/config: Updates package exports and dependencies (e.g., drop @libp2p/interface from kernel-errors, add @metamask/streams/@metamask/utils to kernel-test); lockfile updated.

Written by Cursor Bugbot for commit 23637c2. 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
grypez and others added 3 commits January 20, 2026 17:34
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.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@grypez grypez force-pushed the grypez/refactor-kernel-errors-libp2p branch from 6c9d512 to 23637c2 Compare January 21, 2026 02:44
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.

2 participants