Expand description
Shared primitives and helper types reused across VT Code crates.
This crate provides the foundational building blocks that both the core
agent library (vtcode-core) and the terminal UI (vtcode-ui) depend on.
Modules include ANSI processing, diff rendering, file traversal, color
policy, error classification, and shared protocol types.
Items live here (rather than vtcode-ui) when they are consumed by
vtcode-core or the main binary – keeping the dependency direction clean.
See docs/modules/vtcode_commons_reference.md for ready-to-use adapters.
Re-exports§
pub use colors::blend_colors;pub use colors::color_from_hex;pub use colors::contrasting_color;pub use colors::is_light_color;pub use colors::style;pub use editor::EditorPoint;pub use editor::EditorTarget;pub use editor::normalize_editor_hash_fragment;pub use editor::parse_editor_target;pub use editor::resolve_editor_path;pub use editor::resolve_editor_target;pub use error_category::BackoffStrategy;pub use error_category::ErrorCategory;pub use error_category::Retryability;pub use error_category::classify_anyhow_error;pub use error_category::classify_error_message;pub use error_category::is_retryable_llm_error_message;pub use errors::DisplayErrorFormatter;pub use errors::ErrorFormatter;pub use errors::ErrorReporter;pub use errors::NoopErrorReporter;pub use paths::PathExt;pub use paths::PathResolver;pub use paths::PathScope;pub use paths::StrPathExt;pub use paths::WorkspacePaths;pub use paths::file_name_from_path;pub use paths::is_safe_relative_path;pub use paths::normalize_ascii_identifier;pub use paths::resolve_workspace_path;pub use project::ProjectOverview;pub use project::build_project_overview;pub use reference::MemoryErrorReporter;pub use reference::MemoryTelemetry;pub use reference::StaticWorkspacePaths;pub use stop_hints::STOP_HINT_COMPACT;pub use stop_hints::STOP_HINT_INLINE;pub use stop_hints::with_stop_hint;pub use styling::ColorPalette;pub use styling::DiffColorPalette;pub use styling::render_styled;pub use telemetry::NoopTelemetry;pub use telemetry::TelemetrySink;pub use tokens::estimate_tokens;pub use tokens::truncate_to_tokens;pub use unicode::UNICODE_MONITOR;pub use unicode::UnicodeMonitor;pub use unicode::UnicodeValidationContext;pub use thread_safety::RelaxedAtomic;
Modules§
- ansi
- Shared ANSI escape parser and stripping utilities for VT Code.
- ansi_
capabilities - ANSI terminal capabilities detection and feature support
- ansi_
codes - Shared ANSI escape sequence constants and small builders for VT Code.
- async_
utils - Async utility functions
- at_
pattern - Utilities for parsing @ symbol patterns in user input
- cgp
- Context-Generic Programming (CGP) core wiring trait.
- color256_
theme - Theme-aware 256-color helpers.
- color_
policy - Runtime color output policy helpers.
- colors
- Color utilities for VT Code
- diff
- Diff utilities for generating structured diffs.
- diff_
paths - diff_
preview - Shared helpers for rendering diff previews.
- diff_
theme - Diff theme configuration and color palettes
- editor
- env_
lock - Process-environment mutation lock.
- error_
category - Unified error categorization system for consistent error classification across VT Code.
- errors
- exclusions
- Centralized exclusion constants and helpers for file traversal.
- file_
input - File input helpers for provider-specific inline file attachments.
- formatting
- Unified formatting utilities for UI and logging
- fs
- File utility functions for common operations
- http
- HTTP client utilities
- image
- Image processing utilities
- llm
- Core LLM types shared across the project
- lr_map
- Lock-free concurrent map built on
left_right. - model_
family - Model family definitions and capability groupings.
- paths
- preview
- Shared preview formatting helpers.
- project
- Project-related utilities and structures
- provider
- Provider enum and core definitions shared across VT Code crates.
- reasoning
- Reasoning effort level definitions shared across VT Code crates.
- reference
- retry
- Minimal shared retry policy for wire-level HTTP clients.
- sanitizer
- Secret sanitization utilities for redacting sensitive information.
- serde_
helpers - Serde helper utilities
- slug
- Human-readable slug generator for plan file names
- stop_
hints - styling
- Unified message styles and their logical mappings
- telemetry
- terminal_
detection - Terminal detection primitives shared across VT Code crates.
- thread_
safety - Thread Safety Primitives
- tokens
- Token estimation utilities
- tool_
types - Shared runtime types for the VT Code tool system.
- trace_
flush - Global trace log flush hook.
- ui_
protocol - Shared UI protocol types used across VT Code crates.
- unicode
- Unicode monitoring and validation utilities
- utils
- Generic utility functions
- validation
- Validation utilities for common operations
- vtcodegitignore
- .vtcodegitignore file pattern matching utilities
- walk
- Shared directory walker helpers built on the
ignorecrate.
Macros§
- ctx_err
- Helper macro for context errors Usage: ctx_err!(operation, context) -> “operation context”
- delegate_
components - Wire multiple component names to provider types for a context.
- file_
err - Helper macro for file operation errors with context Usage: file_err!(“path”, “read”) -> “failed to read path”
- model_
family - Macro to simplify model family definitions