Documentation
¶
Index ¶
- func Expand(template string, args []string) string
- func ParseArgs(s string) []string
- func ReadStdinPrompt() (string, error)
- func RunPrint(sess *agent.Session, args []string, jsonMode bool) error
- func RunPrintMode(sess *agent.Session, prompt string, jsonMode bool) error
- func RunTUI(sess *agent.Session, cwd, gitBranch, modelName, version string, ...) error
- type App
- type BtwCommand
- func (c *BtwCommand) Active() bool
- func (c *BtwCommand) Dismiss()
- func (c *BtwCommand) HandleKey(msg tea.KeyMsg) (bool, tea.Cmd)
- func (c *BtwCommand) IsModal() bool
- func (c *BtwCommand) Run(_ *CommandContext, inv CommandInvocation) tea.Cmd
- func (c *BtwCommand) SetResult(msg tui.BtwResultMsg)
- func (c *BtwCommand) Spec() CommandSpec
- func (c *BtwCommand) View(width int) string
- type Command
- type CommandContext
- type CommandInvocation
- type CommandKind
- type CommandLoader
- type CommandSpec
- type FileCommandAdapter
- type InteractiveCommand
- type ModalOverlay
- type ModelCommand
- func (c *ModelCommand) Active() bool
- func (c *ModelCommand) Dismiss()
- func (c *ModelCommand) HandleKey(msg tea.KeyMsg) (bool, tea.Cmd)
- func (c *ModelCommand) Run(ctx *CommandContext, inv CommandInvocation) tea.Cmd
- func (c *ModelCommand) Spec() CommandSpec
- func (c *ModelCommand) View(width int) string
- type Registry
- func (r *Registry) All() []Command
- func (r *Registry) ClearOverlay()
- func (r *Registry) EffectiveSpec(cmd Command) CommandSpec
- func (r *Registry) Lookup(name string) (Command, bool)
- func (r *Registry) Overlay() InteractiveCommand
- func (r *Registry) Register(cmd Command)
- func (r *Registry) RegisterAll(commands []Command)
- func (r *Registry) SetOverlay(ic InteractiveCommand)
- type ResumeCommand
- func (c *ResumeCommand) Active() bool
- func (c *ResumeCommand) Dismiss()
- func (c *ResumeCommand) HandleKey(msg tea.KeyMsg) (bool, tea.Cmd)
- func (c *ResumeCommand) Run(ctx *CommandContext, _ CommandInvocation) tea.Cmd
- func (c *ResumeCommand) Spec() CommandSpec
- func (c *ResumeCommand) View(width int) string
- type SimpleCommand
- type SkillCommand
- type TasksCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand substitutes placeholder patterns in template with the given args.
Supported patterns:
- $1, $2, ... $N — positional args (1-based, out-of-range → "")
- ${@:N} — all args from index N onward (1-based)
- ${@:N:L} — L args starting at index N (1-based)
- $@ / $ARGUMENTS — all args joined by space
Substitution is single-pass per pattern class (no recursive expansion).
func ParseArgs ¶
ParseArgs splits a command argument string respecting double and single quotes. Empty quoted strings are skipped.
func ReadStdinPrompt ¶
ReadStdinPrompt reads all of stdin as a prompt (for pipe usage).
func RunPrintMode ¶
RunPrintMode runs the agent in non-interactive mode. stdout receives assistant text (pipe-friendly), stderr receives tool/status info. When jsonMode is true, all events are streamed as JSONL to stdout.
Types ¶
type App ¶
type App struct {
Session *agent.Session
Cwd string
GitBranch string
ApprovalEngine *approval.Engine
// Commands are user-defined slash commands loaded from .md files.
Commands []config.FileCommand
// Skills are loaded skill definitions.
Skills []config.Skill
// MCPManager manages MCP server connections.
MCPManager *mcpclient.Manager
// CronStore holds session-scoped cron jobs for /loop command.
CronStore *cron.Store
// SubAgentTool provides access to background agent task registry for /tasks command.
SubAgentTool *agentcore.SubAgentTool
// BashTool provides access to background shell registry for /tasks command.
BashTool *agentcoretools.BashTool
// PlanStore persists plans to ~/.codebot/plans/.
PlanStore *storage.PlanStore
// History provides input history for Up/Down navigation.
History *storage.History
// CommandLoaders allow alternative command sources to be injected at app construction time.
CommandLoaders []CommandLoader
// contains filtered or unexported fields
}
App is the TUI adapter. Business logic lives in agent.Session.
type BtwCommand ¶ added in v0.0.4
type BtwCommand struct {
// contains filtered or unexported fields
}
BtwCommand implements /btw — ephemeral side-chain Q&A that reads the full conversation context but never mutates history or invokes tools.
func NewBtwCommand ¶ added in v0.0.4
func NewBtwCommand(app *App) *BtwCommand
NewBtwCommand creates a /btw command bound to the given App.
func (*BtwCommand) Active ¶ added in v0.0.4
func (c *BtwCommand) Active() bool
func (*BtwCommand) Dismiss ¶ added in v0.0.4
func (c *BtwCommand) Dismiss()
func (*BtwCommand) IsModal ¶ added in v0.0.4
func (c *BtwCommand) IsModal() bool
func (*BtwCommand) Run ¶ added in v0.0.4
func (c *BtwCommand) Run(_ *CommandContext, inv CommandInvocation) tea.Cmd
func (*BtwCommand) SetResult ¶ added in v0.0.4
func (c *BtwCommand) SetResult(msg tui.BtwResultMsg)
SetResult updates the overlay with the side question response.
func (*BtwCommand) Spec ¶ added in v0.0.4
func (c *BtwCommand) Spec() CommandSpec
func (*BtwCommand) View ¶ added in v0.0.4
func (c *BtwCommand) View(width int) string
type Command ¶ added in v0.0.2
type Command interface {
Spec() CommandSpec
Run(ctx *CommandContext, inv CommandInvocation) tea.Cmd
}
Command is the unified abstraction for all slash commands.
type CommandContext ¶ added in v0.0.2
type CommandContext struct {
App *App
}
CommandContext provides runtime dependencies to commands.
type CommandInvocation ¶ added in v0.0.2
CommandInvocation is the parsed slash-command input passed to command handlers.
type CommandKind ¶ added in v0.0.2
type CommandKind string
const ( CommandKindBuiltin CommandKind = "builtin" CommandKindCustom CommandKind = "custom" CommandKindSkill CommandKind = "skill" )
type CommandLoader ¶ added in v0.0.2
CommandLoader discovers a family of commands and contributes them to the registry.
type CommandSpec ¶ added in v0.0.2
type CommandSpec struct {
Name string
Aliases []string
Usage string
Description string
Category string
NeedsIdle bool
Hidden bool
Kind CommandKind
Source string
}
CommandSpec describes command metadata.
type FileCommandAdapter ¶ added in v0.0.2
type FileCommandAdapter struct {
// contains filtered or unexported fields
}
func (*FileCommandAdapter) Run ¶ added in v0.0.2
func (c *FileCommandAdapter) Run(ctx *CommandContext, inv CommandInvocation) tea.Cmd
func (*FileCommandAdapter) Spec ¶ added in v0.0.2
func (c *FileCommandAdapter) Spec() CommandSpec
type InteractiveCommand ¶ added in v0.0.2
type InteractiveCommand interface {
Command
Active() bool
HandleKey(msg tea.KeyMsg) (handled bool, cmd tea.Cmd)
View(width int) string
Dismiss()
}
InteractiveCommand extends Command with modal keyboard interception and custom rendering. When Active() returns true the TUI routes all keyboard events through HandleKey and replaces the input area with View.
type ModalOverlay ¶ added in v0.0.4
type ModalOverlay interface {
IsModal() bool
}
ModalOverlay is an optional interface for overlays that replace the input area.
type ModelCommand ¶ added in v0.0.2
type ModelCommand struct {
// contains filtered or unexported fields
}
ModelCommand implements InteractiveCommand for /model. Without arguments it opens an interactive selector overlay; with arguments it switches directly.
func NewModelCommand ¶ added in v0.0.2
func NewModelCommand(app *App) *ModelCommand
func (*ModelCommand) Active ¶ added in v0.0.2
func (c *ModelCommand) Active() bool
func (*ModelCommand) Dismiss ¶ added in v0.0.2
func (c *ModelCommand) Dismiss()
func (*ModelCommand) Run ¶ added in v0.0.2
func (c *ModelCommand) Run(ctx *CommandContext, inv CommandInvocation) tea.Cmd
func (*ModelCommand) Spec ¶ added in v0.0.2
func (c *ModelCommand) Spec() CommandSpec
func (*ModelCommand) View ¶ added in v0.0.2
func (c *ModelCommand) View(width int) string
type Registry ¶ added in v0.0.2
type Registry struct {
// contains filtered or unexported fields
}
Registry manages command registration, lookup by name/alias, and the active interactive overlay.
func NewRegistry ¶ added in v0.0.2
func NewRegistry() *Registry
NewRegistry creates an empty Registry.
func (*Registry) All ¶ added in v0.0.2
All returns all registered commands sorted by kind and then by name.
func (*Registry) ClearOverlay ¶ added in v0.0.2
func (r *Registry) ClearOverlay()
ClearOverlay dismisses and clears the active overlay.
func (*Registry) EffectiveSpec ¶ added in v0.0.2
func (r *Registry) EffectiveSpec(cmd Command) CommandSpec
EffectiveSpec returns the command metadata with only active aliases included.
func (*Registry) Lookup ¶ added in v0.0.2
Lookup finds a command by name or alias (case-insensitive).
func (*Registry) Overlay ¶ added in v0.0.2
func (r *Registry) Overlay() InteractiveCommand
Overlay returns the currently active interactive command, or nil.
func (*Registry) Register ¶ added in v0.0.2
Register adds or replaces a command and its aliases in the registry.
func (*Registry) RegisterAll ¶ added in v0.0.2
RegisterAll adds a batch of commands to the registry.
func (*Registry) SetOverlay ¶ added in v0.0.2
func (r *Registry) SetOverlay(ic InteractiveCommand)
SetOverlay sets the active interactive overlay.
type ResumeCommand ¶ added in v0.0.2
type ResumeCommand struct {
// contains filtered or unexported fields
}
ResumeCommand implements InteractiveCommand for /resume. Opens an interactive overlay to select and switch sessions.
func NewResumeCommand ¶ added in v0.0.2
func NewResumeCommand(app *App) *ResumeCommand
func (*ResumeCommand) Active ¶ added in v0.0.2
func (c *ResumeCommand) Active() bool
func (*ResumeCommand) Dismiss ¶ added in v0.0.2
func (c *ResumeCommand) Dismiss()
func (*ResumeCommand) Run ¶ added in v0.0.2
func (c *ResumeCommand) Run(ctx *CommandContext, _ CommandInvocation) tea.Cmd
func (*ResumeCommand) Spec ¶ added in v0.0.2
func (c *ResumeCommand) Spec() CommandSpec
func (*ResumeCommand) View ¶ added in v0.0.2
func (c *ResumeCommand) View(width int) string
type SimpleCommand ¶ added in v0.0.2
type SimpleCommand struct {
// contains filtered or unexported fields
}
SimpleCommand wraps a plain function as a Command.
func NewSimple ¶ added in v0.0.2
func NewSimple(spec CommandSpec, run func(*CommandContext, CommandInvocation) tea.Cmd) *SimpleCommand
NewSimple creates a SimpleCommand.
func (*SimpleCommand) Run ¶ added in v0.0.2
func (c *SimpleCommand) Run(ctx *CommandContext, inv CommandInvocation) tea.Cmd
func (*SimpleCommand) Spec ¶ added in v0.0.2
func (c *SimpleCommand) Spec() CommandSpec
type SkillCommand ¶ added in v0.0.2
type SkillCommand struct {
// contains filtered or unexported fields
}
func (*SkillCommand) Run ¶ added in v0.0.2
func (c *SkillCommand) Run(ctx *CommandContext, inv CommandInvocation) tea.Cmd
func (*SkillCommand) Spec ¶ added in v0.0.2
func (c *SkillCommand) Spec() CommandSpec
type TasksCommand ¶ added in v0.0.3
type TasksCommand struct {
// contains filtered or unexported fields
}
TasksCommand implements InteractiveCommand for /tasks. Shows background bash commands and agent tasks in a grouped overlay.
func NewTasksCommand ¶ added in v0.0.3
func NewTasksCommand(app *App) *TasksCommand
func (*TasksCommand) Active ¶ added in v0.0.3
func (c *TasksCommand) Active() bool
func (*TasksCommand) Dismiss ¶ added in v0.0.3
func (c *TasksCommand) Dismiss()
func (*TasksCommand) Run ¶ added in v0.0.3
func (c *TasksCommand) Run(ctx *CommandContext, _ CommandInvocation) tea.Cmd
func (*TasksCommand) Spec ¶ added in v0.0.3
func (c *TasksCommand) Spec() CommandSpec
func (*TasksCommand) View ¶ added in v0.0.3
func (c *TasksCommand) View(width int) string
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package imageinput handles image input from clipboard paste and file drag-drop, converting raw data to agentcore ContentBlocks.
|
Package imageinput handles image input from clipboard paste and file drag-drop, converting raw data to agentcore ContentBlocks. |