import { z } from 'zod'; import { Command } from 'commander'; import { ResolvedArtifact, TraceLink } from 'artifact-contracts/core'; declare const NODE_KINDS: readonly ["file", "symbol", "module", "package", "artifact"]; declare const NodeKindSchema: z.ZodEnum<{ symbol: "symbol"; file: "file"; module: "module"; package: "package"; artifact: "artifact"; }>; type NodeKind = z.infer; declare const EDGE_KINDS: readonly ["imports", "exports", "calls", "type_reference", "re_exports", "depends_on", "contains", "boundary_crossing"]; declare const EdgeKindSchema: z.ZodEnum<{ imports: "imports"; exports: "exports"; calls: "calls"; type_reference: "type_reference"; re_exports: "re_exports"; depends_on: "depends_on"; contains: "contains"; boundary_crossing: "boundary_crossing"; }>; type EdgeKind = z.infer; declare const EDGE_CLASSIFICATIONS: readonly ["deterministic", "candidate"]; declare const EdgeClassificationSchema: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; type EdgeClassification = z.infer; declare const GraphNodeSchema: z.ZodObject<{ id: z.ZodString; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; module: "module"; package: "package"; artifact: "artifact"; }>; metadata: z.ZodRecord; }, z.core.$strip>; type GraphNode = z.infer; declare const GraphEdgeSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; kind: z.ZodEnum<{ imports: "imports"; exports: "exports"; calls: "calls"; type_reference: "type_reference"; re_exports: "re_exports"; depends_on: "depends_on"; contains: "contains"; boundary_crossing: "boundary_crossing"; }>; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>; type GraphEdge = z.infer; declare class AdjacencyListGraph { /** Node id → node. */ private readonly nodes; /** Node id → out-edges (from === id). */ private readonly adjacency; /** Total number of edges stored across all adjacency lists. */ private edges; /** * Insert or replace a node. Re-adding an existing id overwrites the stored * node but preserves its adjacency list, so edges survive a metadata update. */ addNode(node: GraphNode): void; /** * Add a directed edge (edge.from → edge.to). Endpoints are not required to * exist yet; missing endpoints are materialised as adjacency entries so the * edge is traversable. Duplicate edges are permitted — callers that need * deduplication should enforce it upstream. */ addEdge(edge: GraphEdge): void; /** Return the node for `id`, or undefined if it was never added. */ getNode(id: string): GraphNode | undefined; /** True if a node with `id` has been added. */ hasNode(id: string): boolean; /** * Out-edges originating at `id` (a defensive copy). Unknown ids yield an * empty array rather than throwing. */ getEdges(id: string): GraphEdge[]; /** * Ids of the direct successors of `id` (the `to` of each out-edge), in * insertion order. Duplicates are preserved to mirror parallel edges. */ getNeighbors(id: string): string[]; /** All nodes, in insertion order. */ getNodes(): GraphNode[]; /** All edges across every adjacency list. */ getAllEdges(): GraphEdge[]; /** Number of nodes. */ nodeCount(): number; /** Number of edges. */ edgeCount(): number; } /** * Yield nodes reachable from `startNodeId` in breadth-first order, starting * with the start node itself. Each node is yielded at most once. */ declare function bfs(graph: AdjacencyListGraph, startNodeId: string): Generator; /** * Yield nodes reachable from `startNodeId` in depth-first (pre-order) order, * starting with the start node itself. Neighbours are explored in edge * insertion order. Each node is yielded at most once. */ declare function dfs(graph: AdjacencyListGraph, startNodeId: string): Generator; /** * Return the set of node ids reachable from `startNodeId` via directed edges, * excluding the start node itself. An unknown start id yields an empty set. */ declare function transitiveClosure(graph: AdjacencyListGraph, startNodeId: string): Set; declare const SerializedGraphSchema: z.ZodObject<{ nodes: z.ZodArray; metadata: z.ZodRecord; }, z.core.$strip>>; edges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type SerializedGraph = z.infer; /** * Flatten a graph into a JSON-compatible object. Nodes and edges are emitted * in insertion order, so the output is stable for a given construction * sequence. */ declare function serializeGraph(graph: AdjacencyListGraph): SerializedGraph; /** * Rebuild an AdjacencyListGraph from its serialized form. Input is validated * through the Zod schemas; malformed data throws a ZodError. Nodes are added * before edges so that endpoint nodes are present, but edges referencing * unknown nodes are still accepted (mirroring addEdge's tolerance). */ declare function deserializeGraph(data: unknown): AdjacencyListGraph; declare const EVIDENCE_TYPES: readonly ["static_import", "dynamic_import", "manifest_dependency", "path_pattern_match", "naming_convention", "matched_schema_name", "nearby_import", "tool_output_field_similarity", "llm_semantic_link"]; declare const EvidenceTypeSchema: z.ZodEnum<{ static_import: "static_import"; dynamic_import: "dynamic_import"; manifest_dependency: "manifest_dependency"; path_pattern_match: "path_pattern_match"; naming_convention: "naming_convention"; matched_schema_name: "matched_schema_name"; nearby_import: "nearby_import"; tool_output_field_similarity: "tool_output_field_similarity"; llm_semantic_link: "llm_semantic_link"; }>; type EvidenceType = z.infer; declare const EvidenceSchema: z.ZodObject<{ type: z.ZodEnum<{ static_import: "static_import"; dynamic_import: "dynamic_import"; manifest_dependency: "manifest_dependency"; path_pattern_match: "path_pattern_match"; naming_convention: "naming_convention"; matched_schema_name: "matched_schema_name"; nearby_import: "nearby_import"; tool_output_field_similarity: "tool_output_field_similarity"; llm_semantic_link: "llm_semantic_link"; }>; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>; type Evidence = z.infer; /** * Returns a new edge with `evidence` appended to its evidence array. * The input edge and its evidence array are left untouched. */ declare function annotateEdge(edge: GraphEdge, evidence: Evidence): GraphEdge; /** * Returns a new array in which every edge has been annotated with `evidence`. * Each edge is replaced by a fresh annotated copy (see {@link annotateEdge}). */ declare function annotateEdges(edges: GraphEdge[], evidence: Evidence): GraphEdge[]; /** * Merges two evidence arrays, deduplicating by the `(type + detail)` key. * `existing` entries take precedence; an `incoming` entry with a key already * present in `existing` is dropped. Order is preserved: existing entries first, * then the surviving incoming entries. */ declare function mergeEvidence(existing: Evidence[], incoming: Evidence[]): Evidence[]; /** * Returns the evidence entry with the highest confidence, or `undefined` when * the array is empty. On ties, the first such entry encountered wins. */ declare function bestEvidence(evidences: Evidence[]): Evidence | undefined; /** * Returns the evidence entries whose confidence is strictly greater than * `threshold`. */ declare function filterByConfidence(evidences: Evidence[], threshold: number): Evidence[]; /** * Per-evidence-type relevance weight. Static, manifest-backed facts (weight * 1.0) are the strongest; LLM/heuristic signals weigh less. Weights are by * evidence *type*, not by the per-edge confidence value. */ declare const RELEVANCE_WEIGHTS: Record; /** Weight applied to an evidence type absent from {@link RELEVANCE_WEIGHTS}. */ declare const UNKNOWN_EVIDENCE_WEIGHT = 0; /** * Diversity multipliers applied to the base weight. An edge corroborated by * several *distinct* evidence kinds is more relevant than one backed by a * single kind (even if repeated). */ declare const DIVERSITY_BONUS: { /** >= 2 distinct evidence kinds. */ readonly two: 1.2; /** >= 3 distinct evidence kinds. */ readonly three: 1.3; }; interface ComputeRelevanceScoreOptions { /** * Evidence types to exclude from the score (e.g. CLI --evidence-exclude). * Excluded evidence contributes neither weight nor diversity. */ exclude?: Iterable; } /** * Compute a deterministic relevance score for an edge from its evidence. * * The score is `maxWeight * diversityBonus`, where `maxWeight` is the largest * weight among the (non-excluded) evidence types present and `diversityBonus` * grows with the number of *distinct* kinds. Empty (or fully-excluded) evidence * scores 0. Unknown evidence types contribute {@link UNKNOWN_EVIDENCE_WEIGHT} * but still count toward diversity. */ declare function computeRelevanceScore(evidence: Evidence[], options?: ComputeRelevanceScoreOptions): number; interface FileRow { id: number; path: string; hash: string; language: string; line_count: number; analyzer_id: string; analyzed_at: string; } interface StoreBackend { /** Current schema version stored in the `schema_version` table. */ getSchemaVersion(): number; getMetadata(key: string): string | undefined; setMetadata(key: string, value: string): void; /** * Insert a file, replacing any existing row with the same path. Replacement * removes the previous file row (§12.5). Returns the new file id. */ insertOrReplaceFile(file: Omit): number; deleteFileByPath(path: string): boolean; getFileByPath(path: string): FileRow | undefined; getFileById(id: number): FileRow | undefined; getAllFiles(): FileRow[]; /** Run `fn` atomically. Rolls back on throw. */ transaction(fn: () => T): T; close(): void; } interface StoreOptions { /** Explicit database path. Overrides the AGENT_ANALYZER_STORE env var. */ dbPath?: string; } interface StoreHandle { /** Which backend is active. */ readonly kind: "sqlite" | "memory"; /** Resolved on-disk path, or null for in-memory / :memory: stores. */ readonly dbPath: string | null; /** Row-level operations. Writer/reader functions operate through this. */ readonly backend: StoreBackend; /** * The underlying better-sqlite3 Database when `kind === "sqlite"`, otherwise * null. Escape hatch for inspection/debugging (§12.1); downstream code should * prefer the writer/reader functions. */ readonly raw: unknown; close(): void; } declare const SCHEMA_VERSION = 1; declare const SCHEMA_DDL = "\n-- Schema version tracking\nCREATE TABLE IF NOT EXISTS schema_version (\n version INTEGER NOT NULL\n);\n\n-- Analyzed source files\nCREATE TABLE IF NOT EXISTS files (\n id INTEGER PRIMARY KEY,\n path TEXT NOT NULL UNIQUE,\n hash TEXT NOT NULL,\n language TEXT NOT NULL,\n line_count INTEGER NOT NULL,\n analyzer_id TEXT NOT NULL,\n analyzed_at TEXT NOT NULL\n);\n\n-- Key-value metadata (hashes for invalidation, timestamps)\nCREATE TABLE IF NOT EXISTS metadata (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL\n);\n"; /** * Open the analyzer store. Uses better-sqlite3 when available, otherwise falls * back to an in-memory backend (§12.2). * * Environment: * AGENT_ANALYZER_NO_STORE=1 in-memory only (`:memory:` when SQLite present) * AGENT_ANALYZER_STORE= custom database path */ declare function openStore(options?: StoreOptions): Promise; /** * Insert or replace a file row. Replacement removes the previous file row. * Returns the new file id. */ declare function upsertFile(db: StoreHandle, filePath: string, hash: string, language: string, lineCount: number, analyzerId: string): number; /** Delete a file row. Returns true if removed. */ declare function deleteFile(db: StoreHandle, filePath: string): boolean; /** Upsert a metadata key/value pair (invalidation hashes, timestamps). */ declare function upsertMetadata(db: StoreHandle, key: string, value: string): void; /** Look up a file row by path. */ declare function getFileByPath(db: StoreHandle, path: string): FileRow | undefined; /** Return all stored file rows. */ declare function getAllFiles(db: StoreHandle): FileRow[]; /** SHA-256 hex digest of a UTF-8 string. */ declare function hashContent(content: string): string; /** Read a file from disk and return the SHA-256 hex digest of its content. */ declare function hashFile(filePath: string): Promise; /** * Deterministic SHA-256 of an arbitrary JSON-serializable value. Object keys * are sorted recursively so that property order does not affect the hash; * array order is preserved. `undefined`-valued properties are omitted, matching * JSON.stringify semantics. */ declare function hashObject(obj: unknown): string; type FileChangeState = "unchanged" | "changed" | "new" | "deleted"; /** * Classify a file against the store. `currentHash` is the freshly-computed hash * of the file's content, or `null` when the file no longer exists on disk. */ declare function checkFileChanged(db: StoreHandle, filePath: string, currentHash: string | null): FileChangeState; /** True if a manifest's content differs from the stored hash (or is unknown). */ declare function checkManifestChanged(db: StoreHandle, manifestPath: string, currentHash: string): boolean; /** True if the Navigation Index hash differs from the stored hash. */ declare function checkNavigationIndexChanged(db: StoreHandle, currentHash: string): boolean; /** True if the analyzer version differs from the stored version. */ declare function checkAnalyzerVersionChanged(db: StoreHandle, currentVersion: string): boolean; interface InvalidationChanges { /** Source files with their current hash (null = deleted on disk). */ files?: { path: string; hash: string | null; }[]; /** Package manifests with their current hash. */ manifests?: { path: string; hash: string; }[]; /** Current Navigation Index hash, if it should be checked. */ navigationHash?: string; /** Current analyzer version, if it should be checked. */ analyzerVersion?: string; } type InvalidationActionKind = "reanalyze-file" | "delete-file" | "rebuild-manifest" | "rebuild-mapping" | "full-rebuild"; interface InvalidationAction { kind: InvalidationActionKind; /** File path / manifest path the action targets, when applicable. */ target?: string; reason: string; } /** * Produce the ordered set of actions needed to bring the store up to date. * * An analyzer-version mismatch supersedes everything: it returns a single * `full-rebuild` action (§12.6), since stored data may be structurally stale. */ declare function getInvalidationPlan(db: StoreHandle, changes: InvalidationChanges): InvalidationAction[]; declare const CANDIDATE_EDGES_METADATA_KEY = "candidate_edges"; /** Serialize candidate edges to store metadata. */ declare function persistCandidateEdges(store: StoreHandle, edges: GraphEdge[]): void; /** * Load persisted candidate edges. Returns an empty array when the key is * absent, JSON is invalid, or edge objects fail schema validation. */ declare function loadCandidateEdges(store: StoreHandle): GraphEdge[]; declare const SYMBOL_KINDS: readonly ["function", "class", "type", "variable", "interface", "enum", "module", "trait", "struct", "constant"]; declare const SymbolKindSchema: z.ZodEnum<{ function: "function"; type: "type"; module: "module"; enum: "enum"; class: "class"; variable: "variable"; interface: "interface"; trait: "trait"; struct: "struct"; constant: "constant"; }>; type SymbolKind = z.infer; declare const SymbolInfoSchema: z.ZodObject<{ name: z.ZodString; kind: z.ZodEnum<{ function: "function"; type: "type"; module: "module"; enum: "enum"; class: "class"; variable: "variable"; interface: "interface"; trait: "trait"; struct: "struct"; constant: "constant"; }>; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>; type SymbolInfo = z.infer; declare const FileAnalysisMetadataSchema: z.ZodObject<{ parserBackend: z.ZodString; parseTimeMs: z.ZodNumber; lineCount: z.ZodNumber; }, z.core.$strip>; type FileAnalysisMetadata = z.infer; declare const FileAnalysisResultSchema: z.ZodObject<{ filePath: z.ZodString; language: z.ZodString; symbols: z.ZodArray; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; edges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; metadata: z.ZodObject<{ parserBackend: z.ZodString; parseTimeMs: z.ZodNumber; lineCount: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; type FileAnalysisResult = z.infer; declare const ANALYZER_CAPABILITIES: readonly ["symbols", "imports", "exports", "calls", "type_references"]; declare const AnalyzerCapabilitySchema: z.ZodEnum<{ imports: "imports"; exports: "exports"; calls: "calls"; symbols: "symbols"; type_references: "type_references"; }>; type AnalyzerCapability = z.infer; interface LanguageAnalyzer { readonly language: string; readonly capabilities: AnalyzerCapability[]; /** * File extensions this analyzer handles, e.g. [".ts", ".tsx"]. Used by * AnalyzerRegistry for extension-based resolution (ARCHITECTURE.md §6.4). * Optional: when omitted, the registry falls back to a language-name map. */ readonly fileExtensions?: readonly string[]; analyze(filePath: string, content: string): Promise; } interface ProjectAnalysisInput { /** Absolute project root; files in `files` are keyed relative to it. */ projectRoot: string; /** * Per-file IR keyed by project-relative path. The unresolved `calls` / * `type_reference` edges to resolve live on each result's `edges`. */ files: Map; /** * Project-relative paths of files whose content changed since the last * run. When provided, only these files are re-resolved; unchanged files * reuse their cached post-resolution edges. When absent (--no-cache or * first run), all files are resolved. */ changedFiles?: Set; } interface ProjectAnalysisResult { /** * The complete set of `calls` / `type_reference` edges for every file the * analyzer handled, with `to` rewritten to a cross-file symbolId where * resolvable. Because every handled edge is reproduced (resolved or not), * these fully supersede the per-file unresolved edges — the pipeline drops a * handled file's `calls` / `type_reference` edges and substitutes these. */ resolvedEdges: GraphEdge[]; /** * Project-relative paths the analyzer processed. Used by the pipeline to know * whose `calls` / `type_reference` edges `resolvedEdges` supersedes; a file * absent here keeps its original per-file edges untouched. */ handledFiles: string[]; } interface ProjectAnalyzer { readonly language: string; readonly capabilities: AnalyzerCapability[]; /** * File extensions this analyzer handles, e.g. [".ts", ".tsx"]. The pipeline * uses these to decide which files in `files` the analyzer owns. */ readonly fileExtensions?: readonly string[]; analyzeProject(input: ProjectAnalysisInput): Promise; } /** * Apply a ProjectAnalysisResult to the per-file IR: for every handled file, * drop its `calls` / `type_reference` edges and substitute the analyzer's * resolved edges (grouped by owning file). Files the analyzer did not handle — * and edges of other kinds (imports, contains, …) — are passed through * unchanged. The input results and their edges are never mutated. */ declare function applyProjectResolution(results: FileAnalysisResult[], resolution: ProjectAnalysisResult): FileAnalysisResult[]; declare class AnalyzerRegistry { /** Normalised extension → analyzer (first registration wins). */ private readonly byExtension; /** Analyzer id (`language`) → analyzer (first registration wins). */ private readonly byId; /** All registered analyzers, in registration order. */ private readonly analyzers; /** Registered ProjectAnalyzers (cross-file resolution), in registration order. */ private readonly projectAnalyzers; /** * Register an analyzer by its file extensions and id. Extensions come from * `analyzer.fileExtensions` when present, otherwise a fallback map keyed by * `analyzer.language`. Re-registering an already-claimed extension or id is a * no-op for that key — the first registered analyzer keeps priority. */ register(analyzer: LanguageAnalyzer): void; /** Resolve the analyzer for a file path by its extension. */ getForFile(filePath: string): LanguageAnalyzer | undefined; /** Look up a registered analyzer by its id (the `language` field). */ getById(id: string): LanguageAnalyzer | undefined; /** List every registered analyzer, in registration order. */ listAll(): LanguageAnalyzer[]; /** * Register a ProjectAnalyzer for cross-file resolution (proposal §3.5). These * run after the per-file analysis pass to rewrite bare-name `calls` / * `type_reference` edges to cross-file symbolIds. */ registerProjectAnalyzer(analyzer: ProjectAnalyzer): void; /** List every registered ProjectAnalyzer, in registration order. */ listProjectAnalyzers(): ProjectAnalyzer[]; } declare class TypeScriptAnalyzer implements LanguageAnalyzer { readonly language = "typescript"; readonly capabilities: ("imports" | "exports" | "calls" | "symbols" | "type_references")[]; readonly fileExtensions: readonly [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]; analyze(filePath: string, content: string): Promise; } declare class TypeScriptProjectAnalyzer implements ProjectAnalyzer { readonly language = "typescript"; readonly capabilities: ("imports" | "exports" | "calls" | "symbols" | "type_references")[]; readonly fileExtensions: readonly [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]; analyzeProject(input: ProjectAnalysisInput): Promise; } declare class YamlAnalyzer implements LanguageAnalyzer { readonly language = "yaml"; readonly capabilities: ("imports" | "exports" | "calls" | "symbols" | "type_references")[]; readonly fileExtensions: readonly [".yaml", ".yml"]; analyze(filePath: string, content: string): Promise; } /** * Create an AnalyzerRegistry pre-populated with the built-in analyzers * (TypeScript first, then YAML) per ARCHITECTURE.md §6.4. Registration order * establishes extension priority — the TypeScript analyzer is registered first. * * The TypeScript ProjectAnalyzer (proposal §3.5) is registered for the * cross-file resolution pass that rewrites bare-name `calls` / `type_reference` * edges to full symbolIds. */ declare function createDefaultRegistry(): AnalyzerRegistry; declare const AstNodeSchema: z.ZodObject<{ id: z.ZodString; metadata: z.ZodRecord; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; filePath: z.ZodString; symbols: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>>; symbolInfo: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type AstNode = z.infer; declare const AstGraphSchema: z.ZodObject<{ nodes: z.ZodMap; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; filePath: z.ZodString; symbols: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>>; symbolInfo: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; edges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; fileHashes: z.ZodMap; }, z.core.$strip>; type AstGraph = z.infer; declare const SerializedAstGraphSchema: z.ZodObject<{ nodes: z.ZodRecord; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; filePath: z.ZodString; symbols: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>>; symbolInfo: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; edges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; fileHashes: z.ZodRecord; }, z.core.$strip>; type SerializedAstGraph = z.infer; declare function serializeAstGraph(graph: AstGraph): SerializedAstGraph; declare function deserializeAstGraph(serialized: SerializedAstGraph): AstGraph; /** * Build an `AstGraph` from analyzed files. Pure — no IO, no store. * * @param results One IR per analyzed file. * @param fileHashes path → SHA-256 content hash, recorded on the graph for the * incremental cache. Copied defensively. */ declare function buildAstGraphFromResults(results: FileAnalysisResult[], fileHashes: Map): AstGraph; /** * Default exclude patterns applied to every scan. Callers may override the * whole list via `ScanOptions.globalExclude`. */ declare const DEFAULT_GLOBAL_EXCLUDE: readonly string[]; /** One scanned file, with the artifacts whose patterns matched it. */ interface FileEntry { /** Absolute path on disk (for reading content). */ path: string; /** Path relative to `projectRoot` (used as the graph node id). */ relativePath: string; /** Ids of artifacts whose `path_patterns` matched this file (may be empty). */ matchedArtifacts: string[]; } interface ScanOptions { /** Project root; all patterns and outputs are resolved relative to it. */ projectRoot: string; /** artifactId → glob patterns (the DSL `path_patterns`). */ artifactPatterns: Map; /** Exclude patterns. Defaults to {@link DEFAULT_GLOBAL_EXCLUDE}. */ globalExclude?: string[]; } interface ScanResult { /** Every scanned file, sorted by `relativePath`. */ entries: FileEntry[]; /** Relative paths of files matching no artifact pattern. */ unmapped: string[]; } /** * Enumerate files under `projectRoot`, assigning each to the artifacts whose * patterns match. Returns all files (mapped and unmapped) plus the list of * unmapped relative paths. Output is deterministic: entries are sorted by * `relativePath` and `matchedArtifacts` by artifact id. */ declare function scanFiles(options: ScanOptions): Promise; interface ResolveSpecifierOptions { /** Raw module specifier as emitted by the analyzer (e.g. "./utils/logger.js"). */ specifier: string; /** Project-relative path of the importing file (e.g. "src/app.ts"). */ fromFile: string; /** All project-relative file paths known to the scan. */ projectFiles: Set; } /** * Resolve a module specifier to a project-relative file path, or `null` when it * is a bare (npm) specifier or cannot be matched to a project file. * * Relative specifiers ("./", "../") are resolved against the importer's * directory, then probed through TS-style extension and index variants. */ declare function resolveSpecifier(options: ResolveSpecifierOptions): string | null; interface ResolveAllEdgesOptions { /** Edges to resolve (typically one file's analysis output). */ edges: GraphEdge[]; /** All project-relative file paths known to the scan. */ projectFiles: Set; } /** * Return a new edge array in which every resolvable import/re-export specifier * has been rewritten to its project-relative file path. Edges of other kinds * (type_reference, calls, …) and unresolvable specifiers are passed through * unchanged. The input array and its edges are never mutated. */ declare function resolveAllEdges(options: ResolveAllEdgesOptions): GraphEdge[]; interface BuildAstGraphResult { graph: AstGraph; /** File contents read during AST build (relative path → source). */ fileContents: Map; } interface BuildAstGraphOptions { /** Project root; patterns and graph node ids are relative to it. */ projectRoot: string; /** artifactId → glob patterns (the DSL `path_patterns`). */ artifactPatterns: Map; /** Analyzer registry resolving files to LanguageAnalyzers by extension. */ registry: AnalyzerRegistry; /** Optional persistent store enabling incremental rebuilds. */ store?: StoreHandle; /** Exclude patterns; defaults to the scanner's DEFAULT_GLOBAL_EXCLUDE. */ globalExclude?: string[]; } /** * Build the AST Graph for a project (ARCHITECTURE.md §6.7). * * Steps: scan files → for each, hash and consult the store (hash match skips * analysis, restoring the cached IR) → analyze the rest via the registry * (files with no matching analyzer are skipped with a diagnostic) → merge into * an AstGraph → write new/changed IRs back to the store. */ declare function buildAstGraph(options: BuildAstGraphOptions): Promise; declare const DependencyNodeSchema: z.ZodObject<{ id: z.ZodString; metadata: z.ZodRecord; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; module: "module"; package: "package"; artifact: "artifact"; }>; artifactIds: z.ZodArray; }, z.core.$strip>; type DependencyNode = z.infer; declare const DependencyGraphSchema: z.ZodObject<{ ast: z.ZodObject<{ nodes: z.ZodMap; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; filePath: z.ZodString; symbols: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>>; symbolInfo: z.ZodOptional; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; edges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; fileHashes: z.ZodMap; }, z.core.$strip>; nodes: z.ZodMap; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; module: "module"; package: "package"; artifact: "artifact"; }>; artifactIds: z.ZodArray; }, z.core.$strip>>; edges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; artifactMapping: z.ZodMap>; }, z.core.$strip>; type DependencyGraph = z.infer; /** * Resolve dependency edges from a parsed manifest. * * @param manifestPath Path to the manifest file (used as the edge `from`). * @param content Parsed manifest object (e.g. `JSON.parse(package.json)`). * @returns One `depends_on` GraphEdge per dependency. Non-package.json * manifests and missing/malformed sections yield `[]`. */ declare function resolveManifestEdges(manifestPath: string, content: Record): GraphEdge[]; /** * Return the ids of every artifact whose glob patterns match `filePath`. * * @param filePath Project-relative path (matches the AST graph node ids). * @param artifactPatterns artifactId → glob patterns (the DSL `path_patterns`). * @returns Matching artifact ids, sorted for deterministic output. * Artifacts with no patterns never match. */ declare function mapFileToArtifacts(filePath: string, artifactPatterns: Map): string[]; /** * Batch variant of {@link mapFileToArtifacts}: build a filePath → artifactId[] * mapping for many files at once. Every input file gets an entry (possibly an * empty array when it matches no artifact). */ declare function buildArtifactMapping(files: string[], artifactPatterns: Map): Map; interface BuildDependencyGraphInput { /** The AST graph whose file nodes and edges form the structural base. */ ast: AstGraph; /** External-package edges from manifests (§7.3). */ manifestEdges: GraphEdge[]; /** filePath → artifact IDs (from the artifact mapper, §7.4). */ artifactMapping: Map; } interface ResolveSymbolEdgesInput { /** Edges to resolve; only `calls` / `type_reference` edges are touched. */ edges: GraphEdge[]; /** Symbol name → candidate symbol ids (a name may exist in several files). */ symbolIndex: Map; /** Every symbol node id, for same-file resolution. */ symbolIds: Set; } /** * Resolve `calls` / `type_reference` edges whose `to` is still a bare symbol * name into a concrete symbol id (§4.2). Resolution prefers a symbol declared * in the same file as the edge's source; otherwise it accepts a globally unique * match. Ambiguous or unknown names are left untouched so the edge still * records the (unresolved) reference. Edges already pointing at a symbol id * (containing '#') or of any other kind pass through unchanged. */ declare function resolveSymbolEdges(input: ResolveSymbolEdgesInput): GraphEdge[]; interface BuildDependencyGraphOptions { /** The AST graph whose file nodes and edges form the structural base. */ ast: AstGraph; /** Project root; manifest paths and graph node ids are relative to it. */ projectRoot: string; /** artifactId → glob patterns (the DSL `path_patterns`). */ artifactPatterns: Map; /** * Paths to package.json manifests (absolute, or relative to `projectRoot`). * Each contributes external-package `depends_on` edges (§7.3). */ manifests?: string[]; } /** * Build the Dependency Graph for a project (ARCHITECTURE.md §7). * * Steps: resolve manifest edges from package.json files → build the * file→artifact mapping from the AST file nodes → assemble the artifact-aware * DependencyGraph (with boundary-crossing edges) → return it. */ declare function buildDependencyGraph(options: BuildDependencyGraphOptions): Promise; declare const ArtifactRouteSchema: z.ZodObject<{ artifactId: z.ZodString; paths: z.ZodArray; }, z.core.$strip>; type ArtifactRoute = z.infer; declare const AffectedEntrySchema: z.ZodObject<{ path: z.ZodString; artifactId: z.ZodOptional; symbolId: z.ZodOptional; symbolName: z.ZodOptional; line: z.ZodOptional; endLine: z.ZodOptional; depth: z.ZodNumber; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>; type AffectedEntry = z.infer; declare const AffectedArtifactSchema: z.ZodObject<{ artifactId: z.ZodString; affectedFiles: z.ZodArray; requiredValidations: z.ZodArray; ownerAgents: z.ZodArray; routes: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>; type AffectedArtifact = z.infer; declare const TEST_ASSOCIATION_METHODS: readonly ["import", "naming_convention", "directory_convention", "semantic"]; declare const TestAssociationMethodSchema: z.ZodEnum<{ naming_convention: "naming_convention"; semantic: "semantic"; import: "import"; directory_convention: "directory_convention"; }>; type TestAssociationMethod = z.infer; declare const TestAssociationSchema: z.ZodObject<{ sourcePath: z.ZodString; testPaths: z.ZodArray; method: z.ZodEnum<{ naming_convention: "naming_convention"; semantic: "semantic"; import: "import"; directory_convention: "directory_convention"; }>; }, z.core.$strip>; type TestAssociation = z.infer; declare const IMPACT_DIRECTIONS: readonly ["downstream", "upstream"]; declare const ImpactDirectionSchema: z.ZodEnum<{ downstream: "downstream"; upstream: "upstream"; }>; type ImpactDirection = z.infer; declare const ImpactReportSchema: z.ZodObject<{ changed: z.ZodArray; direction: z.ZodEnum<{ downstream: "downstream"; upstream: "upstream"; }>; directlyAffected: z.ZodArray; symbolId: z.ZodOptional; symbolName: z.ZodOptional; line: z.ZodOptional; endLine: z.ZodOptional; depth: z.ZodNumber; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; transitivelyAffected: z.ZodArray; symbolId: z.ZodOptional; symbolName: z.ZodOptional; line: z.ZodOptional; endLine: z.ZodOptional; depth: z.ZodNumber; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; affectedArtifacts: z.ZodArray; requiredValidations: z.ZodArray; ownerAgents: z.ZodArray; routes: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>>; affectedValidations: z.ZodArray; affectedAgents: z.ZodArray; affectedWorkflows: z.ZodArray; testMapping: z.ZodArray; method: z.ZodEnum<{ naming_convention: "naming_convention"; semantic: "semantic"; import: "import"; directory_convention: "directory_convention"; }>; }, z.core.$strip>>; maxConfidence: z.ZodNumber; generatedAt: z.ZodString; }, z.core.$strip>; type ImpactReport = z.infer; interface TraverseDownstreamOptions { graph: DependencyGraph; /** The changed files to start from. */ changed: string[]; /** Maximum BFS depth to explore; default: unlimited. */ maxDepth?: number; /** Edge classifications to traverse; default: deterministic + candidate. */ edgeTypes?: EdgeClassification[]; /** Evidence types to exclude when scoring entry relevance. */ evidenceExclude?: EvidenceType[]; /** Cap the number of returned entries. */ limit?: number; /** @deprecated Issue #21 — use `edgeTypes`. Honoured for backward compat. */ minConfidence?: number; } /** * Compute the files affected downstream of `changed` by following reverse * dependency edges. Returns AffectedEntry[] sorted by depth ascending. */ declare function traverseDownstream(options: TraverseDownstreamOptions): AffectedEntry[]; interface TraverseUpstreamOptions { graph: DependencyGraph; /** The files whose dependencies to walk. */ files: string[]; /** Maximum BFS depth to explore; default: unlimited. */ maxDepth?: number; /** Edge classifications to traverse; default: deterministic + candidate. */ edgeTypes?: EdgeClassification[]; /** Evidence types to exclude when scoring entry relevance. */ evidenceExclude?: EvidenceType[]; /** Cap the number of returned entries. */ limit?: number; /** @deprecated Issue #21 — use `edgeTypes`. Honoured for backward compat. */ minConfidence?: number; } /** * Compute the files that `files` depend on by following forward dependency * edges. Returns AffectedEntry[] sorted by depth ascending. */ declare function traverseUpstream(options: TraverseUpstreamOptions): AffectedEntry[]; interface ResolveAffectedArtifactsOptions { /** Affected file paths (from impact traversal, plus the changed files). */ affectedFiles: string[]; /** filePath → artifact IDs (typically `DependencyGraph.artifactMapping`). */ artifactMapping: Map; /** Optional agent-contracts Navigation Index for the contract overlay. */ navigationIndex?: Record; } /** * Map affected files to the artifacts they belong to and, via the Navigation * Index overlay, collect each artifact's required validations, owner agents, * and routes. Artifacts are returned in first-seen order; an artifact's * `affectedFiles` preserve the order in which they were encountered. */ declare function resolveAffectedArtifacts(options: ResolveAffectedArtifactsOptions): AffectedArtifact[]; /** * Determine which workflows are affected, based on the affected artifacts' * membership. A workflow is affected when it lists one of the affected * artifacts (`navigationIndex.workflows[id].artifacts`) or when an affected * artifact node declares it (`artifact.workflows`). Returns a de-duplicated, * stably-ordered list of workflow ids. */ declare function resolveAffectedWorkflows(affectedArtifacts: AffectedArtifact[], navigationIndex?: Record): string[]; interface CallGraphNode { /** Callee symbolId (or a bare name when the call was not resolved). */ symbolId: string; /** Display name when the node resolves to a known symbol. */ symbolName?: string; /** Containing file when the node resolves to a known symbol. */ filePath?: string; /** 1-based line of the call site in the *caller* (undefined for the root). */ line?: number; /** BFS depth from the entry symbol (0 for the root). */ depth: number; /** Direct callees, in source order, de-duplicated by symbolId. */ children: CallGraphNode[]; /** Set when expansion stopped because the symbol is an ancestor (a cycle). */ truncated?: boolean; } /** Traversal direction: callees (forward) or callers (reverse). */ type CallGraphDirection = "forward" | "reverse"; interface CallGraph { /** The entry symbolId the graph was rooted at. */ entry: string; /** The maximum depth explored. */ maxDepth: number; /** Traversal direction used to build the graph. */ direction: CallGraphDirection; /** Root node (the entry symbol). */ root: CallGraphNode; /** Total nodes in the tree (including the root and truncated leaves). */ nodeCount: number; } interface BuildCallGraphOptions { graph: DependencyGraph; /** Entry symbolId (filePath#name) to root the call graph at. */ entry: string; /** Maximum traversal depth; default 3. */ maxDepth?: number; /** * Traversal direction; default "forward". * - "forward": follow `calls` edges caller → callee (what does X call?). * - "reverse": follow `calls` edges callee → caller (who calls X?). */ direction?: CallGraphDirection; } /** * Build a call graph rooted at `entry` by following `calls` edges up to * `maxDepth`. Pure — no IO. Unknown entry symbols still yield a single-node tree * so callers can render a meaningful (empty) result. * * In "forward" mode each edge `from → to` is indexed by its caller, so a node's * children are its callees. In "reverse" mode it is indexed by its callee, so a * node's children are its callers; unresolved edges (whose `to` is a bare name) * are matched against the current symbol's name as well as its full id. */ declare function buildCallGraph(options: BuildCallGraphOptions): CallGraph; interface AnalyzeImpactOptions { graph: DependencyGraph; /** The changed files to analyze impact from. */ changed: string[]; /** Traversal direction. `downstream` answers "what breaks if this changes?". */ direction: ImpactDirection; /** Maximum BFS depth to explore; default: unlimited. */ maxDepth?: number; /** * Edge classifications to traverse; default: deterministic + candidate. * Restrict to `["deterministic"]` for a fast, candidate-free analysis. */ edgeTypes?: EdgeClassification[]; /** Evidence types to exclude when scoring entry relevance (Issue #21). */ evidenceExclude?: EvidenceType[]; /** Cap the number of affected entries, keeping the most relevant. */ limit?: number; /** @deprecated Issue #21 — use `edgeTypes`. Honoured for backward compat. */ minConfidence?: number; /** filePath → artifact IDs; defaults to `graph.artifactMapping`. */ artifactMapping?: Map; /** Optional agent-contracts Navigation Index for the contract overlay. */ navigationIndex?: Record; } /** * Analyze the impact of a set of changed files over a DependencyGraph * (ARCHITECTURE.md §8). Returns a fully-assembled ImpactReport. */ declare function analyzeImpact(options: AnalyzeImpactOptions): Promise; declare const CONTENT_MODES: readonly ["full", "section", "symbol-section", "signature", "reference"]; declare const ContentModeSchema: z.ZodEnum<{ signature: "signature"; full: "full"; section: "section"; "symbol-section": "symbol-section"; reference: "reference"; }>; type ContentMode = z.infer; declare const ContextSectionSchema: z.ZodObject<{ startLine: z.ZodNumber; endLine: z.ZodNumber; symbolId: z.ZodOptional; symbolName: z.ZodOptional; }, z.core.$strip>; type ContextSection = z.infer; declare const ContextEntrySchema: z.ZodObject<{ path: z.ZodString; artifactId: z.ZodOptional; relevanceScore: z.ZodNumber; contentMode: z.ZodEnum<{ signature: "signature"; full: "full"; section: "section"; "symbol-section": "symbol-section"; reference: "reference"; }>; content: z.ZodString; section: z.ZodOptional; symbolName: z.ZodOptional; }, z.core.$strip>>; sections: z.ZodOptional; symbolName: z.ZodOptional; }, z.core.$strip>>>; reason: z.ZodString; }, z.core.$strip>; type ContextEntry = z.infer; declare const ContextMetadataSchema: z.ZodObject<{ totalTokens: z.ZodNumber; budgetTokens: z.ZodNumber; filesIncluded: z.ZodNumber; filesExcluded: z.ZodNumber; filesReferenced: z.ZodNumber; artifactsCovered: z.ZodArray; affectedValidations: z.ZodOptional>; affectedAgents: z.ZodOptional>; affectedWorkflows: z.ZodOptional>; generatedAt: z.ZodString; }, z.core.$strip>; type ContextMetadata = z.infer; declare const ContextPackSchema: z.ZodObject<{ taskId: z.ZodOptional; entries: z.ZodArray; relevanceScore: z.ZodNumber; contentMode: z.ZodEnum<{ signature: "signature"; full: "full"; section: "section"; "symbol-section": "symbol-section"; reference: "reference"; }>; content: z.ZodString; section: z.ZodOptional; symbolName: z.ZodOptional; }, z.core.$strip>>; sections: z.ZodOptional; symbolName: z.ZodOptional; }, z.core.$strip>>>; reason: z.ZodString; }, z.core.$strip>>; metadata: z.ZodObject<{ totalTokens: z.ZodNumber; budgetTokens: z.ZodNumber; filesIncluded: z.ZodNumber; filesExcluded: z.ZodNumber; filesReferenced: z.ZodNumber; artifactsCovered: z.ZodArray; affectedValidations: z.ZodOptional>; affectedAgents: z.ZodOptional>; affectedWorkflows: z.ZodOptional>; generatedAt: z.ZodString; }, z.core.$strip>; }, z.core.$strip>; type ContextPack = z.infer; interface RankedFile { path: string; artifactId?: string; /** Combined relevance score, in the range 0.0 – 1.0. */ relevanceScore: number; /** BFS distance from the change set (0 for directly changed files). */ depth: number; evidence: Evidence[]; } declare const RANK_WEIGHTS: { readonly depth: 0.4; readonly artifact: 0.2; readonly edges: 0.2; readonly relevance: 0.2; }; interface RankFilesOptions { affectedEntries: AffectedEntry[]; /** filePath → artifact IDs. Membership contributes the artifact bonus. */ artifactMapping: Map; /** filePath → edge count (graph degree). Normalized against the max. */ edgeCounts?: Map; /** Evidence types to exclude when deriving the relevance factor (Issue #21). */ evidenceExclude?: EvidenceType[]; } /** * Rank the affected files by relevance (ARCHITECTURE.md §9.2). Returns a list * sorted by relevanceScore descending. */ declare function rankFiles(options: RankFilesOptions): RankedFile[]; /** * Rough token estimate: ~4 characters per token. Deterministic and cheap; good * enough for budget accounting without a real tokenizer. */ declare function estimateTokens(content: string): number; /** Fraction of the budget reserved for metadata entries (§9.3). */ declare const METADATA_RESERVE_FRACTION = 0.1; interface SelectedFile { path: string; relevanceScore: number; tokens: number; } interface BudgetSelection { selected: SelectedFile[]; /** Paths dropped because they would exceed the file budget. */ excluded: string[]; /** Total tokens of the selected files (may exceed budget via depth-0 files). */ totalTokens: number; } interface SelectWithinBudgetOptions { ranked: RankedFile[]; budgetTokens: number; /** filePath → content; missing entries are treated as empty (0 tokens). */ fileContents: Map; } /** * Select files to include within the token budget (ARCHITECTURE.md §9.3). * Iterates in rank order, always including depth-0 files and admitting the * rest only while they fit under the metadata-reserved file budget. */ declare function selectWithinBudget(options: SelectWithinBudgetOptions): BudgetSelection; declare const CONTENT_MODE_THRESHOLDS: { readonly full: 0.7; readonly section: 0.4; readonly signature: 0.2; /** Maximum token size for a "full" rendering. */ readonly fullMaxTokens: 2000; }; /** * Symbol-scoped sections (§6.1): one ContextSection per affected symbol, * spanning `symbol.line` … `symbol.endLine`. Large container symbols (classes, * etc. that enclose other symbols and span more than 50 lines) are decomposed * into a short declaration header plus their child symbols as separate sections. * Sections are sorted by start line and made non-overlapping; a section fully * contained in a prior one is dropped, and a partial overlap is clipped to * begin after the previous section. Line numbers are 1-based and inclusive; * end lines are clamped to the file's length. */ declare function extractSymbolSections(fileContent: string, symbols: SymbolInfo[]): ContextSection[]; interface AssembleContextPackOptions { selection: BudgetSelection; fileContents: Map; rankedFiles: RankedFile[]; budgetTokens: number; taskId?: string; /** * filePath → affected symbols (§6.1). A file present here is rendered in * "symbol-section" mode: only the line ranges of its affected symbols are * included, instead of the score-derived full/section/signature rendering. */ affectedSymbols?: Map; /** Contract validations from impact overlay (§8.4). */ affectedValidations?: string[]; /** Owner agents from impact overlay (§8.4). */ affectedAgents?: string[]; /** Workflows from impact overlay (§8.4). */ affectedWorkflows?: string[]; } /** * Assemble a ContextPack from a budget selection (ARCHITECTURE.md §9.4). * Renders each selected file under its content mode and records the budget / * coverage metadata. */ declare function assembleContextPack(options: AssembleContextPackOptions): ContextPack; interface ContextMapCandidate { path?: string; symbolId?: string; artifactId?: string; } type ContextMapDirection = "downstream" | "upstream" | "both"; interface GetContextMapInput { instruction: string; candidates: ContextMapCandidate[]; depth?: number; direction?: ContextMapDirection; budgetTokens?: number; include?: Array<"dependencies" | "reverseDependencies" | "artifacts" | "symbols" | "validations" | "workflows">; } interface ContextRoot { id: string; kind: "file" | "symbol" | "artifact"; path?: string; symbolId?: string; artifactId?: string; } interface ContextMapNode { id: string; kind: "file" | "symbol" | "artifact" | "validator" | "workflow"; label: string; path?: string; symbolId?: string; artifactId?: string; relevance: number; } type ContextMapEdgeType = "imports" | "calls" | "contains" | "belongs_to_artifact" | "produces" | "consumes" | "validated_by" | "workflow_uses"; interface ContextMapEdge { from: string; to: string; type: ContextMapEdgeType; confidence: number; evidence: Evidence[]; } interface ContextMapTarget { path?: string; symbolId?: string; artifactId?: string; reason: string; contentMode?: ContentMode; relevance?: number; } interface ContextMap { roots: ContextRoot[]; nodes: ContextMapNode[]; edges: ContextMapEdge[]; suggestedReadTargets: ContextMapTarget[]; suggestedEditTargets: ContextMapTarget[]; suggestedValidationTargets: ContextMapTarget[]; } interface GetContextMapOptions extends GetContextMapInput { graph: DependencyGraph; projectRoot: string; edgeTypes?: EdgeClassification[]; evidenceExclude?: EvidenceType[]; limit?: number; navigationIndex?: Record; fileContents?: Map; } declare function resolveContextMapSeeds(graph: DependencyGraph, candidates: ContextMapCandidate[]): { seeds: string[]; roots: ContextRoot[]; }; declare function getContextMap(options: GetContextMapOptions): Promise; /** Default token budget for a context pack. */ declare const DEFAULT_BUDGET_TOKENS = 50000; /** * Context granularity (§6): * "file" — render whole files / line heuristics by relevance (default). * "symbol" — render only the line ranges of affected symbols (symbol-scoped * sections), driven by the impact analysis symbol results. */ declare const CONTEXT_GRANULARITIES: readonly ["file", "symbol"]; type ContextGranularity = (typeof CONTEXT_GRANULARITIES)[number]; interface GenerateContextPackOptions { graph: DependencyGraph; /** The changed files to build context around. */ changed: string[]; /** Token budget for the pack; default: 50,000. */ budgetTokens?: number; /** * Edge classifications to traverse during impact analysis; default: * deterministic + candidate. Restrict to `["deterministic"]` to skip * candidate edges (Issue #21). */ edgeTypes?: EdgeClassification[]; /** Evidence types to exclude when scoring relevance (Issue #21). */ evidenceExclude?: EvidenceType[]; /** Cap the number of ranked files considered for the pack. */ limit?: number; /** @deprecated Issue #21 — use `edgeTypes`. Honoured for backward compat. */ minConfidence?: number; taskId?: string; /** filePath → artifact IDs; defaults to `graph.artifactMapping`. */ artifactMapping?: Map; /** Filesystem root the file paths are resolved against. */ projectRoot: string; /** Context granularity; default: "symbol" (symbol-scoped sections). */ granularity?: ContextGranularity; /** Pre-loaded file contents to avoid re-reading from disk. */ fileContents?: Map; /** Optional agent-contracts Navigation Index for the contract overlay (§8.4). */ navigationIndex?: Record; } /** * Generate a token-budget-constrained ContextPack for a set of changed files * (ARCHITECTURE.md §9). */ declare function generateContextPack(options: GenerateContextPackOptions): Promise; declare const GAP_REASONS: readonly ["contract_related_no_edge", "same_artifact_no_edge", "naming_convention_match", "unresolved_dynamic_import"]; declare const GapReasonSchema: z.ZodEnum<{ contract_related_no_edge: "contract_related_no_edge"; same_artifact_no_edge: "same_artifact_no_edge"; naming_convention_match: "naming_convention_match"; unresolved_dynamic_import: "unresolved_dynamic_import"; }>; type GapReason = z.infer; declare const GapCandidateSchema: z.ZodObject<{ fileA: z.ZodString; fileB: z.ZodString; gapReason: z.ZodEnum<{ contract_related_no_edge: "contract_related_no_edge"; same_artifact_no_edge: "same_artifact_no_edge"; naming_convention_match: "naming_convention_match"; unresolved_dynamic_import: "unresolved_dynamic_import"; }>; contractRelation: z.ZodOptional>; }, z.core.$strip>; type GapCandidate = z.infer; declare const SNIPPET_CONTEXTS: readonly ["signature", "body", "usage", "surrounding"]; declare const SnippetContextSchema: z.ZodEnum<{ signature: "signature"; body: "body"; usage: "usage"; surrounding: "surrounding"; }>; type SnippetContext = z.infer; declare const SourceSnippetSchema: z.ZodObject<{ startLine: z.ZodNumber; endLine: z.ZodNumber; content: z.ZodString; context: z.ZodEnum<{ signature: "signature"; body: "body"; usage: "usage"; surrounding: "surrounding"; }>; }, z.core.$strip>; type SourceSnippet = z.infer; declare const FileContextSchema: z.ZodObject<{ filePath: z.ZodString; symbols: z.ZodArray; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; existingEdges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; snippets: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>; type FileContext = z.infer; declare const GapDescriptionSchema: z.ZodObject<{ reason: z.ZodEnum<{ contract_related_no_edge: "contract_related_no_edge"; same_artifact_no_edge: "same_artifact_no_edge"; naming_convention_match: "naming_convention_match"; unresolved_dynamic_import: "unresolved_dynamic_import"; }>; contractRelation: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>; type GapDescription = z.infer; declare const SourceContextSchema: z.ZodObject<{ file: z.ZodObject<{ filePath: z.ZodString; symbols: z.ZodArray; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; existingEdges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; snippets: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>; relatedFiles: z.ZodArray; exported: z.ZodBoolean; line: z.ZodNumber; symbolId: z.ZodString; endLine: z.ZodNumber; parentSymbolId: z.ZodOptional; signature: z.ZodOptional; }, z.core.$strip>>; existingEdges: z.ZodArray; classification: z.ZodEnum<{ deterministic: "deterministic"; candidate: "candidate"; }>; evidence: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>>; relevanceScore: z.ZodOptional; }, z.core.$strip>>; snippets: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>>; gap: z.ZodObject<{ reason: z.ZodEnum<{ contract_related_no_edge: "contract_related_no_edge"; same_artifact_no_edge: "same_artifact_no_edge"; naming_convention_match: "naming_convention_match"; unresolved_dynamic_import: "unresolved_dynamic_import"; }>; contractRelation: z.ZodOptional; confidence: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; type SourceContext = z.infer; declare const LlmEvidencePointSchema: z.ZodObject<{ type: z.ZodEnum<{ static_import: "static_import"; dynamic_import: "dynamic_import"; manifest_dependency: "manifest_dependency"; path_pattern_match: "path_pattern_match"; naming_convention: "naming_convention"; matched_schema_name: "matched_schema_name"; nearby_import: "nearby_import"; tool_output_field_similarity: "tool_output_field_similarity"; llm_semantic_link: "llm_semantic_link"; }>; detail: z.ZodString; line: z.ZodOptional; }, z.core.$strip>; type LlmEvidencePoint = z.infer; declare const CandidateProposalSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; edgeKind: z.ZodEnum<{ imports: "imports"; exports: "exports"; calls: "calls"; type_reference: "type_reference"; re_exports: "re_exports"; depends_on: "depends_on"; contains: "contains"; boundary_crossing: "boundary_crossing"; }>; confidence: z.ZodNumber; reasoning: z.ZodString; evidencePoints: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type CandidateProposal = z.infer; /** Array form used when parsing a full LLM response. */ declare const CandidateProposalArraySchema: z.ZodArray; confidence: z.ZodNumber; reasoning: z.ZodString; evidencePoints: z.ZodArray; detail: z.ZodString; line: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; interface LlmAdapter { analyze(prompt: string): Promise; } interface SemanticAnalyzerOptions { /** Cap on candidate edges emitted per run (default: 100). */ maxCandidatesPerRun?: number; /** Drop gaps below this confidence before LLM invocation (default: 0.5). */ minGapConfidence?: number; llmAdapter: LlmAdapter; } /** Default cap on candidate edges per run (ARCHITECTURE.md §11.10). */ declare const DEFAULT_MAX_CANDIDATES_PER_RUN = 100; /** Default minimum gap confidence (ARCHITECTURE.md §11.10). */ declare const DEFAULT_MIN_GAP_CONFIDENCE = 0.5; /** Default context window (lines before/after a symbol) for snippets. */ declare const DEFAULT_SNIPPET_CONTEXT_LINES = 5; /** * Heuristic confidence assigned to each gap reason. These express how strongly * the deterministic signal suggests a real relationship worth asking the LLM * about; they are NOT the confidence of the resulting candidate edge (that * comes from the LLM's self-assessment). */ declare const GAP_REASON_CONFIDENCE: Record; interface DetectGapsOptions { astGraph: AstGraph; /** filePath → artifact IDs the file participates in. */ artifactMapping: Map; /** agent-contracts Navigation Index, when available. */ navigationIndex?: Record; } /** * Detect file pairs that should be related but lack a deterministic edge. * * Heuristics, in descending priority: * - `contract_related_no_edge`: files in artifacts the contract graph relates * - `same_artifact_no_edge`: files sharing an artifact * - `naming_convention_match`: files whose names share a normalized stem * - `unresolved_dynamic_import`: dynamic imports with a non-literal target */ declare function detectGaps(options: DetectGapsOptions): GapCandidate[]; interface AssembleContextOptions { /** filePath → raw source content (Layer 1, read from the file system). */ fileContents: Map; /** filePath → symbols (Layer 2, from the store / AST graph). */ symbols: Map; /** filePath → existing edges originating from the file (Layer 2). */ edges: Map; } /** * Assemble the SourceContext for a single gap. `gap.fileA` becomes the primary * file; `gap.fileB` becomes the (single) related file. Missing source content * yields a FileContext with no snippets rather than failing — the LLM can still * reason from symbols and existing edges. */ declare function assembleSourceContext(gap: GapCandidate, options: AssembleContextOptions): SourceContext; /** Default maximum number of snippets returned per file. */ declare const DEFAULT_MAX_SNIPPETS = 5; /** * Extract relevant code snippets from `content` around `symbols`. * * Exported symbols come first (they define the file's public surface and are * the most likely to participate in a cross-file relationship). When the file * has no symbols, a single header snippet (the first few lines) is returned so * the LLM still has minimal context. Lines are 1-based and clamped to the file. */ declare function extractSnippets(filePath: string, content: string, symbols: SymbolInfo[], maxSnippets?: number): SourceSnippet[]; /** * Build the LLM prompt for one assembled SourceContext. Output is deterministic * for a given context, which keeps prompts cacheable and tests stable. */ declare function buildPrompt(context: SourceContext): string; /** * Parse an LLM response into validated CandidateProposals. * * Accepts either a JSON array or a single JSON object. Each element is validated * independently: valid proposals are kept, invalid ones are dropped. Malformed * JSON or a non-array/object payload yields an empty array. */ declare function parseResponse(response: string): CandidateProposal[]; interface NormalizedCandidates { edges: GraphEdge[]; evidence: Evidence[]; } /** * Normalize candidate proposals to graph edges. Returns the candidate edges and * the flattened union of all evidence produced (the same entries are embedded in * each edge's `evidence` array). Each edge is classified `"candidate"`. */ declare function normalizeCandidates(proposals: CandidateProposal[]): NormalizedCandidates; interface RunSemanticAnalysisOptions { astGraph: AstGraph; /** filePath → artifact IDs the file participates in. */ artifactMapping: Map; /** Root directory used to resolve file paths for source snippets. */ projectRoot: string; llmAdapter: LlmAdapter; /** Cap on candidate edges emitted per run (default: 100). */ maxCandidatesPerRun?: number; /** agent-contracts Navigation Index, when available. */ navigationIndex?: Record; } interface SemanticAnalysisResult { edges: GraphEdge[]; gaps: GapCandidate[]; } /** * Run semantic analysis end to end. Gaps are detected deterministically, each is * turned into a prompt and sent to the LLM, and validated proposals are * normalized into candidate edges (capped at `maxCandidatesPerRun`). A failing * LLM call for one gap is isolated — it is skipped rather than aborting the run. */ declare function runSemanticAnalysis(options: RunSemanticAnalysisOptions): Promise; declare const OUTPUT_FORMATS: readonly ["json", "yaml", "text", "dot"]; type OutputFormat = (typeof OUTPUT_FORMATS)[number]; /** A sink for CLI output; defaults to stdout. Overridable for tests. */ type Writer = (line: string) => void; /** * Emit `data` in the requested format. For `json`/`yaml` the structured `data` * is serialized; for `text` the `text` renderer produces a human summary. */ declare function writeOutput(options: { format: OutputFormat; data: unknown; text: () => string; writer?: Writer; }): void; /** * Flatten a DependencyGraph into a JSON/YAML-safe object. The embedded AST * graph is flattened via `serializeAstGraph`; `nodes` and `artifactMapping` * Maps become plain records. */ declare function serializeDependencyGraph(graph: DependencyGraph): Record; declare const PROPAGATION_DIRECTIONS: readonly ["forward", "backward", "both"]; declare const PropagationDirectionSchema: z.ZodEnum<{ forward: "forward"; backward: "backward"; both: "both"; }>; type PropagationDirection = z.infer; declare const SymbolAnchorSchema: z.ZodObject<{ symbolId: z.ZodString; filePath: z.ZodString; startLine: z.ZodNumber; endLine: z.ZodNumber; }, z.core.$strip>; type SymbolAnchor = z.infer; declare const ExternalEvidenceSchema: z.ZodObject<{ kind: z.ZodString; detail: z.ZodString; filePath: z.ZodOptional; line: z.ZodOptional; endLine: z.ZodOptional; symbolId: z.ZodOptional; llmConfidence: z.ZodOptional; }, z.core.$strip>; type ExternalEvidence = z.infer; declare const ExternalEdgeSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; kind: z.ZodString; propagation: z.ZodDefault>; weight: z.ZodDefault; metadata: z.ZodOptional>; evidence: z.ZodOptional; line: z.ZodOptional; endLine: z.ZodOptional; symbolId: z.ZodOptional; llmConfidence: z.ZodOptional; }, z.core.$strip>>>; }, z.core.$strip>; type ExternalEdge = z.infer; declare const AnchorMappingSchema: z.ZodObject<{ domainId: z.ZodString; filePaths: z.ZodArray; symbolIds: z.ZodOptional>; symbols: z.ZodOptional>>; artifactId: z.ZodOptional; }, z.core.$strip>; type AnchorMapping = z.infer; declare const ExternalInsightSchema: z.ZodObject<{ source: z.ZodString; sourceVersion: z.ZodOptional; generatedAt: z.ZodOptional; edges: z.ZodArray>; weight: z.ZodDefault; metadata: z.ZodOptional>; evidence: z.ZodOptional; line: z.ZodOptional; endLine: z.ZodOptional; symbolId: z.ZodOptional; llmConfidence: z.ZodOptional; }, z.core.$strip>>>; }, z.core.$strip>>; anchorMapping: z.ZodOptional; symbolIds: z.ZodOptional>; symbols: z.ZodOptional>>; artifactId: z.ZodOptional; }, z.core.$strip>>>; }, z.core.$strip>; type ExternalInsight = z.infer; declare const InsightQuerySchema: z.ZodObject<{ projectRoot: z.ZodString; changedFiles: z.ZodOptional>; changedSymbols: z.ZodOptional>; artifactIds: z.ZodOptional>; evidencePolicy: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; type InsightQuery = z.infer; declare const ImpactNotificationSchema: z.ZodObject<{ affectedFiles: z.ZodArray; affectedSymbols: z.ZodOptional>; affectedArtifactIds: z.ZodArray; impactReport: z.ZodRecord; }, z.core.$strip>; type ImpactNotification = z.infer; /** Supplies structured insights from an external tool (speckeeper, data-lineage, …). */ interface InsightProvider { readonly name: string; provide(query: InsightQuery): Promise; } declare const UnresolvedEdgeSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; kind: z.ZodString; source: z.ZodString; reason: z.ZodString; }, z.core.$strip>; type UnresolvedEdge = z.infer; declare const ProviderErrorSchema: z.ZodObject<{ providerName: z.ZodString; message: z.ZodString; }, z.core.$strip>; type ProviderError = z.infer; interface IntegrationStats { totalEdgesAdded: number; providersSucceeded: number; providersFailed: number; } interface IntegrationResult { graph: DependencyGraph; unresolvedEdges: UnresolvedEdge[]; providerErrors: ProviderError[]; stats: IntegrationStats; } /** Raised for recoverable analysis failures; mapped to CLI exit code 1. */ declare class AnalysisError extends Error { constructor(message: string); } interface ProjectContext { /** artifactId → glob patterns from the DSL (empty when no DSL resolves). */ artifactPatterns: Map; /** agent-contracts Navigation Index, when a DSL resolved. */ navigationIndex?: Record; /** Resolved artifact definitions from artifact-contracts.yaml, when available. */ artifactDefinitions?: Record; /** Trace links from artifact-contracts.yaml, when available. */ traceLinks?: TraceLink[]; } /** * Resolve project artifact patterns. Prefers artifact-contracts.yaml when * present; otherwise resolves the agent-contracts DSL. Best-effort: if neither * source resolves, returns an empty artifact mapping so the structural pipeline * still runs. */ declare function loadProjectContext(projectRoot: string, dslPath?: string, artifactContractsPath?: string): Promise; interface BuildGraphResult { graph: DependencyGraph; navigationIndex?: Record; store?: StoreHandle; /** File contents loaded during AST build (avoids re-reading in context-pack). */ fileContents: Map; unresolvedEdges: UnresolvedEdge[]; providerErrors: ProviderError[]; } /** * Run the AST → Dependency Graph stages for a project. Opens the persistent * store when caching is enabled; the caller owns closing the returned store. */ declare function buildProjectGraph(options: { projectRoot: string; dslPath?: string; artifactContractsPath?: string; useCache: boolean; externalProviders?: InsightProvider[]; changedFiles?: string[]; changedSymbols?: string[]; }): Promise; /** A contiguous range of 1-based line numbers in a file's post-change state. */ interface LineRange { start: number; end: number; } /** Changed file paths (project-relative) between `ref` and the working tree. */ declare function getChangedFiles(ref: string, cwd: string): string[]; /** * Parse `git diff --relative -U0 ` into per-file changed line ranges (in * the post-change file). A hunk `@@ -a,b +c,d @@` covers new lines c..c+d-1; * a pure deletion (d = 0) is recorded as the single anchor line c so the symbol * around the deletion is still flagged. */ declare function getChangedLineRanges(ref: string, cwd: string): Map; /** * Map changed line ranges to seed ids: the smallest enclosing symbol per * changed line, or the containing file when a line is outside every symbol. * Files with no symbol nodes at all seed the file path directly. */ declare function mapChangedLinesToSymbols(graph: DependencyGraph, changed: Map): string[]; /** * Resolve the impact seeds implied by a git diff against `ref`: changed line * ranges mapped to the smallest enclosing symbols (falling back to file paths). */ declare function resolveDiffSeeds(graph: DependencyGraph, ref: string, cwd: string): string[]; /** Build the artifact-analyzer commander program with all commands registered. */ declare function buildProgram(): Command; /** * Parse `argv` (user arguments, without node/script) and return the process * exit code. Never throws; analysis errors map to 1, argument errors to 2. */ declare function run(argv: string[], program?: Command): Promise; interface CommandProviderConfig { name: string; /** Shell command (pipes allowed when executed with `shell: true`). */ command: string; timeout?: number; env?: Record; /** Working directory override; defaults to `query.projectRoot`. */ cwd?: string; } declare class CommandProvider implements InsightProvider { readonly name: string; private readonly command; private readonly timeout; private readonly extraEnv; private readonly cwdOverride; constructor(config: CommandProviderConfig); provide(query: InsightQuery): Promise; } declare class CommandProviderError extends Error { readonly providerName: string; constructor(providerName: string, message: string); } declare function resolveEdgeKind(externalKind: string): EdgeKind; interface IntegrateInsightResult { edges: GraphEdge[]; unresolvedEdges: UnresolvedEdge[]; } /** * Convert a single {@link ExternalInsight} into graph-ready edges. * Unresolved domain endpoints are logged and collected, not thrown. */ declare function integrateInsight(insight: ExternalInsight): IntegrateInsightResult; /** Integrate multiple insights and merge unresolved edge lists. */ declare function integrateInsights(insights: ExternalInsight[]): IntegrateInsightResult; interface RunProvidersResult { insights: ExternalInsight[]; errors: ProviderError[]; } /** * Execute all providers concurrently. Individual failures do not affect others. */ declare function runProviders(providers: InsightProvider[], query: InsightQuery): Promise; /** * Load external insight providers from YAML configuration. * * Reads `external_providers` from `/artifact-contracts.yaml` * unless `configPath` is given. Returns `[]` when the file is missing, * unparsable, or has no `external_providers` section. */ declare function loadExternalProviders(projectRoot: string, configPath?: string): Promise; /** * Enrich a dependency graph with edges from external insight providers. * When `providers` is empty, returns the input graph unchanged (shallow copy). */ declare function integrateExternalInsights(depGraph: DependencyGraph, providers: InsightProvider[], query: InsightQuery): Promise; declare const TraceElementSchema: z.ZodObject<{ artifactId: z.ZodString; path: z.ZodString; symbolId: z.ZodOptional; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>; type TraceElement = z.infer; declare const TraceConnectionSchema: z.ZodObject<{ from: z.ZodObject<{ artifactId: z.ZodString; path: z.ZodString; symbolId: z.ZodOptional; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>; to: z.ZodObject<{ artifactId: z.ZodString; path: z.ZodString; symbolId: z.ZodOptional; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>; confidence: z.ZodNumber; resolver: z.ZodString; }, z.core.$strip>; type TraceConnection = z.infer; declare const ResolvedTraceLinkSchema: z.ZodObject<{ id: z.ZodString; from: z.ZodString; to: z.ZodString; resolver: z.ZodString; description: z.ZodOptional; connections: z.ZodArray; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>; to: z.ZodObject<{ artifactId: z.ZodString; path: z.ZodString; symbolId: z.ZodOptional; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>; confidence: z.ZodNumber; resolver: z.ZodString; }, z.core.$strip>>; orphans: z.ZodObject<{ from: z.ZodArray; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>>; to: z.ZodArray; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>; type ResolvedTraceLink = z.infer; declare const TraceabilityReportSchema: z.ZodObject<{ system: z.ZodString; links: z.ZodArray; connections: z.ZodArray; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>; to: z.ZodObject<{ artifactId: z.ZodString; path: z.ZodString; symbolId: z.ZodOptional; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>; confidence: z.ZodNumber; resolver: z.ZodString; }, z.core.$strip>>; orphans: z.ZodObject<{ from: z.ZodArray; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>>; to: z.ZodArray; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>>; summary: z.ZodObject<{ totalLinks: z.ZodNumber; fullyConnected: z.ZodNumber; partiallyConnected: z.ZodNumber; disconnected: z.ZodNumber; }, z.core.$strip>; orphanElements: z.ZodArray; kind: z.ZodEnum<{ symbol: "symbol"; file: "file"; }>; }, z.core.$strip>>; generatedAt: z.ZodString; }, z.core.$strip>; type TraceabilityReport = z.infer; interface ExtractTraceElementsOptions { artifactId: string; pathPatterns: string[]; excludePatterns?: string[]; /** Known file paths to match against (project-relative). */ files: string[]; } /** * Return file-level trace elements for an artifact by matching known project * files against `path_patterns` and filtering `exclude_patterns`. */ declare function extractTraceElements(options: ExtractTraceElementsOptions): TraceElement[]; interface ResolveTraceLinksOptions { traceLinks: Array<{ id: string; from: string; to: string; resolver: string; description?: string; }>; /** artifactId → TraceElement[] mapping */ elementsByArtifact: Map; /** Dependency graph for AST-based resolution. */ graph?: DependencyGraph; } /** * Resolve trace link definitions into concrete file-level connections and * orphan elements. */ declare function resolveTraceLinks(options: ResolveTraceLinksOptions): ResolvedTraceLink[]; interface ValidateTraceabilityOptions { /** Resolved artifact definitions (from artifact-contracts.yaml). */ artifacts: Record; /** Trace link definitions from artifact-contracts.yaml. */ traceLinks: Array<{ id: string; from: string; to: string; resolver: string; description?: string; }>; /** System identifier from artifact-contracts.yaml. */ system: string; /** Known file paths in the project (project-relative). */ files: string[]; /** Dependency graph for AST-based resolution. Optional. */ graph?: DependencyGraph; } /** * Orchestrate trace element extraction, link resolution, and report assembly. */ declare function validateTraceability(options: ValidateTraceabilityOptions): TraceabilityReport; export { ANALYZER_CAPABILITIES, AdjacencyListGraph, type AffectedArtifact, AffectedArtifactSchema, type AffectedEntry, AffectedEntrySchema, AnalysisError, type AnalyzeImpactOptions, type AnalyzerCapability, AnalyzerCapabilitySchema, AnalyzerRegistry, type AnchorMapping, AnchorMappingSchema, type ArtifactRoute, ArtifactRouteSchema, type AssembleContextOptions, type AssembleContextPackOptions, type AstGraph, AstGraphSchema, type AstNode, AstNodeSchema, type BudgetSelection, type BuildAstGraphOptions, type BuildAstGraphResult, type BuildCallGraphOptions, type BuildDependencyGraphInput, type BuildDependencyGraphOptions, type BuildGraphResult, CANDIDATE_EDGES_METADATA_KEY, CONTENT_MODES, CONTENT_MODE_THRESHOLDS, CONTEXT_GRANULARITIES, type CallGraph, type CallGraphDirection, type CallGraphNode, type CandidateProposal, CandidateProposalArraySchema, CandidateProposalSchema, CommandProvider, type CommandProviderConfig, CommandProviderError, type ComputeRelevanceScoreOptions, type ContentMode, ContentModeSchema, type ContextEntry, ContextEntrySchema, type ContextGranularity, type ContextMap, type ContextMapCandidate, type ContextMapDirection, type ContextMapEdge, type ContextMapEdgeType, type ContextMapNode, type ContextMapTarget, type ContextMetadata, ContextMetadataSchema, type ContextPack, ContextPackSchema, type ContextRoot, type ContextSection, ContextSectionSchema, DEFAULT_BUDGET_TOKENS, DEFAULT_GLOBAL_EXCLUDE, DEFAULT_MAX_CANDIDATES_PER_RUN, DEFAULT_MAX_SNIPPETS, DEFAULT_MIN_GAP_CONFIDENCE, DEFAULT_SNIPPET_CONTEXT_LINES, DIVERSITY_BONUS, type DependencyGraph, DependencyGraphSchema, type DependencyNode, DependencyNodeSchema, type DetectGapsOptions, EDGE_CLASSIFICATIONS, EDGE_KINDS, EVIDENCE_TYPES, type EdgeClassification, EdgeClassificationSchema, type EdgeKind, EdgeKindSchema, type Evidence, EvidenceSchema, type EvidenceType, EvidenceTypeSchema, type ExternalEdge, ExternalEdgeSchema, type ExternalEvidence, ExternalEvidenceSchema, type ExternalInsight, ExternalInsightSchema, type ExtractTraceElementsOptions, type FileAnalysisMetadata, FileAnalysisMetadataSchema, type FileAnalysisResult, FileAnalysisResultSchema, type FileChangeState, type FileContext, FileContextSchema, type FileEntry, type FileRow, GAP_REASONS, GAP_REASON_CONFIDENCE, type GapCandidate, GapCandidateSchema, type GapDescription, GapDescriptionSchema, type GapReason, GapReasonSchema, type GenerateContextPackOptions, type GetContextMapInput, type GetContextMapOptions, type GraphEdge, GraphEdgeSchema, type GraphNode, GraphNodeSchema, IMPACT_DIRECTIONS, type ImpactDirection, ImpactDirectionSchema, type ImpactNotification, ImpactNotificationSchema, type ImpactReport, ImpactReportSchema, type InsightProvider, type InsightQuery, InsightQuerySchema, type IntegrateInsightResult, type IntegrationResult, type IntegrationStats, type InvalidationAction, type InvalidationActionKind, type InvalidationChanges, type LanguageAnalyzer, type LineRange, type LlmAdapter, type LlmEvidencePoint, LlmEvidencePointSchema, METADATA_RESERVE_FRACTION, NODE_KINDS, type NodeKind, NodeKindSchema, type NormalizedCandidates, OUTPUT_FORMATS, type OutputFormat, PROPAGATION_DIRECTIONS, type ProjectAnalysisInput, type ProjectAnalysisResult, type ProjectAnalyzer, type ProjectContext, type PropagationDirection, PropagationDirectionSchema, type ProviderError, ProviderErrorSchema, RANK_WEIGHTS, RELEVANCE_WEIGHTS, type RankFilesOptions, type RankedFile, type ResolveAffectedArtifactsOptions, type ResolveAllEdgesOptions, type ResolveSpecifierOptions, type ResolveSymbolEdgesInput, type ResolveTraceLinksOptions, type ResolvedTraceLink, ResolvedTraceLinkSchema, type RunProvidersResult, type RunSemanticAnalysisOptions, SCHEMA_DDL, SCHEMA_VERSION, SNIPPET_CONTEXTS, SYMBOL_KINDS, type ScanOptions, type ScanResult, type SelectWithinBudgetOptions, type SelectedFile, type SemanticAnalysisResult, type SemanticAnalyzerOptions, type SerializedAstGraph, SerializedAstGraphSchema, type SerializedGraph, SerializedGraphSchema, type SnippetContext, SnippetContextSchema, type SourceContext, SourceContextSchema, type SourceSnippet, SourceSnippetSchema, type StoreBackend, type StoreHandle, type StoreOptions, type SymbolAnchor, SymbolAnchorSchema, type SymbolInfo, SymbolInfoSchema, type SymbolKind, SymbolKindSchema, TEST_ASSOCIATION_METHODS, type TestAssociation, type TestAssociationMethod, TestAssociationMethodSchema, TestAssociationSchema, type TraceConnection, TraceConnectionSchema, type TraceElement, TraceElementSchema, type TraceabilityReport, TraceabilityReportSchema, type TraverseDownstreamOptions, type TraverseUpstreamOptions, TypeScriptAnalyzer, TypeScriptProjectAnalyzer, UNKNOWN_EVIDENCE_WEIGHT, type UnresolvedEdge, UnresolvedEdgeSchema, type ValidateTraceabilityOptions, type Writer, YamlAnalyzer, analyzeImpact, annotateEdge, annotateEdges, applyProjectResolution, assembleContextPack, assembleSourceContext, bestEvidence, bfs, buildArtifactMapping, buildAstGraph, buildAstGraphFromResults, buildCallGraph, buildDependencyGraph, buildProgram, buildProjectGraph, buildPrompt, checkAnalyzerVersionChanged, checkFileChanged, checkManifestChanged, checkNavigationIndexChanged, computeRelevanceScore, createDefaultRegistry, deleteFile, deserializeAstGraph, deserializeGraph, detectGaps, dfs, estimateTokens, extractSnippets, extractSymbolSections, extractTraceElements, filterByConfidence, generateContextPack, getAllFiles, getChangedFiles, getChangedLineRanges, getContextMap, getFileByPath, getInvalidationPlan, hashContent, hashFile, hashObject, integrateExternalInsights, integrateInsight, integrateInsights, loadCandidateEdges, loadExternalProviders, loadProjectContext, mapChangedLinesToSymbols, mapFileToArtifacts, mergeEvidence, normalizeCandidates, openStore, parseResponse, persistCandidateEdges, rankFiles, resolveAffectedArtifacts, resolveAffectedWorkflows, resolveAllEdges, resolveContextMapSeeds, resolveDiffSeeds, resolveEdgeKind, resolveManifestEdges, resolveSpecifier, resolveSymbolEdges, resolveTraceLinks, run, runProviders, runSemanticAnalysis, scanFiles, selectWithinBudget, serializeAstGraph, serializeDependencyGraph, serializeGraph, transitiveClosure, traverseDownstream, traverseUpstream, upsertFile, upsertMetadata, validateTraceability, writeOutput };