Documentation
¶
Index ¶
- func ExtractTextFromContent(content sdk.MessageContent, images []agentdomain.ImageAttachment) string
- func FormatBytes(size int64) 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 PadText(text string, width int) string
- 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 FormatBytes ¶ added in v0.204.0
FormatBytes formats a byte count the way `docker system prune` reports reclaimed space: decimal (not 1024-based) units and 4 significant digits, e.g. "0B", "4.096kB", "1.653GB".
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 PadText ¶ added in v0.205.1
PadText fits text to exactly width display columns: truncated when wider, space-padded when narrower. Byte length is not display width once multibyte runes or ANSI escapes are involved, so never pad a TruncateText result with len() - that is how a negative strings.Repeat count gets built.
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