Documentation
¶
Overview ¶
Package commands defines slash commands and dispatches them to bound handlers
Index ¶
- Constants
- Variables
- func ActivePersonalityName(cfg map[string]any) string
- func AliasFor(description, name string) string
- func ApplySlashTierTexts()
- func AvailablePersonalities(cfg config.Tree) map[string]any
- func BoundGatewayCommand(name string) (gateway.RegistryCommand, bool)
- func CLITierRefusal(path string) (string, bool)
- func CmdProfile(ctx context.Context, a ProfileArgs, out, errw io.Writer, in io.Reader) error
- func CoalesceSessionNameArgs(argv []string) []string
- func ConfigCommandSources(h string) config.ConfigCommandSources
- func DescribePersonality(value any, width int) string
- func DiscordSkillCommandsByCategory(skills SkillSource, reserved map[string]bool) ([]DiscordSkillCategory, []DiscordSkillEntry, []DiscordCollision)
- func ExitCode(err error) (int, string)
- func GatewayAvailable(d *Def, gates map[string]bool) bool
- func GatewayHelpLines(r *Registry, cfg config.Tree, allowed []string) []string
- func GatewayKnownCommands() map[string]bool
- func GenerateBash(root *cobra.Command) string
- func GenerateFish(root *cobra.Command) string
- func GenerateZsh(root *cobra.Command) string
- func Install(r *Registry)
- func IsBangCommand(text any) bool
- func IsGatewayKnownCommand(ctx context.Context, r *Registry, name string) bool
- func IsInterruptThenDispatch(name string) bool
- func LooksLikeSlashCommand(text string) bool
- func NormalizePersonalityName(value any) string
- func NormalizeSkillToken(token string) string
- func NormalizeTelegramDesc(desc string) string
- func ParseBangCommand(text string) string
- func ParseWith(r *Registry, line string) (*Invocation, Kind)
- func PersistPersonality(ctx context.Context, value any) bool
- func PersonalityNames(personalities map[string]any) []string
- func PluginOptionalChoice(parser any, name, def string, choices ...string)
- func ProfileNames() []string
- func PromptText(value any) string
- func Register(d Def)
- func RenderPersonalityPrompt(value any) string
- func RequiresArgument(argsHint string) bool
- func ResolveConfigGates(cfg config.Tree) map[string]bool
- func ResolveEphemeralSystemPrompt(cfg map[string]any) string
- func ResolvePersonality(value any, cfg config.Tree) (string, string, error)
- func ResolveSlashKey[T any](command string, table map[string]T) (string, bool)
- func RunBoundGatewayCommand(ctx context.Context, name, arg string, host any) error
- func RunGatewayExecQuickCommand(ctx context.Context, env *tools.Env, execCmd any, cwd string) (string, error)
- func RunHandler(ctx context.Context, r *Registry, name, args string, host any) error
- func SanitizeSlackName(raw string) string
- func SanitizeTelegramName(raw string) string
- func ScorePath(filePath, query string) int
- func Shlex(s string) ([]string, error)
- func ShlexArgs(cmd string) []string
- func ShouldBypassActiveSession(name string) bool
- func SlackAppManifest(ctx context.Context, r *Registry, cfg config.Tree, requestURL string) map[string]any
- func SlackSubcommandMap(ctx context.Context, r *Registry, cfg config.Tree) map[string]string
- func SlashArgs(cmd string) string
- func SlashLinked(name string) bool
- func SlashTierRefusal(name string) (string, bool)
- func Subcommands(r *Registry) map[string][]string
- func TelegramMenuMaxCommands(cfg config.Tree) int
- func TruncateDesc(desc string, limit int) string
- func UsageSuffix(description, name, argsHint string) string
- func UsePluginParser(parser any, name string)
- type ApprovalModeResult
- type ArgparseError
- type BundleInfo
- type BusyPolicy
- type CLI
- func (c *CLI) AddPluginCommand(cmd *cobra.Command)
- func (c *CLI) Bind(path string, h CLIHandler) bool
- func (c *CLI) CommandArgv(argv []string) []string
- func (c *CLI) Completion(shell string, w io.Writer) error
- func (c *CLI) Execute(argv []string) error
- func (c *CLI) ExecuteParsed(argv []string) error
- func (c *CLI) FirstPositional(argv []string) (string, bool)
- func (c *CLI) InheritedFlags() []string
- func (c *CLI) LastGiven(cmd *cobra.Command, names ...string) string
- func (c *CLI) Namespace(cmd *cobra.Command, args []string) map[string]any
- func (c *CLI) ParseReadyArgs(argv []string) []string
- func (c *CLI) PluginCLIDiscoveryNeeded(argv []string) bool
- func (c *CLI) Positional(cmd *cobra.Command, args []string, name string) string
- func (c *CLI) Run(argv []string)
- func (c *CLI) ScanProfileFlag(argv []string) (string, int, int, error)
- func (c *CLI) TopLevelValueFlagSets() (map[string]bool, map[string]bool)
- func (c *CLI) Unbound() []string
- func (c *CLI) UnknownOptions(argv []string, cmd *cobra.Command) []string
- type CLIHandler
- type CommandContext
- type CommandReply
- type CompleterSources
- type Completion
- type ConfirmChoice
- type ConfirmHandler
- type ConfirmStore
- func (s *ConfirmStore) Clear(sessionKey string)
- func (s *ConfirmStore) ClearIfStale(sessionKey string, timeout time.Duration) bool
- func (s *ConfirmStore) Pending(sessionKey string) (PendingConfirm, bool)
- func (s *ConfirmStore) Register(sessionKey, confirmID, command string, handler ConfirmHandler)
- func (s *ConfirmStore) Resolve(ctx context.Context, sessionKey, confirmID, choice string, ...) (string, bool)
- type Def
- type DiscordCollision
- type DiscordSkillCategory
- type DiscordSkillEntry
- type Executor
- type ExitError
- type GatewaySkill
- type Group
- type Handler
- type ImportSource
- type Invocation
- type Kind
- type LegacyAgentArgs
- type LegacyAgentParser
- type Meta
- type NameDesc
- func GatewaySkillEntries(ctx context.Context, r *Registry, platform string, source SkillSource, ...) ([]NameDesc, int)
- func TelegramBotCommands(ctx context.Context, r *Registry, cfg config.Tree, includePlugins bool) []NameDesc
- func TelegramMenuCommands(ctx context.Context, r *Registry, cfg config.Tree, skills SkillSource, ...) ([]NameDesc, int)
- type NameMeta
- type NoExecutorError
- type PendingConfirm
- type PlatformHome
- type PluginCommandEntry
- type ProfileArgs
- type QuickCommand
- type Registry
- type Row
- type ShlexError
- type SkillInfo
- type SkillSource
- type SlackSlash
- type SlashCompleter
- type TelegramMenuConfig
- type ToolsetRow
- type UnboundCLIError
- type UnboundError
- type UnknownCommandError
- type UnknownPersonalityError
Constants ¶
const ( CategorySession = "Session" CategoryConfiguration = "Configuration" CategoryInfo = "Info" CategoryToolsSkills = "Tools & Skills" CategoryExit = "Exit" )
Category identifiers in the order the registry introduces them
const ConfirmTimeout = 300 * time.Second
ConfirmTimeout is how long a pending slash confirm stays resolvable
const DestructiveAlwaysMessage = "🔒 Future /clear, /new, /reset, and /undo will run without confirmation."
DestructiveAlwaysMessage confirms the persisted opt out on the CLI
const FlagPresent = "__present__"
FlagPresent is the value an optional argument flag takes when given without a value
const LegacyAgentProg = "icebath-agent"
LegacyAgentProg is the program name the legacy single query runner parses and reports errors under
const MaxStackedSkills = 5
MaxStackedSkills caps the leading skill tokens one line may stack
const PersistFailedProceeding = "⚠️ Couldn't persist opt-out — proceeding once."
PersistFailedProceeding is printed when the opt out could not be saved
const SlackMaxSlashCommands = 50
SlackMaxSlashCommands is the manifest cap on slash commands
const TelegramBotAPIMaxCommands = 100
TelegramBotAPIMaxCommands is the Bot API limit for setMyCommands
const TelegramDefaultMenuMax = 60
TelegramDefaultMenuMax is the default visible menu cap for Telegram
Variables ¶
var BannerVersionLabel func(ctx context.Context) string
BannerVersionLabel is the startup banner version label, assigned by cmd/icebath from pkg/app
var Builtin = []Def{}/* 102 elements not displayed */
Builtin is every core slash command in registry order
var BuiltinPersonalities = map[string]string{
"helpful": "You are a helpful, friendly AI assistant.",
"concise": "You are a concise assistant. Keep responses brief and to the point.",
"technical": "You are a technical expert. Provide detailed, accurate technical information.",
"creative": "You are a creative assistant. Think outside the box and offer innovative solutions.",
"teacher": "You are a patient teacher. Explain concepts clearly with examples.",
"kawaii": "You are a kawaii assistant! Use cute expressions like (◕‿◕), ★, ♪, and ~! Add sparkles and be super enthusiastic about everything! Every response should feel warm and adorable desu~! ヽ(>∀<☆)ノ",
"catgirl": "You are Neko-chan, an anime catgirl AI assistant, nya~! Add 'nya' and cat-like expressions to your speech. Use kaomoji like (=^・ω・^=) and ฅ^•ﻌ•^ฅ. Be playful and curious like a cat, nya~!",
"pirate": "Arrr! Ye be talkin' to Captain Icebath, the most tech-savvy pirate to sail the digital seas! Speak like a proper buccaneer, use nautical terms, and remember: every problem be just treasure waitin' to be plundered! Yo ho ho!",
"shakespeare": "Hark! Thou speakest with an assistant most versed in the bardic arts. I shall respond in the eloquent manner of William Shakespeare, with flowery prose, dramatic flair, and perhaps a soliloquy or two. What light through yonder terminal breaks?",
"surfer": "Duuude! You're chatting with the chillest AI on the web, bro! Everything's gonna be totally rad. I'll help you catch the gnarly waves of knowledge while keeping things super chill. Cowabunga!",
"noir": "The rain hammered against the terminal like regrets on a guilty conscience. They call me Icebath - I solve problems, find answers, dig up the truth that hides in the shadows of your codebase. In this city of silicon and secrets, everyone's got something to hide. What's your story, pal?",
"uwu": "hewwo! i'm your fwiendwy assistant uwu~ i wiww twy my best to hewp you! *nuzzles your code* OwO what's this? wet me take a wook! i pwomise to be vewy hewpful >w<",
"philosopher": "Greetings, seeker of wisdom. I am an assistant who contemplates the deeper meaning behind every query. Let us examine not just the 'how' but the 'why' of your questions. Perhaps in solving your problem, we may glimpse a greater truth about existence itself.",
"hype": "YOOO LET'S GOOOO!!! I am SO PUMPED to help you today! Every question is AMAZING and we're gonna CRUSH IT together! This is gonna be LEGENDARY! ARE YOU READY?! LET'S DO THIS!",
}
BuiltinPersonalities are available on every surface without any config
var BuiltinSubcommands = map[string]bool{}
BuiltinSubcommands are the top level commands plugin discovery never needs to resolve
var CLITiers = map[string]string{ "acp": linktier.Extras, "backup": linktier.Extras, "batch": linktier.Extras, "import": linktier.Extras, "browser": linktier.Extras, "vault": linktier.Extras, "computer-use": linktier.Extras, "cron": linktier.Extras, "kanban": linktier.Extras, "lsp": linktier.Extras, "pets": linktier.Extras, "update": linktier.Extras, "update-takeover": linktier.Extras, "update-finish": linktier.Extras, "update-restart-recovery": linktier.Extras, "update-completion": linktier.Extras, "venv-sync": linktier.Extras, "source-completion": linktier.Extras, "import-health": linktier.Extras, "pm": linktier.Extras, "security": linktier.Extras, "import-agent": linktier.Extras, "claw": linktier.Extras, "slack": linktier.Plugins, "whatsapp": linktier.Plugins, "whatsapp-cloud": linktier.Plugins, "send": linktier.Plugins, "camofox": linktier.Plugins, "feishu": linktier.Plugins, "google_chat": linktier.Plugins, "mcp-serve": linktier.Plugins, "meet": linktier.Extras, "photon": linktier.Plugins, "spotify": linktier.Plugins, "teams-pipeline": linktier.Plugins, "pairing": linktier.Plugins, "gateway setup": linktier.Plugins, "project bind-board": linktier.Extras, "egress": linktier.Plugins, }
CLI command paths outside the core and the tier that carries each, a top level name or a parent path and subcommand
var Confirms = NewConfirmStore()
Confirms is the process wide pending confirm store
var Default = NewRegistry()
Default is the process wide command registry
var DestructiveChoices = []ConfirmChoice{
{"once", "Approve Once", "proceed this time only"},
{"always", "Always Approve", "proceed and silence this prompt permanently"},
{"cancel", "Cancel", "keep current conversation"},
}
DestructiveChoices are the answers of the destructive slash confirm
var DestructiveDetails = map[string]string{
"new": "This starts a fresh session and discards the current conversation history.",
"undo_one": "This removes the last user/assistant exchange from history.",
}
DestructiveDetails are the chat details for the destructive session commands
DestructiveSkipTokens bypass the destructive slash confirmation inline
var ExecuteKeys = []string{"version", "egress", "profile", "bundles", "autoprune", "gateway_help", "gateway_commands"}
ExecuteKeys lists every registry owned executor key the app must bind
var Executors = map[string]Executor{
"version": execVersion,
"egress": execEgress,
"profile": execProfile,
"bundles": execBundles,
"autoprune": execAutoprune,
"gateway_help": execHelp,
"gateway_commands": execCommands,
}
Executors maps a command's execute key to its shared executor
var ImportSources = provider.ImportSources
ImportSources lists the importers the migrate command offers
var IndicatorStyles = home.IndicatorStyles
IndicatorStyles lists the TUI busy indicator styles the /indicator command accepts
var KanbanBlockKinds = []string{"capability", "dependency", "needs_input", "transient"}
KanbanBlockKinds are the typed block reasons
var KanbanInitialStatuses = []string{"blocked", "running"}
KanbanInitialStatuses are the statuses a card may be created in
var KanbanNotifyDeliveryModes = []string{"notify", "notify+wake", "wake"}
KanbanNotifyDeliveryModes are the notifier reactions to terminal events
var KanbanSortOrders = []string{"assignee", "created", "created-desc", "priority", "priority-desc", "status"}
KanbanSortOrders are the accepted list sort keys
var KanbanStatuses = []string{"archived", "blocked", "done", "ready", "review", "running", "scheduled", "todo", "triage"}
KanbanStatuses are the board columns a task may sit in plus archived
var LoadCLIConfig func(ctx context.Context) map[string]any
CLI config loader the personality completer reads, assigned in wiring with the app loader
var NeutralPersonalityNames = map[string]bool{"": true, "none": true, "default": true, "neutral": true}
NeutralPersonalityNames are the names that mean no personality overlay
PickerCommands get no trailing space on exact match because a space would block the picker
var PreArgparseInheritedFlags = [][2]string{{"--profile", "1"}, {"-p", "1"}}
PreArgparseInheritedFlags are consumed before parsing and carried over on relaunch
var SlackReservedCommands = map[string]bool{ "me": true, "status": true, "away": true, "dnd": true, "shrug": true, "remind": true, "msg": true, "feed": true, "who": true, "collapse": true, "expand": true, "leave": true, "join": true, "open": true, "search": true, "topic": true, "mute": true, "pro": true, "shortcuts": true, }
SlackReservedCommands are Slack built ins an app cannot register
var SlackViaIcebathOnly = map[string]bool{ "moa": true, "debug": true, "egress": true, "init": true, "version": true, "diff": true, "update": true, "heartbeat": true, "refine": true, "review": true, "pause": true, "whoami": true, "platform": true, "insights": true, "discard": true, "autoprune": true, }
SlackViaIcebathOnly lists canonical commands reachable on Slack only through the /icebath slash
var SlashTiers = linktier.SlashTiers
Slash commands outside the core and the tier that carries each
var StaticContextRefs = []NameMeta{
{"@diff", "Git working tree diff"},
{"@staged", "Git staged diff"},
{"@file:", "Attach a file"},
{"@folder:", "Attach a folder"},
{"@git:", "Git log with diffs (e.g. @git:5)"},
{"@url:", "Fetch web content"},
}
StaticContextRefs are the fixed @ references offered before path and fuzzy file matches
var TelegramMenuPriority = []string{
"help", "new", "stop", "status", "egress", "resume", "sessions", "model",
"debug", "restart", "update", "verbose", "commands",
"approve", "deny", "queue", "steer", "bg", "btw",
"reasoning", "usage", "platforms", "platform", "profile", "whoami",
}
TelegramMenuPriority ranks the builtins that survive the small visible menu
var ValidApprovalModes = []string{"manual", "smart", "off"}
Persistent approval modes the approvals command accepts
Functions ¶
func ActivePersonalityName ¶
Selected display.personality name when it names a known personality, empty otherwise
func ApplySlashTierTexts ¶
func ApplySlashTierTexts()
ApplySlashTierTexts rewrites the builtin slash descriptions naming a feature of an unlinked tier, run once before any entry
func AvailablePersonalities ¶
Built in personalities overlaid by root then agent level user definitions, later wins
func BoundGatewayCommand ¶
func BoundGatewayCommand(name string) (gateway.RegistryCommand, bool)
Gateway view of the default registry command a typed name binds a handler to, false when it binds none
func CLITierRefusal ¶
Refusal of a CLI command path whose tier this binary leaves out
func CmdProfile ¶
Runs the profile action a names, a nonzero exit becoming an ExitError
func CoalesceSessionNameArgs ¶
CoalesceSessionNameArgs joins unquoted multi word session names after the resume flags
func ConfigCommandSources ¶
func ConfigCommandSources(h string) config.ConfigCommandSources
Readers and writers a config set reaches outside the config package for a home
func DescribePersonality ¶
Short single line preview of a personality for list UIs, cut at width runes
func DiscordSkillCommandsByCategory ¶
func DiscordSkillCommandsByCategory(skills SkillSource, reserved map[string]bool) ([]DiscordSkillCategory, []DiscordSkillEntry, []DiscordCollision)
DiscordSkillCommandsByCategory groups gateway skills for Discord autocomplete and reports clamp collisions
func GatewayAvailable ¶
GatewayAvailable reports whether a command is offered on gateway surfaces
func GatewayHelpLines ¶
GatewayHelpLines renders the gateway help catalog, restricted to allowed canonical names when given
func GatewayKnownCommands ¶
GatewayKnownCommands lists every name and alias the gateway dispatches, config gated ones included
func GenerateBash ¶
Bash completion script with top level commands, per command words and profile names
func GenerateFish ¶
Fish completion script with top level commands, their subcommands and profile names
func GenerateZsh ¶
Zsh completion script describing top level commands, their subcommands and profile names
func IsBangCommand ¶
Reports a shell mode submission, a string whose stripped text starts with an exclamation mark
func IsGatewayKnownCommand ¶
IsGatewayKnownCommand reports whether a name is a builtin or registered plugin gateway command
func IsInterruptThenDispatch ¶
IsInterruptThenDispatch reports whether a name resolves to an interrupt first command
func LooksLikeSlashCommand ¶
LooksLikeSlashCommand reports whether text starts a slash command rather than an absolute path
func NormalizePersonalityName ¶
Canonical lower case form of a personality name, empty for every neutral spelling
func NormalizeSkillToken ¶
NormalizeSkillToken returns the canonical hyphenated slash key of a typed token
func NormalizeTelegramDesc ¶
NormalizeTelegramDesc folds Unicode dashes BotFather rejects to ASCII
func ParseBangCommand ¶
Shell command inside a bang submission with exactly one leading mark removed, empty when bare
func ParseWith ¶
func ParseWith(r *Registry, line string) (*Invocation, Kind)
ParseWith classifies a typed line against a specific registry
func PersistPersonality ¶
Writes the canonical name to display.personality of the home config, false on any failure
func PersonalityNames ¶
Names of a personalities mapping in the order the merge inserted them, builtins first then user entries
func PluginOptionalChoice ¶
Declares an optional positional with choices and a default on a plugin command, as add_argument(name, nargs="?", choices=..., default=...)
func ProfileNames ¶
func ProfileNames() []string
ProfileNames lists default plus every named profile for shell completion
func PromptText ¶
Normalizes a YAML prompt value of string or list shape to text
func RenderPersonalityPrompt ¶
Renders a string or structured personality definition to prompt text
func RequiresArgument ¶
RequiresArgument reports whether a hint makes a bare invocation incomplete
func ResolveConfigGates ¶
ResolveConfigGates returns canonical names whose gateway config gate is truthy in config
func ResolveEphemeralSystemPrompt ¶
Session overlay prompt, the active personality render or else the user owned agent.system_prompt
func ResolvePersonality ¶
Canonical name and rendered prompt of a requested personality, neutral names resolving to empty
func ResolveSlashKey ¶
ResolveSlashKey maps a typed command to its /slug table key, underscores reading as hyphens
func RunBoundGatewayCommand ¶
Runs the default registry handler bound to a typed name against the host taking its turn
func RunGatewayExecQuickCommand ¶
func RunGatewayExecQuickCommand(ctx context.Context, env *tools.Env, execCmd any, cwd string) (string, error)
Runs a gateway exec quick command with a sanitized env and redacted output, its tree stopped on timeout or cancellation
func RunHandler ¶
Runs the handler bound to a typed command or alias against the host it hands its work to
func SanitizeSlackName ¶
SanitizeSlackName lowers, strips invalid characters and edge punctuation and clamps to 32
func SanitizeTelegramName ¶
SanitizeTelegramName lowers, folds hyphens and drops a name that would lose letters
func ScorePath ¶
Scores a file path against a fuzzy query, higher better, zero no match, one empty query
func ShlexArgs ¶
ShlexArgs splits the tokens after the command word, whitespace splitting on unbalanced quotes
func ShouldBypassActiveSession ¶
ShouldBypassActiveSession reports whether a name resolves to any command dispatched mid run
func SlackAppManifest ¶
func SlackAppManifest(ctx context.Context, r *Registry, cfg config.Tree, requestURL string) map[string]any
SlackAppManifest returns the features.slash_commands manifest portion
func SlackSubcommandMap ¶
SlackSubcommandMap maps every name and alias to its /command for the /icebath handler
func SlashLinked ¶
Whether a slash command name or alias belongs to a tier this binary links
func SlashTierRefusal ¶
Refusal of a typed slash command whose tier this binary leaves out
func Subcommands ¶
Subcommands maps /name to its explicit subcommands or the pipe pattern found in the hint
func TelegramMenuMaxCommands ¶
TelegramMenuMaxCommands returns the configured Telegram menu cap within Bot API bounds
func TruncateDesc ¶
TruncateDesc clamps a description to a limit with an ellipsis tail
func UsageSuffix ¶
UsageSuffix formats a description with its usage hint
func UsePluginParser ¶
Asks the CLI that attaches a plugin command to build the named parser on it
Types ¶
type ApprovalModeResult ¶
Outcome of inspecting or persisting approvals.mode
func RunApprovalModeCommand ¶
func RunApprovalModeCommand(ctx context.Context, h string, env *tools.Env, requestedMode string) (ApprovalModeResult, error)
Inspects or persists approvals.mode through the config facade, reporting the mode the guard now enforces
type ArgparseError ¶
type ArgparseError struct {
Cmd *cobra.Command
Msg string
// Leftover arguments the parser could not place, reported against the top command
Unrecognized bool
}
ArgparseError is a parse failure reported as usage and the prog error line with exit status 2
func (*ArgparseError) Error ¶
func (e *ArgparseError) Error() string
func (*ArgparseError) Stderr ¶
func (e *ArgparseError) Stderr() string
Usage line followed by the prog error line, leftover arguments reported by the parser parse_args ran on
type BundleInfo ¶
BundleInfo describes one skill bundle
type BusyPolicy ¶
type BusyPolicy string
Behaviour of a command typed while the agent is mid turn
const ( BusyReject BusyPolicy = "reject" BusyDispatch BusyPolicy = "dispatch" BusyInterruptThenDispatch BusyPolicy = "interrupt_then_dispatch" )
type CLI ¶
CLI is the cobra command tree with handlers bound by path
func NewCLI ¶
func NewCLI() *CLI
NewCLI builds the full icebath command tree with every handler unbound
func (*CLI) AddPluginCommand ¶
AddPluginCommand registers a plugin provided top level command
func (*CLI) Bind ¶
func (c *CLI) Bind(path string, h CLIHandler) bool
Bind attaches a handler to the command at path and reports whether that path exists
func (*CLI) CommandArgv ¶
CommandArgv returns the subcommand and its arguments without the top level flags
func (*CLI) Completion ¶
Prints the zsh or fish script for that shell and the bash script for any other
func (*CLI) ExecuteParsed ¶
Parses argv the way a bare argparse parser would and runs the bound handler, skipping the profile scan
func (*CLI) FirstPositional ¶
FirstPositional returns the first subcommand token of argv or empty
func (*CLI) InheritedFlags ¶
InheritedFlags lists the top level flags tagged to carry over on relaunch
func (*CLI) Namespace ¶
Argparse style vars of a parsed invocation, every parser level from the root down with named positionals
func (*CLI) ParseReadyArgs ¶
ParseReadyArgs joins multi word session names and the optional flag values the way argparse reads argv
func (*CLI) PluginCLIDiscoveryNeeded ¶
PluginCLIDiscoveryNeeded reports whether argv may name a plugin provided command
func (*CLI) Positional ¶
Positional returns the named positional argument or its declared default
func (*CLI) ScanProfileFlag ¶
ScanProfileFlag finds the profile flag in argv as name, tokens consumed, and index
func (*CLI) TopLevelValueFlagSets ¶
TopLevelValueFlagSets returns the required value and optional value flags of the root
type CLIHandler ¶
CLIHandler runs one bound CLI subcommand
type CommandContext ¶
CommandContext carries the surface name, the raw argument string and the surface options to an executor
type CommandReply ¶
CommandReply is the surface independent text of a shared executor with the data it derived
func ExecuteCommand ¶
func ExecuteCommand(ctx context.Context, name string, cc CommandContext) (CommandReply, error)
Runs the shared executor of the named command, a NoExecutorError when it is unknown or has none
func RunExecute ¶
func RunExecute(ctx context.Context, d *Def, cc CommandContext) (CommandReply, bool, error)
Reply of the definition's shared executor, false when the command has none
type CompleterSources ¶
type CompleterSources struct {
Ctx context.Context
Registry *Registry
Cfg func() config.Tree
Skills func() map[string]SkillInfo
Bundles func() map[string]BundleInfo
PluginCommands func() map[string]string
CommandAllowed func(string) bool
Skins func() []NameMeta
ToolsetRows func() []ToolsetRow
ConnectedPlatforms func() []PlatformHome
}
CompleterSources supplies the live data the slash completer reads per keystroke
type Completion ¶
Completion is one prompt completion replacing the word under the cursor
type ConfirmChoice ¶
ConfirmChoice is one answer offered by a slash confirm prompt
type ConfirmHandler ¶
ConfirmHandler runs the confirmed command for a choice of once, always or cancel
type ConfirmStore ¶
type ConfirmStore struct {
// contains filtered or unexported fields
}
ConfirmStore holds pending slash confirms per session so adapters resolve them without the runner
func (*ConfirmStore) Clear ¶
func (s *ConfirmStore) Clear(sessionKey string)
Clear drops the pending confirm for a session without running it
func (*ConfirmStore) ClearIfStale ¶
func (s *ConfirmStore) ClearIfStale(sessionKey string, timeout time.Duration) bool
ClearIfStale drops a pending confirm older than the timeout and reports whether it did
func (*ConfirmStore) Pending ¶
func (s *ConfirmStore) Pending(sessionKey string) (PendingConfirm, bool)
Pending returns the pending confirm for a session
func (*ConfirmStore) Register ¶
func (s *ConfirmStore) Register(sessionKey, confirmID, command string, handler ConfirmHandler)
Register records a pending confirm, superseding any prior one for the session
type Def ¶
type Def struct {
Name string
Description string
Category string
Aliases []string
ArgsHint string
Subcommands []string
CLIOnly bool
BusyPolicy BusyPolicy
BusyHandler string
Plugin string
Handler Handler
Meta
}
One slash command with its metadata and bound handler
func GatewayAvailableCommands ¶
GatewayAvailableCommands lists registry commands visible on gateway surfaces
func PluginEntries ¶
PluginEntries lists registered plugin commands sorted by name
type DiscordCollision ¶
DiscordCollision describes a skill dropped because its clamped name was taken
type DiscordSkillCategory ¶
type DiscordSkillCategory struct {
Name string
Entries []DiscordSkillEntry
}
DiscordSkillCategory groups skills nested under one top level folder
type DiscordSkillEntry ¶
DiscordSkillEntry is one /skill autocomplete row
type Executor ¶
type Executor func(ctx context.Context, cc CommandContext) (CommandReply, error)
Executor formats one shared command reply from its context, never mutating an agent or session
func ResolveExecutor ¶
Shared executor of a command definition, nil when its command has no execute key in the table
type GatewaySkill ¶
GatewaySkill is a skill eligible as a gateway slash command with its path under its scan root
func IterGatewaySkills ¶
func IterGatewaySkills(scope *skills.Scope, platform string) []GatewaySkill
Skills eligible as gateway slash commands for a platform
type Group ¶
Group is one help category with its rows in registry order
func CommandsByCategory ¶
CommandsByCategory groups CLI visible commands and aliases by category in registry order
type Handler ¶
type Handler func(ctx context.Context, inv *Invocation) error
Executes one parsed slash command against the host its invocation carries
type ImportSource ¶
type ImportSource = provider.ImportSource
ImportSource is one native importer the migrate command offers
type Invocation ¶
type Invocation struct {
Name string
Raw string
Args string
Argv []string
Def *Def
// Host surface the handler drives, typed by the binding package
Host any
}
Invocation is one typed slash command with its parsed arguments
type Kind ¶
type Kind int
Kind classifies one typed composer line
const ( // KindPrompt is ordinary text for the agent KindPrompt Kind = iota // KindSlash is a registered slash command or alias KindSlash // KindBang is a shell command typed with a leading exclamation mark KindBang // KindSkill is a slash token with no registered command, a quick, plugin, bundle or skill candidate KindSkill )
type LegacyAgentArgs ¶
type LegacyAgentArgs struct {
Prompt []string
Query, APIKey, EnabledToolsets, DisabledToolsets *string
Model, BaseURL string
MaxTurns, LogPrefixChars int
ListTools, SaveTrajectories, SaveSample, Verbose bool
}
LegacyAgentArgs are the parsed legacy runner options, nil where the option keeps its None default
type LegacyAgentParser ¶
LegacyAgentParser is the legacy runner argument parser, a cobra command parsed with argparse semantics
func NewLegacyAgentParser ¶
func NewLegacyAgentParser(version string, stdout io.Writer) *LegacyAgentParser
Cobra command carrying every legacy runner flag, its help rendered the way argparse formats this parser
func (*LegacyAgentParser) Error ¶
func (p *LegacyAgentParser) Error(msg string) error
Usage and the prog error line on stderr with exit status 2, the error ArgumentParser.error raises
func (*LegacyAgentParser) Parse ¶
func (p *LegacyAgentParser) Parse(argv []string) (*LegacyAgentArgs, error)
Parses argv like ArgumentParser.parse_args, help and version printed with an exit status 0 error
func (*LegacyAgentParser) PrintHelp ¶
func (p *LegacyAgentParser) PrintHelp(w io.Writer)
Writes the full argparse help of the parser
type NameDesc ¶
NameDesc is one platform menu entry
func GatewaySkillEntries ¶
func GatewaySkillEntries(ctx context.Context, r *Registry, platform string, source SkillSource, maxSlots int, reserved map[string]bool, descLimit int, sanitize func(string) string) ([]NameDesc, int)
GatewaySkillEntries is the exported collectGatewaySkillEntries, names and descriptions with the hidden count
type NameMeta ¶
NameMeta pairs a completion name with its description
func LiveSkinRows ¶
Skin names with their description, else their source, the /skin completion rows
type NoExecutorError ¶
type NoExecutorError struct{ Name string }
NoExecutorError reports a command name with no registry owned executor
func (*NoExecutorError) Error ¶
func (e *NoExecutorError) Error() string
type PendingConfirm ¶
type PendingConfirm struct {
ConfirmID string
Command string
Handler ConfirmHandler
CreatedAt time.Time
}
PendingConfirm is one slash command awaiting the user's choice
type PlatformHome ¶
PlatformHome names a connected gateway platform and its home channel
func LiveConnectedPlatforms ¶
func LiveConnectedPlatforms(ctx context.Context) []PlatformHome
Connected gateway platforms with their home channel name, the /handoff completion rows
type PluginCommandEntry ¶
type PluginCommandEntry struct {
Name, Description, ArgsHint string
}
PluginCommandEntry is one plugin slash command with its description and stripped argument hint
func IterPluginCommandEntries ¶
func IterPluginCommandEntries(ctx context.Context, r *Registry) []PluginCommandEntry
Plugin manager commands in registration order then registry plugin commands, a blank description localized
type ProfileArgs ¶
type ProfileArgs struct {
Action string
ProfileName string
Clone bool
CloneAll bool
CloneFrom *string
CloneChannels bool
SyncImports bool
NoAlias bool
IsolatedAuth bool
NoCredentials bool
NoSkills bool
Description *string
Yes bool
Text string
Auto bool
Overwrite bool
AllMissing bool
Remove bool
AliasName string
OldName string
NewName string
Output string
Archive string
ImportName string
Source string
InstallName string
Alias bool
Force bool
ForceConfig bool
}
Parsed arguments of one icebath profile command line, Action empty for the bare command
type QuickCommand ¶
QuickCommand is one user defined slash shortcut from config
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps command names and aliases to definitions
type ShlexError ¶
type ShlexError struct{ Message string }
ShlexError reports unbalanced quoting
func (*ShlexError) Error ¶
func (e *ShlexError) Error() string
type SkillInfo ¶
type SkillInfo struct {
Name string
Description string
SkillDir string
SkillMDPath string
SkillIdentifier string
}
SkillInfo describes one installed skill command
type SkillSource ¶
type SkillSource func(platform string) []GatewaySkill
SkillSource yields the gateway eligible skills for a platform
func HomeSkillSource ¶
func HomeSkillSource(h string, cfg config.Tree) SkillSource
SkillSource over the home's skills scope with the given config
type SlackSlash ¶
SlackSlash is one native Slack slash command
func SlackNativeSlashes ¶
SlackNativeSlashes lists every gateway command as a standalone slash under the manifest cap
type SlashCompleter ¶
type SlashCompleter struct {
// contains filtered or unexported fields
}
SlashCompleter completes slash commands, subcommands, skill commands, and @ references
func NewCompleter ¶
func NewCompleter(src CompleterSources) *SlashCompleter
NewCompleter builds a completer over the given sources
func TUISlashCompleter ¶
func TUISlashCompleter(ctx context.Context, skillCommands, skillBundles skills.SkillCommands) *SlashCompleter
Slash completer the TUI gateway runs over a session's skill and bundle tables and the live sources of the ctx profile
func (*SlashCompleter) Complete ¶
func (c *SlashCompleter) Complete(text string) []Completion
Completions for the text before the cursor
type TelegramMenuConfig ¶
TelegramMenuConfig is the normalized platforms.telegram.extra.command_menu block
func TelegramCommandMenuConfig ¶
func TelegramCommandMenuConfig(cfg config.Tree) TelegramMenuConfig
TelegramCommandMenuConfig reads the command menu config with safe defaults
type ToolsetRow ¶
ToolsetRow describes one toolset the /tools completer may offer
func LiveToolsetRows ¶
func LiveToolsetRows(ctx context.Context) []ToolsetRow
Configurable and plugin toolsets with their cli enable state from the readonly config of the ctx profile
type UnboundCLIError ¶
type UnboundCLIError struct{ Path string }
UnboundCLIError reports a CLI command the host never bound a handler to
func (*UnboundCLIError) Error ¶
func (e *UnboundCLIError) Error() string
type UnboundError ¶
type UnboundError struct{ Name string }
Refusal of a registered command that has no handler bound
func (*UnboundError) Error ¶
func (e *UnboundError) Error() string
type UnknownCommandError ¶
type UnknownCommandError struct{ Name string }
Refusal of a name no registry entry resolves
func (*UnknownCommandError) Error ¶
func (e *UnknownCommandError) Error() string
type UnknownPersonalityError ¶
type UnknownPersonalityError struct{ Msg string }
UnknownPersonalityError is the ValueError raised for a name no personality carries
func (*UnknownPersonalityError) Error ¶
func (e *UnknownPersonalityError) Error() string
func (*UnknownPersonalityError) PyTypeName ¶
func (e *UnknownPersonalityError) PyTypeName() string
Python exception class name the error stands for
Source Files
¶
- approval_mode.go
- argparse_help.go
- bang.go
- cli.go
- cli_argparse.go
- cli_argparse_nargs.go
- cli_argparse_store_false.go
- cli_argparse_table.go
- cli_argparse_values.go
- cli_namespace.go
- cli_parse_errors.go
- cli_plugin_parsers.go
- cli_toplevel.go
- cli_tree_a.go
- cli_tree_b.go
- cli_tree_batch.go
- cli_tree_bundles.go
- cli_tree_c.go
- cli_tree_config.go
- cli_tree_curator.go
- cli_tree_hooks.go
- cli_tree_install.go
- cli_tree_mcp.go
- cli_tree_memory.go
- cli_tree_moa.go
- cli_tree_plugins.go
- cli_tree_pm.go
- cli_tree_pm_run.go
- cli_tree_profile.go
- cli_tree_skills_hub.go
- cli_tree_skin.go
- cli_tree_verify.go
- cli_tree_webhook.go
- completer_live_sources.go
- completion.go
- config_sources_export.go
- confirm.go
- console_execute.go
- def.go
- dispatch.go
- gateway_skills.go
- help.go
- legacy_agent_cli.go
- log.go
- personality.go
- platforms.go
- quick.go
- quick_unix.go
- route.go
- shell_completion.go
- skills_resolver.go
- slash_exec.go
- table.go
- terminal_ui.go
- tiers.go
- tui_slash_completer.go