/** * Process state utilities * * Factory function and utilities for managing process state. * State is a plain object - direct access is encouraged. * * @module engine/state-manager */ import type { SectionData, DimensionResult } from "../../types.js"; import type { ProcessState, SerializedProcessState } from "../shared/types.js"; export type { SerializedProcessState }; /** * Creates a new process state * * @param sections - Initial sections to process * @param metadata - Optional metadata from beforeProcessStart hook * @returns Initialized process state * * @example * ```typescript * const state = createProcessState(sections); * * // Direct access * console.log(state.id); * state.globalResults[dim] = result; * ``` */ export declare function createProcessState(sections: SectionData[], metadata?: unknown): ProcessState; /** * Updates sections and resets section results * * Use this helper when sections are transformed to ensure * the results map stays in sync. * * @param state - Process state to update * @param sections - New sections * * @example * ```typescript * // After transformation * updateStateSections(state, transformedSections); * ``` */ export declare function updateStateSections(state: ProcessState, sections: SectionData[]): void; /** * Gets section results safely * * Returns empty object if section doesn't exist. * * @param state - Process state * @param sectionIndex - Section index * @returns Section results */ export declare function getSectionResults(state: ProcessState, sectionIndex: number): Record; /** * Sets section result safely * * Creates section results object if it doesn't exist. * * @param state - Process state * @param sectionIndex - Section index * @param dimension - Dimension name * @param result - Dimension result */ export declare function setSectionResult(state: ProcessState, sectionIndex: number, dimension: string, result: DimensionResult): void; /** * Serialize state for storage/transmission * * Converts Map to array for JSON serialization * * @param state - Process state to serialize * @returns Serialized state */ export declare function serializeState(state: ProcessState): SerializedProcessState; /** * Deserialize state from storage/transmission * * Converts array back to Map * * @param serialized - Serialized state * @returns Process state */ export declare function deserializeState(serialized: SerializedProcessState): ProcessState; //# sourceMappingURL=state-manager.d.ts.map