55```
66src/
77├── index.ts # Public exports
8- ├── namespace.ts # Machine namespace (Effect-style API)
9- ├── machine-schema.ts # Schema-first State/Event (MachineStateSchema, MachineEventSchema)
10- ├── machine.ts # Machine class with fluent builder API
8+ ├── machine.ts # Machine class + namespace (fluent builder API)
9+ ├── schema.ts # Schema-first State/Event (MachineStateSchema, MachineEventSchema)
1110├── slot.ts # Slot.Guards/Slot.Effects factories for parameterized slots
1211├── actor-ref.ts # Actor reference interface
1312├── actor-system.ts # Actor system service + layer
2625 ├── loop.ts # Event loop, transition resolver, lifecycle effects
2726 ├── execute-transition.ts # Shared transition execution (loop, simulate, harness)
2827 ├── transition-index.ts # O(1) lookup for transitions
29- ├── fiber-storage.ts # Per-actor WeakMap fiber storage utility
3028 ├── brands.ts # StateBrand/EventBrand + BrandedState/BrandedEvent
31- ├── types.ts # Internal utility types
32- ├── is-effect.ts # Shared isEffect type guard
33- └── get-tag.ts # Tag extraction from constructors
29+ └── utils.ts # Type helpers, constants, isEffect, getTag
3430
3531test/
3632├── machine.test.ts # Core machine tests
3733├── actor-system.test.ts # Actor spawning/lifecycle
3834├── actor-ref.test.ts # ActorRef ergonomics
3935├── persistence.test.ts # Persistence tests
4036├── testing.test.ts # Test utilities
41- ├── machine-schema.test.ts # Schema-first State/Event tests
42- ├── transition-index.test.ts # O(1) transition lookup tests
37+ ├── schema.test.ts # Schema-first State/Event tests
4338├── inspection.test.ts # Inspector tests
44- ├── features/ # Feature-specific tests
45- │ ├── any.test.ts
46- │ ├── delay.test.ts # Timeout via spawn patterns
47- │ ├── dynamic-delay.test.ts # Dynamic timeout via spawn
48- │ ├── effects.test.ts
49- │ ├── force.test.ts # reenter transition tests
50- │ ├── from.test.ts
51- │ ├── guards.test.ts
52- │ └── same-state.test.ts
39+ ├── guards.test.ts # Parameterized guard tests
40+ ├── choose.test.ts # Conditional transition tests
41+ ├── delay.test.ts # Timeout via spawn patterns
42+ ├── dynamic-delay.test.ts # Dynamic timeout via spawn
43+ ├── same-state.test.ts # Same-state transition tests
44+ ├── force.test.ts # reenter transition tests
45+ ├── utils/
46+ │ └── effect-test.ts # Test helpers (yieldFibers, etc.)
47+ ├── internal/
48+ │ └── transition-index.test.ts # O(1) transition lookup tests
5349├── patterns/ # Real-world pattern tests
5450│ ├── payment-flow.test.ts
5551│ ├── session-lifecycle.test.ts
@@ -63,14 +59,13 @@ test/
6359
6460| File | Purpose |
6561| ----------------------------------- | ----------------------------------------------------------- |
66- | ` machine.ts ` | Machine class - fluent builder, all combinators as methods |
67- | ` machine- schema.ts` | Schema-first ` State ` /` Event ` - single source of truth |
62+ | ` machine.ts ` | Machine class + namespace - fluent builder, all combinators |
63+ | ` schema.ts ` | Schema-first ` State ` /` Event ` - single source of truth |
6864| ` slot.ts ` | ` Slot.Guards ` /` Slot.Effects ` - parameterized slot factories |
69- | ` namespace.ts ` | Machine namespace export (named for macOS compat) |
7065| ` internal/loop.ts ` | Event processing, ` resolveTransition ` , spawn effect forking |
7166| ` internal/transition-index.ts ` | O(1) lookup for transitions |
7267| ` internal/brands.ts ` | Branded types: ` StateBrand ` , ` BrandedState ` , etc. |
73- | ` internal/fiber-storage .ts ` | ` createFiberStorage() ` - per-actor WeakMap utility |
68+ | ` internal/utils .ts ` | Shared utilities: types, constants, ` isEffect ` , ` getTag ` |
7469| ` persistence/persistent-machine.ts ` | ` Machine.persist ` - schemas from machine |
7570| ` cluster/entity-machine.ts ` | ` toEntity ` - schemas from machine |
7671
@@ -172,18 +167,6 @@ const MyEffects = Slot.Effects({
172167- Context (` ctx ` ) has ` { state, event, self } `
173168- ` provide() ` creates new machine - original reusable with different handlers
174169
175- ## Fiber Storage Pattern
176-
177- ` spawn ` uses shared utility from ` internal/fiber-storage.ts ` :
178-
179- ``` ts
180- import { createFiberStorage } from " ../internal/fiber-storage.js" ;
181-
182- const getFiberMap = createFiberStorage (); // WeakMap-backed, per-actor
183- const instanceKey = Symbol (" spawn" ); // unique per combinator instance
184- getFiberMap (self ).set (instanceKey , fiber );
185- ```
186-
187170## Transition Index
188171
189172` internal/transition-index.ts ` provides O(1) lookup via lazy-built WeakMap cache:
0 commit comments