/** * Equivalence wire format (W.315) — compare two simulation-contract records * under the same "circuit" (config + geometry contract + interaction script), * generalizing the UISessionRecorder init pattern (`solverType: 'ui.session.v1'` * in `packages/studio/src/lib/uiSessionRecorder.ts`). * * Use `solverType: 'equivalence.v1'` on a **witness** object (e.g. CAEL `init` * payload or a small JSON artifact) to mark that the surrounding harness ran * a digital-twin / twin-solver agreement check, not a physics step. */ import type { InteractionEvent, SimulationProvenance } from './SimulationContract'; import type { SubgridAttestation } from '@holoscript/core/paper-0c-spike'; /** Recorded on witness payloads when a wire comparison was performed. */ export declare const EQUIVALENCE_V1: "equivalence.v1"; export type EquivalenceV1SolverType = typeof EQUIVALENCE_V1; /** * Schema for a comparison witness (e.g. embedded in CAEL init or sidecar JSON). * Mirrors the `solverType` slot used by `ui.session.v1` (Studio) so downstream * tools can route by `solverType` without a second discriminator. */ export interface EquivalenceV1Record { solverType: EquivalenceV1SolverType; /** Bumps if canonicalization rules change. */ specVersion: 1; /** Stable derived key for the left / A side (see `wireKey`). */ wireKeyLeft: string; /** Stable derived key for the right / B side. */ wireKeyRight: string; /** True iff `wireKeyLeft === wireKeyRight`. */ equivalent: boolean; /** Optional harness label (test name, twin slot, Martinis run id, …). */ label?: string; } /** Minimum shape shared by `createReplay()` and the comparable slice of {@link SimulationProvenance}. */ export type EquivalenceWireInput = { config: Record; solverType: string; geometryHash: string; contractId: string; fixedDt: number; totalSteps: number; interactions: ReadonlyArray; subgridAttestation?: SubgridAttestation; }; /** Narrow an unknown to {@link EquivalenceWireInput} (replay or provenance). */ export declare function toEquivalenceWireInput(src: EquivalenceWireInput | SimulationProvenance): EquivalenceWireInput; /** * JSON-like stable string for hashing / equality. Sorts object keys; arrays keep order. * Numbers and strings are JSON-serialized; `undefined` is skipped in objects. */ export declare function stableStringify(value: unknown): string; /** * Build the canonical wire snapshot used for agreement checks. * Strips per-run fields (`id`, `timestamp` on interactions) and sorts * interactions by `simTime` then `type` for a deterministic ordering. */ export declare function canonicalWireSnapshot(source: EquivalenceWireInput | SimulationProvenance): Record; /** Single derived key for one side of an equivalence test. */ export declare function wireKey(source: EquivalenceWireInput | SimulationProvenance): string; /** * True if two replay / provenance-shaped records are wire-equivalent: same * contract geometry, same solver label, same config (key-sorted), same * ordered interaction script (ignoring monotonic `id` and wall `timestamp`). */ export declare function wireFormatEquivalent(a: EquivalenceWireInput | SimulationProvenance, b: EquivalenceWireInput | SimulationProvenance): boolean; /** Build a `equivalence.v1` witness record (for logging, CAEL init, or sidecar files). */ export declare function buildEquivalenceV1Record(a: EquivalenceWireInput | SimulationProvenance, b: EquivalenceWireInput | SimulationProvenance, options?: { label?: string; }): EquivalenceV1Record; //# sourceMappingURL=equivalenceRecord.d.ts.map