Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupported = errors.New("not available in this configuration")
ErrUnsupported is returned by Runtime methods whose capability is unavailable in the current configuration (e.g. allow-list ops with no store).
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
Name string
Description string
Usage string
Handler func(ctx context.Context, req Request, rt Runtime) error
}
Definition describes a slash command.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps slash command names to their definitions.
func NewRegistry ¶
func NewRegistry(defs []Definition) *Registry
NewRegistry builds a Registry from defs and auto-registers /help.
func (*Registry) All ¶
func (r *Registry) All() []Definition
All returns a copy of all registered definitions.
type Request ¶
type Request struct {
Text string
ChatID string
UserID string
Connector string
Reply func(text string) error
}
Request carries an incoming slash command plus a reply callback.
type Runtime ¶
type Runtime interface {
ClearHistory() error
IsAdmin() bool
FactoryReset() error // admin only: wipes soul + role + memories + history
Info() UserInfo
// Allow-list management (admin only), scoped to the request's connector.
AllowAdd(number string) error
AllowRemove(number string) error
AllowList() ([]string, error)
// ResolveApproval approves (true) or denies (false) a parked tool call by id.
// It sends its own replies and continues the agent's tool loop.
ResolveApproval(approve bool, id string)
// GenerateLinkCode mints a one-time code so another chat can link to this
// account (see RedeemLinkCode). Returns ErrUnsupported with no store.
GenerateLinkCode() (string, error)
// RedeemLinkCode links this identity to the account that generated code,
// returning a label for the now-shared account.
RedeemLinkCode(code string) (string, error)
// Unlink detaches this identity from its linked account.
Unlink() error
// LinkStatus reports whether this identity is linked, with a short detail.
LinkStatus() (linked bool, detail string)
}
Runtime gives command handlers access to agent capabilities scoped to the current request. The agent supplies a concrete implementation per command. Methods backed by a store return ErrUnsupported when none is configured.
Click to show internal directories.
Click to hide internal directories.