Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasCommandPrefix ¶
HasCommandPrefix returns true if the input starts with a recognized command prefix (e.g. "/" or "!").
Types ¶
type Definition ¶
type Definition struct {
Name string
Description string
Usage string // for simple commands; ignored when SubCommands is set
Aliases []string
SubCommands []SubCommand // optional; when set, Executor routes to sub-command handlers
Handler Handler // for simple commands without sub-commands
}
Definition is the single-source metadata and behavior contract for a slash command.
Design notes (phase 1):
- Every channel reads command shape from this type instead of keeping local copies.
- Visibility is global: all definitions are considered available to all channels.
- Platform menu registration (for example Telegram BotCommand) also derives from this same definition so UI labels and runtime behavior stay aligned.
func BuiltinDefinitions ¶
func BuiltinDefinitions() []Definition
BuiltinDefinitions returns all built-in command definitions. Each command group is defined in its own cmd_*.go file. Definitions are stateless — runtime dependencies are provided via the Runtime parameter passed to handlers at execution time.
func (Definition) EffectiveUsage ¶
func (d Definition) EffectiveUsage() string
EffectiveUsage returns the usage string. When SubCommands are present, it is auto-generated from sub-command names so metadata and behavior cannot drift.
type ExecuteResult ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry(defs []Definition) *Registry
NewRegistry stores the canonical command set used by both dispatch and optional platform registration adapters.
func (*Registry) Definitions ¶
func (r *Registry) Definitions() []Definition
Definitions returns all registered command definitions. Command availability is global and no longer channel-scoped.
type Runtime ¶
type Runtime struct {
Config *config.Config
GetModelInfo func() (name, provider string)
ListAgentIDs func() []string
ListDefinitions func() []Definition
GetEnabledChannels func() []string
SwitchModel func(value string) (oldModel string, err error)
SwitchChannel func(value string) error
ClearHistory func() error
}
Runtime provides runtime dependencies to command handlers. It is constructed per-request by the agent loop so that per-request state (like session scope) can coexist with long-lived callbacks (like GetModelInfo).