Skip to content

Semi-0/Propagator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

374 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ppropogator

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.

Key Architectural Extensions

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 GenericValueSet and PatchedValueSet)
    • Object System: Ergonomic helpers and critics for object-oriented patterns (comprehensive_object.ts provides working utilities; object_propagator.ts is experimental/commented)
  • 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

Origins

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.

Installation

Quick Start

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.sh

This script will:

  • Clone required workspace dependencies (GenericProcedure, Sando)
  • Set up the workspace structure
  • Install all dependencies using bun
  • Run tests to verify the installation

Manual Setup

If you prefer to set up manually:

  1. 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
  1. Create a workspace package.json in the parent directory:
{
  "name": "propagator-workspace",
  "private": true,
  "workspaces": [
    "Propagator",
    "GenericProcedure",
    "Sando"
  ]
}
  1. Install dependencies:
bun install

Usage

Initialization

Some 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();

Running Tests

cd Propagator
bun test

Running Examples

cd Propagator
bun run index.ts

This project was created using bun init in bun v1.1.18. Bun is a fast all-in-one JavaScript runtime.

About

The Art of Propagator Magic in Typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors