Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v1.110.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
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

func AgentReturn(fromAgent, toAgent string) *Message

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 Cancelled

func Cancelled() *Message

func Error

func Error(content string) *Message

func Loading

func Loading(description string) *Message

func ShellOutput

func ShellOutput(content string) *Message

func Spinner

func Spinner() *Message

func SpinnerLabeled added in v1.88.0

func SpinnerLabeled(sender, label string) *Message

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 ToolCallMessage(agentName string, toolCall tools.ToolCall, toolDef tools.Tool, status ToolStatus) *Message

func User

func User(content string) *Message

func Welcome

func Welcome(content string) *Message

func (*Message) AppendToolOutput added in v1.70.2

func (m *Message) AppendToolOutput(output string)

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL