graphservice

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRepositoryNotFound        = errors.New("repository_not_found")
	ErrRepositoryRequired        = errors.New("repository_required")
	ErrInvalidRepositorySelector = errors.New("invalid_repository_selector")
	ErrBranchNotIndexed          = errors.New("branch_not_indexed")
	// ErrNotIndexed means the repository has no indexed commit yet, so no graph
	// can exist for it; indexing must finish first.
	ErrNotIndexed = errors.New("repository_not_indexed")
	// ErrGraphNotReady means the graph state GraphNest holds for the request is
	// inconsistent: facts outside the authorized scope, generation metadata
	// that does not match the selected commit, or a backend without graph
	// support. Retrying does not help by itself.
	ErrGraphNotReady = errors.New("graph_not_ready")
)
View Source
var (
	ErrInvalidRequest = errors.New("invalid_graph_request")
)

Functions

This section is empty.

Types

type AffectedTestsRequest

type AffectedTestsRequest struct {
	Repo         api.GraphRepositorySelector
	Branch       string
	ChangedFiles []string
	MaxDepth     int
	TestGlob     string
	Limit        int
}

type AggregateFilesRequest

type AggregateFilesRequest struct {
	AggregateScopeRequest
	Paths []string
}

type AggregateLimitRequest

type AggregateLimitRequest struct {
	AggregateScopeRequest
	Limit int
}

type AggregateModuleRequest

type AggregateModuleRequest struct {
	AggregateScopeRequest
	Assignments     []graphprotocol.ModuleAssignment
	Kinds           []string
	MinConfidence   float64
	TopPairsPerLink int
	PairKinds       []string
}

type AggregateNodeRequest

type AggregateNodeRequest struct {
	AggregateScopeRequest
	Occurrence string
}

type AggregateScopeRequest

type AggregateScopeRequest struct {
	Repo   api.GraphRepositorySelector
	Branch string
}

type AggregateUnresolvedRequest

type AggregateUnresolvedRequest struct {
	AggregateScopeRequest
	Occurrence, Path string
	Limit            *int
}

type AggregateValuesRequest

type AggregateValuesRequest struct {
	AggregateScopeRequest
	Values []string
}

type AppliedBuildTaskContextOptions

type AppliedBuildTaskContextOptions struct {
	graphprotocol.AppliedRelevantContextOptions
	MaxCodeBlocks    int  `json:"max_code_blocks"`
	MaxCodeBlockSize int  `json:"max_code_block_size"`
	IncludeCode      bool `json:"include_code"`
}

type BuildTaskContextOptions

type BuildTaskContextOptions struct {
	SearchLimit      *int     `json:"search_limit,omitempty"`
	TraversalDepth   *int     `json:"traversal_depth,omitempty"`
	MaxNodes         *int     `json:"max_nodes,omitempty"`
	MinScore         *float64 `json:"min_score,omitempty"`
	MaxCodeBlocks    *int     `json:"max_code_blocks,omitempty"`
	MaxCodeBlockSize *int     `json:"max_code_block_size,omitempty"`
	IncludeCode      *bool    `json:"include_code,omitempty"`
}

type BuildTaskContextRequest

type BuildTaskContextRequest struct {
	Repo        api.GraphRepositorySelector
	Branch      string
	Query       string
	Title       string
	Description string
	Options     BuildTaskContextOptions
}

type CapabilitiesResponse added in v0.5.0

type CapabilitiesResponse struct {
	Version                int                       `json:"version"`
	QueryArtifactVersions  []int                     `json:"query_artifact_versions"`
	UploadArtifactVersions []int                     `json:"upload_artifact_versions"`
	Workflows              []CapabilityWorkflow      `json:"workflows"`
	Status                 string                    `json:"status"`
	Freshness              string                    `json:"freshness"`
	RepositoryID           int64                     `json:"repository_id"`
	Repository             string                    `json:"repository"`
	Branch                 string                    `json:"branch"`
	CurrentIndexedCommit   string                    `json:"current_indexed_commit"`
	Generation             *graphprotocol.Generation `json:"generation"`
	ProducerCapabilities   []string                  `json:"producer_capabilities"`
	DiscoveryProjection    bool                      `json:"discovery_projection"`
	DiscoveryCoverage      string                    `json:"discovery_coverage"`
}

type CapabilityWorkflow added in v0.5.0

type CapabilityWorkflow struct {
	Name            string `json:"name"`
	ArtifactVersion int    `json:"artifact_version"`
}

type ContentReader

type ContentReader interface {
	ReadFileAt(context.Context, authn.Principal, api.ReadFileRequest, string) (api.ReadFileResponse, error)
}

type EntityAnalysisRequest

type EntityAnalysisRequest struct {
	AggregateScopeRequest
	Occurrence string
	MaxDepth   *int
}

type EntityFileRequest

type EntityFileRequest struct {
	AggregateScopeRequest
	Path string
}

type ExploreConfig

type ExploreConfig struct {
	graphprotocol.DiscoveryConfig
	LineNumbers *bool `json:"line_numbers,omitempty"`
	Adaptive    *bool `json:"adaptive,omitempty"`
	Dedup       *bool `json:"dedup,omitempty"`
}

type ExploreFile

type ExploreFile struct {
	Path        string                 `json:"path"`
	Fact        *graphv2.File          `json:"fact,omitempty"`
	Entities    []graphprotocol.Entity `json:"entities"`
	Pinned      bool                   `json:"pinned"`
	Required    bool                   `json:"required"`
	Score       float64                `json:"score"`
	Reservation int                    `json:"reservation_utf16_units"`
	Status      string                 `json:"status"`
	Mode        string                 `json:"mode"`
	Segments    []InspectionSource     `json:"segments"`
	References  []InspectionSource     `json:"references,omitempty"`
	Selections  []ExploreSelection     `json:"selections"`
	Boundaries  []string               `json:"boundaries,omitempty"`
}

type ExploreRequest

type ExploreRequest struct {
	Repo                                                      api.GraphRepositorySelector
	Branch, Query, SessionID                                  string
	Symbols, Files, RequiredOccurrences                       []string
	Limit, CandidateLimit, MaxFiles, SourceUnits, SourceBytes int
	Config                                                    ExploreConfig
}

type ExploreResponse

type ExploreResponse struct {
	Discovery        graphprotocol.DiscoverResponse   `json:"discovery"`
	Files            []ExploreFile                    `json:"files"`
	Relationships    []graphprotocol.TraverseResponse `json:"relationships"`
	Generations      []graphprotocol.Generation       `json:"generations"`
	CorpusFiles      int64                            `json:"corpus_files"`
	LineNumbers      bool                             `json:"line_numbers"`
	Complete         bool                             `json:"complete"`
	Boundaries       []string                         `json:"boundaries,omitempty"`
	Handoffs         []string                         `json:"handoffs,omitempty"`
	Usage            ExploreUsage                     `json:"usage"`
	SourceUnitsLimit int                              `json:"source_utf16_units_limit"`
	SourceBytesLimit int                              `json:"source_bytes_limit"`
	FileLimit        int                              `json:"file_limit"`
	SessionRestored  bool                             `json:"session_restored,omitempty"`
}

type ExploreSelection

type ExploreSelection struct {
	EntityID  string            `json:"entity_id"`
	Range     *graphv2.Location `json:"range,omitempty"`
	Segment   int               `json:"segment"`
	Reference *int              `json:"reference,omitempty"`
	Selection *SourceSelection  `json:"selection,omitempty"`
	Status    string            `json:"status"`
}

type ExploreUsage

type ExploreUsage struct {
	SourceReads     int `json:"source_reads"`
	SourceBytes     int `json:"source_bytes"`
	SourceUnits     int `json:"source_utf16_units"`
	GraphQueries    int `json:"graph_queries"`
	DedupSavedUnits int `json:"dedup_saved_utf16_units,omitempty"`
}

type FileClassificationsRequest

type FileClassificationsRequest struct {
	Repo   api.GraphRepositorySelector
	Branch string
	Paths  []string
}

type FileDependencyRequest

type FileDependencyRequest struct {
	Repo          api.GraphRepositorySelector
	Branch        string
	Paths         []string
	MinConfidence float64
	Limit         int
}

type FileInventoryRequest

type FileInventoryRequest struct {
	Repo                                  api.GraphRepositorySelector
	Branch, Path, Pattern, Format, Cursor string
	Limit                                 int
	MaxDepth                              *int
	IncludeMetadata                       *bool
}

type FileInventoryResponse

type FileInventoryResponse struct {
	Format      string                     `json:"format"`
	Files       []InventoryFile            `json:"files,omitempty"`
	Tree        []*InventoryTree           `json:"tree,omitempty"`
	Groups      []InventoryGroup           `json:"groups,omitempty"`
	Generations []graphprotocol.Generation `json:"generations"`
	NextCursor  string                     `json:"next_cursor,omitempty"`
	// TotalFiles counts the entire filtered immutable inventory. The projection
	// and group sizes describe only this page; depth can hide additional leaves.
	TotalFiles   int64    `json:"total_files"`
	PageFiles    int      `json:"page_files"`
	VisibleFiles int      `json:"visible_files"`
	Complete     bool     `json:"complete"`
	Boundaries   []string `json:"boundaries,omitempty"`
}

type FilteredSubgraphRequest

type FilteredSubgraphRequest struct {
	AggregateScopeRequest
	Filter       graphprotocol.EntityFilter
	IncludeEdges *bool
}

type FindRelevantContextRequest

type FindRelevantContextRequest struct {
	Repo    api.GraphRepositorySelector
	Branch  string
	Query   string
	Options graphprotocol.RelevantContextOptions
}

type GeneratedFileCountRequest

type GeneratedFileCountRequest struct {
	Repo   api.GraphRepositorySelector
	Branch string
}

type InspectEntityRequest

type InspectEntityRequest struct {
	Repo        api.GraphRepositorySelector
	Branch      string
	Selector    graphprotocol.EntitySelector
	OmitSource  bool
	SourceBytes int
	Limit       int
	Cursor      string
}

type InspectFileRequest

type InspectFileRequest struct {
	Repo                                   api.GraphRepositorySelector
	Branch, Path, Cursor                   string
	Limit, StartLine, EndLine, SourceBytes int
	OmitSource                             bool
}

type InspectionBackend

InspectionBackend extends the existing engine without changing legacy wrappers.

type InspectionResponse

type InspectionResponse struct {
	Status      string                          `json:"status"`
	Entities    []graphprotocol.Entity          `json:"entities"`
	NextCursor  string                          `json:"next_cursor,omitempty"`
	File        *graphprotocol.IndexedFile      `json:"file,omitempty"`
	Callers     *graphprotocol.TraverseResponse `json:"callers,omitempty"`
	Callees     *graphprotocol.TraverseResponse `json:"callees,omitempty"`
	Structure   *graphprotocol.TraverseResponse `json:"structure,omitempty"`
	Sources     []InspectionSource              `json:"sources"`
	Generations []graphprotocol.Generation      `json:"generations"`
	Boundaries  []string                        `json:"boundaries,omitempty"`
	Complete    bool                            `json:"complete"`
	Coverage    string                          `json:"coverage"`
}

type InspectionSource

type InspectionSource struct {
	EntityID   string             `json:"entity_id,omitempty"`
	Path       string             `json:"path,omitempty"`
	Status     string             `json:"status"`
	Precision  string             `json:"precision,omitempty"`
	Content    string             `json:"content,omitempty"`
	IndexedSHA string             `json:"indexed_sha,omitempty"`
	BlobSHA    string             `json:"blob_sha,omitempty"`
	StartLine  int                `json:"start_line,omitempty"`
	EndLine    int                `json:"end_line,omitempty"`
	Range      *graphv2.Location  `json:"range,omitempty"`
	Selection  *SourceSelection   `json:"selection,omitempty"`
	FileErrors *graphv2.Extension `json:"file_errors,omitempty"`
}

type InventoryFile

type InventoryFile struct {
	Path     string        `json:"path"`
	Metadata *graphv2.File `json:"metadata,omitempty"`
}

Metadata is the original producer fact, omitted only by explicit request.

type InventoryGroup

type InventoryGroup struct {
	Language string          `json:"language"`
	Files    []InventoryFile `json:"files"`
}

type InventoryTree

type InventoryTree struct {
	Name      string           `json:"name"`
	Path      string           `json:"path"`
	File      *InventoryFile   `json:"file,omitempty"`
	Children  []*InventoryTree `json:"children,omitempty"`
	Truncated bool             `json:"truncated,omitempty"`
}

type Limits

type Limits struct {
	PerCategory, DefaultImpactDepth, MaxDepth int
	DefaultTraceDepth, MaxTraceDepth, MaxRows int
	MaxNodes, MaxEdges, MaxFanout             int
	MaxResponseBytes                          int
}

type ListFilesRequest

type ListFilesRequest struct {
	Repo                            api.GraphRepositorySelector
	Branch, Directory, Glob, Cursor string
	Limit                           int
}

type ProjectTokensRequest

type ProjectTokensRequest struct {
	Repo   api.GraphRepositorySelector
	Branch string
}

type ProjectTokensResponse

type ProjectTokensResponse struct {
	Tokens      []string                   `json:"tokens"`
	Generations []graphprotocol.Generation `json:"generations"`
}

type QualifiedNameRequest

type QualifiedNameRequest struct {
	AggregateScopeRequest
	Pattern string
}

type RepositoryStore

type RepositoryStore interface {
	GraphRepositories(context.Context, authn.Principal) ([]repository.Repository, error)
}

type Service

type Service struct {
	Store   RepositoryStore
	Backend graphprotocol.QueryEngine
	Files   ContentReader
	Limits  Limits
	Observe func(string, string, time.Duration)
	// contains filtered or unexported fields
}

func (*Service) AffectedTests

func (*Service) AmbiguousReferencedNames

func (s *Service) AmbiguousReferencedNames(ctx context.Context, principal authn.Principal, request AggregateValuesRequest) (graphprotocol.AggregateNamesResponse, error)

func (*Service) BuildTaskContext

func (s *Service) BuildTaskContext(ctx context.Context, principal authn.Principal, request BuildTaskContextRequest) (TaskContext, error)

func (*Service) CallGraph

func (*Service) Capabilities added in v0.5.0

func (*Service) CircularDependencies

func (s *Service) CircularDependencies(ctx context.Context, principal authn.Principal, request FileDependencyRequest) (graphprotocol.FileDependencyResponse, error)

func (*Service) Context

func (s *Service) Context(ctx context.Context, principal authn.Principal, request api.GraphContextRequest) (result api.GraphContextResponse, err error)

func (*Service) Discover added in v0.5.0

func (*Service) Explore

Explore composes the existing query and exact-source boundaries in one selected immutable scope. Optional history retains coverage, never authority.

func (*Service) ExplorePublic added in v0.5.0

func (*Service) ExportedSymbols

func (s *Service) ExportedSymbols(ctx context.Context, principal authn.Principal, request EntityFileRequest) (graphprotocol.EntitiesResponse, error)

func (*Service) FanIn

func (*Service) FanOut

func (*Service) FileDependencies

func (s *Service) FileDependencies(ctx context.Context, principal authn.Principal, request FileDependencyRequest) (graphprotocol.FileDependencyResponse, error)

func (*Service) FileDependencyPairs

func (s *Service) FileDependencyPairs(ctx context.Context, principal authn.Principal, request FileDependencyRequest) (graphprotocol.FileDependencyResponse, error)

func (*Service) FileDependentCounts

func (s *Service) FileDependentCounts(ctx context.Context, principal authn.Principal, request FileDependencyRequest) (graphprotocol.FileDependencyResponse, error)

func (*Service) FileDependents

func (*Service) FileInventory

FileInventory is a bounded presentation of indexed files, not source analysis.

func (*Service) FileNodes

func (*Service) FileReachCounts

func (s *Service) FileReachCounts(ctx context.Context, principal authn.Principal, request FileDependencyRequest) (graphprotocol.FileDependencyResponse, error)

func (*Service) FilteredSubgraph

func (s *Service) FilteredSubgraph(ctx context.Context, principal authn.Principal, request FilteredSubgraphRequest) (graphprotocol.SubgraphResponse, error)

func (*Service) FindByQualifiedName

func (s *Service) FindByQualifiedName(ctx context.Context, principal authn.Principal, request QualifiedNameRequest) (graphprotocol.EntitiesResponse, error)

func (*Service) FindRelevantContext

func (s *Service) FindRelevantContext(ctx context.Context, principal authn.Principal, request FindRelevantContextRequest) (graphprotocol.RelevantContextResponse, error)

func (*Service) GraphStats

func (*Service) Impact

func (s *Service) Impact(ctx context.Context, principal authn.Principal, request api.GraphImpactRequest) (result api.GraphImpactResponse, err error)

func (*Service) ImpactRadius

func (s *Service) ImpactRadius(ctx context.Context, principal authn.Principal, request EntityAnalysisRequest) (graphprotocol.SubgraphResponse, error)

func (*Service) InspectEntity

func (*Service) InspectFile

func (*Service) LanguagesWithExports

func (s *Service) LanguagesWithExports(ctx context.Context, principal authn.Principal, request AggregateValuesRequest) (graphprotocol.AggregateNamesResponse, error)

func (*Service) ListFiles

func (*Service) ListFilesPublic added in v0.5.0

func (*Service) ModuleAggregation

func (*Service) ModuleStructure

func (*Service) NodeMetrics

func (*Service) ProjectNameTokens

ProjectNameTokens returns request-local DiscoveryConfig.ProjectTerms from the selected repository and exact-SHA source, never from artifact metadata or disk. ContentReader already bounds source transfer; only 512 lines / 64 KiB of each manifest may contribute evidence. Truncated/unavailable manifests contribute none.

func (*Service) SymbolCallees added in v0.7.0

SymbolCallees is the outgoing counterpart of SymbolCallers.

func (*Service) SymbolCallers added in v0.7.0

SymbolCallers lists what calls, imports, instantiates, navigates to, or references each definition of a name.

func (*Service) SymbolImpact added in v0.7.0

SymbolImpact is the impact radius of each definition of a name.

func (*Service) TopCallingFiles

func (*Service) TopDependedOn

func (*Service) Trace

func (s *Service) Trace(ctx context.Context, principal authn.Principal, request api.GraphTraceRequest) (result api.GraphTraceResponse, err error)

func (*Service) TypeHierarchy added in v0.6.1

func (*Service) TypeRelations added in v0.6.1

func (*Service) UnresolvedNamesAmong

func (s *Service) UnresolvedNamesAmong(ctx context.Context, principal authn.Principal, request AggregateValuesRequest) (graphprotocol.AggregateNamesResponse, error)

func (*Service) UnresolvedReferencesFrom

func (s *Service) UnresolvedReferencesFrom(ctx context.Context, principal authn.Principal, request AggregateUnresolvedRequest) (graphprotocol.UnresolvedReferencesResponse, error)

func (*Service) UnresolvedReferencesInFile

func (s *Service) UnresolvedReferencesInFile(ctx context.Context, principal authn.Principal, request AggregateUnresolvedRequest) (graphprotocol.UnresolvedReferencesResponse, error)

func (*Service) Usages

type Snapshot

type Snapshot struct {
	ID       int64
	GitHubID int64
	Name     string
	Branch   string
	Commit   string
}

func ResolveRepository

func ResolveRepository(ctx context.Context, store RepositoryStore, principal authn.Principal, selector api.GraphRepositorySelector, branch string) (Snapshot, error)

type SourceSelection

type SourceSelection struct {
	StartByte int `json:"start_byte"`
	EndByte   int `json:"end_byte"`
}

SourceSelection is an end-exclusive byte range inside the verbatim Content. Range retains the producer's original zero-based UTF-16 coordinates.

type TaskCodeBlock

type TaskCodeBlock struct {
	Entity             graphprotocol.Entity `json:"entity"`
	Path               string               `json:"path"`
	Language           string               `json:"language,omitempty"`
	Range              *graphv2.Location    `json:"range,omitempty"`
	IndexedSHA         string               `json:"indexed_sha,omitempty"`
	BlobSHA            string               `json:"blob_sha,omitempty"`
	StartLine          int                  `json:"start_line,omitempty"`
	EndLine            int                  `json:"end_line,omitempty"`
	Content            string               `json:"content,omitempty"`
	Status             string               `json:"status"`
	OriginalUTF16Units *int                 `json:"original_utf16_units,omitempty"`
	ReturnedUTF16Units int                  `json:"returned_utf16_units"`
	Truncated          bool                 `json:"truncated"`
	Complete           bool                 `json:"complete"`
}

type TaskContext

type TaskContext struct {
	Query        string                                `json:"query"`
	Summary      string                                `json:"summary"`
	Graph        graphprotocol.RelevantContextResponse `json:"graph"`
	EntryPoints  []graphprotocol.DiscoveryMatch        `json:"entry_points"`
	CodeBlocks   []TaskCodeBlock                       `json:"code_blocks"`
	RelatedFiles []string                              `json:"related_files"`
	Stats        TaskContextStats                      `json:"stats"`
	Options      AppliedBuildTaskContextOptions        `json:"options"`
	Boundaries   []string                              `json:"boundaries,omitempty"`
	Generations  []graphprotocol.Generation            `json:"generations"`
	Complete     bool                                  `json:"complete"`
}

type TaskContextStats

type TaskContextStats struct {
	NodeCount           int `json:"node_count"`
	EdgeCount           int `json:"edge_count"`
	FileCount           int `json:"file_count"`
	CodeBlockCount      int `json:"code_block_count"`
	TotalCodeUTF16Units int `json:"total_code_utf16_units"`
	SourceReads         int `json:"source_reads"`
	SourceBytes         int `json:"source_bytes"`
}

Jump to

Keyboard shortcuts

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