Help us shape the future of Go! Take the 2026 Go Developer Survey

catalog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindingForBuiltin

func BindingForBuiltin(agent BuiltinAgent) model.AgentRuntimeBinding

func BindingForCustom

func BindingForCustom(agent model.CustomAgent, revisionID string) (model.AgentRuntimeBinding, error)

func DefinitionEqual

func DefinitionEqual(a, b model.AgentRuntimeDefinition) bool

func DefinitionReservationKey

func DefinitionReservationKey(definition model.AgentRuntimeDefinition) string

func LegacyBindingForBuiltin

func LegacyBindingForBuiltin(agent BuiltinAgent, identifier string) (model.AgentRuntimeBinding, error)

func LegacyDefinition

func LegacyDefinition(command string) (model.AgentRuntimeDefinition, error)

LegacyDefinition is only used while migrating command-string sessions. New records always persist a structured definition and never pass through this parser.

func RevisionForDefinition

func RevisionForDefinition(definition model.AgentRuntimeDefinition) string

func RuntimeKey

func RuntimeKey(agentID, revision string) string

func ValidateBuiltins

func ValidateBuiltins() error

Types

type AgentCatalogRepository

type AgentCatalogRepository interface {
	Load(ctx context.Context) (*model.AgentCatalogSnapshot, error)
	Save(ctx context.Context, snapshot *model.AgentCatalogSnapshot) error
}

type BuiltinAgent

type BuiltinAgent struct {
	AgentID               string
	Bin                   string
	ACPProgram            string
	ACPArgs               []string
	Command               string
	EnvKey                string
	CLIExecutableEnv      string
	HistoricalIdentifiers []HistoricalIdentifier
	DisplayName           string
	IconURL               string
	SupportsHeadlessPrint bool
	Deprecated            bool
	Install               agentinstall.InstallSpec
}

BuiltinAgent is one built-in catalog entry. ACPProgram and ACPArgs are authoritative; Command remains the current legacy serialization consumed by runtime paths that have not moved to structured argv yet.

func BuiltinSnapshot

func BuiltinSnapshot() []BuiltinAgent

func FindBuiltinByID

func FindBuiltinByID(agentID string) (BuiltinAgent, bool)

func ResolveBuiltin

func ResolveBuiltin(identifier string) (BuiltinAgent, bool)

func (BuiltinAgent) MigrationIdentifiers

func (a BuiltinAgent) MigrationIdentifiers() []string

MigrationIdentifiers returns identifiers in deterministic migration priority: AgentID, current Bin, stable env key, current ACP command, then the explicitly ordered historical identifiers.

func (BuiltinAgent) RuntimeDefinition

func (a BuiltinAgent) RuntimeDefinition() model.AgentRuntimeDefinition

type CustomMutation

type CustomMutation func(current []model.CustomAgent) ([]model.CustomAgent, error)

type Entry

type Entry struct {
	Source  model.AgentCatalogSource
	Builtin *BuiltinAgent
	Custom  *model.CustomAgent
}

type HistoricalIdentifier

type HistoricalIdentifier struct {
	Kind  IdentifierKind
	Value string
}

type IdentifierKind

type IdentifierKind string
const (
	IdentifierKindBin        IdentifierKind = "bin"
	IdentifierKindEnvKey     IdentifierKind = "env_key"
	IdentifierKindACPCommand IdentifierKind = "acp_command"
)

type ResolvedAgent

type ResolvedAgent struct {
	AgentID               string
	Revision              string
	RuntimeKey            string
	Definition            model.AgentRuntimeDefinition
	Command               string
	Bin                   string
	SupportsHeadlessPrint bool
	Deprecated            bool
	Lifecycle             model.AgentLifecycle
}

type Service

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

func NewService

func NewService() (*Service, error)

func (*Service) BuiltinRevisions

func (s *Service) BuiltinRevisions(ctx context.Context, agentID string) ([]model.AgentRuntimeRevision, error)

func (*Service) Builtins

func (s *Service) Builtins() []BuiltinAgent

Builtins returns the supported built-in entries in selector order.

func (*Service) Custom

func (s *Service) Custom(ctx context.Context) ([]model.CustomAgent, error)

Custom returns the persisted custom entries in creation order.

func (*Service) DeletedItems

func (s *Service) DeletedItems(ctx context.Context) ([]model.AgentCatalogItem, error)

func (*Service) Find

func (s *Service) Find(ctx context.Context, agentID string) (Entry, bool, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Entry, error)

List returns built-ins first and persisted custom entries second.

func (*Service) ListItems

func (s *Service) ListItems(ctx context.Context) ([]model.AgentCatalogItem, error)

func (*Service) MutateCustom

func (s *Service) MutateCustom(ctx context.Context, mutate CustomMutation) ([]model.CustomAgent, error)

MutateCustom serializes the full load-validate-save transaction. Management handlers use this instead of a separate Custom + SaveCustom sequence so two concurrent operations cannot overwrite each other's catalog changes.

func (*Service) PruneUnreferencedBuiltinRevisions

func (s *Service) PruneUnreferencedBuiltinRevisions(
	ctx context.Context,
	referenced map[string]map[string]bool,
) ([]model.AgentRuntimeBinding, error)

func (*Service) PruneUnreferencedCustomRevisions

func (s *Service) PruneUnreferencedCustomRevisions(
	ctx context.Context,
	referenced map[string]map[string]bool,
) ([]model.AgentRuntimeBinding, error)

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, identifier string) (ResolvedAgent, bool, error)

Resolve accepts a stable AgentID or a built-in migration identifier and returns the current runtime projection. New settings persist ResolvedAgent's AgentID; Command and Bin are resolved only at execution time.

func (*Service) ResolveBinding

func (s *Service) ResolveBinding(ctx context.Context, identifier, revision string) (model.AgentRuntimeBinding, bool, error)

func (*Service) ResolveDisplayInfos

func (s *Service) ResolveDisplayInfos(ctx context.Context, ids []string) (map[string]model.AgentDisplayInfo, error)

ResolveDisplayInfos resolves display info for historical Agent references (session serve commands, graph node snapshot agent types) against the retained catalog records. Each identifier resolves in this order:

  1. exact built-in AgentID hit → Deleted=false
  2. exact custom AgentID hit (any lifecycle) → Deleted = (lifecycle == deleted)
  3. built-in migration identifier (stable bin, env key, legacy serve command, explicitly ordered historical identifiers) → Deleted=false
  4. no match → absent from the result

The result is keyed by the input identifier as given, so callers look up whatever reference string they already hold; identical identifiers in the input resolve once. The custom catalog is loaded once regardless of how many ids are passed.

func (*Service) ResolveLegacyBinding

func (s *Service) ResolveLegacyBinding(ctx context.Context, identifier string) (model.AgentRuntimeBinding, bool, error)

func (*Service) SaveCustom

func (s *Service) SaveCustom(ctx context.Context, agents []model.CustomAgent) error

SaveCustom atomically replaces the custom portion after validating the whole directory against built-in IDs and definitions. Management flows should perform their operation-specific validation first, then commit one complete snapshot through this method.

func (*Service) Validate

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

Jump to

Keyboard shortcuts

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