plugin

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plugin implements provider binding via capability handles (PLUGIN-005): components bind to providers exclusively through PLUGIN-001 handles, so removing a provider degrades only its dependents.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRuntimeUnsupported       = errors.New("plugin: runtime not supported")
	ErrArtifactChecksumMismatch = errors.New("plugin: artifact checksum mismatch")
	ErrCapabilityNotGranted     = errors.New("plugin: capability not granted")
)

Typed seam errors. Callers match via errors.Is/As, never string matching.

Functions

func VerifyChecksum

func VerifyChecksum(unit ComponentUnit) error

VerifyChecksum checks unit.Artifact against unit.Checksum (SHA-256 hex).

Types

type Binder

type Binder interface {
	Bind(ctx contract.OperationContext, manifests []component.Manifest, factories []ProviderFactory) (BindingReport, error)
}

Binder resolves component requirements against provider factories.

func NewBinder

func NewBinder(strategy BindingStrategy) Binder

NewBinder returns a binder with the given strategy.

type Binding

type Binding struct {
	Component  string
	Capability contract.CapabilityName
	Handle     contract.CapabilityHandle
}

Binding is one satisfied requirement: a component's requirement resolved to a concrete handle.

type BindingReport

type BindingReport struct {
	Bound    []Binding
	Degraded []Degradation
}

BindingReport is the outcome of a bind pass.

type BindingStrategy

type BindingStrategy int

BindingStrategy selects strict vs degraded behavior.

const (
	StrategyDegraded BindingStrategy = iota // missing capability degrades, others stay live
	StrategyStrict                          // any unmet requirement aborts
)

type ComponentUnit

type ComponentUnit struct {
	Name     string
	Runtime  string
	Artifact []byte
	Checksum string
}

ComponentUnit is the artifact + manifest a runtime compiles.

type Degradation

type Degradation struct {
	Component  string
	Capability contract.CapabilityName
	Reason     string // "provider-absent" | "provider-unhealthy"
}

Degradation is one unmet requirement.

type ErrUnsatisfiedRequirement

type ErrUnsatisfiedRequirement struct {
	Component  string
	Capability contract.CapabilityName
}

ErrUnsatisfiedRequirement is a typed strict-binding failure.

func (*ErrUnsatisfiedRequirement) Error

func (e *ErrUnsatisfiedRequirement) Error() string

type InvokeCall

type InvokeCall struct {
	Function string
	Args     []byte
}

InvokeCall is one serialized invocation request.

type InvokeResult

type InvokeResult struct {
	Value    []byte
	Evidence effect.CleanupEvidence
}

InvokeResult is a serialized result plus cleanup evidence.

type ProviderFactory

type ProviderFactory interface {
	Capability() contract.CapabilityName
	Open(ctx contract.OperationContext) (contract.CapabilityHandle, error)
}

ProviderFactory exposes one provider as a capability handle.

func NewStaticFactory

func NewStaticFactory(cap contract.CapabilityName, err error) ProviderFactory

NewStaticFactory returns a factory for cap whose Open returns a no-op handle (or err when supplied).

type RuntimeProvider

type RuntimeProvider interface {
	ID() string
	Compile(unit ComponentUnit) error
	Execute(ctx contract.OperationContext, call InvokeCall, handles []contract.CapabilityHandle) (InvokeResult, error)
	Shutdown(ctx contract.OperationContext) error
}

RuntimeProvider is the seam any execution backend implements.

type StaticFactory

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

StaticFactory is a ProviderFactory backed by a fixed capability and optional open error (for tests).

func (*StaticFactory) Capability

func (f *StaticFactory) Capability() contract.CapabilityName

func (*StaticFactory) Open

type StubProvider

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

StubProvider is an in-process fake of a WASM-like runtime (PLUGIN-008). It enforces the seam's serialization-only rule: Execute returns JSON-encoded bytes and never passes host pointers or closures across the boundary. It proves the RuntimeProvider contract is implementable by a non-Goja backend.

func NewStubProvider

func NewStubProvider(id string, required contract.CapabilityName) *StubProvider

NewStubProvider returns a stub runtime with the given ID. required is the capability Execute insists on (deny-by-default at the seam).

func (*StubProvider) Compile

func (s *StubProvider) Compile(unit ComponentUnit) error

func (*StubProvider) Execute

func (*StubProvider) ID

func (s *StubProvider) ID() string

func (*StubProvider) Shutdown

func (s *StubProvider) Shutdown(ctx contract.OperationContext) error

Jump to

Keyboard shortcuts

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