registry

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package registry manages LLM provider connectors

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCatalogRequired reports an absent Starmap control plane.
	ErrCatalogRequired = errors.New("registry catalog is required")
	// ErrProvidersRequired reports an empty provider registration set.
	ErrProvidersRequired = errors.New("at least one provider registration is required")
	// ErrProviderRequired reports a registration without a provider ID.
	ErrProviderRequired = errors.New("provider registration name is required")
	// ErrConnectorRequired reports a registration without a connector.
	ErrConnectorRequired = errors.New("provider connector is required")
	// ErrCredentialSourceRequired reports a production registration without a
	// request-time material source.
	ErrCredentialSourceRequired = errors.New("provider credential material source is required")
	// ErrRegistryStarted reports a second start request.
	ErrRegistryStarted = errors.New("registry already started")
	// ErrRegistryClosed reports an operation after registry shutdown.
	ErrRegistryClosed = errors.New("registry is closed")
)

Functions

This section is empty.

Types

type Candidate added in v1.0.2

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

Candidate owns a complete runtime generation until publication or close.

func (*Candidate) Availability added in v1.0.2

func (c *Candidate) Availability() []runtimecatalog.AdapterAvailability

Availability returns the complete adapter projection for catalog validation.

func (*Candidate) Close added in v1.0.2

func (c *Candidate) Close() error

Close releases an unpublished candidate.

type Lease added in v1.0.2

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

Lease retains one complete generation for one request.

func (*Lease) Get added in v1.0.2

func (l *Lease) Get(provider string) connectors.Connector

Get returns a connector from the leased generation.

func (*Lease) Release added in v1.0.2

func (l *Lease) Release()

Release ends the request lease. The last old-generation lease closes its connectors after replacement.

func (*Lease) ResolveMaterial added in v1.0.2

func (l *Lease) ResolveMaterial(
	ctx context.Context,
	provider string,
) (credentials.Material, error)

ResolveMaterial resolves material from the leased generation.

func (*Lease) Snapshot added in v1.0.2

func (l *Lease) Snapshot() *runtimecatalog.RoutableSnapshot

Snapshot returns the newest availability view for the leased catalog generation. During replacement, it returns the retained complete snapshot.

type ProviderMetadata

type ProviderMetadata struct {
	ID           string
	Name         string
	URL          string
	Models       []string
	Capabilities []string
	RequiresAuth bool
}

ProviderMetadata contains catalog facts needed by gateway provider discovery.

type Registration

type Registration struct {
	Provider         string
	Connector        connectors.Connector
	Operations       []starmapcatalogs.ProviderOperation
	EndpointTypes    []starmapcatalogs.EndpointType
	BaseURL          string
	EndpointBindings map[string]string
	RequiresAuth     bool
	CredentialSource credentials.MaterialSource
}

Registration binds one configured connector to a provider ID.

type Registry

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

Registry manages provider connectors and their lifecycle

func NewEmpty

func NewEmpty() *Registry

NewEmpty creates an empty registry without initialization Useful for testing

func NewEmptyWithCatalog

func NewEmptyWithCatalog(catalogPlane *runtimecatalog.ControlPlane) *Registry

NewEmptyWithCatalog creates an empty registry with a catalog control plane.

func Open

func Open(catalogPlane *runtimecatalog.ControlPlane, registrations []Registration) (*Registry, error)

Open creates a registry from explicit production registrations.

func (*Registry) AcquireRuntime added in v1.0.2

func (r *Registry) AcquireRuntime() (connectors.RuntimeLease, error)

AcquireRuntime retains the current complete generation until Release.

func (*Registry) Catalog

func (r *Registry) Catalog() *runtimecatalog.ControlPlane

Catalog returns the registry's shared catalog control plane.

func (*Registry) Close

func (r *Registry) Close() error

Close closes all connectors

func (*Registry) Get

func (r *Registry) Get(provider string) (connectors.Connector, error)

Get retrieves a connector by provider name

func (*Registry) GetAll

func (r *Registry) GetAll() map[string]connectors.Connector

GetAll returns all registered connectors

func (*Registry) GetProviderMetadata

func (r *Registry) GetProviderMetadata() []ProviderMetadata

GetProviderMetadata returns Starmap metadata for registered providers.

func (*Registry) GetProviderMetadataForRuntime added in v1.0.2

func (r *Registry) GetProviderMetadataForRuntime(
	lease connectors.RuntimeLease,
) []ProviderMetadata

GetProviderMetadataForRuntime returns provider facts from one retained request generation. The caller owns the lease lifecycle.

func (*Registry) HasProvider

func (r *Registry) HasProvider(provider string) bool

HasProvider checks if a provider is registered

func (*Registry) IsProviderConfigured

func (r *Registry) IsProviderConfigured(provider string) bool

IsProviderConfigured reports whether app composition registered the provider.

func (*Registry) ListProviders

func (r *Registry) ListProviders() []string

ListProviders returns a list of registered provider names

func (*Registry) Prepare added in v1.0.2

func (r *Registry) Prepare(registrations []Registration) (*Candidate, error)

Prepare validates and owns a complete replacement generation.

func (*Registry) Publish added in v1.0.2

func (r *Registry) Publish(
	candidate *Candidate,
	snapshot *runtimecatalog.RoutableSnapshot,
) error

Publish atomically installs a validated generation and drains its predecessor.

func (*Registry) Register

func (r *Registry) Register(provider string, connector connectors.Connector) error

Register adds a connector to the registry

func (*Registry) ResolveMaterial added in v1.0.2

func (r *Registry) ResolveMaterial(ctx context.Context, provider string) (credentials.Material, error)

ResolveMaterial resolves request-bound inference material for one exact registered provider.

func (*Registry) Snapshot added in v1.0.2

func (r *Registry) Snapshot() *runtimecatalog.RoutableSnapshot

Snapshot returns one complete current runtime snapshot.

func (*Registry) Start

func (r *Registry) Start(ctx context.Context) error

Start seals the registry against later registrations.

Jump to

Keyboard shortcuts

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