/** * Graph edge emission primitives. * * Two functions: * - `mapReferenceKindToEdgeType` — translate a scope-resolution * `Reference.kind` into the corresponding graph edge type. * - `tryEmitEdge` — given a reference site + target def, resolve * caller + target to graph ids and emit the edge with * language-provided reason text, dedup-keyed by * `(edgeType, callerId, targetId, line, col)`. * * Next-consumer contract: any language provider can call `tryEmitEdge` * from its own post-pass to emit edges it resolves Python-specific * (or TypeScript-specific, etc.) logic. The dedup key is * language-agnostic — no language needs to change it. */ import type { Reference, ScopeId, SymbolDefinition } from '../../../../_shared/index.js'; import type { KnowledgeGraph } from '../../../graph/types.js'; import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js'; import type { GraphNodeLookup } from '../graph-bridge/node-lookup.js'; /** * Map a `Reference.kind` to a graph edge type. `import-use` is dropped * (no edge type today — provenance lives on the IMPORTS edge emitted * by `emitImportEdges`). */ export declare function mapReferenceKindToEdgeType(kind: Reference['kind']): 'CALLS' | 'ACCESSES' | 'EXTENDS' | 'USES' | undefined; /** * Resolve caller + target to graph ids and emit the edge. Returns true * if the edge was emitted (not deduped, not skipped). * * `seen` is a language-shared dedup set keyed by * `${edgeType}:${callerGraphId}->${targetGraphId}:${line}:${col}` so * multiple language-specific post-passes can share it and never * double-emit a resolution one of them already produced. */ export declare function tryEmitEdge(graph: KnowledgeGraph, scopes: ScopeResolutionIndexes, nodeLookup: GraphNodeLookup, site: { readonly inScope: ScopeId; readonly atRange: { startLine: number; startCol: number; }; readonly kind: string; }, targetDef: SymbolDefinition, reason: string, seen: Set, confidence?: number, collapseByCallerTarget?: boolean): boolean; /** * Variant of `tryEmitEdge` that takes a pre-resolved target graph id * instead of resolving it from a `SymbolDefinition`. Used by the * value-receiver-owner bridge (`receiver-bound-calls.ts` Case 5) where * the picked owner-indexed method def carries no `qualifiedName` (object * literals have no class owner to seed it) and therefore cannot * round-trip through `resolveDefGraphId`. The def's `nodeId` IS the * canonical graph node id (written by the parse phase), so the caller * passes it directly. * * All other invariants of `tryEmitEdge` apply: dedup key shape, collapse * flag honoring, edge-type mapping, caller-id resolution. */ export declare function tryEmitEdgeWithExplicitTargetId(graph: KnowledgeGraph, scopes: ScopeResolutionIndexes, nodeLookup: GraphNodeLookup, site: { readonly inScope: ScopeId; readonly atRange: { startLine: number; startCol: number; }; readonly kind: string; }, targetGraphId: string, reason: string, seen: Set, confidence?: number, collapseByCallerTarget?: boolean): boolean;