types

package
v0.0.0-...-1e0776f Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package types provides shared types for the plugins infrastructure. These types are used across multiple sub-packages to avoid circular dependencies.

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "VIEWRA_PLUGIN",
	MagicCookieValue: "viewra-plugin-v1",
}

Handshake is the shared handshake config for all plugins. Both host and plugin must agree on these values.

Functions

func HasCategoryIn

func HasCategoryIn(categories []Category, target Category) bool

HasCategoryIn checks if a category slice contains a target category.

Types

type Category

type Category string

Category defines the type of functionality a plugin provides.

const (
	CategoryEnricher         Category = "enricher"
	CategoryNotificationSink Category = "notification_sink"
	CategoryProvider         Category = "provider"
	CategoryTrending         Category = "trending"
)

func InferCategoriesFromCapabilities

func InferCategoriesFromCapabilities(capabilities []string) []Category

InferCategoriesFromCapabilities derives runtime categories from a plugin's capabilities. This maps capability strings to the runtime Category types used for client dispatch.

type Health

type Health struct {
	Status        pluginv1.HealthStatus_Status
	Message       string
	LastHeartbeat time.Time
	ErrorRate     float64       // Errors per minute (rolling window)
	AvgLatency    time.Duration // Average response latency
	Restarts      int           // Number of times this plugin has been restarted
}

Health represents the current health status of a plugin.

type Instance

type Instance struct {
	// ID is the unique identifier for this plugin.
	ID string

	// Manifest contains the plugin's static metadata from plugin.yml.
	Manifest *manifest.Manifest

	// Path is the filesystem path to the plugin binary.
	Path string

	// BuildTime is when the plugin binary was last modified (used as build time proxy).
	BuildTime time.Time

	// Client is the go-plugin client managing the plugin process.
	Client *plugin.Client

	// CoreClient provides access to the plugin's core RPC methods.
	CoreClient pluginv1.PluginCoreClient

	// EnricherClient provides access to enricher-specific methods (if applicable).
	EnricherClient pluginv1.EnricherClient

	// ProviderClient provides access to provider methods (if applicable).
	// This is set for plugins with category "provider".
	ProviderClient pluginv1.PluginProviderClient

	// VectorSearchClient provides access to vector search methods (if applicable).
	// This is set for plugins that provide the "vector_search" capability.
	VectorSearchClient pluginv1.VectorSearchClient

	// TrendingClient provides access to trending provider methods (if applicable).
	// This is set for plugins with the "trending" category.
	TrendingClient pluginv1.TrendingProviderServiceClient

	// Health tracks the plugin's current health status.
	Health Health

	// Categories lists which interfaces this plugin implements.
	Categories []Category
	// contains filtered or unexported fields
}

Instance represents a loaded and running plugin.

func (*Instance) GetHealthStatus

func (p *Instance) GetHealthStatus() pluginv1.HealthStatus_Status

GetHealthStatus returns the current health status.

func (*Instance) HasCategory

func (p *Instance) HasCategory(cat Category) bool

HasCategory returns true if the instance has the specified category.

func (*Instance) IsHealthy

func (p *Instance) IsHealthy() bool

IsHealthy returns true if the plugin is in a healthy state.

func (*Instance) UpdateHealth

func (p *Instance) UpdateHealth(status pluginv1.HealthStatus_Status, message string)

UpdateHealth updates the plugin's health status.

Jump to

Keyboard shortcuts

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