@agoric/swingset-liveslots 0.10.3-other-dev-3eb1a1d.0 → 0.10.3-other-dev-fbe72e7.0.fbe72e7

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.
Files changed (86) hide show
  1. package/package.json +26 -26
  2. package/src/boyd-gc.d.ts +12 -0
  3. package/src/boyd-gc.d.ts.map +1 -0
  4. package/src/cache.d.ts +71 -0
  5. package/src/cache.d.ts.map +1 -0
  6. package/src/capdata.d.ts +16 -0
  7. package/src/capdata.d.ts.map +1 -0
  8. package/src/capdata.js +16 -8
  9. package/src/collectionManager.d.ts +47 -0
  10. package/src/collectionManager.d.ts.map +1 -0
  11. package/src/collectionManager.js +1 -0
  12. package/src/facetiousness.d.ts +25 -0
  13. package/src/facetiousness.d.ts.map +1 -0
  14. package/src/index.d.ts +4 -0
  15. package/src/index.d.ts.map +1 -0
  16. package/src/kdebug.d.ts +7 -0
  17. package/src/kdebug.d.ts.map +1 -0
  18. package/src/liveslots.d.ts +42 -0
  19. package/src/liveslots.d.ts.map +1 -0
  20. package/src/liveslots.js +6 -4
  21. package/src/message.d.ts +49 -0
  22. package/src/message.d.ts.map +1 -0
  23. package/src/message.js +7 -3
  24. package/src/parseVatSlots.d.ts +125 -0
  25. package/src/parseVatSlots.d.ts.map +1 -0
  26. package/src/types.d.ts +81 -0
  27. package/src/types.d.ts.map +1 -0
  28. package/src/types.js +6 -5
  29. package/src/vatDataTypes.d.ts +170 -0
  30. package/src/vatDataTypes.d.ts.map +1 -0
  31. package/src/vatDataTypes.ts +272 -0
  32. package/src/vatstore-iterators.d.ts +4 -0
  33. package/src/vatstore-iterators.d.ts.map +1 -0
  34. package/src/vatstore-usage.md +198 -0
  35. package/src/virtualObjectManager.d.ts +44 -0
  36. package/src/virtualObjectManager.d.ts.map +1 -0
  37. package/src/virtualObjectManager.js +70 -14
  38. package/src/virtualReferences.d.ts +61 -0
  39. package/src/virtualReferences.d.ts.map +1 -0
  40. package/src/vpid-tracking.md +92 -0
  41. package/src/watchedPromises.d.ts +31 -0
  42. package/src/watchedPromises.d.ts.map +1 -0
  43. package/src/watchedPromises.js +19 -12
  44. package/test/collections.test.js +25 -4
  45. package/test/dummyMeterControl.d.ts +2 -0
  46. package/test/dummyMeterControl.d.ts.map +1 -0
  47. package/test/engine-gc.d.ts +3 -0
  48. package/test/engine-gc.d.ts.map +1 -0
  49. package/test/gc-and-finalize.d.ts +5 -0
  50. package/test/gc-and-finalize.d.ts.map +1 -0
  51. package/test/gc-helpers.js +2 -2
  52. package/test/handled-promises.test.js +529 -163
  53. package/test/initial-vrefs.test.js +12 -18
  54. package/test/liveslots-helpers.d.ts +64 -0
  55. package/test/liveslots-helpers.d.ts.map +1 -0
  56. package/test/liveslots-helpers.js +1 -0
  57. package/test/liveslots-real-gc.test.js +11 -9
  58. package/test/liveslots.test.js +3 -3
  59. package/test/storeGC/lifecycle.test.js +13 -12
  60. package/test/util.d.ts +25 -0
  61. package/test/util.d.ts.map +1 -0
  62. package/test/util.js +2 -2
  63. package/test/vat-util.d.ts +9 -0
  64. package/test/vat-util.d.ts.map +1 -0
  65. package/test/virtual-objects/state-shape.test.js +312 -221
  66. package/test/virtual-objects/virtualObjectGC.test.js +37 -36
  67. package/test/virtual-objects/virtualObjectManager.test.js +41 -63
  68. package/test/vo-test-harness.test.js +13 -9
  69. package/test/waitUntilQuiescent.d.ts +3 -0
  70. package/test/waitUntilQuiescent.d.ts.map +1 -0
  71. package/tools/fakeCollectionManager.d.ts +14 -0
  72. package/tools/fakeCollectionManager.d.ts.map +1 -0
  73. package/tools/fakeVirtualObjectManager.d.ts +32 -0
  74. package/tools/fakeVirtualObjectManager.d.ts.map +1 -0
  75. package/tools/fakeVirtualSupport.d.ts +278 -0
  76. package/tools/fakeVirtualSupport.d.ts.map +1 -0
  77. package/tools/prepare-strict-test-env.d.ts +37 -0
  78. package/tools/prepare-strict-test-env.d.ts.map +1 -0
  79. package/tools/prepare-test-env.d.ts +2 -0
  80. package/tools/prepare-test-env.d.ts.map +1 -0
  81. package/tools/setup-vat-data.d.ts +9 -0
  82. package/tools/setup-vat-data.d.ts.map +1 -0
  83. package/tools/setup-vat-data.js +0 -1
  84. package/tools/vo-test-harness.d.ts +33 -0
  85. package/tools/vo-test-harness.d.ts.map +1 -0
  86. package/tools/vo-test-harness.js +21 -0
package/package.json CHANGED
@@ -1,44 +1,45 @@
1
1
  {
2
2
  "name": "@agoric/swingset-liveslots",
3
- "version": "0.10.3-other-dev-3eb1a1d.0+3eb1a1d",
3
+ "version": "0.10.3-other-dev-fbe72e7.0.fbe72e7",
4
4
  "description": "SwingSet ocap support layer",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "engines": {
8
- "node": "^18.12 || ^20.9"
8
+ "node": "^20.9 || ^22.11"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "exit 0",
12
12
  "test": "ava",
13
13
  "test:xs": "exit 0",
14
14
  "lint-fix": "yarn lint:eslint --fix",
15
- "lint": "run-s --continue-on-error lint:*",
16
- "lint:types": "tsc",
17
- "lint:eslint": "eslint ."
15
+ "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
16
+ "lint:types": "yarn run -T tsc",
17
+ "lint:eslint": "yarn run -T eslint .",
18
+ "prepack": "yarn run -T tsc --build tsconfig.build.json",
19
+ "postpack": "git clean -f ':!src/types-index.d.ts' '*.d.ts*' '*.tsbuildinfo'"
18
20
  },
19
21
  "dependencies": {
20
- "@agoric/internal": "0.3.3-other-dev-3eb1a1d.0+3eb1a1d",
21
- "@agoric/store": "0.9.3-other-dev-3eb1a1d.0+3eb1a1d",
22
- "@endo/env-options": "^1.1.8",
23
- "@endo/errors": "^1.2.8",
24
- "@endo/eventual-send": "^1.2.8",
25
- "@endo/exo": "^1.5.7",
26
- "@endo/far": "^1.1.9",
27
- "@endo/init": "^1.1.7",
28
- "@endo/marshal": "^1.6.2",
29
- "@endo/nat": "^5.0.13",
30
- "@endo/pass-style": "^1.4.7",
31
- "@endo/patterns": "^1.4.7",
32
- "@endo/promise-kit": "^1.1.8"
22
+ "@agoric/internal": "0.3.3-other-dev-fbe72e7.0.fbe72e7",
23
+ "@agoric/store": "0.9.3-other-dev-fbe72e7.0.fbe72e7",
24
+ "@endo/env-options": "^1.1.11",
25
+ "@endo/errors": "^1.2.13",
26
+ "@endo/eventual-send": "^1.3.4",
27
+ "@endo/exo": "^1.5.12",
28
+ "@endo/far": "^1.1.14",
29
+ "@endo/init": "^1.1.12",
30
+ "@endo/marshal": "^1.8.0",
31
+ "@endo/nat": "^5.1.3",
32
+ "@endo/pass-style": "^1.6.3",
33
+ "@endo/patterns": "^1.7.0",
34
+ "@endo/promise-kit": "^1.1.13"
33
35
  },
34
36
  "devDependencies": {
35
- "@agoric/kmarshal": "0.1.1-other-dev-3eb1a1d.0+3eb1a1d",
37
+ "@agoric/kmarshal": "0.1.1-other-dev-fbe72e7.0.fbe72e7",
36
38
  "ava": "^5.3.0"
37
39
  },
38
40
  "files": [
39
- "src/**/*.js",
40
- "src/**/*.d.ts",
41
- "test/**/*.js",
41
+ "src",
42
+ "test",
42
43
  "tools",
43
44
  "exported.js"
44
45
  ],
@@ -59,14 +60,13 @@
59
60
  "require": [
60
61
  "@endo/init/debug.js"
61
62
  ],
62
- "timeout": "20m",
63
- "workerThreads": false
63
+ "timeout": "20m"
64
64
  },
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
68
  "typeCoverage": {
69
- "atLeast": 75.24
69
+ "atLeast": 75.22
70
70
  },
71
- "gitHead": "3eb1a1d2d75b2b4a94807cd3bf759bc9fc531f05"
71
+ "gitHead": "fbe72e72107f9997f788674e668c660d92ec4492"
72
72
  }
@@ -0,0 +1,12 @@
1
+ export function makeBOYDKit({ gcTools, slotToVal, vrm, kernelRecognizableRemotables, syscall, possiblyDeadSet, possiblyRetiredSet, }: {
2
+ gcTools: any;
3
+ slotToVal: any;
4
+ vrm: any;
5
+ kernelRecognizableRemotables: any;
6
+ syscall: any;
7
+ possiblyDeadSet: any;
8
+ possiblyRetiredSet: any;
9
+ }): {
10
+ scanForDeadObjects: () => Promise<void>;
11
+ };
12
+ //# sourceMappingURL=boyd-gc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boyd-gc.d.ts","sourceRoot":"","sources":["boyd-gc.js"],"names":[],"mappings":"AA+YO;;;;;;;;;;EAqMN"}
package/src/cache.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @template V
3
+ * @callback CacheGet
4
+ * @param {string} key
5
+ * @returns {V | undefined}
6
+ */
7
+ /**
8
+ * @template V
9
+ * @callback CacheSet
10
+ * @param {string} key
11
+ * @param {V} value
12
+ * @returns {void}
13
+ */
14
+ /**
15
+ * @callback CacheDelete
16
+ * @param {string} key
17
+ * @returns {void}
18
+ *
19
+ * @callback CacheFlush
20
+ * @returns {void}
21
+ *
22
+ * @callback CacheInsistClear
23
+ * @returns {void}
24
+ */
25
+ /**
26
+ * @template V
27
+ * @typedef {object} Cache
28
+ * @property {CacheGet<V>} get
29
+ * @property {CacheSet<V>} set
30
+ * @property {CacheDelete} delete
31
+ * @property {CacheFlush} flush
32
+ * @property {CacheInsistClear} insistClear
33
+ */
34
+ /**
35
+ * Cache of virtual object/collection state
36
+ *
37
+ * This cache is empty between deliveries. Within a delivery, the
38
+ * first access to some data will cause vatstore reads to populate the
39
+ * cache, then the data is retained until end-of-delivery. Writes to
40
+ * data will update the cache entry and mark it as dirty. At
41
+ * end-of-delivery, we flush the cache, writing out any dirty entries,
42
+ * and deleting all entries.
43
+ *
44
+ * This needs RAM for everything read during a delivery (rather than
45
+ * having a fixed maximum size), but yields a simple (easy to debug)
46
+ * deterministic relationship between data access and reads/writes to
47
+ * the backing store.
48
+ *
49
+ * @template V
50
+ * @param {(key: string) => V} readBacking
51
+ * @param {(key: string, value: V) => void} writeBacking
52
+ * @param {(key: string) => void} deleteBacking
53
+ * @returns {Cache<V>}
54
+ *
55
+ * This cache is part of the virtual object manager and is not intended to be
56
+ * used independently; it is exported only for the benefit of test code.
57
+ */
58
+ export function makeCache<V>(readBacking: (key: string) => V, writeBacking: (key: string, value: V) => void, deleteBacking: (key: string) => void): Cache<V>;
59
+ export type CacheGet<V> = (key: string) => V | undefined;
60
+ export type CacheSet<V> = (key: string, value: V) => void;
61
+ export type CacheDelete = (key: string) => void;
62
+ export type CacheFlush = () => void;
63
+ export type CacheInsistClear = () => void;
64
+ export type Cache<V> = {
65
+ get: CacheGet<V>;
66
+ set: CacheSet<V>;
67
+ delete: CacheDelete;
68
+ flush: CacheFlush;
69
+ insistClear: CacheInsistClear;
70
+ };
71
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["cache.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;;;;GAMG;AACH;;;;;;;;;;GAUG;AACH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,0BATa,CAAC,eACH,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,gBAClB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,iBAC/B,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACnB,KAAK,CAAC,CAAC,CAAC,CAkDpB;qBAvGY,CAAC,UAEH,MAAM,KACJ,CAAC,GAAG,SAAS;qBAIb,CAAC,UAEH,MAAM,SACN,CAAC,KACC,IAAI;gCAIN,MAAM,KACJ,IAAI;+BAGJ,IAAI;qCAGJ,IAAI;kBAGJ,CAAC;SAEA,QAAQ,CAAC,CAAC,CAAC;SACX,QAAQ,CAAC,CAAC,CAAC;YACX,WAAW;WACX,UAAU;iBACV,gBAAgB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @import {assertCapData} from '@agoric/internal/src/marshal.js';
3
+ */
4
+ /**
5
+ * Assert function to ensure that something expected to be a capdata object
6
+ * actually is. A capdata object should have a .body property that's a string
7
+ * and a .slots property that's an array of strings.
8
+ *
9
+ * @see {assertCapData} for the general case
10
+ * @param {any} specimen The object to be tested
11
+ * @throws {Error} if, upon inspection, the parameter does not satisfy the above
12
+ * criteria.
13
+ * @returns {asserts specimen is import('./types.js').SwingSetCapData}
14
+ */
15
+ export function insistCapData(specimen: any): asserts specimen is import("./types.js").SwingSetCapData;
16
+ //# sourceMappingURL=capdata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capdata.d.ts","sourceRoot":"","sources":["capdata.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;;;;;;;;GAUG;AACH,wCALW,GAAG,GAGD,QAAQ,QAAQ,IAAI,OAAO,YAAY,EAAE,eAAe,CAWpE"}
package/src/capdata.js CHANGED
@@ -1,19 +1,27 @@
1
1
  import { Fail } from '@endo/errors';
2
2
 
3
+ /**
4
+ * @import {assertCapData} from '@agoric/internal/src/marshal.js';
5
+ */
6
+
3
7
  /**
4
8
  * Assert function to ensure that something expected to be a capdata object
5
9
  * actually is. A capdata object should have a .body property that's a string
6
10
  * and a .slots property that's an array of strings.
7
11
  *
8
- * @param {any} capdata The object to be tested
12
+ * @see {assertCapData} for the general case
13
+ * @param {any} specimen The object to be tested
9
14
  * @throws {Error} if, upon inspection, the parameter does not satisfy the above
10
15
  * criteria.
11
- * @returns {asserts capdata is import('./types.js').SwingSetCapData}
16
+ * @returns {asserts specimen is import('./types.js').SwingSetCapData}
12
17
  */
13
- export function insistCapData(capdata) {
14
- typeof capdata.body === 'string' ||
15
- Fail`capdata has non-string .body ${capdata.body}`;
16
- Array.isArray(capdata.slots) ||
17
- Fail`capdata has non-Array slots ${capdata.slots}`;
18
- // TODO check that the .slots array elements are actually strings
18
+ export function insistCapData(specimen) {
19
+ typeof specimen.body === 'string' ||
20
+ Fail`capdata has non-string .body ${specimen.body}`;
21
+ Array.isArray(specimen.slots) ||
22
+ Fail`capdata has non-Array slots ${specimen.slots}`;
23
+ assert(
24
+ specimen.slots.every(slot => typeof slot === 'string'),
25
+ 'All slots must be strings',
26
+ );
19
27
  }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @param {*} syscall
3
+ * @param {import('./virtualReferences.js').VirtualReferenceManager} vrm
4
+ * @param {() => number} allocateExportID
5
+ * @param {() => number} allocateCollectionID
6
+ * @param {(val: any) => string | undefined} convertValToSlot
7
+ * @param {*} convertSlotToVal
8
+ * @param {*} registerValue
9
+ * @param {ToCapData<string>} serialize
10
+ * @param {FromCapData<string>} unserialize
11
+ * @param {(capDatas: any) => void} assertAcceptableSyscallCapdataSize
12
+ */
13
+ export function makeCollectionManager(syscall: any, vrm: import("./virtualReferences.js").VirtualReferenceManager, allocateExportID: () => number, allocateCollectionID: () => number, convertValToSlot: (val: any) => string | undefined, convertSlotToVal: any, registerValue: any, serialize: ToCapData<string>, unserialize: FromCapData<string>, assertAcceptableSyscallCapdataSize: (capDatas: any) => void): {
14
+ initializeStoreKindInfo: () => void;
15
+ makeScalarBigMapStore: <K, V>(label?: string, options?: StoreOptions) => MapStore<K, V>;
16
+ makeScalarBigWeakMapStore: <K, V>(label?: string, options?: StoreOptions) => WeakMapStore<K, V>;
17
+ makeScalarBigSetStore: <K>(label?: string, options?: StoreOptions) => SetStore<K>;
18
+ makeScalarBigWeakSetStore: <K>(label?: string, options?: StoreOptions) => WeakSetStore<K>;
19
+ provideBaggage: () => any;
20
+ flushSchemaCache: () => void;
21
+ getRetentionStats: () => {};
22
+ testHooks: {
23
+ obtainStoreKindID: (kindName: any) => any;
24
+ storeSizeInternal: (vobjID: any) => number;
25
+ makeCollection: (label: any, kindName: any, isDurable: any, keyShape: any, valueShape: any) => (string | {
26
+ has: (key: any) => boolean;
27
+ get: (key: any) => any;
28
+ init: (key: any, value: any) => void;
29
+ addToSet: (key: any) => void;
30
+ addAllToSet: (elems: any) => void;
31
+ addAllToMap: (mapEntries: any) => void;
32
+ set: (key: any, value: any) => void;
33
+ delete: (key: any) => void;
34
+ })[];
35
+ };
36
+ };
37
+ export const collectionMetaKeys: Set<string>;
38
+ export type SchemaCacheValue = {
39
+ keyShape: Pattern;
40
+ valueShape: Pattern;
41
+ label: string;
42
+ schemataCapData: object;
43
+ };
44
+ import type { ToCapData } from '@endo/marshal';
45
+ import type { FromCapData } from '@endo/marshal';
46
+ import type { Pattern } from '@endo/patterns';
47
+ //# sourceMappingURL=collectionManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectionManager.d.ts","sourceRoot":"","sources":["collectionManager.js"],"names":[],"mappings":"AAoHA;;;;;;;;;;;GAWG;AACH,+CAXW,GAAC,OACD,OAAO,wBAAwB,EAAE,uBAAuB,oBACxD,MAAM,MAAM,wBACZ,MAAM,MAAM,oBACZ,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,SAAS,oBAChC,GAAC,iBACD,GAAC,aACD,UAAU,MAAM,CAAC,eACjB,YAAY,MAAM,CAAC,sCACnB,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI;;4BAs+BnB,CAAC,EAAC,CAAC,UACL,MAAM,YACN,YAAY,KACV,QAAQ,CAAC,CAAC,EAAC,CAAC,CAAC;gCASb,CAAC,EAAC,CAAC,UACL,MAAM,YACN,YAAY,KACV,YAAY,CAAC,CAAC,EAAC,CAAC,CAAC;4BASjB,CAAC,UACH,MAAM,YACN,YAAY,KACV,QAAQ,CAAC,CAAC,CAAC;gCASX,CAAC,UACH,MAAM,YACN,YAAY,KACV,YAAY,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;EAsB7B;AA7lCD,6CAIG;;cAIW,OAAO;gBACP,OAAO;WACP,MAAM;qBACN,MAAM;;+BAnDqB,eAAe;iCAAf,eAAe;6BAC9B,gBAAgB"}
@@ -27,6 +27,7 @@ import { makeCache } from './cache.js';
27
27
 
28
28
  /**
29
29
  * @import {ToCapData, FromCapData} from '@endo/marshal';
30
+ * @import {Pattern} from '@endo/patterns';
30
31
  */
31
32
 
32
33
  // XXX TODO: The following key length limit was put in place due to limitations
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Assess the facetiousness of a value. If the value is an object containing
3
+ * only named properties and each such property's value is a function, `obj`
4
+ * represents a single facet and 'one' is returned. If each property's value
5
+ * is instead an object of facetiousness 'one', `obj` represents multiple
6
+ * facets and 'many' is returned. In all other cases `obj` does not represent
7
+ * any kind of facet abstraction and 'not' is returned.
8
+ *
9
+ * @typedef {'one'|'many'|'not'} Facetiousness
10
+ *
11
+ * @param {*} obj The (alleged) object to be assessed
12
+ * @returns {Facetiousness} an assessment of the facetiousness of `obj`
13
+ */
14
+ export function assessFacetiousness(obj: any): Facetiousness;
15
+ export function checkAndUpdateFacetiousness(tag: any, desc: any, proposedFacetNames: any): any;
16
+ /**
17
+ * Assess the facetiousness of a value. If the value is an object containing
18
+ * only named properties and each such property's value is a function, `obj`
19
+ * represents a single facet and 'one' is returned. If each property's value
20
+ * is instead an object of facetiousness 'one', `obj` represents multiple
21
+ * facets and 'many' is returned. In all other cases `obj` does not represent
22
+ * any kind of facet abstraction and 'not' is returned.
23
+ */
24
+ export type Facetiousness = "one" | "many" | "not";
25
+ //# sourceMappingURL=facetiousness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facetiousness.d.ts","sourceRoot":"","sources":["facetiousness.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,yCAHW,GAAC,GACC,aAAa,CA+BzB;AAGM,+FAwCN;;;;;;;;;4BA7EY,KAAK,GAAC,MAAM,GAAC,KAAK"}
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./types-index.js";
2
+ export { makeLiveSlots, makeMarshaller } from "./liveslots.js";
3
+ export { insistMessage, insistVatDeliveryObject, insistVatDeliveryResult, insistVatSyscallObject, insistVatSyscallResult } from "./message.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export function kdebugEnable(flag: any): void;
2
+ export function kdebug(...args: any[]): void;
3
+ export function legibilizeValue(val: any, slots: any, smallcaps: any): any;
4
+ export function legibilizeMethod(method: any, smallcaps: any): string;
5
+ export function extractMethod(methargsCapdata: any): string;
6
+ export function legibilizeMessageArgs(methargsCapdata: any): any[] | "<unintelligible message args>";
7
+ //# sourceMappingURL=kdebug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kdebug.d.ts","sourceRoot":"","sources":["kdebug.js"],"names":[],"mappings":"AAEA,8CAEC;AAED,6CAIC;AAED,2EAwEC;AAED,sEAmDC;AAED,4DAaC;AAED,qGAkBC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Instantiate the liveslots layer for a new vat and then populate the vat with
3
+ * a new root object and its initial associated object graph, if any.
4
+ *
5
+ * @param {*} syscall Kernel syscall interface that the vat will have access to
6
+ * @param {*} forVatID Vat ID label, for use in debug diagostics
7
+ * @param {*} vatPowers
8
+ * @param {import('./types.js').LiveSlotsOptions} liveSlotsOptions
9
+ * @param {*} gcTools { WeakRef, FinalizationRegistry, waitUntilQuiescent }
10
+ * @param {LimitedConsole} [liveSlotsConsole]
11
+ * @param {*} [buildVatNamespace]
12
+ *
13
+ * @returns {*} { dispatch }
14
+ *
15
+ * setBuildRootObject should be called, once, with a function that will
16
+ * create a root object for the new vat The caller provided buildRootObject
17
+ * function produces and returns the new vat's root object:
18
+ *
19
+ * buildRootObject(vatPowers, vatParameters)
20
+ *
21
+ * Within the vat, `import { E } from '@endo/eventual-send'` will
22
+ * provide the E wrapper. For any object x, E(x) returns a proxy object
23
+ * that converts any method invocation into a corresponding eventual send
24
+ * to x. That is, E(x).foo(arg1, arg2) is equivalent to x~.foo(arg1,
25
+ * arg2)
26
+ *
27
+ * If x is the presence in this vat of a remote object (that is, an object
28
+ * outside the vat), this will result in a message send out of the vat via
29
+ * the kernel syscall interface.
30
+ *
31
+ * In the same vein, if x is the presence in this vat of a kernel device,
32
+ * vatPowers.D(x) returns a proxy such that a method invocation on it is
33
+ * translated into the corresponding immediate invocation of the device
34
+ * (using, once again, the kernel syscall interface). D(x).foo(args) will
35
+ * perform an immediate syscall.callNow on the device node.
36
+ */
37
+ export function makeLiveSlots(syscall: any, forVatID: any | undefined, vatPowers: any | undefined, liveSlotsOptions: import("./types.js").LiveSlotsOptions, gcTools: any, liveSlotsConsole?: LimitedConsole, buildVatNamespace?: any): any;
38
+ export function makeMarshaller(syscall: any, gcTools: any, vatID?: string): {
39
+ m: any;
40
+ };
41
+ import type { LimitedConsole } from '@agoric/internal/src/js-utils.js';
42
+ //# sourceMappingURL=liveslots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liveslots.d.ts","sourceRoot":"","sources":["liveslots.js"],"names":[],"mappings":"AAm9CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,uCAhCW,GAAC,YACD,GAAC,yBACD,GAAC,gCACD,OAAO,YAAY,EAAE,gBAAgB,WACrC,GAAC,qBACD,cAAc,sBACd,GAAC,GAEC,GAAC,CAgDb;AAGD;;EAIC;oCAtgDiC,kCAAkC"}
package/src/liveslots.js CHANGED
@@ -14,6 +14,8 @@ import { makeCollectionManager } from './collectionManager.js';
14
14
  import { makeWatchedPromiseManager } from './watchedPromises.js';
15
15
  import { makeBOYDKit } from './boyd-gc.js';
16
16
 
17
+ /** @import {LimitedConsole} from '@agoric/internal/src/js-utils.js'; */
18
+
17
19
  const SYSCALL_CAPDATA_BODY_SIZE_LIMIT = 10_000_000;
18
20
  const SYSCALL_CAPDATA_SLOTS_LENGTH_LIMIT = 10_000;
19
21
 
@@ -32,7 +34,7 @@ const SYSCALL_CAPDATA_SLOTS_LENGTH_LIMIT = 10_000;
32
34
  * @param {import('./types.js').LiveSlotsOptions} liveSlotsOptions
33
35
  * @param {*} gcTools { WeakRef, FinalizationRegistry, waitUntilQuiescent, gcAndFinalize,
34
36
  * meterControl }
35
- * @param {Pick<Console, 'debug' | 'log' | 'info' | 'warn' | 'error'>} console
37
+ * @param {LimitedConsole} console
36
38
  * @param {*} buildVatNamespace
37
39
  *
38
40
  * @returns {*} { dispatch }
@@ -795,6 +797,7 @@ function build(
795
797
  for (const resolution of resolutions) {
796
798
  const [xvpid] = resolution;
797
799
  maybeNewVPIDs.delete(xvpid);
800
+ unregisterUnreferencedVPID(xvpid);
798
801
  }
799
802
  }
800
803
  for (const newVPID of Array.from(maybeNewVPIDs).sort()) {
@@ -1010,14 +1013,13 @@ function build(
1010
1013
  for (const resolution of resolutions) {
1011
1014
  const [xvpid] = resolution;
1012
1015
  maybeNewVPIDs.delete(xvpid);
1016
+ unregisterUnreferencedVPID(xvpid);
1013
1017
  }
1014
1018
  // track everything that's left
1015
1019
  for (const newVPID of Array.from(maybeNewVPIDs).sort()) {
1016
1020
  maybeExportPromise(newVPID);
1017
1021
  }
1018
1022
 
1019
- // only the primary can possibly be newly resolved
1020
- unregisterUnreferencedVPID(vpid);
1021
1023
  exportedVPIDs.delete(vpid);
1022
1024
  }
1023
1025
 
@@ -1496,7 +1498,7 @@ function build(
1496
1498
  * @param {*} vatPowers
1497
1499
  * @param {import('./types.js').LiveSlotsOptions} liveSlotsOptions
1498
1500
  * @param {*} gcTools { WeakRef, FinalizationRegistry, waitUntilQuiescent }
1499
- * @param {Pick<Console, 'debug' | 'log' | 'info' | 'warn' | 'error'>} [liveSlotsConsole]
1501
+ * @param {LimitedConsole} [liveSlotsConsole]
1500
1502
  * @param {*} [buildVatNamespace]
1501
1503
  *
1502
1504
  * @returns {*} { dispatch }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @import {VatDeliveryResult} from './types.js';
3
+ */
4
+ /**
5
+ * @typedef {{
6
+ * methargs: import('./types.js').SwingSetCapData, // of [method, args]
7
+ * result: string | undefined | null,
8
+ * }} Message
9
+ */
10
+ /**
11
+ * Assert function to ensure that something expected to be a message object
12
+ * actually is. A message object should have a .method property that's a
13
+ * string, a .args property that's a capdata object, and optionally a .result
14
+ * property that, if present, must be a string.
15
+ *
16
+ * @param {any} message The object to be tested
17
+ *
18
+ * @throws {Error} if, upon inspection, the parameter does not satisfy the above
19
+ * criteria.
20
+ *
21
+ * @returns {asserts message is Message}
22
+ */
23
+ export function insistMessage(message: any): asserts message is Message;
24
+ /**
25
+ * @param {unknown} vdo
26
+ * @returns {asserts vdo is import('./types.js').VatDeliveryObject}
27
+ */
28
+ export function insistVatDeliveryObject(vdo: unknown): asserts vdo is import("./types.js").VatDeliveryObject;
29
+ /**
30
+ * @param {unknown} vdr
31
+ * @returns {asserts vdr is VatDeliveryResult}
32
+ */
33
+ export function insistVatDeliveryResult(vdr: unknown): asserts vdr is VatDeliveryResult;
34
+ /**
35
+ * @param {unknown} vso
36
+ * @returns {asserts vso is import('./types.js').VatSyscallObject}
37
+ */
38
+ export function insistVatSyscallObject(vso: unknown): asserts vso is import("./types.js").VatSyscallObject;
39
+ /**
40
+ * @param {unknown} vsr
41
+ * @returns {asserts vsr is import('./types.js').VatSyscallResult}
42
+ */
43
+ export function insistVatSyscallResult(vsr: unknown): asserts vsr is import("./types.js").VatSyscallResult;
44
+ export type Message = {
45
+ methargs: import("./types.js").SwingSetCapData;
46
+ result: string | undefined | null;
47
+ };
48
+ import type { VatDeliveryResult } from './types.js';
49
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["message.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH,uCARW,GAAG,GAKD,QAAQ,OAAO,IAAI,OAAO,CAStC;AAED;;;GAGG;AAEH,6CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,OAAO,YAAY,EAAE,iBAAiB,CAwDjE;AAED;;;GAGG;AAEH,6CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,iBAAiB,CAkB5C;AAED;;;GAGG;AAEH,4CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,OAAO,YAAY,EAAE,gBAAgB,CA4EhE;AAED;;;GAGG;AAEH,4CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,OAAO,YAAY,EAAE,gBAAgB,CAkBhE;sBAlNY;IACV,QAAQ,EAAE,OAAO,YAAY,EAAE,eAAe,CAAC;IAC/C,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CACjC;uCAPgC,YAAY"}
package/src/message.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import { assert, Fail } from '@endo/errors';
2
2
  import { insistCapData } from './capdata.js';
3
3
 
4
+ /**
5
+ * @import {VatDeliveryResult} from './types.js';
6
+ */
7
+
4
8
  /**
5
9
  * @typedef {{
6
10
  * methargs: import('./types.js').SwingSetCapData, // of [method, args]
@@ -32,7 +36,7 @@ export function insistMessage(message) {
32
36
 
33
37
  /**
34
38
  * @param {unknown} vdo
35
- * @returns {asserts vdo is import('./types').VatDeliveryObject}
39
+ * @returns {asserts vdo is import('./types.js').VatDeliveryObject}
36
40
  */
37
41
 
38
42
  export function insistVatDeliveryObject(vdo) {
@@ -114,7 +118,7 @@ export function insistVatDeliveryResult(vdr) {
114
118
 
115
119
  /**
116
120
  * @param {unknown} vso
117
- * @returns {asserts vso is import('./types').VatSyscallObject}
121
+ * @returns {asserts vso is import('./types.js').VatSyscallObject}
118
122
  */
119
123
 
120
124
  export function insistVatSyscallObject(vso) {
@@ -194,7 +198,7 @@ export function insistVatSyscallObject(vso) {
194
198
 
195
199
  /**
196
200
  * @param {unknown} vsr
197
- * @returns {asserts vsr is import('./types').VatSyscallResult}
201
+ * @returns {asserts vsr is import('./types.js').VatSyscallResult}
198
202
  */
199
203
 
200
204
  export function insistVatSyscallResult(vsr) {