/** * JSON primitive values that can safely cross checkpoint, storage, and * tool/effect boundaries. * * @example * ```ts * import type { JSONPrimitive } from '@lostgradient/weft'; * * const value: JSONPrimitive = 'ready'; * ``` */ export type JSONPrimitive = string | number | boolean | null; /** * Recursive JSON-safe value. Used for effect-log outputs, durable operation * payloads, and any data that crosses serialization boundaries inside weft. * * @example * ```ts * import type { JSONValue } from '@lostgradient/weft'; * * const value: JSONValue = { count: 1, tags: ['ready'] }; * ``` */ export type JSONValue = JSONPrimitive | ReadonlyArray | { [key: string]: JSONValue; }; /** * Return true when a value is JSON-safe — i.e. composed entirely of strings, * finite numbers, booleans, `null`, arrays of those, and plain objects whose * values are JSON-safe. Detects and rejects cyclic structures. * * @example * ```ts * import { isJSONValue } from '@lostgradient/weft'; * * isJSONValue({ count: 1, tags: ['ready'] }); // true * isJSONValue(new Date()); // false * ``` */ export declare function isJSONValue(value: unknown): value is JSONValue; /** * Coerce an unknown value into a JSON-safe value. Already-safe values pass * through unchanged. `undefined`, `bigint`, `symbol`, and `Error` instances * fall back to safe representations; anything else that fails `JSON.stringify` * is replaced with `null`. * * @example * ```ts * import { normalizeJSONValue } from '@lostgradient/weft'; * * normalizeJSONValue({ count: 1 }); // { count: 1 } * normalizeJSONValue(new Error('boom')); // { name: 'Error', message: 'boom' } * normalizeJSONValue(undefined); // null * ``` */ export declare function normalizeJSONValue(value: unknown): JSONValue;