Documentation
¶
Overview ¶
Package contextmon provides context size monitoring and warnings
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
MaxChars int `yaml:"max_chars"` // Maximum context size in characters
WarningThreshold float64 `yaml:"warning_threshold"` // Percentage to trigger warning (0.0-1.0)
CriticalThreshold float64 `yaml:"critical_threshold"` // Percentage to trigger critical warning
TruncationThreshold float64 `yaml:"truncation_threshold"` // Percentage to auto-truncate
}
Config holds context monitoring configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default context monitoring configuration
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor tracks and reports context size
func NewMonitor ¶
NewMonitor creates a new context monitor with the given configuration
func (*Monitor) LastStatus ¶
LastStatus returns the last checked status (may be nil)
func (*Monitor) RecommendedHistoryCount ¶
RecommendedHistoryCount returns the recommended number of history messages based on current context size and average message length
func (*Monitor) ShouldTruncate ¶
ShouldTruncate returns true if the context should be truncated
func (*Monitor) UpdateConfig ¶
UpdateConfig updates the monitor configuration
type Status ¶
type Status struct {
CurrentSize int // Current size in characters
MaxSize int // Maximum allowed size
Percentage float64 // Usage percentage (0.0-1.0)
Level Level // Current warning level
}
Status represents the current context size status
func (Status) FormatWarning ¶
FormatWarning returns a formatted warning message for display