0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

feat(core): add updateState for partial workflow state writes

setState keeps the contract it has on main: the value passed is validated on
its own and replaces the step's pending state, so a second call in the same
step drops the keys set by the first. Partial updates arrive as a new method
instead of a change to setState, so no existing caller has to be revisited and
evented keeps its unvalidated merge.

updateState merges the top-level keys it's given into the state the step sees,
validates the merged state, and records only the keys it was given so parallel
branches keep their own writes. A key set to undefined is removed. It is
available in steps, workflow tools, map functions, loop and branch conditions,
and sleep functions, on both engines and both storage versions.

Co-Authored-By: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
Tony Kovanen 2026-11-13 17:42:50 +01:00
commit f610b639a4
19 changed files with 453 additions and 33 deletions