Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@typescript-eslint/utils": "^8.8.1",
"@vitest/coverage-istanbul": "3.0.4",
"@vitest/coverage-istanbul": "^3.0.5",
"@vitest/eslint-plugin": "^1.1.25",
"@yarnpkg/types": "^4.0.0",
"depcheck": "^1.4.7",
Expand Down Expand Up @@ -99,7 +99,7 @@
"typescript-eslint": "^8.8.1",
"vite": "^6.0.11",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "3.0.5",
"vitest": "^3.0.5",
"vitest-fetch-mock": "^0.4.3",
"yargs": "^17.7.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"typescript": "~5.5.4",
"typescript-eslint": "^8.8.1",
"vite": "^6.0.11",
"vitest": "3.0.5"
"vitest": "^3.0.5"
},
"engines": {
"node": "^20 || >=22"
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"typescript": "~5.5.4",
"typescript-eslint": "^8.8.1",
"vite": "^6.0.11",
"vitest": "3.0.5"
"vitest": "^3.0.5"
},
"engines": {
"node": "^20 || >=22"
Expand Down
4 changes: 2 additions & 2 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"@ocap/errors": "workspace:^",
"@ocap/kernel": "workspace:^",
"@ocap/shims": "workspace:^",
"@ocap/store": "workspace:^",
"@ocap/streams": "workspace:^",
"@ocap/utils": "workspace:^",
"@sqlite.org/sqlite-wasm": "^3.48.0-build1",
"nanoid": "^3.3.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down Expand Up @@ -101,7 +101,7 @@
"vite": "^6.0.11",
"vite-plugin-checker": "^0.8.0",
"vite-plugin-static-copy": "^2.2.0",
"vitest": "3.0.5"
"vitest": "^3.0.5"
},
"engines": {
"node": "^20 || >=22"
Expand Down
3 changes: 1 addition & 2 deletions packages/extension/src/iframe.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { isVatCommand, VatSupervisor } from '@ocap/kernel';
import type { VatCommand, VatCommandReply } from '@ocap/kernel';
import { makeSQLKVStore } from '@ocap/store/sqlite/wasm';
import { MessagePortDuplexStream, receiveMessagePort } from '@ocap/streams';

import { makeSQLKVStore } from './kernel-integration/sqlite-kv-store.js';

main().catch(console.error);

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { assert } from '@metamask/superstruct';
import type { Infer, Struct } from '@metamask/superstruct';
import type { Json } from '@metamask/utils';
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';

import type { KernelCommandPayloadStructs, KernelMethods } from './messages.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import type {
Kernel,
KernelCommand,
VatId,
VatConfig,
KVStore,
} from '@ocap/kernel';
import type { Kernel, KernelCommand, VatId, VatConfig } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { setupOcapKernelMock } from '@ocap/test-utils';
import { describe, it, expect, vi, beforeEach } from 'vitest';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { makeLogger } from '@ocap/utils';

import { KernelCommandRegistry } from './command-registry.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { clearStateHandler } from './clear-state.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { executeDBQueryHandler } from './execute-db-query.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Json } from '@metamask/utils';
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';

import type { CommandHandler, CommandParams } from '../command-registry.js';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { getStatusHandler } from './get-status.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { launchVatHandler } from './launch-vat.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Json } from '@metamask/utils';
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';

import type { CommandHandler, CommandParams } from '../command-registry.js';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi, beforeEach } from 'vitest';

import { reloadConfigHandler } from './reload-config.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { restartVatHandler } from './restart-vat.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Json } from '@metamask/utils';
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';

import type { CommandHandler, CommandParams } from '../command-registry.js';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { sendVatCommandHandler } from './send-vat-command.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Json } from '@metamask/utils';
import { isKernelCommand } from '@ocap/kernel';
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';

import type { CommandHandler, CommandParams } from '../command-registry.js';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { terminateAllVatsHandler } from './terminate-all-vats.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { terminateVatHandler } from './terminate-vat.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Json } from '@metamask/utils';
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';

import type { CommandHandler, CommandParams } from '../command-registry.js';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Kernel, KVStore } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect } from 'vitest';

import { updateClusterConfigHandler } from './update-cluster-config.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Json } from '@metamask/utils';
import type { ClusterConfig, Kernel, KVStore } from '@ocap/kernel';
import type { ClusterConfig, Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';

import type { CommandHandler } from '../command-registry.js';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import type {
KernelCommandReply,
} from '@ocap/kernel';
import { ClusterConfigStruct, isKernelCommand, Kernel } from '@ocap/kernel';
import { makeSQLKVStore } from '@ocap/store/sqlite/wasm';
import type { PostMessageTarget } from '@ocap/streams';
import { MessagePortDuplexStream, receiveMessagePort } from '@ocap/streams';
import { fetchValidatedJson, makeLogger } from '@ocap/utils';

import { handlePanelMessage } from './handle-panel-message.js';
import { makeSQLKVStore } from './sqlite-kv-store.js';
import { receiveUiConnections } from './ui-connections.js';
import { ExtensionVatWorkerClient } from './VatWorkerClient.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { KVStore, Kernel } from '@ocap/kernel';
import type { Kernel } from '@ocap/kernel';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, vi } from 'vitest';

import { loggingMiddleware, logger } from './logging.js';
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
{ "path": "../shims/tsconfig.build.json" },
{ "path": "../streams/tsconfig.build.json" },
{ "path": "../kernel/tsconfig.build.json" },
{ "path": "../utils/tsconfig.build.json" }
{ "path": "../utils/tsconfig.build.json" },
{ "path": "../store/tsconfig.build.json" }
],
"include": [
"./src/**/*.ts",
"./src/**/*.tsx",
"./src/**/*.module.css",
"./src/**/*-trusted-prelude.js",
"./src/env/dev-console.js",
"../../types"
"./src/env/dev-console.js"
]
}
6 changes: 3 additions & 3 deletions packages/extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
{ "path": "../streams" },
{ "path": "../test-utils" },
{ "path": "../utils" },
{ "path": "../kernel" }
{ "path": "../kernel" },
{ "path": "../store" }
],
"include": [
"../../vitest.config.ts",
Expand All @@ -40,7 +41,6 @@
"./test/**/*.ts",
"./vite-plugins/*.ts",
"./vite.config.ts",
"./vitest.config.ts",
"../../types"
"./vitest.config.ts"
]
}
3 changes: 2 additions & 1 deletion packages/kernel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@metamask/superstruct": "^3.1.0",
"@metamask/utils": "^11.0.1",
"@ocap/errors": "workspace:^",
"@ocap/store": "workspace:^",
"@ocap/streams": "workspace:^",
"@ocap/utils": "workspace:^",
"ses": "^1.9.0",
Expand Down Expand Up @@ -84,7 +85,7 @@
"typescript": "~5.5.4",
"typescript-eslint": "^8.8.1",
"vite": "^6.0.11",
"vitest": "3.0.5"
"vitest": "^3.0.5"
},
"engines": {
"node": "^20 || >=22"
Expand Down
2 changes: 1 addition & 1 deletion packages/kernel/src/Kernel.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { VatNotFoundError } from '@ocap/errors';
import type { KVStore } from '@ocap/store';
import type { MessagePortDuplexStream, DuplexStream } from '@ocap/streams';
import type { MockInstance } from 'vitest';
import { describe, it, expect, vi, beforeEach } from 'vitest';
Expand All @@ -10,7 +11,6 @@ import type {
VatCommand,
VatCommandReply,
} from './messages/index.js';
import type { KVStore } from './store/kernel-store.js';
import type { VatId, VatConfig, VatWorkerService } from './types.js';
import { VatHandle } from './VatHandle.js';
import { makeMapKVStore } from '../test/storage.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/kernel/src/Kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
VatAlreadyExistsError,
VatNotFoundError,
} from '@ocap/errors';
import type { KVStore } from '@ocap/store';
import type { DuplexStream } from '@ocap/streams';
import type { Logger } from '@ocap/utils';
import { makeLogger } from '@ocap/utils';
Expand All @@ -26,7 +27,7 @@ import {
isPromiseRef,
makeKernelStore,
} from './store/kernel-store.js';
import type { KernelStore, KVStore } from './store/kernel-store.js';
import type { KernelStore } from './store/kernel-store.js';
import type {
VatId,
VRef,
Expand Down
7 changes: 5 additions & 2 deletions packages/kernel/src/VatSupervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { importBundle } from '@endo/import-bundle';
import { makeMarshal } from '@endo/marshal';
import type { CapData } from '@endo/marshal';
import { StreamReadError } from '@ocap/errors';
import type { MakeKVStore } from '@ocap/store';
import type { DuplexStream } from '@ocap/streams';

import type {
Expand All @@ -18,7 +19,6 @@ import type {
import { makeDummyMeterControl } from './dummyMeterControl.js';
import type { VatCommand, VatCommandReply } from './messages/index.js';
import { VatCommandMethod } from './messages/index.js';
import type { MakeKVStore } from './store/kernel-store.js';
import { makeSupervisorSyscall } from './syscall.js';
import type { VatConfig, VatId, VRef } from './types.js';
import { ROOT_OBJECT_VREF, isVatConfig } from './types.js';
Expand Down Expand Up @@ -198,7 +198,10 @@ export class VatSupervisor {
}
this.#loaded = true;

const kvStore = await this.#makeKVStore(`[vat-${this.id}]`, true);
const kvStore = await this.#makeKVStore(
`[vat-${this.id}]`,
`vat-${this.id}.db`,
);
const syscall = makeSupervisorSyscall(this, kvStore);
const vatPowers = {}; // XXX should be something more real
const liveSlotsOptions = {}; // XXX should be something more real
Expand Down
1 change: 0 additions & 1 deletion packages/kernel/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './messages/index.js';
export { Kernel } from './Kernel.js';
export type { KVStore, MakeKVStore } from './store/kernel-store.js';
export { VatHandle } from './VatHandle.js';
export { VatSupervisor } from './VatSupervisor.js';
export type { Message } from '@agoric/swingset-liveslots';
Expand Down
2 changes: 1 addition & 1 deletion packages/kernel/src/store/kernel-store.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Message } from '@agoric/swingset-liveslots';
import type { KVStore } from '@ocap/store';
import { describe, it, expect, beforeEach } from 'vitest';

import { makeKernelStore } from './kernel-store.js';
import type { KVStore } from './kernel-store.js';
import { makeMapKVStore } from '../../test/storage.js';
import type { RunQueueItem } from '../types.js';

Expand Down
16 changes: 1 addition & 15 deletions packages/kernel/src/store/kernel-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import type { Message } from '@agoric/swingset-liveslots';
import { Fail } from '@endo/errors';
import type { CapData } from '@endo/marshal';
import type { KVStore } from '@ocap/store';

import type {
VatId,
Expand All @@ -69,21 +70,6 @@ import type {
} from '../types.js';
import { insistVatId } from '../types.js';

export type KVStore = {
get(key: string): string | undefined;
getRequired(key: string): string;
getNextKey(previousKey: string): string | undefined;
set(key: string, value: string): void;
delete(key: string): void;
clear(): void;
executeQuery(sql: string): Record<string, string>[];
};

export type MakeKVStore = (
label: string,
beEphemeral: boolean,
) => Promise<KVStore>;

type StoredValue = {
get(): string | undefined;
set(newValue: string): void;
Expand Down
Loading