Documentation
¶
Overview ¶
Package catalog validates, filters, and compiles immutable native capability registrations.
Index ¶
- Variables
- func ValidateRegistration(registration Registration) error
- type Catalog
- func (catalog *Catalog) Describe(name string) (Description, bool)
- func (catalog *Catalog) Entries() []Entry
- func (catalog *Catalog) Lookup(name string) (Entry, bool)
- func (catalog *Catalog) LookupID(id string) (Entry, bool)
- func (catalog *Catalog) NamespaceBindings() []NamespaceBinding
- func (catalog *Catalog) Search(query string) (SearchResponse, error)
- type Description
- type Entry
- type Invoker
- type NamespaceBinding
- type Options
- type Registration
- type SearchResponse
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidRegistration classifies malformed metadata, handlers, types, duplicates, or namespace collisions. ErrInvalidRegistration = errors.New("invalid catalog registration") // ErrUnknownDisabledCapability classifies a disabled ID absent from the validated registration set. ErrUnknownDisabledCapability = errors.New("unknown disabled capability") // ErrInputTypeMismatch classifies an erased handler argument that cannot be the compiled input type. ErrInputTypeMismatch = errors.New("capability input type mismatch") )
var ( // ErrSearchQueryLimit classifies a search query that exceeds its byte or token budget. ErrSearchQueryLimit = errors.New("search query limit exceeded") )
Functions ¶
func ValidateRegistration ¶
func ValidateRegistration(registration Registration) error
ValidateRegistration reports whether one copied registration has valid metadata, a compiled plan, and a handler.
The first dotted name segment must not collide with a reserved Starlark universe root.
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an immutable, statically filtered capability catalog.
func Build ¶
func Build(registrations []Registration, options Options) (*Catalog, error)
Build validates every registration, applies static filtering once, and returns an immutable catalog.
func (*Catalog) Describe ¶
func (catalog *Catalog) Describe(name string) (Description, bool)
Describe returns the exact description of one enabled capability without fuzzy expansion.
func (*Catalog) NamespaceBindings ¶
func (catalog *Catalog) NamespaceBindings() []NamespaceBinding
NamespaceBindings returns deep copies of namespace data derived from enabled entries.
type Description ¶
type Description struct {
// Name is the enabled capability's exact dotted name.
Name string `json:"name"`
// Signature is generated from the same compiled plan used for binding.
Signature string `json:"signature"`
// Summary is the compact searchable description.
Summary string `json:"summary"`
// Description is the full registered description.
Description string `json:"description"`
// Input is the ordered supported input field shape.
Input []binding.FieldShape `json:"input"`
// Output is the ordered supported output field shape.
Output []binding.FieldShape `json:"output"`
}
Description is one exact model-facing capability description.
type Entry ¶
type Entry struct {
// ID is the stable deployment and policy identity.
ID string
// Name is the dotted Starlark and model-facing capability name.
Name string
// Summary is the compact search description.
Summary string
// Description is the full exact-description text.
Description string
// Plan is the immutable input, output, canonical-argument, and signature plan.
Plan *binding.Plan
// Invoke calls the registered typed handler through its registration-time adapter.
Invoke Invoker
// contains filtered or unexported fields
}
Entry is one validated, enabled capability with its compiled binding plan.
type NamespaceBinding ¶
type NamespaceBinding struct {
// Segments contains the namespace path before the final function name.
Segments []string
// Function is the final Starlark function segment.
Function string
// Capability is the enabled catalog entry represented by this function.
Capability Entry
}
NamespaceBinding maps one enabled capability to its immutable namespace path.
type Options ¶
type Options struct {
// DisabledCapabilities lists stable IDs removed from every live catalog surface.
DisabledCapabilities []string
// MaxSearchQueryBytes bounds search input before normalization.
MaxSearchQueryBytes int
// MaxSearchResults bounds the deterministic result list.
MaxSearchResults int
}
Options controls one immutable catalog build.
type Registration ¶
type Registration struct {
// ID is the stable deployment and policy identity.
ID string
// Name is the dotted Starlark and model-facing capability name.
// The first segment must not collide with a reserved Starlark universe root.
Name string
// Summary is the compact description used by capability search.
Summary string
// Description is the full exact-description text.
Description string
// SearchTerms contains alternative task vocabulary used only for discovery.
SearchTerms []string
// Plan is the caller-compiled input, output, canonical-argument, and signature plan.
Plan *binding.Plan
// Invoke calls the registered typed handler through its registration-time adapter.
Invoke Invoker
}
Registration contains one capability before validation and static filtering.
type SearchResponse ¶
type SearchResponse struct {
// Results contains the packed ranked prefix of eligible capabilities.
Results []SearchResult `json:"results"`
// Truncated reports whether at least one eligible result was omitted.
Truncated bool `json:"truncated"`
}
SearchResponse is one bounded ranked discovery result set.
type SearchResult ¶
type SearchResult struct {
// Name is the enabled capability's exact dotted name.
Name string `json:"name"`
// Signature is generated from the same compiled plan used for binding.
Signature string `json:"signature"`
// Summary is the compact searchable description.
Summary string `json:"summary"`
}
SearchResult is one compact model-facing capability discovery record.