registry

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package registry provides skill registration and discovery.

The registry is a central place to register skills and discover available tools across all registered skills.

Index

Constants

This section is empty.

Variables

View Source
var ErrSkillExists = errors.New("skill already registered")

ErrSkillExists is returned when attempting to register a skill that already exists.

View Source
var ErrSkillNotFound = errors.New("skill not found")

ErrSkillNotFound is returned when a skill is not found in the registry.

Functions

This section is empty.

Types

type InMemory

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

InMemory is a thread-safe in-memory registry implementation.

func New

func New() *InMemory

New creates a new in-memory registry.

func (*InMemory) Close

func (r *InMemory) Close() error

Close closes all registered skills.

func (*InMemory) Count

func (r *InMemory) Count() int

Count returns the number of registered skills.

func (*InMemory) Get

func (r *InMemory) Get(name string) (skill.Skill, error)

Get returns a skill by name.

func (*InMemory) GetTool

func (r *InMemory) GetTool(fullName string) (skill.Tool, error)

GetTool returns a specific tool by its full name (skillname.toolname).

func (*InMemory) Init

func (r *InMemory) Init(ctx context.Context) error

Init initializes all registered skills.

func (*InMemory) List

func (r *InMemory) List() []skill.Skill

List returns all registered skills.

func (*InMemory) ListTools

func (r *InMemory) ListTools() []skill.Tool

ListTools returns all tools across all registered skills.

func (*InMemory) Register

func (r *InMemory) Register(s skill.Skill) error

Register adds a skill to the registry.

func (*InMemory) Unregister

func (r *InMemory) Unregister(name string) error

Unregister removes a skill from the registry.

type Registry

type Registry interface {
	// Register adds a skill to the registry.
	// Returns ErrSkillExists if a skill with the same name is already registered.
	Register(s skill.Skill) error

	// Unregister removes a skill from the registry.
	// Returns ErrSkillNotFound if the skill is not registered.
	Unregister(name string) error

	// Get returns a skill by name.
	// Returns ErrSkillNotFound if the skill is not registered.
	Get(name string) (skill.Skill, error)

	// List returns all registered skills.
	List() []skill.Skill

	// ListTools returns all tools across all registered skills.
	// Tool names are prefixed with skill name: "skillname.toolname"
	ListTools() []skill.Tool

	// GetTool returns a specific tool by its full name (skillname.toolname).
	GetTool(fullName string) (skill.Tool, error)

	// Init initializes all registered skills.
	Init(ctx context.Context) error

	// Close closes all registered skills.
	Close() error
}

Registry manages skill registration and discovery.

Jump to

Keyboard shortcuts

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