/** * Shared configuration for built-in value matchers. * * @example * ```ts * const config: BaseMatcherConfig = { * requireAll: true, * allowExtras: false, * }; * ``` */ interface BaseMatcherConfig { /** Require every expected field or tool to match. */ requireAll?: boolean; /** Allow actual output/tool calls to contain extra fields or calls. */ allowExtras?: boolean; /** Emit matcher debug details to the console. */ debug?: boolean; } /** * Matching strategy used by structured-output and tool-call judges. * * @example * ```ts * const exact: MatchStrategy = "strict"; * const custom: MatchStrategy = (expected, actual) => * String(actual).includes(String(expected)); * ``` */ type MatchStrategy = "strict" | "fuzzy" | ((expected: T, actual: T, context?: string) => boolean); /** * Options controlling fuzzy matcher behavior. * * @example * ```ts * const fuzzyOptions: FuzzyMatchOptions = { * caseInsensitive: true, * substring: true, * numericTolerance: 0.01, * }; * ``` */ interface FuzzyMatchOptions { /** Compare strings without case sensitivity. */ caseInsensitive?: boolean; /** Treat either string containing the other as a match. */ substring?: boolean; /** Relative and absolute tolerance used for numeric comparisons. */ numericTolerance?: number; /** Match arrays without requiring the same order. */ ignoreArrayOrder?: boolean; /** Allow simple string/number/boolean coercions before failing. */ coerceTypes?: boolean; } type Mismatch = { key: string; expected: unknown; actual: unknown; }; /** Debug logger interface accepted by matcher helpers. */ interface Logger { log: (message: string, ...args: unknown[]) => void; } /** Compares two values with strict deep equality semantics. */ declare function strictEquals(expected: unknown, actual: unknown, context?: string): boolean; /** Compares two values with the configured fuzzy matching rules. */ declare function fuzzyMatch(expected: unknown, actual: unknown, options?: FuzzyMatchOptions, context?: string): boolean; /** Builds a reusable matcher function from a strict, fuzzy, or custom strategy. */ declare function createMatcher(strategy: MatchStrategy, options?: FuzzyMatchOptions): (expected: T, actual: T, context?: string) => boolean; /** Formats a value for scorer rationale and debug output. */ declare function formatValue(value: unknown): string; /** Returns a normalized partial-credit score for match-based scorers. */ declare function calculatePartialScore(matched: number, total: number, requireAll: boolean): number; /** Emits scorer debug details through the provided logger. */ declare function debugLog(context: string, data: { expected: unknown; actual: unknown; matches?: string[]; mismatches?: Mismatch[]; extras?: string[]; }, logger?: Logger): void; export { type BaseMatcherConfig, type FuzzyMatchOptions, type Logger, type MatchStrategy, calculatePartialScore, createMatcher, debugLog, formatValue, fuzzyMatch, strictEquals };