/** `state` as JSON, or `undefined` when it can't be (a cycle, a BigInt). */
export declare function toJsonState(state: unknown): Record<string, unknown> | undefined;
/**
 * A copy of `value`'s plain objects and arrays, so changes to the copy don't reach `value`. Other
 * values (Dates, Maps, class instances, functions) are kept as they are, not copied.
 */
export declare function copyState<T>(value: T, copies?: Map<unknown, unknown>): T;
/**
 * The state a nested run hands back to its parent's step: the nested run's changes since `base`,
 * applied to the parent's current state `target`, so changes the parent's other steps made
 * meanwhile are kept.
 *
 * `base` is the JSON state the nested run's changes are relative to: the state it started from,
 * or the state it resumed from (which its parent already holds). `final` is its state now.
 *
 * Returns every key of `final`. A key the nested run didn't change keeps the parent's value (or
 * takes the nested run's, such as a schema default, when the parent doesn't have it). A list the
 * nested run only appended to gets those items appended to the parent's list, after any the
 * parent's other steps appended. An object is merged key by key. Any other changed value is the
 * nested run's. A top-level key the nested run removed is left alone, as `setState` does.
 */
export declare function rebaseNestedState<TState>(target: TState, base: Record<string, unknown>, final: TState): TState;
/**
 * Removes the state a nested run started from out of a step result that is leaving the process.
 *
 * A storage v1 parent that parks on a nested run records that state in `suspendPayload.__workflow_meta.startState`
 * so a crashed parent can rebase the run's changes when it re-drives the step. Callers never need it:
 * results keep the rest of the metadata (run id, path, `.foreach()` iteration ids) but not workflow
 * state, which they only see through `includeState`.
 */
export declare function withoutNestedRunStartState<T>(stepResult: T): T;
//# sourceMappingURL=nested-state.d.ts.map