index

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package index construye el árbol de índice de nem (estilo PageIndex): una tabla de contenidos jerárquica (project → chat → commit) que el agente navega y razona, sin embeddings. Los commits aportan su resumen gratis (el mensaje escrito por el agente); los chats crudos se resumen heurísticamente (o con un summarizer pluggable inyectado en fases posteriores).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeuristicSummary

func HeuristicSummary(chat db.Chat, firstMsgs []db.Message) string

HeuristicSummary arma un resumen barato (sin LLM): el primer mensaje de usuario (la tarea/tema), con fallback al primer mensaje disponible.

Types

type Builder

type Builder interface {
	// Build reconstruye el árbol completo (borra y regenera). Idempotente.
	Build() (*Report, error)
}

Builder construye/refresca el árbol de índice.

func New

func New(store db.Store, options ...Option) (Builder, error)

New crea un Builder sobre el store dado.

type Option

type Option func(*config) error

Option configura al Builder.

func WithEmbedder

func WithEmbedder(e embed.Embedder) Option

WithEmbedder activa la capa de embeddings: tras construir el árbol, embebe los resúmenes de los nodos y los guarda. Si el backend falla, el índice igual se construye (los embeddings simplemente no se generan).

func WithProgress

func WithProgress(fn ProgressFunc) Option

WithProgress recibe callbacks de avance (para mostrar "N/total" en el CLI).

func WithSummarizer

func WithSummarizer(s summarize.Summarizer) Option

WithSummarizer usa un Summarizer con LLM (Ollama/API) para los resúmenes de chat, con fallback al heurístico si el backend falla o devuelve vacío.

func WithSummaryFunc

func WithSummaryFunc(fn SummaryFunc) Option

WithSummaryFunc reemplaza el resumidor de chats (default: heurístico).

type ProgressFunc

type ProgressFunc func(stage string, done, total int)

ProgressFunc recibe el avance de Build (stage = "summarize" | "embed").

type Report

type Report struct {
	Projects int
	Chats    int
	Commits  int
	Nodes    int
	Embedded int
}

Report resume una corrida de Build.

type SummaryFunc

type SummaryFunc func(chat db.Chat, firstMsgs []db.Message) string

SummaryFunc produce el resumen de un chat a partir de sus primeros mensajes. Se inyecta para permitir backends (heurístico por defecto; Ollama/API luego).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL