pluginhost

package
v7.1.57 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePluginID

func ValidatePluginID(id string) bool

ValidatePluginID reports whether id can be used as a plugin configuration key.

Types

type AuthModelResult

type AuthModelResult struct {
	Provider string
	Models   []*registry.ModelInfo
	Auth     *coreauth.Auth
	Handled  bool
	Err      error
}

type Host

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

func New

func New() *Host

func NewForTest

func NewForTest(loader pluginLoader) *Host

func (*Host) ApplyConfig

func (h *Host) ApplyConfig(ctx context.Context, cfg *config.Config)

func (*Host) AuthDataToCoreAuth

func (h *Host) AuthDataToCoreAuth(data pluginapi.AuthData, path, fileName string) *coreauth.Auth

func (*Host) AuthProviderIdentifiers

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

func (*Host) ExecuteCommandLine

func (h *Host) ExecuteCommandLine(ctx context.Context, program string, args []string, configPath string, flagSet *flag.FlagSet) (int, bool)

ExecuteCommandLine runs all enabled plugins whose command-line flags were provided.

func (*Host) HasAuthProvider

func (h *Host) HasAuthProvider(provider string) bool

func (*Host) HasExecutorCandidateProvider

func (h *Host) HasExecutorCandidateProvider(provider string) bool

func (*Host) HasScheduler added in v7.1.57

func (h *Host) HasScheduler() bool

func (*Host) HasStreamInterceptors added in v7.1.55

func (h *Host) HasStreamInterceptors() bool

func (*Host) HasTriggeredCommandLineFlags

func (h *Host) HasTriggeredCommandLineFlags() bool

HasTriggeredCommandLineFlags reports whether any plugin-owned flag was provided.

func (*Host) InterceptRequest added in v7.1.55

func (*Host) InterceptResponse added in v7.1.55

func (*Host) InterceptStreamChunk added in v7.1.55

func (*Host) ModelsForAuth

func (h *Host) ModelsForAuth(ctx context.Context, auth *coreauth.Auth) AuthModelResult

func (*Host) ModelsForProvider

func (h *Host) ModelsForProvider(provider string) []*registry.ModelInfo

func (*Host) NormalizeRequest

func (h *Host) NormalizeRequest(ctx context.Context, from, to sdktranslator.Format, model string, body []byte, stream bool) []byte

func (*Host) NormalizeResponseAfter

func (h *Host) NormalizeResponseAfter(ctx context.Context, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) []byte

func (*Host) NormalizeResponseBefore

func (h *Host) NormalizeResponseBefore(ctx context.Context, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) []byte

func (*Host) ParseAuth

func (h *Host) ParseAuth(ctx context.Context, req pluginapi.AuthParseRequest) (*coreauth.Auth, bool, error)

func (*Host) PickAuth added in v7.1.57

func (*Host) PollLogin

func (h *Host) PollLogin(ctx context.Context, provider, state string, metadata ...map[string]any) (pluginapi.AuthLoginPollResponse, bool, error)

func (*Host) RegisterCommandLineFlags

func (h *Host) RegisterCommandLineFlags(ctx context.Context, flagSet *flag.FlagSet)

RegisterCommandLineFlags exposes plugin-declared flags on the provided FlagSet.

func (*Host) RegisterExecutors

func (h *Host) RegisterExecutors(manager executorManager, modelRegistry modelProviderRegistry)

func (*Host) RegisterFrontendAuthProviders

func (h *Host) RegisterFrontendAuthProviders()

func (*Host) RegisterManagementRoutes

func (h *Host) RegisterManagementRoutes(ctx context.Context, reserved map[string]struct{})

RegisterManagementRoutes rebuilds the plugin-owned Management API route table.

func (*Host) RegisterModels

func (h *Host) RegisterModels(ctx context.Context, modelRegistry modelRegistry)

func (*Host) RegisterUsagePlugins

func (h *Host) RegisterUsagePlugins()

func (*Host) RegisteredPlugins

func (h *Host) RegisteredPlugins() []RegisteredPluginInfo

RegisteredPlugins returns a stable copy of plugin metadata in the current runtime snapshot.

func (*Host) ServeManagementHTTP

func (h *Host) ServeManagementHTTP(w http.ResponseWriter, r *http.Request) bool

ServeManagementHTTP dispatches an authenticated Management API request to a plugin route.

func (*Host) ShutdownAll added in v7.1.48

func (h *Host) ShutdownAll()

ShutdownAll removes active plugin capabilities and closes all loaded dynamic libraries.

func (*Host) Snapshot

func (h *Host) Snapshot() *Snapshot

func (*Host) StartLogin

func (h *Host) StartLogin(ctx context.Context, provider string, baseURL string) (pluginapi.AuthLoginStartResponse, bool, error)

func (*Host) TranslateRequest

func (h *Host) TranslateRequest(ctx context.Context, from, to sdktranslator.Format, model string, body []byte, stream bool) ([]byte, bool)

func (*Host) TranslateResponse

func (h *Host) TranslateResponse(ctx context.Context, from, to sdktranslator.Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) ([]byte, bool)

type PluginFileInfo

type PluginFileInfo struct {
	ID   string
	Path string
}

PluginFileInfo describes a plugin binary selected by the host discovery rules.

func DiscoverPluginFiles

func DiscoverPluginFiles(root string) ([]PluginFileInfo, error)

DiscoverPluginFiles returns plugin binaries selected by the current host discovery rules.

type RegisteredPluginInfo

type RegisteredPluginInfo struct {
	ID            string
	Priority      int
	Metadata      pluginapi.Metadata
	SupportsOAuth bool
	Menus         []RegisteredPluginMenu
}

RegisteredPluginInfo describes a plugin that is active in the current runtime snapshot.

type RegisteredPluginMenu

type RegisteredPluginMenu struct {
	Path        string
	Menu        string
	Description string
}

RegisteredPluginMenu describes a plugin-owned GET Management API menu entry.

type Snapshot

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

Jump to

Keyboard shortcuts

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