Documentation
¶
Overview ¶
Package command provides slash command implementations for the TUI. This file adds team-related slash commands for the Team collaboration mode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrQuit signals the main loop to exit gracefully. ErrQuit = fmt.Errorf("quit") )
sentinel errors used by the TUI main loop to detect special commands.
Functions ¶
func RegisterBuiltins ¶
func RegisterBuiltins(r *Registry)
RegisterBuiltins adds all built-in slash commands to the registry.
func RegisterTeamCommands ¶
func RegisterTeamCommands(r *Registry)
RegisterTeamCommands registers all team-related slash commands.
Types ¶
type Command ¶
type Command interface {
// Name returns the command name without the leading '/'
Name() string
// Aliases returns alternative names for the command.
Aliases() []string
// Description returns a short help string shown in /help and completion.
Description() string
// Execute runs the command. The args string contains everything
// after the command name (trimmed).
Execute(ctx context.Context, env *Env, args string) error
}
Command is the interface that all slash commands must implement.
type CreateTeamReq ¶
CreateTeamReq is the request for creating a team.
type Env ¶
type Env struct {
// Out is the output writer (usually os.Stdout).
Out io.Writer
// ClearHistory resets the conversation message history
ClearHistory func()
// Model returns the current the conversation message history
Model func() string
// SessionKey returns the current session identifier.
SessionKey func() string
// TeamState holds the current active team state (nil if no team).
TeamState *TeamState
// SetTeamState updates the TUI's team state (called by team commands).
SetTeamState func(state *TeamState)
// TeamAPI provides the backend API for team operations.
TeamAPI TeamAPI
}
Env provides the runtime environment that commands can interact with. It is passed to every command's Execute method.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages all registered slash commands.
It provides lookup by name or alias, prefix-based completion, and formatted help output.
func (*Registry) CommandInfos ¶
func (r *Registry) CommandInfos() []input.CommandInfo
CommandInfos returns metadata for all commands, suitable for the input completer.
type TeamAPI ¶
type TeamAPI interface {
// ListTemplates returns available team templates.
ListTemplates(ctx context.Context) ([]TemplateInfo, error)
// CreateTeam creates a team from a template or ad-hoc.
CreateTeam(ctx context.Context, req CreateTeamReq) (*TeamState, error)
// GetTeam returns the current team state.
GetTeam(ctx context.Context, teamID string) (*TeamState, error)
// DissolveTeam dissolves the current team.
DissolveTeam(ctx context.Context, teamID string) error
// SendMessage sends a message to a specific team member.
SendMessage(ctx context.Context, teamID, recipientLabel, content string) error
// Broadcast sends a message to all team members.
Broadcast(ctx context.Context, teamID, content string) error
}
TeamAPI defines the interface the TUI needs for team operations. This decouples the TUI from the concrete HTTP client / server-side implementation.
type TeamMemberState ¶
type TeamMemberState struct {
ID string
SessionID string
Label string
Role string
Status string // idle, running, completed, failed
Progress string
IsLeader bool
NodeID string
}
TeamMemberState represents a team member's status for display.
func (*TeamMemberState) RoleIcon ¶
func (m *TeamMemberState) RoleIcon() string
RoleIcon returns the appropriate icon for the member's role.
func (*TeamMemberState) StatusIcon ¶
func (m *TeamMemberState) StatusIcon() string
StatusIcon returns the appropriate icon for the member's status.
type TeamState ¶
type TeamState struct {
// Enabled indicates whether a team is currently active.
Enabled bool
// ID is the current team's ID.
ID string
// Name is the current team's name.
Name string
// Strategy is the team's coordination strategy.
Strategy string
// Members lists the current team members and their states.
Members []TeamMemberState
// FocusIndex tracks which member is currently focused (-1 = none).
FocusIndex int
}
TeamState holds the current team state exposed to commands. The TUI sets this on the Env before executing team commands.