import type { IndexDatabase } from '../../../db/database-facade.js'; import type { ContractParticipant } from '../../../db/schema.js'; import type { ProcessGroups } from '../../llm/_shared/process-utils.js'; export interface ContractMatch { contractId: number; protocol: string; key: string; normalizedKey: string; /** The participant that initiates (from-side) */ initiator: ContractParticipant; /** The participant that handles (to-side) */ handler: ContractParticipant; /** Module ID of the initiator */ fromModuleId: number; /** Module ID of the handler */ toModuleId: number; } export interface MatchStats { matched: number; unmatched: number; byProtocol: Map; } export interface MaterializeResult { created: number; linked: number; } /** * Matches contracts with complementary-role participants in different process groups, * then materializes them into interactions with definition-level links. */ export declare class ContractMatcher { /** * Find all matched contracts — contracts where complementary roles exist * in different process groups. */ match(db: IndexDatabase, processGroups: ProcessGroups): ContractMatch[]; /** * Get match statistics. */ getStats(db: IndexDatabase, processGroups: ProcessGroups): MatchStats; /** * Materialize matched contracts into interactions and definition links. * Returns the number of interactions created and definition links inserted. */ materializeInteractions(db: IndexDatabase, matches: ContractMatch[]): MaterializeResult; /** * Match a single contract — find complementary role pairs in different process groups. */ private matchContract; /** * Cross-contract fuzzy matching: find complementary-role participants on * _different_ contracts whose normalizedKeys become identical after stripping * common API prefixes (e.g. /api, /v1, /api/v1). */ private fuzzyMatchAcrossContracts; } //# sourceMappingURL=contract-matcher.d.ts.map