Documentation
¶
Index ¶
- Variables
- func BaseStyle() lipgloss.Style
- func CreateBadge(text string, color lipgloss.AdaptiveColor) string
- func CreateGradientText(text string, startColor, endColor lipgloss.AdaptiveColor) string
- func CreateProgressBar(width int, percentage float64, theme Theme) string
- func CreateSeparator(width int, char string, color lipgloss.AdaptiveColor) string
- func EstimateTokens(text string) int
- func FormatCompactLine(symbol, label, content string, ...) string
- func GetAllCommandNames() []string
- func GetMarkdownRenderer(width int) *glamour.TermRenderer
- func SetTheme(theme Theme)
- func StyleCard(width int, theme Theme) lipgloss.Style
- func StyleCompactContent(color lipgloss.AdaptiveColor) lipgloss.Style
- func StyleCompactLabel(color lipgloss.AdaptiveColor) lipgloss.Style
- func StyleCompactSymbol(symbol string, color lipgloss.AdaptiveColor) lipgloss.Style
- func StyleError(theme Theme) lipgloss.Style
- func StyleHeader(theme Theme) lipgloss.Style
- func StyleInfo(theme Theme) lipgloss.Style
- func StyleMuted(theme Theme) lipgloss.Style
- func StyleSubheader(theme Theme) lipgloss.Style
- func StyleSuccess(theme Theme) lipgloss.Style
- func StyleWarning(theme Theme) lipgloss.Style
- func WithAlign(align lipgloss.Position) renderingOption
- func WithBorderColor(color lipgloss.AdaptiveColor) renderingOption
- func WithFullWidth() renderingOption
- func WithMarginBottom(margin int) renderingOption
- func WithMarginTop(margin int) renderingOption
- func WithPaddingBottom(padding int) renderingOption
- func WithPaddingLeft(padding int) renderingOption
- func WithPaddingRight(padding int) renderingOption
- func WithPaddingTop(padding int) renderingOption
- func WithWidth(width int) renderingOption
- type AgentInterface
- type CLI
- func (c *CLI) ClearMessages()
- func (c *CLI) CreateCallbackHandler() callbacks.Handler
- func (c *CLI) DisplayAssistantMessage(message string) error
- func (c *CLI) DisplayAssistantMessageWithModel(message, modelName string) error
- func (c *CLI) DisplayCancellation()
- func (c *CLI) DisplayDebugConfig(config map[string]any)
- func (c *CLI) DisplayDebugMessage(message string)
- func (c *CLI) DisplayError(err error)
- func (c *CLI) DisplayHelp()
- func (c *CLI) DisplayInfo(message string)
- func (c *CLI) DisplayServers(servers []string)
- func (c *CLI) DisplayToolCallMessage(toolName, toolArgs string)
- func (c *CLI) DisplayToolMessage(toolName, toolArgs, toolResult string, isError bool)
- func (c *CLI) DisplayTools(tools []string)
- func (c *CLI) DisplayUsageAfterResponse()
- func (c *CLI) DisplayUsageStats()
- func (c *CLI) DisplayUserMessage(message string)
- func (c *CLI) GetDebugLogger() *CLIDebugLogger
- func (c *CLI) GetPrompt() (string, error)
- func (c *CLI) HandleSlashCommand(input string, servers []string, tools []string) SlashCommandResult
- func (c *CLI) IsSlashCommand(input string) bool
- func (c *CLI) ResetUsageStats()
- func (c *CLI) SetModelName(modelName string)
- func (c *CLI) SetUsageTracker(tracker *UsageTracker)
- func (c *CLI) ShowSpinner(message string, action func() error) error
- func (c *CLI) StartStreamingMessage(modelName string)
- func (c *CLI) UpdateStreamingMessage(content string)
- func (c *CLI) UpdateUsage(inputText, outputText string)
- func (c *CLI) UpdateUsageFromResponse(response *schema.Message, inputText string)
- type CLIDebugLogger
- type CLISetupOptions
- type CompactRenderer
- func (r *CompactRenderer) RenderAssistantMessage(content string, timestamp time.Time, modelName string) UIMessage
- func (r *CompactRenderer) RenderDebugConfigMessage(config map[string]any, timestamp time.Time) UIMessage
- func (r *CompactRenderer) RenderDebugMessage(message string, timestamp time.Time) UIMessage
- func (r *CompactRenderer) RenderErrorMessage(errorMsg string, timestamp time.Time) UIMessage
- func (r *CompactRenderer) RenderSystemMessage(content string, timestamp time.Time) UIMessage
- func (r *CompactRenderer) RenderToolCallMessage(toolName, toolArgs string, timestamp time.Time) UIMessage
- func (r *CompactRenderer) RenderToolMessage(toolName, toolArgs, toolResult string, isError bool) UIMessage
- func (r *CompactRenderer) RenderUserMessage(content string, timestamp time.Time) UIMessage
- func (r *CompactRenderer) SetWidth(width int)
- type FuzzyMatch
- type MessageContainer
- func (c *MessageContainer) AddMessage(msg UIMessage)
- func (c *MessageContainer) Clear()
- func (c *MessageContainer) Render() string
- func (c *MessageContainer) SetModelName(modelName string)
- func (c *MessageContainer) SetSize(width, height int)
- func (c *MessageContainer) UpdateLastMessage(content string)
- type MessageRenderer
- func (r *MessageRenderer) RenderAssistantMessage(content string, timestamp time.Time, modelName string) UIMessage
- func (r *MessageRenderer) RenderDebugConfigMessage(config map[string]any, timestamp time.Time) UIMessage
- func (r *MessageRenderer) RenderDebugMessage(message string, timestamp time.Time) UIMessage
- func (r *MessageRenderer) RenderErrorMessage(errorMsg string, timestamp time.Time) UIMessage
- func (r *MessageRenderer) RenderSystemMessage(content string, timestamp time.Time) UIMessage
- func (r *MessageRenderer) RenderToolCallMessage(toolName, toolArgs string, timestamp time.Time) UIMessage
- func (r *MessageRenderer) RenderToolMessage(toolName, toolArgs, toolResult string, isError bool) UIMessage
- func (r *MessageRenderer) RenderUserMessage(content string, timestamp time.Time) UIMessage
- func (r *MessageRenderer) SetWidth(width int)
- type MessageType
- type SessionStats
- type SlashCommand
- type SlashCommandInput
- type SlashCommandResult
- type Spinner
- type Theme
- type UIMessage
- type UsageStats
- type UsageTracker
- func (ut *UsageTracker) EstimateAndUpdateUsage(inputText, outputText string)
- func (ut *UsageTracker) EstimateAndUpdateUsageFromText(inputText, outputText string)
- func (ut *UsageTracker) GetLastRequestStats() *UsageStats
- func (ut *UsageTracker) GetSessionStats() SessionStats
- func (ut *UsageTracker) RenderUsageInfo() string
- func (ut *UsageTracker) Reset()
- func (ut *UsageTracker) SetWidth(width int)
- func (ut *UsageTracker) UpdateUsage(inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens int)
Constants ¶
This section is empty.
Variables ¶
var SlashCommands = []SlashCommand{ { Name: "/help", Description: "Show available commands and usage information", Category: "Info", Aliases: []string{"/h", "/?"}, }, { Name: "/tools", Description: "List all available MCP tools", Category: "Info", Aliases: []string{"/t"}, }, { Name: "/servers", Description: "Show connected MCP servers", Category: "Info", Aliases: []string{"/s"}, }, { Name: "/clear", Description: "Clear conversation and start fresh", Category: "System", Aliases: []string{"/c", "/cls"}, }, { Name: "/usage", Description: "Show token usage statistics", Category: "Info", Aliases: []string{"/u"}, }, { Name: "/reset-usage", Description: "Reset usage statistics", Category: "System", Aliases: []string{"/ru"}, }, { Name: "/quit", Description: "Exit the application", Category: "System", Aliases: []string{"/q", "/exit"}, }, }
SlashCommands is the registry of all available slash commands
Functions ¶
func CreateBadge ¶ added in v0.17.0
func CreateBadge(text string, color lipgloss.AdaptiveColor) string
CreateBadge creates a styled badge
func CreateGradientText ¶ added in v0.17.0
func CreateGradientText(text string, startColor, endColor lipgloss.AdaptiveColor) string
CreateGradientText creates text with gradient-like effect using different shades
func CreateProgressBar ¶ added in v0.17.0
CreateProgressBar creates a simple progress bar
func CreateSeparator ¶ added in v0.17.0
func CreateSeparator(width int, char string, color lipgloss.AdaptiveColor) string
CreateSeparator creates a styled separator line
func EstimateTokens ¶ added in v0.14.0
EstimateTokens provides a rough estimate of tokens in text This is a simple approximation - real token counting would require the actual tokenizer
func FormatCompactLine ¶ added in v0.19.0
func FormatCompactLine(symbol, label, content string, symbolColor, labelColor, contentColor lipgloss.AdaptiveColor) string
FormatCompactLine formats a complete compact line with consistent spacing
func GetAllCommandNames ¶ added in v0.21.0
func GetAllCommandNames() []string
GetAllCommandNames returns all command names and aliases
func GetMarkdownRenderer ¶
func GetMarkdownRenderer(width int) *glamour.TermRenderer
GetMarkdownRenderer returns a glamour TermRenderer configured for our use
func StyleCompactContent ¶ added in v0.19.0
func StyleCompactContent(color lipgloss.AdaptiveColor) lipgloss.Style
StyleCompactContent creates basic content styling for compact mode
func StyleCompactLabel ¶ added in v0.19.0
func StyleCompactLabel(color lipgloss.AdaptiveColor) lipgloss.Style
StyleCompactLabel creates a styled label for compact mode
func StyleCompactSymbol ¶ added in v0.19.0
func StyleCompactSymbol(symbol string, color lipgloss.AdaptiveColor) lipgloss.Style
StyleCompactSymbol creates a styled symbol for compact mode
func StyleError ¶ added in v0.17.0
StyleError creates error text styling
func StyleHeader ¶ added in v0.17.0
StyleHeader creates a styled header
func StyleMuted ¶ added in v0.17.0
StyleMuted creates muted text styling
func StyleSubheader ¶ added in v0.17.0
StyleSubheader creates a styled subheader
func StyleSuccess ¶ added in v0.17.0
StyleSuccess creates success text styling
func StyleWarning ¶ added in v0.17.0
StyleWarning creates warning text styling
func WithBorderColor ¶ added in v0.17.0
func WithBorderColor(color lipgloss.AdaptiveColor) renderingOption
WithBorderColor sets the border color
func WithFullWidth ¶ added in v0.17.0
func WithFullWidth() renderingOption
WithFullWidth makes the block take full available width
func WithMarginBottom ¶ added in v0.17.0
func WithMarginBottom(margin int) renderingOption
WithMarginBottom sets the bottom margin
func WithMarginTop ¶ added in v0.17.0
func WithMarginTop(margin int) renderingOption
WithMarginTop sets the top margin
func WithPaddingBottom ¶ added in v0.17.0
func WithPaddingBottom(padding int) renderingOption
WithPaddingBottom sets the bottom padding
func WithPaddingLeft ¶ added in v0.17.0
func WithPaddingLeft(padding int) renderingOption
WithPaddingLeft sets the left padding
func WithPaddingRight ¶ added in v0.17.0
func WithPaddingRight(padding int) renderingOption
WithPaddingRight sets the right padding
func WithPaddingTop ¶ added in v0.17.0
func WithPaddingTop(padding int) renderingOption
WithPaddingTop sets the top padding
Types ¶
type AgentInterface ¶ added in v0.19.0
type AgentInterface interface { GetLoadingMessage() string GetTools() []any // Using any to avoid importing tool types GetLoadedServerNames() []string // Add this method for debug config }
AgentInterface defines the interface we need from agent to avoid import cycles
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI handles the command line interface with improved message rendering
func SetupCLI ¶ added in v0.19.0
func SetupCLI(opts *CLISetupOptions) (*CLI, error)
SetupCLI creates and configures CLI with standard info display
func (*CLI) ClearMessages ¶
func (c *CLI) ClearMessages()
ClearMessages clears all messages from the container
func (*CLI) CreateCallbackHandler ¶
CreateCallbackHandler creates a callback handler using HandlerHelper
func (*CLI) DisplayAssistantMessage ¶
DisplayAssistantMessage displays the assistant's message using the new renderer
func (*CLI) DisplayAssistantMessageWithModel ¶
DisplayAssistantMessageWithModel displays the assistant's message with model info
func (*CLI) DisplayCancellation ¶ added in v0.14.0
func (c *CLI) DisplayCancellation()
DisplayCancellation displays a cancellation message
func (*CLI) DisplayDebugConfig ¶ added in v0.12.0
DisplayDebugConfig displays configuration settings using the appropriate renderer
func (*CLI) DisplayDebugMessage ¶ added in v0.28.0
DisplayDebugMessage displays debug messages using the appropriate renderer
func (*CLI) DisplayError ¶
DisplayError displays an error message using the appropriate renderer
func (*CLI) DisplayHelp ¶
func (c *CLI) DisplayHelp()
DisplayHelp displays help information in a message block
func (*CLI) DisplayInfo ¶
DisplayInfo displays an informational message using the appropriate renderer
func (*CLI) DisplayServers ¶
DisplayServers displays configured MCP servers in a message block
func (*CLI) DisplayToolCallMessage ¶
DisplayToolCallMessage displays a tool call in progress
func (*CLI) DisplayToolMessage ¶
DisplayToolMessage displays a tool call message
func (*CLI) DisplayTools ¶
DisplayTools displays available tools in a message block
func (*CLI) DisplayUsageAfterResponse ¶ added in v0.19.0
func (c *CLI) DisplayUsageAfterResponse()
DisplayUsageAfterResponse displays usage information immediately after a response
func (*CLI) DisplayUsageStats ¶ added in v0.14.0
func (c *CLI) DisplayUsageStats()
DisplayUsageStats displays current usage statistics
func (*CLI) DisplayUserMessage ¶
DisplayUserMessage displays the user's message using the appropriate renderer
func (*CLI) GetDebugLogger ¶ added in v0.28.0
func (c *CLI) GetDebugLogger() *CLIDebugLogger
GetDebugLogger returns a debug logger that uses the CLI for rendering
func (*CLI) HandleSlashCommand ¶
func (c *CLI) HandleSlashCommand(input string, servers []string, tools []string) SlashCommandResult
HandleSlashCommand handles slash commands and returns the result
func (*CLI) IsSlashCommand ¶
IsSlashCommand checks if the input is a slash command
func (*CLI) ResetUsageStats ¶ added in v0.14.0
func (c *CLI) ResetUsageStats()
ResetUsageStats resets the usage tracking statistics
func (*CLI) SetModelName ¶ added in v0.19.0
SetModelName sets the current model name for the CLI
func (*CLI) SetUsageTracker ¶ added in v0.14.0
func (c *CLI) SetUsageTracker(tracker *UsageTracker)
SetUsageTracker sets the usage tracker for the CLI
func (*CLI) ShowSpinner ¶
ShowSpinner displays a spinner with the given message and executes the action
func (*CLI) StartStreamingMessage ¶ added in v0.18.0
StartStreamingMessage starts a streaming assistant message
func (*CLI) UpdateStreamingMessage ¶ added in v0.18.0
UpdateStreamingMessage updates the streaming message with new content
func (*CLI) UpdateUsage ¶ added in v0.14.0
UpdateUsage updates the usage tracker with token counts and costs
type CLIDebugLogger ¶ added in v0.28.0
type CLIDebugLogger struct {
// contains filtered or unexported fields
}
CLIDebugLogger implements the tools.DebugLogger interface using CLI rendering
func NewCLIDebugLogger ¶ added in v0.28.0
func NewCLIDebugLogger(cli *CLI) *CLIDebugLogger
NewCLIDebugLogger creates a new CLI debug logger
func (*CLIDebugLogger) IsDebugEnabled ¶ added in v0.28.0
func (l *CLIDebugLogger) IsDebugEnabled() bool
IsDebugEnabled returns whether debug logging is enabled
func (*CLIDebugLogger) LogDebug ¶ added in v0.28.0
func (l *CLIDebugLogger) LogDebug(message string)
LogDebug logs a debug message using the CLI's debug message renderer
type CLISetupOptions ¶ added in v0.19.0
type CLISetupOptions struct { Agent AgentInterface ModelString string Debug bool Compact bool Quiet bool ShowDebug bool // Whether to show debug config ProviderAPIKey string // For OAuth detection }
CLISetupOptions contains options for setting up CLI
type CompactRenderer ¶ added in v0.19.0
type CompactRenderer struct {
// contains filtered or unexported fields
}
CompactRenderer handles rendering messages in compact format
func NewCompactRenderer ¶ added in v0.19.0
func NewCompactRenderer(width int, debug bool) *CompactRenderer
NewCompactRenderer creates a new compact message renderer
func (*CompactRenderer) RenderAssistantMessage ¶ added in v0.19.0
func (r *CompactRenderer) RenderAssistantMessage(content string, timestamp time.Time, modelName string) UIMessage
RenderAssistantMessage renders an assistant message in compact format
func (*CompactRenderer) RenderDebugConfigMessage ¶ added in v0.19.0
func (r *CompactRenderer) RenderDebugConfigMessage(config map[string]any, timestamp time.Time) UIMessage
RenderDebugConfigMessage renders debug config in compact format
func (*CompactRenderer) RenderDebugMessage ¶ added in v0.28.0
func (r *CompactRenderer) RenderDebugMessage(message string, timestamp time.Time) UIMessage
RenderDebugMessage renders debug messages in compact format
func (*CompactRenderer) RenderErrorMessage ¶ added in v0.19.0
func (r *CompactRenderer) RenderErrorMessage(errorMsg string, timestamp time.Time) UIMessage
RenderErrorMessage renders an error message in compact format
func (*CompactRenderer) RenderSystemMessage ¶ added in v0.19.0
func (r *CompactRenderer) RenderSystemMessage(content string, timestamp time.Time) UIMessage
RenderSystemMessage renders a system message in compact format
func (*CompactRenderer) RenderToolCallMessage ¶ added in v0.19.0
func (r *CompactRenderer) RenderToolCallMessage(toolName, toolArgs string, timestamp time.Time) UIMessage
RenderToolCallMessage renders a tool call in progress in compact format
func (*CompactRenderer) RenderToolMessage ¶ added in v0.19.0
func (r *CompactRenderer) RenderToolMessage(toolName, toolArgs, toolResult string, isError bool) UIMessage
RenderToolMessage renders a tool result in compact format
func (*CompactRenderer) RenderUserMessage ¶ added in v0.19.0
func (r *CompactRenderer) RenderUserMessage(content string, timestamp time.Time) UIMessage
RenderUserMessage renders a user message in compact format
func (*CompactRenderer) SetWidth ¶ added in v0.19.0
func (r *CompactRenderer) SetWidth(width int)
SetWidth updates the renderer width
type FuzzyMatch ¶ added in v0.21.0
type FuzzyMatch struct { Command *SlashCommand Score int }
FuzzyMatch represents a match result with score
func FuzzyMatchCommands ¶ added in v0.21.0
func FuzzyMatchCommands(query string, commands []SlashCommand) []FuzzyMatch
FuzzyMatchCommands performs fuzzy matching on slash commands
type MessageContainer ¶
type MessageContainer struct {
// contains filtered or unexported fields
}
MessageContainer wraps multiple messages in a container
func NewMessageContainer ¶
func NewMessageContainer(width, height int, compact bool) *MessageContainer
NewMessageContainer creates a new message container
func (*MessageContainer) AddMessage ¶
func (c *MessageContainer) AddMessage(msg UIMessage)
AddMessage adds a message to the container
func (*MessageContainer) Clear ¶
func (c *MessageContainer) Clear()
Clear clears all messages from the container
func (*MessageContainer) Render ¶
func (c *MessageContainer) Render() string
Render renders all messages in the container
func (*MessageContainer) SetModelName ¶ added in v0.19.0
func (c *MessageContainer) SetModelName(modelName string)
SetModelName sets the current model name for the container
func (*MessageContainer) SetSize ¶
func (c *MessageContainer) SetSize(width, height int)
SetSize updates the container size
func (*MessageContainer) UpdateLastMessage ¶ added in v0.18.0
func (c *MessageContainer) UpdateLastMessage(content string)
UpdateLastMessage updates the content of the last message efficiently
type MessageRenderer ¶
type MessageRenderer struct {
// contains filtered or unexported fields
}
MessageRenderer handles rendering of messages with proper styling
func NewMessageRenderer ¶
func NewMessageRenderer(width int, debug bool) *MessageRenderer
NewMessageRenderer creates a new message renderer
func (*MessageRenderer) RenderAssistantMessage ¶
func (r *MessageRenderer) RenderAssistantMessage(content string, timestamp time.Time, modelName string) UIMessage
RenderAssistantMessage renders an assistant message with left border and background header
func (*MessageRenderer) RenderDebugConfigMessage ¶ added in v0.12.0
func (r *MessageRenderer) RenderDebugConfigMessage(config map[string]any, timestamp time.Time) UIMessage
RenderDebugConfigMessage renders debug configuration settings with tool response block styling
func (*MessageRenderer) RenderDebugMessage ¶ added in v0.28.0
func (r *MessageRenderer) RenderDebugMessage(message string, timestamp time.Time) UIMessage
RenderDebugMessage renders debug messages with tool response block styling
func (*MessageRenderer) RenderErrorMessage ¶
func (r *MessageRenderer) RenderErrorMessage(errorMsg string, timestamp time.Time) UIMessage
RenderErrorMessage renders an error message with left border and background header
func (*MessageRenderer) RenderSystemMessage ¶
func (r *MessageRenderer) RenderSystemMessage(content string, timestamp time.Time) UIMessage
RenderSystemMessage renders a system message with left border and background header
func (*MessageRenderer) RenderToolCallMessage ¶
func (r *MessageRenderer) RenderToolCallMessage(toolName, toolArgs string, timestamp time.Time) UIMessage
RenderToolCallMessage renders a tool call in progress with left border and background header
func (*MessageRenderer) RenderToolMessage ¶
func (r *MessageRenderer) RenderToolMessage(toolName, toolArgs, toolResult string, isError bool) UIMessage
RenderToolMessage renders a tool call message with proper styling
func (*MessageRenderer) RenderUserMessage ¶
func (r *MessageRenderer) RenderUserMessage(content string, timestamp time.Time) UIMessage
RenderUserMessage renders a user message with right border and background header
func (*MessageRenderer) SetWidth ¶
func (r *MessageRenderer) SetWidth(width int)
SetWidth updates the renderer width
type MessageType ¶
type MessageType int
MessageType represents the type of message
const ( UserMessage MessageType = iota AssistantMessage ToolMessage ToolCallMessage // New type for showing tool calls in progress SystemMessage // New type for MCPHost system messages (help, tools, etc.) ErrorMessage // New type for error messages )
type SessionStats ¶ added in v0.14.0
type SessionStats struct { TotalInputTokens int TotalOutputTokens int TotalCacheReadTokens int TotalCacheWriteTokens int TotalCost float64 RequestCount int }
SessionStats represents cumulative stats for the entire session
type SlashCommand ¶ added in v0.21.0
type SlashCommand struct { Name string Description string Aliases []string Category string // e.g., "Navigation", "System", "Info" }
SlashCommand represents a slash command with its metadata
func GetCommandByName ¶ added in v0.21.0
func GetCommandByName(name string) *SlashCommand
GetCommandByName returns a command by its name or alias
type SlashCommandInput ¶ added in v0.21.0
type SlashCommandInput struct {
// contains filtered or unexported fields
}
SlashCommandInput is a custom input field with slash command autocomplete
func NewSlashCommandInput ¶ added in v0.21.0
func NewSlashCommandInput(width int, title string) *SlashCommandInput
NewSlashCommandInput creates a new slash command input field
func (*SlashCommandInput) Cancelled ¶ added in v0.21.0
func (s *SlashCommandInput) Cancelled() bool
Cancelled returns true if the user cancelled
func (*SlashCommandInput) Init ¶ added in v0.21.0
func (s *SlashCommandInput) Init() tea.Cmd
Init implements tea.Model
func (*SlashCommandInput) RenderedLines ¶ added in v0.21.0
func (s *SlashCommandInput) RenderedLines() int
RenderedLines returns how many lines were rendered
func (*SlashCommandInput) Value ¶ added in v0.21.0
func (s *SlashCommandInput) Value() string
Value returns the final value
func (*SlashCommandInput) View ¶ added in v0.21.0
func (s *SlashCommandInput) View() string
View implements tea.Model
type SlashCommandResult ¶ added in v0.17.0
SlashCommandResult represents the result of handling a slash command
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner wraps the bubbles spinner for both interactive and non-interactive mode
func NewSpinner ¶
NewSpinner creates a new spinner with enhanced styling
func NewThemedSpinner ¶
func NewThemedSpinner(message string, color lipgloss.AdaptiveColor) *Spinner
NewThemedSpinner creates a new spinner with the given message and color
type Theme ¶ added in v0.17.0
type Theme struct { Primary lipgloss.AdaptiveColor Secondary lipgloss.AdaptiveColor Success lipgloss.AdaptiveColor Warning lipgloss.AdaptiveColor Error lipgloss.AdaptiveColor Info lipgloss.AdaptiveColor Text lipgloss.AdaptiveColor Muted lipgloss.AdaptiveColor VeryMuted lipgloss.AdaptiveColor Background lipgloss.AdaptiveColor Border lipgloss.AdaptiveColor MutedBorder lipgloss.AdaptiveColor System lipgloss.AdaptiveColor Tool lipgloss.AdaptiveColor Accent lipgloss.AdaptiveColor Highlight lipgloss.AdaptiveColor }
Theme represents a complete UI theme
func DefaultTheme ¶ added in v0.17.0
func DefaultTheme() Theme
DefaultTheme returns the default MCPHost theme (Catppuccin Mocha)
type UIMessage ¶
type UIMessage struct { ID string Type MessageType Position int Height int Content string Timestamp time.Time Streaming bool }
UIMessage represents a rendered message for display
type UsageStats ¶ added in v0.14.0
type UsageStats struct { InputTokens int OutputTokens int CacheReadTokens int CacheWriteTokens int InputCost float64 OutputCost float64 CacheReadCost float64 CacheWriteCost float64 TotalCost float64 }
UsageStats represents token and cost information for a single request/response
type UsageTracker ¶ added in v0.14.0
type UsageTracker struct {
// contains filtered or unexported fields
}
UsageTracker tracks token usage and costs for LLM interactions
func NewUsageTracker ¶ added in v0.14.0
func NewUsageTracker(modelInfo *models.ModelInfo, provider string, width int, isOAuth bool) *UsageTracker
NewUsageTracker creates a new usage tracker for the given model
func (*UsageTracker) EstimateAndUpdateUsage ¶ added in v0.14.0
func (ut *UsageTracker) EstimateAndUpdateUsage(inputText, outputText string)
EstimateAndUpdateUsage estimates tokens from text and updates usage
func (*UsageTracker) EstimateAndUpdateUsageFromText ¶ added in v0.14.0
func (ut *UsageTracker) EstimateAndUpdateUsageFromText(inputText, outputText string)
EstimateAndUpdateUsageFromText estimates tokens from text and updates usage
func (*UsageTracker) GetLastRequestStats ¶ added in v0.14.0
func (ut *UsageTracker) GetLastRequestStats() *UsageStats
GetLastRequestStats returns a copy of the last request statistics
func (*UsageTracker) GetSessionStats ¶ added in v0.14.0
func (ut *UsageTracker) GetSessionStats() SessionStats
GetSessionStats returns a copy of the current session statistics
func (*UsageTracker) RenderUsageInfo ¶ added in v0.14.0
func (ut *UsageTracker) RenderUsageInfo() string
RenderUsageInfo renders enhanced usage information with better styling
func (*UsageTracker) Reset ¶ added in v0.14.0
func (ut *UsageTracker) Reset()
Reset clears all usage statistics
func (*UsageTracker) SetWidth ¶ added in v0.14.0
func (ut *UsageTracker) SetWidth(width int)
SetWidth updates the display width for rendering
func (*UsageTracker) UpdateUsage ¶ added in v0.14.0
func (ut *UsageTracker) UpdateUsage(inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens int)
UpdateUsage updates the tracker with new usage information