Documentation
¶
Index ¶
- func Build(_ context.Context, idx *codeindex.Index, focus Focus, opts Options) (string, error)
- func ExtractMentionedIdents(messages []ai.Message, symbolNames map[string]bool) map[string]bool
- func PageRank(nodes []string, edges []WeightedEdge, personalization map[string]float64) map[string]float64
- func RenderBudgeted(items []RenderItem, maxTokens int) string
- func SelectSymbolsForFile(idx *codeindex.Index, file string, focus Focus, capPerFile int) []*codeindex.Symbol
- type Cache
- type Focus
- type Options
- type RenderItem
- type WeightedEdge
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build assembles a token-budgeted repo map for the agent's system prompt. Returns "" (no error) when the index is nil/empty, when budget is 0, or when no edges resolve. Never fails a turn.
func ExtractMentionedIdents ¶
ExtractMentionedIdents scans message text for identifier-shaped tokens, filters stopwords, and keeps only those present in symbolNames.
func PageRank ¶
func PageRank(nodes []string, edges []WeightedEdge, personalization map[string]float64) map[string]float64
PageRank runs personalized PageRank over nodes and weighted directed edges. personalization may be nil (uniform). Returns nil for empty input.
func RenderBudgeted ¶
func RenderBudgeted(items []RenderItem, maxTokens int) string
RenderBudgeted renders the largest prefix of items that fits in maxTokens. Symbols are grouped by file in input order; within a group, symbols are rendered in their original priority order (caller decides).
func SelectSymbolsForFile ¶
func SelectSymbolsForFile(idx *codeindex.Index, file string, focus Focus, capPerFile int) []*codeindex.Symbol
SelectSymbolsForFile picks up to capPerFile symbols from a single file, always including any whose name is in focus.MentionedIdents, then padding with the most-referenced symbols by in-degree. The file argument is an absolute path (as emitted by ProjectFileGraph).
Types ¶
type Focus ¶
Focus is the per-turn signal fed into ranking. InFocusFiles biases the PageRank personalization vector; MentionedIdents boosts edge weights and per-file symbol selection.
type RenderItem ¶
RenderItem is a (file, symbol) pair to render. Order matters: callers pass items in priority order; RenderBudgeted binary-searches the prefix that fits.
type WeightedEdge ¶
func ProjectFileGraph ¶
func ProjectFileGraph(idx *codeindex.Index, focus Focus) ([]string, []WeightedEdge)
ProjectFileGraph collapses the symbol graph into a file-to-file graph suitable for PageRank. Each resolved cross-file call/reference becomes a weighted edge from referencer file to definer file, with weights derived from Aider's repomap heuristics (see spec section "Edge weighting"). All node and edge endpoint paths are absolute (joined against idx.Root).