import { z } from "zod"; import { type StaticAnalysisHint } from "../runtime/staticAnalysisHints.js"; import { type FixTemplate } from "../runtime/fixTemplates.js"; import type { CycleNode, LeaksReport, NextCallSuggestion } from "../types.js"; export declare const classifyCycleSchema: z.ZodObject<{ path: z.ZodString; maxResults: z.ZodDefault; }, "strip", z.ZodTypeAny, { path: string; maxResults: number; }, { path: string; maxResults?: number | undefined; }>; export type ClassifyCycleInput = z.infer; export type Confidence = "high" | "medium" | "low"; export interface PatternMatch { /** Stable ID, used for catalog lookups in v0.2. */ patternId: string; /** Human-readable name. */ name: string; confidence: Confidence; /** Why we matched (which substrings/conditions hit). */ reason: string; /** Suggested fix direction (one-liner). */ fixHint: string; /** * Optional bridge to static analysis: which SwiftLint rule (if any) would * have caught this cycle at parse time, or an explicit gap notice when no * rule exists. Populated for every catalog pattern. */ staticAnalysisHint?: StaticAnalysisHint; /** * Optional Swift code template showing typical before/after for the fix. * Populated for every catalog pattern. The agent adapts the snippet to * the user's actual type/method names via the SourceKit-LSP tools. */ fixTemplate?: FixTemplate; } export interface CycleClassification { rootClass: string; rootAddress: string; count?: number; /** Most likely match, or null when nothing recognized. */ primaryMatch: PatternMatch | null; /** All matches that fired (a single cycle can match multiple patterns). */ allMatches: PatternMatch[]; } export interface ClassifyCycleResult { ok: boolean; path: string; totalCycles: number; classified: CycleClassification[]; /** * Suggested next tool calls based on the highest-confidence pattern hit. * Each entry has pre-populated args and a one-sentence rationale — * the orchestrator can chain them without re-reasoning over the result. */ suggestedNextCalls?: NextCallSuggestion[]; } interface PatternDefinition { id: string; name: string; fixHint: string; match: (root: CycleNode, allClasses: Set) => Confidence | null; } /** Exposed for unit tests. Each entry is a concrete cycle signature plus the * fix hint we'd suggest if the LLM is asked "how do I unstick this?". */ export declare const PATTERNS: PatternDefinition[]; /** Pure: classify each ROOT CYCLE in the parsed report. */ export declare function classifyReport(report: LeaksReport, maxResults?: number): { totalCycles: number; classified: CycleClassification[]; classNamesByIndex: string[][]; }; export declare function classifyCycle(input: ClassifyCycleInput): Promise; export {};