diff --git a/.depcheckrc.yml b/.depcheckrc.yml
index 68297a790..cf63d4d6c 100644
--- a/.depcheckrc.yml
+++ b/.depcheckrc.yml
@@ -2,7 +2,7 @@
ignores:
# monorepo
- '@metamask/kernel-shims'
- - '@ocap/cli'
+ - '@metamask/kernel-cli'
- '@ocap/repo-tools'
# eslint and prettier
@@ -47,11 +47,11 @@ ignores:
- 'typedoc'
- 'typescript'
- # Used by @ocap/nodejs to build the sqlite3 bindings
+ # Used by @metamask/kernel-node-runtime to build the sqlite3 bindings
- 'node-gyp'
# Peer dependency of @metamask/kernel-shims due to its /endoify-node
- # export, used by @ocap/nodejs
+ # export, used by @metamask/kernel-node-runtime
- '@libp2p/webrtc'
# These are peer dependencies of various modules we actually do
diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml
index ad8dab6ff..3a0ad979a 100644
--- a/.github/workflows/lint-build-test.yml
+++ b/.github/workflows/lint-build-test.yml
@@ -145,7 +145,19 @@ jobs:
strategy:
matrix:
node-version: [24.x]
- package: [omnium-gatherum, nodejs, extension]
+ package:
+ [
+ '@metamask/kernel-node-runtime',
+ '@ocap/extension',
+ '@ocap/omnium-gatherum',
+ ]
+ include:
+ - package: '@metamask/kernel-node-runtime'
+ directory: kernel-node-runtime
+ - package: '@ocap/extension'
+ directory: extension
+ - package: '@ocap/omnium-gatherum'
+ directory: omnium-gatherum
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v3
@@ -156,13 +168,13 @@ jobs:
- run: VITE_DB_FOLDER=e2e yarn build
- name: Run E2E tests
id: e2e
- run: yarn workspace @ocap/${{ matrix.package }} test:e2e:ci
+ run: yarn workspace ${{ matrix.package }} test:e2e:ci
- name: Upload test artifacts
if: ${{ failure() && steps.e2e.conclusion == 'failure' }}
uses: actions/upload-artifact@v7
with:
- name: playwright-traces-${{ matrix.package }}
- path: packages/${{ matrix.package }}/test-results
+ name: playwright-traces-${{ matrix.directory }}
+ path: packages/${{ matrix.directory }}/test-results
if-no-files-found: ignore
- name: Require clean working directory
shell: bash
diff --git a/docs/usage.md b/docs/usage.md
index 158ec46e5..3e9e07066 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -80,7 +80,7 @@ await kernel.initRemoteComms(relays);
For Node.js environments, you can use the provided utility function:
```typescript
-import { makeKernel } from '@ocap/nodejs';
+import { makeKernel } from '@metamask/kernel-node-runtime';
import { MessageChannel } from 'node:worker_threads';
// Create a message channel for kernel communication
@@ -100,7 +100,7 @@ Alternatively, you can manually set up the Node.js components:
```typescript
import { Kernel } from '@metamask/ocap-kernel';
import { makeSQLKernelDatabase } from '@metamask/kernel-store/sqlite/nodejs';
-import { NodejsPlatformServices } from '@ocap/nodejs';
+import { NodejsPlatformServices } from '@metamask/kernel-node-runtime';
// Initialize kernel database with Node.js SQLite implementation
const kernelDatabase = await makeSQLKernelDatabase({
@@ -121,7 +121,7 @@ const kernel = await Kernel.make(platformServices, kernelDatabase, {
Vats execute JavaScript code bundled into a specific format. To create a vat bundle:
1. Write your vat code with a root object that exports methods
-2. Bundle the code using the `@ocap/cli` with `yarn ocap bundle ./path/to/vat.js`
+2. Bundle the code using the `@metamask/kernel-cli` with `yarn ocap bundle ./path/to/vat.js`
Example vat code:
@@ -475,7 +475,7 @@ For a comprehensive overview of the API:
### CLI Tools
-The `@ocap/cli` package provides tools for working with vat bundles:
+The `@metamask/kernel-cli` package provides tools for working with vat bundles:
```bash
# Bundle a vat file
@@ -490,7 +490,7 @@ yarn ocap serve ./path/to/bundles
For testing vats and kernel integration, the project uses Vitest:
```typescript
-import { makeKernel } from '@ocap/nodejs';
+import { makeKernel } from '@metamask/kernel-node-runtime';
import { MessageChannel } from 'node:worker_threads';
import { describe, it, expect } from 'vitest';
@@ -619,7 +619,7 @@ async function run() {
### Node.js Implementation
```typescript
-import { makeKernel } from '@ocap/nodejs';
+import { makeKernel } from '@metamask/kernel-node-runtime';
import { ClusterConfigStruct } from '@metamask/ocap-kernel';
import { MessageChannel } from 'node:worker_threads';
import fs from 'node:fs/promises';
diff --git a/eslint.config.mjs b/eslint.config.mjs
index cc80025cd..987853357 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -256,10 +256,10 @@ const config = createConfig([
files: [
'**/vite.config.ts',
'**/vitest.config.ts',
- 'packages/cli/**/*',
'packages/extension/**/*',
- 'packages/nodejs/**/*-worker.ts',
- 'packages/nodejs/test/workers/**/*',
+ 'packages/kernel-cli/**/*',
+ 'packages/kernel-node-runtime/**/*-worker.ts',
+ 'packages/kernel-node-runtime/test/workers/**/*',
'packages/omnium-gatherum/**/*',
'packages/repo-tools/**/*',
],
@@ -273,7 +273,7 @@ const config = createConfig([
'packages/*/src/**/vats/**/*',
'packages/*/src/**/caplets/**/*.js',
'packages/*/test/**/vats/**/*',
- 'packages/nodejs/test/workers/**/*',
+ 'packages/kernel-node-runtime/test/workers/**/*',
'packages/logger/test/workers/**/*',
],
rules: {
diff --git a/package.json b/package.json
index eb7706386..fd8f370ac 100644
--- a/package.json
+++ b/package.json
@@ -62,7 +62,7 @@
"@metamask/eslint-config-nodejs": "^15.0.0",
"@metamask/eslint-config-typescript": "^15.0.0",
"@metamask/eslint-config-vitest": "^15.0.0",
- "@ocap/cli": "workspace:^",
+ "@metamask/kernel-cli": "workspace:^",
"@ts-bridge/cli": "^0.6.3",
"@ts-bridge/shims": "^0.1.1",
"@types/lodash": "^4.17.16",
@@ -112,7 +112,7 @@
"lavamoat": {
"allowScripts": {
"$root$": true,
- "@ocap/cli>@metamask/logger>@metamask/streams": true,
+ "@metamask/kernel-cli>@metamask/logger>@metamask/streams": true,
"@lavamoat/preinstall-always-fail": false,
"eslint-import-resolver-typescript>unrs-resolver": false,
"eslint-plugin-import-x>unrs-resolver": false,
@@ -123,9 +123,10 @@
"vitest>@vitest/browser>webdriverio>@wdio/utils>edgedriver": false,
"vitest>@vitest/browser>webdriverio>@wdio/utils>geckodriver": false,
"vitest>@vitest/mocker>msw": false,
- "@ocap/cli>@ocap/nodejs>@libp2p/webrtc>@ipshipyard/node-datachannel": false,
- "@ocap/cli>@ocap/nodejs>@metamask/kernel-store>better-sqlite3": false,
- "@ocap/cli>@ocap/nodejs>@metamask/streams": false
+ "@metamask/kernel-cli>@metamask/kernel-node-runtime>@libp2p/webrtc>@ipshipyard/node-datachannel": false,
+ "@metamask/kernel-cli>@metamask/kernel-node-runtime>@metamask/kernel-store>better-sqlite3": false,
+ "@metamask/kernel-cli>@metamask/kernel-node-runtime>@metamask/streams": false,
+ "@metamask/kernel-cli>@metamask/kernel-shims>@libp2p/webrtc>@ipshipyard/node-datachannel": false
}
},
"resolutions": {
diff --git a/packages/extension/vite.config.ts b/packages/extension/vite.config.ts
index 4b78bdd06..ae0805217 100644
--- a/packages/extension/vite.config.ts
+++ b/packages/extension/vite.config.ts
@@ -1,12 +1,12 @@
// eslint-disable-next-line spaced-comment
///
+import { bundleVats } from '@metamask/kernel-utils/vite-plugins';
import {
getDefines,
getPackageDevAliases,
} from '@ocap/repo-tools/build-utils/vite';
import {
- bundleVats,
deduplicateAssets,
extensionDev,
htmlTrustedPrelude,
diff --git a/packages/kernel-cli/CHANGELOG.md b/packages/kernel-cli/CHANGELOG.md
new file mode 100644
index 000000000..090b9a22a
--- /dev/null
+++ b/packages/kernel-cli/CHANGELOG.md
@@ -0,0 +1,16 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+### Changed
+
+- **BREAKING:** Rename package from `@ocap/cli` to `@metamask/kernel-cli` and make it public ([#875](https://github.com/MetaMask/ocap-kernel/pull/875))
+- Replace `@ocap/repo-tools/vite-plugins` dependency with `@metamask/kernel-utils/vite-plugins` ([#875](https://github.com/MetaMask/ocap-kernel/pull/875))
+- Replace `@ocap/nodejs` dependency with `@metamask/kernel-node-runtime` ([#875](https://github.com/MetaMask/ocap-kernel/pull/875))
+
+[Unreleased]: https://github.com/MetaMask/ocap-kernel/
diff --git a/packages/kernel-cli/LICENSE.APACHE2 b/packages/kernel-cli/LICENSE.APACHE2
new file mode 100644
index 000000000..8194a06ae
--- /dev/null
+++ b/packages/kernel-cli/LICENSE.APACHE2
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2025 Consensys Software Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/kernel-cli/LICENSE.MIT b/packages/kernel-cli/LICENSE.MIT
new file mode 100644
index 000000000..658c855eb
--- /dev/null
+++ b/packages/kernel-cli/LICENSE.MIT
@@ -0,0 +1,20 @@
+MIT License
+
+Copyright (c) 2025 Consensys Software Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
diff --git a/packages/cli/README.md b/packages/kernel-cli/README.md
similarity index 93%
rename from packages/cli/README.md
rename to packages/kernel-cli/README.md
index c36158921..081179f95 100644
--- a/packages/cli/README.md
+++ b/packages/kernel-cli/README.md
@@ -1,6 +1,14 @@
-# `cli`
+# `@metamask/kernel-cli`
-Ocap Kernel cli.
+Ocap Kernel CLI tool for bundling and serving vat bundles.
+
+## Installation
+
+`yarn add @metamask/kernel-cli`
+
+or
+
+`npm install @metamask/kernel-cli`
## Commands
diff --git a/packages/cli/package.json b/packages/kernel-cli/package.json
similarity index 83%
rename from packages/cli/package.json
rename to packages/kernel-cli/package.json
index 4076f33be..1f20de098 100644
--- a/packages/cli/package.json
+++ b/packages/kernel-cli/package.json
@@ -1,12 +1,21 @@
{
- "name": "@ocap/cli",
+ "name": "@metamask/kernel-cli",
"version": "0.0.0",
- "private": true,
"description": "Ocap Kernel cli",
+ "keywords": [
+ "MetaMask",
+ "object capabilities",
+ "ocap"
+ ],
+ "homepage": "https://github.com/MetaMask/ocap-kernel/tree/main/packages/kernel-cli#readme",
+ "bugs": {
+ "url": "https://github.com/MetaMask/ocap-kernel/issues"
+ },
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/ocap-kernel.git"
},
+ "license": "(MIT OR Apache-2.0)",
"type": "module",
"bin": {
"ocap": "./dist/app.mjs"
@@ -15,9 +24,10 @@
"dist/"
],
"scripts": {
- "build": "ts-bridge --project tsconfig.build.json --no-references --clean",
+ "build": "ts-bridge --project tsconfig.build.json --no-references --clean && chmod +x dist/app.mjs",
"build:docs": "typedoc",
- "changelog:validate": "../../scripts/validate-changelog.sh @ocap/cli",
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/kernel-cli",
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/kernel-cli",
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo ./logs",
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
"lint:dependencies": "depcheck --quiet",
@@ -35,13 +45,13 @@
},
"dependencies": {
"@endo/promise-kit": "^1.1.13",
+ "@metamask/kernel-node-runtime": "workspace:^",
"@metamask/kernel-shims": "workspace:^",
"@metamask/kernel-utils": "workspace:^",
"@metamask/logger": "workspace:^",
"@metamask/utils": "^11.9.0",
- "@ocap/nodejs": "workspace:^",
- "@ocap/repo-tools": "workspace:^",
"@types/node": "^22.13.1",
+ "acorn": "^8.15.0",
"chokidar": "^4.0.1",
"glob": "^11.0.0",
"serve-handler": "^6.1.6",
@@ -54,6 +64,7 @@
"@metamask/eslint-config": "^15.0.0",
"@metamask/eslint-config-nodejs": "^15.0.0",
"@metamask/eslint-config-typescript": "^15.0.0",
+ "@ocap/repo-tools": "workspace:^",
"@ts-bridge/cli": "^0.6.3",
"@ts-bridge/shims": "^0.1.1",
"@types/serve-handler": "^6",
@@ -86,5 +97,9 @@
},
"exports": {
"./package.json": "./package.json"
+ },
+ "publishConfig": {
+ "access": "public",
+ "registry": "https://registry.npmjs.org/"
}
}
diff --git a/packages/cli/src/app.ts b/packages/kernel-cli/src/app.ts
similarity index 100%
rename from packages/cli/src/app.ts
rename to packages/kernel-cli/src/app.ts
diff --git a/packages/cli/src/commands/bundle.test.ts b/packages/kernel-cli/src/commands/bundle.test.ts
similarity index 98%
rename from packages/cli/src/commands/bundle.test.ts
rename to packages/kernel-cli/src/commands/bundle.test.ts
index d07731bac..226f37eee 100644
--- a/packages/cli/src/commands/bundle.test.ts
+++ b/packages/kernel-cli/src/commands/bundle.test.ts
@@ -25,7 +25,7 @@ const mocks = vi.hoisted(() => {
};
});
-vi.mock('@ocap/repo-tools/vite-plugins', () => ({
+vi.mock('@metamask/kernel-utils/vite-plugins', () => ({
bundleVat: mocks.bundleVat,
}));
diff --git a/packages/cli/src/commands/bundle.ts b/packages/kernel-cli/src/commands/bundle.ts
similarity index 94%
rename from packages/cli/src/commands/bundle.ts
rename to packages/kernel-cli/src/commands/bundle.ts
index 883c28134..1e2ee53e8 100644
--- a/packages/cli/src/commands/bundle.ts
+++ b/packages/kernel-cli/src/commands/bundle.ts
@@ -1,6 +1,6 @@
import type { VatBundle } from '@metamask/kernel-utils';
+import { bundleVat } from '@metamask/kernel-utils/vite-plugins';
import type { Logger } from '@metamask/logger';
-import { bundleVat } from '@ocap/repo-tools/vite-plugins';
import { glob } from 'glob';
import { writeFile } from 'node:fs/promises';
import { resolve, join } from 'node:path';
@@ -30,7 +30,6 @@ export async function bundleFile(
const { logger, targetPath } = options;
const sourceFullPath = resolve(sourcePath);
const bundlePath = targetPath ?? resolveBundlePath(sourceFullPath);
- // Type annotation ensures repo-tools VatBundle stays compatible with kernel-utils VatBundle.
const bundle: VatBundle = await bundleVat(sourceFullPath);
const bundleContent = JSON.stringify(bundle);
await writeFile(bundlePath, bundleContent);
diff --git a/packages/cli/src/commands/daemon-client.ts b/packages/kernel-cli/src/commands/daemon-client.ts
similarity index 97%
rename from packages/cli/src/commands/daemon-client.ts
rename to packages/kernel-cli/src/commands/daemon-client.ts
index b9b313c0f..1ae3a83de 100644
--- a/packages/cli/src/commands/daemon-client.ts
+++ b/packages/kernel-cli/src/commands/daemon-client.ts
@@ -1,6 +1,6 @@
+import { readLine, writeLine } from '@metamask/kernel-node-runtime/daemon';
import type { JsonRpcResponse } from '@metamask/utils';
import { assertIsJsonRpcResponse } from '@metamask/utils';
-import { readLine, writeLine } from '@ocap/nodejs/daemon';
import { randomUUID } from 'node:crypto';
import { createConnection } from 'node:net';
import type { Socket } from 'node:net';
diff --git a/packages/cli/src/commands/daemon-entry.ts b/packages/kernel-cli/src/commands/daemon-entry.ts
similarity index 93%
rename from packages/cli/src/commands/daemon-entry.ts
rename to packages/kernel-cli/src/commands/daemon-entry.ts
index d95d835e9..6867551a7 100644
--- a/packages/cli/src/commands/daemon-entry.ts
+++ b/packages/kernel-cli/src/commands/daemon-entry.ts
@@ -1,9 +1,9 @@
import '@metamask/kernel-shims/endoify-node';
-import { Logger } from '@metamask/logger';
+import { makeKernel } from '@metamask/kernel-node-runtime';
+import { startDaemon } from '@metamask/kernel-node-runtime/daemon';
+import type { DaemonHandle } from '@metamask/kernel-node-runtime/daemon';
import type { LogEntry } from '@metamask/logger';
-import { makeKernel } from '@ocap/nodejs';
-import { startDaemon } from '@ocap/nodejs/daemon';
-import type { DaemonHandle } from '@ocap/nodejs/daemon';
+import { Logger } from '@metamask/logger';
import { mkdir, rm, writeFile } from 'node:fs/promises';
import { homedir } from 'node:os';
import { join } from 'node:path';
diff --git a/packages/cli/src/commands/daemon-spawn.ts b/packages/kernel-cli/src/commands/daemon-spawn.ts
similarity index 100%
rename from packages/cli/src/commands/daemon-spawn.ts
rename to packages/kernel-cli/src/commands/daemon-spawn.ts
diff --git a/packages/cli/src/commands/daemon.ts b/packages/kernel-cli/src/commands/daemon.ts
similarity index 99%
rename from packages/cli/src/commands/daemon.ts
rename to packages/kernel-cli/src/commands/daemon.ts
index 10d9ee0e6..02af06d33 100644
--- a/packages/cli/src/commands/daemon.ts
+++ b/packages/kernel-cli/src/commands/daemon.ts
@@ -1,5 +1,5 @@
+import { deleteDaemonState } from '@metamask/kernel-node-runtime/daemon';
import { isJsonRpcFailure } from '@metamask/utils';
-import { deleteDaemonState } from '@ocap/nodejs/daemon';
import { readFile, rm } from 'node:fs/promises';
import { homedir } from 'node:os';
import { join, resolve } from 'node:path';
diff --git a/packages/cli/src/commands/serve.test.ts b/packages/kernel-cli/src/commands/serve.test.ts
similarity index 100%
rename from packages/cli/src/commands/serve.test.ts
rename to packages/kernel-cli/src/commands/serve.test.ts
diff --git a/packages/cli/src/commands/serve.ts b/packages/kernel-cli/src/commands/serve.ts
similarity index 100%
rename from packages/cli/src/commands/serve.ts
rename to packages/kernel-cli/src/commands/serve.ts
diff --git a/packages/cli/src/commands/watch.test.ts b/packages/kernel-cli/src/commands/watch.test.ts
similarity index 100%
rename from packages/cli/src/commands/watch.test.ts
rename to packages/kernel-cli/src/commands/watch.test.ts
diff --git a/packages/cli/src/commands/watch.ts b/packages/kernel-cli/src/commands/watch.ts
similarity index 100%
rename from packages/cli/src/commands/watch.ts
rename to packages/kernel-cli/src/commands/watch.ts
diff --git a/packages/cli/src/config.ts b/packages/kernel-cli/src/config.ts
similarity index 100%
rename from packages/cli/src/config.ts
rename to packages/kernel-cli/src/config.ts
diff --git a/packages/cli/src/file.test.ts b/packages/kernel-cli/src/file.test.ts
similarity index 100%
rename from packages/cli/src/file.test.ts
rename to packages/kernel-cli/src/file.test.ts
diff --git a/packages/cli/src/file.ts b/packages/kernel-cli/src/file.ts
similarity index 100%
rename from packages/cli/src/file.ts
rename to packages/kernel-cli/src/file.ts
diff --git a/packages/cli/src/path.ts b/packages/kernel-cli/src/path.ts
similarity index 100%
rename from packages/cli/src/path.ts
rename to packages/kernel-cli/src/path.ts
diff --git a/packages/cli/src/utils.test.ts b/packages/kernel-cli/src/utils.test.ts
similarity index 100%
rename from packages/cli/src/utils.test.ts
rename to packages/kernel-cli/src/utils.test.ts
diff --git a/packages/cli/src/utils.ts b/packages/kernel-cli/src/utils.ts
similarity index 100%
rename from packages/cli/src/utils.ts
rename to packages/kernel-cli/src/utils.ts
diff --git a/packages/cli/test/bundles.ts b/packages/kernel-cli/test/bundles.ts
similarity index 100%
rename from packages/cli/test/bundles.ts
rename to packages/kernel-cli/test/bundles.ts
diff --git a/packages/cli/test/bundles/sample-vat-esp.js b/packages/kernel-cli/test/bundles/sample-vat-esp.js
similarity index 100%
rename from packages/cli/test/bundles/sample-vat-esp.js
rename to packages/kernel-cli/test/bundles/sample-vat-esp.js
diff --git a/packages/cli/test/bundles/sample-vat.js b/packages/kernel-cli/test/bundles/sample-vat.js
similarity index 100%
rename from packages/cli/test/bundles/sample-vat.js
rename to packages/kernel-cli/test/bundles/sample-vat.js
diff --git a/packages/cli/test/integration/serve.test.ts b/packages/kernel-cli/test/integration/serve.test.ts
similarity index 100%
rename from packages/cli/test/integration/serve.test.ts
rename to packages/kernel-cli/test/integration/serve.test.ts
diff --git a/packages/cli/test/test.bundle b/packages/kernel-cli/test/test.bundle
similarity index 100%
rename from packages/cli/test/test.bundle
rename to packages/kernel-cli/test/test.bundle
diff --git a/packages/cli/tsconfig.build.json b/packages/kernel-cli/tsconfig.build.json
similarity index 100%
rename from packages/cli/tsconfig.build.json
rename to packages/kernel-cli/tsconfig.build.json
diff --git a/packages/cli/tsconfig.json b/packages/kernel-cli/tsconfig.json
similarity index 100%
rename from packages/cli/tsconfig.json
rename to packages/kernel-cli/tsconfig.json
diff --git a/packages/cli/typedoc.json b/packages/kernel-cli/typedoc.json
similarity index 100%
rename from packages/cli/typedoc.json
rename to packages/kernel-cli/typedoc.json
diff --git a/packages/cli/vitest.config.ts b/packages/kernel-cli/vitest.config.ts
similarity index 100%
rename from packages/cli/vitest.config.ts
rename to packages/kernel-cli/vitest.config.ts
diff --git a/packages/cli/vitest.integration.config.ts b/packages/kernel-cli/vitest.integration.config.ts
similarity index 100%
rename from packages/cli/vitest.integration.config.ts
rename to packages/kernel-cli/vitest.integration.config.ts
diff --git a/packages/nodejs/CHANGELOG.md b/packages/kernel-node-runtime/CHANGELOG.md
similarity index 64%
rename from packages/nodejs/CHANGELOG.md
rename to packages/kernel-node-runtime/CHANGELOG.md
index 0c82cb1ed..c5feaa0c8 100644
--- a/packages/nodejs/CHANGELOG.md
+++ b/packages/kernel-node-runtime/CHANGELOG.md
@@ -7,4 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Changed
+
+- **BREAKING:** Rename package from `@ocap/nodejs` to `@metamask/kernel-node-runtime` and make it public ([#875](https://github.com/MetaMask/ocap-kernel/pull/875))
+
[Unreleased]: https://github.com/MetaMask/ocap-kernel/
diff --git a/packages/kernel-node-runtime/LICENSE.APACHE2 b/packages/kernel-node-runtime/LICENSE.APACHE2
new file mode 100644
index 000000000..8194a06ae
--- /dev/null
+++ b/packages/kernel-node-runtime/LICENSE.APACHE2
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2025 Consensys Software Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/kernel-node-runtime/LICENSE.MIT b/packages/kernel-node-runtime/LICENSE.MIT
new file mode 100644
index 000000000..658c855eb
--- /dev/null
+++ b/packages/kernel-node-runtime/LICENSE.MIT
@@ -0,0 +1,20 @@
+MIT License
+
+Copyright (c) 2025 Consensys Software Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
diff --git a/packages/kernel-node-runtime/README.md b/packages/kernel-node-runtime/README.md
new file mode 100644
index 000000000..e10f8f0e6
--- /dev/null
+++ b/packages/kernel-node-runtime/README.md
@@ -0,0 +1,15 @@
+# `@metamask/kernel-node-runtime`
+
+For running Ocap Kernel experiments in a Node.js environment.
+
+## Installation
+
+`yarn add @metamask/kernel-node-runtime`
+
+or
+
+`npm install @metamask/kernel-node-runtime`
+
+## Contributing
+
+This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/ocap-kernel#readme).
diff --git a/packages/nodejs/package.json b/packages/kernel-node-runtime/package.json
similarity index 88%
rename from packages/nodejs/package.json
rename to packages/kernel-node-runtime/package.json
index 681b3b046..b800a1961 100644
--- a/packages/nodejs/package.json
+++ b/packages/kernel-node-runtime/package.json
@@ -1,9 +1,13 @@
{
- "name": "@ocap/nodejs",
+ "name": "@metamask/kernel-node-runtime",
"version": "0.0.0",
- "private": true,
"description": "For running Ocap Kernel experiments in a Node.js environment",
- "homepage": "https://github.com/MetaMask/ocap-kernel/tree/main/packages/nodejs#readme",
+ "keywords": [
+ "MetaMask",
+ "object capabilities",
+ "ocap"
+ ],
+ "homepage": "https://github.com/MetaMask/ocap-kernel/tree/main/packages/kernel-node-runtime#readme",
"bugs": {
"url": "https://github.com/MetaMask/ocap-kernel/issues"
},
@@ -11,6 +15,8 @@
"type": "git",
"url": "https://github.com/MetaMask/ocap-kernel.git"
},
+ "license": "(MIT OR Apache-2.0)",
+ "sideEffects": false,
"type": "module",
"exports": {
".": {
@@ -35,13 +41,17 @@
},
"./package.json": "./package.json"
},
+ "main": "./dist/index.cjs",
+ "module": "./dist/index.mjs",
+ "types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --no-references --clean",
"build:docs": "typedoc",
- "changelog:validate": "../../scripts/validate-changelog.sh @ocap/nodejs",
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/kernel-node-runtime",
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/kernel-node-runtime",
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo ./logs",
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
"lint:dependencies": "depcheck --quiet",
@@ -111,5 +121,9 @@
},
"engines": {
"node": ">=22"
+ },
+ "publishConfig": {
+ "access": "public",
+ "registry": "https://registry.npmjs.org/"
}
}
diff --git a/packages/nodejs/scripts/test-e2e-ci.sh b/packages/kernel-node-runtime/scripts/test-e2e-ci.sh
similarity index 100%
rename from packages/nodejs/scripts/test-e2e-ci.sh
rename to packages/kernel-node-runtime/scripts/test-e2e-ci.sh
diff --git a/packages/nodejs/src/daemon/delete-daemon-state.ts b/packages/kernel-node-runtime/src/daemon/delete-daemon-state.ts
similarity index 100%
rename from packages/nodejs/src/daemon/delete-daemon-state.ts
rename to packages/kernel-node-runtime/src/daemon/delete-daemon-state.ts
diff --git a/packages/nodejs/src/daemon/index.ts b/packages/kernel-node-runtime/src/daemon/index.ts
similarity index 100%
rename from packages/nodejs/src/daemon/index.ts
rename to packages/kernel-node-runtime/src/daemon/index.ts
diff --git a/packages/nodejs/src/daemon/rpc-socket-server.ts b/packages/kernel-node-runtime/src/daemon/rpc-socket-server.ts
similarity index 100%
rename from packages/nodejs/src/daemon/rpc-socket-server.ts
rename to packages/kernel-node-runtime/src/daemon/rpc-socket-server.ts
diff --git a/packages/nodejs/src/daemon/socket-line.test.ts b/packages/kernel-node-runtime/src/daemon/socket-line.test.ts
similarity index 100%
rename from packages/nodejs/src/daemon/socket-line.test.ts
rename to packages/kernel-node-runtime/src/daemon/socket-line.test.ts
diff --git a/packages/nodejs/src/daemon/socket-line.ts b/packages/kernel-node-runtime/src/daemon/socket-line.ts
similarity index 100%
rename from packages/nodejs/src/daemon/socket-line.ts
rename to packages/kernel-node-runtime/src/daemon/socket-line.ts
diff --git a/packages/nodejs/src/daemon/start-daemon.test.ts b/packages/kernel-node-runtime/src/daemon/start-daemon.test.ts
similarity index 100%
rename from packages/nodejs/src/daemon/start-daemon.test.ts
rename to packages/kernel-node-runtime/src/daemon/start-daemon.test.ts
diff --git a/packages/nodejs/src/daemon/start-daemon.ts b/packages/kernel-node-runtime/src/daemon/start-daemon.ts
similarity index 100%
rename from packages/nodejs/src/daemon/start-daemon.ts
rename to packages/kernel-node-runtime/src/daemon/start-daemon.ts
diff --git a/packages/nodejs/src/index.ts b/packages/kernel-node-runtime/src/index.ts
similarity index 100%
rename from packages/nodejs/src/index.ts
rename to packages/kernel-node-runtime/src/index.ts
diff --git a/packages/nodejs/src/io/index.ts b/packages/kernel-node-runtime/src/io/index.ts
similarity index 100%
rename from packages/nodejs/src/io/index.ts
rename to packages/kernel-node-runtime/src/io/index.ts
diff --git a/packages/nodejs/src/io/socket-channel.test.ts b/packages/kernel-node-runtime/src/io/socket-channel.test.ts
similarity index 100%
rename from packages/nodejs/src/io/socket-channel.test.ts
rename to packages/kernel-node-runtime/src/io/socket-channel.test.ts
diff --git a/packages/nodejs/src/io/socket-channel.ts b/packages/kernel-node-runtime/src/io/socket-channel.ts
similarity index 100%
rename from packages/nodejs/src/io/socket-channel.ts
rename to packages/kernel-node-runtime/src/io/socket-channel.ts
diff --git a/packages/nodejs/src/kernel/PlatformServices.test.ts b/packages/kernel-node-runtime/src/kernel/PlatformServices.test.ts
similarity index 100%
rename from packages/nodejs/src/kernel/PlatformServices.test.ts
rename to packages/kernel-node-runtime/src/kernel/PlatformServices.test.ts
diff --git a/packages/nodejs/src/kernel/PlatformServices.ts b/packages/kernel-node-runtime/src/kernel/PlatformServices.ts
similarity index 100%
rename from packages/nodejs/src/kernel/PlatformServices.ts
rename to packages/kernel-node-runtime/src/kernel/PlatformServices.ts
diff --git a/packages/nodejs/src/kernel/make-kernel.test.ts b/packages/kernel-node-runtime/src/kernel/make-kernel.test.ts
similarity index 100%
rename from packages/nodejs/src/kernel/make-kernel.test.ts
rename to packages/kernel-node-runtime/src/kernel/make-kernel.test.ts
diff --git a/packages/nodejs/src/kernel/make-kernel.ts b/packages/kernel-node-runtime/src/kernel/make-kernel.ts
similarity index 100%
rename from packages/nodejs/src/kernel/make-kernel.ts
rename to packages/kernel-node-runtime/src/kernel/make-kernel.ts
diff --git a/packages/nodejs/src/vat/fetch-blob.test.ts b/packages/kernel-node-runtime/src/vat/fetch-blob.test.ts
similarity index 100%
rename from packages/nodejs/src/vat/fetch-blob.test.ts
rename to packages/kernel-node-runtime/src/vat/fetch-blob.test.ts
diff --git a/packages/nodejs/src/vat/fetch-blob.ts b/packages/kernel-node-runtime/src/vat/fetch-blob.ts
similarity index 100%
rename from packages/nodejs/src/vat/fetch-blob.ts
rename to packages/kernel-node-runtime/src/vat/fetch-blob.ts
diff --git a/packages/nodejs/src/vat/make-supervisor.test.ts b/packages/kernel-node-runtime/src/vat/make-supervisor.test.ts
similarity index 100%
rename from packages/nodejs/src/vat/make-supervisor.test.ts
rename to packages/kernel-node-runtime/src/vat/make-supervisor.test.ts
diff --git a/packages/nodejs/src/vat/make-supervisor.ts b/packages/kernel-node-runtime/src/vat/make-supervisor.ts
similarity index 100%
rename from packages/nodejs/src/vat/make-supervisor.ts
rename to packages/kernel-node-runtime/src/vat/make-supervisor.ts
diff --git a/packages/nodejs/src/vat/streams.test.ts b/packages/kernel-node-runtime/src/vat/streams.test.ts
similarity index 100%
rename from packages/nodejs/src/vat/streams.test.ts
rename to packages/kernel-node-runtime/src/vat/streams.test.ts
diff --git a/packages/nodejs/src/vat/streams.ts b/packages/kernel-node-runtime/src/vat/streams.ts
similarity index 100%
rename from packages/nodejs/src/vat/streams.ts
rename to packages/kernel-node-runtime/src/vat/streams.ts
diff --git a/packages/nodejs/src/vat/vat-worker.test.ts b/packages/kernel-node-runtime/src/vat/vat-worker.test.ts
similarity index 100%
rename from packages/nodejs/src/vat/vat-worker.test.ts
rename to packages/kernel-node-runtime/src/vat/vat-worker.test.ts
diff --git a/packages/nodejs/src/vat/vat-worker.ts b/packages/kernel-node-runtime/src/vat/vat-worker.ts
similarity index 100%
rename from packages/nodejs/src/vat/vat-worker.ts
rename to packages/kernel-node-runtime/src/vat/vat-worker.ts
diff --git a/packages/nodejs/test/e2e/PlatformServices.test.ts b/packages/kernel-node-runtime/test/e2e/PlatformServices.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/PlatformServices.test.ts
rename to packages/kernel-node-runtime/test/e2e/PlatformServices.test.ts
diff --git a/packages/nodejs/test/e2e/bip39-identity-recovery.test.ts b/packages/kernel-node-runtime/test/e2e/bip39-identity-recovery.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/bip39-identity-recovery.test.ts
rename to packages/kernel-node-runtime/test/e2e/bip39-identity-recovery.test.ts
diff --git a/packages/nodejs/test/e2e/captp-service.test.ts b/packages/kernel-node-runtime/test/e2e/captp-service.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/captp-service.test.ts
rename to packages/kernel-node-runtime/test/e2e/captp-service.test.ts
diff --git a/packages/nodejs/test/e2e/daemon-stack.test.ts b/packages/kernel-node-runtime/test/e2e/daemon-stack.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/daemon-stack.test.ts
rename to packages/kernel-node-runtime/test/e2e/daemon-stack.test.ts
diff --git a/packages/nodejs/test/e2e/kernel-worker.test.ts b/packages/kernel-node-runtime/test/e2e/kernel-worker.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/kernel-worker.test.ts
rename to packages/kernel-node-runtime/test/e2e/kernel-worker.test.ts
diff --git a/packages/nodejs/test/e2e/quic-transport.test.ts b/packages/kernel-node-runtime/test/e2e/quic-transport.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/quic-transport.test.ts
rename to packages/kernel-node-runtime/test/e2e/quic-transport.test.ts
diff --git a/packages/nodejs/test/e2e/remote-comms.test.ts b/packages/kernel-node-runtime/test/e2e/remote-comms.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/remote-comms.test.ts
rename to packages/kernel-node-runtime/test/e2e/remote-comms.test.ts
diff --git a/packages/nodejs/test/e2e/system-subcluster.test.ts b/packages/kernel-node-runtime/test/e2e/system-subcluster.test.ts
similarity index 100%
rename from packages/nodejs/test/e2e/system-subcluster.test.ts
rename to packages/kernel-node-runtime/test/e2e/system-subcluster.test.ts
diff --git a/packages/nodejs/test/get-test-worker.ts b/packages/kernel-node-runtime/test/get-test-worker.ts
similarity index 100%
rename from packages/nodejs/test/get-test-worker.ts
rename to packages/kernel-node-runtime/test/get-test-worker.ts
diff --git a/packages/nodejs/test/helpers/kernel.ts b/packages/kernel-node-runtime/test/helpers/kernel.ts
similarity index 100%
rename from packages/nodejs/test/helpers/kernel.ts
rename to packages/kernel-node-runtime/test/helpers/kernel.ts
diff --git a/packages/nodejs/test/helpers/remote-comms.ts b/packages/kernel-node-runtime/test/helpers/remote-comms.ts
similarity index 100%
rename from packages/nodejs/test/helpers/remote-comms.ts
rename to packages/kernel-node-runtime/test/helpers/remote-comms.ts
diff --git a/packages/nodejs/test/vats/captp-service-vat.ts b/packages/kernel-node-runtime/test/vats/captp-service-vat.ts
similarity index 100%
rename from packages/nodejs/test/vats/captp-service-vat.ts
rename to packages/kernel-node-runtime/test/vats/captp-service-vat.ts
diff --git a/packages/nodejs/test/vats/monotonous-vat.js b/packages/kernel-node-runtime/test/vats/monotonous-vat.js
similarity index 100%
rename from packages/nodejs/test/vats/monotonous-vat.js
rename to packages/kernel-node-runtime/test/vats/monotonous-vat.js
diff --git a/packages/nodejs/test/vats/remote-vat.js b/packages/kernel-node-runtime/test/vats/remote-vat.js
similarity index 100%
rename from packages/nodejs/test/vats/remote-vat.js
rename to packages/kernel-node-runtime/test/vats/remote-vat.js
diff --git a/packages/nodejs/test/vats/sample-vat.js b/packages/kernel-node-runtime/test/vats/sample-vat.js
similarity index 100%
rename from packages/nodejs/test/vats/sample-vat.js
rename to packages/kernel-node-runtime/test/vats/sample-vat.js
diff --git a/packages/nodejs/test/vats/stepper-upper-vat.js b/packages/kernel-node-runtime/test/vats/stepper-upper-vat.js
similarity index 100%
rename from packages/nodejs/test/vats/stepper-upper-vat.js
rename to packages/kernel-node-runtime/test/vats/stepper-upper-vat.js
diff --git a/packages/nodejs/test/vats/system-vat.ts b/packages/kernel-node-runtime/test/vats/system-vat.ts
similarity index 100%
rename from packages/nodejs/test/vats/system-vat.ts
rename to packages/kernel-node-runtime/test/vats/system-vat.ts
diff --git a/packages/nodejs/test/workers/captp-service-client.js b/packages/kernel-node-runtime/test/workers/captp-service-client.js
similarity index 100%
rename from packages/nodejs/test/workers/captp-service-client.js
rename to packages/kernel-node-runtime/test/workers/captp-service-client.js
diff --git a/packages/nodejs/test/workers/hello-world.js b/packages/kernel-node-runtime/test/workers/hello-world.js
similarity index 100%
rename from packages/nodejs/test/workers/hello-world.js
rename to packages/kernel-node-runtime/test/workers/hello-world.js
diff --git a/packages/nodejs/test/workers/stream-sync.js b/packages/kernel-node-runtime/test/workers/stream-sync.js
similarity index 100%
rename from packages/nodejs/test/workers/stream-sync.js
rename to packages/kernel-node-runtime/test/workers/stream-sync.js
diff --git a/packages/nodejs/tsconfig.build.json b/packages/kernel-node-runtime/tsconfig.build.json
similarity index 100%
rename from packages/nodejs/tsconfig.build.json
rename to packages/kernel-node-runtime/tsconfig.build.json
diff --git a/packages/nodejs/tsconfig.json b/packages/kernel-node-runtime/tsconfig.json
similarity index 100%
rename from packages/nodejs/tsconfig.json
rename to packages/kernel-node-runtime/tsconfig.json
diff --git a/packages/nodejs/typedoc.json b/packages/kernel-node-runtime/typedoc.json
similarity index 100%
rename from packages/nodejs/typedoc.json
rename to packages/kernel-node-runtime/typedoc.json
diff --git a/packages/nodejs/vitest.config.e2e.ts b/packages/kernel-node-runtime/vitest.config.e2e.ts
similarity index 100%
rename from packages/nodejs/vitest.config.e2e.ts
rename to packages/kernel-node-runtime/vitest.config.e2e.ts
diff --git a/packages/nodejs/vitest.config.ts b/packages/kernel-node-runtime/vitest.config.ts
similarity index 100%
rename from packages/nodejs/vitest.config.ts
rename to packages/kernel-node-runtime/vitest.config.ts
diff --git a/packages/kernel-test/package.json b/packages/kernel-test/package.json
index 2cb1cdea7..9d9ebc133 100644
--- a/packages/kernel-test/package.json
+++ b/packages/kernel-test/package.json
@@ -54,12 +54,12 @@
"@endo/promise-kit": "^1.1.13",
"@libp2p/crypto": "5.1.8",
"@libp2p/peer-id": "5.1.9",
+ "@metamask/kernel-node-runtime": "workspace:^",
"@metamask/kernel-store": "workspace:^",
"@metamask/kernel-utils": "workspace:^",
"@metamask/logger": "workspace:^",
"@metamask/ocap-kernel": "workspace:^",
"@ocap/kernel-language-model-service": "workspace:^",
- "@ocap/nodejs": "workspace:^",
"@ocap/nodejs-test-workers": "workspace:^",
"@ocap/remote-iterables": "workspace:^"
},
@@ -68,8 +68,8 @@
"@metamask/eslint-config": "^15.0.0",
"@metamask/eslint-config-nodejs": "^15.0.0",
"@metamask/eslint-config-typescript": "^15.0.0",
+ "@metamask/kernel-cli": "workspace:^",
"@metamask/kernel-shims": "workspace:^",
- "@ocap/cli": "workspace:^",
"@ocap/repo-tools": "workspace:^",
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
diff --git a/packages/kernel-test/src/io.test.ts b/packages/kernel-test/src/io.test.ts
index d9f9407ea..62ccc7f5a 100644
--- a/packages/kernel-test/src/io.test.ts
+++ b/packages/kernel-test/src/io.test.ts
@@ -191,7 +191,9 @@ describe('IO kernel service', () => {
});
const { logger } = makeTestLogger();
- const { NodejsPlatformServices } = await import('@ocap/nodejs');
+ const { NodejsPlatformServices } = await import(
+ '@metamask/kernel-node-runtime'
+ );
const kernel = await Kernel.make(
new NodejsPlatformServices({
logger: logger.subLogger({ tags: ['platform'] }),
diff --git a/packages/kernel-test/src/remote-comms.test.ts b/packages/kernel-test/src/remote-comms.test.ts
index 66c1c5f2a..00b69bfaa 100644
--- a/packages/kernel-test/src/remote-comms.test.ts
+++ b/packages/kernel-test/src/remote-comms.test.ts
@@ -1,5 +1,6 @@
import { generateKeyPairFromSeed } from '@libp2p/crypto/keys';
import { peerIdFromPrivateKey } from '@libp2p/peer-id';
+import { NodejsPlatformServices } from '@metamask/kernel-node-runtime';
import type { KernelDatabase } from '@metamask/kernel-store';
import { makeSQLKernelDatabase } from '@metamask/kernel-store/sqlite/nodejs';
import { fromHex } from '@metamask/kernel-utils';
@@ -12,7 +13,6 @@ import type {
RemoteMessageHandler,
RemoteCommsOptions,
} from '@metamask/ocap-kernel';
-import { NodejsPlatformServices } from '@ocap/nodejs';
import { mkdtemp, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
diff --git a/packages/kernel-test/src/utils.ts b/packages/kernel-test/src/utils.ts
index 76a558d7d..c255347b8 100644
--- a/packages/kernel-test/src/utils.ts
+++ b/packages/kernel-test/src/utils.ts
@@ -1,6 +1,7 @@
// eslint-disable-next-line spaced-comment
///
+import { NodejsPlatformServices } from '@metamask/kernel-node-runtime';
import type { KernelDatabase } from '@metamask/kernel-store';
import { stringify, waitUntilQuiescent } from '@metamask/kernel-utils';
import {
@@ -11,7 +12,6 @@ import {
import type { LogEntry } from '@metamask/logger';
import { Kernel, kunser } from '@metamask/ocap-kernel';
import type { ClusterConfig, PlatformServices } from '@metamask/ocap-kernel';
-import { NodejsPlatformServices } from '@ocap/nodejs';
import { vi } from 'vitest';
/**
diff --git a/packages/kernel-test/tsconfig.json b/packages/kernel-test/tsconfig.json
index bc2bca875..ae412ba35 100644
--- a/packages/kernel-test/tsconfig.json
+++ b/packages/kernel-test/tsconfig.json
@@ -11,7 +11,7 @@
{ "path": "../kernel-agents" },
{ "path": "../kernel-store" },
{ "path": "../kernel-utils" },
- { "path": "../nodejs" },
+ { "path": "../kernel-node-runtime" },
{ "path": "../nodejs-test-workers" },
{ "path": "../ocap-kernel" },
{ "path": "../remote-iterables" },
diff --git a/packages/kernel-utils/CHANGELOG.md b/packages/kernel-utils/CHANGELOG.md
index 5d5bf53ce..96ef032e2 100644
--- a/packages/kernel-utils/CHANGELOG.md
+++ b/packages/kernel-utils/CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+
+- Add `./vite-plugins` export with `bundleVat` and `bundleVats` vat bundling utilities (moved from `@ocap/repo-tools`) ([#875](https://github.com/MetaMask/ocap-kernel/pull/875))
+- Add `vite` as an optional peer dependency for the `./vite-plugins` subpath ([#875](https://github.com/MetaMask/ocap-kernel/pull/875))
+
## [0.4.0]
### Added
diff --git a/packages/kernel-utils/package.json b/packages/kernel-utils/package.json
index 0199a158b..1e13e4e04 100644
--- a/packages/kernel-utils/package.json
+++ b/packages/kernel-utils/package.json
@@ -59,6 +59,16 @@
"default": "./dist/libp2p-relay.cjs"
}
},
+ "./vite-plugins": {
+ "import": {
+ "types": "./dist/vite-plugins/index.d.mts",
+ "default": "./dist/vite-plugins/index.mjs"
+ },
+ "require": {
+ "types": "./dist/vite-plugins/index.d.cts",
+ "default": "./dist/vite-plugins/index.cjs"
+ }
+ },
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
@@ -139,9 +149,20 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
- "vite": "^7.3.0",
"vitest": "^4.0.16"
},
+ "peerDependencies": {
+ "acorn": "^8.15.0",
+ "vite": "^7.3.0"
+ },
+ "peerDependenciesMeta": {
+ "acorn": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ },
"engines": {
"node": ">=22"
},
diff --git a/packages/repo-tools/src/vite-plugins/bundle-vats/bundle-vat.ts b/packages/kernel-utils/src/vite-plugins/bundle-vat.ts
similarity index 84%
rename from packages/repo-tools/src/vite-plugins/bundle-vats/bundle-vat.ts
rename to packages/kernel-utils/src/vite-plugins/bundle-vat.ts
index c10bfc4b5..814e50dea 100644
--- a/packages/repo-tools/src/vite-plugins/bundle-vats/bundle-vat.ts
+++ b/packages/kernel-utils/src/vite-plugins/bundle-vat.ts
@@ -1,21 +1,11 @@
import { build } from 'vite';
import type { Rollup } from 'vite';
+import type { VatBundle } from '../vat-bundle.ts';
import { exportMetadataPlugin } from './export-metadata-plugin.ts';
import { stripCommentsPlugin } from './strip-comments-plugin.ts';
-/**
- * A bundle produced by the vat bundler.
- *
- * Contains the bundled code as an IIFE that assigns exports to `__vatExports__`,
- * along with metadata about the bundle's exports and external dependencies.
- */
-export type VatBundle = {
- moduleFormat: 'iife';
- code: string;
- exports: string[];
- external: string[];
-};
+export type { VatBundle } from '../vat-bundle.ts';
/**
* Bundle a vat source file using vite.
diff --git a/packages/repo-tools/src/vite-plugins/bundle-vats/export-metadata-plugin.ts b/packages/kernel-utils/src/vite-plugins/export-metadata-plugin.ts
similarity index 100%
rename from packages/repo-tools/src/vite-plugins/bundle-vats/export-metadata-plugin.ts
rename to packages/kernel-utils/src/vite-plugins/export-metadata-plugin.ts
diff --git a/packages/repo-tools/src/vite-plugins/bundle-vats/index.test.ts b/packages/kernel-utils/src/vite-plugins/index.test.ts
similarity index 100%
rename from packages/repo-tools/src/vite-plugins/bundle-vats/index.test.ts
rename to packages/kernel-utils/src/vite-plugins/index.test.ts
diff --git a/packages/repo-tools/src/vite-plugins/bundle-vats/index.ts b/packages/kernel-utils/src/vite-plugins/index.ts
similarity index 100%
rename from packages/repo-tools/src/vite-plugins/bundle-vats/index.ts
rename to packages/kernel-utils/src/vite-plugins/index.ts
diff --git a/packages/repo-tools/src/vite-plugins/bundle-vats/strip-comments-plugin.test.ts b/packages/kernel-utils/src/vite-plugins/strip-comments-plugin.test.ts
similarity index 100%
rename from packages/repo-tools/src/vite-plugins/bundle-vats/strip-comments-plugin.test.ts
rename to packages/kernel-utils/src/vite-plugins/strip-comments-plugin.test.ts
diff --git a/packages/repo-tools/src/vite-plugins/bundle-vats/strip-comments-plugin.ts b/packages/kernel-utils/src/vite-plugins/strip-comments-plugin.ts
similarity index 100%
rename from packages/repo-tools/src/vite-plugins/bundle-vats/strip-comments-plugin.ts
rename to packages/kernel-utils/src/vite-plugins/strip-comments-plugin.ts
diff --git a/packages/nodejs-test-workers/package.json b/packages/nodejs-test-workers/package.json
index 2492b7d26..dca097108 100644
--- a/packages/nodejs-test-workers/package.json
+++ b/packages/nodejs-test-workers/package.json
@@ -81,9 +81,9 @@
"node": ">=22"
},
"dependencies": {
+ "@metamask/kernel-node-runtime": "workspace:^",
"@metamask/kernel-shims": "workspace:^",
"@metamask/logger": "workspace:^",
- "@metamask/ocap-kernel": "workspace:^",
- "@ocap/nodejs": "workspace:^"
+ "@metamask/ocap-kernel": "workspace:^"
}
}
diff --git a/packages/nodejs-test-workers/src/workers/mock-fetch.ts b/packages/nodejs-test-workers/src/workers/mock-fetch.ts
index 9b624a0a6..7918ee2b7 100644
--- a/packages/nodejs-test-workers/src/workers/mock-fetch.ts
+++ b/packages/nodejs-test-workers/src/workers/mock-fetch.ts
@@ -1,7 +1,7 @@
import '@metamask/kernel-shims/endoify-node';
+import { makeNodeJsVatSupervisor } from '@metamask/kernel-node-runtime';
import { Logger } from '@metamask/logger';
import type { VatId } from '@metamask/ocap-kernel';
-import { makeNodeJsVatSupervisor } from '@ocap/nodejs';
const LOG_TAG = 'nodejs-test-vat-worker';
diff --git a/packages/nodejs-test-workers/tsconfig.build.json b/packages/nodejs-test-workers/tsconfig.build.json
index 996d35bbf..7d382158e 100644
--- a/packages/nodejs-test-workers/tsconfig.build.json
+++ b/packages/nodejs-test-workers/tsconfig.build.json
@@ -9,7 +9,7 @@
},
"references": [
{ "path": "../logger/tsconfig.build.json" },
- { "path": "../nodejs/tsconfig.build.json" },
+ { "path": "../kernel-node-runtime/tsconfig.build.json" },
{ "path": "../ocap-kernel/tsconfig.build.json" }
],
"files": [],
diff --git a/packages/nodejs-test-workers/tsconfig.json b/packages/nodejs-test-workers/tsconfig.json
index b01d41d9b..a23455df9 100644
--- a/packages/nodejs-test-workers/tsconfig.json
+++ b/packages/nodejs-test-workers/tsconfig.json
@@ -7,7 +7,7 @@
},
"references": [
{ "path": "../repo-tools" },
- { "path": "../nodejs" },
+ { "path": "../kernel-node-runtime" },
{ "path": "../ocap-kernel" },
{ "path": "../logger" }
],
diff --git a/packages/nodejs/README.md b/packages/nodejs/README.md
deleted file mode 100644
index abcef732d..000000000
--- a/packages/nodejs/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# `@ocap/nodejs`
-
-For running Ocap Kernel experiments in a Node.js environment
-
-## Installation
-
-`yarn add @ocap/nodejs`
-
-or
-
-`npm install @ocap/nodejs`
-
-## Contributing
-
-This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/ocap-kernel#readme).
-
-## End-to-End Tests
-
-Navigate to package root.
-
-```sh
-cd ~/path/to/ocap-kernel/packages/nodejs
-```
-
-If it's not already running, start the `@ocap/cli` in `kernel-test/src/vats/default`.
-
-```sh
-yarn run -T ocap start ../kernel-test/src/vats/default
-```
-
-Then, run the end to end tests.
-
-```sh
-yarn test:e2e
-```
diff --git a/packages/omnium-gatherum/vite.config.ts b/packages/omnium-gatherum/vite.config.ts
index 61d32372e..8106c1f29 100644
--- a/packages/omnium-gatherum/vite.config.ts
+++ b/packages/omnium-gatherum/vite.config.ts
@@ -1,12 +1,12 @@
// eslint-disable-next-line spaced-comment
///
+import { bundleVats } from '@metamask/kernel-utils/vite-plugins';
import {
getDefines,
getPackageDevAliases,
} from '@ocap/repo-tools/build-utils/vite';
import {
- bundleVats,
deduplicateAssets,
extensionDev,
htmlTrustedPrelude,
diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json
index c5bae564a..f473f2960 100644
--- a/packages/repo-tools/package.json
+++ b/packages/repo-tools/package.json
@@ -53,7 +53,6 @@
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.6.5",
"@vitest/runner": "4.0.16",
- "acorn": "^8.15.0",
"cheerio": "^1.0.0",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
diff --git a/packages/repo-tools/src/vite-plugins/index.test.ts b/packages/repo-tools/src/vite-plugins/index.test.ts
index cc609b542..589efc63d 100644
--- a/packages/repo-tools/src/vite-plugins/index.test.ts
+++ b/packages/repo-tools/src/vite-plugins/index.test.ts
@@ -6,8 +6,6 @@ describe('index', () => {
it('has the expected exports', () => {
// VatBundle is a type-only export, not visible at runtime
expect(Object.keys(indexModule).sort()).toStrictEqual([
- 'bundleVat',
- 'bundleVats',
'deduplicateAssets',
'extensionDev',
'htmlTrustedPrelude',
diff --git a/packages/repo-tools/src/vite-plugins/index.ts b/packages/repo-tools/src/vite-plugins/index.ts
index e26af73f1..0c409d2a0 100644
--- a/packages/repo-tools/src/vite-plugins/index.ts
+++ b/packages/repo-tools/src/vite-plugins/index.ts
@@ -1,5 +1,3 @@
-export { bundleVat, bundleVats } from './bundle-vats/index.ts';
-export type { VatBundle } from './bundle-vats/index.ts';
export * from './deduplicate-assets.ts';
export * from './extension-dev.ts';
export * from './html-trusted-prelude.ts';
diff --git a/tsconfig.build.json b/tsconfig.build.json
index ecf57a430..21d2500a1 100644
--- a/tsconfig.build.json
+++ b/tsconfig.build.json
@@ -2,7 +2,7 @@
"files": [],
"include": [],
"references": [
- { "path": "./packages/cli/tsconfig.build.json" },
+ { "path": "./packages/kernel-cli/tsconfig.build.json" },
{ "path": "./packages/kernel-agents/tsconfig.build.json" },
{ "path": "./packages/kernel-browser-runtime/tsconfig.build.json" },
{ "path": "./packages/kernel-errors/tsconfig.build.json" },
@@ -13,7 +13,7 @@
{ "path": "./packages/kernel-utils/tsconfig.build.json" },
{ "path": "./packages/logger/tsconfig.build.json" },
{ "path": "./packages/nodejs-test-workers/tsconfig.build.json" },
- { "path": "./packages/nodejs/tsconfig.build.json" },
+ { "path": "./packages/kernel-node-runtime/tsconfig.build.json" },
{ "path": "./packages/ocap-kernel/tsconfig.build.json" },
{ "path": "./packages/omnium-gatherum/tsconfig.build.json" },
{ "path": "./packages/remote-iterables/tsconfig.build.json" },
diff --git a/tsconfig.json b/tsconfig.json
index c7c624374..e1948ffc1 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -13,7 +13,7 @@
"files": [],
"include": [],
"references": [
- { "path": "./packages/cli" },
+ { "path": "./packages/kernel-cli" },
{ "path": "./packages/create-package" },
{ "path": "./packages/extension" },
{ "path": "./packages/kernel-agents" },
@@ -27,7 +27,7 @@
{ "path": "./packages/kernel-ui" },
{ "path": "./packages/kernel-utils" },
{ "path": "./packages/logger" },
- { "path": "./packages/nodejs" },
+ { "path": "./packages/kernel-node-runtime" },
{ "path": "./packages/nodejs-test-workers" },
{ "path": "./packages/ocap-kernel" },
{ "path": "./packages/omnium-gatherum" },
diff --git a/yarn.config.cjs b/yarn.config.cjs
index 1666ae474..25d6cacb8 100644
--- a/yarn.config.cjs
+++ b/yarn.config.cjs
@@ -23,14 +23,14 @@ const typedocExceptions = [
'omnium-gatherum',
'repo-tools',
];
-// Packages that do not have builds
-const noBuild = ['create-package', 'repo-tools'];
+// Packages that do not enforce the standard build script
+const buildExceptions = ['create-package', 'kernel-cli', 'repo-tools'];
// Packages that do not have tests
const noTests = [];
// Packages that do not export a `package.json` file
-const noPackageJson = ['extension', 'omnium-gatherum'];
+const noPackageJsonExport = ['extension', 'omnium-gatherum'];
// Packages that have weird exports
-const exportsExceptions = ['kernel-shims'];
+const exportsExceptions = ['kernel-cli', 'kernel-shims'];
// Packages that have weird files
const filesExceptions = [
'kernel-browser-runtime',
@@ -185,7 +185,7 @@ module.exports = defineConfig({
}
// All non-root packages must export a `package.json` file except for the ones that are exempted
- if (!noPackageJson.includes(workspaceBasename)) {
+ if (!noPackageJsonExport.includes(workspaceBasename)) {
expectWorkspaceField(
workspace,
'exports["./package.json"]',
@@ -281,7 +281,7 @@ module.exports = defineConfig({
}
}
- if (!noBuild.includes(workspaceBasename)) {
+ if (!buildExceptions.includes(workspaceBasename)) {
const enforceTsBridge = (currentValue) =>
typeof currentValue === 'string' && currentValue.includes('ts-bridge')
? 'ts-bridge --project tsconfig.build.json --no-references --clean'
diff --git a/yarn.lock b/yarn.lock
index d900788bb..ba942628a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2429,6 +2429,60 @@ __metadata:
languageName: unknown
linkType: soft
+"@metamask/kernel-cli@workspace:^, @metamask/kernel-cli@workspace:packages/kernel-cli":
+ version: 0.0.0-use.local
+ resolution: "@metamask/kernel-cli@workspace:packages/kernel-cli"
+ dependencies:
+ "@arethetypeswrong/cli": "npm:^0.17.4"
+ "@endo/promise-kit": "npm:^1.1.13"
+ "@metamask/auto-changelog": "npm:^5.3.0"
+ "@metamask/eslint-config": "npm:^15.0.0"
+ "@metamask/eslint-config-nodejs": "npm:^15.0.0"
+ "@metamask/eslint-config-typescript": "npm:^15.0.0"
+ "@metamask/kernel-node-runtime": "workspace:^"
+ "@metamask/kernel-shims": "workspace:^"
+ "@metamask/kernel-utils": "workspace:^"
+ "@metamask/logger": "workspace:^"
+ "@metamask/utils": "npm:^11.9.0"
+ "@ocap/repo-tools": "workspace:^"
+ "@ts-bridge/cli": "npm:^0.6.3"
+ "@ts-bridge/shims": "npm:^0.1.1"
+ "@types/node": "npm:^22.13.1"
+ "@types/serve-handler": "npm:^6"
+ "@types/yargs": "npm:^17.0.33"
+ "@typescript-eslint/eslint-plugin": "npm:^8.29.0"
+ "@typescript-eslint/parser": "npm:^8.29.0"
+ "@typescript-eslint/utils": "npm:^8.29.0"
+ "@vitest/eslint-plugin": "npm:^1.6.5"
+ acorn: "npm:^8.15.0"
+ chokidar: "npm:^4.0.1"
+ depcheck: "npm:^1.4.7"
+ eslint: "npm:^9.23.0"
+ eslint-config-prettier: "npm:^10.1.1"
+ eslint-import-resolver-typescript: "npm:^4.3.1"
+ eslint-plugin-import-x: "npm:^4.10.0"
+ eslint-plugin-jsdoc: "npm:^50.6.9"
+ eslint-plugin-n: "npm:^17.17.0"
+ eslint-plugin-prettier: "npm:^5.2.6"
+ eslint-plugin-promise: "npm:^7.2.1"
+ glob: "npm:^11.0.0"
+ jsdom: "npm:^27.4.0"
+ prettier: "npm:^3.5.3"
+ rimraf: "npm:^6.0.1"
+ serve-handler: "npm:^6.1.6"
+ ses: "npm:^1.14.0"
+ turbo: "npm:^2.5.6"
+ typedoc: "npm:^0.28.1"
+ typescript: "npm:~5.8.2"
+ typescript-eslint: "npm:^8.29.0"
+ vite: "npm:^7.3.0"
+ vitest: "npm:^4.0.16"
+ yargs: "npm:^17.7.2"
+ bin:
+ ocap: ./dist/app.mjs
+ languageName: unknown
+ linkType: soft
+
"@metamask/kernel-errors@workspace:^, @metamask/kernel-errors@workspace:packages/kernel-errors":
version: 0.0.0-use.local
resolution: "@metamask/kernel-errors@workspace:packages/kernel-errors"
@@ -2470,6 +2524,60 @@ __metadata:
languageName: unknown
linkType: soft
+"@metamask/kernel-node-runtime@workspace:^, @metamask/kernel-node-runtime@workspace:packages/kernel-node-runtime":
+ version: 0.0.0-use.local
+ resolution: "@metamask/kernel-node-runtime@workspace:packages/kernel-node-runtime"
+ dependencies:
+ "@arethetypeswrong/cli": "npm:^0.17.4"
+ "@chainsafe/libp2p-quic": "npm:^1.1.8"
+ "@endo/captp": "npm:^4.4.8"
+ "@endo/eventual-send": "npm:^1.3.4"
+ "@endo/promise-kit": "npm:^1.1.13"
+ "@libp2p/interface": "npm:2.11.0"
+ "@libp2p/tcp": "npm:10.1.19"
+ "@libp2p/webrtc": "npm:5.2.24"
+ "@metamask/auto-changelog": "npm:^5.3.0"
+ "@metamask/eslint-config": "npm:^15.0.0"
+ "@metamask/eslint-config-nodejs": "npm:^15.0.0"
+ "@metamask/eslint-config-typescript": "npm:^15.0.0"
+ "@metamask/kernel-platforms": "workspace:^"
+ "@metamask/kernel-rpc-methods": "workspace:^"
+ "@metamask/kernel-shims": "workspace:^"
+ "@metamask/kernel-store": "workspace:^"
+ "@metamask/kernel-utils": "workspace:^"
+ "@metamask/logger": "workspace:^"
+ "@metamask/ocap-kernel": "workspace:^"
+ "@metamask/streams": "workspace:^"
+ "@ocap/repo-tools": "workspace:^"
+ "@ts-bridge/cli": "npm:^0.6.3"
+ "@ts-bridge/shims": "npm:^0.1.1"
+ "@types/node": "npm:^22.13.1"
+ "@typescript-eslint/eslint-plugin": "npm:^8.29.0"
+ "@typescript-eslint/parser": "npm:^8.29.0"
+ "@typescript-eslint/utils": "npm:^8.29.0"
+ "@vitest/eslint-plugin": "npm:^1.6.5"
+ depcheck: "npm:^1.4.7"
+ eslint: "npm:^9.23.0"
+ eslint-config-prettier: "npm:^10.1.1"
+ eslint-import-resolver-typescript: "npm:^4.3.1"
+ eslint-plugin-import-x: "npm:^4.10.0"
+ eslint-plugin-jsdoc: "npm:^50.6.9"
+ eslint-plugin-n: "npm:^17.17.0"
+ eslint-plugin-prettier: "npm:^5.2.6"
+ eslint-plugin-promise: "npm:^7.2.1"
+ node-gyp: "npm:^11.2.0"
+ prettier: "npm:^3.5.3"
+ rimraf: "npm:^6.0.1"
+ ses: "npm:^1.14.0"
+ turbo: "npm:^2.5.6"
+ typedoc: "npm:^0.28.1"
+ typescript: "npm:~5.8.2"
+ typescript-eslint: "npm:^8.29.0"
+ vite: "npm:^7.3.0"
+ vitest: "npm:^4.0.16"
+ languageName: unknown
+ linkType: soft
+
"@metamask/kernel-platforms@workspace:^, @metamask/kernel-platforms@workspace:packages/kernel-platforms":
version: 0.0.0-use.local
resolution: "@metamask/kernel-platforms@workspace:packages/kernel-platforms"
@@ -2747,8 +2855,15 @@ __metadata:
typedoc: "npm:^0.28.1"
typescript: "npm:~5.8.2"
typescript-eslint: "npm:^8.29.0"
- vite: "npm:^7.3.0"
vitest: "npm:^4.0.16"
+ peerDependencies:
+ acorn: ^8.15.0
+ vite: ^7.3.0
+ peerDependenciesMeta:
+ acorn:
+ optional: true
+ vite:
+ optional: true
languageName: unknown
linkType: soft
@@ -3489,59 +3604,6 @@ __metadata:
languageName: unknown
linkType: soft
-"@ocap/cli@workspace:^, @ocap/cli@workspace:packages/cli":
- version: 0.0.0-use.local
- resolution: "@ocap/cli@workspace:packages/cli"
- dependencies:
- "@arethetypeswrong/cli": "npm:^0.17.4"
- "@endo/promise-kit": "npm:^1.1.13"
- "@metamask/auto-changelog": "npm:^5.3.0"
- "@metamask/eslint-config": "npm:^15.0.0"
- "@metamask/eslint-config-nodejs": "npm:^15.0.0"
- "@metamask/eslint-config-typescript": "npm:^15.0.0"
- "@metamask/kernel-shims": "workspace:^"
- "@metamask/kernel-utils": "workspace:^"
- "@metamask/logger": "workspace:^"
- "@metamask/utils": "npm:^11.9.0"
- "@ocap/nodejs": "workspace:^"
- "@ocap/repo-tools": "workspace:^"
- "@ts-bridge/cli": "npm:^0.6.3"
- "@ts-bridge/shims": "npm:^0.1.1"
- "@types/node": "npm:^22.13.1"
- "@types/serve-handler": "npm:^6"
- "@types/yargs": "npm:^17.0.33"
- "@typescript-eslint/eslint-plugin": "npm:^8.29.0"
- "@typescript-eslint/parser": "npm:^8.29.0"
- "@typescript-eslint/utils": "npm:^8.29.0"
- "@vitest/eslint-plugin": "npm:^1.6.5"
- chokidar: "npm:^4.0.1"
- depcheck: "npm:^1.4.7"
- eslint: "npm:^9.23.0"
- eslint-config-prettier: "npm:^10.1.1"
- eslint-import-resolver-typescript: "npm:^4.3.1"
- eslint-plugin-import-x: "npm:^4.10.0"
- eslint-plugin-jsdoc: "npm:^50.6.9"
- eslint-plugin-n: "npm:^17.17.0"
- eslint-plugin-prettier: "npm:^5.2.6"
- eslint-plugin-promise: "npm:^7.2.1"
- glob: "npm:^11.0.0"
- jsdom: "npm:^27.4.0"
- prettier: "npm:^3.5.3"
- rimraf: "npm:^6.0.1"
- serve-handler: "npm:^6.1.6"
- ses: "npm:^1.14.0"
- turbo: "npm:^2.5.6"
- typedoc: "npm:^0.28.1"
- typescript: "npm:~5.8.2"
- typescript-eslint: "npm:^8.29.0"
- vite: "npm:^7.3.0"
- vitest: "npm:^4.0.16"
- yargs: "npm:^17.7.2"
- bin:
- ocap: ./dist/app.mjs
- languageName: unknown
- linkType: soft
-
"@ocap/create-package@workspace:packages/create-package":
version: 0.0.0-use.local
resolution: "@ocap/create-package@workspace:packages/create-package"
@@ -3822,14 +3884,14 @@ __metadata:
"@metamask/eslint-config": "npm:^15.0.0"
"@metamask/eslint-config-nodejs": "npm:^15.0.0"
"@metamask/eslint-config-typescript": "npm:^15.0.0"
+ "@metamask/kernel-cli": "workspace:^"
+ "@metamask/kernel-node-runtime": "workspace:^"
"@metamask/kernel-shims": "workspace:^"
"@metamask/kernel-store": "workspace:^"
"@metamask/kernel-utils": "workspace:^"
"@metamask/logger": "workspace:^"
"@metamask/ocap-kernel": "workspace:^"
- "@ocap/cli": "workspace:^"
"@ocap/kernel-language-model-service": "workspace:^"
- "@ocap/nodejs": "workspace:^"
"@ocap/nodejs-test-workers": "workspace:^"
"@ocap/remote-iterables": "workspace:^"
"@ocap/repo-tools": "workspace:^"
@@ -3871,7 +3933,7 @@ __metadata:
"@metamask/eslint-config-nodejs": "npm:^15.0.0"
"@metamask/eslint-config-typescript": "npm:^15.0.0"
"@metamask/eslint-config-vitest": "npm:^15.0.0"
- "@ocap/cli": "workspace:^"
+ "@metamask/kernel-cli": "workspace:^"
"@ts-bridge/cli": "npm:^0.6.3"
"@ts-bridge/shims": "npm:^0.1.1"
"@types/lodash": "npm:^4.17.16"
@@ -3925,10 +3987,10 @@ __metadata:
"@metamask/eslint-config": "npm:^15.0.0"
"@metamask/eslint-config-nodejs": "npm:^15.0.0"
"@metamask/eslint-config-typescript": "npm:^15.0.0"
+ "@metamask/kernel-node-runtime": "workspace:^"
"@metamask/kernel-shims": "workspace:^"
"@metamask/logger": "workspace:^"
"@metamask/ocap-kernel": "workspace:^"
- "@ocap/nodejs": "workspace:^"
"@ocap/repo-tools": "workspace:^"
"@ts-bridge/cli": "npm:^0.6.3"
"@ts-bridge/shims": "npm:^0.1.1"
@@ -3956,60 +4018,6 @@ __metadata:
languageName: unknown
linkType: soft
-"@ocap/nodejs@workspace:^, @ocap/nodejs@workspace:packages/nodejs":
- version: 0.0.0-use.local
- resolution: "@ocap/nodejs@workspace:packages/nodejs"
- dependencies:
- "@arethetypeswrong/cli": "npm:^0.17.4"
- "@chainsafe/libp2p-quic": "npm:^1.1.8"
- "@endo/captp": "npm:^4.4.8"
- "@endo/eventual-send": "npm:^1.3.4"
- "@endo/promise-kit": "npm:^1.1.13"
- "@libp2p/interface": "npm:2.11.0"
- "@libp2p/tcp": "npm:10.1.19"
- "@libp2p/webrtc": "npm:5.2.24"
- "@metamask/auto-changelog": "npm:^5.3.0"
- "@metamask/eslint-config": "npm:^15.0.0"
- "@metamask/eslint-config-nodejs": "npm:^15.0.0"
- "@metamask/eslint-config-typescript": "npm:^15.0.0"
- "@metamask/kernel-platforms": "workspace:^"
- "@metamask/kernel-rpc-methods": "workspace:^"
- "@metamask/kernel-shims": "workspace:^"
- "@metamask/kernel-store": "workspace:^"
- "@metamask/kernel-utils": "workspace:^"
- "@metamask/logger": "workspace:^"
- "@metamask/ocap-kernel": "workspace:^"
- "@metamask/streams": "workspace:^"
- "@ocap/repo-tools": "workspace:^"
- "@ts-bridge/cli": "npm:^0.6.3"
- "@ts-bridge/shims": "npm:^0.1.1"
- "@types/node": "npm:^22.13.1"
- "@typescript-eslint/eslint-plugin": "npm:^8.29.0"
- "@typescript-eslint/parser": "npm:^8.29.0"
- "@typescript-eslint/utils": "npm:^8.29.0"
- "@vitest/eslint-plugin": "npm:^1.6.5"
- depcheck: "npm:^1.4.7"
- eslint: "npm:^9.23.0"
- eslint-config-prettier: "npm:^10.1.1"
- eslint-import-resolver-typescript: "npm:^4.3.1"
- eslint-plugin-import-x: "npm:^4.10.0"
- eslint-plugin-jsdoc: "npm:^50.6.9"
- eslint-plugin-n: "npm:^17.17.0"
- eslint-plugin-prettier: "npm:^5.2.6"
- eslint-plugin-promise: "npm:^7.2.1"
- node-gyp: "npm:^11.2.0"
- prettier: "npm:^3.5.3"
- rimraf: "npm:^6.0.1"
- ses: "npm:^1.14.0"
- turbo: "npm:^2.5.6"
- typedoc: "npm:^0.28.1"
- typescript: "npm:~5.8.2"
- typescript-eslint: "npm:^8.29.0"
- vite: "npm:^7.3.0"
- vitest: "npm:^4.0.16"
- languageName: unknown
- linkType: soft
-
"@ocap/omnium-gatherum@workspace:packages/omnium-gatherum":
version: 0.0.0-use.local
resolution: "@ocap/omnium-gatherum@workspace:packages/omnium-gatherum"
@@ -4131,7 +4139,6 @@ __metadata:
"@typescript-eslint/utils": "npm:^8.29.0"
"@vitest/eslint-plugin": "npm:^1.6.5"
"@vitest/runner": "npm:4.0.16"
- acorn: "npm:^8.15.0"
cheerio: "npm:^1.0.0"
depcheck: "npm:^1.4.7"
eslint: "npm:^9.23.0"