botagents

package
v0.19.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RuntimeACP          = "acp"
	MetadataProviderKey = "provider"
)

Variables

View Source
var (
	ErrNotFound        = errors.New("bot agent not found")
	ErrNameTaken       = errors.New("bot agent name already taken")
	ErrInvalidRuntime  = errors.New("invalid bot agent runtime")
	ErrInvalidMetadata = errors.New("invalid bot agent metadata")
	ErrDefaultInUse    = errors.New("default bot agent cannot be disabled or deleted")
	ErrUnavailable     = errors.New("bot agent is unavailable")
)

Functions

func ValidateConfiguration

func ValidateConfiguration(agent BotAgent, botMetadata map[string]any) error

ValidateConfiguration validates the shared per-provider bot metadata without consulting the legacy metadata enabled flag. BotAgent.Enabled is now the availability source of truth.

Types

type BotAgent

type BotAgent struct {
	ID        string         `json:"id"`
	BotID     string         `json:"bot_id"`
	Name      string         `json:"name"`
	Runtime   string         `json:"runtime"`
	Enabled   bool           `json:"enabled"`
	Metadata  map[string]any `json:"metadata"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt *time.Time     `json:"deleted_at,omitempty"`
}

BotAgent is a user-managed Agent entry attached to a bot. Native is the built-in fallback and is intentionally represented by the absence of a row.

type ConfigurationError

type ConfigurationError struct {
	Field string
}

func (*ConfigurationError) Error

func (e *ConfigurationError) Error() string

type CreateRequest

type CreateRequest struct {
	Name     string         `json:"name"`
	Runtime  string         `json:"runtime"`
	Metadata map[string]any `json:"metadata"`
}

type Descriptor

type Descriptor struct {
	BotAgentID string
	Runtime    string
	Provider   string
}

Descriptor is the stable runtime selection projected into a session. The provider is temporary ACP compatibility metadata, not a first-class model.

func DescriptorFor

func DescriptorFor(agent BotAgent) (Descriptor, error)

type ListResponse

type ListResponse struct {
	Items []BotAgent `json:"items"`
}

type Service

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

func NewService

func NewService(log *slog.Logger, q queries) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, botID string, req CreateRequest) (BotAgent, error)

func (*Service) Delete

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

func (*Service) FindActiveByProvider

func (s *Service) FindActiveByProvider(ctx context.Context, botID, provider string) (BotAgent, error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, botID, id string) (BotAgent, error)

func (*Service) GetActive

func (s *Service) GetActive(ctx context.Context, botID, id string) (BotAgent, error)

GetActive is used for new defaults and new sessions. Existing sessions may keep using Get so disabling an Agent does not terminate established work.

func (*Service) List

func (s *Service) List(ctx context.Context, botID string) ([]BotAgent, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, botID, id string, req UpdateRequest) (BotAgent, error)

type UpdateRequest

type UpdateRequest struct {
	Name    *string `json:"name,omitempty"`
	Enabled *bool   `json:"enabled,omitempty"`
}

Jump to

Keyboard shortcuts

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