Typescript implementation of propagator system from the art of propagator & SDF.
Including the implementation of basic cells, propagators, support layer, generic arithmetic, as well as simple backtracking(amb op).
Module map: the core propagator implementation is documented in Propagator/docs/README.md (file index and links to related packages).
The system extends a vector clock-based reactive system for transmitting values between cells and propagators. Vector clocks track causality and temporal ordering, enabling correct reactive updates in distributed and concurrent scenarios. Vector clocks can also be used as a Truth Maintenance System (TMS), tracking dependencies and support relationships between values (see test/advanceReactive.test.ts and DataTypes/TemporaryValueSet.ts). Cells support reflectivity, allowing them to observe and react to their own state changes.
Beyond vector clock-based reactivity, this implementation introduces several major architectural changes:
-
Distributed Execution Models:
- WorkerCell: Cells can run in isolated worker threads for parallel computation
- RemoteCell/SocketIOCell: Network-based distributed cells for multi-machine computation
- SubnetCell: Isolated subnetworks with independent schedulers
-
Dynamic Behavior System:
- Patch System: Hot-swappable cell strategies for memory, intake, selection, and emission (see
PatchSystem/) - Generic Propagator: Framework for creating generic, extensible propagators with critic-based handler dispatch (actively used in
GenericValueSetandPatchedValueSet) - Object System: Ergonomic helpers and critics for object-oriented patterns (
comprehensive_object.tsprovides working utilities;object_propagator.tsis experimental/commented)
- Patch System: Hot-swappable cell strategies for memory, intake, selection, and emission (see
-
Advanced Scheduler Framework:
- Multiple scheduler implementations (Simple, Staged, Reactive, Experimental, Proposed)
- Promise/Async Support: Scheduler supports asynchronous operations and promises
- Steppable Execution: Fine-grained control over propagator execution
- Replay System: Ability to replay propagator execution for debugging
-
Virtualization & Isolation:
- Virtual Environment: Virtual copy operations for isolated execution contexts
- CarriedCell: Cells that carry other cells, enabling nested and structured data
-
Observability:
- Both cells and propagators can be observed by external observers
- Full execution replay and debugging capabilities
- Visualization and introspection support
This library is a TypeScript reimplementation of propagator-based infrastructure originally developed by Chris Hanson and Gerald Jay Sussman as part of the SDF system accompanying the book Software Design for Flexibility.
The original implementation is written in MIT/GNU Scheme and released under the GNU General Public License v3 or later.
The easiest way to set up the Propagator workspace is using the provided install script:
git clone https://github.com/Semi-0/Propagator.git
cd Propagator
./install.shThis script will:
- Clone required workspace dependencies (GenericProcedure, Sando)
- Set up the workspace structure
- Install all dependencies using
bun - Run tests to verify the installation
If you prefer to set up manually:
- Clone the repository and its dependencies:
git clone https://github.com/Semi-0/Propagator.git
git clone https://github.com/Semi-0/GenericProcedure.git
git clone https://github.com/Semi-0/Sando.git- Create a workspace
package.jsonin the parent directory:
{
"name": "propagator-workspace",
"private": true,
"workspaces": [
"Propagator",
"GenericProcedure",
"Sando"
]
}- Install dependencies:
bun installSome subsystems rely on generic-procedure handlers (e.g. get_id, get_children).
Call init_propagator_system() once during your app/test bootstrap to install them.
import { init_propagator_system } from "ppropogator";
await init_propagator_system();cd Propagator
bun testcd Propagator
bun run index.tsThis project was created using bun init in bun v1.1.18. Bun is a fast all-in-one JavaScript runtime.