/** * A deeply owned JSON value returned by {@link snapshotJsonValue}. * * Compound snapshots are frozen before they are returned. Object snapshots * have null prototypes. Array snapshots retain normal array behavior but * shadow inherited `toJSON` hooks with an immutable non-enumerable property. */ export type JsonSnapshotValue = null | boolean | number | string | readonly JsonSnapshotValue[] | { readonly [key: string]: JsonSnapshotValue; }; /** Resource limits applied while taking a provider-boundary JSON snapshot. */ export type JsonSnapshotOptions = { /** * Maximum nesting depth, where the root value is at depth zero. * * @default 64 */ maxDepth?: number; /** * Maximum number of JSON values, including the root and primitive leaves. * * @default 65_536 */ maxNodes?: number; /** * Maximum UTF-8 byte length of the snapshot's canonical JSON encoding. * * @default 8_388_608 */ maxBytes?: number; /** Sort object keys for deterministic snapshots. Defaults to true. */ sortObjectKeys?: boolean; /** * Follow `JSON.stringify` on `undefined` members: drop object properties * holding `undefined` and encode `undefined` array elements as `null`. Set * this only for wire payloads; audit callers need `undefined` to stay * distinguishable from absent. * * @default false */ dropUndefinedMembers?: boolean; }; /** * Create a bounded, deeply owned, accessor-free snapshot of a JSON value. * * Traversal uses property descriptors instead of property reads, so getters * and `toJSON` methods are never invoked. Unsupported prototypes, accessors, * methods, symbols, sparse arrays, cycles, and non-JSON primitives fail * closed with a sanitized TypeError. */ export declare function snapshotJsonValue(value: unknown, options?: JsonSnapshotOptions): JsonSnapshotValue; /** * Create the provider-boundary snapshot used by request builders. * * Node-compatible runtimes use the strict descriptor walk above. Edge hosts * cannot distinguish Proxy objects before reflection, so they first cross the * captured structured-clone boundary. The host rejects Proxy values (including * nested Proxies) without running Proxy traps and returns a newly owned graph. * Ordinary accessors follow the host's structured-clone semantics; this is an * explicit edge-runtime compatibility trade-off because those hosts expose no * no-hook Proxy brand primitive. */ export declare function snapshotProviderJsonValue(value: unknown, options?: JsonSnapshotOptions): JsonSnapshotValue; /** * Compare JSON-compatible values independently of object key order. * * Provider runtimes sometimes expose tool input as JSON text while callers * retain the parsed value. Set `parseJsonStrings` only for that boundary: a * valid JSON string is then compared as its represented JSON value. Invalid, * unsafe, or over-budget values fail closed and compare unequal. */ export declare function jsonValuesEqual(left: unknown, right: unknown, parseJsonStrings?: boolean): boolean; //# sourceMappingURL=json-snapshot.d.ts.map