import type { Message, Thought, ToolCall } from "../../common"; import type { BlockingOrderingViolation, OrderingAdvisoryViolation, OrderingProfile, OrderingRepair, OrderingTimelineEntry } from "./types"; /** * Writes `value` at `path` inside `target`, creating any missing intermediate objects. * The write-side counterpart to {@link getDotPath} — a fallback repair must populate the exact * same nested location the evaluator reads, or the post-repair re-evaluation never clears. * * @remarks * Every intermediate object the path walks through is SHALLOW-CLONED before being written into, * even when it already exists — never mutated in place. A caller that only shallow-copies its own * top-level `target` (e.g. `{ ...snapshot.payload }`) still shares every NESTED object with the * original by reference; writing through those without cloning would corrupt the original * primitive's payload as a side effect of "repairing" an unrelated copy. */ export declare const setDotPath: (target: Record, path: string, value: unknown) => void; /** * Builds the adapter-compatible, deterministically ordered primitive timeline. * * @param messages - Messages to place first in the insertion-order tie-break domain. * @param thoughts - Thoughts to place after messages in the tie-break domain. * @param toolCalls - Tool calls to place after thoughts in the tie-break domain. * @returns A new timeline sorted by creation time and then insertion sequence. * @remarks The fixed collection order mirrors existing adapters, making equal-millisecond behavior * predictable instead of introducing a guard-only wire ordering. */ export declare const buildOrderingTimeline: (messages: Iterable, thoughts: Iterable, toolCalls: Iterable) => OrderingTimelineEntry[]; /** * Evaluates all stateless ordering rules in a profile. * * @param timeline - Stable primitive timeline to inspect. * @param profile - Declarative rules and reporting identity. * @returns Blocking violations and non-blocking advisory findings. * @remarks Preservation is intentionally skipped: its previous snapshot belongs in middleware, * where the long-lived dispatch context exists; keeping this evaluator pure prevents hidden state. */ export declare const evaluateOrderingProfile: (timeline: OrderingTimelineEntry[], profile: OrderingProfile, /** * Optional request context. `toolIdentity` and `schemaIntegrity` need the tools the request * actually declares, which the timeline alone cannot supply; both skip silently when it is * absent, so every existing caller keeps working unchanged. */ context?: { tools?: ReadonlyArray<{ name: string; inputSchema?: unknown; }>; }) => { blocking: BlockingOrderingViolation[]; advisories: OrderingAdvisoryViolation[]; }; /** * Combines profiles without mutating their rule arrays. * * @param profiles - Profiles whose rules should be composed in supplied order. * @returns A profile containing every input rule, with a deterministic synthesized name. * @remarks Union composition is intentionally mechanical so independently sourced vendor rules * remain visible and are not silently deduplicated by coincidental ids. */ export declare const unionOfRules: (profiles: OrderingProfile[]) => OrderingProfile; /** * Describes safe repairs for blocking violations without changing caller-owned data. * * @param timeline - Timeline used to locate implicated primitives; it is never mutated. * @param violations - Blocking findings to classify; they are never mutated. * @param profiles - Optional profiles used only by explicitly enabled metadata fallback repair. * @param authorized - Profiles whose rules authorize their own fallback, reachable without the * global opt-in. See RequiredMetadataRule.fallbackRepairAuthorized. * @returns Repairs for reorder/filler strategies and all remaining violations. * @remarks Metadata fallback is deliberately unreachable for a rule that neither appears in * `profiles` nor authorizes itself. */ export declare const repairViolations: (timeline: OrderingTimelineEntry[], violations: BlockingOrderingViolation[], profiles?: OrderingProfile[], authorized?: OrderingProfile[]) => { repaired: OrderingRepair[]; unrepaired: BlockingOrderingViolation[]; timeline: OrderingTimelineEntry[]; };