Skip to main content

vtcode_config/constants/
prompt_cache.rs

1pub const DEFAULT_ENABLED: bool = true;
2/// Relative fallback used only when the centralized path resolver is unavailable.
3pub const DEFAULT_CACHE_DIR: &str = "cache/vtcode/prompts";
4pub const DEFAULT_MAX_ENTRIES: usize = 1_000;
5pub const DEFAULT_MAX_AGE_DAYS: u64 = 30;
6pub const DEFAULT_AUTO_CLEANUP: bool = true;
7pub const DEFAULT_MIN_QUALITY_THRESHOLD: f64 = 0.7;
8pub(crate) const DEFAULT_CACHE_FRIENDLY_PROMPT_SHAPING: bool = true;
9
10pub(crate) const OPENAI_MIN_PREFIX_TOKENS: u32 = 1_024;
11pub(crate) const GEMINI_MIN_PREFIX_TOKENS: u32 = 1_024;
12pub(crate) const OPENAI_IDLE_EXPIRATION_SECONDS: u64 = 60 * 60; // 1 hour max reuse window
13
14pub const ANTHROPIC_DEFAULT_TTL_SECONDS: u64 = 5 * 60; // 5 minutes
15pub(crate) const ANTHROPIC_EXTENDED_TTL_SECONDS: u64 = 60 * 60; // 1 hour option
16pub(crate) const ANTHROPIC_TOOLS_TTL_SECONDS: u64 = 60 * 60; // 1 hour for tools/system
17pub(crate) const ANTHROPIC_MESSAGES_TTL_SECONDS: u64 = 5 * 60; // 5 minutes for messages
18pub(crate) const ANTHROPIC_MAX_BREAKPOINTS: u8 = 4;
19pub(crate) const ANTHROPIC_MIN_MESSAGE_LENGTH_FOR_CACHE: usize = 256;
20
21pub(crate) const GEMINI_EXPLICIT_DEFAULT_TTL_SECONDS: u64 = 60 * 60; // 1 hour default for explicit caches
22
23/// Approximate provider-side prompt cache lifetimes used for the cache-gap
24/// warning (advisory only). A pause longer than these likely means the next
25/// request re-pays full cache-creation cost.
26pub(crate) const ANTHROPIC_CACHE_GAP_WARNING_SECONDS: u64 = 5 * 60; // ephemeral 5m TTL
27pub(crate) const OPENAI_CACHE_GAP_WARNING_SECONDS: u64 = 10 * 60; // in-memory cache window
28pub(crate) const DEFAULT_CACHE_GAP_WARNING_SECONDS: u64 = 5 * 60;
29
30pub const OPENROUTER_CACHE_DISCOUNT_ENABLED: bool = true;
31pub const XAI_CACHE_ENABLED: bool = true;
32pub const DEEPSEEK_CACHE_ENABLED: bool = true;
33pub(crate) const ZAI_CACHE_ENABLED: bool = false;
34pub(crate) const MOONSHOT_CACHE_ENABLED: bool = true;