Skip to content

Releases: cevr/effect-machine

v0.7.1

01 Mar 01:55
e7b60df

Choose a tag to compare

Patch Changes

  • fa54c61 Thanks @cevr! - Update Effect dependency to 4.0.0-beta.21
    • Replace Effect.makeSemaphore with Semaphore.make (removed in beta.6)

v0.7.0

19 Feb 18:32
0487588

Choose a tag to compare

Minor Changes

  • 34c85b8 Thanks @cevr! - Migrate to Effect v4 (4.0.0-beta.5)
    • Default export now targets Effect v4 — v3 users should import from effect-machine/v3
    • Migrate src/ and test suite to v4 APIs (Effect, Schema, SubscriptionRef, ServiceMap)
    • MachineStateSchema/MachineEventSchema now use Schema.Codec for encode/decode compat
    • 213 tests passing across 19 files

v0.6.0

09 Feb 12:24
464b370

Choose a tag to compare

Minor Changes

  • 9d5bd6f Thanks @cevr! - Add actor.children to expose child actors spawned via self.spawn

    • actor.children returns ReadonlyMap<string, ActorRef> of children spawned via self.spawn
    • State-scoped children auto-removed from map on state exit
    • Works for both regular and persistent actors
  • 9d5bd6f Thanks @cevr! - Add observable ActorSystem with event stream and sync observation

    • system.subscribe(fn) — sync callback for ActorSpawned / ActorStopped events, returns unsubscribe
    • system.actors — sync snapshot of all registered actors (ReadonlyMap)
    • system.events — async Stream<SystemEvent> via PubSub (each subscriber gets own queue)
    • Works with both explicit (ActorSystemDefault) and implicit (Machine.spawn) systems
    • No events emitted during system teardown
    • Double-stop prevention: system.stop + scope finalizer won't emit duplicate ActorStopped

v0.4.0

08 Feb 20:37
dbf801b

Choose a tag to compare

Minor Changes

  • bd3953e Thanks @cevr! - Add child actor support: self.spawn() from handlers, actor.system on every ActorRef, implicit system creation for Machine.spawn, and automatic lifecycle coupling to state scope

v0.3.2

08 Feb 19:08
bcfaded

Choose a tag to compare

Patch Changes

  • a16c44e Thanks @cevr! - Add tsdown build step. Library now ships pre-built ESM with .d.ts declarations instead of raw TypeScript source.

v0.3.1

01 Feb 16:10
f409d26

Choose a tag to compare

Patch Changes

  • Add stopSync to ActorRef — fire-and-forget stop for sync contexts (framework cleanup hooks, event handlers).

v0.3.0

01 Feb 15:02
3249c6c

Choose a tag to compare

Minor Changes

  • 0154ac9 Thanks @cevr! - feat: DX overhaul — multi-state .on(), State.derive(), .onAny(), waitFor deadlock fix, sendSync, waitFor(State.X), .build() / BuiltMachine

    • Multi-state .on()/.reenter(): Accept arrays of states — .on([State.A, State.B], Event.X, handler)
    • State.derive(): Construct new state from source — State.B.derive(stateA, { extra: val }) picks overlapping fields + applies overrides
    • .onAny() wildcard transitions: Handle event from any state — .onAny(Event.Cancel, () => State.Cancelled). Specific .on() takes priority.
    • waitFor deadlock fix: Rewrote to use sync listeners + Deferred instead of SubscriptionRef.changes stream, preventing semaphore deadlock on synchronous transitions
    • sendSync: Fire-and-forget sync send for framework integration (React/Solid hooks)
    • waitFor(State.X): Accept state constructor/value instead of predicate — actor.waitFor(State.Active) and actor.sendAndWait(event, State.Done)
    • .build() / BuiltMachine: Terminal builder method — .provide() renamed to .build(), returns BuiltMachine. .validate() removed. Machine.spawn and ActorSystem.spawn accept BuiltMachine. No-slot machines: .build() with no args.
  • 365da12 Thanks @cevr! - feat: remove Scope.Scope from Machine.spawn and system.spawn signatures

    • Scope-optional spawn: Machine.spawn and ActorSystem.spawn no longer require Scope.Scope in R. Both detect scope via Effect.serviceOption — if present, attach cleanup finalizer; if absent, skip.
    • Daemon forks: Event loop, background effects, and persistence fibers use Effect.forkDaemon — detached from parent scope, cleaned up by actor.stop.
    • System-level cleanup: ActorSystem layer teardown stops all registered actors automatically. ActorSystemDefault is now Layer.scoped.
    • Breaking: Callers that relied on Scope.Scope appearing in the R type of spawn may need type adjustments. Effect.scoped wrappers around spawn are no longer required but still work (scope detection finds them).

v0.2.4

31 Jan 23:10
c928ae5

Choose a tag to compare

Patch Changes

  • d29f2ff Thanks @cevr! - feat: makeInspector accepts Schema constructors as type params

    makeInspector<typeof MyState, typeof MyEvent>(cb) now auto-extracts .Type from schema constructors via ResolveType. No need for typeof MyState.Type anymore.

v0.2.3

31 Jan 22:40
77d5f15

Choose a tag to compare

Patch Changes

  • 85a2854 Thanks @cevr! - fix: use forkScoped for event loop fiber to prevent premature interruption

    Changed Effect.fork to Effect.forkScoped for the actor event loop fiber. Previously, the event loop was attached to the calling fiber's scope, meaning it would be interrupted when a transient caller completed. Now the event loop's lifetime is tied to the provided Scope.Scope service, allowing callers to control the actor's lifecycle explicitly.

v0.2.2

31 Jan 22:20
c659f93

Choose a tag to compare

Patch Changes

  • 2bcb0bb Thanks @cevr! - Add AnyInspectionEvent type alias and default generic params on makeInspector/consoleInspector/collectingInspector so untyped inspectors work without explicit casts.

  • c50c3ce Thanks @cevr! - Fix waitFor race condition where a fast state transition between get and changes subscription could cause waitFor to hang forever. Now uses stateRef.changes directly which emits the current value atomically as its first element.