Documentation
¶
Index ¶
- Constants
- type Message
- func Agent(typ MessageType, agentName, content string) *Message
- func AgentReturn(fromAgent, toAgent string) *Message
- func Cancelled() *Message
- func Error(content string) *Message
- func Loading(description string) *Message
- func ShellOutput(content string) *Message
- func Spinner() *Message
- func SpinnerLabeled(sender, label string) *Message
- func ToolCallMessage(agentName string, toolCall tools.ToolCall, toolDef tools.Tool, ...) *Message
- func User(content string) *Message
- func Welcome(content string) *Message
- type MessageType
- type ToolStatus
Constants ¶
const ( UserMessageEditLabel = "✎ edit" MessageCopyLabel = "⎘ copy" ErrorRetryLabel = "↻ retry" // AgentReturnLabel is the connector between the child and parent badges // of a delegation-return transition (see AgentReturn). AgentReturnLabel = "returned control to" // MessageActionSeparator joins adjacent action labels (e.g. edit + copy) // on a message's hover-action row. MessageActionSeparator = " " // CopiedFeedbackLabel transiently replaces a clicked copy label. It must // keep the exact display width of the copy labels so the swap never // shifts the layout of the line it happens on. CopiedFeedbackLabel = "copied" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
Type MessageType
Content string
Sender string // Agent name for assistant messages
ToolCall tools.ToolCall // Associated tool call for tool messages
ToolDefinition tools.Tool // Definition of the tool being called
ToolStatus ToolStatus // Status for tool calls
ToolResult *tools.ToolCallResult // Result of tool call (when completed)
// StartedAt records when a tool call entered ToolStatusRunning.
// Used to display elapsed time for long-running tool calls.
StartedAt *time.Time
// SessionPosition is the index of this message in session.Messages (when known).
// Used for operations like branching on edits.
SessionPosition *int
}
Message represents a single message in the chat
func Agent ¶
func Agent(typ MessageType, agentName, content string) *Message
func AgentReturn ¶ added in v1.104.0
AgentReturn is the delegation-return transition: fromAgent (the child) returned control to toAgent (the parent). Sender carries the child so the accent/badge machinery colors it like any other agent attribution; Content carries the parent name rather than copyable text — the message type is UI-only and is neither selectable nor copyable.
func ShellOutput ¶
func SpinnerLabeled ¶ added in v1.88.0
SpinnerLabeled is a pending-response spinner that names the agent we're waiting on. Sender drives the accent color; Content holds the label (e.g. "root → x"). Empty Content renders the default spinner.
func ToolCallMessage ¶
func (*Message) AppendToolOutput ¶ added in v1.70.2
type MessageType ¶
type MessageType int
MessageType represents different types of messages
const ( MessageTypeUser MessageType = iota MessageTypeAssistant MessageTypeAssistantReasoningBlock // Collapsed reasoning + tool calls block MessageTypeSpinner MessageTypeError MessageTypeShellOutput MessageTypeCancelled MessageTypeToolCall MessageTypeToolResult MessageTypeWelcome MessageTypeLoading // MessageTypeAgentReturn is the UI-only delegation-return transition shown // when a sub-agent hands control back to its parent. It is live feedback // for the AgentSwitching runtime event, which is not persisted to the // session, so it never reappears when a session is reloaded. MessageTypeAgentReturn )
type ToolStatus ¶
type ToolStatus int
ToolStatus represents the status of a tool call
const ( ToolStatusPending ToolStatus = iota ToolStatusConfirmation ToolStatusRunning ToolStatusCompleted ToolStatusError )