bundles

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BundleResourceKind is the canonical desired-state kind for extension bundles.
	BundleResourceKind resources.ResourceKind = "bundle"
	// BundleActivationResourceKind is the canonical desired-state kind for active bundle profiles.
	BundleActivationResourceKind resources.ResourceKind = "bundle.activation"

	BundleActivationOwnerKind resources.ResourceOwnerKind = "bundle.activation"
)
View Source
const (
	ScopeGlobal    = modelpkg.ScopeGlobal
	ScopeWorkspace = modelpkg.ScopeWorkspace
)

Variables

View Source
var (
	ErrActivationNotFound     = modelpkg.ErrActivationNotFound
	ErrBundleNotFound         = errors.New("bundles: bundle not found")
	ErrProfileNotFound        = errors.New("bundles: profile not found")
	ErrDefaultChannelBusy     = errors.New("bundles: effective default channel is already claimed")
	ErrWebhookUnsupported     = errors.New("bundles: bundle webhook triggers are not supported")
	ErrAgentConflict          = errors.New("bundles: bundle agent conflicts with an existing agent")
	ErrAgentReferenceNotFound = errors.New("bundles: bundle automation references an unavailable agent")
)

Functions

func ActivationResourceID

func ActivationResourceID(
	extensionName string,
	bundleName string,
	profileName string,
	scope Scope,
	workspaceID string,
) string

ActivationResourceID returns the stable canonical resource ID for one bundle profile activation.

func BundleResourceID

func BundleResourceID(extensionName string, bundleName string) string

BundleResourceID returns the stable canonical resource ID for one extension bundle.

func NewActivationResourceCodec

func NewActivationResourceCodec() (resources.KindCodec[ActivationResourceSpec], error)

NewActivationResourceCodec builds the typed codec for bundle.activation records.

func NewBundleResourceCodec

func NewBundleResourceCodec() (resources.KindCodec[BundleResourceSpec], error)

NewBundleResourceCodec builds the typed codec for bundle records.

Types

type ActivateRequest

type ActivateRequest struct {
	ExtensionName               string
	BundleName                  string
	ProfileName                 string
	Scope                       Scope
	Workspace                   string
	BindPrimaryChannelAsDefault bool
}

type Activation

type Activation = modelpkg.Activation

type ActivationPreview

type ActivationPreview struct {
	Activation Activation
	Bundle     extensionpkg.BundleSpec
	Profile    extensionpkg.BundleProfile
	Inventory  []InventoryItem
}

type ActivationResourceSpec

type ActivationResourceSpec struct {
	ExtensionName               string `json:"extension_name"`
	BundleName                  string `json:"bundle_name"`
	ProfileName                 string `json:"profile_name"`
	SpecContentHash             string `json:"spec_content_hash,omitempty"`
	BindPrimaryChannelAsDefault bool   `json:"bind_primary_channel_default"`
}

ActivationResourceSpec is the canonical desired-state payload for bundle activation records.

type BundleActivationResourcePlan

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

BundleActivationResourcePlan is the owned-resource composition plan produced from bundle.activation records.

func (*BundleActivationResourcePlan) Kind

func (*BundleActivationResourcePlan) OperationCount

func (p *BundleActivationResourcePlan) OperationCount() int

func (*BundleActivationResourcePlan) Revision

func (p *BundleActivationResourcePlan) Revision() int64

type BundleResourceSpec

type BundleResourceSpec struct {
	ExtensionName              string                  `json:"extension_name"`
	Bundle                     extensionpkg.BundleSpec `json:"bundle"`
	OwnerBridgePlatform        string                  `json:"owner_bridge_platform,omitempty"`
	OwnerProvidesBridgeAdapter bool                    `json:"owner_provides_bridge_adapter,omitempty"`
}

BundleResourceSpec is the canonical desired-state payload for bundle catalog records.

type CatalogEntry

type CatalogEntry struct {
	ExtensionName string
	Bundle        extensionpkg.BundleSpec
}

type DeclaredChannel

type DeclaredChannel struct {
	ActivationID  string
	ExtensionName string
	BundleName    string
	ProfileName   string
	WorkspaceID   string
	Name          string
	Description   string
	Primary       bool
}

type ExtensionInfoLister

type ExtensionInfoLister interface {
	List() ([]extensionpkg.ExtensionInfo, error)
}

type ExtensionLoader

type ExtensionLoader func(ctx context.Context, name string) (*extensionpkg.Extension, error)

type InventoryItem

type InventoryItem = modelpkg.InventoryItem

type NetworkSettings

type NetworkSettings struct {
	ConfiguredDefaultChannel string
	EffectiveDefaultChannel  string
	EffectiveDefaultSource   string
	DeclaredChannels         []DeclaredChannel
}

type Option

type Option func(*Service)

func WithConfiguredDefaultChannel

func WithConfiguredDefaultChannel(channel string) Option

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithNow

func WithNow(now func() time.Time) Option

func WithWorkspaceResolver

func WithWorkspaceResolver(resolver workspacepkg.RuntimeResolver) Option

type ResourceStore

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

ResourceStore persists bundles, activations, and owned activation fan-out through canonical resources.

func NewResourceStore

func NewResourceStore(cfg ResourceStoreConfig) (*ResourceStore, error)

NewResourceStore constructs a resource-backed bundle store.

func (*ResourceStore) ApplyBundleActivationResources

func (s *ResourceStore) ApplyBundleActivationResources(
	ctx context.Context,
	plan BundleActivationResourcePlan,
) error

func (*ResourceStore) CreateBundleActivation

func (s *ResourceStore) CreateBundleActivation(ctx context.Context, activation Activation) error

func (*ResourceStore) DeleteBundleActivation

func (s *ResourceStore) DeleteBundleActivation(ctx context.Context, id string) error

func (*ResourceStore) GetBundleActivation

func (s *ResourceStore) GetBundleActivation(ctx context.Context, id string) (Activation, error)

func (*ResourceStore) ListAgentResources

func (s *ResourceStore) ListAgentResources(
	ctx context.Context,
) ([]resources.Record[aghconfig.AgentDef], error)

func (*ResourceStore) ListBundleActivationInventory

func (s *ResourceStore) ListBundleActivationInventory(
	ctx context.Context,
	activationID string,
) ([]InventoryItem, error)

func (*ResourceStore) ListBundleActivations

func (s *ResourceStore) ListBundleActivations(ctx context.Context) ([]Activation, error)

func (*ResourceStore) ListBundleResources

func (s *ResourceStore) ListBundleResources(
	ctx context.Context,
) ([]resources.Record[BundleResourceSpec], error)

func (*ResourceStore) UpdateBundleActivation

func (s *ResourceStore) UpdateBundleActivation(ctx context.Context, activation Activation) error

type Scope

type Scope = modelpkg.Scope

type Service

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

func NewService

func NewService(store Store, extensions ExtensionInfoLister, loadExtension ExtensionLoader, opts ...Option) *Service

func (*Service) Activate

func (s *Service) Activate(ctx context.Context, req ActivateRequest) (ActivationPreview, error)

func (*Service) Apply

func (s *Service) Apply(ctx context.Context, plan resources.ProjectionPlan) error

Apply writes owned automation and bridge desired-state records through canonical stores.

func (*Service) Build

func (s *Service) Build(
	ctx context.Context,
	activationRecords []resources.Record[ActivationResourceSpec],
	bundleRecords []resources.Record[BundleResourceSpec],
) (resources.ProjectionPlan, error)

Build composes active bundle activations with bundle catalog dependency records.

func (*Service) Catalog

func (s *Service) Catalog(ctx context.Context) ([]CatalogEntry, error)

func (*Service) Deactivate

func (s *Service) Deactivate(ctx context.Context, id string) error

func (*Service) GetActivation

func (s *Service) GetActivation(ctx context.Context, id string) (ActivationPreview, error)

func (*Service) ListActivations

func (s *Service) ListActivations(ctx context.Context) ([]ActivationPreview, error)

func (*Service) NetworkSettings

func (s *Service) NetworkSettings(ctx context.Context) (NetworkSettings, error)

func (*Service) PreviewActivation

func (s *Service) PreviewActivation(ctx context.Context, req ActivateRequest) (ActivationPreview, error)

func (*Service) Reconcile

func (s *Service) Reconcile(ctx context.Context) error

func (*Service) UpdateActivation

func (s *Service) UpdateActivation(ctx context.Context, req UpdateActivationRequest) (ActivationPreview, error)

type Store

type Store interface {
	CreateBundleActivation(ctx context.Context, activation Activation) error
	UpdateBundleActivation(ctx context.Context, activation Activation) error
	DeleteBundleActivation(ctx context.Context, id string) error
	GetBundleActivation(ctx context.Context, id string) (Activation, error)
	ListBundleActivations(ctx context.Context) ([]Activation, error)
	ListBundleActivationInventory(ctx context.Context, activationID string) ([]InventoryItem, error)
	ListBundleResources(ctx context.Context) ([]resources.Record[BundleResourceSpec], error)
	ListAgentResources(ctx context.Context) ([]resources.Record[aghconfig.AgentDef], error)
	ApplyBundleActivationResources(ctx context.Context, plan BundleActivationResourcePlan) error
}

type UpdateActivationRequest

type UpdateActivationRequest struct {
	ID                          string
	BindPrimaryChannelAsDefault bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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