Skip to content

Commit 0e841a8

Browse files
authored
docs: Add a glossary (#491)
Adds a glossary to the docs folder. This file contains terms that map to concepts found throughout the monorepo. Also updates the .cursorrules to engage language model reviewers in maintaining the glossary.
1 parent 8f9f0c6 commit 0e841a8

3 files changed

Lines changed: 91 additions & 0 deletions

File tree

.cursorrules

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,24 @@ Error handling:
8181

8282
Documentation:
8383

84+
- Check the [glossary](./docs/glossary.md) for definitions of unclear terms.
8485
- Use JSDoc and TypeDoc for public APIs.
8586
- Include examples and document error cases.
87+
- When adding glossary entries:
88+
- Include links to relevant implementation files using `[term](../path/to/file.ts)` syntax
89+
- Use cross-references with `[term](#term)` syntax to link related concepts
90+
- Consider how new terms relate to existing architectural concepts
91+
92+
PR review:
93+
94+
- Check if new terms, concepts, or architectural patterns are introduced that should be added to the glossary for AI agent accessibility.
95+
- Consider adding glossary entries for:
96+
- New technical terms or abbreviations
97+
- Core architectural components
98+
- Important data structures or types
99+
- Communication patterns or protocols
100+
- System operations or processes
101+
- Include links to relevant implementation files when adding glossary entries.
86102

87103
Changelog management:
88104

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ See [`packages/create-package/README.md`](packages/create-package/README.md).
6969
### Releasing
7070

7171
For information on creating releases, see the [MetaMask/core release documentation](https://github.com/MetaMask/core/blob/main/docs/contributing.md#releasing-changes).
72+
73+
## References
74+
75+
- [Glossary](./docs/glossary.md)

docs/glossary.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Glossary
2+
3+
## Concepts
4+
5+
### kernel
6+
A centralized manager of [vats](#vat) and [distributed objects](#distributed-object). See the [Kernel](../packages/ocap-kernel/src/Kernel.ts) class.
7+
8+
### vat
9+
A unit of compute managed by the [kernel](#kernel). See the [VatHandle](../packages/ocap-kernel/src/VatHandle.ts) and [VatSupervisor](../packages/ocap-kernel/src/VatSupervisor.ts) classes.
10+
11+
### cluster
12+
A logically related group of [vats](#vat), intended to be operated together. See the `ClusterConfig` type in [`packages/ocap-kernel/src/types.ts`](../packages/ocap-kernel/src/types.ts).
13+
14+
### distributed object
15+
A persistent object residing in a [vat](#vat) and asynchronously accessible to other vats. See the [implementation](../packages/ocap-kernel/src/store/methods/object.ts) in the kernel's storage methods.
16+
17+
### supervisor
18+
A component that manages the lifecycle and communication of a [vat](#vat). The [VatSupervisor](../packages/ocap-kernel/src/VatSupervisor.ts) handles [message delivery](#delivery), [syscalls](#syscall), and vat initialization.
19+
20+
### liveslots
21+
A framework for managing object lifecycles within [vats](#vat). Liveslots provides the runtime environment for vat code and handles object persistence, promise management, and [syscall](#syscall) coordination.
22+
23+
### crank
24+
A single execution cycle in the kernel's [run queue](#run-queue). Each crank processes one item from the run queue, delivering messages or notifications to [vats](#vat). Cranks can be aborted and rolled back if errors occur. See the [KernelQueue](../packages/ocap-kernel/src/KernelQueue.ts) for the run loop implementation.
25+
26+
### syscall
27+
A system call made by a [vat](#vat) to request kernel services. Syscalls include operations like sending messages, resolving [promises](#promise-resolution), and accessing persistent storage. See [VatSyscall](../packages/ocap-kernel/src/VatSyscall.ts) and the [syscall service](../packages/ocap-kernel/src/services/syscall.ts).
28+
29+
### delivery
30+
The process of sending a message or notification to a [vat](#vat). Deliveries can be of type 'message', 'notify', 'dropExports', 'retireExports', 'retireImports', or 'bringOutYourDead'. See the [router](#router) ([KernelRouter](../packages/ocap-kernel/src/KernelRouter.ts)) for delivery logic.
31+
32+
### marshaling
33+
The process of serializing and deserializing data for transmission between [vats](#vat). The kernel uses marshaling to convert object references and data structures into a format suitable for cross-vat communication. See the [kernel marshal service](../packages/ocap-kernel/src/services/kernel-marshal.ts) for `kser` and `kunser` functions.
34+
35+
### promise resolution
36+
The process of fulfilling or rejecting a promise. Promise resolutions are delivered as notifications to [vats](#vat) and can trigger cascading resolutions of dependent promises. See the [promise store methods](../packages/ocap-kernel/src/store/methods/promise.ts) for implementation details.
37+
38+
### garbage collection (GC)
39+
The process of identifying and cleaning up unreachable objects. The kernel performs GC by tracking reference counts and delivering appropriate notifications to [vats](#vat). **Important**: the garbage collection systems of the kernel, liveslots, and javascript are all mutually independent. See the [GC methods](../packages/ocap-kernel/src/store/methods/gc.ts) and [GC service](../packages/ocap-kernel/src/services/garbage-collection.ts) for implementation details.
40+
41+
### revocation
42+
The process of invalidating an object reference, preventing further access to the object. Revoked objects return errors when accessed. See the [revocation methods](../packages/ocap-kernel/src/store/methods/revocation.ts) for implementation.
43+
44+
### channel
45+
A communication pathway between different components, such as between a [vat](#vat) and the [kernel](#kernel), or between different [clusters](#cluster). Channels use [streams](#stream) for message passing. See the [BaseDuplexStream](../packages/streams/src/BaseDuplexStream.ts) for the core channel implementation.
46+
47+
### stream
48+
A remote asynchronous iterator that provides bidirectional communication between components. Streams implement the `Reader` interface from `@endo/stream` and can be used for message passing between [vats](#vat), kernel components, and external systems. See the [BaseDuplexStream](../packages/streams/src/BaseDuplexStream.ts) for bidirectional streams.
49+
50+
### run queue
51+
The kernel's main execution queue that processes messages, notifications, and [garbage collection](#garbage-collection-gc) actions. Each [crank](#crank) processes one item from this queue. See the [KernelQueue](../packages/ocap-kernel/src/KernelQueue.ts) class and [queue methods](../packages/ocap-kernel/src/store/methods/queue.ts) for implementation details.
52+
53+
### router
54+
The component responsible for routing messages to the correct [vat](#vat) based on target references and promise states. The router handles [delivery](#delivery) logic. See the [KernelRouter](../packages/ocap-kernel/src/KernelRouter.ts) for routing logic.
55+
56+
## Abbreviations
57+
58+
### clist
59+
A _clist_ (short for "capability list") is a bidirectional mapping between short, channel-specific identifiers and actual object references. The clist is unique to a channel-runtime pair, and translates between the javascript runtime which holds the object references and the channel which communicates about them.
60+
61+
### eref
62+
An _ERef_ (short for "endpoint reference") is a generic term for a ref which is either a [vref](#vref) or an [rref](#rref).
63+
64+
### kref
65+
A _KRef_ (short for "kernel reference") designates an Object within the scope of the Kernel itself. It is used in the translation of References between one Vat and another. A KRef is generated and assigned by the Kernel whenever an Object reference is imported into or exported from a Vat for the first time.
66+
67+
### rref
68+
An _RRef_ (short for "remote reference") designates an object within the scope of an established point-to-point communications [Channel](#channel) between two Clusters. An RRef does not survive the Channel it is associated with. An RRef is generated when the Kernel for one Cluster exports an Object Reference into the Channel connecting it to another Cluster's Kernel.
69+
70+
### vref
71+
A _VRef_ (short for "vat reference") designates an Object within the scope of the Objects known to a particular Vat. It is used across the Kernel/Vat boundary in the marshaling of messages delivered into or sent by that Vat. A VRef is generated and assigned by the Kernel when importing an Object Reference into a Vat for the first time and by the Vat when exporting an Object Reference from it for the first time.

0 commit comments

Comments
 (0)