extension

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 20 Imported by: 1 module, 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 extension registers extension contracts independently of package lifecycle code.

Index

Constants

View Source
const (
	ComponentDiscovery   = "component.discovery"
	ComponentValidation  = "component.validation"
	ComponentPreparation = "component.preparation"
	ComponentState       = "component.state"
)

Variables

This section is empty.

Functions

func CompileSchema

func CompileSchema(directory, path string) (*jsonschema.Schema, error)

CompileSchema resolves references only within the package; validation never fetches the network.

func ComponentModes

func ComponentModes(metadata map[string]any) ([]string, error)

ComponentModes returns the execution modes a configuration export declares. An export that declares none supports only the native mode.

func IsComponent

func IsComponent(capability string) bool

IsComponent reports whether a capability supplies component configuration.

func ValidateAuth

func ValidateAuth(binding Binding) error

ValidateAuth verifies the package's configuration schema and credential declarations.

func ValidateCommand

func ValidateCommand(binding Binding) error

ValidateCommand checks command metadata without running its executable.

func ValidateComponent

func ValidateComponent(binding Binding) error

ValidateComponent checks configuration-provider metadata without starting code.

Types

type Activation

type Activation struct {
	Binding
	Package     string
	Executable  string
	Description *pluginv1.DescribeResponse
	// Alias is the package's key under plugins.packages, used to name its configuration in errors.
	Alias string
	// Timeout bounds every call into the plugin; zero means no deadline.
	Timeout time.Duration
	// InteractionLimit bounds how long an interactive call may wait for the user on top of
	// Timeout; zero means the runtime default.
	InteractionLimit time.Duration
}

Activation binds a statically validated export to its verified native package.

type Binding

type Binding struct {
	Capability string
	Name       string
	Directory  string
	Metadata   map[string]any
}

Binding describes one statically validated export in an installed package.

type Descriptor

type Descriptor struct {
	Capability string
	Path       []string
	Version    uint32
	Validate   func(Binding) error
	Activate   func(context.Context, *Activation) error
	Scaffold   string
	Test       func(context.Context, Binding) error
}

Descriptor supplies extension-specific validation, activation, scaffolding, and conformance hooks. Discovery and installation use only static validation.

type Registry

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

Registry owns descriptors for supported extension contracts.

func New

func New() *Registry

New creates an empty descriptor registry for explicit startup composition.

func (*Registry) Discover

func (r *Registry) Discover(capabilities map[string]any) ([]Binding, error)

Discover reads export selectors for catalog metadata without resolving schemas. Discovery never implies that a package is installable or trusted.

func (*Registry) Get

func (r *Registry) Get(capability string) (Descriptor, bool)

Get returns a descriptor with an isolated metadata path.

func (*Registry) Register

func (r *Registry) Register(descriptor Descriptor) error

Register adds a capability selector and rejects overlapping metadata paths.

func (*Registry) Validate

func (r *Registry) Validate(directory string, capabilities map[string]any) ([]Binding, error)

Validate discovers every declared export and rejects unsupported metadata. A package is accepted as a whole before any adapter is activated.

Jump to

Keyboard shortcuts

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