const INLINE_STREAM_MAX_LINES: usize = 30;
const RUN_COMMAND_HEAD_PREVIEW_LINES: usize = 3;
const RUN_COMMAND_TAIL_PREVIEW_LINES: usize = 3;
const MAX_LINE_LENGTH: usize = 150;
const DIFF_WRAP_SOURCE_MAX_WIDTH: usize = 2_000;
const DEFAULT_SPOOL_THRESHOLD: usize = 50_000; const MAX_CODE_LINES: usize = 30;
const EXEC_SESSION_OUTPUT_MAX_LINES: usize = 10;
const EXTREME_OUTPUT_THRESHOLD_MB: usize = 2_000_000;
const LARGE_OUTPUT_NOTIFICATION_THRESHOLD: usize = 50_000;
use std::borrow::Cow;
use anstyle::{AnsiColor, Effects, Reset, Style as AnsiStyle};
use anyhow::Result;
use smallvec::SmallVec;
use vtcode_commons::preview::{
display_width, excerpt_text_lines, format_hidden_lines_summary as shared_hidden_lines_summary,
truncate_with_ellipsis,
};
use vtcode_core::config::ToolOutputMode;
use vtcode_core::config::loader::VTCodeConfig;
use vtcode_core::tools::tool_intent;
use vtcode_core::utils::ansi::{AnsiRenderer, MessageStyle};
use vtcode_diff::{
DiffDisplayKind, DiffDisplayLine, SideBySideRow, bounded_display_lines, diff_display_line_number_width,
diff_gutter_fits, diff_gutter_width, diff_side_by_side_fits, display_lines_from_unified_diff, side_by_side_rows,
};
use super::files::colorize_diff_summary_line;
use super::styles::{GitStyles, LsStyles, select_line_style};
use vtcode_commons::diff_paths::{is_prose_language_hint, parse_diff_git_path, parse_diff_marker_path};
#[path = "../streams_helpers.rs"]
mod streams_helpers;
pub(crate) use streams_helpers::{
build_markdown_code_block, render_code_fence_blocks, resolve_stdout_tail_limit, strip_ansi_codes,
};
use streams_helpers::{
looks_like_diff_content, select_stream_lines_streaming, should_render_as_code_block, spool_output_if_needed,
};
mod diff_blocks;
mod diff_format;
mod diff_paths;
mod notices;
mod preview;
mod stream_section;
#[cfg(test)]
pub(crate) use diff_blocks::format_side_by_side_row_ansi;
pub(crate) use diff_blocks::{
render_diff_content_block, render_diff_content_block_with_language, select_line_style_for_kind,
};
#[cfg(test)]
pub(crate) use diff_format::format_diff_line_with_gutter_and_syntax;
#[cfg(test)]
pub(crate) use diff_format::syntax_segments_for_diff_body;
pub(crate) use diff_format::{
diff_display_text, format_diff_line_with_gutter_and_syntax_to_width, highlight_diff_body_with_syntax,
highlight_diff_content, select_render_line_style, semantic_diff_line_style, should_show_diff_gutter,
};
pub(crate) use diff_paths::{
diff_language_hint_from_content, is_generic_diff_review_label, is_pretruncated_diff_content,
language_hint_for_display_line, line_exceeds_wrap_safety_cap, parse_omitted_line_count, resolve_diff_review_path,
};
pub(crate) use notices::{HiddenLinesNoticeKind, hidden_lines_notice, hidden_lines_notice_with};
#[cfg(test)]
pub(crate) use preview::collect_run_command_preview;
pub(crate) use preview::{render_preview_line, render_run_command_preview, trim_to_tail};
#[cfg(test)]
pub(crate) use stream_section::is_exec_session_tool;
pub(crate) use stream_section::render_stream_section;
#[cfg(test)]
mod tests;