Releases: cevr/effect-machine
v0.7.1
v0.7.0
Minor Changes
34c85b8Thanks @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
- Default export now targets Effect v4 — v3 users should import from
v0.6.0
Minor Changes
-
9d5bd6fThanks @cevr! - Add actor.children to expose child actors spawned via self.spawnactor.childrenreturnsReadonlyMap<string, ActorRef>of children spawned viaself.spawn- State-scoped children auto-removed from map on state exit
- Works for both regular and persistent actors
-
9d5bd6fThanks @cevr! - Add observable ActorSystem with event stream and sync observationsystem.subscribe(fn)— sync callback forActorSpawned/ActorStoppedevents, returns unsubscribesystem.actors— sync snapshot of all registered actors (ReadonlyMap)system.events— asyncStream<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 duplicateActorStopped
v0.4.0
v0.3.2
v0.3.1
Patch Changes
- Add
stopSynctoActorRef— fire-and-forget stop for sync contexts (framework cleanup hooks, event handlers).
v0.3.0
Minor Changes
-
0154ac9Thanks @cevr! - feat: DX overhaul — multi-state.on(),State.derive(),.onAny(),waitFordeadlock 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.waitFordeadlock fix: Rewrote to use sync listeners +Deferredinstead ofSubscriptionRef.changesstream, preventing semaphore deadlock on synchronous transitionssendSync: 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)andactor.sendAndWait(event, State.Done).build()/BuiltMachine: Terminal builder method —.provide()renamed to.build(), returnsBuiltMachine..validate()removed.Machine.spawnandActorSystem.spawnacceptBuiltMachine. No-slot machines:.build()with no args.
- Multi-state
-
365da12Thanks @cevr! - feat: removeScope.ScopefromMachine.spawnandsystem.spawnsignatures- Scope-optional spawn:
Machine.spawnandActorSystem.spawnno longer requireScope.ScopeinR. Both detect scope viaEffect.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 byactor.stop. - System-level cleanup:
ActorSystemlayer teardown stops all registered actors automatically.ActorSystemDefaultis nowLayer.scoped. - Breaking: Callers that relied on
Scope.Scopeappearing in theRtype of spawn may need type adjustments.Effect.scopedwrappers around spawn are no longer required but still work (scope detection finds them).
- Scope-optional spawn:
v0.2.4
v0.2.3
Patch Changes
-
85a2854Thanks @cevr! - fix: use forkScoped for event loop fiber to prevent premature interruptionChanged
Effect.forktoEffect.forkScopedfor 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 providedScope.Scopeservice, allowing callers to control the actor's lifecycle explicitly.
v0.2.2
Patch Changes
-
2bcb0bbThanks @cevr! - AddAnyInspectionEventtype alias and default generic params onmakeInspector/consoleInspector/collectingInspectorso untyped inspectors work without explicit casts. -
c50c3ceThanks @cevr! - FixwaitForrace condition where a fast state transition betweengetandchangessubscription could causewaitForto hang forever. Now usesstateRef.changesdirectly which emits the current value atomically as its first element.