Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Name string
Description string
ReadOnlySafe bool // true = 只读浏览模式下允许执行(纯查询/展示)
Handler func(args []string, ctx *Context) Result
}
Command 斜杠命令定义
type Context ¶
type Context struct {
// 模型/配置信息
Model string
Provider string
Version string
PermMode string
Currency string
MaxContext int
// token/费用信息
InputTokens int
OutputTokens int
TotalTokens int
CostString string
CostUSD float64
// 会话信息
SessionID string
SessionTurns int
WorkDir string
// 缓存信息
CacheCreationTokens int
CacheReadTokens int
// 回调函数(需要外部行为的命令)
OnClear func() // /clear
OnCompact func() string // /compact
OnModelSwitch func(string) // /model <name>
OnExport func() string // /export
OnResume func() ([]ResumeEntryData, error) // /resume
OnLogin func() string // /login
OnLogout func() string // /logout
OnMCPList func() string // /mcp
OnSkillsList func() string // /skills
OnPluginsList func() string // /plugins
OnHooksList func() string // /hooks
OnThemeSwitch func(string) string // /theme <dark|light>
}
Context 命令执行上下文(由 TUI/Agent 注入)
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler 斜杠命令路由器
func (*Handler) CommandNames ¶
CommandNames 返回所有命令名称列表(用于 TUI 补全)
func (*Handler) IsReadOnlySafe ¶
IsReadOnlySafe 检查给定的 slash 输入在只读模式下是否允许执行
type ResultType ¶
type ResultType string
ResultType 命令结果类型
const ( ResultNotice ResultType = "notice" // 短提示(临时通知,~10 秒消失) ResultPanel ResultType = "panel" // 长文本(可滚动面板,Esc 关闭) ResultSelector ResultType = "selector" // 打开选择器(如 /resume) ResultPrompt ResultType = "prompt" // 发送预设 prompt 给 Agent ResultAction ResultType = "action" // 执行内部动作(如退出、清屏) )
Click to show internal directories.
Click to hide internal directories.