import type { FirstContactEvidence, MisinterpretationCategory } from "./evidence.js"; export type PatternStatus = "provisional" | "canonical" | "rejected"; /** A single expected turn in a canonical conversation trajectory. */ export type PatternTurn = { turn: number; command: string; intent?: string; /** Expected agent reasoning state after this turn. */ expectedReasoningState: { understoodAs: string; confidence: number; unknowns: string[]; }; /** Whether this turn represents a decision point where the model may diverge. */ decisionPoint: boolean; }; /** A deterministic conversation pattern derived from first-contact evidence. */ export type ConversationPattern = { schemaVersion: "1.0.0"; id: string; title: string; /** The human prompt that triggers this pattern. */ trigger: string; /** Preconditions observed in the repository state. */ preconditions: { initialized?: boolean; phase?: string; files?: string[]; repositoryStateSummary?: string; }; /** Canonical trajectory of commands and expected reasoning states. */ trajectory: PatternTurn[]; /** Decision points where the agent must choose between alignment and misinterpretation. */ decisionPoints: { turn: number; description: string; }[]; /** Observed prompts or commands that produced aligned changes. */ successfulPrompts: string[]; /** Observed misinterpretations or anti-patterns to avoid. */ antiPatterns: string[]; /** Misinterpretation categories present in the source evidence. */ misinterpretationCategories: MisinterpretationCategory[]; /** Confidence score derived from the source evidence. */ confidence: number; /** Current validation status. Patterns start as provisional until validated. */ status: PatternStatus; /** Evidence that supports this pattern. */ supportingEvidence: { sessionId: string; scenarioId: string; evidencePath?: string; }[]; }; /** Result of validating a conversation pattern. */ export type PatternValidationResult = { status: PatternStatus; errors: string[]; warnings: string[]; }; /** * Extract a deterministic ConversationPattern from a FirstContactEvidence artifact. * * The extractor never invents: every field is derived from the evidence object. */ export declare function extractConversationPattern(evidence: FirstContactEvidence, options?: { evidencePath?: string; }): ConversationPattern; /** * Validate a conversation pattern against the First Contact learning rules. * * A pattern is promoted to canonical only when it has enough supporting * evidence, meets the confidence threshold, and shows no conflicting * trajectories. Single-evidence patterns remain provisional by design. */ export declare function validateConversationPattern(pattern: ConversationPattern, options?: { minEvidenceCount?: number; minConfidence?: number; }): PatternValidationResult; /** * Promote a pattern to canonical if validation permits. * * Returns the updated pattern; the original is not mutated. */ export declare function promoteConversationPattern(pattern: ConversationPattern, options?: { minEvidenceCount?: number; minConfidence?: number; }): ConversationPattern; /** * Persist a ConversationPattern artifact to disk. * * Returns the path of the written file. */ export declare function saveConversationPattern(pattern: ConversationPattern, outputDir: string, filename?: string): Promise;