import { DeployVerificationResult } from "./deploy-verifier.js"; export interface InferenceProposal { id: string; type: "fix" | "refactor" | "automate" | "guard" | "codify"; title: string; description: string; evidence: string[]; confidence: number; source: "recurring_problem" | "recurring_pattern" | "wrong_turn"; status: "pending" | "approved" | "rejected" | "applied" | "failed"; /** Repertoire signals the sessions behind this proposal already named. */ namedSignals?: string[]; /** Approaches, solutions, or the wrong turn from those sessions. */ lesson?: string; } export interface InferenceCycleResult { cycleId: string; triggered: boolean; triggerReason: string; corpusSummary: { sessions: number; totalCommits: number; recurringPatterns: number; recurringProblems: number; }; proposals: InferenceProposal[]; votes: { proposalId: string; decision: string; confidence: number; details: string[]; }[]; deployVerification?: DeployVerificationResult | undefined; phase: CyclePhase; completedAt: string; duration: number; } export type CyclePhase = "idle" | "collecting" | "proposing" | "governing" | "applying" | "deploying" | "verifying" | "complete" | "failed"; export type AgentInvoker = (agentName: string, prompt: string) => Promise; export interface InferenceCycleOptions { skipDeployVerify?: boolean; skipApply?: boolean; skipResearcherReview?: boolean; force?: boolean; } export declare class InferenceCycle { private static instances; private static reEntryLock; private static governedProposalIds; static getInstance(projectRoot?: string, options?: InferenceCycleOptions): InferenceCycle; static resetInstance(): void; private inferenceDir; private stateDir; private projectRoot; private phase; private opencodeAvailable; private agentInvoker; private options; constructor(projectRoot?: string, agentInvoker?: AgentInvoker, options?: InferenceCycleOptions); governExternalProposals(proposals: InferenceProposal[]): Promise; maybeRunCycle(): Promise; /** Approve or reject grades the signals that proposal's sessions already named. needs-revision does not write. */ private recordGovernedLessons; private governProposals; /** Flag off: the local matrix is the pass. Dynamo is not called and the miss is not stored as a reject. */ private governWithLocalMatrix; private isGovernanceMcpPreferred; private parseGovernanceMcpResponse; private extractTextFromNdjson; private resolveOpencodeRoot; private setPhase; getPhase(): CyclePhase; private saveCycleState; private appendHistory; /** Lesson ids that leave the 50-entry window stay covered. Empty cycles do not erase them. */ private retainDroppedLessonIds; private readRetainedLessonIds; private retainedLessonCycle; private loadHistory; private buildBlockedResult; private buildResult; }