/** * JSON-safe serialization helpers for neural state. * * The package's hot-path types use `Float32Array` and `Map` which * don't survive `JSON.stringify` cleanly. These helpers encode/decode them * in a stable shape so SONAManager / ReasoningBank / PatternLearner can * round-trip through `serialize()` → `JSON.stringify` → file → `JSON.parse` * → `deserialize()` without losing precision or structure. * * Encoding: * Float32Array ↔ { __f32: number[] } * Map ↔ { __map: Array<[K, V]> } * * Numbers in Float32Array are stored as plain JS `number` (double precision). * Round-trip is loss-free at single-precision (the values were f32 originally; * widening to f64 then narrowing back is exact for any finite f32). */ export interface EncodedFloat32Array { __f32: number[]; } export interface EncodedMap { __map: Array<[string, V]>; } export declare function encodeFloat32Array(arr: Float32Array): EncodedFloat32Array; export declare function decodeFloat32Array(encoded: EncodedFloat32Array): Float32Array; export declare function isEncodedFloat32Array(v: unknown): v is EncodedFloat32Array; export declare function encodeMap(map: Map, encodeValue?: (v: V) => unknown): EncodedMap; export declare function decodeMap(encoded: EncodedMap, decodeValue?: (v: unknown) => V): Map; export declare function isEncodedMap(v: unknown): v is EncodedMap; /** * Deep walk an object and encode all Float32Array/Map nodes. Useful when * a class's state contains nested f32 arrays in unknown locations (e.g., * Trajectory.steps[i].stateEmbedding). Skip with caution — the deep walker * is recursive and shouldn't be used on objects with cycles. */ export declare function deepEncode(value: unknown): unknown; export declare function deepDecode(value: unknown): unknown; //# sourceMappingURL=serialize.d.ts.map