/** * NEXUS plasticity queries (T1013 · fills wiring gap from T998 + T1006). * * Read-only queries over the plasticity columns (`weight`, `last_accessed_at`, * `co_accessed_count`) — added by T998 and partitioned by T11545 (ADR-090 §5.3) * into the sibling `nexus_relation_weights` table (1:1 on `relation_id`). These * queries JOIN that table back onto `nexus_relations`. * * - `getHotPaths` — top-N relations by weight (strongest paths). * - `getHotNodes` — top-N source symbols aggregated by weight (busiest hubs). * - `getColdSymbols`— symbols whose last_accessed_at is older than a threshold * (or never accessed) — prune / archive candidates. * * Empty-state semantics: all three return `{ count, note? }` envelopes with * the payload array under `paths` / `nodes` / `symbols`. They never throw on * missing DB — callers in the CLI layer return a LAFS envelope either way. * * The CLI in `packages/cleo/src/cli/commands/nexus.ts` depends on the exact * field names below: `paths[]`, `nodes[]`, `symbols[]`, `count`, `note`. */ import { type EngineResult } from '../engine-result.js'; /** One row in the hot-paths result. */ export interface NexusHotPath { sourceId: string; targetId: string; type: string; weight: number; lastAccessedAt: string | null; coAccessedCount: number; } /** One row in the hot-nodes result. */ export interface NexusHotNode { /** Canonical node id (matches `nexus_nodes.id`). T1108 field. */ nodeId: string; /** Backward-compatible alias of {@link nodeId}. Retained for pre-T1108 callers. */ sourceId: string; label: string; filePath: string | null; kind: string; totalWeight: number; pathCount: number; } /** One row in the cold-symbols result. */ export interface NexusColdSymbol { /** Canonical node id (matches `nexus_nodes.id`). T1108 field. */ nodeId: string; /** Backward-compatible alias of {@link nodeId}. */ sourceId: string; label: string; filePath: string | null; kind: string; lastAccessedAt: string | null; /** Alias of {@link lastAccessedAt} — CLI renderer convenience. */ lastAccessed: string | null; ageDays: number | null; pathCount: number; /** Maximum relation weight on any outgoing edge — ranks cold-but-still-valuable symbols. */ maxWeight: number; } /** Generic plasticity result envelope. Property name varies by query. */ export interface NexusHotPathsResult { paths: NexusHotPath[]; count: number; note?: string; } export interface NexusHotNodesResult { nodes: NexusHotNode[]; count: number; note?: string; } export interface NexusColdSymbolsResult { symbols: NexusColdSymbol[]; count: number; /** The `thresholdDays` input echoed back for caller convenience. T1108 field. */ thresholdDays: number; note?: string; } /** * Generic plasticity result (backward-compatible alias). * Kept for consumers that prefer a generic wrapper over the three concrete types. */ export type NexusPlasticityResult = { paths: T[]; count: number; note?: string; } | { nodes: T[]; count: number; note?: string; } | { symbols: T[]; count: number; note?: string; }; /** * Return the top-N strongest relations by `weight` DESC. * Uses the plasticity columns added in T998. */ export declare function getHotPaths(_projectRoot: string, limit?: number): Promise; /** * Return the top-N source symbols by aggregated `weight`. * Joins nexus_nodes for label / filePath / kind so the CLI can render a * human-readable table without a second query. */ export declare function getHotNodes(_projectRoot: string, limit?: number): Promise; /** * Return symbols that haven't been accessed in `thresholdDays` (or never). * Joins nexus_nodes for label / filePath / kind. Capped at 500 rows so large * neglected graphs don't flood stdout. */ export declare function getColdSymbols(_projectRoot: string, thresholdDays?: number): Promise; export declare function nexusHotPaths(projectRoot: string, limit: number): Promise>; export declare function nexusHotNodes(projectRoot: string, limit: number): Promise>; export declare function nexusColdSymbols(projectRoot: string, thresholdDays: number): Promise>; //# sourceMappingURL=plasticity-queries.d.ts.map