pluginhost

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthService

func NewAuthService(store auth.AuthStore) pkgplugins.Auth

Types

type ChannelPlatform

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

ChannelPlatform is a mutable host extension bag for managed channel runtimes.

func NewChannelRuntimeServices

func NewChannelRuntimeServices() *ChannelPlatform

func (*ChannelPlatform) Handler

func (s *ChannelPlatform) Handler() pkgchannel.Handler

func (*ChannelPlatform) Notifications

func (s *ChannelPlatform) Notifications() pkgplugins.ChannelRegistry

func (*ChannelPlatform) ParentContext

func (s *ChannelPlatform) ParentContext() context.Context

func (*ChannelPlatform) Set

func (s *ChannelPlatform) Set(parent context.Context, handler pkgchannel.Handler, notifications pkgplugins.ChannelRegistry)

type ConfigBackend

type ConfigBackend interface {
	Get(ctx context.Context, pluginID string) (pkgplugins.PluginState, error)
	Set(ctx context.Context, pluginID string, config map[string]any) error
	SetEnabled(ctx context.Context, pluginID string, enabled bool) error
}

ConfigBackend is the host-owned unscoped plugin config backend.

type Host

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

func New

func New(store config.Store, opts ...Option) *Host

func (*Host) AddAdmin

func (h *Host) AddAdmin(reg pkgplugins.AdminSpec)

func (*Host) AddAfterToolResult

func (h *Host) AddAfterToolResult(reg pkgplugins.AfterToolResultSpec)

func (*Host) AddBeforeRun

func (h *Host) AddBeforeRun(reg pkgplugins.BeforeRunSpec)

func (*Host) AddBeforeToolCall

func (h *Host) AddBeforeToolCall(reg pkgplugins.BeforeToolCallSpec)

func (*Host) AddChannel

func (h *Host) AddChannel(reg pkgplugins.ChannelSpec)

func (*Host) AddHook

func (h *Host) AddHook(reg pkgplugins.HookSpec)

func (*Host) AddMemory

func (h *Host) AddMemory(reg pkgplugins.MemorySpec)

func (*Host) AddPromptInventory

func (h *Host) AddPromptInventory(reg pkgplugins.PromptInventorySpec)

func (*Host) AddProvider

func (h *Host) AddProvider(reg pkgplugins.ProviderSpec)

func (*Host) AddRuntime

func (h *Host) AddRuntime(reg pkgplugins.RuntimeSpec)

func (*Host) AddSystemPrompt

func (h *Host) AddSystemPrompt(reg pkgplugins.SystemPromptSpec)

func (*Host) AddTool

func (h *Host) AddTool(reg pkgplugins.ToolSpec)

func (*Host) AfterToolResult

func (*Host) ApplyChannel added in v0.10.0

func (h *Host) ApplyChannel(ctx context.Context, channel config.Channel) error

func (*Host) ApplyPlugin

func (h *Host) ApplyPlugin(ctx context.Context, pluginID string) error

func (*Host) Auth

func (h *Host) Auth() pkgplugins.Auth

Auth returns the injected auth service, if any.

func (*Host) BeforeRun

func (*Host) BuildEnabledHooks

func (h *Host) BuildEnabledHooks(ctx context.Context, bc pluginhooks.BuildContext) []hooks.HookPlugin

func (*Host) BuildEnabledTools

func (h *Host) BuildEnabledTools(ctx context.Context, bc plugintools.BuildContext) []tools.Tool

func (*Host) BuildMemory

func (h *Host) BuildMemory(ctx context.Context, name string, db *sql.DB, annaHome string, cfg map[string]any, summarizerFn func(context.Context, string) (string, error)) (memory.Provider, error)

func (*Host) BuildProvider

func (h *Host) BuildProvider(name string, stateConfig map[string]any) (providers.ProviderAdapter, error)

func (*Host) BuildProviderRegistry

func (h *Host) BuildProviderRegistry(name string, stateConfig map[string]any) (*providers.Registry, error)

func (*Host) ChannelConfigured

func (h *Host) ChannelConfigured(ctx context.Context, name string) bool

func (*Host) ChannelInstanceConfigured added in v0.10.0

func (h *Host) ChannelInstanceConfigured(channel config.Channel) bool

func (*Host) ChannelNotificationsEnabled

func (h *Host) ChannelNotificationsEnabled(ctx context.Context, name string) bool

func (*Host) ChannelRuntime

func (h *Host) ChannelRuntime() pkgplugins.ChannelPlatform

ChannelRuntime returns the injected channel runtime service extension, if any.

func (*Host) Config

func (h *Host) Config() ConfigBackend

func (*Host) ConfigSchema

func (h *Host) ConfigSchema(pluginID string) map[string]any

func (*Host) DesiredState

func (h *Host) DesiredState(ctx context.Context, pluginID string) (pkgplugins.PluginState, error)

func (*Host) HasConfig

func (h *Host) HasConfig(pluginID string) bool

func (*Host) HasRuntime

func (h *Host) HasRuntime(pluginID string) bool

func (*Host) HasStatus

func (h *Host) HasStatus(pluginID string) bool

func (*Host) ListAdminVisiblePlugins

func (h *Host) ListAdminVisiblePlugins(ctx context.Context) ([]pkgplugins.RegisteredPlugin, error)

func (*Host) ListChannels added in v0.10.0

func (h *Host) ListChannels(ctx context.Context) ([]config.Channel, error)

func (*Host) ListProviderTypes

func (h *Host) ListProviderTypes() []ProviderType

func (*Host) ListRegisteredPlugins

func (h *Host) ListRegisteredPlugins() []pkgplugins.PluginInfo

func (*Host) LoadCatalog

func (h *Host) LoadCatalog(catalog *pkgplugins.Catalog) error

func (*Host) LoadDefaultCatalog

func (h *Host) LoadDefaultCatalog() error

func (*Host) Logger

func (h *Host) Logger(pluginID string) *slog.Logger

func (*Host) ManagedPlugins

func (h *Host) ManagedPlugins() []string

func (*Host) Notifications

func (h *Host) Notifications() pkgplugins.Notifier

Notifications returns the injected notification service, if any.

func (*Host) PluginsByKind

func (h *Host) PluginsByKind(kind string) []string

func (*Host) PromptTools

func (h *Host) PromptTools(ctx context.Context, pluginID string) ([]pkgplugins.PromptToolInfo, error)

func (*Host) RedactConfig

func (h *Host) RedactConfig(pluginID string, raw map[string]any) map[string]any

func (*Host) ReflectRuntime

func (h *Host) ReflectRuntime() pkgplugins.ReflectPlatform

ReflectRuntime returns the injected reflect runtime service extension, if any.

func (*Host) RegisterPluginID

func (h *Host) RegisterPluginID(id string)

func (*Host) Runtime

func (h *Host) Runtime() pkgplugins.RuntimeLookup

func (*Host) Scheduler

func (h *Host) Scheduler() SchedulerBackend

Scheduler returns the injected scheduler backend, if any.

func (*Host) SetAuthService

func (h *Host) SetAuthService(service pkgplugins.Auth)

SetAuthService updates the auth service extension after host construction.

func (*Host) SetChannelRuntimeServices

func (h *Host) SetChannelRuntimeServices(services pkgplugins.ChannelPlatform)

SetChannelRuntimeServices updates the channel runtime service extension after host construction.

func (*Host) SetEnabled

func (h *Host) SetEnabled(ctx context.Context, pluginID string, enabled bool) error

func (*Host) SetInfo

func (h *Host) SetInfo(info pkgplugins.PluginInfo)

func (*Host) SetNotificationService

func (h *Host) SetNotificationService(service pkgplugins.Notifier)

SetNotificationService updates the notification service extension after host construction.

func (*Host) SetReflectRuntimeServices

func (h *Host) SetReflectRuntimeServices(services pkgplugins.ReflectPlatform)

SetReflectRuntimeServices updates the reflect runtime service extension after host construction.

func (*Host) SetSchedulerService

func (h *Host) SetSchedulerService(service SchedulerBackend)

SetSchedulerService updates the scheduler backend after host construction.

func (*Host) SetStateStore

func (h *Host) SetStateStore(store StateStoreBackend)

SetStateStore updates the plugin state backend after host construction.

func (*Host) StateStore

func (h *Host) StateStore() StateStoreBackend

StateStore returns the injected plugin state backend, if any.

func (*Host) Status

func (h *Host) Status(ctx context.Context, pluginID string) (any, error)

func (*Host) Stop

func (h *Host) Stop(ctx context.Context) error

func (*Host) SystemPromptSections

func (h *Host) SystemPromptSections(ctx context.Context, build pkgplugins.SystemPromptContext) ([]pkgplugins.SystemPromptSection, error)

func (*Host) ValidateConfig

func (h *Host) ValidateConfig(pluginID string, raw map[string]any) error

func (*Host) ValidateRegistrations

func (h *Host) ValidateRegistrations() error

type Option

type Option func(*Host)

func WithAuthService

func WithAuthService(service pkgplugins.Auth) Option

WithAuthService injects the narrow auth directory available to plugins.

func WithChannelRuntimeServices

func WithChannelRuntimeServices(services pkgplugins.ChannelPlatform) Option

WithChannelRuntimeServices injects the narrow services used by managed channel runtimes.

func WithNotificationService

func WithNotificationService(service pkgplugins.Notifier) Option

WithNotificationService injects the narrow notification service available to plugins.

func WithReflectRuntimeServices

func WithReflectRuntimeServices(services pkgplugins.ReflectPlatform) Option

WithReflectRuntimeServices injects the narrow services used by the reflect managed runtime.

func WithSchedulerService

func WithSchedulerService(service SchedulerBackend) Option

WithSchedulerService injects the host scheduler backend available to plugins.

func WithStateStore

func WithStateStore(store StateStoreBackend) Option

WithStateStore injects the host plugin state backend available to plugins.

type ProviderType

type ProviderType struct {
	ID         string
	Name       string
	DefaultURL string
}

type ReflectPlatform

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

ReflectPlatform is a mutable host extension bag for the reflect managed runtime.

func NewReflectRuntimeServices

func NewReflectRuntimeServices() *ReflectPlatform

func (*ReflectPlatform) BuildProviders

func (s *ReflectPlatform) BuildProviders(api, apiKey, baseURL string) (*providers.Registry, error)

func (*ReflectPlatform) Memory

func (s *ReflectPlatform) Memory() memory.Provider

func (*ReflectPlatform) ParentContext

func (s *ReflectPlatform) ParentContext() context.Context

func (*ReflectPlatform) Set

func (s *ReflectPlatform) Set(parent context.Context, mem memory.Provider, store config.Store, workspace string, buildProviders func(api, apiKey, baseURL string) (*providers.Registry, error))

func (*ReflectPlatform) Store

func (*ReflectPlatform) Workspace

func (s *ReflectPlatform) Workspace() string

type RuntimeHost

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

func NewRuntimeHost

func NewRuntimeHost(host *Host) *RuntimeHost

func (*RuntimeHost) ApplyChannel added in v0.10.0

func (h *RuntimeHost) ApplyChannel(ctx context.Context, channel config.Channel) error

func (*RuntimeHost) ApplyPlugin

func (h *RuntimeHost) ApplyPlugin(ctx context.Context, pluginID string) error

func (*RuntimeHost) Get

func (h *RuntimeHost) Get(pluginID string, runtimeName string) (pkgplugins.RuntimeHandle, bool)

func (*RuntimeHost) Lookup

func (h *RuntimeHost) Lookup(pluginID string, runtimeName string) (pkgplugins.RuntimeHandle, bool)

func (*RuntimeHost) Snapshot

func (h *RuntimeHost) Snapshot(ctx context.Context, pluginID string, runtimeName string) (pkgplugins.RuntimeStatus, error)

func (*RuntimeHost) Stop

func (h *RuntimeHost) Stop(ctx context.Context) error

type SchedulerBackend

type SchedulerBackend interface {
	ReconcilePluginJobs(ctx context.Context, pluginID string, jobs []pkgplugins.SchedulerJobSpec) error
	DeletePluginJobs(ctx context.Context, pluginID string) error
	DeletePluginJob(ctx context.Context, pluginID string, key string) error
	ListPluginJobs(ctx context.Context, pluginID string) ([]pkgplugins.SchedulerJob, error)
}

SchedulerBackend is the host-owned unscoped scheduler backend.

type StateStoreBackend

type StateStoreBackend interface {
	Get(ctx context.Context, pluginID string, scope pkgplugins.StateScope, key string) (map[string]any, bool, error)
	Set(ctx context.Context, pluginID string, scope pkgplugins.StateScope, key string, value map[string]any) error
	Delete(ctx context.Context, pluginID string, scope pkgplugins.StateScope, key string) error
}

StateStoreBackend is the host-owned unscoped plugin state backend.

Jump to

Keyboard shortcuts

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