pluginhost

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const RegistryRootKey = `` /* 174-byte string literal not displayed */

RegistryRootKey is the pinned public key for the ZTVS Registry. In a production build, this would be a real ECDSA public key.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(filepath string, url string) error

func VerifyIntegrity

func VerifyIntegrity(pluginPath, expectedChecksum string) error

VerifyIntegrity checks if the plug binary's SHA-256 hash matches the provided checksum. checksum should be in format "f2416982..." or "sha256:f2416982..."

func VerifySignature

func VerifySignature(data []byte, signature []byte) error

VerifySignature validates that the provided data was signed by the RegistryRootKey.

Types

type BinaryRunner

type BinaryRunner struct{}

BinaryRunner executes native binaries (Go, Rust).

func (*BinaryRunner) Execute

func (r *BinaryRunner) Execute(ctx context.Context, entrypoint string, stdin []byte) ([]byte, error)

func (*BinaryRunner) Name

func (r *BinaryRunner) Name() string

func (*BinaryRunner) Supports

func (r *BinaryRunner) Supports(runtimeType string) bool

func (*BinaryRunner) Validate

func (r *BinaryRunner) Validate(entrypoint string) error

type Git

type Git struct{}

Git handles git operations for plugin distribution.

func NewGit

func NewGit() *Git

func (*Git) Clone

func (g *Git) Clone(url, dest string) error

Clone clones a git repository to the specified destination.

func (*Git) Pull

func (g *Git) Pull(dest string) error

Pull updates an existing git repository in the specified destination.

func (*Git) Remove

func (g *Git) Remove(dest string) error

Remove cleans up a plugin directory (e.g., on build failure).

type Host

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

func New

func New() *Host

func (*Host) Discover

func (h *Host) Discover(ctx context.Context) ([]string, error)

func (*Host) GetManifest

func (h *Host) GetManifest(pluginPath string) (*sdk.Manifest, bool)

func (*Host) GetPluginInfo

func (h *Host) GetPluginInfo(pluginPath string) (*PluginInfo, bool)

func (*Host) Handshake

func (h *Host) Handshake(
	ctx context.Context,
	pluginPath string,
) (*rpc.HandshakeResponse, error)

func (*Host) Lockfile

func (h *Host) Lockfile() *registry.Lockfile

func (*Host) RunCheck

func (h *Host) RunCheck(
	ctx context.Context,
	pluginPath string,
	checkID string,
) (*rpc.RunCheckResponse, error)

type JavaRunner

type JavaRunner struct{}

JavaRunner is a placeholder for Java support.

func (*JavaRunner) Execute

func (r *JavaRunner) Execute(ctx context.Context, entrypoint string, stdin []byte) ([]byte, error)

func (*JavaRunner) Name

func (r *JavaRunner) Name() string

func (*JavaRunner) Supports

func (r *JavaRunner) Supports(runtimeType string) bool

func (*JavaRunner) Validate

func (r *JavaRunner) Validate(entrypoint string) error

type NodeRunner

type NodeRunner struct{}

NodeRunner is a placeholder for Node.js support.

func (*NodeRunner) Execute

func (r *NodeRunner) Execute(ctx context.Context, entrypoint string, stdin []byte) ([]byte, error)

func (*NodeRunner) Name

func (r *NodeRunner) Name() string

func (*NodeRunner) Supports

func (r *NodeRunner) Supports(runtimeType string) bool

func (*NodeRunner) Validate

func (r *NodeRunner) Validate(entrypoint string) error

type PluginInfo

type PluginInfo struct {
	Entrypoint string
	Manifest   *sdk.Manifest
	Enabled    bool
	Runner     Runner
}

type PythonRunner

type PythonRunner struct{}

PythonRunner is a placeholder for Python support.

func (*PythonRunner) Execute

func (r *PythonRunner) Execute(ctx context.Context, entrypoint string, stdin []byte) ([]byte, error)

func (*PythonRunner) Name

func (r *PythonRunner) Name() string

func (*PythonRunner) Supports

func (r *PythonRunner) Supports(runtimeType string) bool

func (*PythonRunner) Validate

func (r *PythonRunner) Validate(entrypoint string) error

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) CheckAndUpdateAll

func (r *Registry) CheckAndUpdateAll(ctx context.Context, host *Host, mode string) error

func (*Registry) FetchIndex

func (r *Registry) FetchIndex(ctx context.Context) (*registry.Index, error)

func (*Registry) GetInfo

func (r *Registry) GetInfo(ctx context.Context, name string) (*registry.PluginMetadata, error)

func (*Registry) Install

func (r *Registry) Install(ctx context.Context, pluginName string, host *Host) error

Install downloads, builds, and registers a plugin. It clones the monorepo to a temp dir, extracts the plugin subdirectory, builds it, and moves it to the final install location.

func (*Registry) PerformAtomicUpdate

func (r *Registry) PerformAtomicUpdate(ctx context.Context, name string, host *Host, meta *registry.PluginMetadata) error

func (*Registry) Search

func (r *Registry) Search(ctx context.Context, query string) ([]registry.PluginMetadata, error)

type Runner

type Runner interface {
	Name() string
	Supports(runtimeType string) bool
	Validate(entrypoint string) error
	Execute(ctx context.Context, entrypoint string, stdin []byte) ([]byte, error)
}

Runner defines the interface for different plugin execution environments.

type RunnerRegistry

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

RunnerRegistry manages the available plugin runners.

func NewRunnerRegistry

func NewRunnerRegistry() *RunnerRegistry

func (*RunnerRegistry) GetRunner

func (r *RunnerRegistry) GetRunner(runtimeType string) (Runner, error)

func (*RunnerRegistry) Register

func (r *RunnerRegistry) Register(runner Runner)

Jump to

Keyboard shortcuts

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