Documentation
¶
Overview ¶
Package command 定义了 Golem 斜杠命令(Slash Commands)的接口、注册与分发逻辑。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface {
// Name 返回触发该命令的名称(不含前导斜杠,如 "new")。
Name() string
// Description 返回该命令的简短描述。
Description() string
// Execute 执行命令逻辑。args 是命令名称后紧跟的参数文本。
Execute(ctx context.Context, args string, env Env) Result
}
Command 是所有斜杠命令必须实现的接口。
type CronCommand ¶
type CronCommand struct{}
CronCommand 实现 /cron — 管理定时任务。 子命令: list, remove <id>, enable <id>, disable <id>, run <id>
func (*CronCommand) Description ¶
func (c *CronCommand) Description() string
func (*CronCommand) Name ¶
func (c *CronCommand) Name() string
type Env ¶
type Env struct {
Channel string // 消息来源通道
ChatID string // 聊天 ID
SenderID string // 发送者 ID
SessionKey string // 唯一的会话标识符
Sessions *session.Manager // 会话管理器,用于操作聊天历史
WorkspacePath string // 工作区根路径
Config *config.Config // 全局配置实例
Metrics *metrics.RuntimeMetrics // 运行时指标记录器
ListCommands func() []Command // 用于 /help 获取所有可用命令的回调函数
}
Env 携带斜杠命令执行时的上下文环境信息。
type HelpCommand ¶
type HelpCommand struct{}
HelpCommand 实现 /help 命令 — 用于列出当前所有已注册且可用的斜杠命令。
type MemoryCommand ¶
type MemoryCommand struct{}
MemoryCommand 实现 /memory 命令 — 用于读取长期记忆 (MEMORY.md) 或查询日记条目。 使用方式:
/memory [read] - 读取长期记忆内容 /memory diary [date|recent] - 读取指定日期或最近的日记分录
func (*MemoryCommand) Description ¶
func (c *MemoryCommand) Description() string
Description 返回命令描述。
type NewSessionCommand ¶
type NewSessionCommand struct{}
NewSessionCommand 实现 /new 命令 — 用于重置当前会话,清除历史上下文。
func (*NewSessionCommand) Description ¶
func (c *NewSessionCommand) Description() string
Description 返回命令描述。
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 负责存储所有已注册的斜杠命令并进行匹配分发。
type SkillsCommand ¶
type SkillsCommand struct{}
SkillsCommand 实现 /skills 命令 — 用于查看已安装技能及其详细信息。 使用方式:
/skills [list] - 列出所有已发现的技能 /skills show <name> - 显示指定技能的完整 Markdown 内容
func (*SkillsCommand) Description ¶
func (c *SkillsCommand) Description() string
Description 返回命令描述。
type StatusCommand ¶
type StatusCommand struct{}
StatusCommand 实现 /status 命令 — 用于显示 Agent 当前的运行时状态、配置概览及性能指标。
func (*StatusCommand) Description ¶
func (c *StatusCommand) Description() string
Description 返回命令描述。
type VersionCommand ¶
type VersionCommand struct{}
VersionCommand 实现 /version 命令 — 用于显示当前 Golem 二进制文件的版本及构建环境。
func (*VersionCommand) Description ¶
func (c *VersionCommand) Description() string
Description 返回命令描述。