@agoric/swingset-vat 0.32.3-dev-4fb0418.0 → 0.32.3-dev-d61be8d.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-4fb0418.0+4fb0418",
3
+ "version": "0.32.3-dev-d61be8d.0+d61be8d",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -27,17 +27,17 @@
27
27
  "@types/yargs-parser": "^21.0.0"
28
28
  },
29
29
  "dependencies": {
30
- "@agoric/assert": "0.6.1-dev-4fb0418.0+4fb0418",
31
- "@agoric/internal": "0.3.3-dev-4fb0418.0+4fb0418",
32
- "@agoric/kmarshal": "0.1.1-dev-4fb0418.0+4fb0418",
33
- "@agoric/store": "0.9.3-dev-4fb0418.0+4fb0418",
34
- "@agoric/swing-store": "0.9.2-dev-4fb0418.0+4fb0418",
35
- "@agoric/swingset-liveslots": "0.10.3-dev-4fb0418.0+4fb0418",
36
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-4fb0418.0+4fb0418",
37
- "@agoric/time": "0.3.3-dev-4fb0418.0+4fb0418",
38
- "@agoric/vat-data": "0.5.3-dev-4fb0418.0+4fb0418",
39
- "@agoric/xsnap": "0.14.3-dev-4fb0418.0+4fb0418",
40
- "@agoric/xsnap-lockdown": "0.14.1-dev-4fb0418.0+4fb0418",
30
+ "@agoric/assert": "0.6.1-dev-d61be8d.0+d61be8d",
31
+ "@agoric/internal": "0.3.3-dev-d61be8d.0+d61be8d",
32
+ "@agoric/kmarshal": "0.1.1-dev-d61be8d.0+d61be8d",
33
+ "@agoric/store": "0.9.3-dev-d61be8d.0+d61be8d",
34
+ "@agoric/swing-store": "0.9.2-dev-d61be8d.0+d61be8d",
35
+ "@agoric/swingset-liveslots": "0.10.3-dev-d61be8d.0+d61be8d",
36
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-d61be8d.0+d61be8d",
37
+ "@agoric/time": "0.3.3-dev-d61be8d.0+d61be8d",
38
+ "@agoric/vat-data": "0.5.3-dev-d61be8d.0+d61be8d",
39
+ "@agoric/xsnap": "0.14.3-dev-d61be8d.0+d61be8d",
40
+ "@agoric/xsnap-lockdown": "0.14.1-dev-d61be8d.0+d61be8d",
41
41
  "@endo/base64": "^0.2.34",
42
42
  "@endo/bundle-source": "^2.7.0",
43
43
  "@endo/captp": "^3.1.4",
@@ -102,5 +102,5 @@
102
102
  "typeCoverage": {
103
103
  "atLeast": 75.26
104
104
  },
105
- "gitHead": "4fb04184d1fb3497e3b8063bc9563d55fe87351d"
105
+ "gitHead": "d61be8d7fbda7dd3846cba38f8829e36bfae92a4"
106
106
  }
@@ -17,6 +17,10 @@ export function makeStartSubprocessWorkerNode(
17
17
  args.push('--cpu-prof-interval');
18
18
  args.push('100');
19
19
  args.push('--cpu-prof-name');
20
+ // cf. https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282
21
+ nameDisplayArg = nameDisplayArg
22
+ .replaceAll(':', '-')
23
+ .replaceAll(/[^a-z0-9._-]/gi, '_');
20
24
  args.push(`CPU.${nameDisplayArg}.cpuprofile`);
21
25
  }
22
26
  if (debugVats.includes(vatID)) {
@@ -1,32 +1,29 @@
1
- /* eslint-disable @jessie.js/safe-await-separator */
2
1
  import { Fail, q } from '@agoric/assert';
3
2
  import { kunser } from '@agoric/kmarshal';
4
3
  import { makeQueue } from '@endo/stream';
5
- import type { E } from '@endo/eventual-send';
6
-
7
- import type { SwingsetController } from '../src/controller/controller.js';
8
4
 
9
5
  const sink = () => {};
10
6
 
11
- export const makeRunUtils = (
12
- controller: SwingsetController,
13
- log = (..._) => {},
14
- ) => {
7
+ /**
8
+ * @param {import('../src/controller/controller.js').SwingsetController} controller
9
+ * @param {(...args: any[]) => void} [log]
10
+ */
11
+ export const makeRunUtils = (controller, log = (..._) => {}) => {
15
12
  let cranksRun = 0;
16
13
 
17
14
  const mutex = makeQueue();
18
15
 
19
16
  mutex.put(controller.run());
20
17
 
21
- const runThunk = async <T extends () => any>(
22
- thunk: T,
23
- ): Promise<ReturnType<T>> => {
24
- try {
25
- // this promise for the last lock may fail
26
- await mutex.get();
27
- } catch {
28
- // noop because the result will resolve for the previous runMethod return
29
- }
18
+ /**
19
+ * @template {() => any} T
20
+ * @param {T} thunk
21
+ * @returns {Promise<ReturnType<T>>}
22
+ */
23
+ const runThunk = async thunk => {
24
+ // this promise for the last lock may fail
25
+ // sink because the result will resolve for the previous runMethod return
26
+ await mutex.get().catch(sink);
30
27
 
31
28
  const thunkResult = await thunk();
32
29
 
@@ -60,10 +57,12 @@ export const makeRunUtils = (
60
57
  }
61
58
  };
62
59
 
63
- type EVProxy = typeof E & {
64
- sendOnly: (presence: unknown) => Record<string, (...args: any) => void>;
65
- vat: (name: string) => Record<string, (...args: any) => Promise<any>>;
66
- };
60
+ /**
61
+ * @typedef {import('@endo/eventual-send').EProxy & {
62
+ * sendOnly: (presence: unknown) => Record<string, (...args: any) => void>;
63
+ * vat: (name: string) => Record<string, (...args: any) => Promise<any>>;
64
+ * }} EVProxy
65
+ */
67
66
 
68
67
  // IMPORTANT WARNING TO USERS OF `EV`
69
68
  //
@@ -109,48 +108,56 @@ export const makeRunUtils = (
109
108
  // promise that can remain pending indefinitely, possibly to be settled by a
110
109
  // future message delivery.
111
110
 
111
+ /** @type {EVProxy} */
112
112
  // @ts-expect-error cast, approximate
113
- const EV: EVProxy = presence =>
114
- new Proxy(harden({}), {
115
- get: (_t, method, _rx) => {
116
- const boundMethod = (...args) =>
117
- queueAndRun(() =>
118
- controller.queueToVatObject(presence, method, args),
119
- );
120
- return harden(boundMethod);
121
- },
122
- });
123
- EV.vat = vatName =>
124
- new Proxy(harden({}), {
125
- get: (_t, method, _rx) => {
126
- const boundMethod = (...args) =>
127
- queueAndRun(() => controller.queueToVatRoot(vatName, method, args));
128
- return harden(boundMethod);
129
- },
130
- });
131
- // @ts-expect-error xxx
132
- EV.sendOnly = presence =>
133
- new Proxy(harden({}), {
134
- get: (_t, method, _rx) => {
135
- const boundMethod = (...args) =>
136
- queueAndRun(
137
- () => controller.queueToVatObject(presence, method, args),
138
- true,
139
- );
140
- return harden(boundMethod);
141
- },
142
- });
143
- // @ts-expect-error xxx
144
- EV.get = presence =>
145
- new Proxy(harden({}), {
146
- get: (_t, pathElement, _rx) =>
147
- queueAndRun(() =>
148
- controller.queueToVatRoot('bootstrap', 'awaitVatObject', [
149
- presence,
150
- [pathElement],
151
- ]),
152
- ),
153
- });
113
+ const EV = Object.assign(
114
+ presence =>
115
+ new Proxy(harden({}), {
116
+ get: (_t, method, _rx) => {
117
+ const boundMethod = (...args) =>
118
+ queueAndRun(() =>
119
+ controller.queueToVatObject(presence, method, args),
120
+ );
121
+ return harden(boundMethod);
122
+ },
123
+ }),
124
+ {
125
+ vat: vatName =>
126
+ new Proxy(harden({}), {
127
+ get: (_t, method, _rx) => {
128
+ const boundMethod = (...args) =>
129
+ queueAndRun(() =>
130
+ controller.queueToVatRoot(vatName, method, args),
131
+ );
132
+ return harden(boundMethod);
133
+ },
134
+ }),
135
+ sendOnly: presence =>
136
+ new Proxy(harden({}), {
137
+ get: (_t, method, _rx) => {
138
+ const boundMethod = (...args) =>
139
+ queueAndRun(
140
+ () => controller.queueToVatObject(presence, method, args),
141
+ true,
142
+ );
143
+ return harden(boundMethod);
144
+ },
145
+ }),
146
+ get: presence =>
147
+ new Proxy(harden({}), {
148
+ get: (_t, pathElement, _rx) =>
149
+ queueAndRun(() =>
150
+ controller.queueToVatRoot('bootstrap', 'awaitVatObject', [
151
+ presence,
152
+ [pathElement],
153
+ ]),
154
+ ),
155
+ }),
156
+ },
157
+ );
154
158
  return harden({ runThunk, EV });
155
159
  };
156
- export type RunUtils = ReturnType<typeof makeRunUtils>;
160
+
161
+ /**
162
+ * @typedef {ReturnType<typeof makeRunUtils>} RunUtils
163
+ */