Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .changeset/typed-statechart-protocols.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
"@typeonce/effect-machine": minor
---

Separate public commands from machine-local events with typed `events` and
`internalEvents` protocols, unique-tag validation, and public-schema validation
for Cluster delivery.

Move finality entirely into state definitions. This is a breaking API change:
remove `type: "final"` from handlers and declare final states and output schemas
with `Machine.defineStates`. Handler `context.action` is also removed in favor
of the single canonical `Machine.action` staging API. Planning and execution
now require an output implementation for every declared output schema and
expose discriminated, schema-derived terminal results.

Add typed helpers for one-shot Effects, timers, staged actions with a returned
transition value, state retagging, immediate parents, and identity-safe invoked
child addressing. Add bound Atom runtime factories, fail-aware results,
equality-aware selectors, and reactive child bridges, while tightening startup
and protocol error types. Protocol schemas are owned by each machine and rely
on Effect's schema parser memoization instead of package-level cache registries.
Reactive child bridge identity uses Effect's standard `Atom.family` primitive.
Atom selectors now infer exact state paths and values from their bridge snapshot
and no longer require a separate `DefinedStates` argument.

Match child descriptors by id and machine identity, and split the old overloaded
child constructor:
use `Machine.child(id, machine)` for complete statecharts and
`Machine.childAddress<Event>(id)` for lower-level process addresses.
`Machine.invoke` now separates its lifecycle `id` from an explicit typed
`address`. Remove the direct `AtomMachine.make(runtime, machine)` overload in
favor of `AtomMachine.bind(runtime).make(machine)`, and make the default child
Atom startup-error channel `unknown`.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
with:
node-version: 24
cache: pnpm
cache-dependency-path: examples/pokemon/pnpm-lock.yaml
cache-dependency-path: |
pnpm-lock.yaml
examples/pokemon/pnpm-lock.yaml
- run: pnpm --dir ../.. install --frozen-lockfile
- run: pnpm --dir ../.. build
- run: pnpm install --frozen-lockfile
- run: pnpm check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
dist/
references/
*.tgz
.DS_Store
2 changes: 0 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
This package incubates the Machine work proposed in Effect PR #6429.

Portions are adapted from the Effect project, which is distributed under the
MIT License. See https://github.com/Effect-TS/effect and the source history for
authorship and provenance.
Loading
Loading