Documentation
¶
Index ¶
- func New(cfg Config, _ Deps) (agentkit.Commands, error)
- func PluginHelpCommand() agentkit.Command
- type Config
- type Deps
- type Registry
- func (r *Registry) Commands() []agentkit.Command
- func (r *Registry) Dispatch(ctx context.Context, name string, rawArgs string) (string, error)
- func (r *Registry) EnrichSlashContext(ctx context.Context) context.Context
- func (r *Registry) List() []agentkit.Command
- func (r *Registry) SetCommands(providers []agentkit.CommandProvider) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New registers commands/registry: Aggregate slash commands contributed by CommandProvider plugins.
Best practices:
- Providers are discovered from the built graph, so a command appears as soon as its plugin is wired in.
func PluginHelpCommand ¶ added in v0.1.2
PluginHelpCommand exposes the plugin catalog help slash command.
Types ¶
type Config ¶
type Config struct {
// Allow exposes only these command names; empty means all.
Allow []string `json:"allow,omitempty"`
// Deny hides these command names; applied after Allow.
Deny []string `json:"deny,omitempty"`
// Admins lists user IDs that may run admin-only slash commands. Matching is
// case-insensitive. When empty, admin restrictions are not enforced.
Admins []string `json:"admins,omitempty"`
// AdminOnly lists command names and aliases that require an admin user when
// Admins is non-empty.
AdminOnly []string `json:"adminOnly,omitempty"`
}
Config controls which contributed commands are exposed. Allow and Deny match command names and aliases case-insensitively. When Allow is empty, every command is eligible unless denied. When Allow is non-empty, only listed commands are registered.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry collects slash commands contributed by built plugins.
func NewFromProviders ¶
func NewFromProviders(cfg Config, providers []agentkit.CommandProvider) (*Registry, error)
NewFromProviders builds a registry from explicit command providers.
func (*Registry) EnrichSlashContext ¶ added in v0.1.16
EnrichSlashContext sets KeyIsAdmin when the current user matches Config.Admins.
func (*Registry) SetCommands ¶
func (r *Registry) SetCommands(providers []agentkit.CommandProvider) error
SetCommands registers commands from every built CommandProvider.