From d7286d025a8f94e26cac27a77d1fa2d0e142f6ae Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Mon, 12 Jan 2026 20:15:42 +0100 Subject: [PATCH 1/7] chore(deps): Update MetaMask dependencies and fix JSDoc compliance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update MetaMask packages to latest versions: - @metamask/eslint-config: 14.0.0 → 15.0.0 - @metamask/eslint-config-nodejs: 14.0.0 → 15.0.0 - @metamask/eslint-config-typescript: 14.0.0 → 15.0.0 - @metamask/eslint-config-vitest: 1.0.0 → 15.0.0 - @metamask/auto-changelog: 5.0.1 → 5.3.0 - @metamask/utils: 11.4.2 → 11.9.0 - @metamask/snaps-utils: 11.6.1 → 11.7.1 Update eslint.config.mjs to configure JSDoc rules: - Require JSDoc for functions, methods, and classes in TypeScript - Disable JSDoc requirement for test files and config files Add missing JSDoc documentation across all packages to comply with the new linting rules. Co-Authored-By: Claude --- eslint.config.mjs | 29 + package.json | 12 +- packages/cli/package.json | 12 +- packages/create-package/package.json | 10 +- packages/create-package/src/cli.test.ts | 2 - packages/create-package/src/commands.test.ts | 2 - packages/extension/package.json | 10 +- packages/kernel-agents/package.json | 8 +- .../src/strategies/json/messages.ts | 53 ++ .../src/strategies/repl/messages.ts | 83 +++ .../src/strategies/repl/parse/javascript.ts | 2 - packages/kernel-agents/src/task.ts | 3 + packages/kernel-agents/src/types/messages.ts | 9 + packages/kernel-browser-runtime/package.json | 14 +- .../src/PlatformServicesClient.ts | 3 + .../src/PlatformServicesServer.ts | 8 + packages/kernel-errors/package.json | 10 +- packages/kernel-errors/src/BaseError.ts | 10 + .../kernel-errors/src/errors/AbortError.ts | 8 + .../src/errors/DuplicateEndowmentError.ts | 10 + .../src/errors/EvaluatorError.ts | 8 + .../src/errors/SampleGenerationError.ts | 7 + .../src/errors/StreamReadError.ts | 9 + .../src/errors/SubclusterNotFoundError.ts | 9 + .../src/errors/VatAlreadyExistsError.ts | 9 + .../src/errors/VatDeletedError.ts | 9 + .../src/errors/VatNotFoundError.ts | 9 + .../package.json | 8 +- .../src/ollama/base.test.ts | 4 +- .../src/ollama/base.ts | 2 - .../src/ollama/nodejs.test.ts | 2 +- .../src/ollama/types.ts | 3 +- .../test/utils.ts | 2 +- packages/kernel-platforms/package.json | 10 +- packages/kernel-rpc-methods/package.json | 12 +- packages/kernel-rpc-methods/src/RpcClient.ts | 37 ++ packages/kernel-shims/package.json | 8 +- packages/kernel-store/package.json | 8 +- .../kernel-store/src/sqlite/nodejs.test.ts | 2 +- packages/kernel-store/src/sqlite/nodejs.ts | 1 - packages/kernel-store/src/sqlite/wasm.test.ts | 4 +- packages/kernel-test/package.json | 8 +- packages/kernel-ui/package.json | 10 +- packages/kernel-utils/package.json | 10 +- packages/logger/package.json | 10 +- packages/logger/src/logger.ts | 37 ++ packages/logger/src/options.ts | 2 +- packages/nodejs-test-workers/package.json | 8 +- packages/nodejs/package.json | 10 +- .../nodejs/src/kernel/PlatformServices.ts | 4 + packages/ocap-kernel/package.json | 12 +- packages/ocap-kernel/src/Kernel.ts | 48 +- packages/ocap-kernel/src/KernelQueue.ts | 8 +- packages/ocap-kernel/src/KernelRouter.ts | 7 + .../ocap-kernel/src/KernelServiceManager.ts | 8 + .../ocap-kernel/src/remotes/OcapURLManager.ts | 6 + .../ocap-kernel/src/remotes/RemoteHandle.ts | 3 + .../ocap-kernel/src/remotes/RemoteManager.ts | 17 + .../ocap-kernel/src/vats/SubclusterManager.ts | 10 + packages/ocap-kernel/src/vats/VatHandle.ts | 3 + .../ocap-kernel/src/vats/VatManager.test.ts | 2 +- packages/ocap-kernel/src/vats/VatManager.ts | 9 + .../ocap-kernel/src/vats/VatSupervisor.ts | 9 + packages/ocap-kernel/test/remotes-mocks.ts | 5 + packages/omnium-gatherum/package.json | 10 +- packages/remote-iterables/package.json | 8 +- packages/remote-iterables/src/reader-ref.ts | 10 + packages/repo-tools/package.json | 6 +- packages/streams/package.json | 10 +- packages/streams/src/BaseDuplexStream.ts | 22 + packages/streams/src/BaseStream.ts | 36 +- .../src/browser/ChromeRuntimeStream.ts | 43 ++ .../streams/src/browser/MessagePortStream.ts | 32 ++ .../streams/src/browser/PostMessageStream.ts | 37 ++ packages/streams/src/node/NodeWorkerStream.ts | 32 ++ packages/streams/src/split.ts | 71 +++ packages/streams/test/stream-mocks.ts | 69 +++ packages/template-package/package.json | 8 +- vitest.config.ts | 130 ++--- yarn.lock | 527 ++++++++++++------ 80 files changed, 1340 insertions(+), 418 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 2ef2bb7a1..bf6f62a76 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -49,6 +49,20 @@ const config = createConfig([ files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '**/*.d.ts'], extends: [metamaskTypescriptConfig], rules: { + // Don't require JSDoc for type declarations. + 'jsdoc/require-jsdoc': [ + 'error', + { + require: { + FunctionDeclaration: true, + MethodDefinition: true, + ClassDeclaration: true, + }, + contexts: [], + }, + ], + + // Require explicit function return types. '@typescript-eslint/explicit-function-return-type': [ 'error', { @@ -141,6 +155,7 @@ const config = createConfig([ files: ['**/test/**/*', '**/*.test.ts', '**/*.test.tsx'], rules: { '@typescript-eslint/explicit-function-return-type': 'off', + 'jsdoc/require-jsdoc': 'off', }, }, @@ -260,6 +275,20 @@ const config = createConfig([ 'import-x/no-unresolved': 'off', }, }, + + { + files: [ + '**/vite.config.*', + '**/vite-plugins/**/*', + '**/vats/**/*.js', + '**/vitest.config.ts', + '**/vitest.config.e2e.ts', + 'yarn.config.cjs', + ], + rules: { + 'jsdoc/require-jsdoc': 'off', + }, + }, ]); export default config; diff --git a/package.json b/package.json index 96ca81ff7..a283cb9c0 100644 --- a/package.json +++ b/package.json @@ -55,12 +55,12 @@ "@arethetypeswrong/cli": "^0.17.4", "@lavamoat/allow-scripts": "^3.3.2", "@lavamoat/preinstall-always-fail": "^2.1.0", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/create-release-branch": "^4.1.2", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", - "@metamask/eslint-config-vitest": "^1.0.0", + "@metamask/auto-changelog": "^5.3.0", + "@metamask/create-release-branch": "^4.1.3", + "@metamask/eslint-config": "^15.0.0", + "@metamask/eslint-config-nodejs": "^15.0.0", + "@metamask/eslint-config-typescript": "^15.0.0", + "@metamask/eslint-config-vitest": "^15.0.0", "@ocap/cli": "workspace:^", "@ts-bridge/cli": "^0.6.3", "@ts-bridge/shims": "^0.1.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index edf0891a1..e39c83477 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -49,8 +49,8 @@ "@metamask/kernel-shims": "workspace:^", "@metamask/kernel-utils": "workspace:^", "@metamask/logger": "workspace:^", - "@metamask/snaps-utils": "^11.6.1", - "@metamask/utils": "^11.4.2", + "@metamask/snaps-utils": "^11.7.1", + "@metamask/utils": "^11.9.0", "@types/node": "^22.13.1", "chokidar": "^4.0.1", "glob": "^11.0.0", @@ -60,10 +60,10 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/create-package/package.json b/packages/create-package/package.json index 4e501b812..27c8d9937 100644 --- a/packages/create-package/package.json +++ b/packages/create-package/package.json @@ -46,11 +46,11 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", - "@metamask/utils": "^11.4.2", + "@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", + "@metamask/utils": "^11.9.0", "@ocap/repo-tools": "workspace:^", "@ts-bridge/cli": "^0.6.3", "@ts-bridge/shims": "^0.1.1", diff --git a/packages/create-package/src/cli.test.ts b/packages/create-package/src/cli.test.ts index 927f297c5..166d67865 100644 --- a/packages/create-package/src/cli.test.ts +++ b/packages/create-package/src/cli.test.ts @@ -30,8 +30,6 @@ function getParsedArgv( description: string, ): Record { return { - // TODO: Either fix this lint violation or explain why it's necessary to ignore. - // eslint-disable-next-line @typescript-eslint/naming-convention _: [], $0: 'create-package', name: `@ocap/${name}`, diff --git a/packages/create-package/src/commands.test.ts b/packages/create-package/src/commands.test.ts index 2169c5ada..2f144e2fb 100644 --- a/packages/create-package/src/commands.test.ts +++ b/packages/create-package/src/commands.test.ts @@ -30,8 +30,6 @@ describe('create-package/commands', () => { }); const args: Arguments = { - // TODO: Either fix this lint violation or explain why it's necessary to ignore. - // eslint-disable-next-line @typescript-eslint/naming-convention _: [], $0: 'create-package', name: '@ocap/new-package', diff --git a/packages/extension/package.json b/packages/extension/package.json index f2d6e06b2..b2ce2a876 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -50,17 +50,17 @@ "@metamask/logger": "workspace:^", "@metamask/ocap-kernel": "workspace:^", "@metamask/streams": "workspace:^", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "react": "^17.0.2", "react-dom": "^17.0.2", "ses": "^1.14.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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/cli": "workspace:^", "@ocap/kernel-test": "workspace:^", "@ocap/repo-tools": "workspace:^", diff --git a/packages/kernel-agents/package.json b/packages/kernel-agents/package.json index 9659c5013..5c42f6c35 100644 --- a/packages/kernel-agents/package.json +++ b/packages/kernel-agents/package.json @@ -87,10 +87,10 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/kernel-agents/src/strategies/json/messages.ts b/packages/kernel-agents/src/strategies/json/messages.ts index cafa8e83d..2d22ba3ed 100644 --- a/packages/kernel-agents/src/strategies/json/messages.ts +++ b/packages/kernel-agents/src/strategies/json/messages.ts @@ -4,6 +4,9 @@ export type MessageType = | 'assistant' | 'capabilityResult'; +/** + * A message with a type and body, used for structured communication in agent transcripts. + */ export class Message< Type extends MessageType, Body extends Record, @@ -12,11 +15,22 @@ export class Message< messageBody: Body; + /** + * Constructs a new {@link Message}. + * + * @param messageType - The type of the message. + * @param messageBody - The body content of the message. + */ constructor(messageType: Type, messageBody: Body) { this.messageType = messageType; this.messageBody = messageBody; } + /** + * Serializes the message to a JSON string. + * + * @returns The JSON string representation of the message. + */ toJSON(): string { return JSON.stringify({ ...this.messageBody, @@ -27,16 +41,32 @@ export class Message< export type Transcript = Message>[]; +/** + * A message containing capability schemas for the agent to use. + */ export class CapabilitySpecMessage extends Message< 'capabilitySpecification', { schemas: object } > { + /** + * Constructs a new {@link CapabilitySpecMessage}. + * + * @param schemas - The capability schemas describing available capabilities. + */ constructor(schemas: object) { super('capabilitySpecification', { schemas }); } } +/** + * A message representing user input to the agent. + */ export class UserMessage extends Message<'user', { content: string }> { + /** + * Constructs a new {@link UserMessage}. + * + * @param content - The user's message content. + */ constructor(content: string) { super('user', { content }); } @@ -44,14 +74,29 @@ export class UserMessage extends Message<'user', { content: string }> { export type Invocation = { name: string; args: object }; +/** + * A message representing the assistant's response, including optional thinking and capability invocations. + */ export class AssistantMessage extends Message< 'assistant', { think?: string[]; invoke: Invocation[] } > { + /** + * Constructs a new {@link AssistantMessage}. + * + * @param options - The options for the assistant message. + * @param options.think - The think to include in the message. + * @param options.invoke - The invoke to include in the message. + */ constructor({ think, invoke }: { think?: string[]; invoke: Invocation[] }) { super('assistant', { think: think ?? [], invoke }); } + /** + * Serializes the assistant message to a JSON string. + * + * @returns The JSON string. + */ toJSON(): string { /* JSON.stringify will not preserve the order of the properties. * To utilize the conditional probability, think precedes invoke. @@ -72,10 +117,18 @@ export type AssistantMessageJson = { invoke: Invocation[]; }; +/** + * A message containing the results of capability invocations. + */ export class CapabilityResultMessage extends Message< 'capabilityResult', { results: (Invocation & { result: unknown })[] } > { + /** + * Constructs a new {@link CapabilityResultMessage}. + * + * @param results - The array of invocation results, each containing the invocation details and its result. + */ constructor(results: (Invocation & { result: unknown })[]) { super('capabilityResult', { results }); } diff --git a/packages/kernel-agents/src/strategies/repl/messages.ts b/packages/kernel-agents/src/strategies/repl/messages.ts index 97ba4e8f6..5df014be7 100644 --- a/packages/kernel-agents/src/strategies/repl/messages.ts +++ b/packages/kernel-agents/src/strategies/repl/messages.ts @@ -35,6 +35,9 @@ const isJsonObservable = (value: unknown): value is JsonObservable => export const observeJson = (value: JsonObservation): string => isJsonObservable(value) ? value.toJsonString() : stringify(value); +/** + * An abstract REPL message with JSON and REPL string serialization capabilities. + */ export abstract class ReplMessage< Type extends ReplMessageType, Body extends Record, @@ -42,6 +45,11 @@ export abstract class ReplMessage< extends Message implements ReplObservable, JsonObservable { + /** + * Serializes the message to a JSON-formatted string. + * + * @returns The JSON string representation of the message. + */ toJsonString(): string { const messageType = `"messageType": "${this.messageType}"`; const bodyEntries = Object.entries(this.messageBody) @@ -56,13 +64,27 @@ export abstract class ReplMessage< } // Statements comprise the action space of the REPL agent. +/** + * A message representing a statement in the REPL action space. + */ export class StatementMessage< Type extends StatementType = StatementType, > extends ReplMessage { + /** + * Serializes the statement to a REPL-formatted string with prompt prefix. + * + * @returns The REPL string representation of the statement. + */ toReplString(): string { return `> ${this.messageBody.code}`; } + /** + * Creates a statement message from code by parsing it and determining its type. + * + * @param code - The code string to parse into a statement message. + * @returns A statement message of the appropriate type. + */ static fromCode(code: string): StatementMessage { return statementMessageFromCode(code); } @@ -81,26 +103,59 @@ const parseStatement = ( return statement; }; +/** + * A message representing a comment statement. + */ export class CommentMessage extends StatementMessage<'comment'> { + /** + * Constructs a new {@link CommentMessage}. + * + * @param code - The comment code string. + * @param statement - Optional pre-parsed syntax node; if not provided, the code will be parsed. + */ constructor(code: string, statement?: SyntaxNode) { const node = statement ?? parseStatement(code, 'comment'); super('comment', { code, node }); } } +/** + * A message representing an import statement. + */ export class ImportMessage extends StatementMessage<'import'> { + /** + * Constructs a new {@link ImportMessage}. + * + * @param code - The import statement code string. + * @param statement - Optional pre-parsed syntax node; if not provided, the code will be parsed. + */ constructor(code: string, statement?: SyntaxNode) { const node = statement ?? parseStatement(code, 'import_statement'); super('import', { code, node }); } + /** + * Creates an import message from a list of named imports from the abilities module. + * + * @param names - The names to import from the abilities module. + * @returns An import message for the specified names. + */ static fromNames(names: string[]): ImportMessage { const code = `import { ${names.join(', ')} } from "@ocap/abilities";`; return new ImportMessage(code); } } +/** + * A message representing an evaluation statement to be executed. + */ export class EvaluationMessage extends StatementMessage<'evaluation'> { + /** + * Constructs a new {@link EvaluationMessage}. + * + * @param code - The code to evaluate. + * @param statement - Optional pre-parsed syntax node; if not provided, the code will be parsed. + */ constructor(code: string, statement?: SyntaxNode) { const node = statement ?? parseStatement(code, 'expression_statement'); super('evaluation', { code, node }); @@ -126,14 +181,27 @@ function statementMessageFromCode(code: string): StatementMessage { } } +/** + * A message representing an interjection in the REPL session. + */ export class InterjectionMessage extends ReplMessage< 'interjection', { interjection: string } > { + /** + * Constructs a new {@link InterjectionMessage}. + * + * @param interjection - The interjection text to display. + */ constructor(interjection: string) { super('interjection', { interjection }); } + /** + * Serializes the interjection to a REPL-formatted string with exclamation prefix. + * + * @returns The REPL string representation of the interjection. + */ toReplString(): string { return `! ${this.messageBody.interjection}`; } @@ -176,9 +244,19 @@ type ResultArg = { [RETURN]?: unknown; }; +/** + * A message representing the result of evaluating a statement. + */ export class ResultMessage extends ReplMessage<'result', ResultMessageBody> { readonly #compress: boolean; + /** + * Constructs a new {@link ResultMessage}. + * + * @param result - The result object containing optional value, error, or return properties. + * @param options - Configuration options for the result message. + * @param options.compress - Whether to compress long output by truncating lines; defaults to true. + */ constructor( result: ResultArg, { compress = true }: { compress?: boolean } = {}, @@ -203,6 +281,11 @@ export class ResultMessage extends ReplMessage<'result', ResultMessageBody> { this.#compress = compress; } + /** + * Serializes the result to a REPL-formatted string, optionally compressing long output. + * + * @returns The REPL string representation of the result. + */ toReplString(): string { const lines = { error: this.messageBody.error?.split('\n') ?? [], diff --git a/packages/kernel-agents/src/strategies/repl/parse/javascript.ts b/packages/kernel-agents/src/strategies/repl/parse/javascript.ts index a1e4e0fb9..277ece0f7 100644 --- a/packages/kernel-agents/src/strategies/repl/parse/javascript.ts +++ b/packages/kernel-agents/src/strategies/repl/parse/javascript.ts @@ -1,7 +1,5 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import Parser from 'tree-sitter'; import JavaScript from 'tree-sitter-javascript'; -/* eslint-enable @typescript-eslint/naming-convention */ const parser = new Parser(); parser.setLanguage(JavaScript as Parser.Language); diff --git a/packages/kernel-agents/src/task.ts b/packages/kernel-agents/src/task.ts index 385305c8c..d96a97eaf 100644 --- a/packages/kernel-agents/src/task.ts +++ b/packages/kernel-agents/src/task.ts @@ -14,6 +14,9 @@ export const defaultJudgment = (_result: unknown): _result is Result => const formatTaskId = (count: number): string => `t${count.toString().padStart(3, '0')}`; +/** + * Manages the creation and tracking of tasks for agents. + */ export class TaskManager { readonly #tasks: Task[] = []; diff --git a/packages/kernel-agents/src/types/messages.ts b/packages/kernel-agents/src/types/messages.ts index f4ab24231..20cf35376 100644 --- a/packages/kernel-agents/src/types/messages.ts +++ b/packages/kernel-agents/src/types/messages.ts @@ -1,5 +1,8 @@ export type MessageTypeBase = string; +/** + * An abstract base class for messages with a type and body. + */ export abstract class Message< Type extends MessageTypeBase, Body extends Record = Record, @@ -8,6 +11,12 @@ export abstract class Message< messageBody: Body; + /** + * Constructs a new {@link Message}. + * + * @param messageType - The type identifier for the message. + * @param messageBody - The body content of the message. + */ constructor(messageType: Type, messageBody: Body) { this.messageType = messageType; this.messageBody = messageBody; diff --git a/packages/kernel-browser-runtime/package.json b/packages/kernel-browser-runtime/package.json index 17f0c7b9c..cb930dd93 100644 --- a/packages/kernel-browser-runtime/package.json +++ b/packages/kernel-browser-runtime/package.json @@ -71,21 +71,21 @@ "@metamask/kernel-utils": "workspace:^", "@metamask/logger": "workspace:^", "@metamask/ocap-kernel": "workspace:^", - "@metamask/rpc-errors": "^7.0.2", - "@metamask/snaps-utils": "^11.6.1", + "@metamask/rpc-errors": "^7.0.3", + "@metamask/snaps-utils": "^11.7.1", "@metamask/streams": "workspace:^", "@metamask/superstruct": "^3.2.1", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "@ocap/kernel-platforms": "workspace:^", "nanoid": "^5.1.5", "ses": "^1.14.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/kernel-browser-runtime/src/PlatformServicesClient.ts b/packages/kernel-browser-runtime/src/PlatformServicesClient.ts index 40ec1ac75..634e8a44c 100644 --- a/packages/kernel-browser-runtime/src/PlatformServicesClient.ts +++ b/packages/kernel-browser-runtime/src/PlatformServicesClient.ts @@ -35,6 +35,9 @@ export type PlatformServicesClientStream = PostMessageDuplexStream< PostMessageEnvelope >; +/** + * + */ export class PlatformServicesClient implements PlatformServices { readonly #logger: Logger; diff --git a/packages/kernel-browser-runtime/src/PlatformServicesServer.ts b/packages/kernel-browser-runtime/src/PlatformServicesServer.ts index 91956b343..23ea90412 100644 --- a/packages/kernel-browser-runtime/src/PlatformServicesServer.ts +++ b/packages/kernel-browser-runtime/src/PlatformServicesServer.ts @@ -40,6 +40,9 @@ export type PlatformServicesStream = PostMessageDuplexStream< PostMessageEnvelope // was JsonRpcResponse >; +/** + * + */ export class PlatformServicesServer { readonly #logger; @@ -150,6 +153,11 @@ export class PlatformServicesServer { return new PlatformServicesServer(stream, makeWorker, logger); } + /** + * Handles incoming JSON-RPC messages from the shared worker. + * + * @param event - The message event containing the JSON-RPC message data. + */ async #handleMessage(event: MessageEvent): Promise { if (isJsonRpcResponse(event.data)) { const message = event.data; diff --git a/packages/kernel-errors/package.json b/packages/kernel-errors/package.json index aa14d0787..527c90db7 100644 --- a/packages/kernel-errors/package.json +++ b/packages/kernel-errors/package.json @@ -58,14 +58,14 @@ "dependencies": { "@libp2p/interface": "2.11.0", "@metamask/superstruct": "^3.2.1", - "@metamask/utils": "^11.4.2" + "@metamask/utils": "^11.9.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/kernel-errors/src/BaseError.ts b/packages/kernel-errors/src/BaseError.ts index 0caf74590..bb79afb12 100644 --- a/packages/kernel-errors/src/BaseError.ts +++ b/packages/kernel-errors/src/BaseError.ts @@ -8,11 +8,21 @@ import type { MarshaledError, } from './types.ts'; +/** + * Base class for all OCAP kernel errors. + */ export class BaseError extends Error implements OcapError { public readonly code: ErrorCode; public readonly data: Json | undefined; + /** + * Creates a new BaseError instance. + * + * @param code - The error code identifying the type of error. + * @param message - A human-readable description of the error. + * @param options - Additional error options including cause, stack, and data. + */ constructor( code: ErrorCode, message: string, diff --git a/packages/kernel-errors/src/errors/AbortError.ts b/packages/kernel-errors/src/errors/AbortError.ts index 5feb0c7f9..c400f924b 100644 --- a/packages/kernel-errors/src/errors/AbortError.ts +++ b/packages/kernel-errors/src/errors/AbortError.ts @@ -10,7 +10,15 @@ import { BaseError } from '../BaseError.ts'; import { marshaledErrorSchema, ErrorCode } from '../constants.ts'; import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; +/** + * Error indicating an operation was aborted. + */ export class AbortError extends BaseError { + /** + * Creates a new AbortError. + * + * @param options - Additional error options including cause and stack. + */ constructor(options?: ErrorOptionsWithStack) { super(ErrorCode.AbortError, 'Operation aborted.', { ...options, diff --git a/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts b/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts index e73eb0c55..8248aa9df 100644 --- a/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts +++ b/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts @@ -10,7 +10,17 @@ import { BaseError } from '../BaseError.ts'; import { marshaledErrorSchema, ErrorCode } from '../constants.ts'; import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; +/** + * Error indicating a duplicate endowment was detected. + */ export class DuplicateEndowmentError extends BaseError { + /** + * Creates a new DuplicateEndowmentError. + * + * @param endowmentName - The name of the duplicate endowment. + * @param isInternal - Whether the duplicate is an internal endowment. + * @param options - Additional error options including cause and stack. + */ constructor( endowmentName: string, isInternal: boolean, diff --git a/packages/kernel-errors/src/errors/EvaluatorError.ts b/packages/kernel-errors/src/errors/EvaluatorError.ts index da9e04f6e..4509f1cc2 100644 --- a/packages/kernel-errors/src/errors/EvaluatorError.ts +++ b/packages/kernel-errors/src/errors/EvaluatorError.ts @@ -25,6 +25,14 @@ import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; * even if the compiler cannot detect this. */ export class EvaluatorError extends BaseError { + /** + * Creates a new EvaluatorError. + * + * @param message - A human-readable description of the evaluator error. + * @param code - An internal code identifying the specific evaluator failure. + * @param cause - The underlying error that caused this evaluator error. + * @param options - Additional error options including stack. + */ constructor( message: string, code: string, diff --git a/packages/kernel-errors/src/errors/SampleGenerationError.ts b/packages/kernel-errors/src/errors/SampleGenerationError.ts index 1191bd9d0..4b867669b 100644 --- a/packages/kernel-errors/src/errors/SampleGenerationError.ts +++ b/packages/kernel-errors/src/errors/SampleGenerationError.ts @@ -21,6 +21,13 @@ import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; * This error should trigger resampling from the LLM. */ export class SampleGenerationError extends BaseError { + /** + * Creates a new SampleGenerationError. + * + * @param sample - The invalid sample text generated by the LLM. + * @param cause - The underlying error that caused sample generation to fail. + * @param options - Additional error options including stack. + */ constructor(sample: string, cause: Error, options?: ErrorOptionsWithStack) { super(ErrorCode.SampleGenerationError, 'LLM generated invalid response.', { ...options, diff --git a/packages/kernel-errors/src/errors/StreamReadError.ts b/packages/kernel-errors/src/errors/StreamReadError.ts index 1b40c1be6..d10b67548 100644 --- a/packages/kernel-errors/src/errors/StreamReadError.ts +++ b/packages/kernel-errors/src/errors/StreamReadError.ts @@ -20,7 +20,16 @@ type StreamReadErrorData = { vatId: string } | { kernelId: string }; type StreamReadErrorOptions = Required & Pick; +/** + * Error indicating an unexpected failure while reading from a stream. + */ export class StreamReadError extends BaseError { + /** + * Creates a new StreamReadError. + * + * @param data - Context data identifying the source of the error (vatId or kernelId). + * @param options - Error options including the underlying cause and stack trace. + */ constructor(data: StreamReadErrorData, options: StreamReadErrorOptions) { super(ErrorCode.StreamReadError, 'Unexpected stream read error.', { ...options, diff --git a/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts b/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts index e82322566..ce83d2364 100644 --- a/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts +++ b/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts @@ -4,7 +4,16 @@ import { BaseError } from '../BaseError.ts'; import { marshaledErrorSchema, ErrorCode } from '../constants.ts'; import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; +/** + * Error indicating that a requested subcluster does not exist. + */ export class SubclusterNotFoundError extends BaseError { + /** + * Creates a new SubclusterNotFoundError. + * + * @param subclusterId - The identifier of the subcluster that was not found. + * @param options - Additional error options including cause and stack trace. + */ constructor(subclusterId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.SubclusterNotFound, 'Subcluster does not exist.', { ...options, diff --git a/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts b/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts index a663ecddd..f427d3807 100644 --- a/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts +++ b/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts @@ -4,7 +4,16 @@ import { BaseError } from '../BaseError.ts'; import { marshaledErrorSchema, ErrorCode } from '../constants.ts'; import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; +/** + * Error indicating an attempt to create a vat with an ID that already exists. + */ export class VatAlreadyExistsError extends BaseError { + /** + * Creates a new VatAlreadyExistsError. + * + * @param vatId - The identifier of the vat that already exists. + * @param options - Additional error options including cause and stack trace. + */ constructor(vatId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.VatAlreadyExists, 'Vat already exists.', { ...options, diff --git a/packages/kernel-errors/src/errors/VatDeletedError.ts b/packages/kernel-errors/src/errors/VatDeletedError.ts index ba46e94ce..607757146 100644 --- a/packages/kernel-errors/src/errors/VatDeletedError.ts +++ b/packages/kernel-errors/src/errors/VatDeletedError.ts @@ -4,7 +4,16 @@ import { BaseError } from '../BaseError.ts'; import { marshaledErrorSchema, ErrorCode } from '../constants.ts'; import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; +/** + * Error indicating an operation was attempted on a vat that has been deleted. + */ export class VatDeletedError extends BaseError { + /** + * Creates a new VatDeletedError. + * + * @param vatId - The identifier of the deleted vat. + * @param options - Additional error options including cause and stack trace. + */ constructor(vatId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.VatDeleted, 'Vat was deleted.', { ...options, diff --git a/packages/kernel-errors/src/errors/VatNotFoundError.ts b/packages/kernel-errors/src/errors/VatNotFoundError.ts index d1a5d0643..15c08aff3 100644 --- a/packages/kernel-errors/src/errors/VatNotFoundError.ts +++ b/packages/kernel-errors/src/errors/VatNotFoundError.ts @@ -4,7 +4,16 @@ import { BaseError } from '../BaseError.ts'; import { marshaledErrorSchema, ErrorCode } from '../constants.ts'; import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; +/** + * Error indicating that a requested vat does not exist. + */ export class VatNotFoundError extends BaseError { + /** + * Creates a new VatNotFoundError. + * + * @param vatId - The identifier of the vat that was not found. + * @param options - Additional error options including cause and stack trace. + */ constructor(vatId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.VatNotFound, 'Vat does not exist.', { ...options, diff --git a/packages/kernel-language-model-service/package.json b/packages/kernel-language-model-service/package.json index 45d183c13..d51b2d84b 100644 --- a/packages/kernel-language-model-service/package.json +++ b/packages/kernel-language-model-service/package.json @@ -68,10 +68,10 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", "@metamask/streams": "workspace:^", "@ocap/repo-tools": "workspace:^", "@ts-bridge/cli": "^0.6.3", diff --git a/packages/kernel-language-model-service/src/ollama/base.test.ts b/packages/kernel-language-model-service/src/ollama/base.test.ts index 361d926ce..e1819b84b 100644 --- a/packages/kernel-language-model-service/src/ollama/base.test.ts +++ b/packages/kernel-language-model-service/src/ollama/base.test.ts @@ -126,7 +126,7 @@ describe('OllamaBaseService', () => { expect(mockClient.generate).toHaveBeenCalledWith({ model: 'llama2:7b', - // eslint-disable-next-line @typescript-eslint/naming-convention + keep_alive: -1, prompt: '', }); @@ -146,7 +146,7 @@ describe('OllamaBaseService', () => { expect(mockClient.generate).toHaveBeenCalledWith({ model: 'llama2:7b', - // eslint-disable-next-line @typescript-eslint/naming-convention + keep_alive: 0, prompt: '', }); diff --git a/packages/kernel-language-model-service/src/ollama/base.ts b/packages/kernel-language-model-service/src/ollama/base.ts index 66ef88fba..37b923422 100644 --- a/packages/kernel-language-model-service/src/ollama/base.ts +++ b/packages/kernel-language-model-service/src/ollama/base.ts @@ -69,11 +69,9 @@ export class OllamaBaseService const instance = { getInfo: async () => modelInfo, load: async () => { - // eslint-disable-next-line @typescript-eslint/naming-convention await ollama.generate({ model, keep_alive: -1, prompt: '' }); }, unload: async () => { - // eslint-disable-next-line @typescript-eslint/naming-convention await ollama.generate({ model, keep_alive: 0, prompt: '' }); }, sample: async (prompt: string, options?: Partial) => { diff --git a/packages/kernel-language-model-service/src/ollama/nodejs.test.ts b/packages/kernel-language-model-service/src/ollama/nodejs.test.ts index 882dcb1bd..7ad5d7ed2 100644 --- a/packages/kernel-language-model-service/src/ollama/nodejs.test.ts +++ b/packages/kernel-language-model-service/src/ollama/nodejs.test.ts @@ -83,7 +83,7 @@ describe('OllamaNodejsService', () => { expect(chunk).toMatchObject({ response, done: true, - // eslint-disable-next-line @typescript-eslint/naming-convention + done_reason: 'stop', }); } diff --git a/packages/kernel-language-model-service/src/ollama/types.ts b/packages/kernel-language-model-service/src/ollama/types.ts index 7df905da1..65f7e8289 100644 --- a/packages/kernel-language-model-service/src/ollama/types.ts +++ b/packages/kernel-language-model-service/src/ollama/types.ts @@ -39,7 +39,7 @@ export type OllamaNodejsConfig = { */ export const OllamaModelOptionsStruct = object({ // Ollama is pythonic, using snake_case for its options. - /* eslint-disable @typescript-eslint/naming-convention */ + temperature: optional(number()), top_p: optional(number()), top_k: optional(number()), @@ -47,7 +47,6 @@ export const OllamaModelOptionsStruct = object({ repeat_last_n: optional(number()), seed: optional(number()), num_ctx: optional(number()), - /* eslint-enable @typescript-eslint/naming-convention */ }); /** diff --git a/packages/kernel-language-model-service/test/utils.ts b/packages/kernel-language-model-service/test/utils.ts index 4d1798713..0189920fd 100644 --- a/packages/kernel-language-model-service/test/utils.ts +++ b/packages/kernel-language-model-service/test/utils.ts @@ -75,7 +75,7 @@ export const mockReadableStream = (chunks: object[]) => JSON.stringify({ ...chunks[chunks.length - 1], done: true, - // eslint-disable-next-line @typescript-eslint/naming-convention + done_reason: 'stop', }), ), diff --git a/packages/kernel-platforms/package.json b/packages/kernel-platforms/package.json index 4b0ee4f7d..88bb5cf21 100644 --- a/packages/kernel-platforms/package.json +++ b/packages/kernel-platforms/package.json @@ -67,11 +67,11 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", - "@metamask/utils": "^11.4.2", + "@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", + "@metamask/utils": "^11.9.0", "@ocap/repo-tools": "workspace:^", "@ts-bridge/cli": "^0.6.3", "@ts-bridge/shims": "^0.1.1", diff --git a/packages/kernel-rpc-methods/package.json b/packages/kernel-rpc-methods/package.json index 950e1d582..ed2246dd2 100644 --- a/packages/kernel-rpc-methods/package.json +++ b/packages/kernel-rpc-methods/package.json @@ -59,16 +59,16 @@ "@endo/promise-kit": "^1.1.13", "@metamask/kernel-utils": "workspace:^", "@metamask/logger": "workspace:^", - "@metamask/rpc-errors": "^7.0.2", + "@metamask/rpc-errors": "^7.0.3", "@metamask/superstruct": "^3.2.1", - "@metamask/utils": "^11.4.2" + "@metamask/utils": "^11.9.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/kernel-rpc-methods/src/RpcClient.ts b/packages/kernel-rpc-methods/src/RpcClient.ts index b82a32cde..186b1791e 100644 --- a/packages/kernel-rpc-methods/src/RpcClient.ts +++ b/packages/kernel-rpc-methods/src/RpcClient.ts @@ -23,6 +23,9 @@ export type SendMessage = ( payload: JsonRpcRequest | JsonRpcNotification, ) => Promise; +/** + * A typed JSON-RPC client that sends requests and notifications over a provided message channel. + */ export class RpcClient< // The class picks up its type from the `methods` argument, // so using `any` in this constraint is safe. @@ -41,6 +44,14 @@ export class RpcClient< readonly #logger: Logger; + /** + * Creates a new RpcClient instance. + * + * @param methods - The method specifications defining available RPC methods and their types. + * @param sendMessage - The function used to send JSON-RPC messages to the remote endpoint. + * @param prefix - A string prefix for generating unique message IDs. + * @param logger - The logger instance for debugging and error reporting. + */ constructor( methods: Methods, sendMessage: SendMessage, @@ -53,6 +64,14 @@ export class RpcClient< this.#logger = logger; } + /** + * Sends a JSON-RPC request with the specified message ID and awaits the result. + * + * @param method - The RPC method name to call. + * @param params - The parameters to pass to the method. + * @param id - The unique message ID for correlating the request with its response. + * @returns A promise that resolves to the validated result of the RPC call. + */ async #call>( method: Method, params: ExtractParams, @@ -118,6 +137,12 @@ export class RpcClient< return [id, await this.#call(method, params, id)]; } + /** + * Validates that a result matches the expected type defined in the method specification. + * + * @param method - The RPC method name used to look up the expected result type. + * @param result - The result value to validate against the method's result schema. + */ #assertResult>( method: Method, result: unknown, @@ -131,6 +156,13 @@ export class RpcClient< } } + /** + * Creates and sends a JSON-RPC request, returning a promise that resolves when a response is received. + * + * @param messageId - The unique ID to associate with the request for response correlation. + * @param payload - The JSON-RPC request payload to send. + * @returns A promise that resolves to the successful JSON-RPC response. + */ async #createMessage( messageId: string, payload: JsonRpcRequest, @@ -184,6 +216,11 @@ export class RpcClient< } } + /** + * Generates the next unique message ID by combining the prefix with an incrementing counter. + * + * @returns A unique string identifier for the next message. + */ #nextMessageId(): string { return `${this.#prefix}${this.#messageCounter()}`; } diff --git a/packages/kernel-shims/package.json b/packages/kernel-shims/package.json index 47c108c8b..eff3f6ba9 100644 --- a/packages/kernel-shims/package.json +++ b/packages/kernel-shims/package.json @@ -54,10 +54,10 @@ }, "devDependencies": { "@endo/bundle-source": "^4.1.2", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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:^", "@typescript-eslint/eslint-plugin": "^8.29.0", "@typescript-eslint/parser": "^8.29.0", diff --git a/packages/kernel-store/package.json b/packages/kernel-store/package.json index aacf0b6dd..8ef5f7be5 100644 --- a/packages/kernel-store/package.json +++ b/packages/kernel-store/package.json @@ -84,10 +84,10 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/kernel-store/src/sqlite/nodejs.test.ts b/packages/kernel-store/src/sqlite/nodejs.test.ts index 8407f98a4..ea8d63787 100644 --- a/packages/kernel-store/src/sqlite/nodejs.test.ts +++ b/packages/kernel-store/src/sqlite/nodejs.test.ts @@ -27,7 +27,7 @@ const mockDb = { transaction: vi.fn((fn) => fn), exec: vi.fn(), inTransaction: false, - // eslint-disable-next-line @typescript-eslint/naming-convention + _spStack: [] as string[], close: vi.fn(), }; diff --git a/packages/kernel-store/src/sqlite/nodejs.ts b/packages/kernel-store/src/sqlite/nodejs.ts index 7cfc2d0c3..421ba8c2c 100644 --- a/packages/kernel-store/src/sqlite/nodejs.ts +++ b/packages/kernel-store/src/sqlite/nodejs.ts @@ -1,6 +1,5 @@ import { Logger } from '@metamask/logger'; import type { Database as SqliteDatabase } from 'better-sqlite3'; -// eslint-disable-next-line @typescript-eslint/naming-convention import Sqlite from 'better-sqlite3'; import { mkdir } from 'node:fs/promises'; import { tmpdir } from 'node:os'; diff --git a/packages/kernel-store/src/sqlite/wasm.test.ts b/packages/kernel-store/src/sqlite/wasm.test.ts index f0d775191..5e1713802 100644 --- a/packages/kernel-store/src/sqlite/wasm.test.ts +++ b/packages/kernel-store/src/sqlite/wasm.test.ts @@ -29,9 +29,9 @@ const mockStatement = { const mockDb = { exec: vi.fn(), prepare: vi.fn(() => mockStatement), - // eslint-disable-next-line @typescript-eslint/naming-convention + _inTx: false, - // eslint-disable-next-line @typescript-eslint/naming-convention + _spStack: [] as string[], close: vi.fn(), }; diff --git a/packages/kernel-test/package.json b/packages/kernel-test/package.json index f0f070457..12138472c 100644 --- a/packages/kernel-test/package.json +++ b/packages/kernel-test/package.json @@ -58,7 +58,7 @@ "@metamask/logger": "workspace:^", "@metamask/ocap-kernel": "workspace:^", "@metamask/streams": "workspace:^", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "@ocap/kernel-language-model-service": "workspace:^", "@ocap/nodejs": "workspace:^", "@ocap/nodejs-test-workers": "workspace:^", @@ -66,9 +66,9 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@metamask/eslint-config": "^15.0.0", + "@metamask/eslint-config-nodejs": "^15.0.0", + "@metamask/eslint-config-typescript": "^15.0.0", "@ocap/cli": "workspace:^", "@ocap/repo-tools": "workspace:^", "@typescript-eslint/eslint-plugin": "^8.29.0", diff --git a/packages/kernel-ui/package.json b/packages/kernel-ui/package.json index 891e7f195..8cfee7b97 100644 --- a/packages/kernel-ui/package.json +++ b/packages/kernel-ui/package.json @@ -67,7 +67,7 @@ "@metamask/kernel-utils": "workspace:^", "@metamask/logger": "workspace:^", "@metamask/ocap-kernel": "workspace:^", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "tailwindcss": "^3.0.0" }, "peerDependencies": { @@ -76,10 +76,10 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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:^", "@solana/addresses": "^2.0.0", "@testing-library/dom": "^10.4.0", diff --git a/packages/kernel-utils/package.json b/packages/kernel-utils/package.json index 9d9da956b..0a68dacfc 100644 --- a/packages/kernel-utils/package.json +++ b/packages/kernel-utils/package.json @@ -82,15 +82,15 @@ "@endo/patterns": "^1.7.0", "@endo/promise-kit": "^1.1.13", "@metamask/superstruct": "^3.2.1", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "setimmediate": "^1.0.5" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", "@metamask/kernel-errors": "workspace:^", "@ocap/repo-tools": "workspace:^", "@ts-bridge/cli": "^0.6.3", diff --git a/packages/logger/package.json b/packages/logger/package.json index af54ee671..a2d5b2ca2 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -58,14 +58,14 @@ "dependencies": { "@metamask/kernel-utils": "workspace:^", "@metamask/streams": "workspace:^", - "@metamask/utils": "^11.4.2" + "@metamask/utils": "^11.9.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", "@metamask/kernel-shims": "workspace:^", "@ocap/repo-tools": "workspace:^", "@ts-bridge/cli": "^0.6.3", diff --git a/packages/logger/src/logger.ts b/packages/logger/src/logger.ts index 44e33c6c1..a29df85a4 100644 --- a/packages/logger/src/logger.ts +++ b/packages/logger/src/logger.ts @@ -70,14 +70,44 @@ const harden = globalThis.harden ?? ((value: unknown) => value); export class Logger { readonly #options: LoggerOptions; + /** + * Logs a message at the 'log' level. + * + * @param message - The message to log. + * @param args - Additional arguments to include in the log entry. + */ log: LogMethod; + /** + * Logs a message at the 'debug' level. + * + * @param message - The message to log. + * @param args - Additional arguments to include in the log entry. + */ debug: LogMethod; + /** + * Logs a message at the 'info' level. + * + * @param message - The message to log. + * @param args - Additional arguments to include in the log entry. + */ info: LogMethod; + /** + * Logs a message at the 'warn' level. + * + * @param message - The message to log. + * @param args - Additional arguments to include in the log entry. + */ warn: LogMethod; + /** + * Logs a message at the 'error' level. + * + * @param message - The message to log. + * @param args - Additional arguments to include in the log entry. + */ error: LogMethod; /** @@ -147,6 +177,13 @@ export class Logger { .catch((problem) => onError?.(problem)); } + /** + * Dispatches a log entry to all configured transports. + * + * @param options - Additional logger options to merge with the instance options. + * @param level - The severity level of the log entry. + * @param args - The message and additional data to include in the log entry. + */ #dispatch(options: LoggerOptions, level: LogLevel, ...args: LogArgs): void { const { transports, tags } = mergeOptions(this.#options, options); const [message, ...data] = args; diff --git a/packages/logger/src/options.ts b/packages/logger/src/options.ts index d64fd8dd1..5f1630d27 100644 --- a/packages/logger/src/options.ts +++ b/packages/logger/src/options.ts @@ -19,7 +19,7 @@ export const parseOptions = ( options: LoggerOptions | string | undefined, ): LoggerOptions => { // The default case catches whatever is not explicitly handled below. - // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check + switch (typeof options) { case 'object': if (!options.transports) { diff --git a/packages/nodejs-test-workers/package.json b/packages/nodejs-test-workers/package.json index a03e7d27c..60a72f88e 100644 --- a/packages/nodejs-test-workers/package.json +++ b/packages/nodejs-test-workers/package.json @@ -47,10 +47,10 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/nodejs/package.json b/packages/nodejs/package.json index f83467337..1dfd8e283 100644 --- a/packages/nodejs/package.json +++ b/packages/nodejs/package.json @@ -61,16 +61,16 @@ "@metamask/logger": "workspace:^", "@metamask/ocap-kernel": "workspace:^", "@metamask/streams": "workspace:^", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "@ocap/kernel-platforms": "workspace:^", "ses": "^1.14.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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/cli": "workspace:^", "@ocap/repo-tools": "workspace:^", "@ts-bridge/cli": "^0.6.3", diff --git a/packages/nodejs/src/kernel/PlatformServices.ts b/packages/nodejs/src/kernel/PlatformServices.ts index c21f69a5f..4008fcff7 100644 --- a/packages/nodejs/src/kernel/PlatformServices.ts +++ b/packages/nodejs/src/kernel/PlatformServices.ts @@ -23,6 +23,10 @@ const DEFAULT_WORKER_FILE = new URL( import.meta.url, ).pathname; +/** + * Node.js implementation of platform services for launching, managing, and + * terminating vat workers, as well as handling network communications. + */ export class NodejsPlatformServices implements PlatformServices { readonly #logger: Logger; diff --git a/packages/ocap-kernel/package.json b/packages/ocap-kernel/package.json index 0983a01bc..08f7e4a19 100644 --- a/packages/ocap-kernel/package.json +++ b/packages/ocap-kernel/package.json @@ -90,10 +90,10 @@ "@metamask/kernel-store": "workspace:^", "@metamask/kernel-utils": "workspace:^", "@metamask/logger": "workspace:^", - "@metamask/rpc-errors": "^7.0.2", + "@metamask/rpc-errors": "^7.0.3", "@metamask/streams": "workspace:^", "@metamask/superstruct": "^3.2.1", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "@multiformats/multiaddr": "^12.4.4", "@ocap/kernel-platforms": "workspace:^", "it-byte-stream": "^2.0.1", @@ -104,10 +104,10 @@ "uint8arrays": "^5.1.0" }, "devDependencies": { - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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/cli": "workspace:^", "@ocap/repo-tools": "workspace:^", "@ts-bridge/cli": "^0.6.3", diff --git a/packages/ocap-kernel/src/Kernel.ts b/packages/ocap-kernel/src/Kernel.ts index 0e5036993..27db21043 100644 --- a/packages/ocap-kernel/src/Kernel.ts +++ b/packages/ocap-kernel/src/Kernel.ts @@ -35,6 +35,9 @@ import { SubclusterManager } from './vats/SubclusterManager.ts'; import type { VatHandle } from './vats/VatHandle.ts'; import { VatManager } from './vats/VatManager.ts'; +/** + * + */ export class Kernel { /** Command channel from the controlling console/browser extension/test driver */ readonly #commandStream: DuplexStream; @@ -248,10 +251,7 @@ export class Kernel { * Initialize the remote comms object. * * @param options - Options for remote communications initialization. - * @param options.relays - The relays to use for the remote comms object. - * @param options.maxRetryAttempts - Maximum number of reconnection attempts. 0 = infinite (default). - * @param options.maxQueue - Maximum number of messages to queue per peer while reconnecting (default: 200). - * @returns a promise that resolves when initialization is complete. + * @returns A promise that resolves when initialization is complete. */ async initRemoteComms(options?: RemoteCommsOptions): Promise { await this.#remoteManager.initRemoteComms(options); @@ -262,7 +262,6 @@ export class Kernel { * * @param to - The peer ID of the remote kernel. * @param message - The message to send. - * @returns a promise for the result of the message send. */ async sendRemoteMessage(to: string, message: string): Promise { await this.#remoteManager.sendRemoteMessage(to, message); @@ -326,7 +325,7 @@ export class Kernel { * @param target - The object to which the message is directed. * @param method - The method to be invoked. * @param args - Message arguments. - * @returns a promise for the (CapData encoded) result of the message invocation. + * @returns A promise for the CapData encoded result of the message invocation. */ async queueMessage( target: KRef, @@ -394,7 +393,7 @@ export class Kernel { /** * Gets all subclusters. * - * @returns An array of subcluster information records. + * @returns An array of all subcluster records. */ getSubclusters(): Subcluster[] { return this.#subclusterManager.getSubclusters(); @@ -404,7 +403,7 @@ export class Kernel { * Checks if a vat belongs to a specific subcluster. * * @param vatId - The ID of the vat to check. - * @param subclusterId - The ID of the subcluster to check against. + * @param subclusterId - The ID of the subcluster to check membership against. * @returns True if the vat belongs to the specified subcluster, false otherwise. */ isVatInSubcluster(vatId: VatId, subclusterId: string): boolean { @@ -414,8 +413,8 @@ export class Kernel { /** * Gets all vat IDs that belong to a specific subcluster. * - * @param subclusterId - The ID of the subcluster to get vats for. - * @returns An array of vat IDs that belong to the specified subcluster. + * @param subclusterId - The ID of the subcluster to retrieve vat IDs from. + * @returns An array of vat IDs belonging to the specified subcluster. */ getSubclusterVats(subclusterId: string): VatId[] { return this.#subclusterManager.getSubclusterVats(subclusterId); @@ -424,7 +423,7 @@ export class Kernel { /** * Restarts a vat. * - * @param vatId - The ID of the vat. + * @param vatId - The ID of the vat to restart. * @returns A promise for the restarted vat handle. */ async restartVat(vatId: VatId): Promise { @@ -434,9 +433,9 @@ export class Kernel { /** * Terminate a vat with extreme prejudice. * - * @param vatId - The ID of the vat. - * @param reason - If the vat is being terminated, the reason for the termination. - * @returns A promise that resolves when the vat is terminated. + * @param vatId - The ID of the vat to terminate. + * @param reason - The reason for the termination, if any. + * @returns A promise that resolves when the vat has been terminated. */ async terminateVat(vatId: VatId, reason?: CapData): Promise { return this.#vatManager.terminateVat(vatId, reason); @@ -453,8 +452,9 @@ export class Kernel { /** * Gets an endpoint by its ID. * - * @param endpointId - The ID of the endpoint. - * @returns The endpoint, or undefined if not found. + * @param endpointId - The ID of the endpoint to retrieve. + * @returns The endpoint handle for the given ID. + * @throws If the endpoint ID is invalid (neither a vat ID nor a remote ID). */ #getEndpoint(endpointId: EndpointId): EndpointHandle { if (isVatId(endpointId)) { @@ -470,7 +470,7 @@ export class Kernel { /** * Gets a list of the IDs of all running vats. * - * @returns An array of vat IDs. + * @returns An array of all running vat IDs. */ getVatIds(): VatId[] { return this.#vatManager.getVatIds(); @@ -479,7 +479,7 @@ export class Kernel { /** * Gets a list of information about all running vats. * - * @returns An array of vat information records. + * @returns An array of vat information records containing ID, config, and subcluster ID. */ getVats(): { id: VatId; @@ -513,7 +513,7 @@ export class Kernel { * Get the current kernel status, defined as the current cluster configuration * and a list of all running vats. * - * @returns The current kernel status containing vats and subclusters information. + * @returns A promise for the current kernel status containing vats, subclusters, and remote comms information. */ async getStatus(): Promise { await this.#kernelQueue.waitForCrank(); @@ -541,8 +541,8 @@ export class Kernel { /** * Pin a vat root. * - * @param vatId - The ID of the vat. - * @returns The KRef of the vat root. + * @param vatId - The ID of the vat whose root to pin. + * @returns The KRef of the pinned vat root. */ pinVatRoot(vatId: VatId): KRef { return this.#vatManager.pinVatRoot(vatId); @@ -551,7 +551,7 @@ export class Kernel { /** * Unpin a vat root. * - * @param vatId - The ID of the vat. + * @param vatId - The ID of the vat whose root to unpin. */ unpinVatRoot(vatId: VatId): void { this.#vatManager.unpinVatRoot(vatId); @@ -560,8 +560,8 @@ export class Kernel { /** * Ping a vat. * - * @param vatId - The ID of the vat. - * @returns A promise that resolves to the result of the ping. + * @param vatId - The ID of the vat to ping. + * @returns A promise that resolves to the ping result. */ async pingVat(vatId: VatId): Promise { return this.#vatManager.pingVat(vatId); diff --git a/packages/ocap-kernel/src/KernelQueue.ts b/packages/ocap-kernel/src/KernelQueue.ts index ba6ef44e4..f537ec648 100644 --- a/packages/ocap-kernel/src/KernelQueue.ts +++ b/packages/ocap-kernel/src/KernelQueue.ts @@ -40,6 +40,12 @@ export class KernelQueue { /** Thunk to signal run queue transition from empty to non-empty */ #wakeUpTheRunQueue: (() => void) | null; + /** + * Construct a new KernelQueue instance. + * + * @param kernelStore - The kernel's persistent state store. + * @param terminateVat - Function to terminate a vat with an optional reason. + */ constructor( kernelStore: KernelStore, terminateVat: (vatId: VatId, reason?: CapData) => Promise, @@ -211,7 +217,7 @@ export class KernelQueue { * This method can be called by external operations to ensure they don't interfere * with ongoing kernel operations. * - * @returns A promise that resolves when the current crank is finished. + * @returns A promise that resolves when the current crank is complete. */ async waitForCrank(): Promise { return this.#kernelStore.waitForCrank(); diff --git a/packages/ocap-kernel/src/KernelRouter.ts b/packages/ocap-kernel/src/KernelRouter.ts index 2a612925c..53fafbb55 100644 --- a/packages/ocap-kernel/src/KernelRouter.ts +++ b/packages/ocap-kernel/src/KernelRouter.ts @@ -264,6 +264,13 @@ export class KernelRouter { return crankResults; } + /** + * Delivers a message to a kernel service object. + * + * @param target - The kernel reference of the target service object. + * @param message - The message to deliver to the service. + * @returns A promise that resolves to the crank results indicating the delivery was to the kernel. + */ async #deliverKernelServiceMessage( target: KRef, message: Message, diff --git a/packages/ocap-kernel/src/KernelServiceManager.ts b/packages/ocap-kernel/src/KernelServiceManager.ts index 884b6a35d..5fcb74fb8 100644 --- a/packages/ocap-kernel/src/KernelServiceManager.ts +++ b/packages/ocap-kernel/src/KernelServiceManager.ts @@ -37,6 +37,14 @@ export class KernelServiceManager { /** Objects providing custom or kernel-privileged services to vats, indexed by kref */ readonly #kernelServicesByObject: Map = new Map(); + /** + * Creates a new KernelServiceManager instance. + * + * @param options - Constructor options. + * @param options.kernelStore - The kernel's persistent state store. + * @param options.kernelQueue - The kernel's message queue for scheduling deliveries. + * @param options.logger - Logger instance for debugging and diagnostics. + */ constructor({ kernelStore, kernelQueue, diff --git a/packages/ocap-kernel/src/remotes/OcapURLManager.ts b/packages/ocap-kernel/src/remotes/OcapURLManager.ts index 74443c88c..ab55f2813 100644 --- a/packages/ocap-kernel/src/remotes/OcapURLManager.ts +++ b/packages/ocap-kernel/src/remotes/OcapURLManager.ts @@ -23,6 +23,12 @@ export class OcapURLManager { /** OCAP URL redemption service object */ readonly #ocapURLRedemptionService: object; + /** + * Creates a new OcapURLManager instance. + * + * @param options - Constructor options. + * @param options.remoteManager - The remote manager for handling cross-kernel communications. + */ constructor({ remoteManager }: OcapURLManagerConstructorProps) { this.#remoteManager = remoteManager; diff --git a/packages/ocap-kernel/src/remotes/RemoteHandle.ts b/packages/ocap-kernel/src/remotes/RemoteHandle.ts index c7da85079..71e3f72a9 100644 --- a/packages/ocap-kernel/src/remotes/RemoteHandle.ts +++ b/packages/ocap-kernel/src/remotes/RemoteHandle.ts @@ -59,6 +59,9 @@ type RedeemURLReply = { type RemoteCommand = Delivery | RedeemURLRequest | RedeemURLReply; +/** + * Handles communication with a remote kernel endpoint over the network. + */ export class RemoteHandle implements EndpointHandle { /** The ID of the remote connection this is the RemoteHandle for. */ readonly remoteId: RemoteId; diff --git a/packages/ocap-kernel/src/remotes/RemoteManager.ts b/packages/ocap-kernel/src/remotes/RemoteManager.ts index c337cae84..1711ffd12 100644 --- a/packages/ocap-kernel/src/remotes/RemoteManager.ts +++ b/packages/ocap-kernel/src/remotes/RemoteManager.ts @@ -52,6 +52,16 @@ export class RemoteManager { /** Handler for incoming remote messages */ #messageHandler: RemoteMessageHandler | undefined; + /** + * Creates a new RemoteManager instance. + * + * @param options - Constructor options. + * @param options.platformServices - Platform-specific services for network communication. + * @param options.kernelStore - The kernel's persistent state store. + * @param options.kernelQueue - The kernel's message queue for scheduling deliveries. + * @param options.logger - Logger instance for debugging and diagnostics. + * @param options.keySeed - Seed for generating the kernel's cryptographic key pair. + */ constructor({ platformServices, kernelStore, @@ -210,6 +220,13 @@ export class RemoteManager { return remote; } + /** + * Initializes a remote handle for communication with a remote kernel. + * + * @param remoteId - The unique identifier for the remote kernel. + * @param info - Information about the remote including peer ID and connection hints. + * @returns A handle for communicating with the remote kernel. + */ #initializeRemote(remoteId: RemoteId, info: RemoteInfo): RemoteHandle { const { peerId, hints } = info; const remoteComms = this.getRemoteComms(); diff --git a/packages/ocap-kernel/src/vats/SubclusterManager.ts b/packages/ocap-kernel/src/vats/SubclusterManager.ts index 2ea082745..b0293e3c6 100644 --- a/packages/ocap-kernel/src/vats/SubclusterManager.ts +++ b/packages/ocap-kernel/src/vats/SubclusterManager.ts @@ -45,6 +45,16 @@ export class SubclusterManager { args: unknown[], ) => Promise>; + /** + * Creates a new SubclusterManager instance. + * + * @param options - Constructor options. + * @param options.kernelStore - The kernel's persistent state store. + * @param options.kernelQueue - The kernel's message queue for scheduling deliveries. + * @param options.vatManager - Manager for creating and managing vat instances. + * @param options.getKernelService - Function to retrieve a kernel service by its kref. + * @param options.queueMessage - Function to queue messages for delivery to targets. + */ constructor({ kernelStore, kernelQueue, diff --git a/packages/ocap-kernel/src/vats/VatHandle.ts b/packages/ocap-kernel/src/vats/VatHandle.ts index 8af941c2e..2b3c97635 100644 --- a/packages/ocap-kernel/src/vats/VatHandle.ts +++ b/packages/ocap-kernel/src/vats/VatHandle.ts @@ -44,6 +44,9 @@ type VatConstructorProps = { logger?: Logger | undefined; }; +/** + * Handles communication with and lifecycle management of a vat. + */ export class VatHandle implements EndpointHandle { /** The ID of the vat this is the VatHandle for */ readonly vatId: VatId; diff --git a/packages/ocap-kernel/src/vats/VatManager.test.ts b/packages/ocap-kernel/src/vats/VatManager.test.ts index cad8e86ba..0e072ff4c 100644 --- a/packages/ocap-kernel/src/vats/VatManager.test.ts +++ b/packages/ocap-kernel/src/vats/VatManager.test.ts @@ -120,7 +120,7 @@ describe('VatManager', () => { { vatID: 'v1' as VatId, vatConfig: createMockVatConfig('vat1') }, { vatID: 'v2' as VatId, vatConfig: createMockVatConfig('vat2') }, ]; - // eslint-disable-next-line jsdoc/require-jsdoc + function* mockGenerator() { yield* vatRecords; } diff --git a/packages/ocap-kernel/src/vats/VatManager.ts b/packages/ocap-kernel/src/vats/VatManager.ts index 315770e9d..7947c9dc4 100644 --- a/packages/ocap-kernel/src/vats/VatManager.ts +++ b/packages/ocap-kernel/src/vats/VatManager.ts @@ -40,6 +40,15 @@ export class VatManager { /** Logger for outputting messages (such as errors) to the console */ readonly #logger: Logger; + /** + * Creates a new VatManager instance. + * + * @param options - Constructor options. + * @param options.platformServices - Platform-specific services for launching vat workers. + * @param options.kernelStore - The kernel's persistent state store. + * @param options.kernelQueue - The kernel's message queue for scheduling deliveries. + * @param options.logger - Logger instance for debugging and diagnostics. + */ constructor({ platformServices, kernelStore, diff --git a/packages/ocap-kernel/src/vats/VatSupervisor.ts b/packages/ocap-kernel/src/vats/VatSupervisor.ts index e56bb86c9..e0adbdf13 100644 --- a/packages/ocap-kernel/src/vats/VatSupervisor.ts +++ b/packages/ocap-kernel/src/vats/VatSupervisor.ts @@ -61,6 +61,9 @@ const marshal = makeMarshal(undefined, undefined, { serializeBodyFormat: 'smallcaps', }); +/** + * Supervises a vat's execution, managing its lifecycle and communication with the kernel. + */ export class VatSupervisor { /** The id of the vat being supervised */ readonly id: VatId; @@ -218,6 +221,12 @@ export class VatSupervisor { return ['ok', null]; } + /** + * Delivers a message to the vat and captures the result. + * + * @param params - The delivery object containing the message to deliver. + * @returns A tuple indicating success or failure along with any error information. + */ async #deliver(params: VatDeliveryObject): Promise { if (!this.#dispatch) { throw new Error(`cannot deliver before vat is loaded`); diff --git a/packages/ocap-kernel/test/remotes-mocks.ts b/packages/ocap-kernel/test/remotes-mocks.ts index 734cd3b97..c55dc3d77 100644 --- a/packages/ocap-kernel/test/remotes-mocks.ts +++ b/packages/ocap-kernel/test/remotes-mocks.ts @@ -29,6 +29,11 @@ export type MockRemotesConfig = { export class MockRemotesFactory { config: MockRemotesConfig; + /** + * Creates a new MockRemotesFactory instance. + * + * @param config - Configuration options for the mock factory. + */ constructor(config: MockRemotesConfig = {}) { this.config = { peerId: 'test-peer-id', diff --git a/packages/omnium-gatherum/package.json b/packages/omnium-gatherum/package.json index 86c010863..e97cedf61 100644 --- a/packages/omnium-gatherum/package.json +++ b/packages/omnium-gatherum/package.json @@ -51,17 +51,17 @@ "@metamask/logger": "workspace:^", "@metamask/ocap-kernel": "workspace:^", "@metamask/streams": "workspace:^", - "@metamask/utils": "^11.4.2", + "@metamask/utils": "^11.9.0", "react": "^17.0.2", "react-dom": "^17.0.2", "ses": "^1.14.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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/cli": "workspace:^", "@ocap/repo-tools": "workspace:^", "@playwright/test": "^1.54.2", diff --git a/packages/remote-iterables/package.json b/packages/remote-iterables/package.json index 3092d7ee9..e9e0622a9 100644 --- a/packages/remote-iterables/package.json +++ b/packages/remote-iterables/package.json @@ -54,10 +54,10 @@ "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", "@endo/promise-kit": "^1.1.13", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/remote-iterables/src/reader-ref.ts b/packages/remote-iterables/src/reader-ref.ts index 644792e0a..5258646d3 100644 --- a/packages/remote-iterables/src/reader-ref.ts +++ b/packages/remote-iterables/src/reader-ref.ts @@ -47,6 +47,11 @@ export const asyncIterate = ( export const makeIteratorRef = (iterable: SomehowAsyncIterable) => { const iterator = asyncIterate(iterable); return makeExo('AsyncIterator', AsyncIteratorInterface, { + /** + * Gets the next value from the iterator. + * + * @returns A promise that resolves to the next iterator result. + */ async next() { return iterator.next(undefined); }, @@ -74,6 +79,11 @@ export const makeIteratorRef = (iterable: SomehowAsyncIterable) => { } return harden({ done: true, value: undefined }); }, + /** + * Returns the async iterator for use with for-await-of loops. + * + * @returns The iterator itself. + */ [Symbol.asyncIterator]() { return this; }, diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index d152f196e..5fb569785 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -41,9 +41,9 @@ "test:watch": "vitest --config vitest.config.ts" }, "devDependencies": { - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@metamask/eslint-config": "^15.0.0", + "@metamask/eslint-config-nodejs": "^15.0.0", + "@metamask/eslint-config-typescript": "^15.0.0", "@metamask/superstruct": "^3.2.1", "@playwright/test": "^1.54.2", "@typescript-eslint/eslint-plugin": "^8.29.0", diff --git a/packages/streams/package.json b/packages/streams/package.json index 4adf4d634..cb9706acc 100644 --- a/packages/streams/package.json +++ b/packages/streams/package.json @@ -73,14 +73,14 @@ "@metamask/kernel-errors": "workspace:^", "@metamask/kernel-utils": "workspace:^", "@metamask/superstruct": "^3.2.1", - "@metamask/utils": "^11.4.2" + "@metamask/utils": "^11.9.0" }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/packages/streams/src/BaseDuplexStream.ts b/packages/streams/src/BaseDuplexStream.ts index a935388a1..aed522fd3 100644 --- a/packages/streams/src/BaseDuplexStream.ts +++ b/packages/streams/src/BaseDuplexStream.ts @@ -124,6 +124,12 @@ export abstract class BaseDuplexStream< */ write: (value: Write) => Promise>; + /** + * Constructs a new {@link BaseDuplexStream}. + * + * @param reader - The underlying reader for the duplex stream. + * @param writer - The underlying writer for the duplex stream. + */ constructor(reader: ReadStream, writer: WriteStream) { // Set a catch handler to avoid unhandled rejection errors. The promise may // reject before reads or writes occur, in which case there are no handlers. @@ -159,6 +165,9 @@ export abstract class BaseDuplexStream< harden(this); } + /** + * Resets the synchronization status to idle and creates a new promise kit. + */ #resetSynchronizationStatus(): void { this.#synchronizationStatus = SynchronizationStatus.Idle; this.#syncKit = makePromiseKit(); @@ -242,6 +251,9 @@ export abstract class BaseDuplexStream< } } + /** + * Completes the synchronization by resolving the sync promise. Idempotent. + */ #completeSynchronization(): void { if (isEnded(this.#synchronizationStatus)) { return; @@ -251,6 +263,11 @@ export abstract class BaseDuplexStream< this.#syncKit.resolve(); } + /** + * Fails the synchronization by rejecting the sync promise with the given error. Idempotent. + * + * @param error - The error to reject the sync promise with. + */ #failSynchronization(error: Error): void { if (isEnded(this.#synchronizationStatus)) { return; @@ -260,6 +277,11 @@ export abstract class BaseDuplexStream< this.#syncKit.reject(error); } + /** + * Returns the async iterator for this stream. + * + * @returns This stream as an async iterator. + */ [Symbol.asyncIterator](): typeof this { return this; } diff --git a/packages/streams/src/BaseStream.ts b/packages/streams/src/BaseStream.ts index 0e96c14fb..dd98d2073 100644 --- a/packages/streams/src/BaseStream.ts +++ b/packages/streams/src/BaseStream.ts @@ -139,11 +139,11 @@ export class BaseReader implements Reader { /** * Constructs a {@link BaseReader}. * - * @param args - Options bag. - * @param args.name - The name of the stream, for logging purposes. Defaults to the class name. + * @param options - Options bag for configuring the reader. + * @param options.name - The name of the stream, for logging purposes. Defaults to the class name. + * @param options.onEnd - A function that is called when the stream ends. For any cleanup that * should happen when the stream ends, such as closing a message port. - * @param args.onEnd - A function that is called when the stream ends. For any cleanup that - * @param args.validateInput - A function that validates input from the transport. + * @param options.validateInput - A function that validates input from the transport. */ constructor({ name, onEnd, validateInput }: BaseReaderArgs) { this.#name = name ?? this.constructor.name; @@ -195,6 +195,11 @@ export class BaseReader implements Reader { this.#buffer.put(makePendingResult(unmarshaled)); }; + /** + * Handles an input error by putting it into the buffer and ending the stream. + * + * @param error - The error to handle. + */ async #handleInputError(error: Error): Promise { if (!this.#buffer.hasPendingReads()) { this.#buffer.put(error); @@ -215,6 +220,11 @@ export class BaseReader implements Reader { await onEndP; } + /** + * Returns the async iterator for this stream. + * + * @returns This stream as an async iterator. + */ [Symbol.asyncIterator](): typeof this { return this; } @@ -287,10 +297,10 @@ export class BaseWriter implements Writer { /** * Constructs a {@link BaseWriter}. * - * @param args - Options bag. - * @param args.onDispatch - A function that dispatches messages over the underlying transport mechanism. - * @param args.onEnd - A function that is called when the stream ends. For any cleanup that - * @param args.name - The name of the stream, for logging purposes. Defaults to the class name. + * @param options - Options bag for configuring the writer. + * @param options.onDispatch - A function that dispatches messages over the underlying transport mechanism. + * @param options.name - The name of the stream, for logging purposes. Defaults to the class name. + * @param options.onEnd - A function that is called when the stream ends. For any cleanup that * should happen when the stream ends, such as closing a message port. */ constructor({ name, onDispatch, onEnd }: BaseWriterArgs) { @@ -344,6 +354,11 @@ export class BaseWriter implements Writer { } } + /** + * Ends the stream and calls the onEnd callback. Idempotent. + * + * @param error - The error to end the stream with. + */ async #end(error?: Error): Promise { this.#isDone = true; const onEndP = this.#onEnd?.(error); @@ -351,6 +366,11 @@ export class BaseWriter implements Writer { await onEndP; } + /** + * Returns the async iterator for this stream. + * + * @returns This stream as an async iterator. + */ [Symbol.asyncIterator](): typeof this { return this; } diff --git a/packages/streams/src/browser/ChromeRuntimeStream.ts b/packages/streams/src/browser/ChromeRuntimeStream.ts index 8ca23dbb1..28174adda 100644 --- a/packages/streams/src/browser/ChromeRuntimeStream.ts +++ b/packages/streams/src/browser/ChromeRuntimeStream.ts @@ -67,6 +67,16 @@ export class ChromeRuntimeReader extends BaseReader { readonly #extensionId: string; + /** + * Constructs a new {@link ChromeRuntimeReader}. + * + * @param runtime - The Chrome runtime API object. + * @param target - The target context (e.g., 'background', 'offscreen', 'popup'). + * @param source - The source context that messages are expected from. + * @param options - Options bag for configuring the reader. + * @param options.validateInput - A function that validates input from the transport. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor( runtime: ChromeRuntime, target: ChromeRuntimeTarget, @@ -99,6 +109,12 @@ export class ChromeRuntimeReader extends BaseReader { harden(this); } + /** + * Handles incoming messages from the Chrome runtime. + * + * @param message - The message received from the Chrome runtime. + * @param sender - The sender information for the message. + */ #onMessage(message: unknown, sender: ChromeMessageSender): void { if (sender.id !== this.#extensionId) { return; @@ -143,6 +159,16 @@ harden(ChromeRuntimeReader); * - The module-level documentation for more details. */ export class ChromeRuntimeWriter extends BaseWriter { + /** + * Constructs a new {@link ChromeRuntimeWriter}. + * + * @param runtime - The Chrome runtime API object. + * @param target - The target context to send messages to. + * @param source - The source context identifying where messages originate. + * @param options - Options bag for configuring the writer. + * @param options.name - The name of the stream, for logging purposes. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor( runtime: ChromeRuntime, target: ChromeRuntimeTarget, @@ -183,6 +209,14 @@ export class ChromeRuntimeDuplexStream< Write, ChromeRuntimeWriter > { + /** + * Constructs a new {@link ChromeRuntimeDuplexStream}. + * + * @param runtime - The Chrome runtime API object. + * @param localTarget - The local target context for this stream. + * @param remoteTarget - The remote target context to communicate with. + * @param validateInput - A function that validates input from the transport. + */ constructor( runtime: ChromeRuntime, localTarget: ChromeRuntimeTarget, @@ -217,6 +251,15 @@ export class ChromeRuntimeDuplexStream< harden(this); } + /** + * Creates and synchronizes a new {@link ChromeRuntimeDuplexStream}. + * + * @param runtime - The Chrome runtime API object. + * @param localTarget - The local target context for this stream. + * @param remoteTarget - The remote target context to communicate with. + * @param validateInput - A function that validates input from the transport. + * @returns A synchronized duplex stream. + */ static async make( runtime: ChromeRuntime, localTarget: ChromeRuntimeTarget, diff --git a/packages/streams/src/browser/MessagePortStream.ts b/packages/streams/src/browser/MessagePortStream.ts index ab051e3f1..2573e65e5 100644 --- a/packages/streams/src/browser/MessagePortStream.ts +++ b/packages/streams/src/browser/MessagePortStream.ts @@ -44,6 +44,14 @@ import type { Dispatchable } from '../utils.ts'; * - The module-level documentation for more details. */ export class MessagePortReader extends BaseReader { + /** + * Constructs a new {@link MessagePortReader}. + * + * @param port - The message port to read from. + * @param options - Options bag for configuring the reader. + * @param options.validateInput - A function that validates input from the transport. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor( port: MessagePort, { validateInput, onEnd }: BaseReaderArgs = {}, @@ -83,6 +91,14 @@ harden(MessagePortReader); * - The module-level documentation for more details. */ export class MessagePortWriter extends BaseWriter { + /** + * Constructs a new {@link MessagePortWriter}. + * + * @param port - The message port to write to. + * @param options - Options bag for configuring the writer. + * @param options.name - The name of the stream, for logging purposes. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor( port: MessagePort, { name, onEnd }: Omit, 'onDispatch'> = {}, @@ -101,6 +117,9 @@ export class MessagePortWriter extends BaseWriter { } harden(MessagePortWriter); +/** + * A duplex stream over a {@link MessagePort}. + */ export class MessagePortDuplexStream< Read, Write = Read, @@ -110,6 +129,12 @@ export class MessagePortDuplexStream< Write, MessagePortWriter > { + /** + * Constructs a new {@link MessagePortDuplexStream}. + * + * @param port - The message port to use for bidirectional communication. + * @param validateInput - A function that validates input from the transport. + */ constructor(port: MessagePort, validateInput?: ValidateInput) { let writer: MessagePortWriter; // eslint-disable-line prefer-const const reader = new MessagePortReader(port, { @@ -128,6 +153,13 @@ export class MessagePortDuplexStream< super(reader, writer); } + /** + * Creates and synchronizes a new {@link MessagePortDuplexStream}. + * + * @param port - The message port to use for bidirectional communication. + * @param validateInput - A function that validates input from the transport. + * @returns A synchronized duplex stream. + */ static async make( port: MessagePort, validateInput?: ValidateInput, diff --git a/packages/streams/src/browser/PostMessageStream.ts b/packages/streams/src/browser/PostMessageStream.ts index 2069682f7..f362823d5 100644 --- a/packages/streams/src/browser/PostMessageStream.ts +++ b/packages/streams/src/browser/PostMessageStream.ts @@ -44,6 +44,15 @@ type PostMessageReaderArgs = BaseReaderArgs & { * @see {@link PostMessageWriter} for the corresponding writable stream. */ export class PostMessageReader extends BaseReader { + /** + * Constructs a new {@link PostMessageReader}. + * + * @param options - Options bag for configuring the reader. + * @param options.messageTarget - The target to listen for messages on. + * @param options.validateInput - A function that validates input from the transport. + * @param options.onEnd - A function that is called when the stream ends. + * @param options.messageEventMode - Whether to pass the message event or just the data to the stream. + */ constructor({ validateInput, onEnd, @@ -83,6 +92,12 @@ export type PostMessageEnvelope = { transfer: Transferable[]; }; +/** + * Checks if the value is a post message envelope with a payload and transfer array. + * + * @param value - The value to check. + * @returns True if the value is a post message envelope. + */ const isPostMessageEnvelope = ( value: unknown, ): value is PostMessageEnvelope => @@ -96,6 +111,14 @@ const isPostMessageEnvelope = ( * @see {@link PostMessageReader} for the corresponding readable stream. */ export class PostMessageWriter extends BaseWriter { + /** + * Constructs a new {@link PostMessageWriter}. + * + * @param messageTarget - The target to post messages to. + * @param options - Options bag for configuring the writer. + * @param options.name - The name of the stream, for logging purposes. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor( messageTarget: PostMessageTarget, { name, onEnd }: Omit, 'onDispatch'> = {}, @@ -133,6 +156,14 @@ export class PostMessageDuplexStream< Write, PostMessageWriter > { + /** + * Constructs a new {@link PostMessageDuplexStream}. + * + * @param options - Options bag for configuring the duplex stream. + * @param options.messageTarget - The target for sending and receiving messages. + * @param options.validateInput - A function that validates input from the transport. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor({ messageTarget, validateInput, @@ -159,6 +190,12 @@ export class PostMessageDuplexStream< super(reader, writer); } + /** + * Creates and synchronizes a new {@link PostMessageDuplexStream}. + * + * @param args - The options for configuring the duplex stream. + * @returns A synchronized duplex stream. + */ static async make( args: PostMessageDuplexStreamArgs, ): Promise> { diff --git a/packages/streams/src/node/NodeWorkerStream.ts b/packages/streams/src/node/NodeWorkerStream.ts index 897c940d8..97533cd6c 100644 --- a/packages/streams/src/node/NodeWorkerStream.ts +++ b/packages/streams/src/node/NodeWorkerStream.ts @@ -29,6 +29,14 @@ export type NodePort = { * - The module-level documentation for more details. */ export class NodeWorkerReader extends BaseReader { + /** + * Constructs a new {@link NodeWorkerReader}. + * + * @param port - The node worker port to read from. + * @param options - Options bag for configuring the reader. + * @param options.validateInput - A function that validates input from the transport. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor( port: NodePort, { validateInput, onEnd }: BaseReaderArgs = {}, @@ -55,6 +63,14 @@ harden(NodeWorkerReader); * - The module-level documentation for more details. */ export class NodeWorkerWriter extends BaseWriter { + /** + * Constructs a new {@link NodeWorkerWriter}. + * + * @param port - The node worker port to write to. + * @param options - Options bag for configuring the writer. + * @param options.name - The name of the stream, for logging purposes. + * @param options.onEnd - A function that is called when the stream ends. + */ constructor( port: NodePort, { name, onEnd }: Omit, 'onDispatch'> = {}, @@ -71,6 +87,9 @@ export class NodeWorkerWriter extends BaseWriter { } harden(NodeWorkerWriter); +/** + * A duplex stream over a Node worker port. + */ export class NodeWorkerDuplexStream< Read, Write = Read, @@ -80,6 +99,12 @@ export class NodeWorkerDuplexStream< Write, NodeWorkerWriter > { + /** + * Constructs a new {@link NodeWorkerDuplexStream}. + * + * @param port - The node worker port for bidirectional communication. + * @param validateInput - A function that validates input from the transport. + */ constructor(port: NodePort, validateInput?: ValidateInput) { let writer: NodeWorkerWriter; // eslint-disable-line prefer-const const reader = new NodeWorkerReader(port, { @@ -98,6 +123,13 @@ export class NodeWorkerDuplexStream< super(reader, writer); } + /** + * Creates and synchronizes a new {@link NodeWorkerDuplexStream}. + * + * @param port - The node worker port for bidirectional communication. + * @param validateInput - A function that validates input from the transport. + * @returns A synchronized duplex stream. + */ static async make( port: NodePort, validateInput?: ValidateInput, diff --git a/packages/streams/src/split.ts b/packages/streams/src/split.ts index e2098425c..893577dfe 100644 --- a/packages/streams/src/split.ts +++ b/packages/streams/src/split.ts @@ -4,12 +4,28 @@ import type { DuplexStream } from './BaseDuplexStream.ts'; import { BaseReader } from './BaseStream.ts'; import type { BaseReaderArgs, ReceiveInput } from './BaseStream.ts'; +/** + * A reader for use within {@link split} that reads from a reader and forwards + * writes to a parent. The reader should output a subset of the parent stream's values based + * on some predicate. + */ class SplitReader extends BaseReader { + /** + * Constructs a new {@link SplitReader}. + * + * @param args - The arguments to pass to the base reader. + */ // eslint-disable-next-line no-restricted-syntax private constructor(args: BaseReaderArgs) { super(args); } + /** + * Creates a new {@link SplitReader}. + * + * @param args - The arguments to pass to the base reader. + * @returns A new {@link SplitReader} and the receive input function. + */ static make( args: BaseReaderArgs, ): [SplitReader, ReceiveInput] { @@ -31,6 +47,12 @@ class SplitStream readonly #reader: SplitReader; + /** + * Constructs a new {@link SplitStream}. + * + * @param parent - The parent stream to read from. + * @param reader - The reader to use to read from the parent stream. + */ constructor( parent: DuplexStream, reader: SplitReader, @@ -40,6 +62,12 @@ class SplitStream harden(this); } + /** + * Constructs a new {@link SplitStream}. + * + * @param parent - The parent stream to read from. + * @returns A new {@link SplitStream} and the receive input function. + */ static make( parent: DuplexStream, ): { @@ -53,41 +81,84 @@ class SplitStream return { stream, receiveInput }; } + /** + * Reads the next value from the stream. + * + * @returns The next value from the stream. + */ async next(): Promise> { return this.#reader.next(); } + /** + * Writes a value to the stream. + * + * @param value - The value to write to the stream. + * @returns The result of writing the value. + */ async write(value: Write): Promise> { return this.#parent.write(value); } + /** + * Drains the stream by passing each value to a handler function. + * + * @param handler - The function that will receive each value from the stream. + */ async drain(handler: (value: Read) => void | Promise): Promise { for await (const value of this.#reader) { await handler(value); } } + /** + * Pipes the stream to another duplex stream. + * + * @param sink - The duplex stream to pipe to. + */ async pipe(sink: DuplexStream): Promise { await this.drain(async (value) => { await sink.write(value); }); } + /** + * Closes the stream. Idempotent. + * + * @returns The final result for this stream. + */ async return(): Promise> { await this.#parent.return(); return this.#reader.return(); } + /** + * Closes the stream with an error. Idempotent. + * + * @param error - The error to close the stream with. + * @returns The final result for this stream. + */ async throw(error: Error): Promise> { await this.#parent.throw(error); return this.#reader.throw(error); } + /** + * Closes the stream. Syntactic sugar for `throw(error)` or `return()`. Idempotent. + * + * @param error - The error to close the stream with. + * @returns The final result for this stream. + */ async end(error?: Error): Promise> { await this.#parent.end(error); return this.#reader.end(error); } + /** + * Returns the async iterator for this stream. + * + * @returns This stream as an async iterator. + */ [Symbol.asyncIterator](): typeof this { return this; } diff --git a/packages/streams/test/stream-mocks.ts b/packages/streams/test/stream-mocks.ts index 3f4213926..b844a4084 100644 --- a/packages/streams/test/stream-mocks.ts +++ b/packages/streams/test/stream-mocks.ts @@ -12,38 +12,80 @@ import type { } from '../src/BaseStream.ts'; import { BaseReader, BaseWriter } from '../src/BaseStream.ts'; +/** + * A test reader that exposes the receiveInput method for testing purposes. + */ export class TestReader extends BaseReader { readonly #receiveInput: ReceiveInput; + /** + * Gets the receive input function for this reader. + * + * @returns The receive input function. + */ get receiveInput(): ReceiveInput { return this.#receiveInput; } + /** + * Constructs a new {@link TestReader}. + * + * @param args - Options bag for configuring the reader. + */ constructor(args: BaseReaderArgs = {}) { super(args); this.#receiveInput = super.getReceiveInput(); } + /** + * Gets the receive input function. Overrides the protected method for testing. + * + * @returns The receive input function. + */ getReceiveInput(): ReceiveInput { return super.getReceiveInput(); } + /** + * Closes the underlying transport and returns. + * + * @returns The final result for this stream. + */ async return(): Promise> { return super.return(); } + /** + * Closes the stream with an error. + * + * @param error - The error to close the stream with. + * @returns The final result for this stream. + */ async throw(error: Error): Promise> { return super.throw(error); } } +/** + * A test writer that exposes the onDispatch function for testing purposes. + */ export class TestWriter extends BaseWriter { readonly #onDispatch: Dispatch; + /** + * Gets the dispatch function for this writer. + * + * @returns The dispatch function. + */ get onDispatch(): Dispatch { return this.#onDispatch; } + /** + * Constructs a new {@link TestWriter}. + * + * @param args - Options bag for configuring the writer. + */ constructor(args: BaseWriterArgs) { super(args); this.#onDispatch = args.onDispatch; @@ -56,6 +98,9 @@ type TestDuplexStreamOptions = { writerOnEnd?: () => void; }; +/** + * A test duplex stream that exposes internal methods for testing purposes. + */ export class TestDuplexStream< Read = number, Write = Read, @@ -64,14 +109,33 @@ export class TestDuplexStream< readonly #receiveInput: ReceiveInput; + /** + * Gets the dispatch function for the underlying writer. + * + * @returns The dispatch function. + */ get onDispatch(): Dispatch { return this.#onDispatch; } + /** + * Gets the receive input function for the underlying reader. + * + * @returns The receive input function. + */ get receiveInput(): ReceiveInput { return this.#receiveInput; } + /** + * Constructs a new {@link TestDuplexStream}. + * + * @param onDispatch - The dispatch function to use for writing. + * @param options - Options bag for configuring the stream. + * @param options.validateInput - A function that validates input from the transport. + * @param options.readerOnEnd - A function that is called when the reader ends. + * @param options.writerOnEnd - A function that is called when the writer ends. + */ constructor( onDispatch: Dispatch, { @@ -97,6 +161,11 @@ export class TestDuplexStream< this.#receiveInput = reader.receiveInput; } + /** + * Synchronizes the stream with its remote counterpart. + * + * @returns A promise that resolves when the stream is synchronized. + */ async synchronize(): Promise { return super.synchronize(); } diff --git a/packages/template-package/package.json b/packages/template-package/package.json index e933234c3..bd5c60eaf 100644 --- a/packages/template-package/package.json +++ b/packages/template-package/package.json @@ -47,10 +47,10 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/auto-changelog": "^5.0.1", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@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", diff --git a/vitest.config.ts b/vitest.config.ts index 740a0991b..88b458ce3 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -63,28 +63,28 @@ export default defineConfig({ thresholds: { autoUpdate: true, 'packages/cli/**': { - statements: 52.32, - functions: 53.57, - branches: 68.88, - lines: 52.63, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/create-package/**': { - statements: 100, - functions: 100, - branches: 100, - lines: 100, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/extension/**': { - statements: 1.42, + statements: 0, functions: 0, branches: 0, - lines: 1.44, + lines: 0, }, 'packages/kernel-agents/**': { - statements: 92.34, - functions: 90.84, - branches: 85.08, - lines: 92.48, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/kernel-browser-runtime/**': { statements: 85.88, @@ -99,22 +99,22 @@ export default defineConfig({ lines: 99.21, }, 'packages/kernel-language-model-service/**': { - statements: 99, - functions: 100, - branches: 94.11, - lines: 98.97, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/kernel-platforms/**': { - statements: 99.28, - functions: 100, - branches: 91.89, - lines: 99.26, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/kernel-rpc-methods/**': { - statements: 100, - functions: 100, - branches: 100, - lines: 100, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/kernel-shims/**': { statements: 0, @@ -123,40 +123,40 @@ export default defineConfig({ lines: 0, }, 'packages/kernel-store/**': { - statements: 98.37, - functions: 100, - branches: 91.42, - lines: 98.36, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/kernel-ui/**': { - statements: 95.03, - functions: 95.83, - branches: 87.53, - lines: 95.11, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/kernel-utils/**': { - statements: 100, - functions: 100, - branches: 100, - lines: 100, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/logger/**': { - statements: 98.66, - functions: 96.66, - branches: 97.36, - lines: 100, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/nodejs/**': { - statements: 88.98, - functions: 87.5, - branches: 90.9, - lines: 89.74, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/nodejs-test-workers/**': { - statements: 23.52, - functions: 25, - branches: 25, - lines: 25, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/ocap-kernel/**': { statements: 95.12, @@ -165,28 +165,28 @@ export default defineConfig({ lines: 95.1, }, 'packages/omnium-gatherum/**': { - statements: 5.26, - functions: 5.55, + statements: 0, + functions: 0, branches: 0, - lines: 5.35, + lines: 0, }, 'packages/remote-iterables/**': { - statements: 100, - functions: 100, - branches: 100, - lines: 100, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/streams/**': { - statements: 100, - functions: 100, - branches: 100, - lines: 100, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, 'packages/template-package/**': { - statements: 100, - functions: 100, - branches: 100, - lines: 100, + statements: 0, + functions: 0, + branches: 0, + lines: 0, }, }, }, diff --git a/yarn.lock b/yarn.lock index 6c1955ecb..d78906c16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2014,6 +2014,19 @@ __metadata: languageName: node linkType: hard +"@metamask/approval-controller@npm:^8.0.0": + version: 8.0.0 + resolution: "@metamask/approval-controller@npm:8.0.0" + dependencies: + "@metamask/base-controller": "npm:^9.0.0" + "@metamask/messenger": "npm:^0.3.0" + "@metamask/rpc-errors": "npm:^7.0.2" + "@metamask/utils": "npm:^11.8.1" + nanoid: "npm:^3.3.8" + checksum: 10/356fa411f2b077a31ea7565ffafaa4ecd68100ed93c26027ef4c30c55f7bf49a9f76a819bee05925756b0d4890d01a0ea0983b3b57bab3bf5b9ec2336f1a40e9 + languageName: node + linkType: hard + "@metamask/auto-changelog@npm:^4.0.0": version: 4.1.0 resolution: "@metamask/auto-changelog@npm:4.1.0" @@ -2030,10 +2043,11 @@ __metadata: languageName: node linkType: hard -"@metamask/auto-changelog@npm:^5.0.1": - version: 5.0.1 - resolution: "@metamask/auto-changelog@npm:5.0.1" +"@metamask/auto-changelog@npm:^5.3.0": + version: 5.3.0 + resolution: "@metamask/auto-changelog@npm:5.3.0" dependencies: + "@octokit/rest": "npm:^20.0.0" diff: "npm:^5.0.0" execa: "npm:^5.1.1" semver: "npm:^7.3.5" @@ -2042,7 +2056,7 @@ __metadata: prettier: ">=3.0.0" bin: auto-changelog: dist/cli.mjs - checksum: 10/4f526c710b4d198ca51ac447823fbc5528a86b31cfcba1d3d0ed2d71f847fb4276672a5a93d321778c75fe62450cf088ae4e110381a190d1d0c7ae8846040270 + checksum: 10/5381c2b1efbade000bafbbee7b1becbee1787b9f24849352d16ddd3b14f511f865b3478250301f3d22f98fe0208690f62f166a476e64d38ed58361d816a673b6 languageName: node linkType: hard @@ -2057,13 +2071,13 @@ __metadata: languageName: node linkType: hard -"@metamask/controller-utils@npm:^11.14.1": - version: 11.14.1 - resolution: "@metamask/controller-utils@npm:11.14.1" +"@metamask/controller-utils@npm:^11.17.0": + version: 11.18.0 + resolution: "@metamask/controller-utils@npm:11.18.0" dependencies: "@metamask/eth-query": "npm:^4.0.0" "@metamask/ethjs-unit": "npm:^0.3.0" - "@metamask/utils": "npm:^11.8.1" + "@metamask/utils": "npm:^11.9.0" "@spruceid/siwe-parser": "npm:2.1.0" "@types/bn.js": "npm:^5.1.5" bignumber.js: "npm:^9.1.2" @@ -2074,13 +2088,13 @@ __metadata: lodash: "npm:^4.17.21" peerDependencies: "@babel/runtime": ^7.0.0 - checksum: 10/b00e2ba24a0903ec06c00de4506c789a717ecba3510244cc58435d26c990680e88d884ce417ba39e5cb3b8f7f16f3f42bdc77f284af248b7d1bd60abb80a836c + checksum: 10/0c96701e3639b887c51c02416158bfeef42bf80701a4ca0d1ad2c888a370ccd9a6f2cb4677ef075a17a341c0dc9135e91c4f3079a7d498d9368d2f5e6fdf5d1b languageName: node linkType: hard -"@metamask/create-release-branch@npm:^4.1.2": - version: 4.1.2 - resolution: "@metamask/create-release-branch@npm:4.1.2" +"@metamask/create-release-branch@npm:^4.1.3": + version: 4.1.3 + resolution: "@metamask/create-release-branch@npm:4.1.3" dependencies: "@metamask/action-utils": "npm:^1.0.0" "@metamask/auto-changelog": "npm:^4.0.0" @@ -2099,7 +2113,7 @@ __metadata: prettier: ">=3.0.0" bin: create-release-branch: bin/create-release-branch.js - checksum: 10/00277dff438c639d5bd29b5251237ccb4e1792ff8ff1e148ee2a68982fa2c08d3158b2d1b054ff0cd298364f399b9ae8e0d88f9fc85d922c17b9dfe6509b299e + checksum: 10/fbaece7e989b559e5b8d70197b3abc86550f6678db4f35e75c0931522c45b91dc0d7fd4bb1e6aca567137d4715c803594c356ad9169ba6a6a55edf109b2827cc languageName: node linkType: hard @@ -2142,54 +2156,54 @@ __metadata: languageName: node linkType: hard -"@metamask/eslint-config-nodejs@npm:^14.0.0": - version: 14.0.0 - resolution: "@metamask/eslint-config-nodejs@npm:14.0.0" +"@metamask/eslint-config-nodejs@npm:^15.0.0": + version: 15.0.0 + resolution: "@metamask/eslint-config-nodejs@npm:15.0.0" dependencies: "@eslint/js": "npm:^9.11.0" globals: "npm:^15.9.0" peerDependencies: - "@metamask/eslint-config": ^14.0.0 + "@metamask/eslint-config": ^15.0.0 eslint: ^9.11.0 eslint-plugin-n: ^17.10.3 - checksum: 10/62a69e0a258b6b0ef8cbb844a3420115ff213648f55e1b3863dd29fa5892de8013f8157317e8279f68b7e82c69c97edc15c0040ad49469756393a711d91b0fff + checksum: 10/541a2df5a21e3e73abd8b5b175fd2c3604bfa8694d7e8e7e48891f01d38396267f1cf92cb88cb181ddd7931dee3c7bf39de59d2cb1f30971a245551d575674a1 languageName: node linkType: hard -"@metamask/eslint-config-typescript@npm:^14.0.0": - version: 14.0.0 - resolution: "@metamask/eslint-config-typescript@npm:14.0.0" +"@metamask/eslint-config-typescript@npm:^15.0.0": + version: 15.0.0 + resolution: "@metamask/eslint-config-typescript@npm:15.0.0" dependencies: "@eslint/js": "npm:^9.11.0" peerDependencies: - "@metamask/eslint-config": ^14.0.0 + "@metamask/eslint-config": ^15.0.0 eslint: ^9.11.0 eslint-import-resolver-typescript: ^3.6.3 eslint-plugin-import-x: ^4.3.0 eslint-plugin-jsdoc: ^50.2.4 - typescript: ">=4.8.4 <5.6" - typescript-eslint: ^8.6.0 - checksum: 10/cbf0a9e8523292d41140f90630863d034301422f16e6a42e5881c3593e83c07d0394787563d3e88fee02aa22042a9ca974363d3f192374e31bb0729c6ca8734e + typescript: ">=4.8.4 <6" + typescript-eslint: ^8.39.0 + checksum: 10/5ff44e8970a67f87da92a65b8478d22374713ca94feb671ba462b87441ae8b47e427857b363b79b50e6078856c0f482c3965de7f2ee38fe0b40f8f4e27891540 languageName: node linkType: hard -"@metamask/eslint-config-vitest@npm:^1.0.0": - version: 1.0.0 - resolution: "@metamask/eslint-config-vitest@npm:1.0.0" +"@metamask/eslint-config-vitest@npm:^15.0.0": + version: 15.0.0 + resolution: "@metamask/eslint-config-vitest@npm:15.0.0" dependencies: "@eslint/js": "npm:^9.11.0" globals: "npm:^15.9.0" peerDependencies: - "@metamask/eslint-config": ^14.0.0 + "@metamask/eslint-config": ^15.0.0 "@vitest/eslint-plugin": ^1.1.4 eslint: ^9.11.0 - checksum: 10/7d8e80e0fb5ff893cd1b369e6aa4c722b7863db2078997d93b7633cfe9d66c870ce0f9ce762b876effc9f0cf20ac81b6268f659ebf8bf20544c1d03600cfec0d + checksum: 10/44be0a6e6c97ed090421f931817049edacbae97f64c21e4eda76abd17b930b9c984bb34b29a5b13eee3f3ac5456a64fe1744c883cc18403ac05e66c6907804ee languageName: node linkType: hard -"@metamask/eslint-config@npm:^14.0.0": - version: 14.0.0 - resolution: "@metamask/eslint-config@npm:14.0.0" +"@metamask/eslint-config@npm:^15.0.0": + version: 15.0.0 + resolution: "@metamask/eslint-config@npm:15.0.0" dependencies: "@eslint/js": "npm:^9.11.0" globals: "npm:^15.9.0" @@ -2201,7 +2215,7 @@ __metadata: eslint-plugin-prettier: ^5.2.1 eslint-plugin-promise: ^7.1.0 prettier: ^3.3.3 - checksum: 10/b7ae38bf777e9341b8dfac75e98159fb5d5da7d913af2312b586c82370c84acff68ee78e3b104a3577a971d593c6039bd909c8d7ca41cb7a69ed069871080c8a + checksum: 10/93eb41bd61f3f4a0cf930a3d83e8893455f4f03339e91b21ef5a2835d24532db7c2916138a3e1b64777b5fb95cbe4ac90107697ac6f962c11ea7a99955cc75e4 languageName: node linkType: hard @@ -2237,7 +2251,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-engine@npm:^10.0.2, @metamask/json-rpc-engine@npm:^10.0.3, @metamask/json-rpc-engine@npm:^10.1.1, @metamask/json-rpc-engine@npm:^10.2.0": +"@metamask/json-rpc-engine@npm:^10.0.2, @metamask/json-rpc-engine@npm:^10.0.3, @metamask/json-rpc-engine@npm:^10.2.0": version: 10.2.0 resolution: "@metamask/json-rpc-engine@npm:10.2.0" dependencies: @@ -2269,10 +2283,10 @@ __metadata: dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" "@endo/marshal": "npm:^1.8.0" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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/json-rpc-engine": "npm:^10.2.0" "@metamask/kernel-errors": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" @@ -2280,11 +2294,11 @@ __metadata: "@metamask/kernel-utils": "workspace:^" "@metamask/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" - "@metamask/rpc-errors": "npm:^7.0.2" - "@metamask/snaps-utils": "npm:^11.6.1" + "@metamask/rpc-errors": "npm:^7.0.3" + "@metamask/snaps-utils": "npm:^11.7.1" "@metamask/streams": "workspace:^" "@metamask/superstruct": "npm:^3.2.1" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/kernel-platforms": "workspace:^" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" @@ -2324,12 +2338,12 @@ __metadata: dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" "@libp2p/interface": "npm:2.11.0" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -2365,15 +2379,15 @@ __metadata: dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" "@endo/promise-kit": "npm:^1.1.13" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-utils": "workspace:^" "@metamask/logger": "workspace:^" - "@metamask/rpc-errors": "npm:^7.0.2" + "@metamask/rpc-errors": "npm:^7.0.3" "@metamask/superstruct": "npm:^3.2.1" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -2408,10 +2422,10 @@ __metadata: "@endo/bundle-source": "npm:^4.1.2" "@endo/eventual-send": "npm:^1.3.4" "@endo/lockdown": "npm:^1.0.18" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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:^" "@typescript-eslint/eslint-plugin": "npm:^8.29.0" "@typescript-eslint/parser": "npm:^8.29.0" @@ -2442,10 +2456,10 @@ __metadata: resolution: "@metamask/kernel-store@workspace:packages/kernel-store" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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/logger": "workspace:^" "@ocap/repo-tools": "workspace:^" "@sqlite.org/sqlite-wasm": "npm:^3.49.1-build3" @@ -2483,19 +2497,19 @@ __metadata: resolution: "@metamask/kernel-ui@workspace:packages/kernel-ui" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" + "@metamask/auto-changelog": "npm:^5.3.0" "@metamask/design-system-react": "npm:^0.1.0" "@metamask/design-system-tailwind-preset": "npm:^0.5.0" "@metamask/design-tokens": "npm:^8.0.0" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.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-browser-runtime": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" "@metamask/kernel-utils": "workspace:^" "@metamask/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@solana/addresses": "npm:^2.0.0" "@testing-library/dom": "npm:^10.4.0" @@ -2553,13 +2567,13 @@ __metadata: "@endo/exo": "npm:^1.5.12" "@endo/patterns": "npm:^1.7.0" "@endo/promise-kit": "npm:^1.1.13" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-errors": "workspace:^" "@metamask/superstruct": "npm:^3.2.1" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -2609,14 +2623,14 @@ __metadata: resolution: "@metamask/logger@workspace:packages/logger" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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/streams": "workspace:^" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -2694,19 +2708,19 @@ __metadata: "@libp2p/webrtc": "npm:5.2.24" "@libp2p/websockets": "npm:9.2.19" "@libp2p/webtransport": "npm:5.0.51" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-errors": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" "@metamask/kernel-store": "workspace:^" "@metamask/kernel-utils": "workspace:^" "@metamask/logger": "workspace:^" - "@metamask/rpc-errors": "npm:^7.0.2" + "@metamask/rpc-errors": "npm:^7.0.3" "@metamask/streams": "workspace:^" "@metamask/superstruct": "npm:^3.2.1" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@multiformats/multiaddr": "npm:^12.4.4" "@ocap/cli": "workspace:^" "@ocap/kernel-platforms": "workspace:^" @@ -2741,23 +2755,22 @@ __metadata: languageName: unknown linkType: soft -"@metamask/permission-controller@npm:^12.0.0": - version: 12.1.0 - resolution: "@metamask/permission-controller@npm:12.1.0" +"@metamask/permission-controller@npm:^12.2.0": + version: 12.2.0 + resolution: "@metamask/permission-controller@npm:12.2.0" dependencies: + "@metamask/approval-controller": "npm:^8.0.0" "@metamask/base-controller": "npm:^9.0.0" - "@metamask/controller-utils": "npm:^11.14.1" - "@metamask/json-rpc-engine": "npm:^10.1.1" + "@metamask/controller-utils": "npm:^11.17.0" + "@metamask/json-rpc-engine": "npm:^10.2.0" "@metamask/messenger": "npm:^0.3.0" "@metamask/rpc-errors": "npm:^7.0.2" - "@metamask/utils": "npm:^11.8.1" + "@metamask/utils": "npm:^11.9.0" "@types/deep-freeze-strict": "npm:^1.1.0" deep-freeze-strict: "npm:^1.1.1" immer: "npm:^9.0.6" nanoid: "npm:^3.3.8" - peerDependencies: - "@metamask/approval-controller": ^8.0.0 - checksum: 10/c9a881bbeb477a9080653c6f8b57a326ce7e722d9b324bcd2613bc3caae595906a4759c49982be4bec6742390e2f03dcf8009ad3c8b5fceedadbf600a51597eb + checksum: 10/d15ce9b69b3f8dbed2409d2e789e800d06798e42e55ac05095f19db0feda7492a64e221865ec6ee3d41b6c809ba5467f2bdab443c2d99133df88ac624ae264b8 languageName: node linkType: hard @@ -2816,47 +2829,47 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@npm:^3.2.3": - version: 3.2.3 - resolution: "@metamask/snaps-registry@npm:3.2.3" +"@metamask/snaps-registry@npm:^4.0.0": + version: 4.0.0 + resolution: "@metamask/snaps-registry@npm:4.0.0" dependencies: - "@metamask/superstruct": "npm:^3.1.0" - "@metamask/utils": "npm:^11.0.1" + "@metamask/superstruct": "npm:^3.2.1" + "@metamask/utils": "npm:^11.4.0" "@noble/curves": "npm:^1.2.0" "@noble/hashes": "npm:^1.3.2" - checksum: 10/37760f29b7aaa337d815cf0c11fa34af5093d87fdc60a3750c494cf8bae6293cd52da03e7694b467b79733052d75ec6e3781ab3590d7259a050784e5be347d12 + checksum: 10/62387701d0433402bbe93495f90e24f2df3bdff2b063402b029294fada62c9f389048a2c68a1e51b260cb10cec949dd0c80596bf6295abc4175f5039c486a108 languageName: node linkType: hard -"@metamask/snaps-sdk@npm:^10.0.0": - version: 10.0.0 - resolution: "@metamask/snaps-sdk@npm:10.0.0" +"@metamask/snaps-sdk@npm:^10.3.0": + version: 10.3.0 + resolution: "@metamask/snaps-sdk@npm:10.3.0" dependencies: "@metamask/key-tree": "npm:^10.1.1" "@metamask/providers": "npm:^22.1.1" "@metamask/rpc-errors": "npm:^7.0.3" "@metamask/superstruct": "npm:^3.2.1" "@metamask/utils": "npm:^11.8.1" - checksum: 10/f753e92b2d4b06aae448beabc891de9be913c6c42ffbbd38039196982c19eafa3cb9fd158a7717f2d0692eeba2e4714a3620d3b19ce40550db75b1e8c5470da3 + luxon: "npm:^3.5.0" + checksum: 10/24efa7af91557d2365cd2199e0572566675efadbcc51a350938cb57e4b5c0861188c30d26a9ec3a42cb9059b37bba0f44a5486ec3ed32ac2e956cf48213d6485 languageName: node linkType: hard -"@metamask/snaps-utils@npm:^11.6.1": - version: 11.6.1 - resolution: "@metamask/snaps-utils@npm:11.6.1" +"@metamask/snaps-utils@npm:^11.7.1": + version: 11.7.1 + resolution: "@metamask/snaps-utils@npm:11.7.1" dependencies: "@babel/core": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" "@metamask/key-tree": "npm:^10.1.1" "@metamask/messenger": "npm:^0.3.0" - "@metamask/permission-controller": "npm:^12.0.0" + "@metamask/permission-controller": "npm:^12.2.0" "@metamask/rpc-errors": "npm:^7.0.3" "@metamask/slip44": "npm:^4.3.0" - "@metamask/snaps-registry": "npm:^3.2.3" - "@metamask/snaps-sdk": "npm:^10.0.0" + "@metamask/snaps-registry": "npm:^4.0.0" + "@metamask/snaps-sdk": "npm:^10.3.0" "@metamask/superstruct": "npm:^3.2.1" - "@metamask/utils": "npm:^11.8.1" - "@noble/hashes": "npm:^1.7.1" + "@metamask/utils": "npm:^11.9.0" "@scure/base": "npm:^1.1.1" chalk: "npm:^4.1.2" cron-parser: "npm:^4.5.0" @@ -2869,7 +2882,7 @@ __metadata: semver: "npm:^7.5.4" ses: "npm:^1.14.0" validate-npm-package-name: "npm:^5.0.0" - checksum: 10/ad694a02aeea9ab8dc159a032681b5eb57b75debf636ac229669ece479fc38deda423b3e79a1ef2af30ef69be627ad5fcd7852a24448eeb58799f510d07b8216 + checksum: 10/4f1ebf14df5eef4344aef8367923176b02f68c58a76c2776aef3015e36f1f889f6463a6b991c78e5810424cf117e20972511a12fcc3436839b0f6100cbb8f09e languageName: node linkType: hard @@ -2880,14 +2893,14 @@ __metadata: "@arethetypeswrong/cli": "npm:^0.17.4" "@endo/promise-kit": "npm:^1.1.13" "@endo/stream": "npm:^1.2.13" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-errors": "workspace:^" "@metamask/kernel-utils": "workspace:^" "@metamask/superstruct": "npm:^3.2.1" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -2928,9 +2941,9 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^11.0.1, @metamask/utils@npm:^11.1.0, @metamask/utils@npm:^11.4.2, @metamask/utils@npm:^11.8.1": - version: 11.8.1 - resolution: "@metamask/utils@npm:11.8.1" +"@metamask/utils@npm:^11.0.1, @metamask/utils@npm:^11.1.0, @metamask/utils@npm:^11.4.0, @metamask/utils@npm:^11.4.2, @metamask/utils@npm:^11.8.1, @metamask/utils@npm:^11.9.0": + version: 11.9.0 + resolution: "@metamask/utils@npm:11.9.0" dependencies: "@ethereumjs/tx": "npm:^4.2.0" "@metamask/superstruct": "npm:^3.1.0" @@ -2943,7 +2956,7 @@ __metadata: pony-cause: "npm:^2.1.10" semver: "npm:^7.5.4" uuid: "npm:^9.0.1" - checksum: 10/efd3aab7f86b4a74d396cf1d5fc76e748ff78906802fdc15ec9ce2d1a9bd6b035e8e036ea93eb6b9ea33782c70adb9000772eb7a5e0164e8e9e2ebb077dca3ab + checksum: 10/f8f5e99ba6c6de0395ed4e0acc82ee9c0dca26991ea6a8f10b3896e72745790966a8eded8c42be905d9f01fa99c1fd29a7f68541e2ef9854fc14984a0b514ad3 languageName: node linkType: hard @@ -3125,7 +3138,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.8.0, @noble/hashes@npm:^1.1.2, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:^1.7.1, @noble/hashes@npm:^1.8.0": +"@noble/hashes@npm:1.8.0, @noble/hashes@npm:^1.1.2, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:^1.8.0": version: 1.8.0 resolution: "@noble/hashes@npm:1.8.0" checksum: 10/474b7f56bc6fb2d5b3a42132561e221b0ea4f91e590f4655312ca13667840896b34195e2b53b7f097ec080a1fdd3b58d902c2a8d0fbdf51d2e238b53808a177e @@ -3347,15 +3360,15 @@ __metadata: "@libp2p/ping": "npm:2.0.37" "@libp2p/tcp": "npm:10.1.19" "@libp2p/websockets": "npm:9.2.19" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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/snaps-utils": "npm:^11.6.1" - "@metamask/utils": "npm:^11.4.2" + "@metamask/snaps-utils": "npm:^11.7.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" @@ -3400,11 +3413,11 @@ __metadata: resolution: "@ocap/create-package@workspace:packages/create-package" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" - "@metamask/utils": "npm:^11.4.2" + "@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/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -3441,10 +3454,10 @@ __metadata: resolution: "@ocap/extension@workspace:packages/extension" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-browser-runtime": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" "@metamask/kernel-shims": "workspace:^" @@ -3453,7 +3466,7 @@ __metadata: "@metamask/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" "@metamask/streams": "workspace:^" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/cli": "workspace:^" "@ocap/kernel-test": "workspace:^" "@ocap/repo-tools": "workspace:^" @@ -3501,10 +3514,10 @@ __metadata: dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" "@endo/eventual-send": "npm:^1.3.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-errors": "workspace:^" "@metamask/kernel-utils": "workspace:^" "@metamask/logger": "workspace:^" @@ -3545,10 +3558,10 @@ __metadata: resolution: "@ocap/kernel-language-model-service@workspace:packages/kernel-language-model-service" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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/streams": "workspace:^" "@metamask/superstruct": "npm:^3.2.1" "@ocap/repo-tools": "workspace:^" @@ -3586,12 +3599,12 @@ __metadata: resolution: "@ocap/kernel-platforms@workspace:packages/kernel-platforms" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/repo-tools": "workspace:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -3670,15 +3683,15 @@ __metadata: "@endo/promise-kit": "npm:^1.1.13" "@libp2p/crypto": "npm:5.1.8" "@libp2p/peer-id": "npm:5.1.9" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.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-store": "workspace:^" "@metamask/kernel-utils": "workspace:^" "@metamask/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" "@metamask/streams": "workspace:^" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/cli": "workspace:^" "@ocap/kernel-language-model-service": "workspace:^" "@ocap/nodejs": "workspace:^" @@ -3717,12 +3730,12 @@ __metadata: "@arethetypeswrong/cli": "npm:^0.17.4" "@lavamoat/allow-scripts": "npm:^3.3.2" "@lavamoat/preinstall-always-fail": "npm:^2.1.0" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/create-release-branch": "npm:^4.1.2" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" - "@metamask/eslint-config-vitest": "npm:^1.0.0" + "@metamask/auto-changelog": "npm:^5.3.0" + "@metamask/create-release-branch": "npm:^4.1.3" + "@metamask/eslint-config": "npm:^15.0.0" + "@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:^" "@ts-bridge/cli": "npm:^0.6.3" "@ts-bridge/shims": "npm:^0.1.1" @@ -3772,10 +3785,10 @@ __metadata: resolution: "@ocap/nodejs-test-workers@workspace:packages/nodejs-test-workers" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" "@ocap/nodejs": "workspace:^" @@ -3816,17 +3829,17 @@ __metadata: "@endo/promise-kit": "npm:^1.1.13" "@libp2p/interface": "npm:2.11.0" "@libp2p/webrtc": "npm:5.2.24" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-store": "workspace:^" "@metamask/kernel-utils": "workspace:^" "@metamask/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" "@metamask/streams": "workspace:^" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/cli": "workspace:^" "@ocap/kernel-platforms": "workspace:^" "@ocap/repo-tools": "workspace:^" @@ -3864,10 +3877,10 @@ __metadata: resolution: "@ocap/omnium-gatherum@workspace:packages/omnium-gatherum" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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-browser-runtime": "workspace:^" "@metamask/kernel-rpc-methods": "workspace:^" "@metamask/kernel-shims": "workspace:^" @@ -3876,7 +3889,7 @@ __metadata: "@metamask/logger": "workspace:^" "@metamask/ocap-kernel": "workspace:^" "@metamask/streams": "workspace:^" - "@metamask/utils": "npm:^11.4.2" + "@metamask/utils": "npm:^11.9.0" "@ocap/cli": "workspace:^" "@ocap/repo-tools": "workspace:^" "@playwright/test": "npm:^1.54.2" @@ -3929,10 +3942,10 @@ __metadata: "@endo/patterns": "npm:^1.7.0" "@endo/promise-kit": "npm:^1.1.13" "@endo/stream": "npm:^1.2.13" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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" @@ -3964,9 +3977,9 @@ __metadata: version: 0.0.0-use.local resolution: "@ocap/repo-tools@workspace:packages/repo-tools" dependencies: - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.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" "@playwright/test": "npm:^1.54.2" "@typescript-eslint/eslint-plugin": "npm:^8.29.0" @@ -4000,10 +4013,10 @@ __metadata: resolution: "@ocap/template-package@workspace:packages/template-package" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/auto-changelog": "npm:^5.0.1" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.0" + "@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" @@ -4031,6 +4044,131 @@ __metadata: languageName: unknown linkType: soft +"@octokit/auth-token@npm:^4.0.0": + version: 4.0.0 + resolution: "@octokit/auth-token@npm:4.0.0" + checksum: 10/60e42701e341d700f73c518c7a35675d36d79fa9d5e838cc3ade96d147e49f5ba74db2e07b2337c2b95aaa540aa42088116df2122daa25633f9e70a2c8785c44 + languageName: node + linkType: hard + +"@octokit/core@npm:^5.0.2": + version: 5.2.2 + resolution: "@octokit/core@npm:5.2.2" + dependencies: + "@octokit/auth-token": "npm:^4.0.0" + "@octokit/graphql": "npm:^7.1.0" + "@octokit/request": "npm:^8.4.1" + "@octokit/request-error": "npm:^5.1.1" + "@octokit/types": "npm:^13.0.0" + before-after-hook: "npm:^2.2.0" + universal-user-agent: "npm:^6.0.0" + checksum: 10/0c39b43e562a8acf8f1d563a85f3c0e55e6d678ae16a4b3d6341060b3d5315c021dfa1bd15dc818fa4cc5612eb5cd518b13cb7c194e3c92ca3da9c0dc6a854b5 + languageName: node + linkType: hard + +"@octokit/endpoint@npm:^9.0.6": + version: 9.0.6 + resolution: "@octokit/endpoint@npm:9.0.6" + dependencies: + "@octokit/types": "npm:^13.1.0" + universal-user-agent: "npm:^6.0.0" + checksum: 10/2bf776423365ee926bf3f722a664e52f1070758eff4a176279fb132103fd0c76e3541f83ace49bbad9a64f9c9b8de453be565ca8d6136989e9514dea65380ecf + languageName: node + linkType: hard + +"@octokit/graphql@npm:^7.1.0": + version: 7.1.1 + resolution: "@octokit/graphql@npm:7.1.1" + dependencies: + "@octokit/request": "npm:^8.4.1" + "@octokit/types": "npm:^13.0.0" + universal-user-agent: "npm:^6.0.0" + checksum: 10/9a7a65fa84df795b0acb5315dae5a4a5a042a01dde0c88974df180a1c02b9b8e61cae013be32461b11ee1d507a8f778f3b7f37dfa3b371771332cb8efcd01f29 + languageName: node + linkType: hard + +"@octokit/openapi-types@npm:^24.2.0": + version: 24.2.0 + resolution: "@octokit/openapi-types@npm:24.2.0" + checksum: 10/000897ebc6e247c2591049d6081e95eb5636f73798dadd695ee6048496772b58065df88823e74a760201828545a7ac601dd3c1bcd2e00079a62a9ee9d389409c + languageName: node + linkType: hard + +"@octokit/plugin-paginate-rest@npm:11.4.4-cjs.2": + version: 11.4.4-cjs.2 + resolution: "@octokit/plugin-paginate-rest@npm:11.4.4-cjs.2" + dependencies: + "@octokit/types": "npm:^13.7.0" + peerDependencies: + "@octokit/core": 5 + checksum: 10/e0f696b3b69febe4e7c736d909065871f38bb8346a07f19a9c83246a02972568ac672667db472f846baef20a9611adf26ce8f0f189a11004c4b6618765078e19 + languageName: node + linkType: hard + +"@octokit/plugin-request-log@npm:^4.0.0": + version: 4.0.1 + resolution: "@octokit/plugin-request-log@npm:4.0.1" + peerDependencies: + "@octokit/core": 5 + checksum: 10/fd8c0a201490cba00084689a0d1d54fc7b5ab5b6bdb7e447056b947b1754f78526e9685400eab10d3522bfa7b5bc49c555f41ec412c788610b96500b168f3789 + languageName: node + linkType: hard + +"@octokit/plugin-rest-endpoint-methods@npm:13.3.2-cjs.1": + version: 13.3.2-cjs.1 + resolution: "@octokit/plugin-rest-endpoint-methods@npm:13.3.2-cjs.1" + dependencies: + "@octokit/types": "npm:^13.8.0" + peerDependencies: + "@octokit/core": ^5 + checksum: 10/479827e62466e55bc1a50129d51597807bddc6c909e56be9e8dd9c1a91efa0f466a2f56b7d80438649e21ab0a3a195f840b3fccf2ae7f11fb0a919db8e62bc62 + languageName: node + linkType: hard + +"@octokit/request-error@npm:^5.1.1": + version: 5.1.1 + resolution: "@octokit/request-error@npm:5.1.1" + dependencies: + "@octokit/types": "npm:^13.1.0" + deprecation: "npm:^2.0.0" + once: "npm:^1.4.0" + checksum: 10/6ad98626407ba57bb33fa197611be74bee1dd9abc8d5d845648d6a2a04aa6840c0eb7f4be341d55dfcab5bc19181ad5fd25194869a7aaac6245f74b3a14d9662 + languageName: node + linkType: hard + +"@octokit/request@npm:^8.4.1": + version: 8.4.1 + resolution: "@octokit/request@npm:8.4.1" + dependencies: + "@octokit/endpoint": "npm:^9.0.6" + "@octokit/request-error": "npm:^5.1.1" + "@octokit/types": "npm:^13.1.0" + universal-user-agent: "npm:^6.0.0" + checksum: 10/2b2c9131cc9b608baeeef8ce2943768cc9db5fbe36a665f734a099bd921561c760e4391fbdf39d5aefb725db26742db1488c65624940ef7cec522e10863caa5e + languageName: node + linkType: hard + +"@octokit/rest@npm:^20.0.0": + version: 20.1.2 + resolution: "@octokit/rest@npm:20.1.2" + dependencies: + "@octokit/core": "npm:^5.0.2" + "@octokit/plugin-paginate-rest": "npm:11.4.4-cjs.2" + "@octokit/plugin-request-log": "npm:^4.0.0" + "@octokit/plugin-rest-endpoint-methods": "npm:13.3.2-cjs.1" + checksum: 10/e0759fdbf18bc96f68299b4ca04d7102ce861e8508f01e9e580ed9c1e19d4cc20d150635161e360375f1c52c95e54bf6b56aaae16f943a93d6dcb38a51d8a23e + languageName: node + linkType: hard + +"@octokit/types@npm:^13.0.0, @octokit/types@npm:^13.1.0, @octokit/types@npm:^13.7.0, @octokit/types@npm:^13.8.0": + version: 13.10.0 + resolution: "@octokit/types@npm:13.10.0" + dependencies: + "@octokit/openapi-types": "npm:^24.2.0" + checksum: 10/32f8f5010d7faae128b0cdd0c221f0ca8c3781fe44483ecd87162b3da507db667f7369acda81340f6e2c9c374d9a938803409c6085c2c01d98210b6c58efb99a + languageName: node + linkType: hard + "@parcel/watcher-android-arm64@npm:2.5.1": version: 2.5.1 resolution: "@parcel/watcher-android-arm64@npm:2.5.1" @@ -6623,6 +6761,13 @@ __metadata: languageName: node linkType: hard +"before-after-hook@npm:^2.2.0": + version: 2.2.3 + resolution: "before-after-hook@npm:2.2.3" + checksum: 10/e676f769dbc4abcf4b3317db2fd2badb4a92c0710e0a7da12cf14b59c3482d4febf835ad7de7874499060fd4e13adf0191628e504728b3c5bb4ec7a878c09940 + languageName: node + linkType: hard + "better-sqlite3@npm:^12.4.1": version: 12.4.6 resolution: "better-sqlite3@npm:12.4.6" @@ -7701,6 +7846,13 @@ __metadata: languageName: node linkType: hard +"deprecation@npm:^2.0.0": + version: 2.3.1 + resolution: "deprecation@npm:2.3.1" + checksum: 10/f56a05e182c2c195071385455956b0c4106fe14e36245b00c689ceef8e8ab639235176a96977ba7c74afb173317fac2e0ec6ec7a1c6d1e6eaa401c586c714132 + languageName: node + linkType: hard + "deps-regex@npm:^0.2.0": version: 0.2.0 resolution: "deps-regex@npm:0.2.0" @@ -14927,6 +15079,13 @@ __metadata: languageName: node linkType: hard +"universal-user-agent@npm:^6.0.0": + version: 6.0.1 + resolution: "universal-user-agent@npm:6.0.1" + checksum: 10/fdc8e1ae48a05decfc7ded09b62071f571c7fe0bd793d700704c80cea316101d4eac15cc27ed2bb64f4ce166d2684777c3198b9ab16034f547abea0d3aa1c93c + languageName: node + linkType: hard + "universalify@npm:^2.0.0": version: 2.0.1 resolution: "universalify@npm:2.0.1" From 049bab08cbaf2b0b2e35b25e3113c949e55ba5b1 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Mon, 12 Jan 2026 20:21:35 +0100 Subject: [PATCH 2/7] chore: Update test coverage thresholds and yarn.lock Update coverage thresholds based on actual test coverage after dependency updates. Co-Authored-By: Claude Opus 4.5 --- vitest.config.ts | 130 +++++++++++++++++++++++------------------------ yarn.lock | 49 ++++++++++++++++++ 2 files changed, 114 insertions(+), 65 deletions(-) diff --git a/vitest.config.ts b/vitest.config.ts index 88b458ce3..740a0991b 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -63,28 +63,28 @@ export default defineConfig({ thresholds: { autoUpdate: true, 'packages/cli/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 52.32, + functions: 53.57, + branches: 68.88, + lines: 52.63, }, 'packages/create-package/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 100, + functions: 100, + branches: 100, + lines: 100, }, 'packages/extension/**': { - statements: 0, + statements: 1.42, functions: 0, branches: 0, - lines: 0, + lines: 1.44, }, 'packages/kernel-agents/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 92.34, + functions: 90.84, + branches: 85.08, + lines: 92.48, }, 'packages/kernel-browser-runtime/**': { statements: 85.88, @@ -99,22 +99,22 @@ export default defineConfig({ lines: 99.21, }, 'packages/kernel-language-model-service/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 99, + functions: 100, + branches: 94.11, + lines: 98.97, }, 'packages/kernel-platforms/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 99.28, + functions: 100, + branches: 91.89, + lines: 99.26, }, 'packages/kernel-rpc-methods/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 100, + functions: 100, + branches: 100, + lines: 100, }, 'packages/kernel-shims/**': { statements: 0, @@ -123,40 +123,40 @@ export default defineConfig({ lines: 0, }, 'packages/kernel-store/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 98.37, + functions: 100, + branches: 91.42, + lines: 98.36, }, 'packages/kernel-ui/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 95.03, + functions: 95.83, + branches: 87.53, + lines: 95.11, }, 'packages/kernel-utils/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 100, + functions: 100, + branches: 100, + lines: 100, }, 'packages/logger/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 98.66, + functions: 96.66, + branches: 97.36, + lines: 100, }, 'packages/nodejs/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 88.98, + functions: 87.5, + branches: 90.9, + lines: 89.74, }, 'packages/nodejs-test-workers/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 23.52, + functions: 25, + branches: 25, + lines: 25, }, 'packages/ocap-kernel/**': { statements: 95.12, @@ -165,28 +165,28 @@ export default defineConfig({ lines: 95.1, }, 'packages/omnium-gatherum/**': { - statements: 0, - functions: 0, + statements: 5.26, + functions: 5.55, branches: 0, - lines: 0, + lines: 5.35, }, 'packages/remote-iterables/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 100, + functions: 100, + branches: 100, + lines: 100, }, 'packages/streams/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 100, + functions: 100, + branches: 100, + lines: 100, }, 'packages/template-package/**': { - statements: 0, - functions: 0, - branches: 0, - lines: 0, + statements: 100, + functions: 100, + branches: 100, + lines: 100, }, }, }, diff --git a/yarn.lock b/yarn.lock index d78906c16..1402f3e93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2156,6 +2156,20 @@ __metadata: languageName: node linkType: hard +"@metamask/eslint-config-nodejs@npm:^14.0.0": + version: 14.0.0 + resolution: "@metamask/eslint-config-nodejs@npm:14.0.0" + dependencies: + "@eslint/js": "npm:^9.11.0" + globals: "npm:^15.9.0" + peerDependencies: + "@metamask/eslint-config": ^14.0.0 + eslint: ^9.11.0 + eslint-plugin-n: ^17.10.3 + checksum: 10/62a69e0a258b6b0ef8cbb844a3420115ff213648f55e1b3863dd29fa5892de8013f8157317e8279f68b7e82c69c97edc15c0040ad49469756393a711d91b0fff + languageName: node + linkType: hard + "@metamask/eslint-config-nodejs@npm:^15.0.0": version: 15.0.0 resolution: "@metamask/eslint-config-nodejs@npm:15.0.0" @@ -2170,6 +2184,23 @@ __metadata: languageName: node linkType: hard +"@metamask/eslint-config-typescript@npm:^14.0.0": + version: 14.1.0 + resolution: "@metamask/eslint-config-typescript@npm:14.1.0" + dependencies: + "@eslint/js": "npm:^9.11.0" + peerDependencies: + "@metamask/eslint-config": ^14.1.0 + eslint: ^9.11.0 + eslint-import-resolver-typescript: ^3.6.3 + eslint-plugin-import-x: ^4.3.0 + eslint-plugin-jsdoc: ^50.2.4 + typescript: ">=4.8.4 <5.9.0" + typescript-eslint: ^8.24 + checksum: 10/697b61648969f5f53179b8cf83ffb1aa1dbe5ce9ad4f7f4ed0bc4e436c510f1d28543e764467fd880ccb2579b5810e78eee63f972daa55f1b599844b53ea13ca + languageName: node + linkType: hard + "@metamask/eslint-config-typescript@npm:^15.0.0": version: 15.0.0 resolution: "@metamask/eslint-config-typescript@npm:15.0.0" @@ -2201,6 +2232,24 @@ __metadata: languageName: node linkType: hard +"@metamask/eslint-config@npm:^14.0.0": + version: 14.1.0 + resolution: "@metamask/eslint-config@npm:14.1.0" + dependencies: + "@eslint/js": "npm:^9.11.0" + globals: "npm:^15.9.0" + peerDependencies: + eslint: ^9.11.0 + eslint-config-prettier: ^9.1.0 + eslint-plugin-import-x: ^4.3.0 + eslint-plugin-jsdoc: ^50.2.4 + eslint-plugin-prettier: ^5.2.1 + eslint-plugin-promise: ^7.1.0 + prettier: ^3.3.3 + checksum: 10/c6313391ea09130ae7254356069c8c28621d8dac668278291cba4436e95d4d5b8a43e11d7ce98ade96b2e4c7706171eba9c966ce7ba439fe888576bb32930b06 + languageName: node + linkType: hard + "@metamask/eslint-config@npm:^15.0.0": version: 15.0.0 resolution: "@metamask/eslint-config@npm:15.0.0" From 9350f3e20d2e5681ea33a604df2374608a71912b Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Mon, 12 Jan 2026 21:03:45 +0100 Subject: [PATCH 3/7] fix lint --- packages/kernel-test-local/package.json | 6 +-- yarn.lock | 55 ++----------------------- 2 files changed, 6 insertions(+), 55 deletions(-) diff --git a/packages/kernel-test-local/package.json b/packages/kernel-test-local/package.json index a85ae8acd..58c12c882 100644 --- a/packages/kernel-test-local/package.json +++ b/packages/kernel-test-local/package.json @@ -35,9 +35,9 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.17.4", - "@metamask/eslint-config": "^14.0.0", - "@metamask/eslint-config-nodejs": "^14.0.0", - "@metamask/eslint-config-typescript": "^14.0.0", + "@metamask/eslint-config": "^15.0.0", + "@metamask/eslint-config-nodejs": "^15.0.0", + "@metamask/eslint-config-typescript": "^15.0.0", "@types/node": "^22.13.1", "@typescript-eslint/eslint-plugin": "^8.29.0", "@typescript-eslint/parser": "^8.29.0", diff --git a/yarn.lock b/yarn.lock index 1402f3e93..ca1372055 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2156,20 +2156,6 @@ __metadata: languageName: node linkType: hard -"@metamask/eslint-config-nodejs@npm:^14.0.0": - version: 14.0.0 - resolution: "@metamask/eslint-config-nodejs@npm:14.0.0" - dependencies: - "@eslint/js": "npm:^9.11.0" - globals: "npm:^15.9.0" - peerDependencies: - "@metamask/eslint-config": ^14.0.0 - eslint: ^9.11.0 - eslint-plugin-n: ^17.10.3 - checksum: 10/62a69e0a258b6b0ef8cbb844a3420115ff213648f55e1b3863dd29fa5892de8013f8157317e8279f68b7e82c69c97edc15c0040ad49469756393a711d91b0fff - languageName: node - linkType: hard - "@metamask/eslint-config-nodejs@npm:^15.0.0": version: 15.0.0 resolution: "@metamask/eslint-config-nodejs@npm:15.0.0" @@ -2184,23 +2170,6 @@ __metadata: languageName: node linkType: hard -"@metamask/eslint-config-typescript@npm:^14.0.0": - version: 14.1.0 - resolution: "@metamask/eslint-config-typescript@npm:14.1.0" - dependencies: - "@eslint/js": "npm:^9.11.0" - peerDependencies: - "@metamask/eslint-config": ^14.1.0 - eslint: ^9.11.0 - eslint-import-resolver-typescript: ^3.6.3 - eslint-plugin-import-x: ^4.3.0 - eslint-plugin-jsdoc: ^50.2.4 - typescript: ">=4.8.4 <5.9.0" - typescript-eslint: ^8.24 - checksum: 10/697b61648969f5f53179b8cf83ffb1aa1dbe5ce9ad4f7f4ed0bc4e436c510f1d28543e764467fd880ccb2579b5810e78eee63f972daa55f1b599844b53ea13ca - languageName: node - linkType: hard - "@metamask/eslint-config-typescript@npm:^15.0.0": version: 15.0.0 resolution: "@metamask/eslint-config-typescript@npm:15.0.0" @@ -2232,24 +2201,6 @@ __metadata: languageName: node linkType: hard -"@metamask/eslint-config@npm:^14.0.0": - version: 14.1.0 - resolution: "@metamask/eslint-config@npm:14.1.0" - dependencies: - "@eslint/js": "npm:^9.11.0" - globals: "npm:^15.9.0" - peerDependencies: - eslint: ^9.11.0 - eslint-config-prettier: ^9.1.0 - eslint-plugin-import-x: ^4.3.0 - eslint-plugin-jsdoc: ^50.2.4 - eslint-plugin-prettier: ^5.2.1 - eslint-plugin-promise: ^7.1.0 - prettier: ^3.3.3 - checksum: 10/c6313391ea09130ae7254356069c8c28621d8dac668278291cba4436e95d4d5b8a43e11d7ce98ade96b2e4c7706171eba9c966ce7ba439fe888576bb32930b06 - languageName: node - linkType: hard - "@metamask/eslint-config@npm:^15.0.0": version: 15.0.0 resolution: "@metamask/eslint-config@npm:15.0.0" @@ -3688,9 +3639,9 @@ __metadata: resolution: "@ocap/kernel-test-local@workspace:packages/kernel-test-local" dependencies: "@arethetypeswrong/cli": "npm:^0.17.4" - "@metamask/eslint-config": "npm:^14.0.0" - "@metamask/eslint-config-nodejs": "npm:^14.0.0" - "@metamask/eslint-config-typescript": "npm:^14.0.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/logger": "workspace:^" "@ocap/kernel-agents": "workspace:^" "@ocap/kernel-language-model-service": "workspace:^" From 4877f84f469faf3b475d3dfe1458e78afd531037 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Mon, 12 Jan 2026 21:11:50 +0100 Subject: [PATCH 4/7] fill empty jsdocs --- .../src/PlatformServicesClient.ts | 9 +++++++++ .../src/PlatformServicesServer.ts | 13 +++++++++++++ packages/ocap-kernel/src/Kernel.ts | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/packages/kernel-browser-runtime/src/PlatformServicesClient.ts b/packages/kernel-browser-runtime/src/PlatformServicesClient.ts index 634e8a44c..5a7b49d0a 100644 --- a/packages/kernel-browser-runtime/src/PlatformServicesClient.ts +++ b/packages/kernel-browser-runtime/src/PlatformServicesClient.ts @@ -36,7 +36,16 @@ export type PlatformServicesClientStream = PostMessageDuplexStream< >; /** + * The client end of the platform services, intended to be constructed in + * the kernel worker. Sends launch and terminate worker requests to the + * server and wraps the launch response in a DuplexStream for consumption + * by the kernel, and provides network connectivity. * + * @see {@link PlatformServicesServer} for the other end of the service. + * + * @param stream - The stream to use for communication with the server. + * @param logger - An optional {@link Logger}. Defaults to a new logger labeled '[platform services client]'. + * @returns A new {@link PlatformServicesClient}. */ export class PlatformServicesClient implements PlatformServices { readonly #logger: Logger; diff --git a/packages/kernel-browser-runtime/src/PlatformServicesServer.ts b/packages/kernel-browser-runtime/src/PlatformServicesServer.ts index 23ea90412..b4f0cd857 100644 --- a/packages/kernel-browser-runtime/src/PlatformServicesServer.ts +++ b/packages/kernel-browser-runtime/src/PlatformServicesServer.ts @@ -41,7 +41,20 @@ export type PlatformServicesStream = PostMessageDuplexStream< >; /** + * The server end of the platform services, intended to be constructed in + * the offscreen document. Listens for launch and terminate worker requests + * from the client and uses the {@link VatWorker} methods to effect those + * requests, and provides network connectivity. * + * Note that {@link PlatformServicesServer.start} must be called to start + * the server. + * + * @see {@link PlatformServicesClient} for the other end of the service. + * + * @param stream - The stream to use for communication with the client. + * @param makeWorker - A method for making a {@link VatWorker}. + * @param logger - An optional {@link Logger}. Defaults to a new logger labeled '[platform services server]'. + * @returns A new {@link PlatformServicesServer}. */ export class PlatformServicesServer { readonly #logger; diff --git a/packages/ocap-kernel/src/Kernel.ts b/packages/ocap-kernel/src/Kernel.ts index 27db21043..b52abb7c5 100644 --- a/packages/ocap-kernel/src/Kernel.ts +++ b/packages/ocap-kernel/src/Kernel.ts @@ -36,7 +36,17 @@ import type { VatHandle } from './vats/VatHandle.ts'; import { VatManager } from './vats/VatManager.ts'; /** + * The kernel is the main class for the kernel. It is responsible for + * managing the lifecycle of the kernel and the vats. * + * @param commandStream - Command channel from whatever external software is driving the kernel. + * @param platformServices - Service to do things the kernel worker can't. + * @param kernelDatabase - Database holding the kernel's persistent state. + * @param options - Options for the kernel constructor. + * @param options.resetStorage - If true, the storage will be cleared. + * @param options.logger - Optional logger for error and diagnostic output. + * @param options.keySeed - Optional seed for libp2p key generation. + * @returns A new {@link Kernel}. */ export class Kernel { /** Command channel from the controlling console/browser extension/test driver */ From 82d2d5cf69ed05d5bf19e59cb3874fcc5e2f6887 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Tue, 13 Jan 2026 16:11:36 +0100 Subject: [PATCH 5/7] add missing jsdoc --- packages/kernel-errors/src/errors/ResourceLimitError.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/kernel-errors/src/errors/ResourceLimitError.ts b/packages/kernel-errors/src/errors/ResourceLimitError.ts index cec6fcef8..dc0bd60a1 100644 --- a/packages/kernel-errors/src/errors/ResourceLimitError.ts +++ b/packages/kernel-errors/src/errors/ResourceLimitError.ts @@ -11,7 +11,16 @@ import { BaseError } from '../BaseError.ts'; import { marshaledErrorSchema, ErrorCode } from '../constants.ts'; import type { ErrorOptionsWithStack, MarshaledOcapError } from '../types.ts'; +/** + * Error indicating a resource limit was exceeded. + */ export class ResourceLimitError extends BaseError { + /** + * Creates a new ResourceLimitError. + * + * @param message - A human-readable description of the error. + * @param options - Additional error options including cause and stack. + */ constructor( message: string, options?: ErrorOptionsWithStack & { From c5b1506147189a9a440e0de9c6ed6679fcbcc448 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Tue, 13 Jan 2026 16:16:01 +0100 Subject: [PATCH 6/7] add missing jsdoc --- packages/kernel-errors/src/BaseError.ts | 3 +++ packages/kernel-errors/src/errors/AbortError.ts | 3 +++ .../kernel-errors/src/errors/DuplicateEndowmentError.ts | 5 +++++ packages/kernel-errors/src/errors/EvaluatorError.ts | 4 ++++ packages/kernel-errors/src/errors/ResourceLimitError.ts | 6 +++++- packages/kernel-errors/src/errors/SampleGenerationError.ts | 4 ++++ packages/kernel-errors/src/errors/StreamReadError.ts | 7 ++++++- .../kernel-errors/src/errors/SubclusterNotFoundError.ts | 6 +++++- packages/kernel-errors/src/errors/VatAlreadyExistsError.ts | 6 +++++- packages/kernel-errors/src/errors/VatDeletedError.ts | 4 ++++ packages/kernel-errors/src/errors/VatNotFoundError.ts | 6 +++++- 11 files changed, 49 insertions(+), 5 deletions(-) diff --git a/packages/kernel-errors/src/BaseError.ts b/packages/kernel-errors/src/BaseError.ts index bb79afb12..91f8baab9 100644 --- a/packages/kernel-errors/src/BaseError.ts +++ b/packages/kernel-errors/src/BaseError.ts @@ -22,6 +22,9 @@ export class BaseError extends Error implements OcapError { * @param code - The error code identifying the type of error. * @param message - A human-readable description of the error. * @param options - Additional error options including cause, stack, and data. + * @param options.data - Additional data about the error. + * @param options.cause - The underlying error that caused the base error. + * @param options.stack - The stack trace of the error. */ constructor( code: ErrorCode, diff --git a/packages/kernel-errors/src/errors/AbortError.ts b/packages/kernel-errors/src/errors/AbortError.ts index c400f924b..1e6955dd9 100644 --- a/packages/kernel-errors/src/errors/AbortError.ts +++ b/packages/kernel-errors/src/errors/AbortError.ts @@ -18,6 +18,9 @@ export class AbortError extends BaseError { * Creates a new AbortError. * * @param options - Additional error options including cause and stack. + * @param options.data - Additional data about the error. + * @param options.cause - The underlying error that caused the operation to abort. + * @param options.stack - The stack trace of the error. */ constructor(options?: ErrorOptionsWithStack) { super(ErrorCode.AbortError, 'Operation aborted.', { diff --git a/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts b/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts index 8248aa9df..7ec88a1a6 100644 --- a/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts +++ b/packages/kernel-errors/src/errors/DuplicateEndowmentError.ts @@ -20,6 +20,11 @@ export class DuplicateEndowmentError extends BaseError { * @param endowmentName - The name of the duplicate endowment. * @param isInternal - Whether the duplicate is an internal endowment. * @param options - Additional error options including cause and stack. + * @param options.data - Additional data about the error. + * @param options.data.endowmentName - The name of the duplicate endowment. + * @param options.data.isInternal - Whether the duplicate is an internal endowment. + * @param options.cause - The underlying error that caused the duplicate endowment error. + * @param options.stack - The stack trace of the error. */ constructor( endowmentName: string, diff --git a/packages/kernel-errors/src/errors/EvaluatorError.ts b/packages/kernel-errors/src/errors/EvaluatorError.ts index 4509f1cc2..26e261c6b 100644 --- a/packages/kernel-errors/src/errors/EvaluatorError.ts +++ b/packages/kernel-errors/src/errors/EvaluatorError.ts @@ -32,6 +32,10 @@ export class EvaluatorError extends BaseError { * @param code - An internal code identifying the specific evaluator failure. * @param cause - The underlying error that caused this evaluator error. * @param options - Additional error options including stack. + * @param options.data - Additional data about the error. + * @param options.data.code - An internal code identifying the specific evaluator failure. + * @param options.cause - The underlying error that caused this evaluator error. + * @param options.stack - The stack trace of the error. */ constructor( message: string, diff --git a/packages/kernel-errors/src/errors/ResourceLimitError.ts b/packages/kernel-errors/src/errors/ResourceLimitError.ts index dc0bd60a1..13026a7c6 100644 --- a/packages/kernel-errors/src/errors/ResourceLimitError.ts +++ b/packages/kernel-errors/src/errors/ResourceLimitError.ts @@ -19,7 +19,11 @@ export class ResourceLimitError extends BaseError { * Creates a new ResourceLimitError. * * @param message - A human-readable description of the error. - * @param options - Additional error options including cause and stack. + * @param options - Additional error options including cause, stack, and data. + * @param options.data - Additional data about the error. + * @param options.data.limitType - The type of limit that was exceeded. + * @param options.data.current - The current value of the limit. + * @param options.data.limit - The limit value. */ constructor( message: string, diff --git a/packages/kernel-errors/src/errors/SampleGenerationError.ts b/packages/kernel-errors/src/errors/SampleGenerationError.ts index 4b867669b..caa2c1c3b 100644 --- a/packages/kernel-errors/src/errors/SampleGenerationError.ts +++ b/packages/kernel-errors/src/errors/SampleGenerationError.ts @@ -27,6 +27,10 @@ export class SampleGenerationError extends BaseError { * @param sample - The invalid sample text generated by the LLM. * @param cause - The underlying error that caused sample generation to fail. * @param options - Additional error options including stack. + * @param options.data - Additional data about the error. + * @param options.data.sample - The invalid sample text generated by the LLM. + * @param options.cause - The underlying error that caused sample generation to fail. + * @param options.stack - The stack trace of the error. */ constructor(sample: string, cause: Error, options?: ErrorOptionsWithStack) { super(ErrorCode.SampleGenerationError, 'LLM generated invalid response.', { diff --git a/packages/kernel-errors/src/errors/StreamReadError.ts b/packages/kernel-errors/src/errors/StreamReadError.ts index d10b67548..f3751d275 100644 --- a/packages/kernel-errors/src/errors/StreamReadError.ts +++ b/packages/kernel-errors/src/errors/StreamReadError.ts @@ -28,7 +28,12 @@ export class StreamReadError extends BaseError { * Creates a new StreamReadError. * * @param data - Context data identifying the source of the error (vatId or kernelId). - * @param options - Error options including the underlying cause and stack trace. + * @param options - Error options including the underlying cause, stack, and data. + * @param options.data - Additional data about the error. + * @param options.data.vatId - The ID of the vat that caused the error. + * @param options.data.kernelId - The ID of the kernel that caused the error. + * @param options.cause - The underlying error that caused the stream read error. + * @param options.stack - The stack trace of the error. */ constructor(data: StreamReadErrorData, options: StreamReadErrorOptions) { super(ErrorCode.StreamReadError, 'Unexpected stream read error.', { diff --git a/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts b/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts index ce83d2364..2b8d84c35 100644 --- a/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts +++ b/packages/kernel-errors/src/errors/SubclusterNotFoundError.ts @@ -12,7 +12,11 @@ export class SubclusterNotFoundError extends BaseError { * Creates a new SubclusterNotFoundError. * * @param subclusterId - The identifier of the subcluster that was not found. - * @param options - Additional error options including cause and stack trace. + * @param options - Additional error options including cause, stack, and data. + * @param options.data - Additional data about the error. + * @param options.data.subclusterId - The identifier of the subcluster that was not found. + * @param options.cause - The underlying error that caused the subcluster not found error. + * @param options.stack - The stack trace of the error. */ constructor(subclusterId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.SubclusterNotFound, 'Subcluster does not exist.', { diff --git a/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts b/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts index f427d3807..64374a245 100644 --- a/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts +++ b/packages/kernel-errors/src/errors/VatAlreadyExistsError.ts @@ -12,7 +12,11 @@ export class VatAlreadyExistsError extends BaseError { * Creates a new VatAlreadyExistsError. * * @param vatId - The identifier of the vat that already exists. - * @param options - Additional error options including cause and stack trace. + * @param options - Additional error options including cause, stack, and data. + * @param options.data - Additional data about the error. + * @param options.data.vatId - The identifier of the vat that already exists. + * @param options.cause - The underlying error that caused the vat already exists error. + * @param options.stack - The stack trace of the error. */ constructor(vatId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.VatAlreadyExists, 'Vat already exists.', { diff --git a/packages/kernel-errors/src/errors/VatDeletedError.ts b/packages/kernel-errors/src/errors/VatDeletedError.ts index 607757146..0388a9f02 100644 --- a/packages/kernel-errors/src/errors/VatDeletedError.ts +++ b/packages/kernel-errors/src/errors/VatDeletedError.ts @@ -13,6 +13,10 @@ export class VatDeletedError extends BaseError { * * @param vatId - The identifier of the deleted vat. * @param options - Additional error options including cause and stack trace. + * @param options.data - Additional data about the error. + * @param options.data.vatId - The identifier of the deleted vat. + * @param options.cause - The underlying error that caused the vat deleted error. + * @param options.stack - The stack trace of the error. */ constructor(vatId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.VatDeleted, 'Vat was deleted.', { diff --git a/packages/kernel-errors/src/errors/VatNotFoundError.ts b/packages/kernel-errors/src/errors/VatNotFoundError.ts index 15c08aff3..215b39897 100644 --- a/packages/kernel-errors/src/errors/VatNotFoundError.ts +++ b/packages/kernel-errors/src/errors/VatNotFoundError.ts @@ -12,7 +12,11 @@ export class VatNotFoundError extends BaseError { * Creates a new VatNotFoundError. * * @param vatId - The identifier of the vat that was not found. - * @param options - Additional error options including cause and stack trace. + * @param options - Additional error options including cause, stack, and data. + * @param options.data - Additional data about the error. + * @param options.data.vatId - The identifier of the vat that was not found. + * @param options.cause - The underlying error that caused the vat not found error. + * @param options.stack - The stack trace of the error. */ constructor(vatId: string, options?: ErrorOptionsWithStack) { super(ErrorCode.VatNotFound, 'Vat does not exist.', { From 811f960e754a585c5e72e8d94c4ba490824f52f5 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Tue, 13 Jan 2026 17:42:24 +0100 Subject: [PATCH 7/7] Update packages/ocap-kernel/src/Kernel.ts jsdoc Co-authored-by: grypez <143971198+grypez@users.noreply.github.com> --- packages/ocap-kernel/src/Kernel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ocap-kernel/src/Kernel.ts b/packages/ocap-kernel/src/Kernel.ts index b52abb7c5..879b090d3 100644 --- a/packages/ocap-kernel/src/Kernel.ts +++ b/packages/ocap-kernel/src/Kernel.ts @@ -36,7 +36,7 @@ import type { VatHandle } from './vats/VatHandle.ts'; import { VatManager } from './vats/VatManager.ts'; /** - * The kernel is the main class for the kernel. It is responsible for + * The main class for the ocap kernel. It is responsible for * managing the lifecycle of the kernel and the vats. * * @param commandStream - Command channel from whatever external software is driving the kernel.