Documentation
¶
Index ¶
- func ExtractTextFromContent(content sdk.MessageContent, images []agentdomain.ImageAttachment) string
- func FormatCost(cost float64) string
- func FormatErrorCLI(message string) string
- func FormatResponsiveMessage(content string, width int) string
- func FormatSuccess(message string) string
- func FormatToolCall(toolName string, args map[string]any) string
- func FormatWarning(message string) string
- func GetResponsiveWidth(terminalWidth int) int
- func TruncateText(text string, maxLength int) string
- func WrapText(text string, width int) string
- type ConversationLineFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTextFromContent ¶
func ExtractTextFromContent(content sdk.MessageContent, images []agentdomain.ImageAttachment) string
ExtractTextFromContent extracts text from potentially multimodal message content
func FormatCost ¶
FormatCost formats cost with adaptive precision based on magnitude Returns "-" for zero cost, and uses 2-4 decimal places based on the amount
func FormatErrorCLI ¶
FormatErrorCLI creates an error message with red color for CLI output
func FormatResponsiveMessage ¶
FormatResponsiveMessage formats a message with responsive text wrapping
func FormatSuccess ¶
FormatSuccess creates a properly formatted success message
func FormatToolCall ¶
FormatToolCall formats a tool call for consistent display across the application
func FormatWarning ¶
FormatWarning creates a properly formatted warning message
func GetResponsiveWidth ¶
GetResponsiveWidth returns the content width for a terminal: the full width minus a small right margin, floored at minWidth. No upper cap — content fills the screen at any terminal size.
func TruncateText ¶
TruncateText truncates text to fit within maxLength display columns, adding "..." if needed. It is width-aware: multibyte and wide runes (emoji, CJK) and ANSI escapes are measured by rendered width and never split mid-grapheme.
Types ¶
type ConversationLineFormatter ¶
type ConversationLineFormatter struct {
// contains filtered or unexported fields
}
ConversationLineFormatter converts conversation entries to text lines
func NewConversationLineFormatter ¶
func NewConversationLineFormatter(width int, toolFormatter agentdomain.ToolFormatter) *ConversationLineFormatter
NewConversationLineFormatter creates a new conversation line formatter
func (*ConversationLineFormatter) FormatConversationToLines ¶
func (f *ConversationLineFormatter) FormatConversationToLines(conversation []convdomain.ConversationEntry) []string
FormatConversationToLines converts conversation entries to plain text lines
func (*ConversationLineFormatter) SetWidth ¶
func (f *ConversationLineFormatter) SetWidth(width int)
SetWidth updates the formatter width