Skip to content

Commit 505aed9

Browse files
committed
refactor(extension): Replace MessageResolver with RpcClient
1 parent db4fca1 commit 505aed9

34 files changed

+243
-741
lines changed

packages/extension/src/kernel-integration/handlers/execute-db-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { array, object, record, string } from '@metamask/superstruct';
22
import type { MethodSpec, Handler } from '@ocap/rpc-methods';
33

4-
const executeDBQuerySpec: MethodSpec<
4+
export const executeDBQuerySpec: MethodSpec<
55
'executeDBQuery',
66
{ sql: string },
77
Record<string, string>[]

packages/extension/src/kernel-integration/handlers/get-status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const KernelStatusStruct = type({
1919
),
2020
});
2121

22-
type KernelStatus = Infer<typeof KernelStatusStruct>;
22+
export type KernelStatus = Infer<typeof KernelStatusStruct>;
2323

2424
export const getStatusSpec: MethodSpec<
2525
'getStatus',
Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,60 @@
1-
import { clearStateHandler } from './clear-state.ts';
2-
import { executeDBQueryHandler } from './execute-db-query.ts';
3-
import { getStatusHandler } from './get-status.ts';
4-
import { launchVatHandler } from './launch-vat.ts';
5-
import { reloadConfigHandler } from './reload-config.ts';
6-
import { restartVatHandler } from './restart-vat.ts';
7-
import { sendVatCommandHandler } from './send-vat-command.ts';
8-
import { terminateAllVatsHandler } from './terminate-all-vats.ts';
9-
import { terminateVatHandler } from './terminate-vat.ts';
10-
import { updateClusterConfigHandler } from './update-cluster-config.ts';
1+
import { clearStateHandler, clearStateSpec } from './clear-state.ts';
2+
import {
3+
executeDBQueryHandler,
4+
executeDBQuerySpec,
5+
} from './execute-db-query.ts';
6+
import { getStatusHandler, getStatusSpec } from './get-status.ts';
7+
import { launchVatHandler, launchVatSpec } from './launch-vat.ts';
8+
import { reloadConfigHandler, reloadConfigSpec } from './reload-config.ts';
9+
import { restartVatHandler, restartVatSpec } from './restart-vat.ts';
10+
import {
11+
sendVatCommandHandler,
12+
sendVatCommandSpec,
13+
} from './send-vat-command.ts';
14+
import {
15+
terminateAllVatsHandler,
16+
terminateAllVatsSpec,
17+
} from './terminate-all-vats.ts';
18+
import { terminateVatHandler, terminateVatSpec } from './terminate-vat.ts';
19+
import {
20+
updateClusterConfigHandler,
21+
updateClusterConfigSpec,
22+
} from './update-cluster-config.ts';
1123

24+
/**
25+
* Call-ee side handlers for the kernel control methods.
26+
*/
1227
export const handlers = {
13-
getStatus: getStatusHandler,
1428
clearState: clearStateHandler,
15-
sendVatCommand: sendVatCommandHandler,
1629
executeDBQuery: executeDBQueryHandler,
30+
getStatus: getStatusHandler,
1731
launchVat: launchVatHandler,
1832
reload: reloadConfigHandler,
1933
restartVat: restartVatHandler,
20-
terminateVat: terminateVatHandler,
34+
sendVatCommand: sendVatCommandHandler,
2135
terminateAllVats: terminateAllVatsHandler,
36+
terminateVat: terminateVatHandler,
2237
updateClusterConfig: updateClusterConfigHandler,
2338
} as const;
2439

25-
export type KernelControlMethod =
26-
(typeof handlers)[keyof typeof handlers]['method'];
40+
/**
41+
* Call-er side method specs for the kernel control methods.
42+
*/
43+
export const methodSpecs = {
44+
clearState: clearStateSpec,
45+
executeDBQuery: executeDBQuerySpec,
46+
getStatus: getStatusSpec,
47+
launchVat: launchVatSpec,
48+
reload: reloadConfigSpec,
49+
restartVat: restartVatSpec,
50+
sendVatCommand: sendVatCommandSpec,
51+
terminateAllVats: terminateAllVatsSpec,
52+
terminateVat: terminateVatSpec,
53+
updateClusterConfig: updateClusterConfigSpec,
54+
} as const;
55+
56+
type Handlers = (typeof handlers)[keyof typeof handlers];
57+
58+
export type KernelControlMethod = Handlers['method'];
59+
60+
export type { KernelStatus } from './get-status.ts';

packages/extension/src/kernel-integration/messages.test.ts

Lines changed: 0 additions & 223 deletions
This file was deleted.

0 commit comments

Comments
 (0)