plugin

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 13 Imported by: 0

README

QNTX Plugin System

  • PULSE: According to ADR-004 we do have Plugin-Pulse integration, i think we should look into making LLM calls using the LLM gRPC service a Pulse managed abstraction. A new QNTX plugin called Voor is likely to create a lot of requests, right now it's looking like it's getting written to be managing it's own queue, and for sure the priority. So you have Werf nominating a lot of matches, and then Voor who decides what should be something we spend an LLM call on, and then there is Pulse who will also manage a queue of work and will decide how to allocate resources to each. I think what pissed me off about Pulse in the beginning was how deeply tied it was to domain logic. now a lot of that seems to be decoupled. but now the problem seems to be returning. Resource allocation has domain implications, so how do you manage this?
ADR Decision
ADR-001 Domain plugin architecture
ADR-002 Plugin configuration management
ADR-003 Plugin communication patterns
ADR-004 Plugin-Pulse integration for dynamic async handlers
ADR-006 Protocol Buffers as single source of truth for types

Configuration

Plugins receive configuration through the plugin.Config interface. They don't know where values come from — they just call config.GetString("model") or config.GetString("_llm_endpoint").

The implementation that actually resolves those calls lives in plugin/grpc/config_provider.go, not in the server. The server passes in service endpoints (gRPC addresses), and the config provider merges them with am.toml values. This keeps the server out of plugin concerns — it just hands over addresses at startup and walks away.

Documentation

Overview

Package plugin provides the plugin architecture for QNTX domain extensions.

A domain plugin represents a complete functional area (e.g., code, biotech, finance). Each domain provides HTTP endpoints, WebSocket handlers, and lifecycle management.

Architecture:

  • All domains run as separate processes via gRPC
  • All domains implement the same DomainPlugin interface
  • Domains are isolated - interact only via shared database (attestations)

Example domains:

  • code: Software development (git ingestion, GitHub PRs, language servers, code editor)
  • biotech: Bioinformatics (sequence analysis, protein folding, genomics)
  • finance: Financial analysis (market data, risk modeling, portfolio optimization)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() []string

List returns all plugin names from the global registry (Issue #4: Thread-safe)

func Register

func Register(plugin DomainPlugin) error

Register registers a plugin with the global registry (Issue #4: Thread-safe)

func SetDefaultRegistry

func SetDefaultRegistry(registry *Registry)

SetDefaultRegistry sets the global registry (Issue #4: Thread-safe) Panics if called more than once. The mutex ensures thread-safe check-and-set.

Types

type AddVectorsRequest

type AddVectorsRequest struct {
	Index   string
	Vectors []VectorEntry
}

AddVectorsRequest is a request to add vectors to an index.

type AddVectorsResponse

type AddVectorsResponse struct {
	Added int
}

AddVectorsResponse is the result of adding vectors.

type Base

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

Base provides default implementations for common plugin boilerplate. Embed this in your plugin struct to get Metadata, Pause, Resume, IsPaused, Health, Shutdown, and RegisterWebSocket for free.

Per-glyph config pattern: plugins that support multiple glyph instances can store per-glyph configuration as attestations (subject: "{plugin}-glyph-{glyphID}", predicate: "configured"). This makes the plugin stateless across restarts — all state lives in the ATS. See ix-json for the reference implementation.

Usage:

type Plugin struct {
    plugin.Base
    // plugin-specific fields
}

func NewPlugin() *Plugin {
    return &Plugin{
        Base: plugin.NewBase(plugin.Metadata{Name: "myplugin", ...}),
    }
}

func (p *Plugin) Initialize(ctx context.Context, services plugin.ServiceRegistry) error {
    p.Init(services)
    // plugin-specific initialization
}

func NewBase

func NewBase(meta Metadata) Base

NewBase creates a Base with the given metadata.

func (*Base) Health

func (b *Base) Health(ctx context.Context) HealthStatus

Health returns a basic health status with pause state. Override this in your plugin to add domain-specific details.

func (*Base) Init

func (b *Base) Init(services ServiceRegistry)

Init stores the ServiceRegistry. Call this from your plugin's Initialize().

func (*Base) IsPaused

func (b *Base) IsPaused() bool

IsPaused returns whether the plugin is currently paused.

func (*Base) Metadata

func (b *Base) Metadata() Metadata

Metadata returns the plugin metadata.

func (*Base) Pause

func (b *Base) Pause(ctx context.Context) error

Pause temporarily suspends the plugin.

func (*Base) RegisterWebSocket

func (b *Base) RegisterWebSocket() (map[string]WebSocketHandler, error)

RegisterWebSocket returns nil. Override if your plugin uses WebSockets.

func (*Base) Resume

func (b *Base) Resume(ctx context.Context) error

Resume restores the plugin to active operation.

func (*Base) Services

func (b *Base) Services() ServiceRegistry

Services returns the ServiceRegistry provided during initialization.

func (*Base) Shutdown

func (b *Base) Shutdown(ctx context.Context) error

Shutdown is a no-op default. Override if your plugin needs cleanup.

type Config

type Config interface {
	// GetString retrieves a string configuration value
	GetString(key string) string

	// GetInt retrieves an integer configuration value
	GetInt(key string) int

	// GetBool retrieves a boolean configuration value
	GetBool(key string) bool

	// GetStringSlice retrieves a string slice configuration value
	GetStringSlice(key string) []string

	// Get retrieves a raw configuration value
	Get(key string) interface{}

	// Set sets a configuration value (for runtime overrides)
	Set(key string, value interface{})

	// GetKeys returns all available configuration keys (sorted)
	GetKeys() []string
}

Config provides access to plugin configuration

type ConfigField

type ConfigField struct {
	Type         string // "string", "number", "boolean", "array"
	Description  string // Human-readable description
	DefaultValue string // Default value as string
	Required     bool   // Whether field is required
	MinValue     string // For numbers: minimum value
	MaxValue     string // For numbers: maximum value
	Pattern      string // For strings: regex validation pattern
	ElementType  string // For arrays: element type
}

ConfigField describes a single configuration field for UI-based configuration. This maps directly to protocol.ConfigFieldSchema for gRPC serialization.

type ConfigProvider

type ConfigProvider interface {
	// GetPluginConfig returns configuration for a specific plugin
	GetPluginConfig(domain string) Config
}

ConfigProvider provides configuration for plugins

type ConfigurablePlugin

type ConfigurablePlugin interface {
	DomainPlugin

	// ConfigSchema returns the configuration schema for this plugin.
	// The returned map keys are configuration field names (e.g., "gopls.workspace_root").
	// Values describe each field's type, description, default, and validation constraints.
	//
	// Field types: "string", "number", "boolean", "array"
	// See protocol.ConfigFieldSchema for the full schema definition.
	ConfigSchema() map[string]ConfigField
}

ConfigurablePlugin is an optional interface for plugins that expose configuration schemas for UI-based configuration. Plugins implementing this interface will have their configuration schema exposed via the gRPC ConfigSchema RPC, enabling the web UI to render configuration forms.

type ConfigureIndexRequest

type ConfigureIndexRequest struct {
	Index                string
	PrimaryKey           string
	FilterableAttributes []string
	SortableAttributes   []string
	SearchableAttributes []string
}

ConfigureIndexRequest creates/configures an index with its settings.

type ConfigureIndexResponse

type ConfigureIndexResponse struct {
	Accepted bool
}

ConfigureIndexResponse reports whether the configuration was accepted.

type CreateIndexRequest

type CreateIndexRequest struct {
	Name       string
	Dimensions int
}

CreateIndexRequest is a request to create a new vector index.

type CreateIndexResponse

type CreateIndexResponse struct {
	Name string
}

CreateIndexResponse is the result of creating an index.

type DefaultServiceRegistry

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

DefaultServiceRegistry is the standard implementation of ServiceRegistry

func (*DefaultServiceRegistry) ATSStore

ATSStore returns the attestation storage interface

func (*DefaultServiceRegistry) Config

func (r *DefaultServiceRegistry) Config(domain string) Config

Config returns plugin-specific configuration

func (*DefaultServiceRegistry) Database

func (r *DefaultServiceRegistry) Database() *sql.DB

Database returns the shared QNTX database connection

func (*DefaultServiceRegistry) FileService

func (r *DefaultServiceRegistry) FileService() FileService

FileService returns nil for in-process plugins (they share the filesystem with core).

func (*DefaultServiceRegistry) LLM

LLM returns nil for in-process plugins (LLM is a gRPC-only service).

func (*DefaultServiceRegistry) Logger

func (r *DefaultServiceRegistry) Logger(domain string) *zap.SugaredLogger

Logger returns a logger for the specified domain with version information

func (*DefaultServiceRegistry) Queue

Queue returns the Pulse async job queue

func (*DefaultServiceRegistry) Schedule

Schedule returns nil for in-process plugins (runtime schedules are a gRPC feature).

func (*DefaultServiceRegistry) Search

Search returns nil for in-process plugins (Search is a gRPC-only service).

func (*DefaultServiceRegistry) VectorSearch

func (r *DefaultServiceRegistry) VectorSearch() VectorSearchService

VectorSearch returns nil for in-process plugins (VectorSearch is a gRPC-only service).

type DeleteDocumentsRequest

type DeleteDocumentsRequest struct {
	Index string
	IDs   []string
}

DeleteDocumentsRequest removes documents from an index.

type DeleteDocumentsResponse

type DeleteDocumentsResponse struct {
	Deleted int
}

DeleteDocumentsResponse reports how many documents were deleted.

type DomainPlugin

type DomainPlugin interface {
	// Metadata returns information about this domain plugin
	Metadata() Metadata

	// Initialize is called when the plugin is loaded
	// The plugin receives a service registry to access QNTX core services
	Initialize(ctx context.Context, services ServiceRegistry) error

	// Shutdown is called when QNTX is shutting down
	Shutdown(ctx context.Context) error

	// RegisterHTTP registers HTTP handlers for this domain
	// Handlers will be mounted at: /api/<domain-name>/*
	RegisterHTTP(mux *http.ServeMux) error

	// RegisterWebSocket registers WebSocket handlers for this domain
	// Handlers will be mounted at: /<domain-name>-ws
	RegisterWebSocket() (map[string]WebSocketHandler, error)

	// Health returns the health status of this domain plugin
	Health(ctx context.Context) HealthStatus
}

DomainPlugin defines the interface that all domain plugins must implement. All plugins implement this interface.

func Get

func Get(name string) (DomainPlugin, bool)

Get retrieves a plugin from the global registry (Issue #4: Thread-safe)

type EmbeddingProvider

type EmbeddingProvider interface {
	DomainPlugin
}

EmbeddingProvider is an optional interface marker for plugins that provide EmbeddingService (Embed, BatchEmbed, Cluster, ModelInfo RPCs). The actual service is registered as a separate gRPC service on the plugin server.

type FileService

type FileService interface {
	// ReadFileBase64 reads a stored file and returns its MIME type and base64-encoded content.
	ReadFileBase64(fileID string) (mimeType, base64Data string, err error)
}

FileService provides file access for plugins. Plugins use this to read files stored on the core server's filesystem.

type GlyphDef

type GlyphDef struct {
	// Symbol is the glyph identifier (e.g., "⚗" for a chemistry plugin).
	// Must not collide with built-in symbols from sym package.
	Symbol string

	// Title is the human-readable name shown in the title bar.
	Title string

	// Label is a short identifier for logs and the spawn menu.
	Label string

	// ContentPath is the HTTP path (relative to /api/{plugin}/) that
	// returns the HTML fragment for this glyph's content area.
	// The frontend GETs this path with ?glyph_id={id}&content={encoded}
	// and mounts the response HTML into the glyph element.
	// Used for server-rendered HTML glyphs. Ignored when ModulePath is set.
	ContentPath string

	// CSSPath is an optional HTTP path to a stylesheet for this glyph type.
	// Loaded once when the first glyph of this type is created.
	CSSPath string

	// ModulePath is the HTTP path (relative to /api/{plugin}/) to a
	// TypeScript/JavaScript module that exports a render function.
	// When set, the frontend dynamically imports this module and injects
	// a GlyphUI instance, bypassing the server-rendered HTML pipeline.
	// The module must export: render(glyph, ui) => HTMLElement
	ModulePath string

	// DefaultWidth and DefaultHeight in pixels. 0 = use system default.
	DefaultWidth  int
	DefaultHeight int
}

GlyphDef defines a custom glyph type provided by a plugin.

type HealthStatus

type HealthStatus struct {
	Healthy bool
	Paused  bool // True if plugin is intentionally paused (not a failure)
	Message string
	Details map[string]interface{}
}

HealthStatus represents the health of a domain plugin

type IndexDocumentsRequest

type IndexDocumentsRequest struct {
	Index     string
	Documents [][]byte // documents as JSON
}

IndexDocumentsRequest pushes documents into an index.

type IndexDocumentsResponse

type IndexDocumentsResponse struct {
	Accepted int
}

IndexDocumentsResponse reports how many documents were accepted.

type LLMAttachment

type LLMAttachment struct {
	MimeType string
	Data     string
	Filename string
}

LLMAttachment is a file attached to an LLM request.

type LLMProvider

type LLMProvider interface {
	DomainPlugin

	// Chat handles an LLM chat request.
	Chat(ctx context.Context, req LLMRequest) (*LLMResponse, error)
}

LLMProvider is an optional interface for plugins that provide LLM services. Plugins implementing this interface register as LLM backends in the core service mesh. Other plugins can then call services.LLM().Chat() to make LLM requests routed through the provider.

type LLMRequest

type LLMRequest struct {
	SystemPrompt string
	UserPrompt   string
	Model        string
	Temperature  float64
	MaxTokens    int
	Provider     string          // Target provider (empty = default)
	Attachments  []LLMAttachment // Multimodal attachments
}

LLMRequest is a provider-agnostic LLM chat request.

type LLMResponse

type LLMResponse struct {
	Content          string
	Model            string
	PromptTokens     int
	CompletionTokens int
	TotalTokens      int
}

LLMResponse is a provider-agnostic LLM chat response.

type LLMService

type LLMService interface {
	// Chat sends a chat completion request and returns the response.
	Chat(ctx context.Context, req LLMRequest) (*LLMResponse, error)
}

LLMService provides provider-agnostic LLM access for plugins. Core routes requests to the appropriate provider plugin.

type Metadata

type Metadata struct {
	// Name is the domain identifier (e.g., "code", "biotech")
	Name string

	// Version is the plugin version (semver)
	Version string

	// QNTXVersion is the required QNTX version (semver constraint)
	QNTXVersion string

	// Description is a human-readable description
	Description string

	// Author is the plugin author/maintainer
	Author string

	// License is the plugin license (e.g., "MIT", "Apache-2.0")
	License string
}

Metadata describes a domain plugin

type PausablePlugin

type PausablePlugin interface {
	DomainPlugin

	// Pause temporarily suspends the plugin's operations.
	// The plugin should stop processing new requests but maintain its state.
	// HTTP endpoints may return 503 Service Unavailable while paused.
	Pause(ctx context.Context) error

	// Resume restores the plugin to active operation after a pause.
	Resume(ctx context.Context) error
}

PausablePlugin is an optional interface for plugins that support pause/resume. Plugins that implement this interface can be paused and resumed at runtime without a full shutdown/restart cycle.

type PluginState

type PluginState string

PluginState represents the current state of a plugin

const (
	// StateLoading indicates the plugin is currently loading/connecting
	StateLoading PluginState = "loading"
	// StateRunning indicates the plugin is active and processing requests
	StateRunning PluginState = "running"
	// StatePaused indicates the plugin is temporarily suspended
	StatePaused PluginState = "paused"
	// StateStopped indicates the plugin has been shut down
	StateStopped PluginState = "stopped"
	// StateFailed indicates the plugin failed to initialize or encountered a fatal error
	StateFailed PluginState = "failed"
	// StateRestarting indicates the plugin is being intentionally killed and relaunched
	StateRestarting PluginState = "restarting"
)

type QueueService

type QueueService interface {
	// Enqueue adds a new job to the queue
	Enqueue(job *async.Job) error

	// GetJob retrieves a job by ID
	GetJob(id string) (*async.Job, error)

	// UpdateJob updates a job's state
	UpdateJob(job *async.Job) error

	// ListJobs lists jobs with optional status filter
	ListJobs(status *async.JobStatus, limit int) ([]*async.Job, error)
}

QueueService defines the job queue operations available to plugins. This interface allows both local and remote queue implementations.

type Registry

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

Registry manages all domain plugins

func GetDefaultRegistry

func GetDefaultRegistry() *Registry

GetDefaultRegistry returns the global registry (Issue #4: Thread-safe read)

func NewRegistry

func NewRegistry(qntxVersion string, logger *zap.SugaredLogger) *Registry

NewRegistry creates a new plugin registry

func (*Registry) Get

func (r *Registry) Get(name string) (DomainPlugin, bool)

Get retrieves a domain plugin by name

func (*Registry) GetAll

func (r *Registry) GetAll() map[string]DomainPlugin

GetAll returns all registered plugins

func (*Registry) GetAllStates

func (r *Registry) GetAllStates() map[string]PluginState

GetAllStates returns the states of all plugins

func (*Registry) GetError

func (r *Registry) GetError(name string) (string, bool)

GetError returns the error message for a failed plugin, if any.

func (*Registry) GetState

func (r *Registry) GetState(name string) (PluginState, bool)

GetState returns the current state of a plugin

func (*Registry) HealthCheckAll

func (r *Registry) HealthCheckAll(ctx context.Context) map[string]HealthStatus

HealthCheckAll checks health of all plugins

func (*Registry) InitializeAll

func (r *Registry) InitializeAll(ctx context.Context, services ServiceRegistry) error

InitializeAll initializes all registered plugins

func (*Registry) IsPausable

func (r *Registry) IsPausable(name string) bool

IsPausable checks if a plugin implements the PausablePlugin interface

func (*Registry) IsReady

func (r *Registry) IsReady(name string) bool

IsReady returns whether a plugin is ready to handle requests

func (*Registry) List

func (r *Registry) List() []string

List returns all registered domain plugin names in sorted order

func (*Registry) ListEnabled

func (r *Registry) ListEnabled() []string

ListEnabled returns all enabled plugin names (including pre-registered ones) in sorted order This includes plugins that are still loading, not just fully loaded ones

func (*Registry) MarkFailed

func (r *Registry) MarkFailed(name string, reason string)

MarkFailed marks a plugin as failed and stores the error reason. Used when a pre-registered plugin fails to load or connect.

func (*Registry) MarkReady

func (r *Registry) MarkReady(name string)

MarkReady marks a plugin as ready (StateRunning) after successful loading Used by async plugin loading to indicate plugin is ready to handle requests

func (*Registry) MarkStopped

func (r *Registry) MarkStopped(name string)

MarkStopped sets a plugin's state to stopped (used when disabling at runtime).

func (*Registry) Pause

func (r *Registry) Pause(ctx context.Context, name string) error

Pause pauses a plugin if it implements PausablePlugin

func (*Registry) PreRegister

func (r *Registry) PreRegister(name string)

PreRegister reserves a plugin slot in loading state before async initialization This allows routes to be registered immediately while plugins load in background

func (*Registry) Register

func (r *Registry) Register(plugin DomainPlugin) error

Register registers a domain plugin Returns error if plugin name conflicts or version incompatible

func (*Registry) Resume

func (r *Registry) Resume(ctx context.Context, name string) error

Resume resumes a paused plugin

func (*Registry) ShutdownAll

func (r *Registry) ShutdownAll(ctx context.Context) error

ShutdownAll shuts down all registered plugins

func (*Registry) Unregister

func (r *Registry) Unregister(name string)

Unregister removes a plugin from the registry so it can be re-registered after restart.

type ScheduleService

type ScheduleService interface {
	// Create creates a new recurring schedule and returns its ID
	Create(handlerName string, intervalSecs int, payload []byte, metadata map[string]string) (scheduleID string, err error)

	// Pause pauses an active schedule
	Pause(scheduleID string) error

	// Resume resumes a paused schedule
	Resume(scheduleID string) error

	// Delete soft-deletes a schedule
	Delete(scheduleID string) error

	// Get retrieves a schedule by ID
	Get(scheduleID string) (*schedule.Job, error)
}

ScheduleService defines runtime schedule management for plugins. Plugins use this to create, pause, resume, and delete recurring Pulse schedules.

type SearchHit

type SearchHit struct {
	ID          string
	Score       float32
	Document    []byte // indexed content as JSON
	Highlighted []byte // highlighted fields as JSON
}

SearchHit is a single search result.

type SearchProvider

type SearchProvider interface {
	DomainPlugin

	// Search queries an index and returns ranked results.
	Search(ctx context.Context, req SearchRequest) (*SearchResponse, error)

	// IndexDocuments pushes documents into an index.
	IndexDocuments(ctx context.Context, req IndexDocumentsRequest) (*IndexDocumentsResponse, error)

	// DeleteDocuments removes documents from an index by ID.
	DeleteDocuments(ctx context.Context, req DeleteDocumentsRequest) (*DeleteDocumentsResponse, error)

	// ConfigureIndex creates/configures an index with filterable, sortable, and searchable attributes.
	ConfigureIndex(ctx context.Context, req ConfigureIndexRequest) (*ConfigureIndexResponse, error)
}

SearchProvider is an optional interface for plugins that provide search services. Plugins implementing this interface register as the search backend in the core service mesh. Other plugins can then call services.Search() to query indexes.

type SearchRequest

type SearchRequest struct {
	Query   string
	Index   string
	TopK    int
	Filters []byte   // filter expression as JSON — interpreted by the provider
	Facets  []string // facet fields to include in response
}

SearchRequest is a search query against an index.

type SearchResponse

type SearchResponse struct {
	Hits              []SearchHit
	Total             int
	ProcessingMs      int
	FacetDistribution []byte // facet counts as JSON
}

SearchResponse contains ranked search results.

type SearchService

type SearchService interface {
	// Search queries an index and returns ranked results.
	Search(ctx context.Context, req SearchRequest) (*SearchResponse, error)

	// IndexDocuments pushes documents into an index.
	IndexDocuments(ctx context.Context, req IndexDocumentsRequest) (*IndexDocumentsResponse, error)

	// DeleteDocuments removes documents from an index by ID.
	DeleteDocuments(ctx context.Context, req DeleteDocumentsRequest) (*DeleteDocumentsResponse, error)

	// ConfigureIndex creates/configures an index with filterable, sortable, and searchable attributes.
	ConfigureIndex(ctx context.Context, req ConfigureIndexRequest) (*ConfigureIndexResponse, error)
}

SearchService provides full-text search over indexed documents. Core routes requests to the search provider plugin (qntx-meili).

type ServiceRegistry

type ServiceRegistry interface {
	// Database returns the shared QNTX database connection
	Database() *sql.DB

	// Logger returns a logger for this plugin
	Logger(domain string) *zap.SugaredLogger

	// Config returns plugin-specific configuration
	Config(domain string) Config

	// ATSStore returns the attestation storage interface
	ATSStore() ats.AttestationStore

	// Queue returns the Pulse async job queue
	Queue() QueueService

	// Schedule returns the Pulse schedule management service
	Schedule() ScheduleService

	// FileService returns the file storage service for reading uploaded files
	FileService() FileService

	// LLM returns the LLM service for provider-agnostic chat completions.
	// Returns nil if no LLM provider is available.
	LLM() LLMService

	// VectorSearch returns the vector search service for nearest-neighbor queries (ADR-016).
	// Returns nil if no vector search provider is available.
	VectorSearch() VectorSearchService

	// Search returns the full-text search service.
	// Returns nil if no search provider is available.
	Search() SearchService
}

ServiceRegistry provides access to QNTX core services for domain plugins. Plugins use this registry to look up services they need.

func NewServiceRegistry

func NewServiceRegistry(db *sql.DB, logger *zap.SugaredLogger, store ats.AttestationStore, config ConfigProvider, queue QueueService) ServiceRegistry

NewServiceRegistry creates a new service registry

type UIPlugin

type UIPlugin interface {
	DomainPlugin

	// RegisterGlyphs returns glyph type definitions this plugin provides.
	// Each definition includes symbol, title, label, and the HTTP path
	// that renders the glyph's HTML content.
	RegisterGlyphs() []GlyphDef
}

UIPlugin is an optional interface for plugins that provide custom glyph types. Plugins implementing this interface can extend the QNTX frontend with custom UI components rendered as glyphs on the canvas.

type VectorEntry

type VectorEntry struct {
	ID     string
	Vector []float32
}

VectorEntry is a single vector with its identifier.

type VectorSearchHit

type VectorSearchHit struct {
	ID       string
	Distance float32
}

VectorSearchHit is a single search result.

type VectorSearchRequest

type VectorSearchRequest struct {
	Index       string
	QueryVector []float32
	TopK        int
}

VectorSearchRequest is a request to search a vector index.

type VectorSearchResponse

type VectorSearchResponse struct {
	Results []VectorSearchHit
}

VectorSearchResponse contains search results.

type VectorSearchService

type VectorSearchService interface {
	// Search finds the nearest neighbors to a query vector in a named index.
	Search(ctx context.Context, req VectorSearchRequest) (*VectorSearchResponse, error)

	// AddVectors inserts vectors into a named index.
	AddVectors(ctx context.Context, req AddVectorsRequest) (*AddVectorsResponse, error)

	// CreateIndex creates a new named vector index.
	CreateIndex(ctx context.Context, req CreateIndexRequest) (*CreateIndexResponse, error)
}

VectorSearchService provides nearest-neighbor search over dense vector indexes (ADR-016). Core routes requests to the provider plugin (e.g. faiss).

type WebSocketHandler

type WebSocketHandler interface {
	ServeWS(w http.ResponseWriter, r *http.Request)
}

WebSocketHandler handles WebSocket connections

Directories

Path Synopsis
Package grpc provides gRPC transport for external domain plugins.
Package grpc provides gRPC transport for external domain plugins.
Package httputil provides shared HTTP handler utilities for QNTX plugins.
Package httputil provides shared HTTP handler utilities for QNTX plugins.

Jump to

Keyboard shortcuts

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