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

types

package
v1.72.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	UserMessageEditLabel      = "✎"
	AssistantMessageCopyLabel = "⎘"
)

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 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 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
)

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