pluginsvc

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package pluginsvc provides the default implementation of plugins.PluginService.

Phase 3 widens the Phase-2 build/validate/push/content surface with Install/Uninstall/List/Info and the per-client MaterializationAdapter seam. The New constructor returns plugins.PluginService, which now exposes the full lifecycle; callers pass WithStore/WithMaterializers/WithGroupManager (and the other Phase-3 options) to wire persistence and materialization.

Index

Constants

View Source
const LocalBuildAnnotation = "dev.stacklok.toolhive.local-build"

LocalBuildAnnotation marks a tag in the local OCI store as produced by `thv plugin build` rather than an OCI pull (install, content preview). The value is always "true" when set; absence means "not a local build".

This is the SAME annotation key as skillsvc.LocalBuildAnnotation. It is generic by design (reverse-DNS namespaced) so it composes with other locally-built artifact types. ListBuilds filters by isPluginArtifact before trusting it, so a skill local-build tag cannot masquerade as a plugin build and vice versa.

The annotation is stamped at the descriptor level inside the store's root index.json, not on the manifest content. Two properties follow from that:

  1. Push resolves the artifact by digest, which returns a plain descriptor (oras-go's oci.Store strips annotations when the reference is a digest), so the marker never crosses the wire.
  2. Pull calls Store.Tag with the pulled digest, which also resolves by digest before tagging, so pulled tags inherit no annotations and stay invisible to ListBuilds.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) plugins.PluginService

New creates a new plugin service and returns it as a plugins.PluginService. Callers wire persistence (WithStore), per-client materialization (WithMaterializers), group membership (WithGroupManager), git installs (WithGitClient), and registry-name lookup (WithPluginLookup) via options; the OCI store/packager/registry options carry over from Phase 2.

Types

type Option

type Option func(*service)

Option configures the plugin service.

func WithClientManager added in v0.34.0

func WithClientManager(cm *client.ClientManager) Option

WithClientManager sets the client manager used to validate that requested clients support plugins. Optional: when nil, the materializers map is the sole source of truth for plugin-supporting clients.

func WithGitClient added in v0.34.0

func WithGitClient(c git.Client) Option

WithGitClient sets a fixed git client used by the git install flow, bypassing per-clone auth resolution. Primarily used for testing with mock clients; mirrors gitresolver.WithGitClient.

func WithGroupManager added in v0.34.0

func WithGroupManager(mgr groups.Manager) Option

WithGroupManager sets the group manager for plugin group membership.

func WithMaterializers added in v0.34.0

func WithMaterializers(m map[string]plugins.MaterializationAdapter) Option

WithMaterializers sets the per-client-type materialization adapters used to install a plugin tree into a target client's directory layout.

func WithOCIStore

func WithOCIStore(store *ociplugins.Store) Option

WithOCIStore sets the local OCI store for plugin artifacts.

func WithPackager

func WithPackager(p ociplugins.PluginPackager) Option

WithPackager sets the plugin packager for building OCI artifacts.

func WithPluginLookup added in v0.34.0

func WithPluginLookup(pl PluginLookup) Option

WithPluginLookup sets the registry-based plugin lookup for name resolution.

func WithRegistryClient

func WithRegistryClient(rc ociplugins.RegistryClient) Option

WithRegistryClient sets the registry client for push/pull operations.

func WithStore added in v0.34.0

func WithStore(store storage.PluginStore) Option

WithStore sets the persistence store for installed plugins.

type PluginLookup added in v0.34.0

type PluginLookup interface {
	SearchPlugins(ctx context.Context, query string) ([]PluginSearchHit, error)
}

PluginLookup resolves a plain plugin name against a registry/index. This seam stays unwired in Wave 0; the registry-name install flow lands in a later Phase-3 wave. It mirrors skillsvc.SkillLookup.

type PluginPackage added in v0.34.0

type PluginPackage struct {
	// Reference is the full OCI reference (e.g. ghcr.io/org/plugin:v1).
	Reference string `json:"reference"`
	// Type is the package type (e.g. "oci").
	Type string `json:"type,omitempty"`
}

PluginPackage describes a single OCI package backing a plugin search hit.

type PluginSearchHit added in v0.34.0

type PluginSearchHit struct {
	// Name is the plugin name (kebab-case).
	Name string `json:"name"`
	// Description is a human-readable description of the plugin.
	Description string `json:"description,omitempty"`
	// Packages lists the OCI packages that publish this plugin.
	Packages []PluginPackage `json:"packages,omitempty"`
}

PluginSearchHit is a single result from a registry-name plugin search. It is the plugin analogue of a registry skill hit, used by the registry-name install flow that lands in a later Phase-3 wave.

Jump to

Keyboard shortcuts

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