This library is an integration of xstate actors/machines using the Atom module of effect. The goal is to allow the use of xstate API for state management with Atom as a bridge inside components.
Current supported surface:
actorAtomandactorRefAtomcreate Atom-owned XState actors and keep actor lifecycle tied to the activeAtomRegistry.fromAtominvokes readable or writable Effect Atoms as XState actors, using the active actor Atom registry when available.fromEffectinvokes Effect workflows as XState actors, including input, output, typed failures, interruption, and emitted events.fromStreaminvokes Effect Streams as XState actors, accumulating emitted items in the actor snapshot.selectAtom,emittedAtom, andpersistedAtomexpose XState snapshots, emitted events, and persisted snapshots as Atoms.runtime(Atom.runtime(layer))creates a local wrapper withruntime.actorAtomandruntime.actorRefAtom, so invokedfromEffectandfromStreamactors can use services from the Atom runtime without global prototype mutation.- Actor-system registry/runtime bridges are intentionally internal. Keep them scoped and avoid global mutation of Effect or XState objects.
This project keeps source references under .repos/.
- Check
.repos/effectwhen working with Effect APIs, internals, examples, or type definitions. - Check
.repos/xstatewhen working with XState APIs, internals, examples, or type definitions. - Treat those folders as upstream reference sources. Do not edit them unless the task explicitly asks to update the vendored subtree.
Run pnpm run typecheck, pnpm run test-types and pnpm run test to verify the work before completion.