Skip to main content

simulator/src

packages/simulator/src

Purpose

Code-first simulator API.

Public surface

AgentConnection

Interface
Runtime connection issued by every router implementation. It carries the credential and address a runtime dials; each runtime chooses its own startup deadline and owns whatever readiness evidence its process exposes.

AgentHandle

Class
A participant whose autonomous runtime is owned by the run scope.

AgentProcessExited

Class
A roster runtime process terminated with an operating-system exit code.

AgentProcessSignaled

Class
A roster runtime process terminated because it received a signal.

AgentRuntimeCompleted

Class
An autonomous runtime completed normally.

AgentRuntimeFailed

Class
An autonomous runtime completed with a recorded failure.

AgentRuntimeReady

Class
A roster runtime has acquired its identity and completed readiness.

AgentRuntimeStartFailed

Class
A roster runtime failed before it established readiness.

ClusterError

Class
Cluster loss that ends a run without exposing its backend.

ClusterLost

Class
Post-allocation cluster error plus all durable evidence retained.

ClusterServices

TypeAlias
Opaque service set supplied by a local-Kubernetes or GKE Layer.

CompletedLedgerReceipt

Class
Physical receipt for a ledger whose completion marker is durable.

ConversationAddress

Class
A participant-independent network address. Binding an endpoint produces a conversation socket; the address itself never implies a sender.

ConversationOpened

Class
A participant allocated a conversation address for a nonempty group.

ConversationParticipants

TypeAlias
Every conversation has at least one participant of any network role.

ConversationSocket

Class
A conversation address bound to exactly one controlled endpoint.

coreEvents

Variable
The exact event classes readable from every simulator run ledger.

CustomerEvents

Interface
Definition-bound emission of customer-owned event classes only.

EncodedEventOf

TypeAlias
The closed encoded union persisted for a catalog.

Endpoint

Class
A run-scoped participant controlled directly by the experiment program.

EndpointMessageReceived

Class
A controlled endpoint received a message through the data plane.

EndpointMessageSent

Class
A controlled endpoint committed a message through the data plane.

EventCatalog

Class
The exact immutable event universe for one definition. The private type identifier makes catalog arguments nominal: a structural object cannot claim a schema, constructor list, and tag list that disagree.

EventCatalogDefinitionError

Class
Invalid catalogs fail during definition construction, before a run starts.

EventCatalogDefinitionFailure

TypeAlias
Represents event catalog definition failure conditions.

EventClass

TypeAlias
A schema-backed event constructor. The catalog retains both the schema and constructor faces so persisted values decode back into their exact class.

EventClassOf

TypeAlias
The closed constructor union declared by a catalog.

EventMetadata

Interface
Causality metadata accepted from a customer event producer.

EventOf

TypeAlias
The closed instance union declared by a catalog.

IncompleteLedgerReceipt

Class
Physical receipt retained when ledger completion could not be published.

isEntryModule

Function
Whether a module is the process entry point rather than an ordinary import. Both sides are canonicalized because they are not the same kind of path: Node resolves a module’s real path before it becomes import.meta.url, while process.argv[1] is whatever the caller typed. Every executable in this package reaches its module through a symlink in the controller image, where /opt/moltzap/dist points at the installed package directory. Comparing the two without canonicalizing makes a directly invoked entry point look like an import, so the process exits successfully having done nothing. realPath returns undefined for a path that does not exist, so a missing or deleted argv[1] is a plain false rather than a thrown ENOENT. Returns: Whether both locations name the same real file.

LedgerFailure

TypeAlias
Represents ledger failure conditions.

LedgerReceipt

TypeAlias
Decoded physical ledger receipt.

LedgerReceipt

Variable
Schema for the complete physical ledger-receipt universe.

LinkController

Class
Experiment-facing directed-link control installed by the run kernel.

LinkControllerService

Interface
Run-scoped, evidence-producing directed-link control.

LinkDelivery

Interface
One committed message about to cross a directed link.

LinkDown

Class
A directed participant link transitioned from available to unavailable.

LinkMessageDelayed

Class
Active link policies deferred one delivery by a known total duration.

LinkMessageDropped

Class
An active link policy discarded one committed message before delivery.

LinkMessageHeld

Class
An active link policy parked one delivery until its lease clears.

linkPolicy

Variable
Canonical link policies for the common traffic shapes.

LinkPolicy

TypeAlias
Decides one delivery on a directed link. A policy reads only its input and the ambient Clock; the link interpreter, never the policy, spends time and records evidence.

LinkPolicyCleared

Class
A described policy stopped shaping one directed participant link.

LinkPolicySet

Class
A described policy became active on one directed participant link.

LinkUp

Class
A directed participant link transitioned from unavailable to available.

linkVerdict

Variable
Constructors and matchers for the closed verdict union.

LinkVerdict

TypeAlias
Closed per-delivery decision returned by a link policy.

MessageParts

TypeAlias
Nonempty protocol message content.

Network

Class
Network operations available to the customer program.

NetworkError

Class
An operational failure at a network boundary.

NetworkService

Interface
Controlled endpoint operations installed for one run scope.

ParticipantHandle

Class
A router-issued network identity. The hidden symbol prevents structurally similar protocol data from being used as an identity handle.

ProgramFailed

Class
The customer program failed with a typed failure or defect.

ProgramFinished

Class
Customer-program completion plus its complete durable evidence.

ProgramInterrupted

Class
The customer program was interrupted.

ProgramSucceeded

Class
The customer program returned successfully.

ReadableRunLedger

Interface
Definition-bound read access to every committed core and customer event.

ReceivedMessage

Interface
A message delivered to one attached endpoint.

RouterMessageCommitted

Class
The router durably committed one message, plaintext parts included.

RouterStarted

Class
The run-scoped router is accepting participant connections.

RouterStartFailed

Class
Router acquisition failed before the data plane became available.

RouterStopFailed

Class
Router release or stopped-router evidence collection failed.

Run

Variable
Discoverable execution entry point for one experiment society.

RunSpec

Interface
Immutable code-first definition of one experiment society.

RunSpec

Variable
Discoverable constructor for immutable experiment definitions.

RunStarted

Class
The run ledger is allocated and run-scoped acquisition has begun.

SimulatorDefinitionError

Class
Reports simulator definition failures.

SimulatorDefinitionId

TypeAlias
Stable code identity persisted in every ledger manifest.

SimulatorRunFailure

TypeAlias
Represents simulator run failure conditions.

SimulatorRunOutcome

TypeAlias
Closed result of every run whose ledger allocation succeeded.

VersionedEventTag

TypeAlias
Stable persisted identity for an event class.

Files

  • cluster.ts
  • entry.ts
  • definition.ts
  • catalog.ts
  • core.ts
  • append.ts
  • conversation.ts
  • endpoint.ts
  • failure.ts
  • link.ts
  • participant.ts
  • router.ts
  • events.ts
  • execute.ts