index

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion = 7
	DBFileName    = "index.sqlite"
)

Variables

This section is empty.

Functions

func Exists

func Exists(metadataDir string) (bool, error)

func Invalidate

func Invalidate(metadataDir string) error

Invalidate removes derived index state. It is safe because the index can be rebuilt entirely from durable event, checkpoint, and adapter records.

func SummarizeTurnEvents

func SummarizeTurnEvents(events []eventlog.Event) map[uint64]TurnEventSummary

func SummarizeTurnEventsByStream

func SummarizeTurnEventsByStream(events []eventlog.Event) map[StreamTurnKey]TurnEventSummary

Types

type BlameCacheEntry

type BlameCacheEntry struct {
	Line   int
	Text   string
	Origin BlameCacheOrigin
}

type BlameCacheOrigin

type BlameCacheOrigin struct {
	Kind            string
	SessionID       primitives.SessionID
	TurnID          primitives.TurnID
	CheckpointRef   primitives.CheckpointRef
	Commit          primitives.CommitSHA
	Time            time.Time
	Adapter         string
	Prompt          string
	ToolNames       []string
	ActionTool      string
	ActionAgentID   string
	ActionAgentType string
	Intent          *provenance.Attribution
}

type BlameCacheQuery

type BlameCacheQuery struct {
	ScopeSession  primitives.SessionID
	Path          primitives.RepoPath
	HistoryKey    string
	LatestRef     primitives.CheckpointRef
	LatestCommit  primitives.CommitSHA
	CompleteTurns int
	Line          int
}

type BlameCacheSnapshot

type BlameCacheSnapshot struct {
	ScopeSession  primitives.SessionID
	Path          primitives.RepoPath
	HistoryKey    string
	LatestRef     primitives.CheckpointRef
	LatestCommit  primitives.CommitSHA
	LatestTime    time.Time
	CompleteTurns int
	LineCount     int
	Entries       []BlameCacheEntry
	Warnings      []string
}

type GraphQuery

type GraphQuery struct {
	Session    primitives.SessionID
	WorktreeID primitives.WorktreeID
	Limit      int
}

type GraphSession

type GraphSession struct {
	ID         primitives.SessionID
	Turns      []GraphTurn
	TotalTurns int
	Warnings   []string
}

type GraphTurn

type GraphTurn struct {
	WorktreeID primitives.WorktreeID
	StreamID   primitives.EventStreamID
	TurnID     primitives.TurnID
	Pre        *checkpoint.CheckpointRefInfo
	Post       *checkpoint.CheckpointRefInfo
	Diff       checkpoint.DiffSummary
	DiffLoaded bool
	Events     TurnEventSummary
	Warnings   []string
}

type Paths

type Paths struct {
	Dir    string
	DBPath string
}

func PathsForMetadata

func PathsForMetadata(metadataDir string) Paths

type RebuildStats

type RebuildStats struct {
	DBPath            string
	Sessions          int
	Turns             int
	Events            int
	Checkpoints       int
	FileTouches       int
	SearchDocuments   int
	SourceFingerprint string
}

func Rebuild

func Rebuild(repo *checkpoint.Repo) (RebuildStats, error)

type SearchQuery

type SearchQuery struct {
	Query      string
	Session    primitives.SessionID
	WorktreeID primitives.WorktreeID
	Limit      int
}

type SearchResult

type SearchResult struct {
	SessionID  primitives.SessionID     `json:"session_id"`
	WorktreeID primitives.WorktreeID    `json:"worktree_id,omitempty"`
	StreamID   primitives.EventStreamID `json:"stream_id,omitempty"`
	TurnID     primitives.TurnID        `json:"turn_id"`
	First      time.Time                `json:"first,omitempty"`
	Last       time.Time                `json:"last,omitempty"`
	Adapter    string                   `json:"adapter,omitempty"`
	Model      string                   `json:"model,omitempty"`
	Prompt     string                   `json:"prompt,omitempty"`
	Assistant  string                   `json:"assistant,omitempty"`
	ToolNames  []string                 `json:"tool_names,omitempty"`
	Paths      []string                 `json:"paths,omitempty"`
	Snippet    string                   `json:"snippet,omitempty"`
	Rank       float64                  `json:"rank"`
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(metadataDir string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Healthy

func (s *Store) Healthy() (bool, error)

func (*Store) LoadBlameCache

func (s *Store) LoadBlameCache(query BlameCacheQuery) (BlameCacheSnapshot, bool, error)

func (*Store) LoadGraph

func (s *Store) LoadGraph(query GraphQuery) ([]GraphSession, error)

func (*Store) SaveBlameCache

func (s *Store) SaveBlameCache(snapshot BlameCacheSnapshot) error

func (*Store) Search

func (s *Store) Search(query SearchQuery) ([]SearchResult, error)

func (*Store) StructurallyHealthy

func (s *Store) StructurallyHealthy() (bool, error)

StructurallyHealthy reports whether the derived database is internally usable and schema-compatible. Freshness is deliberately separate: a new durable event makes an index stale, but does not indicate corruption.

type StreamTurnKey

type StreamTurnKey struct {
	StreamID primitives.EventStreamID
	TurnID   uint64
}

type TurnEventSummary

type TurnEventSummary struct {
	Count      int
	Adapter    string
	Model      string
	Prompt     string
	Assistant  string
	ToolNames  []string
	TypeCounts map[primitives.EventType]int
	First      time.Time
	Last       time.Time
}

Jump to

Keyboard shortcuts

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