From ed4284a3362267055bc48b997b895bc2e9108d93 Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:08:53 -0800 Subject: [PATCH 1/4] chore: @ocap/kernel-platforms -> @metamask/kernel-platforms --- packages/kernel-browser-runtime/package.json | 2 +- .../kernel-browser-runtime/src/vat/iframe.ts | 2 +- packages/kernel-platforms/README.md | 6 +- packages/kernel-platforms/package.json | 5 +- packages/nodejs/package.json | 2 +- packages/nodejs/src/vat/make-supervisor.ts | 2 +- packages/ocap-kernel/package.json | 2 +- packages/ocap-kernel/src/types.ts | 4 +- .../src/vats/VatSupervisor.test.ts | 2 +- .../ocap-kernel/src/vats/VatSupervisor.ts | 2 +- yarn.lock | 86 +++++++++---------- 11 files changed, 57 insertions(+), 58 deletions(-) diff --git a/packages/kernel-browser-runtime/package.json b/packages/kernel-browser-runtime/package.json index d6fd624cc..8ee0f9e60 100644 --- a/packages/kernel-browser-runtime/package.json +++ b/packages/kernel-browser-runtime/package.json @@ -66,6 +66,7 @@ "@endo/captp": "^4.4.8", "@metamask/json-rpc-engine": "^10.2.0", "@metamask/kernel-errors": "workspace:^", + "@metamask/kernel-platforms": "workspace:^", "@metamask/kernel-rpc-methods": "workspace:^", "@metamask/kernel-store": "workspace:^", "@metamask/kernel-utils": "workspace:^", @@ -76,7 +77,6 @@ "@metamask/streams": "workspace:^", "@metamask/superstruct": "^3.2.1", "@metamask/utils": "^11.9.0", - "@ocap/kernel-platforms": "workspace:^", "nanoid": "^5.1.5", "ses": "^1.14.0" }, diff --git a/packages/kernel-browser-runtime/src/vat/iframe.ts b/packages/kernel-browser-runtime/src/vat/iframe.ts index 5e4345333..40219c413 100644 --- a/packages/kernel-browser-runtime/src/vat/iframe.ts +++ b/packages/kernel-browser-runtime/src/vat/iframe.ts @@ -1,3 +1,4 @@ +import { makePlatform } from '@metamask/kernel-platforms/browser'; import type { JsonRpcMessage } from '@metamask/kernel-utils'; import { isJsonRpcMessage } from '@metamask/kernel-utils'; import { Logger } from '@metamask/logger'; @@ -6,7 +7,6 @@ import { MessagePortDuplexStream, receiveMessagePort, } from '@metamask/streams/browser'; -import { makePlatform } from '@ocap/kernel-platforms/browser'; import { setupConsoleForwarding } from '../utils/console-forwarding.ts'; diff --git a/packages/kernel-platforms/README.md b/packages/kernel-platforms/README.md index bdc99d830..2d0f30430 100644 --- a/packages/kernel-platforms/README.md +++ b/packages/kernel-platforms/README.md @@ -1,14 +1,14 @@ -# `@ocap/kernel-platforms` +# `@metamask/kernel-platforms` Specifications and implementations of platform capabilities ## Installation -`yarn add @ocap/kernel-platforms` +`yarn add @metamask/kernel-platforms` or -`npm install @ocap/kernel-platforms` +`npm install @metamask/kernel-platforms` ## Contributing diff --git a/packages/kernel-platforms/package.json b/packages/kernel-platforms/package.json index c58060379..64e717e0e 100644 --- a/packages/kernel-platforms/package.json +++ b/packages/kernel-platforms/package.json @@ -1,7 +1,6 @@ { - "name": "@ocap/kernel-platforms", + "name": "@metamask/kernel-platforms", "version": "0.0.0", - "private": true, "description": "Specifications and implementations of capabilities across platforms", "homepage": "https://github.com/MetaMask/ocap-kernel/tree/main/packages/kernel-platforms#readme", "bugs": { @@ -51,7 +50,7 @@ "scripts": { "build": "ts-bridge --project tsconfig.build.json --no-references --clean", "build:docs": "typedoc", - "changelog:validate": "../../scripts/validate-changelog.sh @ocap/kernel-platforms", + "changelog:validate": "../../scripts/validate-changelog.sh @metamask/kernel-platforms", "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", diff --git a/packages/nodejs/package.json b/packages/nodejs/package.json index 5789d66e5..6b327988e 100644 --- a/packages/nodejs/package.json +++ b/packages/nodejs/package.json @@ -65,6 +65,7 @@ "@libp2p/interface": "2.11.0", "@libp2p/tcp": "10.1.19", "@libp2p/webrtc": "5.2.24", + "@metamask/kernel-platforms": "workspace:^", "@metamask/kernel-rpc-methods": "workspace:^", "@metamask/kernel-shims": "workspace:^", "@metamask/kernel-store": "workspace:^", @@ -72,7 +73,6 @@ "@metamask/logger": "workspace:^", "@metamask/ocap-kernel": "workspace:^", "@metamask/streams": "workspace:^", - "@ocap/kernel-platforms": "workspace:^", "ses": "^1.14.0" }, "devDependencies": { diff --git a/packages/nodejs/src/vat/make-supervisor.ts b/packages/nodejs/src/vat/make-supervisor.ts index 82912ddf1..bd3722081 100644 --- a/packages/nodejs/src/vat/make-supervisor.ts +++ b/packages/nodejs/src/vat/make-supervisor.ts @@ -1,7 +1,7 @@ +import { makePlatform } from '@metamask/kernel-platforms/nodejs'; import { makeStreamTransport, Logger } from '@metamask/logger'; import type { VatId } from '@metamask/ocap-kernel'; import { VatSupervisor } from '@metamask/ocap-kernel'; -import { makePlatform } from '@ocap/kernel-platforms/nodejs'; import { fetchBlob } from './fetch-blob.ts'; import { makeStreams } from './streams.ts'; diff --git a/packages/ocap-kernel/package.json b/packages/ocap-kernel/package.json index 1ac119bbe..1fc9714af 100644 --- a/packages/ocap-kernel/package.json +++ b/packages/ocap-kernel/package.json @@ -86,6 +86,7 @@ "@libp2p/websockets": "9.2.19", "@libp2p/webtransport": "5.0.51", "@metamask/kernel-errors": "workspace:^", + "@metamask/kernel-platforms": "workspace:^", "@metamask/kernel-rpc-methods": "workspace:^", "@metamask/kernel-store": "workspace:^", "@metamask/kernel-utils": "workspace:^", @@ -95,7 +96,6 @@ "@metamask/superstruct": "^3.2.1", "@metamask/utils": "^11.9.0", "@multiformats/multiaddr": "^12.4.4", - "@ocap/kernel-platforms": "workspace:^", "@scure/bip39": "^2.0.1", "it-byte-stream": "^2.0.1", "libp2p": "2.10.0", diff --git a/packages/ocap-kernel/src/types.ts b/packages/ocap-kernel/src/types.ts index 3fb68f0b6..5a8d670fd 100644 --- a/packages/ocap-kernel/src/types.ts +++ b/packages/ocap-kernel/src/types.ts @@ -7,6 +7,8 @@ import type { VatOneResolution, } from '@agoric/swingset-liveslots'; import type { CapData } from '@endo/marshal'; +import type { PlatformConfig } from '@metamask/kernel-platforms'; +import { platformConfigStruct } from '@metamask/kernel-platforms'; import type { VatCheckpoint } from '@metamask/kernel-store'; import type { JsonRpcMessage } from '@metamask/kernel-utils'; import type { DuplexStream } from '@metamask/streams'; @@ -28,8 +30,6 @@ import { import type { Infer } from '@metamask/superstruct'; import type { Json } from '@metamask/utils'; import { UnsafeJsonStruct } from '@metamask/utils'; -import type { PlatformConfig } from '@ocap/kernel-platforms'; -import { platformConfigStruct } from '@ocap/kernel-platforms'; import type { RemoteMessageHandler, diff --git a/packages/ocap-kernel/src/vats/VatSupervisor.test.ts b/packages/ocap-kernel/src/vats/VatSupervisor.test.ts index 566fe9666..2a327838c 100644 --- a/packages/ocap-kernel/src/vats/VatSupervisor.test.ts +++ b/packages/ocap-kernel/src/vats/VatSupervisor.test.ts @@ -1,8 +1,8 @@ +import type { PlatformFactory } from '@metamask/kernel-platforms'; import { delay, isJsonRpcMessage } from '@metamask/kernel-utils'; import type { JsonRpcMessage } from '@metamask/kernel-utils'; import { Logger } from '@metamask/logger'; import { rpcErrors } from '@metamask/rpc-errors'; -import type { PlatformFactory } from '@ocap/kernel-platforms'; import { TestDuplexStream } from '@ocap/repo-tools/test-utils/streams'; import { describe, it, expect, vi } from 'vitest'; diff --git a/packages/ocap-kernel/src/vats/VatSupervisor.ts b/packages/ocap-kernel/src/vats/VatSupervisor.ts index 71ba745b1..d701fb247 100644 --- a/packages/ocap-kernel/src/vats/VatSupervisor.ts +++ b/packages/ocap-kernel/src/vats/VatSupervisor.ts @@ -10,6 +10,7 @@ import { DuplicateEndowmentError, StreamReadError, } from '@metamask/kernel-errors'; +import type { PlatformFactory } from '@metamask/kernel-platforms'; import { RpcClient, RpcService } from '@metamask/kernel-rpc-methods'; import type { VatKVStore } from '@metamask/kernel-store'; import { @@ -25,7 +26,6 @@ import { isJsonRpcRequest, isJsonRpcResponse, } from '@metamask/utils'; -import type { PlatformFactory } from '@ocap/kernel-platforms'; import { loadBundle } from './bundle-loader.ts'; import { makeGCAndFinalize } from '../garbage-collection/gc-finalize.ts'; diff --git a/yarn.lock b/yarn.lock index 80dd1b264..41672ece5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2386,6 +2386,7 @@ __metadata: "@metamask/eslint-config-typescript": "npm:^15.0.0" "@metamask/json-rpc-engine": "npm:^10.2.0" "@metamask/kernel-errors": "workspace:^" + "@metamask/kernel-platforms": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" "@metamask/kernel-store": "workspace:^" "@metamask/kernel-utils": "workspace:^" @@ -2396,7 +2397,6 @@ __metadata: "@metamask/streams": "workspace:^" "@metamask/superstruct": "npm:^3.2.1" "@metamask/utils": "npm:^11.9.0" - "@ocap/kernel-platforms": "workspace:^" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -2470,6 +2470,46 @@ __metadata: 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" + dependencies: + "@arethetypeswrong/cli": "npm:^0.17.4" + "@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/superstruct": "npm:^3.2.1" + "@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" + "@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" + 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-rpc-methods@workspace:^, @metamask/kernel-rpc-methods@workspace:packages/kernel-rpc-methods": version: 0.0.0-use.local resolution: "@metamask/kernel-rpc-methods@workspace:packages/kernel-rpc-methods" @@ -2819,6 +2859,7 @@ __metadata: "@metamask/eslint-config-nodejs": "npm:^15.0.0" "@metamask/eslint-config-typescript": "npm:^15.0.0" "@metamask/kernel-errors": "workspace:^" + "@metamask/kernel-platforms": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" "@metamask/kernel-store": "workspace:^" "@metamask/kernel-utils": "workspace:^" @@ -2828,7 +2869,6 @@ __metadata: "@metamask/superstruct": "npm:^3.2.1" "@metamask/utils": "npm:^11.9.0" "@multiformats/multiaddr": "npm:^12.4.4" - "@ocap/kernel-platforms": "workspace:^" "@ocap/repo-tools": "workspace:^" "@scure/bip39": "npm:^2.0.1" "@ts-bridge/cli": "npm:^0.6.3" @@ -3728,46 +3768,6 @@ __metadata: languageName: unknown linkType: soft -"@ocap/kernel-platforms@workspace:^, @ocap/kernel-platforms@workspace:packages/kernel-platforms": - version: 0.0.0-use.local - resolution: "@ocap/kernel-platforms@workspace:packages/kernel-platforms" - dependencies: - "@arethetypeswrong/cli": "npm:^0.17.4" - "@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/superstruct": "npm:^3.2.1" - "@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" - "@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" - 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/kernel-test-local@workspace:packages/kernel-test-local": version: 0.0.0-use.local resolution: "@ocap/kernel-test-local@workspace:packages/kernel-test-local" @@ -3970,6 +3970,7 @@ __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-platforms": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" "@metamask/kernel-shims": "workspace:^" "@metamask/kernel-store": "workspace:^" @@ -3977,7 +3978,6 @@ __metadata: "@metamask/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" "@metamask/streams": "workspace:^" - "@ocap/kernel-platforms": "workspace:^" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" From 3f042110464df7bf14d90fbe50394c51e7e0c99b Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:16:23 -0800 Subject: [PATCH 2/4] fix: constraints --- packages/kernel-platforms/LICENSE.APACHE2 | 201 ++++++++++++++++++++++ packages/kernel-platforms/LICENSE.MIT | 20 +++ packages/kernel-platforms/package.json | 15 ++ 3 files changed, 236 insertions(+) create mode 100644 packages/kernel-platforms/LICENSE.APACHE2 create mode 100644 packages/kernel-platforms/LICENSE.MIT diff --git a/packages/kernel-platforms/LICENSE.APACHE2 b/packages/kernel-platforms/LICENSE.APACHE2 new file mode 100644 index 000000000..c163baf2c --- /dev/null +++ b/packages/kernel-platforms/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 2026 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-platforms/LICENSE.MIT b/packages/kernel-platforms/LICENSE.MIT new file mode 100644 index 000000000..1a929f9ec --- /dev/null +++ b/packages/kernel-platforms/LICENSE.MIT @@ -0,0 +1,20 @@ +MIT License + +Copyright (c) 2026 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-platforms/package.json b/packages/kernel-platforms/package.json index 64e717e0e..aa520afbf 100644 --- a/packages/kernel-platforms/package.json +++ b/packages/kernel-platforms/package.json @@ -50,6 +50,7 @@ "scripts": { "build": "ts-bridge --project tsconfig.build.json --no-references --clean", "build:docs": "typedoc", + "changelog:update": "../../scripts/update-changelog.sh @metamask/kernel-platforms", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/kernel-platforms", "clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo ./logs", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies", @@ -104,5 +105,19 @@ "dependencies": { "@metamask/superstruct": "^3.2.1", "ses": "^1.14.0" + }, + "keywords": [ + "MetaMask", + "object capabilities", + "ocap" + ], + "license": "(MIT OR Apache-2.0)", + "module": "./dist/index.mjs", + "main": "./dist/index.cjs", + "types": "./dist/index.d.cts", + "sideEffects": false, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" } } From a02f7a4068f246bb5234da4fb04dd453e764571c Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:25:45 -0800 Subject: [PATCH 3/4] fix: prevent non-private packages from having private workspace production deps Add a yarn constraint that errors when a published (`@metamask/`) package lists a private (`@ocap/`) workspace package in production dependencies (`dependencies` or `peerDependencies`) via the `workspace:` protocol. Co-Authored-By: Claude Sonnet 4.6 --- yarn.config.cjs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/yarn.config.cjs b/yarn.config.cjs index 5dfe8f8a3..44e91f085 100644 --- a/yarn.config.cjs +++ b/yarn.config.cjs @@ -169,6 +169,9 @@ module.exports = defineConfig({ // All non-root package must have valid "changelog:update" and // "changelog:validate" scripts. expectCorrectWorkspaceChangelogScripts(workspace); + + // Non-private packages must not have production dependencies on private workspace packages. + expectNoPrivateWorkspaceProductionDependencies(Yarn, workspace); } // Non-published packages must not specify the following keys except from the ones that are exempted @@ -827,6 +830,36 @@ function expectConsistentDependenciesAndDevDependencies(Yarn) { } } +/** + * Expect that non-private workspace packages do not have production + * dependencies (anything except `devDependencies`) using the `workspace:` + * protocol that resolve to private packages. + * + * @param {Yarn} Yarn - The Yarn "global". + * @param {Workspace} workspace - The workspace to check. + */ +function expectNoPrivateWorkspaceProductionDependencies(Yarn, workspace) { + for (const dependency of Yarn.dependencies({ workspace })) { + if (dependency.type === 'devDependencies') { + continue; + } + + if (!dependency.range.startsWith('workspace:')) { + continue; + } + + const dependencyWorkspace = Yarn.workspace({ ident: dependency.ident }); + if ( + dependencyWorkspace !== null && + dependencyWorkspace.manifest.private === true + ) { + dependency.error( + `Non-private package "${workspace.manifest.name}" must not depend on private package "${dependency.ident}" in "${dependency.type}"`, + ); + } + } +} + /** * Expect that the workspace has a README.md file, and that it is a non-empty * string. The README.md is expected to: From 5dec84bd2cb8a2da97da57168b166b83b8bfc124 Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:28:29 -0800 Subject: [PATCH 4/4] test --- packages/foo/CHANGELOG.md | 10 ++++ packages/foo/README.md | 15 ++++++ packages/foo/package.json | 83 +++++++++++++++++++++++++++++++ packages/foo/src/index.test.ts | 11 ++++ packages/foo/src/index.ts | 9 ++++ packages/foo/tsconfig.build.json | 13 +++++ packages/foo/tsconfig.json | 15 ++++++ packages/foo/typedoc.json | 8 +++ packages/foo/vitest.config.ts | 16 ++++++ packages/ocap-kernel/package.json | 1 + tsconfig.build.json | 1 + tsconfig.json | 1 + yarn.lock | 37 ++++++++++++++ 13 files changed, 220 insertions(+) create mode 100644 packages/foo/CHANGELOG.md create mode 100644 packages/foo/README.md create mode 100644 packages/foo/package.json create mode 100644 packages/foo/src/index.test.ts create mode 100644 packages/foo/src/index.ts create mode 100644 packages/foo/tsconfig.build.json create mode 100644 packages/foo/tsconfig.json create mode 100644 packages/foo/typedoc.json create mode 100644 packages/foo/vitest.config.ts diff --git a/packages/foo/CHANGELOG.md b/packages/foo/CHANGELOG.md new file mode 100644 index 000000000..0c82cb1ed --- /dev/null +++ b/packages/foo/CHANGELOG.md @@ -0,0 +1,10 @@ +# 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] + +[Unreleased]: https://github.com/MetaMask/ocap-kernel/ diff --git a/packages/foo/README.md b/packages/foo/README.md new file mode 100644 index 000000000..1625f71c4 --- /dev/null +++ b/packages/foo/README.md @@ -0,0 +1,15 @@ +# `@ocap/foo` + +bar + +## Installation + +`yarn add @ocap/foo` + +or + +`npm install @ocap/foo` + +## 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/foo/package.json b/packages/foo/package.json new file mode 100644 index 000000000..dd419b0b5 --- /dev/null +++ b/packages/foo/package.json @@ -0,0 +1,83 @@ +{ + "name": "@ocap/foo", + "version": "0.0.0", + "private": true, + "description": "bar", + "homepage": "https://github.com/MetaMask/ocap-kernel/tree/main/packages/foo#readme", + "bugs": { + "url": "https://github.com/MetaMask/ocap-kernel/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/MetaMask/ocap-kernel.git" + }, + "type": "module", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + }, + "./package.json": "./package.json" + }, + "files": [ + "dist/" + ], + "scripts": { + "build": "ts-bridge --project tsconfig.build.json --no-references --clean", + "build:docs": "typedoc", + "changelog:validate": "../../scripts/validate-changelog.sh @ocap/foo", + "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", + "lint:eslint": "eslint . --cache", + "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies", + "lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore --log-level error", + "publish:preview": "yarn npm publish --tag preview", + "test": "vitest run --config vitest.config.ts", + "test:clean": "yarn test --no-cache --coverage.clean", + "test:dev": "yarn test --mode development", + "test:verbose": "yarn test --reporter verbose", + "test:watch": "vitest --config vitest.config.ts", + "test:dev:quiet": "yarn test:dev --reporter @ocap/repo-tools/vitest-reporters/silent" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.4", + "@metamask/auto-changelog": "^5.3.0", + "@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", + "@typescript-eslint/eslint-plugin": "^8.29.0", + "@typescript-eslint/parser": "^8.29.0", + "@typescript-eslint/utils": "^8.29.0", + "@vitest/eslint-plugin": "^1.6.5", + "depcheck": "^1.4.7", + "eslint": "^9.23.0", + "eslint-config-prettier": "^10.1.1", + "eslint-import-resolver-typescript": "^4.3.1", + "eslint-plugin-import-x": "^4.10.0", + "eslint-plugin-jsdoc": "^50.6.9", + "eslint-plugin-n": "^17.17.0", + "eslint-plugin-prettier": "^5.2.6", + "eslint-plugin-promise": "^7.2.1", + "prettier": "^3.5.3", + "rimraf": "^6.0.1", + "turbo": "^2.5.6", + "typedoc": "^0.28.1", + "typescript": "~5.8.2", + "typescript-eslint": "^8.29.0", + "vite": "^7.3.0", + "vitest": "^4.0.16" + }, + "engines": { + "node": ">=22" + } +} diff --git a/packages/foo/src/index.test.ts b/packages/foo/src/index.test.ts new file mode 100644 index 000000000..b019d6c61 --- /dev/null +++ b/packages/foo/src/index.test.ts @@ -0,0 +1,11 @@ +import { describe, expect, it } from 'vitest'; + +import greet from './index.ts'; + +describe('Test', () => { + it('greets', () => { + const name = 'Huey'; + const result = greet(name); + expect(result).toBe('Hello, Huey!'); + }); +}); diff --git a/packages/foo/src/index.ts b/packages/foo/src/index.ts new file mode 100644 index 000000000..f7250b998 --- /dev/null +++ b/packages/foo/src/index.ts @@ -0,0 +1,9 @@ +/** + * Example function that returns a greeting for the given name. + * + * @param name - The name to greet. + * @returns The greeting. + */ +export default function greet(name: string): string { + return `Hello, ${name}!`; +} diff --git a/packages/foo/tsconfig.build.json b/packages/foo/tsconfig.build.json new file mode 100644 index 000000000..30d7991d1 --- /dev/null +++ b/packages/foo/tsconfig.build.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.packages.build.json", + "compilerOptions": { + "baseUrl": "./", + "lib": ["ES2022"], + "outDir": "./dist", + "rootDir": "./src", + "types": [] + }, + "references": [], + "files": [], + "include": ["./src"] +} diff --git a/packages/foo/tsconfig.json b/packages/foo/tsconfig.json new file mode 100644 index 000000000..6bf57bef4 --- /dev/null +++ b/packages/foo/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.packages.json", + "compilerOptions": { + "baseUrl": "./", + "lib": ["ES2022"], + "types": ["vitest"] + }, + "references": [{ "path": "../repo-tools" }], + "include": [ + "../../vitest.config.ts", + "./src", + "./vite.config.ts", + "./vitest.config.ts" + ] +} diff --git a/packages/foo/typedoc.json b/packages/foo/typedoc.json new file mode 100644 index 000000000..f8eb78ae1 --- /dev/null +++ b/packages/foo/typedoc.json @@ -0,0 +1,8 @@ +{ + "entryPoints": [], + "excludePrivate": true, + "hideGenerator": true, + "out": "docs", + "tsconfig": "./tsconfig.build.json", + "projectDocuments": ["documents/*.md"] +} diff --git a/packages/foo/vitest.config.ts b/packages/foo/vitest.config.ts new file mode 100644 index 000000000..ecc65ebf9 --- /dev/null +++ b/packages/foo/vitest.config.ts @@ -0,0 +1,16 @@ +import { mergeConfig } from '@ocap/repo-tools/vitest-config'; +import { defineConfig, defineProject } from 'vitest/config'; + +import defaultConfig from '../../vitest.config.ts'; + +export default defineConfig((args) => { + return mergeConfig( + args, + defaultConfig, + defineProject({ + test: { + name: 'foo', + }, + }), + ); +}); diff --git a/packages/ocap-kernel/package.json b/packages/ocap-kernel/package.json index 1fc9714af..36fe2fdf2 100644 --- a/packages/ocap-kernel/package.json +++ b/packages/ocap-kernel/package.json @@ -96,6 +96,7 @@ "@metamask/superstruct": "^3.2.1", "@metamask/utils": "^11.9.0", "@multiformats/multiaddr": "^12.4.4", + "@ocap/foo": "workspace:^", "@scure/bip39": "^2.0.1", "it-byte-stream": "^2.0.1", "libp2p": "2.10.0", diff --git a/tsconfig.build.json b/tsconfig.build.json index ecf57a430..78c2d3c94 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -3,6 +3,7 @@ "include": [], "references": [ { "path": "./packages/cli/tsconfig.build.json" }, + { "path": "./packages/foo/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" }, diff --git a/tsconfig.json b/tsconfig.json index c7c624374..39a6bfcd1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,7 @@ { "path": "./packages/cli" }, { "path": "./packages/create-package" }, { "path": "./packages/extension" }, + { "path": "./packages/foo" }, { "path": "./packages/kernel-agents" }, { "path": "./packages/kernel-browser-runtime" }, { "path": "./packages/kernel-errors" }, diff --git a/yarn.lock b/yarn.lock index 41672ece5..73993c82c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2869,6 +2869,7 @@ __metadata: "@metamask/superstruct": "npm:^3.2.1" "@metamask/utils": "npm:^11.9.0" "@multiformats/multiaddr": "npm:^12.4.4" + "@ocap/foo": "workspace:^" "@ocap/repo-tools": "workspace:^" "@scure/bip39": "npm:^2.0.1" "@ts-bridge/cli": "npm:^0.6.3" @@ -3639,6 +3640,42 @@ __metadata: languageName: unknown linkType: soft +"@ocap/foo@workspace:^, @ocap/foo@workspace:packages/foo": + version: 0.0.0-use.local + resolution: "@ocap/foo@workspace:packages/foo" + dependencies: + "@arethetypeswrong/cli": "npm:^0.17.4" + "@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" + "@ocap/repo-tools": "workspace:^" + "@ts-bridge/cli": "npm:^0.6.3" + "@ts-bridge/shims": "npm:^0.1.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" + prettier: "npm:^3.5.3" + rimraf: "npm:^6.0.1" + 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/kernel-agents-repl@workspace:^, @ocap/kernel-agents-repl@workspace:packages/kernel-agents-repl": version: 0.0.0-use.local resolution: "@ocap/kernel-agents-repl@workspace:packages/kernel-agents-repl"