/**
 * Bounded serialization utilities for AI tracing.
 *
 * These utilities prevent memory issues by enforcing strict limits on
 * string lengths, array sizes, object depths, and total output size.
 * They are designed to be used across all tracing/telemetry systems.
 *
 * ## Custom Span Serialization
 *
 * Classes can implement a `serializeForSpan()` method to provide a custom
 * representation when serialized for tracing spans. This is useful for:
 * - Excluding internal state and implementation details
 * - Removing functions and circular references
 * - Providing a clean, readable representation for observability
 *
 * @example
 * ```typescript
 * class MyClass {
 *   private internalState = new Map();
 *   public data: string[];
 *
 *   serializeForSpan() {
 *     return { data: this.data };
 *   }
 * }
 * ```
 */
/**
 * Default keys to strip from objects during deep cleaning.
 * These are typically internal/sensitive fields that shouldn't be traced.
 */
export declare const DEFAULT_KEYS_TO_STRIP: Set<string>;
export interface DeepCleanOptions {
    keysToStrip: Set<string> | string[] | Record<string, unknown>;
    maxDepth: number;
    maxStringLength: number;
    maxArrayLength: number;
    maxObjectKeys: number;
}
export declare const DEFAULT_DEEP_CLEAN_OPTIONS: DeepCleanOptions;
/**
 * Merge user-provided serialization options with defaults.
 * Returns a complete DeepCleanOptions object.
 */
export declare function mergeSerializationOptions(userOptions?: {
    maxStringLength?: number;
    maxDepth?: number;
    maxArrayLength?: number;
    maxObjectKeys?: number;
}): DeepCleanOptions;
/**
 * Hard-cap any string to prevent unbounded growth.
 */
export declare function truncateString(s: string, maxChars: number): string;
export type SerializedMapEntry = [keyType: string, key: any, value: any];
export interface SerializedMap {
    __type: 'Map';
    __map_entries: SerializedMapEntry[];
    __truncated?: string;
}
export declare function isSerializedMap(value: unknown): value is SerializedMap;
export declare function reconstructSerializedMap(value: SerializedMap): Map<unknown, unknown>;
/**
 * Recursively cleans a value by removing circular references, stripping problematic keys,
 * and enforcing size limits on strings, arrays, and objects.
 *
 * This is used by AI tracing spans to sanitize input/output data before storing.
 *
 * @param value - The value to clean (object, array, primitive, etc.)
 * @param options - Optional configuration for cleaning behavior
 * @returns A cleaned version of the input with size limits enforced
 */
export declare function deepClean(value: any, options?: DeepCleanOptions): any;
//# sourceMappingURL=serialization.d.ts.map