Skip to main contentModule utils
Source - CheckResult
- Check result with actionable error message
- RetryConfig
- Retry configuration
- Tokenizer
- Token counting utility using character-based estimation
Uses ~4 characters per token as a reasonable approximation
- MutexExt
- Extension trait for Mutex to provide safe lock operations
- check_ollama_available
- Check if Ollama is running and responding
- check_ollama_model
- Check if a specific model is available in Ollama
- format_relative_timestamp
- Format a timestamp as a relative, human-readable string
- format_tokens
- Format token count for display: “X.Xk” for >= 1000, raw number otherwise.
- init_logger
- Initialize the logging system with tracing
- lock_arc_mutex_safe
- Safe lock for Arc<Mutex> - standalone function since we can’t impl on Arc
- log_debug
- Log a debug message (backward compatible)
- log_error
- Log an error message with category prefix (backward compatible)
- log_info
- Log an info message with category prefix (backward compatible)
- log_progress
- Progress indicator for startup sequence
- log_warn
- Log a warning message with category prefix (backward compatible)
- open_file
- Open a file with the platform’s default application.
Silently spawns the opener in the background (does not block).
- retry_async
- Retry an async operation with exponential backoff
- truncate_content
- Truncate content to a maximum character count (char-boundary safe)
- truncate_web_content
- Truncate web content using the default limit