@agoric/swingset-vat 0.32.3-dev-987bcf1.0 → 0.32.3-dev-42dbac1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/swingset-vat",
3
- "version": "0.32.3-dev-987bcf1.0+987bcf1",
3
+ "version": "0.32.3-dev-42dbac1.0+42dbac1",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -27,15 +27,15 @@
27
27
  "@types/yargs-parser": "^21.0.0"
28
28
  },
29
29
  "dependencies": {
30
- "@agoric/internal": "0.3.3-dev-987bcf1.0+987bcf1",
31
- "@agoric/kmarshal": "0.1.1-dev-987bcf1.0+987bcf1",
32
- "@agoric/store": "0.9.3-dev-987bcf1.0+987bcf1",
33
- "@agoric/swing-store": "0.9.2-dev-987bcf1.0+987bcf1",
34
- "@agoric/swingset-liveslots": "0.10.3-dev-987bcf1.0+987bcf1",
35
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-987bcf1.0+987bcf1",
36
- "@agoric/time": "0.3.3-dev-987bcf1.0+987bcf1",
37
- "@agoric/vat-data": "0.5.3-dev-987bcf1.0+987bcf1",
38
- "@agoric/xsnap-lockdown": "0.14.1-dev-987bcf1.0+987bcf1",
30
+ "@agoric/internal": "0.3.3-dev-42dbac1.0+42dbac1",
31
+ "@agoric/kmarshal": "0.1.1-dev-42dbac1.0+42dbac1",
32
+ "@agoric/store": "0.9.3-dev-42dbac1.0+42dbac1",
33
+ "@agoric/swing-store": "0.9.2-dev-42dbac1.0+42dbac1",
34
+ "@agoric/swingset-liveslots": "0.10.3-dev-42dbac1.0+42dbac1",
35
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-42dbac1.0+42dbac1",
36
+ "@agoric/time": "0.3.3-dev-42dbac1.0+42dbac1",
37
+ "@agoric/vat-data": "0.5.3-dev-42dbac1.0+42dbac1",
38
+ "@agoric/xsnap-lockdown": "0.14.1-dev-42dbac1.0+42dbac1",
39
39
  "@endo/base64": "^1.0.9",
40
40
  "@endo/bundle-source": "^3.5.1",
41
41
  "@endo/captp": "^4.4.4",
@@ -102,5 +102,5 @@
102
102
  "typeCoverage": {
103
103
  "atLeast": 76.28
104
104
  },
105
- "gitHead": "987bcf1df00a307034d4c6da3145b6f1318885be"
105
+ "gitHead": "42dbac17b5524ed5f027da0643f6f4ffc88eec6a"
106
106
  }
@@ -9,7 +9,7 @@ import { makeUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';
9
9
  import { kser, kslot, makeError } from '@agoric/kmarshal';
10
10
  import { assertKnownOptions } from '../lib/assertOptions.js';
11
11
  import { foreverPolicy } from '../lib/runPolicies.js';
12
- import { makeVatManagerFactory } from './vat-loader/manager-factory.js';
12
+ import { makeVatManagerMaker } from './vat-loader/manager-factory.js';
13
13
  import { makeVatWarehouse } from './vat-warehouse.js';
14
14
  import makeDeviceManager from './deviceManager.js';
15
15
  import makeKernelKeeper, {
@@ -1557,7 +1557,7 @@ export default function buildKernel(
1557
1557
  gcAndFinalize,
1558
1558
  meterControl: makeDummyMeterControl(),
1559
1559
  });
1560
- const vatManagerFactory = makeVatManagerFactory({
1560
+ const makeVatManager = makeVatManagerMaker({
1561
1561
  allVatPowers,
1562
1562
  kernelKeeper,
1563
1563
  vatEndowments,
@@ -1652,7 +1652,7 @@ export default function buildKernel(
1652
1652
  }
1653
1653
 
1654
1654
  const vatLoader = makeVatLoader({
1655
- vatManagerFactory,
1655
+ makeVatManager,
1656
1656
  kernelSlog,
1657
1657
  makeSourcedConsole,
1658
1658
  kernelKeeper,
@@ -4,7 +4,7 @@ import { makeLocalVatManagerFactory } from './manager-local.js';
4
4
  import { makeNodeSubprocessFactory } from './manager-subprocess-node.js';
5
5
  import { makeXsSubprocessFactory } from './manager-subprocess-xsnap.js';
6
6
 
7
- export function makeVatManagerFactory({
7
+ export function makeVatManagerMaker({
8
8
  allVatPowers,
9
9
  kernelKeeper,
10
10
  vatEndowments,
@@ -18,14 +18,12 @@ export function makeVatManagerFactory({
18
18
  vatEndowments,
19
19
  gcTools,
20
20
  });
21
-
22
21
  const nodeSubprocessFactory = makeNodeSubprocessFactory({
23
22
  startSubprocessWorker: startSubprocessWorkerNode,
24
23
  kernelKeeper,
25
24
  kernelSlog,
26
25
  testLog: allVatPowers.testLog,
27
26
  });
28
-
29
27
  const xsWorkerFactory = makeXsSubprocessFactory({
30
28
  startXSnap,
31
29
  kernelKeeper,
@@ -69,58 +67,41 @@ export function makeVatManagerFactory({
69
67
  * @param {import('@agoric/swingset-liveslots').LiveSlotsOptions} options.liveSlotsOptions
70
68
  * @returns { Promise<import('../../types-internal.js').VatManager> }
71
69
  */
72
- async function vatManagerFactory(
73
- vatID,
74
- { managerOptions, liveSlotsOptions },
75
- ) {
70
+ async function makeVatManager(vatID, options) {
71
+ const { managerOptions, liveSlotsOptions } = options;
76
72
  validateManagerOptions(managerOptions);
77
73
  const { workerOptions, enableSetup } = managerOptions;
78
74
  const { type } = workerOptions;
79
75
 
80
- if (type !== 'local' && 'setup' in managerOptions) {
81
- console.warn(`TODO: stop using setup() with ${type}`);
82
- }
83
- if (enableSetup) {
84
- if (managerOptions.setup) {
85
- return localFactory.createFromSetup(vatID, managerOptions);
86
- } else {
87
- return localFactory.createFromBundle(
88
- vatID,
89
- managerOptions.bundle,
90
- managerOptions,
91
- liveSlotsOptions,
92
- );
93
- }
94
- } else if (type === 'local') {
95
- return localFactory.createFromBundle(
96
- vatID,
97
- managerOptions.bundle,
98
- managerOptions,
99
- liveSlotsOptions,
100
- );
76
+ if (type !== 'local' && (enableSetup || 'setup' in managerOptions)) {
77
+ console.warn(`TODO: stop using enableSetup and setup() with ${type}`);
101
78
  }
102
79
 
103
- if (type === 'node-subprocess') {
104
- return nodeSubprocessFactory.createFromBundle(
105
- vatID,
106
- managerOptions.bundle,
107
- managerOptions,
108
- liveSlotsOptions,
109
- );
80
+ if (enableSetup && managerOptions.setup) {
81
+ return localFactory.createFromSetup(vatID, managerOptions);
110
82
  }
111
83
 
112
- if (type === 'xsnap') {
113
- assert(managerOptions.bundle, 'xsnap requires Bundle');
114
- return xsWorkerFactory.createFromBundle(
115
- vatID,
116
- managerOptions.bundle,
117
- managerOptions,
118
- liveSlotsOptions,
119
- );
84
+ /** @type {Pick<typeof xsWorkerFactory, 'createFromBundle'>} */
85
+ let factory;
86
+ if (enableSetup || type === 'local') {
87
+ factory = localFactory;
88
+ } else if (type === 'node-subprocess') {
89
+ factory = nodeSubprocessFactory;
90
+ } else if (type === 'xsnap') {
91
+ assert(managerOptions.bundle, 'worker type xsnap requires a bundle');
92
+ factory = xsWorkerFactory;
93
+ } else {
94
+ throw Error(`unknown vat worker type ${type}`);
120
95
  }
121
96
 
122
- throw Error(`unknown type ${type}, not 'local' or 'xsnap'`);
97
+ return factory.createFromBundle(
98
+ vatID,
99
+ // @ts-expect-error managerOptions.bundle might be undefined
100
+ managerOptions.bundle,
101
+ managerOptions,
102
+ liveSlotsOptions,
103
+ );
123
104
  }
124
105
 
125
- return harden(vatManagerFactory);
106
+ return harden(makeVatManager);
126
107
  }
@@ -9,7 +9,7 @@ export function makeVatRootObjectSlot() {
9
9
  export function makeVatLoader(stuff) {
10
10
  const {
11
11
  overrideVatManagerOptions = {},
12
- vatManagerFactory,
12
+ makeVatManager,
13
13
  kernelSlog,
14
14
  makeSourcedConsole,
15
15
  kernelKeeper,
@@ -127,7 +127,7 @@ export function makeVatLoader(stuff) {
127
127
  };
128
128
 
129
129
  const finish = starting && kernelSlog.startup(vatID);
130
- const manager = await vatManagerFactory(vatID, {
130
+ const manager = await makeVatManager(vatID, {
131
131
  managerOptions,
132
132
  liveSlotsOptions,
133
133
  });
@@ -150,7 +150,7 @@ export function makeVatLoader(stuff) {
150
150
  ...overrideVatManagerOptions,
151
151
  };
152
152
  const liveSlotsOptions = {};
153
- const manager = await vatManagerFactory(vatID, {
153
+ const manager = await makeVatManager(vatID, {
154
154
  managerOptions,
155
155
  liveSlotsOptions,
156
156
  });