Skip to content

@tinyactors/node 0.2.0

Latest

Choose a tag to compare

@dhamidi dhamidi released this 16 Oct 09:37

@tinyactors/node 0.2.0

Summary

This release replaces the package. @tinyactors/node 0.2.0 is the Node.js binding built from tinyactors-core/bindings/node, and its API is a new one (ea4113b). It is xstate-style: machines from createMachine or setup, actors from createActor, SCXML through fromSCXML, compiled systems through compileSystem and loadImage, and links between systems through serveLinks. A few names carry over from 0.1.0 (createSystem, System, SystemOptions, Actor, SendOptions) with new shapes and meanings.

It installs the same way as 0.1.0: a prebuilt addon per platform (darwin-arm64, darwin-x64, linux-x64, linux-arm64) as an optional dependency, with one Linux addon for glibc and musl, so nothing compiles on install. It runs on Node.js 22.12 or later and on Bun.

The commits listed below from before the replacement changed the 0.1.0 addon, which this release no longer contains.

Upgrading

  • The 0.1.0 API is removed, with no compatibility layer: its system API (statechart definitions, post and send with their results, loaders, the debug adapter, and the tracing and metrics helpers) is gone. Rewrite callers against the xstate-style API: createMachine and createActor for a machine, fromSCXML for an SCXML document (ea4113b).
  • createSystem, System, SystemOptions, Actor and SendOptions keep their names but not their shapes: check each use against the new declarations.
  • The changes the 0.1.0 addon went through before it was removed (caf78df, 1d4f458, bb87794, 0bc6cfa, 6a6a1fa, 482417e, 28a0ccb, 19cd181, 904b335, 93c3d46, ccd6d63, bc82ab4, 206cdb4, 3edae90) need nothing beyond that rewrite.

Breaking changes

  • setting the time fires due sends; ta_run reports the next wake (caf78df)
  • internal events and invocation names travel as text (1d4f458)
  • hosts read event names as text (bb87794)
  • hosts pass event names to core as text (0bc6cfa)
  • hosts post by address into core; the router goes (6a6a1fa)
  • mail for targets that are not resident waits in core (482417e)
  • move the OTLP encoder into tinyactors-otlp (28a0ccb)
  • mail to resident sessions travels as envelopes (19cd181)
  • the taken input stays in its envelope; event blocks go (904b335)
  • admit inputs into the envelope pool and run them with ta_run (93c3d46)
  • core writes telemetry to a lossy ring stamped by a host clock (ccd6d63)
  • send() resolves when its macrostep ended, without until (bc82ab4)
  • no input log (206cdb4)
  • remove the debug adapter and the VS Code test client (3edae90)

API changes

Added

  • export Action
  • export ActionArgs
  • export ActionFunction
  • export Actions
  • export Actor
  • export ActorOptions
  • export ActorRef
  • export AnyActor
  • export AnyActorLogic
  • export AnyActorRef
  • export AnyStateMachine
  • export AssignAction
  • export Assigner
  • export ByteStream
  • export CancelAction
  • export CompositeGuard
  • export ContextFrom
  • export Delay
  • export DoneActorEvent
  • export Envelope
  • export EventFrom
  • export EventObject
  • export EventOrExpr
  • export FrameDecoder
  • export FromSCXMLOptions
  • export Guard
  • export GuardPredicate
  • export HibernationOptions
  • export HibernationStore
  • export InputFrom
  • export InvokeConfig
  • export Link
  • export LinkContext
  • export LinkEvent
  • export LinkHello
  • export LinkMachine
  • export LinkOptions
  • export LinkServer
  • export LinkStatus
  • export LinkTransport
  • export LogAction
  • export MachineConfig
  • export MachineContext
  • export MachineImplementations
  • export MachineTypes
  • export MigrateOptions
  • export Migration
  • export MigrationResult
  • export NodeByteStream
  • export Observer
  • export OutputFrom
  • export ParameterizedObject
  • export ParsedAddress
  • export PartialAssigner
  • export PeerStatus
  • export RaiseAction
  • export RefusedFrame
  • export SCXMLEvent
  • export SCXMLLogic
  • export SegmentStats
  • export SendOptions
  • export SendParentAction
  • export SendTarget
  • export SendToAction
  • export ServeLinksOptions
  • export SingleOrArray
  • export Snapshot
  • export StateInGuard
  • export StateMachine
  • export StateNodeConfig
  • export StateValue
  • export StoreLink
  • export StoreLinkOptions
  • export Subscription
  • export System
  • export SystemImage
  • export SystemOptions
  • export SystemRef
  • export TransitionConfig
  • export TransitionConfigOrTarget
  • export TransitionsConfig
  • export WireValue
  • export and
  • export assign
  • export cancel
  • export compileSystem
  • export createActor
  • export createLink
  • export createMachine
  • export createMemoryStore
  • export createStoreLink
  • export createSystem
  • export decodeValue
  • export decodeWire
  • export encodeFrame
  • export encodeValue
  • export encodeWire
  • export formatAddress
  • export fromSCXML
  • export loadImage
  • export log
  • export not
  • export or
  • export parseAddress
  • export raise
  • export sendParent
  • export sendTo
  • export serveLinks
  • export setup
  • export stateIn

Changes

Added

  • package and release @tinyactors/node from core's Node.js binding (ea4113b)
  • add the indexed min-heap and TA_ERR_FULL (7319dd3)
  • setRecorder(recorder, { families }) (9385884)
  • PreparedActor.replay(event, at) (7cef60a)
  • event data leaving a session is a copy (3d83589)
  • a helper for naming effects (1db4c18)
  • actorURI() builds an actor's address (d795ce9)
  • a reply-to-sender target (7fffbce)
  • typed event maps on the chart builder (324fd99)
  • the parameters travel as one tinyactors.params attribute (napi ADR 0036 §4) (2174e61)
  • the trace staging bound holds outside turns too (napi ADR 0036 §2) (8a31b00)
  • every OTLP resource names the system's parameters, and stats() reports them (napi ADR 0035) (6222b6f)
  • the data model table, its names and the refusal buffer are sized by parameters (napi ADR 0035) (c68d9c7)
  • traceStagingBytes bounds a turn's staged spans; a turn past it ends early (napi ADR 0035) (b5666f4)
  • createSystem({ parameters }), and traceValueBytes (napi ADR 0035) (0170abe)
  • the input log is core's records as bytes, replayed by core (napi ADR 0034) (33694e9)
  • the input log is a write-ahead log the application stores without reading (napi ADR 0033) (c9f90c5)
  • PreparedActor.replay, a loader's { replay } answer, and System.evict (napi ADR 0032 §§7-8) (1c9c78a)
  • the input log, with a write-ahead hold and a durable mailbox (napi ADR 0032 §6) (cbce803)
  • mail for a gone session goes to its family's loader (napi ADR 0032 §2) (6c2bf1a)
  • session IDs as text everywhere, and createSystem({ incarnation }) (napi ADR 0032 §1) (8c8e3fc)
  • registered data models get a compile scope; the ECMAScript example prints (ADR 0031) (b87baea)
  • data models print, and encode() writes for a data model (ADR 0031) (e4f146e)
  • the built-in data model reads new Name(arguments) (ADR 0031) (a2c36b7)
  • classes registered by name, and the serialize symbol (ADR 0031) (484cef7)
  • one host expression per JavaScript value (ADR 0030) (f838fbd)
  • a trace request names each span's definition in its scope (ADR 0028) (8d4e5cb)
  • charts call host functions by name (ADR 0029) (d281fb4)
  • chart codecs, registered in JavaScript (ADR 0027) (7968d05)
  • define(spec) takes any data model, resolve, and nests inline children (ADR 0027) (f86f964)
  • definitions export their spec and answer lookups by ID (ADR 0027) (32759a1)

Fixed

  • settle taken posts by address, keep mail names out of the kernel, and restore weakened tests (bea43cd)
  • parameterInfo() gives kernel parameters owner "kernel" (cb066c4)
  • a steady load past the staging bound keeps its buffer (napi ADR 0036 §2) (e67dff0)
  • a refused document's text is sized by compileTextBytes (napi ADR 0036 §1) (ed53212)
  • destroy() of a logged actor records destroyed, and a replay starts after it (0f8bd34)

Performance

  • the durable reader scans each piece once (napi ADR 0034) (71f6572)
  • a replay queues its records with their times instead of one per turn (napi ADR 0032 §7) (464625c)

Changed

  • traceValueBytes becomes valueBytes, one limit for traces and logs (napi ADR 0036 §3) (43331b1)
Internal (38)
  • accept the ring protocol's ADRs (ccbad31)
  • register definitions by native spec handle, not a byte layout (ed7cdd1)
  • plan the ring protocol's replacement of core's plumbing (a2c0edc)
  • declare I/O processor and invoker types with h2c.type_declare (c206f86)
  • catalog the ring protocol's building blocks, drop I/O callbacks (9d4416a)
  • remove quarantine; the chain limit abandons a runaway's input (8375de3)
  • park waiting slots in a chunked area, one running workspace (0abb5c8)
  • rename macrostepSlots to maxConcurrentInputs, add maxQuarantined (44ef6cd)
  • run inputs in macrostep slots and quarantine runaways in core (333fcd8)
  • withdraw an admitted input with h2c.withdraw (5a666a0)
  • define ring protocol execution boundaries (6991de1)
  • rename ring fence to macrostep ended (8fc9b3c)
  • specify debugger ownership outside ring protocol (1d1429f)
  • granary's allow list, rebuilt from its journal (1ac9e77)
  • an actor's log is an inbox with acknowledgements (0244ac0)
  • a paused macrostep may repeat its sends after a crash (385276a)
  • benchmark a logged input (8502df3)
  • the trace staging bound is the bound plus one call (e165dce)
  • a send() timeout does not hold the event loop (8275001)
  • point moved ADRs to the host kernel (d32761c)
  • ADR 0034 addendum, the durable reader scans each piece once (b7b23b5)
  • ADR 0035 implemented, with notes and measurements; README on parameters; pointers from ADRs 0005, 0007, 0016 and 0017 (36b8c25)
  • ADR 0034 implemented, with notes and costs; the README's persistence section on bytes and checkpoints (f8ee33d)
  • ADR 0033 implemented, with notes; the README's persistence section; pointer from ADR 0032 (636725e)
  • ADR 0033, the input log is a write-ahead log the application stores without reading (a127ba5)
  • ADR 0032 implemented, with notes on replay, evict and their cost (f9d63c1)
  • replay a report, and a runaway the operator abandoned and released (fa23f94)
  • ADR 0032 section 6 implemented, with notes and the benchmark; replay moves to PreparedActor (60a0f02)
  • ADR 0032 sections 1 and 2 implemented, with notes; pointers from ADRs 0020 and 0022 (7c9a707)
  • ADR 0032, named actors persist by replaying their inputs (f97c7bd)
  • values in text, and data models that print (ADR 0031 implemented) (3a5efa4)
  • the ADR 0031 API says what a data model gets to print and compile (06f5157)
  • values describe themselves, and data models print them (ADR 0031) (dd0d208)
  • index.d.ts needs only Node's types, and a check keeps it so (bc971a7)
  • charts call host functions by name (ADR 0029) (b4e9a62)
  • definitions round-trip through codecs; traces name their definition (4db2b4c)
  • a README for users; development notes move to DEVELOPMENT.md (61db09b)
  • the loader test's empty directory has a node_modules (8be4582)