export class WorkflowState { private readonly values: Record = {}; set(key: string, value: unknown): void { this.values[key] = value; } get(pathExpression: string): unknown { const parts = pathExpression.split("."); let current: unknown = this.values; for (const part of parts) { if (typeof current !== "object" || current === null || !(part in current)) { throw new Error(`State reference not found: state.${pathExpression}`); } current = (current as Record)[part]; } return current; } snapshot(): Record { return { ...this.values }; } }