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

query

package
v1.10.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic added in v1.7.3

type Diagnostic struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Diagnostic carries structured warnings or errors without hiding available facts.

type Engine

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

Engine wraps a loaded graph and answers queries against it.

func LoadFromFile

func LoadFromFile(graphPath string) (*Engine, error)

LoadFromFile opens a runtime query graph. Repo-local .vela/graph.json paths locate the sibling v0.4 SQLite runtime store; graph.json remains export/debug context and is not used as query truth.

func (*Engine) Bindings added in v1.4.0

func (e *Engine) Bindings(label string) string

Bindings returns queryable memory reference binder state for the given node.

func (*Engine) DiagnosticResult added in v1.7.3

func (e *Engine) DiagnosticResult(kind, code, message string) Result

DiagnosticResult returns structured adapter diagnostics when a tool cannot run.

func (*Engine) Explain

func (e *Engine) Explain(label string) string

Explain returns all edges where the given node is source or target.

func (*Engine) ExplainResult added in v1.7.3

func (e *Engine) ExplainResult(label string) Result

ExplainResult returns a shared core result for explain answers with proof metadata.

func (*Engine) ExploreResult added in v1.7.3

func (e *Engine) ExploreResult(request string, limit int) Result

ExploreResult returns structured broad-request resolution data for MCP agents.

func (*Engine) FindNode added in v1.5.0

func (e *Engine) FindNode(term string) (types.Node, bool)

FindNode resolves a node by ID, exact label, or fuzzy label match.

func (*Engine) Freshness added in v1.7.3

func (e *Engine) Freshness() Freshness

Freshness reports the runtime graph freshness state attached at load time.

func (*Engine) Graph

func (e *Engine) Graph() *types.Graph

Graph returns the underlying types.Graph (read-only reference).

func (*Engine) ImpactResult added in v1.7.3

func (e *Engine) ImpactResult(subject string, limit int) Result

ImpactResult returns structured reverse-dependency facts for an MCP impact query.

func (*Engine) Lookup added in v1.7.1

func (e *Engine) Lookup(term string, limit int) []LookupCandidate

Lookup returns ranked node candidates for a broad term without pretending to answer a structural graph question directly.

func (*Engine) LookupResult added in v1.7.3

func (e *Engine) LookupResult(term string, limit int) Result

LookupResult returns structured candidate resolution data for MCP agents.

func (*Engine) Neighbors added in v1.5.0

func (e *Engine) Neighbors(label string) ([]Neighbor, error)

Neighbors returns all incoming and outgoing edges for the given node.

func (*Engine) NodeByID

func (e *Engine) NodeByID(id string) (types.Node, bool)

NodeByID returns the node with the given ID string, if it exists.

func (*Engine) Path

func (e *Engine) Path(fromLabel, toLabel string) string

Path finds the shortest directed path from nodeA to nodeB. Returns a human-readable string.

func (*Engine) PathResult added in v1.7.3

func (e *Engine) PathResult(from, to string) Result

PathResult returns structured endpoint and path facts for an MCP path query.

func (*Engine) Query

func (e *Engine) Query(input string) string

Query is a freeform dispatcher: parses "path A B", "explain X", etc.

func (*Engine) RenderExplore added in v1.7.3

func (e *Engine) RenderExplore(request string, limit int) string

RenderExplore resolves broad natural language to candidate graph subjects and cites only graph relationships as proof for the returned context.

func (*Engine) RenderLookup added in v1.7.1

func (e *Engine) RenderLookup(term string, limit int) string

RenderLookup formats ranked candidates with enough metadata to pick an exact subject for follow-up structural graph queries.

func (*Engine) Route added in v1.4.0

func (e *Engine) Route(input string) string

Route reports workspace-layer repo routing for a query.

func (*Engine) RunRequest added in v1.7.1

func (e *Engine) RunRequest(req types.QueryRequest) (string, error)

RunRequest executes the reduced graph-truth query contract used by the new CLI, TUI, server, and MCP surfaces.

func (*Engine) Search added in v1.5.0

func (e *Engine) Search(term string, limit int) []types.Node

Search performs a small lexical ranking over node fields.

func (*Engine) Stats added in v1.5.0

func (e *Engine) Stats() GraphStats

Stats returns a structured graph summary.

func (*Engine) StatusResult added in v1.7.3

func (e *Engine) StatusResult() Result

StatusResult returns structured runtime graph status for adapter responses.

type Fact added in v1.7.3

type Fact struct {
	Subject    string           `json:"subject"`
	Predicate  string           `json:"predicate"`
	Object     string           `json:"object"`
	Evidence   []types.Evidence `json:"evidence,omitempty"`
	Confidence types.Confidence `json:"confidence,omitempty"`
	Source     string           `json:"source,omitempty"`
	Layer      types.Layer      `json:"layer,omitempty"`
	Metadata   map[string]any   `json:"metadata,omitempty"`
}

Fact is a graph-backed claim used by a query answer.

type Freshness added in v1.7.3

type Freshness struct {
	Status             FreshnessStatus `json:"status"`
	StaleFiles         []string        `json:"stale_files,omitempty"`
	RecommendedActions []string        `json:"recommended_actions,omitempty"`
}

Freshness describes whether graph data used by a Result is fresh enough to trust.

type FreshnessStatus added in v1.7.3

type FreshnessStatus string

FreshnessStatus qualifies the runtime graph state used by a result.

const (
	FreshnessUnknown FreshnessStatus = "unknown"
	FreshnessFresh   FreshnessStatus = "fresh"
	FreshnessWarming FreshnessStatus = "warming"
	FreshnessStale   FreshnessStatus = "stale"
)

type GraphStats added in v1.5.0

type GraphStats struct {
	NodeCount       int
	EdgeCount       int
	CommunityCount  int
	NodeTypes       map[string]int
	ConfidenceTypes map[string]int
}

GraphStats summarizes the graph contents for diagnostics and MCP output.

type LookupCandidate added in v1.7.1

type LookupCandidate struct {
	Node  types.Node
	Score int
}

LookupCandidate is a ranked node suggestion for broad discovery queries.

type Neighbor added in v1.5.0

type Neighbor struct {
	Node      types.Node
	Edge      types.Edge
	Direction string
}

Neighbor describes a directly connected node and the edge relating it.

type Result added in v1.7.3

type Result struct {
	SchemaVersion         string           `json:"schema_version"`
	QueryKind             string           `json:"query_kind"`
	Status                ResultStatus     `json:"status"`
	ResolvedSubjects      []Subject        `json:"resolved_subjects,omitempty"`
	Facts                 []Fact           `json:"facts,omitempty"`
	Evidence              []types.Evidence `json:"evidence,omitempty"`
	Confidence            types.Confidence `json:"confidence,omitempty"`
	Freshness             Freshness        `json:"freshness"`
	Diagnostics           []Diagnostic     `json:"diagnostics"`
	Answer                string           `json:"answer,omitempty"`
	RelevantSource        []string         `json:"relevant_source,omitempty"`
	PathsAndRelationships []Fact           `json:"paths_and_relationships,omitempty"`
	ImpactRadius          string           `json:"impact_radius,omitempty"`
	LayeredEvidence       []Fact           `json:"layered_evidence,omitempty"`
	ConfidenceAndLimits   string           `json:"confidence_and_limits,omitempty"`
	SuggestedNextQueries  []string         `json:"suggested_next_queries,omitempty"`
	InterpretedIntent     string           `json:"interpreted_intent,omitempty"`
}

Result is the minimal adapter-independent envelope for graph-backed answers.

type ResultStatus added in v1.7.3

type ResultStatus string

ResultStatus classifies the shared core query result before adapter rendering.

const (
	ResultStatusOK          ResultStatus = "ok"
	ResultStatusPartial     ResultStatus = "partial"
	ResultStatusUnavailable ResultStatus = "unavailable"
	ResultStatusAmbiguous   ResultStatus = "ambiguous"
	ResultStatusUnresolved  ResultStatus = "unresolved"
	ResultStatusError       ResultStatus = "error"
)

type Subject added in v1.7.3

type Subject struct {
	ID    string `json:"id"`
	Label string `json:"label,omitempty"`
	Kind  string `json:"kind,omitempty"`
}

Subject is a resolved graph subject included in a shared Result.

Jump to

Keyboard shortcuts

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