extension

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 6 Imported by: ? 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 extension provides rollback-aware lifecycle management for narrow provider, tool, context, and skill registries. It is not a general plugin SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTransaction

func ApplyTransaction(ctx context.Context, steps []Step) error

Types

type Contribution

type Contribution[T any] struct {
	ID           string
	Version      string
	Owner        string
	Trust        Trust
	Dependencies []string
	Value        T
	Activate     func(context.Context, T) error
	Deactivate   func(context.Context, T) error
	Health       func(context.Context, T) error
}

type Registry

type Registry[T any] struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry[T any]() *Registry[T]

func (*Registry[T]) ActivateAll

func (r *Registry[T]) ActivateAll(ctx context.Context, ids []string) error

ActivateAll activates a dependency-ordered list atomically. Earlier activations are rolled back if a later contribution fails.

func (*Registry[T]) ActiveSnapshot

func (r *Registry[T]) ActiveSnapshot() map[string]Contribution[T]

ActiveSnapshot returns stable active contributions for one admitted run.

func (*Registry[T]) CheckHealth

func (r *Registry[T]) CheckHealth(ctx context.Context) []Status

CheckHealth probes every active extension. Failures are deactivated and quarantined so later snapshots cannot keep exposing a broken capability.

func (*Registry[T]) Quarantine

func (r *Registry[T]) Quarantine(id, reason string) error

func (*Registry[T]) QuarantineContext

func (r *Registry[T]) QuarantineContext(ctx context.Context, id, reason string) error

QuarantineContext disables an active contribution before excluding it from future snapshots.

func (*Registry[T]) Register

func (r *Registry[T]) Register(contribution Contribution[T]) error

func (*Registry[T]) Statuses

func (r *Registry[T]) Statuses() []Status

func (*Registry[T]) Unregister

func (r *Registry[T]) Unregister(ctx context.Context, id string) error

func (*Registry[T]) Update

func (r *Registry[T]) Update(ctx context.Context, replacement Contribution[T]) error

Update replaces one contribution transactionally. The previous active version is restored if the replacement cannot activate.

type State

type State string
const (
	StateRegistered  State = "registered"
	StateActive      State = "active"
	StateUnhealthy   State = "unhealthy"
	StateQuarantined State = "quarantined"
)

type Status

type Status struct {
	ID           string    `json:"id"`
	Version      string    `json:"version"`
	Owner        string    `json:"owner"`
	Trust        Trust     `json:"trust"`
	State        State     `json:"state"`
	LastError    string    `json:"last_error,omitempty"`
	LastHealthAt time.Time `json:"last_health_at,omitempty"`
}

type Step

type Step struct {
	Name     string
	Apply    func(context.Context) error
	Rollback func(context.Context) error
}

Step lets a host coordinate changes across provider, tool, context, and skill registries while retaining reverse-order rollback.

type Trust

type Trust string
const (
	TrustBuiltin    Trust = "builtin"
	TrustHost       Trust = "host"
	TrustThirdParty Trust = "third_party"
)

Jump to

Keyboard shortcuts

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