Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LLM        LLMConfig        `yaml:"llm"`
	Extraction ExtractionConfig `yaml:"extraction"`
	UI         UIConfig         `yaml:"ui"`
	Watch      WatchConfig      `yaml:"watch"`
	Daemon     DaemonConfig     `yaml:"daemon"`
	Obsidian   ObsidianConfig   `yaml:"obsidian"`
}

Config is the global configuration for Vela

type DaemonConfig

type DaemonConfig struct {
	PIDFile    string `yaml:"pid_file"`
	LogFile    string `yaml:"log_file"`
	LogLevel   string `yaml:"log_level"`
	StatusFile string `yaml:"status_file"`
}

DaemonConfig configures the background daemon process.

type DaemonSourceStatus

type DaemonSourceStatus struct {
	Connected  bool  `json:"connected"`
	EventCount int64 `json:"event_count"`
}

DaemonSourceStatus holds per-source connectivity info written to the status file.

type DaemonStatus

type DaemonStatus struct {
	PID       int                           `json:"pid"`
	Sources   map[string]DaemonSourceStatus `json:"sources"` // name -> status
	UpdatedAt string                        `json:"updated_at"`
}

DaemonStatus is written by the daemon to StatusFile so the CLI can read source connectivity without cross-process registry access.

type Edge

type Edge struct {
	Source     string                 `json:"source"`
	Target     string                 `json:"target"`
	Relation   string                 `json:"relation"`        // calls, imports, uses, describes, etc.
	Confidence string                 `json:"confidence"`      // EXTRACTED, INFERRED, AMBIGUOUS
	Score      float64                `json:"score,omitempty"` // 0.0-1.0
	SourceFile string                 `json:"source_file,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

Edge represents a relationship between two nodes

type EdgeType

type EdgeType string

EdgeType is a discriminated string for graph relationships.

const (
	// Code-derived edge types (existing conventions)
	EdgeTypeCalls      EdgeType = "calls"
	EdgeTypeImports    EdgeType = "imports"
	EdgeTypeImplements EdgeType = "implements"

	// Knowledge edge types (Ancora integration)
	EdgeTypeReferences EdgeType = "references" // obs -> file/function
	EdgeTypeRelatedTo  EdgeType = "related_to" // obs -> obs
	EdgeTypeDefines    EdgeType = "defines"    // obs -> concept
	EdgeTypeBelongsTo  EdgeType = "belongs_to" // obs -> concept
)

type ExtractionConfig

type ExtractionConfig struct {
	CodeLanguages []string `yaml:"code_languages"`
	IncludeDocs   bool     `yaml:"include_docs"`
	IncludeImages bool     `yaml:"include_images"`
	ChunkSize     int      `yaml:"chunk_size"` // tokens
	CacheDir      string   `yaml:"cache_dir"`
}

ExtractionConfig holds configuration for extraction behavior

type ExtractionProgress

type ExtractionProgress struct {
	TotalFiles      int
	ProcessedFiles  int
	TotalChunks     int
	ProcessedChunks int
	CurrentFile     string
	CurrentChunk    int
	StartTime       time.Time
	LastUpdateTime  time.Time
}

ExtractionProgress tracks the progress of document extraction

func (*ExtractionProgress) ElapsedSeconds

func (p *ExtractionProgress) ElapsedSeconds() int

ElapsedSeconds returns seconds since extraction started

func (*ExtractionProgress) EstimatedRemainingSeconds

func (p *ExtractionProgress) EstimatedRemainingSeconds() int

EstimatedRemainingSeconds returns estimated remaining time in seconds

func (*ExtractionProgress) EstimatedTotalSeconds

func (p *ExtractionProgress) EstimatedTotalSeconds() int

EstimatedTotalSeconds returns the estimated total time in seconds

func (*ExtractionProgress) Percentage

func (p *ExtractionProgress) Percentage() int

Percentage returns the extraction progress as a percentage (0-100)

type ExtractionResult

type ExtractionResult struct {
	Nodes []Node `json:"nodes"`
	Edges []Edge `json:"edges"`
}

ExtractionResult is returned by extractors (code, doc, pdf)

type ExtractorConfig

type ExtractorConfig struct {
	Enabled   bool   `yaml:"enabled"`
	Workers   int    `yaml:"workers"`
	WriteBack bool   `yaml:"write_back"`
	Provider  string `yaml:"provider"`
	Model     string `yaml:"model"`
}

ExtractorConfig controls LLM-based reference extraction.

type Graph

type Graph struct {
	Nodes       []Node                 `json:"nodes"`
	Edges       []Edge                 `json:"edges"`
	Communities map[int][]string       `json:"communities"`
	Metadata    map[string]interface{} `json:"metadata"`
	ExtractedAt time.Time              `json:"extracted_at"`
}

Graph represents the complete knowledge graph

type LLMConfig

type LLMConfig struct {
	Provider       string        `yaml:"provider"` // local, anthropic, openai
	Model          string        `yaml:"model"`
	Endpoint       string        `yaml:"endpoint"` // for local providers
	APIKey         string        `yaml:"api_key"`  // for remote providers
	Timeout        time.Duration `yaml:"timeout"`
	MaxChunkTokens int           `yaml:"max_chunk_tokens"`
}

LLMConfig holds configuration for LLM providers

type LLMProvider

type LLMProvider interface {
	// ExtractGraph sends text to the LLM and requests structured graph extraction
	ExtractGraph(ctx context.Context, text string, schema string) (*ExtractionResult, error)

	// Health checks if the LLM provider is accessible
	Health(ctx context.Context) error

	// Name returns the provider name for logging
	Name() string
}

LLMProvider defines the interface for pluggable LLM backends

type Node

type Node struct {
	ID             string                 `json:"id"`
	Label          string                 `json:"label"`
	NodeType       string                 `json:"type"` // function, class, concept, file, etc.
	SourceFile     string                 `json:"source_file,omitempty"`
	SourceLocation string                 `json:"source_location,omitempty"` // L42:C5
	Community      int                    `json:"community,omitempty"`
	Degree         int                    `json:"degree,omitempty"`
	Description    string                 `json:"description,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
	// Source identifies where this node came from (codebase, memory, webhook).
	// Nodes from the same extraction share the same Source.
	Source *Source `json:"source,omitempty"`
}

Node represents a concept, class, function, or entity in the knowledge graph

type NodeType

type NodeType string

NodeType is a discriminated string for all node varieties in the graph.

const (
	// Code-derived node types (existing conventions)
	NodeTypeFunction  NodeType = "function"
	NodeTypeStruct    NodeType = "struct"
	NodeTypeInterface NodeType = "interface"
	NodeTypeFile      NodeType = "file"
	NodeTypePackage   NodeType = "package"

	// Knowledge node types (Ancora integration)
	NodeTypeObservation  NodeType = "observation"
	NodeTypeConcept      NodeType = "concept"
	NodeTypeWorkspace    NodeType = "workspace"
	NodeTypeVisibility   NodeType = "visibility"
	NodeTypeOrganization NodeType = "organization"
)
const NodeTypeMemorySource NodeType = "memory_source"

NodeTypeMemorySource is the root node for all ancora memory.

const NodeTypeProject NodeType = "project"

NodeTypeProject is the root node for a codebase extraction.

type ObsReference

type ObsReference struct {
	// Type is one of: "file", "observation", "concept", "function"
	Type string `json:"type"`
	// Target is the referenced artifact (path, ID, name, etc.)
	Target string `json:"target"`
}

ObsReference describes a relationship from an observation to another artifact. It mirrors the wire format used by Ancora but lives in the Vela type system.

type ObservationNode

type ObservationNode struct {
	// ID is the Vela node ID — "ancora:obs:<ancoraID>"
	ID       string
	NodeType NodeType
	// AncoraID is the original Ancora observation primary key.
	AncoraID int64
	Title    string
	Content  string
	// ObsType is the Ancora observation category: "decision", "bugfix", etc.
	ObsType    string
	Workspace  string
	References []ObsReference
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

ObservationNode represents an Ancora memory observation as a graph node.

func (*ObservationNode) ToNode

func (o *ObservationNode) ToNode() Node

ToNode converts an ObservationNode to a generic types.Node for graph storage.

type ObsidianConfig

type ObsidianConfig struct {
	AutoSync bool   `yaml:"auto_sync"`
	VaultDir string `yaml:"vault_dir"` // e.g. "vela-out"
}

ObsidianConfig controls automatic Obsidian vault sync. When AutoSync is true the daemon writes the vault after every successful reconcile. VaultDir is the OUTPUT directory — Vela writes into <VaultDir>/obsidian/ mirroring the manual `vela extract` layout.

type ProgressUpdate

type ProgressUpdate struct {
	Progress         ExtractionProgress
	Error            error
	IsComplete       bool
	EstimatedSeconds int
}

ProgressUpdate is sent on a channel to update UI with extraction progress

type ReconcilerConfig

type ReconcilerConfig struct {
	DebounceMs   int `yaml:"debounce_ms"`
	MaxBatchSize int `yaml:"max_batch_size"`
}

ReconcilerConfig controls event batching behaviour.

type Source

type Source struct {
	// Type discriminates the source category.
	Type SourceType `json:"type"`
	// Name is the project/repo name (e.g., "vela", "glim", "ancora").
	Name string `json:"name"`
	// Path is the local filesystem path (codebase only).
	Path string `json:"path,omitempty"`
	// Remote is the git remote URL if detected (codebase only).
	Remote string `json:"remote,omitempty"`
}

Source describes where a node or extraction result originated. For codebases: detected from git remote or folder name. For memory: always "ancora" with workspace/visibility metadata on nodes.

type SourceType

type SourceType string

SourceType discriminates knowledge sources.

const (
	// SourceTypeCodebase is a local or git-tracked codebase (files, functions, deps).
	SourceTypeCodebase SourceType = "codebase"
	// SourceTypeMemory is Ancora persistent memory (observations, decisions).
	SourceTypeMemory SourceType = "memory"
	// SourceTypeWebhook is external event sources (future: Jira, GitHub, etc.).
	SourceTypeWebhook SourceType = "webhook"
)

type UIConfig

type UIConfig struct {
	Theme        string `yaml:"theme"`
	ShowProgress bool   `yaml:"show_progress"`
	EnableColors bool   `yaml:"enable_colors"`
}

UIConfig holds configuration for TUI behavior

type WatchConfig

type WatchConfig struct {
	Enabled    bool                `yaml:"enabled"`
	Sources    []WatchSourceConfig `yaml:"sources"`
	Reconciler ReconcilerConfig    `yaml:"reconciler"`
	Extractor  ExtractorConfig     `yaml:"extractor"`
}

WatchConfig is the top-level daemon watch configuration.

type WatchSourceConfig

type WatchSourceConfig struct {
	Name   string `yaml:"name"`
	Type   string `yaml:"type"`   // "syfra" | "webhook"
	Socket string `yaml:"socket"` // path for syfra sources
}

WatchSourceConfig configures a single event source for the daemon.

Jump to

Keyboard shortcuts

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