import type { DataContract } from '../types/data-contract.js'; import type { BlueprintVariance } from '../types/blueprint.js'; type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue; }; /** * Walk `value` recursively and produce a structurally-equivalent * tree with stripped keys removed and all strings NFC-normalized. * Arrays preserved in order; primitives unchanged except for Unicode * normalization on strings; `undefined` collapses to absent (mirrors * JSON behavior). Object key sorting + JSON serialization happen in * the downstream JCS pass — this function handles the domain-specific * strip step PLUS Unicode normalization (RFC 8785 leaves NFC out of * scope; we apply it ourselves so visually-identical contracts hash * identically regardless of the agent's keyboard / IME composition). * * Exported for tests / debugging — production callers should use * `canonicalizeContracts()`. * * `stripProse` (default `true`) controls the `description`/`usage` * STRIPPED_KEYS strip. The contract pipeline strips (prose is * informational); the variance pipeline ({@link canonicalizeVariance}) * passes `false` because variance prose is load-bearing signal. */ export declare function canonicalizeValue(value: unknown, stripProse?: boolean): JsonValue | undefined; /** * Produce the canonical bytes for a `DataContract` value, suitable * for hashing or external content-address lookups. Stable across * paraphrase, key order, whitespace, description-only edits, and * `serverInfo.version` (server-version metadata; `serverInfo.name` is * identity and is preserved). * * Empty / undefined / `{}` all collapse to the same canonical bytes, * which produces a stable `blueprintKey` for the "no-contract" case. * That key isn't used for cache lookups (registry refuses to register * contract-less pushes) but stays well-defined for completeness. * * The output is a UTF-8-encoded JSON string per RFC 8785. External * implementations using any JCS library produce the same bytes. */ export declare function canonicalizeContracts(contract: DataContract | undefined): string; /** * Canonical bytes for a {@link BlueprintVariance} block — the input to * `variantKey()`. Same JCS + NFC pipeline as {@link canonicalizeContracts} * with two DELIBERATE divergences from the contract pipeline: * * 1. **No `description`/`usage` strip.** For a contract, prose is * informational and stripped so a doc tweak doesn't invalidate a * cache key. For variance, the prose IS the signal: `seedPrompt` * and any `context` value steer the generated `componentCode`, so * stripping them would collapse genuinely distinct variants onto * one key (false reuse). This is the inverse of the contract rule. * 2. **Self-normalizing (D9).** Empty-string fields, empty objects, * and empty arrays are elided internally so `undefined`, `{}`, * `{persona:''}`, and an all-empty block all collapse to the same * "default variant" canonical form. Callers never pre-normalize — * the accept path (verbatim `blueprintMeta.variance`) and the * override path produce identical keys for equivalent variance. * * Pure function — no I/O, no globals. */ export declare function canonicalizeVariance(variance: BlueprintVariance | undefined): string; export {}; //# sourceMappingURL=canonicalize-contract.d.ts.map