commands

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package commands provides a unified slash-command handler shared by all channels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ctx

type Ctx struct {
	SessionKey  string
	Agent       agent.PrimaryAgent
	Sessions    *session.Manager
	Config      *config.Root
	CronManager *cron.Manager      // optional; enables /cron commands
	TaskManager *taskqueue.Manager // optional; enables /tasks and /cancel commands
	Version     string             // binary version (for /status)
	StartTime   time.Time          // process start time (for /status uptime)
	SkillCount  int                // loaded skill count (for /status)
	Fallbacks   []string           // model fallback chain (for /status)
}

Ctx holds all dependencies needed to execute commands.

type Result

type Result struct {
	Text    string
	Handled bool
}

Result is the return value from Handle.

func Handle

func Handle(ctx context.Context, text string, cmdCtx Ctx) Result

Handle processes a slash command if text starts with '/'. Returns Result.Handled=true if the command was recognised (even if it erred). Unknown slash commands also return Handled=true so they are not forwarded to the agent.

Jump to

Keyboard shortcuts

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