Patch Changes
-
e0dc812: Durable execution DX improvements:
-
The drive loop no longer routes root events by hand.
executeEffectsretains the root-addressed events it captures, andexecution.waitForEvent()hands them out before deferring to the adapter, so the canonical loop is:let [state, effects] = execution.initialTransition(input); await execution.executeEffects(effects); while (state.status === 'active') { [state, effects] = execution.transition(state, await execution.waitForEvent()); await execution.executeEffects(effects); }
(
executeEffectsnow resolves withvoid.) -
createDurable(logic, adapter, { inspect })observes the execution's inspection events (@xstate.actor/@xstate.transition) across the whole live actor tree, including transitions computed by the pure path — the host-side home for operation logs and instrumentation. -
execution.getActorRef(snapshot, address)resolves a logical address against the snapshot's live actor tree, for hosts whose durable mailbox stores addresses as strings. -
Machine
outputtypes infer from the config'soutputfunction when noschemas.outputschema is declared; a declared schema stays authoritative. -
DurableSnapshotkeeps thestatus/output/errordiscriminant visible whenTLogicis an unresolved type parameter, and adapterwaitForEventimplementations may return plain event objects — generic host libraries no longer need casts.
-
-
e0dc812: A machine's output type is now inferred from its
outputconfig when noschemas.outputis declared. A declaredschemas.outputstays authoritative.const machine = setup({}).createMachine({ context: { shipped: ['sku-1'] }, initial: 'done', states: { done: { type: 'final' } }, output: ({ context }) => ({ status: 'shipped' as const, skus: context.shipped }) }); // OutputFrom<typeof machine> is now // { status: 'shipped'; skus: string[] } instead of {}