vtcode_config/
constants.rs

1/// Application metadata constants shared across crates
2pub mod app {
3    pub const DISPLAY_NAME: &str = "VT Code";
4}
5
6/// Prompt path constants to avoid hardcoding throughout the codebase
7pub mod prompts {
8    pub const DEFAULT_SYSTEM_PROMPT_PATH: &str = "prompts/system.md";
9    pub const DEFAULT_CUSTOM_PROMPTS_DIR: &str = "~/.vtcode/prompts";
10    pub const DEFAULT_CUSTOM_SLASH_COMMANDS_DIR: &str = "~/.vtcode/commands";
11    pub const CUSTOM_PROMPTS_ENV_VAR: &str = "VTCODE_HOME";
12    pub const DEFAULT_CUSTOM_PROMPT_MAX_FILE_SIZE_KB: usize = 64;
13    pub const CORE_BUILTIN_PROMPTS_DIR: &str = "vtcode-core/prompts/custom";
14}
15
16/// Command execution defaults shared across the agent runtime
17pub mod commands {
18    pub const DEFAULT_EXTRA_PATH_ENTRIES: &[&str] = &[
19        "$HOME/.cargo/bin",
20        "$HOME/.local/bin",
21        "/opt/homebrew/bin",
22        "/usr/local/bin",
23        "$HOME/.asdf/bin",
24        "$HOME/.asdf/shims",
25        "$HOME/go/bin",
26    ];
27}
28
29/// Output limits to prevent unbounded memory growth.
30pub mod output_limits {
31    /// Maximum size for single agent message payloads (bytes).
32    pub const MAX_AGENT_MESSAGES_SIZE: usize = 10 * 1024 * 1024;
33    /// Maximum size for entire message history payloads (bytes).
34    pub const MAX_ALL_MESSAGES_SIZE: usize = 50 * 1024 * 1024;
35    /// Maximum size per line (bytes).
36    pub const MAX_LINE_LENGTH: usize = 1024 * 1024;
37    /// Default message count limit.
38    pub const DEFAULT_MESSAGE_LIMIT: usize = 10_000;
39    /// Maximum message count limit.
40    pub const MAX_MESSAGE_LIMIT: usize = 50_000;
41}
42
43
44/// Model ID constants to sync with docs/models.json
45pub mod models {
46    // Google/Gemini models
47    pub mod google {
48        /// Default model - using stable version for production reliability
49        pub const DEFAULT_MODEL: &str = "gemini-2.5-flash";
50
51        pub const SUPPORTED_MODELS: &[&str] = &[
52            "gemini-3-pro-preview",       // Latest flagship model with advanced reasoning
53            "gemini-3-flash-preview",     // Fast version of Gemini 3 Pro with 3-level thinking
54            "gemini-3-pro-image-preview", // Image generation model with 4K resolution
55            "gemini-2.5-pro",
56            "gemini-2.5-flash",
57            "gemini-2.5-flash-lite",
58            "gemini-2.5-flash-preview-05-20",
59            "gemini-1.5-pro",
60            "gemini-1.5-flash",
61        ];
62
63        /// Models that support thinking/reasoning capability with configurable thinking_level
64        /// Based on: https://ai.google.dev/gemini-api/docs/gemini-3
65        /// Gemini 3 Pro/Flash: supports low, high (default)
66        /// Gemini 3 Flash only: also supports minimal, medium
67        pub const REASONING_MODELS: &[&str] = &[
68            "gemini-3-pro-preview",
69            "gemini-3-flash-preview",
70            "gemini-2.5-pro",
71            "gemini-2.5-flash",
72            "gemini-2.5-flash-lite",
73            "gemini-2.5-flash-preview-05-20",
74            "gemini-1.5-pro",
75            "gemini-1.5-flash",
76        ];
77
78        /// Models that support Gemini 3 extended thinking levels (minimal, medium)
79        /// Only Gemini 3 Flash supports these additional levels beyond low/high
80        pub const EXTENDED_THINKING_MODELS: &[&str] = &["gemini-3-flash-preview"];
81
82        /// Models supporting image generation
83        pub const IMAGE_GENERATION_MODELS: &[&str] = &["gemini-3-pro-image-preview"];
84
85        /// Models that support context caching (min 2048 tokens required)
86        /// Context caching reduces costs for repeated API calls with similar contexts
87        /// Reference: https://ai.google.dev/gemini-api/docs/caching
88        pub const CACHING_MODELS: &[&str] = &[
89            "gemini-3-pro-preview",
90            "gemini-3-flash-preview",
91            "gemini-2.5-pro",
92            "gemini-2.5-flash",
93            "gemini-2.5-flash-lite",
94            "gemini-2.5-flash-preview-05-20",
95            "gemini-1.5-pro",
96            "gemini-1.5-flash",
97        ];
98
99        /// Models that support code execution (Python)
100        /// Code execution allows models to write and execute Python code
101        /// Reference: https://ai.google.dev/gemini-api/docs/code-execution
102        pub const CODE_EXECUTION_MODELS: &[&str] = &[
103            "gemini-3-pro-preview",
104            "gemini-3-flash-preview",
105            "gemini-2.5-pro",
106            "gemini-2.5-flash",
107            "gemini-2.5-flash-lite",
108            "gemini-2.5-flash-preview-05-20",
109            "gemini-1.5-pro",
110            "gemini-1.5-flash",
111        ];
112
113        // Convenience constants for commonly used models
114        pub const GEMINI_2_5_PRO: &str = "gemini-2.5-pro";
115        pub const GEMINI_2_5_FLASH: &str = "gemini-2.5-flash";
116        pub const GEMINI_2_5_FLASH_LITE: &str = "gemini-2.5-flash-lite";
117        pub const GEMINI_2_5_FLASH_PREVIEW: &str = "gemini-2.5-flash-preview-05-20";
118        pub const GEMINI_3_PRO_PREVIEW: &str = "gemini-3-pro-preview";
119        pub const GEMINI_3_FLASH_PREVIEW: &str = "gemini-3-flash-preview";
120        pub const GEMINI_3_PRO_IMAGE_PREVIEW: &str = "gemini-3-pro-image-preview";
121    }
122
123    // OpenAI models (from docs/models.json)
124    pub mod openai {
125        pub const DEFAULT_MODEL: &str = "gpt-5";
126        pub const SUPPORTED_MODELS: &[&str] = &[
127            "gpt-5",
128            "gpt-5-codex",
129            "gpt-5-mini",
130            "gpt-5-nano",
131            "gpt-5.2",
132            "gpt-5.2-2025-12-11",
133            "gpt-5.2-codex",
134            "gpt-5.1", // Enhanced version of GPT-5 with temperature support and streaming
135            "gpt-5.1-codex", // Enhanced version of GPT-5 Codex with temperature support and streaming
136            "gpt-5.1-codex-max", // Enhanced version of GPT-5 Codex with temperature support and streaming
137            "gpt-5.1-mini",      // Enhanced mini version with temperature support and streaming
138            "codex-mini-latest",
139            "gpt-oss-20b",
140            "gpt-oss-120b",
141        ];
142
143        /// Models that require the OpenAI Responses API
144        pub const RESPONSES_API_MODELS: &[&str] = &[
145            GPT_5,
146            GPT_5_CODEX,
147            GPT_5_MINI,
148            GPT_5_NANO,
149            GPT_5_2,
150            GPT_5_2_ALIAS,
151            GPT_5_2_CODEX,
152            GPT_5_1,
153            GPT_5_1_CODEX,
154            GPT_5_1_CODEX_MAX,
155            GPT_5_1_MINI,
156        ];
157
158        /// Models that support the OpenAI reasoning parameter payload
159        pub const REASONING_MODELS: &[&str] = &[
160            GPT_5,
161            GPT_5_CODEX,
162            GPT_5_MINI,
163            GPT_5_NANO,
164            GPT_5_2,
165            GPT_5_2_ALIAS,
166            GPT_5_2_CODEX,
167            GPT_5_1,
168            GPT_5_1_CODEX,
169            GPT_5_1_CODEX_MAX,
170        ];
171
172        /// Models that do not expose structured tool calling on the OpenAI platform
173        pub const TOOL_UNAVAILABLE_MODELS: &[&str] = &[];
174
175        /// GPT-OSS models that use harmony tokenization
176        pub const HARMONY_MODELS: &[&str] = &[GPT_OSS_20B, GPT_OSS_120B];
177
178        // Convenience constants for commonly used models
179        pub const GPT_5: &str = "gpt-5";
180        pub const GPT_5_CODEX: &str = "gpt-5-codex";
181        pub const GPT_5_MINI: &str = "gpt-5-mini";
182        pub const GPT_5_NANO: &str = "gpt-5-nano";
183        pub const GPT_5_2: &str = "gpt-5.2";
184        pub const GPT_5_2_ALIAS: &str = "gpt-5.2-2025-12-11";
185        pub const GPT_5_2_CODEX: &str = "gpt-5.2-codex";
186        pub const GPT_5_1: &str = "gpt-5.1"; // Enhanced version with temperature support and streaming
187        pub const GPT_5_1_CODEX: &str = "gpt-5.1-codex"; // Enhanced version with temperature support and streaming
188        pub const GPT_5_1_CODEX_MAX: &str = "gpt-5.1-codex-max"; // Enhanced version with temperature support and streaming
189        pub const GPT_5_1_MINI: &str = "gpt-5.1-mini"; // Enhanced version with temperature support and streaming
190        pub const CODEX_MINI_LATEST: &str = "codex-mini-latest";
191        pub const GPT_OSS_20B: &str = "gpt-oss-20b";
192        pub const GPT_OSS_120B: &str = "gpt-oss-120b";
193    }
194
195    // Hugging Face Inference Providers (OpenAI-compatible router)
196    pub mod huggingface {
197        pub const DEFAULT_MODEL: &str = OPENAI_GPT_OSS_120B;
198        pub const SUPPORTED_MODELS: &[&str] = &[
199            // Recommended conversational LLMs from HF docs
200            GOOGLE_GEMMA_2_2B_IT,
201            QWEN3_CODER_480B_A35B_INSTRUCT,
202            OPENAI_GPT_OSS_120B,
203            ZAI_GLM_45,
204            QWEN3_4B_THINKING_2507,
205            QWEN25_7B_INSTRUCT_1M,
206            QWEN25_CODER_32B_INSTRUCT,
207            DEEPSEEK_R1,
208            // Additional supported models
209            DEEPSEEK_V32,
210            OPENAI_GPT_OSS_20B,
211            ZAI_GLM_46,
212            ZAI_GLM_47,
213            ZAI_GLM_47_NOVITA,
214            ZAI_GLM_47_FLASH_NOVITA,
215            MOONSHOT_KIMI_K2_THINKING,
216            // Recommended VLM
217            ZAI_GLM_45V,
218            // Novita inference provider models
219            MINIMAX_M2_1_NOVITA,
220            DEEPSEEK_V32_NOVITA,
221            XIAOMI_MIMO_V2_FLASH_NOVITA,
222        ];
223
224        // Recommended conversational LLMs
225        pub const GOOGLE_GEMMA_2_2B_IT: &str = "google/gemma-2-2b-it";
226        pub const QWEN3_CODER_480B_A35B_INSTRUCT: &str = "Qwen/Qwen3-Coder-480B-A35B-Instruct";
227        pub const OPENAI_GPT_OSS_120B: &str = "openai/gpt-oss-120b";
228        pub const ZAI_GLM_45: &str = "zai-org/GLM-4.5:zai-org";
229        pub const QWEN3_4B_THINKING_2507: &str = "Qwen/Qwen3-4B-Thinking-2507";
230        pub const QWEN25_7B_INSTRUCT_1M: &str = "Qwen/Qwen2.5-7B-Instruct-1M";
231        pub const QWEN25_CODER_32B_INSTRUCT: &str = "Qwen/Qwen2.5-Coder-32B-Instruct";
232        pub const DEEPSEEK_R1: &str = "deepseek-ai/DeepSeek-R1";
233
234        // Additional supported models
235        pub const DEEPSEEK_V32: &str = "deepseek-ai/DeepSeek-V3.2";
236        pub const OPENAI_GPT_OSS_20B: &str = "openai/gpt-oss-20b";
237        pub const ZAI_GLM_46: &str = "zai-org/GLM-4.6:zai-org";
238        pub const ZAI_GLM_47: &str = "zai-org/GLM-4.7:zai-org";
239        pub const ZAI_GLM_47_NOVITA: &str = "zai-org/GLM-4.7:novita";
240        pub const ZAI_GLM_47_FLASH_NOVITA: &str = "zai-org/GLM-4.7-Flash:novita";
241        pub const MOONSHOT_KIMI_K2_THINKING: &str = "moonshotai/Kimi-K2-Thinking";
242
243        // Recommended VLM
244        pub const ZAI_GLM_45V: &str = "zai-org/GLM-4.5V:zai-org";
245        pub const MINIMAX_M2_1_NOVITA: &str = "MiniMaxAI/MiniMax-M2.1:novita";
246        pub const DEEPSEEK_V32_NOVITA: &str = "deepseek-ai/DeepSeek-V3.2:novita";
247        pub const XIAOMI_MIMO_V2_FLASH_NOVITA: &str = "XiaomiMiMo/MiMo-V2-Flash:novita";
248
249        pub const REASONING_MODELS: &[&str] = &[
250            // All recommended models support reasoning
251            QWEN3_CODER_480B_A35B_INSTRUCT,
252            OPENAI_GPT_OSS_120B,
253            ZAI_GLM_45,
254            QWEN3_4B_THINKING_2507,
255            DEEPSEEK_R1,
256            // Additional reasoning models
257            DEEPSEEK_V32,
258            OPENAI_GPT_OSS_20B,
259            ZAI_GLM_46,
260            ZAI_GLM_47,
261            ZAI_GLM_47_NOVITA,
262            ZAI_GLM_47_FLASH_NOVITA,
263            MOONSHOT_KIMI_K2_THINKING,
264            ZAI_GLM_45V,
265            DEEPSEEK_V32_NOVITA,
266            MINIMAX_M2_1_NOVITA,
267            XIAOMI_MIMO_V2_FLASH_NOVITA,
268        ];
269    }
270
271    // Z.AI models (direct API)
272    pub mod zai {
273        pub const DEFAULT_MODEL: &str = "glm-4.7";
274        pub const SUPPORTED_MODELS: &[&str] = &[
275            "glm-4-plus",
276            "glm-4.7",
277            "glm-4.7-flash",
278            "glm-4.6",
279            "glm-4.6v",
280            "glm-4.6v-flash",
281            "glm-4.6v-flashx",
282            "glm-4.5",
283            "glm-4.5-air",
284            "glm-4.5-x",
285            "glm-4.5-airx",
286            "glm-4.5-flash",
287            "glm-4.5v",
288            "glm-4-32b-0414-128k",
289        ];
290
291        pub const REASONING_MODELS: &[&str] = &[
292            "glm-4-plus",
293            "glm-4.7",
294            "glm-4.7-flash",
295            "glm-4.6",
296            "glm-4.5",
297            "glm-4.5-air",
298            "glm-4.5-x",
299            "glm-4.5-airx",
300            "glm-4.5-flash",
301        ];
302
303        pub const GLM_4_PLUS: &str = "glm-4-plus";
304        pub const GLM_4_PLUS_DEEP_THINKING: &str = "glm-4-plus:thinking";
305        pub const GLM_4_7: &str = "glm-4.7";
306        pub const GLM_4_7_DEEP_THINKING: &str = "glm-4.7:thinking";
307        pub const GLM_4_7_FLASH: &str = "glm-4.7-flash";
308        pub const GLM_4_6: &str = "glm-4.6";
309        pub const GLM_4_6_DEEP_THINKING: &str = "glm-4.6:thinking";
310        pub const GLM_4_6V: &str = "glm-4.6v";
311        pub const GLM_4_6V_FLASH: &str = "glm-4.6v-flash";
312        pub const GLM_4_6V_FLASHX: &str = "glm-4.6v-flashx";
313        pub const GLM_4_5: &str = "glm-4.5";
314        pub const GLM_4_5_DEEP_THINKING: &str = "glm-4.5:thinking";
315        pub const GLM_4_5_AIR: &str = "glm-4.5-air";
316        pub const GLM_4_5_X: &str = "glm-4.5-x";
317        pub const GLM_4_5_AIRX: &str = "glm-4.5-airx";
318        pub const GLM_4_5_FLASH: &str = "glm-4.5-flash";
319        pub const GLM_4_5V: &str = "glm-4.5v";
320        pub const GLM_4_32B_0414_128K: &str = "glm-4-32b-0414-128k";
321    }
322
323    // Moonshot.ai models (direct API)
324    pub mod moonshot {
325        // Legacy Moonshot direct API models (kept for compatibility with tests)
326        pub const DEFAULT_MODEL: &str = "kimi-k2-0905";
327        pub const SUPPORTED_MODELS: &[&str] = &[DEFAULT_MODEL];
328    }
329
330    // OpenRouter models (extensible via vtcode.toml)
331    #[cfg(not(docsrs))]
332    pub mod openrouter {
333        include!(concat!(env!("OUT_DIR"), "/openrouter_constants.rs"));
334    }
335
336    #[cfg(docsrs)]
337    pub mod openrouter {
338        pub const SUPPORTED_MODELS: &[&str] = &[];
339        pub const REASONING_MODELS: &[&str] = &[];
340        pub const TOOL_UNAVAILABLE_MODELS: &[&str] = &[];
341
342        // Define the constants that are referenced elsewhere to avoid compile errors
343        pub const X_AI_GROK_CODE_FAST_1: &str = "x-ai/grok-code-fast-1";
344        pub const QWEN3_CODER: &str = "qwen/qwen3-coder";
345        pub const ANTHROPIC_CLAUDE_SONNET_4_5: &str = "anthropic/claude-sonnet-4.5";
346
347        pub mod vendor {
348            pub mod openrouter {
349                pub const MODELS: &[&str] = &[];
350            }
351        }
352    }
353
354    // LM Studio models (OpenAI-compatible local server)
355    pub mod lmstudio {
356        pub const DEFAULT_MODEL: &str = META_LLAMA_31_8B_INSTRUCT;
357        pub const SUPPORTED_MODELS: &[&str] = &[
358            META_LLAMA_3_8B_INSTRUCT,
359            META_LLAMA_31_8B_INSTRUCT,
360            QWEN25_7B_INSTRUCT,
361            GEMMA_2_2B_IT,
362            GEMMA_2_9B_IT,
363            PHI_31_MINI_4K_INSTRUCT,
364        ];
365
366        pub const META_LLAMA_3_8B_INSTRUCT: &str = "lmstudio-community/meta-llama-3-8b-instruct";
367        pub const META_LLAMA_31_8B_INSTRUCT: &str = "lmstudio-community/meta-llama-3.1-8b-instruct";
368        pub const QWEN25_7B_INSTRUCT: &str = "lmstudio-community/qwen2.5-7b-instruct";
369        pub const GEMMA_2_2B_IT: &str = "lmstudio-community/gemma-2-2b-it";
370        pub const GEMMA_2_9B_IT: &str = "lmstudio-community/gemma-2-9b-it";
371        pub const PHI_31_MINI_4K_INSTRUCT: &str = "lmstudio-community/phi-3.1-mini-4k-instruct";
372    }
373
374    pub mod ollama {
375        pub const DEFAULT_LOCAL_MODEL: &str = "gpt-oss:20b";
376        pub const DEFAULT_CLOUD_MODEL: &str = "gpt-oss:120b-cloud";
377        pub const DEFAULT_MODEL: &str = DEFAULT_LOCAL_MODEL;
378        pub const SUPPORTED_MODELS: &[&str] = &[
379            DEFAULT_LOCAL_MODEL,
380            QWEN3_1_7B,
381            DEFAULT_CLOUD_MODEL,
382            GPT_OSS_20B_CLOUD,
383            DEEPSEEK_V32_CLOUD,
384            QWEN3_NEXT_80B_CLOUD,
385            MISTRAL_LARGE_3_675B_CLOUD,
386            KIMI_K2_THINKING_CLOUD,
387            KIMI_K2_1T_CLOUD,
388            QWEN3_CODER_480B_CLOUD,
389            GLM_46_CLOUD,
390            GLM_47_CLOUD,
391            GEMINI_3_PRO_PREVIEW_LATEST_CLOUD,
392            GEMINI_3_FLASH_PREVIEW_CLOUD,
393            DEVSTRAL_2_123B_CLOUD,
394            MINIMAX_M2_CLOUD,
395            MINIMAX_M21_CLOUD,
396            NEMOTRON_3_NANO_30B_CLOUD,
397        ];
398
399        /// Models that emit structured reasoning traces when `think` is enabled
400        pub const REASONING_MODELS: &[&str] = &[
401            GPT_OSS_20B,
402            GPT_OSS_20B_CLOUD,
403            GPT_OSS_120B_CLOUD,
404            QWEN3_1_7B,
405            DEEPSEEK_V32_CLOUD,
406            QWEN3_NEXT_80B_CLOUD,
407            MISTRAL_LARGE_3_675B_CLOUD,
408            KIMI_K2_THINKING_CLOUD,
409            KIMI_K2_1T_CLOUD,
410            QWEN3_CODER_480B_CLOUD,
411            GLM_46_CLOUD,
412            GLM_47_CLOUD,
413            GEMINI_3_PRO_PREVIEW_LATEST_CLOUD,
414            GEMINI_3_FLASH_PREVIEW_CLOUD,
415            DEVSTRAL_2_123B_CLOUD,
416            MINIMAX_M2_CLOUD,
417            MINIMAX_M21_CLOUD,
418            NEMOTRON_3_NANO_30B_CLOUD,
419        ];
420
421        /// Models that require an explicit reasoning effort level instead of boolean toggle
422        pub const REASONING_LEVEL_MODELS: &[&str] = &[
423            GPT_OSS_20B,
424            GPT_OSS_20B_CLOUD,
425            GPT_OSS_120B_CLOUD,
426            GLM_46_CLOUD,
427            GLM_47_CLOUD,
428            MINIMAX_M2_CLOUD,
429            MINIMAX_M21_CLOUD,
430            GEMINI_3_FLASH_PREVIEW_CLOUD,
431        ];
432
433        pub const GPT_OSS_20B: &str = DEFAULT_LOCAL_MODEL;
434        pub const GPT_OSS_20B_CLOUD: &str = "gpt-oss:20b-cloud";
435        pub const GPT_OSS_120B_CLOUD: &str = DEFAULT_CLOUD_MODEL;
436        pub const QWEN3_1_7B: &str = "qwen3:1.7b";
437        pub const DEEPSEEK_V32_CLOUD: &str = "deepseek-v3.2:cloud";
438        pub const QWEN3_NEXT_80B_CLOUD: &str = "qwen3-next:80b-cloud";
439        pub const MISTRAL_LARGE_3_675B_CLOUD: &str = "mistral-large-3:675b-cloud";
440        pub const KIMI_K2_THINKING_CLOUD: &str = "kimi-k2-thinking:cloud";
441        pub const KIMI_K2_1T_CLOUD: &str = "kimi-k2:1t-cloud";
442        pub const QWEN3_CODER_480B_CLOUD: &str = "qwen3-coder:480b-cloud";
443        pub const GLM_46_CLOUD: &str = "glm-4.6:cloud";
444        pub const GLM_47_CLOUD: &str = "glm-4.7:cloud";
445        pub const GEMINI_3_PRO_PREVIEW_LATEST_CLOUD: &str = "gemini-3-pro-preview:latest";
446        pub const GEMINI_3_FLASH_PREVIEW_CLOUD: &str = "gemini-3-flash-preview:cloud";
447        pub const DEVSTRAL_2_123B_CLOUD: &str = "devstral-2:123b-cloud";
448        pub const MINIMAX_M2_CLOUD: &str = "minimax-m2:cloud";
449        pub const MINIMAX_M21_CLOUD: &str = "minimax-m2.1:cloud";
450        pub const NEMOTRON_3_NANO_30B_CLOUD: &str = "nemotron-3-nano:30b-cloud";
451    }
452
453    // DeepSeek models (native API) - V3.2 released 2025-12-01
454    pub mod deepseek {
455        pub const DEFAULT_MODEL: &str = "deepseek-chat";
456        pub const SUPPORTED_MODELS: &[&str] = &["deepseek-chat", "deepseek-reasoner"];
457
458        pub const DEEPSEEK_CHAT: &str = "deepseek-chat";
459        pub const DEEPSEEK_REASONER: &str = "deepseek-reasoner";
460    }
461
462    // Anthropic models (from docs/models.json)
463    pub mod anthropic {
464        // Standard model for straightforward tools - Sonnet 4.5 preferred for most use cases
465        pub const DEFAULT_MODEL: &str = "claude-sonnet-4-5-20250929";
466        pub const SUPPORTED_MODELS: &[&str] = &[
467            // Claude 4.5 series
468            "claude-sonnet-4-5-20250929", // Latest flagship model for complex agents and coding
469            "claude-haiku-4-5-20251001",  // Fastest model with near-frontier intelligence
470            "claude-opus-4-5-20251101",   // Premium flagship model with exceptional intelligence
471            "claude-opus-4-1-20250805",   // Specialized reasoning model
472            "claude-sonnet-4-5",          // Alias for latest Claude Sonnet 4.5
473            "claude-haiku-4-5",           // Alias for latest Claude Haiku 4.5
474            "claude-opus-4-5",            // Alias for latest Claude Opus 4.5
475            "claude-opus-4-1",            // Alias for latest Claude Opus 4.1
476            // Claude 4 series
477            "claude-sonnet-4-20250514", // Claude 4 Sonnet
478            "claude-opus-4-20250514",   // Claude 4 Opus
479            "claude-sonnet-4-0",        // Alias for Claude 4 Sonnet
480            "claude-opus-4-0",          // Alias for Claude 4 Opus
481            // Claude 3.x series
482            "claude-3-7-sonnet-20250219", // Latest Claude 3.7 Sonnet
483            "claude-3-7-sonnet-latest",   // Alias for Claude 3.7 Sonnet
484            "claude-3-5-sonnet-20241022", // Latest Claude 3.5 Sonnet
485            "claude-3-5-sonnet-latest",   // Alias for Claude 3.5 Sonnet
486            "claude-3-5-haiku-20241022",  // Latest Claude 3.5 Haiku
487            "claude-3-5-haiku-latest",    // Alias for Claude 3.5 Haiku
488            "claude-3-opus-20240229",     // Legacy Claude 3 Opus
489            "claude-3-sonnet-20240229",   // Legacy Claude 3 Sonnet
490            "claude-3-haiku-20240307",    // Legacy Claude 3 Haiku
491        ];
492
493        // Convenience constants for versioned models
494        pub const CLAUDE_SONNET_4_5_20250929: &str = "claude-sonnet-4-5-20250929";
495        pub const CLAUDE_HAIKU_4_5_20251001: &str = "claude-haiku-4-5-20251001";
496        pub const CLAUDE_OPUS_4_5_20251101: &str = "claude-opus-4-5-20251101";
497        pub const CLAUDE_OPUS_4_1_20250805: &str = "claude-opus-4-1-20250805";
498        pub const CLAUDE_SONNET_4_20250514: &str = "claude-sonnet-4-20250514";
499        pub const CLAUDE_OPUS_4_20250514: &str = "claude-opus-4-20250514";
500        pub const CLAUDE_3_7_SONNET_20250219: &str = "claude-3-7-sonnet-20250219";
501        pub const CLAUDE_3_5_SONNET_20241022: &str = "claude-3-5-sonnet-20241022";
502        pub const CLAUDE_3_5_HAIKU_20241022: &str = "claude-3-5-haiku-20241022";
503
504        // Convenience constants for alias models
505        pub const CLAUDE_HAIKU_4_5: &str = "claude-haiku-4-5";
506        pub const CLAUDE_SONNET_4_5: &str = "claude-sonnet-4-5";
507        pub const CLAUDE_OPUS_4_5: &str = "claude-opus-4-5";
508        pub const CLAUDE_OPUS_4_1: &str = "claude-opus-4-1";
509        pub const CLAUDE_SONNET_4_0: &str = "claude-sonnet-4-0";
510        pub const CLAUDE_OPUS_4_0: &str = "claude-opus-4-0";
511        pub const CLAUDE_3_7_SONNET_LATEST: &str = "claude-3-7-sonnet-latest";
512        pub const CLAUDE_3_5_SONNET_LATEST: &str = "claude-3-5-sonnet-latest";
513        pub const CLAUDE_3_5_HAIKU_LATEST: &str = "claude-3-5-haiku-latest";
514
515        // Legacy aliases for backwards compatibility
516        pub const CLAUDE_OPUS_4_1_20250805_LEGACY: &str = "claude-opus-4-1-20250805";
517
518        /// Models that accept the reasoning effort parameter or extended thinking
519        pub const REASONING_MODELS: &[&str] = &[
520            CLAUDE_SONNET_4_5_20250929,
521            CLAUDE_HAIKU_4_5_20251001,
522            CLAUDE_OPUS_4_5_20251101,
523            CLAUDE_OPUS_4_1_20250805,
524            CLAUDE_SONNET_4_5,
525            CLAUDE_HAIKU_4_5,
526            CLAUDE_OPUS_4_5,
527            CLAUDE_OPUS_4_1,
528            "claude-sonnet-4-20250514",
529            "claude-opus-4-20250514",
530            "claude-sonnet-4-0",
531            "claude-opus-4-0",
532            "claude-3-7-sonnet-20250219",
533            "claude-3-7-sonnet-latest",
534        ];
535
536        /// Interleaved thinking configuration for Anthropic models
537        pub const INTERLEAVED_THINKING_BETA: &str = "interleaved-thinking-2025-05-14";
538        pub const INTERLEAVED_THINKING_TYPE_ENABLED: &str = "enabled";
539    }
540
541    // MiniMax models (Anthropic-compatible API, standalone provider)
542    pub mod minimax {
543        pub const DEFAULT_MODEL: &str = MINIMAX_M2_1;
544        pub const SUPPORTED_MODELS: &[&str] = &[MINIMAX_M2_1, MINIMAX_M2_1_LIGHTNING, MINIMAX_M2];
545        pub const MINIMAX_M2_1: &str = "MiniMax-M2.1";
546        pub const MINIMAX_M2_1_LIGHTNING: &str = "MiniMax-M2.1-lightning";
547        pub const MINIMAX_M2: &str = "MiniMax-M2";
548    }
549
550    // xAI models
551    pub mod xai {
552        pub const DEFAULT_MODEL: &str = "grok-4";
553        pub const SUPPORTED_MODELS: &[&str] = &[
554            "grok-4",
555            "grok-4-mini",
556            "grok-4-code",
557            "grok-4-code-latest",
558            "grok-4-vision",
559            "grok-4-1-fast",
560            "grok-code-fast-1",
561            "grok-4-fast",
562            "grok-3",
563            "grok-3-mini",
564            "grok-2-1212",
565            "grok-2-vision-1212",
566            "grok-beta",
567        ];
568
569        pub const GROK_4: &str = "grok-4";
570        pub const GROK_4_MINI: &str = "grok-4-mini";
571        pub const GROK_4_CODE: &str = "grok-4-code";
572        pub const GROK_4_CODE_LATEST: &str = "grok-4-code-latest";
573        pub const GROK_4_VISION: &str = "grok-4-vision";
574        pub const GROK_4_1_FAST: &str = "grok-4-1-fast";
575        pub const GROK_CODE_FAST_1: &str = "grok-code-fast-1";
576        pub const GROK_4_FAST: &str = "grok-4-fast";
577        pub const GROK_3: &str = "grok-3";
578        pub const GROK_3_MINI: &str = "grok-3-mini";
579        pub const GROK_2_1212: &str = "grok-2-1212";
580        pub const GROK_2_VISION_1212: &str = "grok-2-vision-1212";
581        pub const GROK_BETA: &str = "grok-beta";
582    }
583
584    // Backwards compatibility - keep old constants working
585    pub const GEMINI_2_5_FLASH_PREVIEW: &str = google::GEMINI_2_5_FLASH_PREVIEW;
586    pub const GEMINI_2_5_FLASH: &str = google::GEMINI_2_5_FLASH;
587    pub const GEMINI_2_5_PRO: &str = google::GEMINI_2_5_PRO;
588    pub const GEMINI_2_5_FLASH_LITE: &str = google::GEMINI_2_5_FLASH_LITE;
589    pub const GEMINI_3_PRO_PREVIEW: &str = google::GEMINI_3_PRO_PREVIEW;
590    pub const GEMINI_3_FLASH_PREVIEW: &str = google::GEMINI_3_FLASH_PREVIEW;
591    pub const GPT_5: &str = openai::GPT_5;
592    pub const GPT_5_CODEX: &str = openai::GPT_5_CODEX;
593    pub const GPT_5_MINI: &str = openai::GPT_5_MINI;
594    pub const GPT_5_NANO: &str = openai::GPT_5_NANO;
595    pub const GPT_5_2: &str = openai::GPT_5_2;
596    pub const GPT_5_2_ALIAS: &str = openai::GPT_5_2_ALIAS;
597    pub const GPT_5_1: &str = openai::GPT_5_1;
598    pub const GPT_5_1_CODEX: &str = openai::GPT_5_1_CODEX;
599    pub const GPT_5_1_CODEX_MAX: &str = openai::GPT_5_1_CODEX_MAX;
600    pub const GPT_5_1_MINI: &str = openai::GPT_5_1_MINI;
601    pub const CODEX_MINI: &str = openai::CODEX_MINI_LATEST;
602    pub const CODEX_MINI_LATEST: &str = openai::CODEX_MINI_LATEST;
603    pub const CLAUDE_OPUS_4_1_20250805: &str = anthropic::CLAUDE_OPUS_4_1_20250805;
604    pub const CLAUDE_OPUS_4_5_20251101: &str = anthropic::CLAUDE_OPUS_4_5_20251101;
605    pub const CLAUDE_OPUS_4_20250514: &str = anthropic::CLAUDE_OPUS_4_20250514;
606    pub const CLAUDE_SONNET_4_20250514: &str = anthropic::CLAUDE_SONNET_4_20250514;
607    pub const CLAUDE_3_7_SONNET_20250219: &str = anthropic::CLAUDE_3_7_SONNET_20250219;
608    pub const CLAUDE_3_5_SONNET_20241022: &str = anthropic::CLAUDE_3_5_SONNET_20241022;
609    pub const CLAUDE_SONNET_4_5: &str = anthropic::CLAUDE_SONNET_4_5;
610    pub const CLAUDE_HAIKU_4_5: &str = anthropic::CLAUDE_HAIKU_4_5;
611    pub const CLAUDE_SONNET_4_5_20250929: &str = anthropic::CLAUDE_SONNET_4_5_20250929;
612    pub const CLAUDE_HAIKU_4_5_20251001: &str = anthropic::CLAUDE_HAIKU_4_5_20251001;
613    pub const CLAUDE_OPUS_4_1: &str = anthropic::CLAUDE_OPUS_4_1;
614    pub const CLAUDE_OPUS_4_5: &str = anthropic::CLAUDE_OPUS_4_5;
615    pub const CLAUDE_SONNET_4_0: &str = anthropic::CLAUDE_SONNET_4_0;
616    pub const CLAUDE_OPUS_4_0: &str = anthropic::CLAUDE_OPUS_4_0;
617    pub const CLAUDE_3_7_SONNET_LATEST: &str = anthropic::CLAUDE_3_7_SONNET_LATEST;
618    pub const CLAUDE_3_5_SONNET_LATEST: &str = anthropic::CLAUDE_3_5_SONNET_LATEST;
619    pub const CLAUDE_3_5_HAIKU_20241022: &str = anthropic::CLAUDE_3_5_HAIKU_20241022;
620    pub const CLAUDE_3_5_HAIKU_LATEST: &str = anthropic::CLAUDE_3_5_HAIKU_LATEST;
621    pub const MINIMAX_M2: &str = minimax::MINIMAX_M2;
622    pub const XAI_GROK_4: &str = xai::GROK_4;
623    pub const XAI_GROK_4_MINI: &str = xai::GROK_4_MINI;
624    pub const XAI_GROK_4_CODE: &str = xai::GROK_4_CODE;
625    pub const XAI_GROK_4_CODE_LATEST: &str = xai::GROK_4_CODE_LATEST;
626    pub const XAI_GROK_4_VISION: &str = xai::GROK_4_VISION;
627    pub const XAI_GROK_3: &str = xai::GROK_3;
628    pub const XAI_GROK_2: &str = xai::GROK_2_1212;
629    pub const XAI_GROK_BETA: &str = xai::GROK_BETA;
630    pub const DEEPSEEK_CHAT: &str = deepseek::DEEPSEEK_CHAT;
631    pub const DEEPSEEK_REASONER: &str = deepseek::DEEPSEEK_REASONER;
632    #[cfg(not(docsrs))]
633    pub const OPENROUTER_X_AI_GROK_CODE_FAST_1: &str = openrouter::X_AI_GROK_CODE_FAST_1;
634    #[cfg(docsrs)]
635    pub const OPENROUTER_X_AI_GROK_CODE_FAST_1: &str = "x-ai/grok-code-fast-1";
636    #[cfg(not(docsrs))]
637    pub const OPENROUTER_QWEN3_CODER: &str = openrouter::QWEN3_CODER;
638    #[cfg(docsrs)]
639    pub const OPENROUTER_QWEN3_CODER: &str = "qwen/qwen3-coder";
640    #[cfg(not(docsrs))]
641    pub const OPENROUTER_ANTHROPIC_CLAUDE_SONNET_4_5: &str =
642        openrouter::ANTHROPIC_CLAUDE_SONNET_4_5;
643    #[cfg(docsrs)]
644    pub const OPENROUTER_ANTHROPIC_CLAUDE_SONNET_4_5: &str = "anthropic/claude-sonnet-4.5";
645}
646
647/// Prompt caching defaults shared across features and providers
648pub mod prompt_cache {
649    pub const DEFAULT_ENABLED: bool = true;
650    pub const DEFAULT_CACHE_DIR: &str = ".vtcode/cache/prompts";
651    pub const DEFAULT_MAX_ENTRIES: usize = 1_000;
652    pub const DEFAULT_MAX_AGE_DAYS: u64 = 30;
653    pub const DEFAULT_AUTO_CLEANUP: bool = true;
654    pub const DEFAULT_MIN_QUALITY_THRESHOLD: f64 = 0.7;
655
656    pub const OPENAI_MIN_PREFIX_TOKENS: u32 = 1_024;
657    pub const GEMINI_MIN_PREFIX_TOKENS: u32 = 1_024;
658    pub const OPENAI_IDLE_EXPIRATION_SECONDS: u64 = 60 * 60; // 1 hour max reuse window
659
660    pub const ANTHROPIC_DEFAULT_TTL_SECONDS: u64 = 5 * 60; // 5 minutes
661    pub const ANTHROPIC_EXTENDED_TTL_SECONDS: u64 = 60 * 60; // 1 hour option
662    pub const ANTHROPIC_TOOLS_TTL_SECONDS: u64 = 60 * 60; // 1 hour for tools/system
663    pub const ANTHROPIC_MESSAGES_TTL_SECONDS: u64 = 5 * 60; // 5 minutes for messages
664    pub const ANTHROPIC_MAX_BREAKPOINTS: u8 = 4;
665    pub const ANTHROPIC_MIN_MESSAGE_LENGTH_FOR_CACHE: usize = 256;
666
667    pub const GEMINI_EXPLICIT_DEFAULT_TTL_SECONDS: u64 = 60 * 60; // 1 hour default for explicit caches
668
669    pub const OPENROUTER_CACHE_DISCOUNT_ENABLED: bool = true;
670    pub const XAI_CACHE_ENABLED: bool = true;
671    pub const DEEPSEEK_CACHE_ENABLED: bool = true;
672    pub const ZAI_CACHE_ENABLED: bool = false;
673    pub const MOONSHOT_CACHE_ENABLED: bool = true;
674}
675
676/// Model validation and helper functions
677pub mod model_helpers {
678    use super::models;
679
680    /// Get supported models for a provider
681    pub fn supported_for(provider: &str) -> Option<&'static [&'static str]> {
682        match provider {
683            "google" | "gemini" => Some(models::google::SUPPORTED_MODELS),
684            "openai" => Some(models::openai::SUPPORTED_MODELS),
685            "anthropic" => Some(models::anthropic::SUPPORTED_MODELS),
686            "minimax" => Some(models::minimax::SUPPORTED_MODELS),
687            "deepseek" => Some(models::deepseek::SUPPORTED_MODELS),
688            #[cfg(not(docsrs))]
689            "openrouter" => Some(models::openrouter::SUPPORTED_MODELS),
690            #[cfg(docsrs)]
691            "openrouter" => Some(&[]),
692            "moonshot" => Some(models::moonshot::SUPPORTED_MODELS),
693            "xai" => Some(models::xai::SUPPORTED_MODELS),
694            "zai" => Some(models::zai::SUPPORTED_MODELS),
695            "ollama" => Some(models::ollama::SUPPORTED_MODELS),
696            _ => None,
697        }
698    }
699
700    /// Get default model for a provider
701    pub fn default_for(provider: &str) -> Option<&'static str> {
702        match provider {
703            "google" | "gemini" => Some(models::google::DEFAULT_MODEL),
704            "openai" => Some(models::openai::DEFAULT_MODEL),
705            "anthropic" => Some(models::anthropic::DEFAULT_MODEL),
706            "minimax" => Some(models::minimax::DEFAULT_MODEL),
707            "deepseek" => Some(models::deepseek::DEFAULT_MODEL),
708            #[cfg(not(docsrs))]
709            "openrouter" => Some(models::openrouter::DEFAULT_MODEL),
710            #[cfg(docsrs)]
711            "openrouter" => Some("openrouter/auto"), // Fallback for docs.rs build
712            "xai" => Some(models::xai::DEFAULT_MODEL),
713            "zai" => Some(models::zai::DEFAULT_MODEL),
714            "ollama" => Some(models::ollama::DEFAULT_MODEL),
715            _ => None,
716        }
717    }
718
719    /// Validate if a model is supported by a provider
720    pub fn is_valid(provider: &str, model: &str) -> bool {
721        supported_for(provider)
722            .map(|list| list.contains(&model))
723            .unwrap_or(false)
724    }
725}
726
727/// Environment variable names shared across the application.
728pub mod env {
729    /// Agent Client Protocol specific environment keys
730    pub mod acp {
731        #[derive(Debug, Clone, Copy)]
732        pub enum AgentClientProtocolEnvKey {
733            Enabled,
734            ZedEnabled,
735            ZedToolsReadFileEnabled,
736            ZedToolsListFilesEnabled,
737            ZedWorkspaceTrust,
738        }
739
740        impl AgentClientProtocolEnvKey {
741            pub fn as_str(self) -> &'static str {
742                match self {
743                    Self::Enabled => "VT_ACP_ENABLED",
744                    Self::ZedEnabled => "VT_ACP_ZED_ENABLED",
745                    Self::ZedToolsReadFileEnabled => "VT_ACP_ZED_TOOLS_READ_FILE_ENABLED",
746                    Self::ZedToolsListFilesEnabled => "VT_ACP_ZED_TOOLS_LIST_FILES_ENABLED",
747                    Self::ZedWorkspaceTrust => "VT_ACP_ZED_WORKSPACE_TRUST",
748                }
749            }
750        }
751    }
752}
753
754/// Default configuration values
755pub mod defaults {
756    use super::{models, ui};
757
758    pub const DEFAULT_MODEL: &str = models::openai::DEFAULT_MODEL;
759    pub const DEFAULT_CLI_MODEL: &str = models::openai::DEFAULT_MODEL;
760    pub const DEFAULT_PROVIDER: &str = "openai";
761    pub const DEFAULT_API_KEY_ENV: &str = "OPENAI_API_KEY";
762    pub const DEFAULT_THEME: &str = "ciapre-dark";
763    pub const DEFAULT_FULL_AUTO_MAX_TURNS: usize = 30;
764    pub const DEFAULT_MAX_TOOL_LOOPS: usize = 200;
765    pub const DEFAULT_MAX_REPEATED_TOOL_CALLS: usize = 3;
766    pub const DEFAULT_PTY_STDOUT_TAIL_LINES: usize = 20;
767    pub const DEFAULT_PTY_SCROLLBACK_LINES: usize = 400;
768    pub const DEFAULT_TOOL_OUTPUT_MODE: &str = ui::TOOL_OUTPUT_MODE_COMPACT;
769
770    pub const DEFAULT_PTY_OUTPUT_MAX_TOKENS: usize = 8_000;
771
772    /// Byte fuse for PTY output - secondary safeguard after token truncation.
773    /// Protects against edge cases where token estimation underestimates size.
774    pub const DEFAULT_PTY_OUTPUT_BYTE_FUSE: usize = 40 * 1024; // 40 KiB
775
776    pub const DEFAULT_MAX_TOOL_CALLS_PER_TURN: usize = 32;
777    pub const DEFAULT_MAX_TOOL_WALL_CLOCK_SECS: u64 = 600;
778    pub const DEFAULT_MAX_TOOL_RETRIES: u32 = 2;
779}
780
781/// Execution boundary constants (inspired by OpenAI Codex agent loop patterns)
782/// Reference: https://openai.com/index/unrolling-the-codex-agent-loop/
783pub mod execution {
784    /// Default timeout for agent loop execution (10 minutes)
785    /// Used when no timeout is specified or when 0 is passed
786    pub const DEFAULT_TIMEOUT_SECS: u64 = 600;
787
788    /// Maximum allowed timeout (1 hour)
789    /// Any user-specified timeout above this is capped
790    pub const MAX_TIMEOUT_SECS: u64 = 3600;
791
792    /// Minimum timeout (10 seconds)
793    /// Prevents unreasonably short timeouts that would cause failures
794    pub const MIN_TIMEOUT_SECS: u64 = 10;
795
796    /// Resolve timeout with deterministic bounds (never returns 0 or unbounded)
797    /// This pattern ensures execution always has a bounded duration.
798    ///
799    /// # Arguments
800    /// * `user_timeout` - Optional user-specified timeout in seconds
801    ///
802    /// # Returns
803    /// A bounded timeout value that is:
804    /// - DEFAULT_TIMEOUT_SECS if None or 0
805    /// - MAX_TIMEOUT_SECS if exceeds maximum
806    /// - The user value if within bounds
807    #[inline]
808    pub const fn resolve_timeout(user_timeout: Option<u64>) -> u64 {
809        match user_timeout {
810            None => DEFAULT_TIMEOUT_SECS,
811            Some(0) => DEFAULT_TIMEOUT_SECS,
812            Some(t) if t > MAX_TIMEOUT_SECS => MAX_TIMEOUT_SECS,
813            Some(t) if t < MIN_TIMEOUT_SECS => MIN_TIMEOUT_SECS,
814            Some(t) => t,
815        }
816    }
817}
818
819pub mod ui {
820    pub const TOOL_OUTPUT_MODE_COMPACT: &str = "compact";
821    pub const TOOL_OUTPUT_MODE_FULL: &str = "full";
822    pub const DEFAULT_INLINE_VIEWPORT_ROWS: u16 = 16;
823    pub const DEFAULT_REASONING_VISIBLE: bool = false;
824    pub const SLASH_SUGGESTION_LIMIT: usize = 50; // All commands are scrollable
825    pub const SLASH_PALETTE_MIN_WIDTH: u16 = 40;
826    pub const SLASH_PALETTE_MIN_HEIGHT: u16 = 9;
827    pub const SLASH_PALETTE_HORIZONTAL_MARGIN: u16 = 8;
828    pub const SLASH_PALETTE_TOP_OFFSET: u16 = 3;
829    pub const SLASH_PALETTE_CONTENT_PADDING: u16 = 6;
830    pub const SLASH_PALETTE_HINT_PRIMARY: &str = "Type to filter slash commands.";
831    pub const SLASH_PALETTE_HINT_SECONDARY: &str = "Press Enter to apply • Esc to dismiss.";
832    pub const MODAL_MIN_WIDTH: u16 = 36;
833    pub const MODAL_MIN_HEIGHT: u16 = 9;
834    pub const MODAL_LIST_MIN_HEIGHT: u16 = 12;
835    pub const MODAL_WIDTH_RATIO: f32 = 0.6;
836    pub const MODAL_HEIGHT_RATIO: f32 = 0.6;
837    pub const MODAL_MAX_WIDTH_RATIO: f32 = 0.9;
838    pub const MODAL_MAX_HEIGHT_RATIO: f32 = 0.8;
839    pub const MODAL_CONTENT_HORIZONTAL_PADDING: u16 = 8;
840    pub const MODAL_CONTENT_VERTICAL_PADDING: u16 = 6;
841    pub const MODAL_INSTRUCTIONS_TITLE: &str = "";
842    pub const MODAL_INSTRUCTIONS_BULLET: &str = "•";
843    pub const INLINE_HEADER_HEIGHT: u16 = 3;
844    pub const INLINE_INPUT_HEIGHT: u16 = 4;
845    pub const INLINE_INPUT_MAX_LINES: usize = 10;
846    pub const INLINE_NAVIGATION_PERCENT: u16 = 28;
847    pub const INLINE_NAVIGATION_MIN_WIDTH: u16 = 24;
848    pub const INLINE_CONTENT_MIN_WIDTH: u16 = 48;
849    pub const INLINE_STACKED_NAVIGATION_PERCENT: u16 = INLINE_NAVIGATION_PERCENT;
850    pub const INLINE_SCROLLBAR_EDGE_PADDING: u16 = 1;
851    pub const INLINE_TRANSCRIPT_BOTTOM_PADDING: u16 = 6;
852    pub const INLINE_PREVIEW_MAX_CHARS: usize = 56;
853    pub const INLINE_PREVIEW_ELLIPSIS: &str = "…";
854    pub const HEADER_HIGHLIGHT_PREVIEW_MAX_CHARS: usize = 48;
855    pub const INLINE_AGENT_MESSAGE_LEFT_PADDING: &str = "";
856    pub const INLINE_AGENT_QUOTE_PREFIX: &str = "";
857    pub const INLINE_USER_MESSAGE_DIVIDER_SYMBOL: &str = "─";
858
859    /// Scroll percentage format in status bar
860    pub const SCROLL_INDICATOR_FORMAT: &str = "↕";
861    /// Show scroll percentage in status bar
862    pub const SCROLL_INDICATOR_ENABLED: bool = true;
863
864    pub const INLINE_BLOCK_TOP_LEFT: &str = "â•­";
865    pub const INLINE_BLOCK_TOP_RIGHT: &str = "â•®";
866    pub const INLINE_BLOCK_BODY_LEFT: &str = "│";
867    pub const INLINE_BLOCK_BODY_RIGHT: &str = "│";
868    pub const INLINE_BLOCK_BOTTOM_LEFT: &str = "â•°";
869    pub const INLINE_BLOCK_BOTTOM_RIGHT: &str = "╯";
870    pub const INLINE_BLOCK_HORIZONTAL: &str = "─";
871    pub const INLINE_TOOL_HEADER_LABEL: &str = "Tool";
872    pub const INLINE_TOOL_ACTION_PREFIX: &str = "→";
873    pub const INLINE_TOOL_DETAIL_PREFIX: &str = "↳";
874    pub const INLINE_PTY_HEADER_LABEL: &str = "Terminal";
875    pub const INLINE_PTY_RUNNING_LABEL: &str = "running";
876    pub const INLINE_PTY_STATUS_LIVE: &str = "LIVE";
877    pub const INLINE_PTY_STATUS_DONE: &str = "DONE";
878    pub const INLINE_PTY_PLACEHOLDER: &str = "Terminal output";
879    pub const MODAL_LIST_HIGHLIGHT_SYMBOL: &str = "✦";
880    pub const MODAL_LIST_HIGHLIGHT_FULL: &str = "✦ ";
881    pub const MODAL_LIST_SUMMARY_FILTER_LABEL: &str = "Filter";
882    pub const MODAL_LIST_SUMMARY_SEPARATOR: &str = " • ";
883    pub const MODAL_LIST_SUMMARY_MATCHES_LABEL: &str = "Matches";
884    pub const MODAL_LIST_SUMMARY_TOTAL_LABEL: &str = "of";
885    pub const MODAL_LIST_SUMMARY_NO_MATCHES: &str = "No matches";
886    pub const MODAL_LIST_SUMMARY_RESET_HINT: &str = "Press Esc to reset";
887    pub const MODAL_LIST_NO_RESULTS_MESSAGE: &str = "No matching options";
888    pub const HEADER_VERSION_PROMPT: &str = "> ";
889    pub const HEADER_VERSION_PREFIX: &str = "VT Code";
890    pub const HEADER_VERSION_LEFT_DELIMITER: &str = "(";
891    pub const HEADER_VERSION_RIGHT_DELIMITER: &str = ")";
892    pub const HEADER_MODE_INLINE: &str = "Inline session";
893    pub const HEADER_MODE_ALTERNATE: &str = "Alternate session";
894    pub const HEADER_MODE_AUTO: &str = "Auto session";
895    pub const HEADER_MODE_FULL_AUTO_SUFFIX: &str = " (full)";
896    pub const HEADER_MODE_PRIMARY_SEPARATOR: &str = " | ";
897    pub const HEADER_MODE_SECONDARY_SEPARATOR: &str = " | ";
898    pub const HEADER_PROVIDER_PREFIX: &str = "Provider: ";
899    pub const HEADER_MODEL_PREFIX: &str = "Model: ";
900    pub const HEADER_REASONING_PREFIX: &str = "Reasoning effort: ";
901    pub const HEADER_TRUST_PREFIX: &str = "Trust: ";
902    pub const HEADER_TOOLS_PREFIX: &str = "Tools: ";
903    pub const HEADER_MCP_PREFIX: &str = "MCP: ";
904    pub const HEADER_GIT_PREFIX: &str = "git: ";
905    pub const HEADER_GIT_CLEAN_SUFFIX: &str = "✓";
906    pub const HEADER_GIT_DIRTY_SUFFIX: &str = "*";
907    pub const HEADER_UNKNOWN_PLACEHOLDER: &str = "unavailable";
908    pub const HEADER_STATUS_LABEL: &str = "Status";
909    pub const HEADER_STATUS_ACTIVE: &str = "Active";
910    pub const HEADER_STATUS_PAUSED: &str = "Paused";
911    pub const HEADER_MESSAGES_LABEL: &str = "Messages";
912    pub const HEADER_INPUT_LABEL: &str = "Input";
913    pub const HEADER_INPUT_ENABLED: &str = "Enabled";
914    pub const HEADER_INPUT_DISABLED: &str = "Disabled";
915    pub const INLINE_USER_PREFIX: &str = " ";
916    pub const CHAT_INPUT_PLACEHOLDER_BOOTSTRAP: &str =
917        "Implement {feature} in {file} (@files, #prompts, /commands)";
918    pub const CHAT_INPUT_PLACEHOLDER_FOLLOW_UP: &str =
919        "Build something (@files, #prompts, /commands or Shift+Tab to switch to modes)";
920    pub const HEADER_SHORTCUT_HINT: &str = "Shortcuts: Enter=submit | Shift+Enter=newline | Ctrl/Cmd+Enter=queue | Esc=cancel | Ctrl+C=interrupt | @=file picker | #=custom prompts | /=slash commands";
921    pub const HEADER_META_SEPARATOR: &str = "   ";
922    pub const WELCOME_TEXT_WIDTH: usize = 80;
923    pub const WELCOME_SHORTCUT_SECTION_TITLE: &str = "Keyboard Shortcuts";
924    pub const WELCOME_SHORTCUT_HINT_PREFIX: &str = "Shortcuts:";
925    pub const WELCOME_SHORTCUT_SEPARATOR: &str = "•";
926    pub const WELCOME_SHORTCUT_INDENT: &str = "  ";
927    pub const WELCOME_SLASH_COMMAND_SECTION_TITLE: &str = "Slash Commands";
928    pub const WELCOME_SLASH_COMMAND_LIMIT: usize = 6;
929    pub const WELCOME_SLASH_COMMAND_PREFIX: &str = "/";
930    pub const WELCOME_SLASH_COMMAND_INTRO: &str = "";
931    pub const WELCOME_SLASH_COMMAND_INDENT: &str = "  ";
932    pub const NAVIGATION_BLOCK_TITLE: &str = "Timeline";
933    pub const NAVIGATION_BLOCK_SHORTCUT_NOTE: &str = "Ctrl+T";
934    pub const NAVIGATION_EMPTY_LABEL: &str = "Waiting for activity";
935    pub const NAVIGATION_INDEX_PREFIX: &str = "#";
936    pub const NAVIGATION_LABEL_AGENT: &str = "Agent";
937    pub const NAVIGATION_LABEL_ERROR: &str = "Error";
938    pub const NAVIGATION_LABEL_INFO: &str = "Info";
939    pub const NAVIGATION_LABEL_POLICY: &str = "Policy";
940    pub const NAVIGATION_LABEL_TOOL: &str = "Tool";
941    pub const NAVIGATION_LABEL_USER: &str = "User";
942    pub const NAVIGATION_LABEL_PTY: &str = "PTY";
943    pub const PLAN_BLOCK_TITLE: &str = "TODOs";
944    pub const PLAN_STATUS_EMPTY: &str = "No TODOs";
945    pub const PLAN_STATUS_IN_PROGRESS: &str = "In progress";
946    pub const PLAN_STATUS_DONE: &str = "Done";
947    pub const PLAN_IN_PROGRESS_NOTE: &str = "in progress";
948    pub const SUGGESTION_BLOCK_TITLE: &str = "Slash Commands";
949    pub const STATUS_LINE_MODE: &str = "auto";
950    pub const STATUS_LINE_REFRESH_INTERVAL_MS: u64 = 1000;
951    pub const STATUS_LINE_COMMAND_TIMEOUT_MS: u64 = 200;
952
953    // TUI tick rate constants for smooth scrolling
954    /// Tick rate (Hz) when user is actively interacting with the TUI
955    pub const TUI_ACTIVE_TICK_RATE_HZ: f64 = 16.0;
956    /// Tick rate (Hz) when TUI is idle to save CPU
957    pub const TUI_IDLE_TICK_RATE_HZ: f64 = 4.0;
958    /// Duration (ms) to remain in active mode after last input
959    pub const TUI_ACTIVE_TIMEOUT_MS: u64 = 500;
960
961    // Theme and color constants
962    pub const THEME_MIN_CONTRAST_RATIO: f64 = 4.5;
963    pub const THEME_FOREGROUND_LIGHTEN_RATIO: f64 = 0.25;
964    pub const THEME_SECONDARY_LIGHTEN_RATIO: f64 = 0.2;
965    pub const THEME_MIX_RATIO: f64 = 0.35;
966    pub const THEME_TOOL_BODY_MIX_RATIO: f64 = 0.35;
967    pub const THEME_TOOL_BODY_LIGHTEN_RATIO: f64 = 0.2;
968    pub const THEME_RESPONSE_COLOR_LIGHTEN_RATIO: f64 = 0.15;
969    pub const THEME_REASONING_COLOR_LIGHTEN_RATIO: f64 = 0.3;
970    pub const THEME_USER_COLOR_LIGHTEN_RATIO: f64 = 0.2;
971    pub const THEME_SECONDARY_USER_COLOR_LIGHTEN_RATIO: f64 = 0.4;
972    pub const THEME_PRIMARY_STATUS_LIGHTEN_RATIO: f64 = 0.35;
973    pub const THEME_PRIMARY_STATUS_SECONDARY_LIGHTEN_RATIO: f64 = 0.5;
974    pub const THEME_LOGO_ACCENT_BANNER_LIGHTEN_RATIO: f64 = 0.35;
975    pub const THEME_LOGO_ACCENT_BANNER_SECONDARY_LIGHTEN_RATIO: f64 = 0.25;
976
977    // UI Color constants
978    pub const THEME_COLOR_WHITE_RED: u8 = 0xFF;
979    pub const THEME_COLOR_WHITE_GREEN: u8 = 0xFF;
980    pub const THEME_COLOR_WHITE_BLUE: u8 = 0xFF;
981    pub const THEME_MIX_RATIO_MIN: f64 = 0.0;
982    pub const THEME_MIX_RATIO_MAX: f64 = 1.0;
983    pub const THEME_BLEND_CLAMP_MIN: f64 = 0.0;
984    pub const THEME_BLEND_CLAMP_MAX: f64 = 255.0;
985
986    // WCAG contrast algorithm constants
987    pub const THEME_RELATIVE_LUMINANCE_CUTOFF: f64 = 0.03928;
988    pub const THEME_RELATIVE_LUMINANCE_LOW_FACTOR: f64 = 12.92;
989    pub const THEME_RELATIVE_LUMINANCE_OFFSET: f64 = 0.055;
990    pub const THEME_RELATIVE_LUMINANCE_EXPONENT: f64 = 2.4;
991    pub const THEME_CONTRAST_RATIO_OFFSET: f64 = 0.05;
992    pub const THEME_RED_LUMINANCE_COEFFICIENT: f64 = 0.2126;
993    pub const THEME_GREEN_LUMINANCE_COEFFICIENT: f64 = 0.7152;
994    pub const THEME_BLUE_LUMINANCE_COEFFICIENT: f64 = 0.0722;
995    pub const THEME_LUMINANCE_LIGHTEN_RATIO: f64 = 0.2;
996}
997
998/// Reasoning effort configuration constants
999pub mod reasoning {
1000    pub const LOW: &str = "low";
1001    pub const MEDIUM: &str = "medium";
1002    pub const HIGH: &str = "high";
1003    pub const ALLOWED_LEVELS: &[&str] = &["minimal", LOW, MEDIUM, HIGH, "xhigh"];
1004    pub const LABEL_LOW: &str = "Low";
1005    pub const LABEL_MEDIUM: &str = "Medium";
1006    pub const LABEL_HIGH: &str = "High";
1007    pub const DESCRIPTION_LOW: &str = "Fast responses with lightweight reasoning.";
1008    pub const DESCRIPTION_MEDIUM: &str = "Balanced depth and speed for general tasks. (Note: May not be fully available for all models including Gemini 3 Pro)";
1009    pub const DESCRIPTION_HIGH: &str = "Maximum reasoning depth for complex problems.";
1010}
1011
1012/// Message role constants to avoid hardcoding strings
1013pub mod message_roles {
1014    pub const SYSTEM: &str = "system";
1015    pub const USER: &str = "user";
1016    pub const ASSISTANT: &str = "assistant";
1017    pub const TOOL: &str = "tool";
1018}
1019
1020/// URL constants for API endpoints
1021pub mod urls {
1022    pub const GEMINI_API_BASE: &str = "https://generativelanguage.googleapis.com/v1beta";
1023    pub const OPENAI_API_BASE: &str = "https://api.openai.com/v1";
1024    pub const HUGGINGFACE_API_BASE: &str = "https://router.huggingface.co/v1";
1025    pub const ANTHROPIC_API_BASE: &str = "https://api.anthropic.com/v1";
1026    pub const ANTHROPIC_API_VERSION: &str = "2023-06-01";
1027    pub const MINIMAX_API_BASE: &str = "https://api.minimax.io/anthropic";
1028    pub const OPENROUTER_API_BASE: &str = "https://openrouter.ai/api/v1";
1029    pub const XAI_API_BASE: &str = "https://api.x.ai/v1";
1030    pub const DEEPSEEK_API_BASE: &str = "https://api.deepseek.com/v1";
1031    pub const Z_AI_API_BASE: &str = "https://api.z.ai/api/paas/v4";
1032    pub const MOONSHOT_API_BASE: &str = "https://api.moonshot.cn/v1";
1033    pub const LMSTUDIO_API_BASE: &str = "http://localhost:1234/v1";
1034    pub const OLLAMA_API_BASE: &str = "http://localhost:11434";
1035    pub const OLLAMA_CLOUD_API_BASE: &str = "https://ollama.com";
1036}
1037
1038/// Environment variable names for overriding provider base URLs
1039pub mod env_vars {
1040    pub const GEMINI_BASE_URL: &str = "GEMINI_BASE_URL";
1041    pub const OPENAI_BASE_URL: &str = "OPENAI_BASE_URL";
1042    pub const HUGGINGFACE_BASE_URL: &str = "HUGGINGFACE_BASE_URL";
1043    pub const ANTHROPIC_BASE_URL: &str = "ANTHROPIC_BASE_URL";
1044    pub const OPENROUTER_BASE_URL: &str = "OPENROUTER_BASE_URL";
1045    pub const XAI_BASE_URL: &str = "XAI_BASE_URL";
1046    pub const DEEPSEEK_BASE_URL: &str = "DEEPSEEK_BASE_URL";
1047    pub const Z_AI_BASE_URL: &str = "Z_AI_BASE_URL";
1048    pub const MOONSHOT_BASE_URL: &str = "MOONSHOT_BASE_URL";
1049    pub const LMSTUDIO_BASE_URL: &str = "LMSTUDIO_BASE_URL";
1050    pub const OLLAMA_BASE_URL: &str = "OLLAMA_BASE_URL";
1051    pub const MINIMAX_BASE_URL: &str = "MINIMAX_BASE_URL";
1052
1053    /// Environment variable for setting maximum thinking budget tokens
1054    /// Set to 63999 to get 2x the default thinking budget on 64K output models
1055    /// See: https://decodeclaude.com/ultrathink-deprecated/
1056    pub const MAX_THINKING_TOKENS: &str = "MAX_THINKING_TOKENS";
1057}
1058
1059/// HTTP header constants for provider integrations
1060pub mod headers {
1061    pub const ACCEPT_LANGUAGE: &str = "Accept-Language";
1062    pub const ACCEPT_LANGUAGE_DEFAULT: &str = "en-US,en";
1063}
1064
1065/// Tool name constants to avoid hardcoding strings throughout the codebase
1066pub mod tools {
1067    // ============================================================
1068    // UNIFIED TOOLS (Primary Interface)
1069    // ============================================================
1070    /// Unified search & discovery tool (aliases: grep_file, list_files, code_intelligence, etc.)
1071    pub const UNIFIED_SEARCH: &str = "unified_search";
1072    /// Unified shell execution & code execution tool (aliases: run_pty_cmd, execute_code, etc.)
1073    pub const UNIFIED_EXEC: &str = "unified_exec";
1074    /// Unified file operations tool (aliases: read_file, write_file, edit_file, etc.)
1075    pub const UNIFIED_FILE: &str = "unified_file";
1076
1077    // ============================================================
1078    // SKILL MANAGEMENT TOOLS (Progressive Disclosure)
1079    // ============================================================
1080    /// List all available skills (local and dormant system utilities)
1081    pub const LIST_SKILLS: &str = "list_skills";
1082    /// Load a skill's instructions and activate its tools
1083    pub const LOAD_SKILL: &str = "load_skill";
1084    /// Load resources from a skill (scripts, templates, docs)
1085    pub const LOAD_SKILL_RESOURCE: &str = "load_skill_resource";
1086
1087    // ============================================================
1088    // AGENT CONTROL TOOLS (Delegation)
1089    // ============================================================
1090    /// Spawn a subagent for specialized tasks (explore, plan, general, etc.)
1091    pub const SPAWN_SUBAGENT: &str = "spawn_subagent";
1092
1093    // ============================================================
1094    // LEGACY SEARCH ALIASES (use unified_search instead)
1095    // ============================================================
1096    pub const GREP_FILE: &str = "grep_file";
1097    pub const LIST_FILES: &str = "list_files";
1098    pub const CODE_INTELLIGENCE: &str = "code_intelligence";
1099    pub const SEARCH_TOOLS: &str = "search_tools";
1100    pub const SKILL: &str = "skill";
1101    pub const AGENT_INFO: &str = "agent_info";
1102    pub const WEB_FETCH: &str = "web_fetch";
1103    pub const SEARCH: &str = "search";
1104    pub const FIND: &str = "find";
1105
1106    // ============================================================
1107    // LEGACY EXECUTION ALIASES (use unified_exec instead)
1108    // ============================================================
1109    pub const RUN_PTY_CMD: &str = "run_pty_cmd";
1110    pub const CREATE_PTY_SESSION: &str = "create_pty_session";
1111    pub const LIST_PTY_SESSIONS: &str = "list_pty_sessions";
1112    pub const CLOSE_PTY_SESSION: &str = "close_pty_session";
1113    pub const SEND_PTY_INPUT: &str = "send_pty_input";
1114    pub const READ_PTY_SESSION: &str = "read_pty_session";
1115    pub const RESIZE_PTY_SESSION: &str = "resize_pty_session";
1116    pub const EXECUTE_CODE: &str = "execute_code";
1117    pub const EXEC_PTY_CMD: &str = "exec_pty_cmd";
1118    pub const EXEC: &str = "exec";
1119    pub const SHELL: &str = "shell";
1120
1121    // ============================================================
1122    // LEGACY FILE OPERATION ALIASES (use unified_file instead)
1123    // ============================================================
1124    pub const READ_FILE: &str = "read_file";
1125    pub const WRITE_FILE: &str = "write_file";
1126    pub const EDIT_FILE: &str = "edit_file";
1127    pub const DELETE_FILE: &str = "delete_file";
1128    pub const CREATE_FILE: &str = "create_file";
1129    pub const APPLY_PATCH: &str = "apply_patch";
1130    pub const SEARCH_REPLACE: &str = "search_replace";
1131    pub const FILE_OP: &str = "file_op";
1132    pub const MOVE_FILE: &str = "move_file";
1133    pub const COPY_FILE: &str = "copy_file";
1134
1135    // ============================================================
1136    // ERROR & DIAGNOSTICS
1137    // ============================================================
1138    pub const GET_ERRORS: &str = "get_errors";
1139
1140    // ============================================================
1141    // HUMAN-IN-THE-LOOP (HITL)
1142    // ============================================================
1143    /// Ask the human a question via the interactive UI (TUI) and return the selection.
1144    pub const ASK_USER_QUESTION: &str = "ask_user_question";
1145    /// Request structured user input with 1-3 questions and optional multiple-choice options.
1146    pub const REQUEST_USER_INPUT: &str = "request_user_input";
1147
1148    // ============================================================
1149    // PLAN MODE
1150    // ============================================================
1151    /// Enter plan mode - enables read-only tools and planning workflow.
1152    pub const ENTER_PLAN_MODE: &str = "enter_plan_mode";
1153    /// Exit plan mode - triggers confirmation modal before execution.
1154    pub const EXIT_PLAN_MODE: &str = "exit_plan_mode";
1155
1156    // Special wildcard for full access
1157    pub const WILDCARD_ALL: &str = "*";
1158}
1159
1160/// Bash tool security validation constants
1161pub mod bash {
1162    /// Commands that are always blocked for security reasons
1163    pub const ALWAYS_BLOCKED_COMMANDS: &[&str] = &[
1164        "rm",
1165        "rmdir",
1166        "del",
1167        "format",
1168        "fdisk",
1169        "mkfs",
1170        "dd",
1171        "shred",
1172        "wipe",
1173        "srm",
1174        "unlink",
1175        "chmod",
1176        "chown",
1177        "passwd",
1178        "usermod",
1179        "userdel",
1180        "systemctl",
1181        "service",
1182        "kill",
1183        "killall",
1184        "pkill",
1185        "reboot",
1186        "shutdown",
1187        "halt",
1188        "poweroff",
1189        "sudo",
1190        "su",
1191        "doas",
1192        "runas",
1193        "mount",
1194        "umount",
1195        "fsck",
1196        "tune2fs", // Filesystem operations
1197        "iptables",
1198        "ufw",
1199        "firewalld", // Firewall
1200        "crontab",
1201        "at", // Scheduling
1202        "podman",
1203        "kubectl", // Container/orchestration
1204    ];
1205
1206    /// Network commands that require sandbox to be enabled
1207    pub const NETWORK_COMMANDS: &[&str] = &[
1208        "wget", "ftp", "scp", "rsync", "ssh", "telnet", "nc", "ncat", "socat",
1209    ];
1210
1211    /// Commands that are always allowed (safe development tools)
1212    pub const ALLOWED_COMMANDS: &[&str] = &[
1213        // File system and basic utilities
1214        "ls",
1215        "pwd",
1216        "cat",
1217        "head",
1218        "tail",
1219        "grep",
1220        "find",
1221        "wc",
1222        "sort",
1223        "uniq",
1224        "cut",
1225        "awk",
1226        "sed",
1227        "echo",
1228        "printf",
1229        "seq",
1230        "basename",
1231        "dirname",
1232        "date",
1233        "cal",
1234        "bc",
1235        "expr",
1236        "test",
1237        "[",
1238        "]",
1239        "true",
1240        "false",
1241        "sleep",
1242        "which",
1243        "type",
1244        "file",
1245        "stat",
1246        "du",
1247        "df",
1248        "ps",
1249        "top",
1250        "htop",
1251        "tree",
1252        "less",
1253        "more",
1254        "tac",
1255        "rev",
1256        "tr",
1257        "fold",
1258        "paste",
1259        "join",
1260        "comm",
1261        "diff",
1262        "patch",
1263        "gzip",
1264        "gunzip",
1265        "bzip2",
1266        "bunzip2",
1267        "xz",
1268        "unxz",
1269        "tar",
1270        "zip",
1271        "unzip",
1272        "shasum",
1273        "md5sum",
1274        "sha256sum",
1275        "sha512sum", // Hashing tools
1276        // Version control
1277        "git",
1278        "hg",
1279        "svn",
1280        "git-lfs",
1281        // Build systems and tools
1282        "make",
1283        "cmake",
1284        "ninja",
1285        "meson",
1286        "bazel",
1287        "buck2",
1288        "scons",
1289        "waf",
1290        "xcodebuild",
1291        // Rust/Cargo ecosystem
1292        "cargo",
1293        "rustc",
1294        "rustfmt",
1295        "rustup",
1296        "clippy",
1297        "cargo-clippy",
1298        "cargo-fmt",
1299        "cargo-build",
1300        "cargo-test",
1301        "cargo-run",
1302        "cargo-check",
1303        "cargo-doc",
1304        // Node.js/npm ecosystem
1305        "npm",
1306        "yarn",
1307        "pnpm",
1308        "bun",
1309        "npx",
1310        "node",
1311        "yarnpkg",
1312        "npm-run",
1313        "npm-test",
1314        "npm-start",
1315        "npm-build",
1316        "npm-lint",
1317        "npm-install",
1318        "yarn-test",
1319        "yarn-start",
1320        "yarn-build",
1321        "yarn-lint",
1322        "yarn-install",
1323        "pnpm-test",
1324        "pnpm-start",
1325        "pnpm-build",
1326        "pnpm-lint",
1327        "pnpm-install",
1328        "bun-test",
1329        "bun-start",
1330        "bun-build",
1331        "bun-lint",
1332        "bun-install",
1333        "bun-run",
1334        // Python ecosystem
1335        "python",
1336        "python3",
1337        "pip",
1338        "pip3",
1339        "virtualenv",
1340        "venv",
1341        "conda",
1342        "pytest",
1343        "python-m-pytest",
1344        "python3-m-pytest",
1345        "python-m-pip",
1346        "python3-m-pip",
1347        "python-m-venv",
1348        "python3-m-venv",
1349        "black",
1350        "flake8",
1351        "mypy",
1352        "pylint",
1353        "isort",
1354        "ruff",
1355        "bandit",
1356        // Java ecosystem
1357        "java",
1358        "javac",
1359        "jar",
1360        "jarsigner",
1361        "javadoc",
1362        "jmap",
1363        "jstack",
1364        "jstat",
1365        "jinfo",
1366        "mvn",
1367        "gradle",
1368        "gradlew",
1369        "./gradlew",
1370        "mvnw",
1371        "./mvnw",
1372        "mvn-test",
1373        "mvn-compile",
1374        "mvn-package",
1375        "mvn-install",
1376        "mvn-clean",
1377        "gradle-test",
1378        "gradle-build",
1379        "gradle-check",
1380        "gradle-run",
1381        "gradle-clean",
1382        // Go ecosystem
1383        "go",
1384        "gofmt",
1385        "goimports",
1386        "golint",
1387        "go-test",
1388        "go-build",
1389        "go-run",
1390        "go-mod",
1391        "golangci-lint",
1392        "go-doc",
1393        "go-vet",
1394        "go-install",
1395        "go-clean",
1396        // C/C++ ecosystem
1397        "gcc",
1398        "g++",
1399        "clang",
1400        "clang++",
1401        "clang-cl",
1402        "cpp",
1403        "cc",
1404        "c++",
1405        "gcc-ar",
1406        "gcc-nm",
1407        "gcc-ranlib",
1408        "ld",
1409        "lld",
1410        "gold",
1411        "bfdld",
1412        "make",
1413        "cmake",
1414        "ninja",
1415        "autotools",
1416        "autoconf",
1417        "automake",
1418        "libtool",
1419        "pkg-config",
1420        "pkgconfig",
1421        // Testing frameworks and tools
1422        "pytest",
1423        "jest",
1424        "mocha",
1425        "jasmine",
1426        "karma",
1427        "chai",
1428        "sinon",
1429        "vitest",
1430        "cypress",
1431        "selenium",
1432        "playwright",
1433        "testcafe",
1434        "tape",
1435        "ava",
1436        "qunit",
1437        "junit",
1438        "googletest",
1439        "catch2",
1440        "benchmark",
1441        "hyperfine",
1442        // Linting and formatting tools
1443        "eslint",
1444        "prettier",
1445        "tslint",
1446        "jshint",
1447        "jscs",
1448        "stylelint",
1449        "htmlhint",
1450        "jsonlint",
1451        "yamllint",
1452        "toml-check",
1453        "markdownlint",
1454        "remark-cli",
1455        "shellcheck",
1456        "hadolint",
1457        "rustfmt",
1458        "gofmt",
1459        "black",
1460        "isort",
1461        "ruff",
1462        "clang-format",
1463        "clang-tidy",
1464        // Documentation tools
1465        "doxygen",
1466        "sphinx",
1467        "mkdocs",
1468        "hugo",
1469        "jekyll",
1470        "gatsby",
1471        "next",
1472        "nuxt",
1473        "vuepress",
1474        "docusaurus",
1475        "storybook",
1476        "gitbook",
1477        "readthedocs",
1478        "pandoc",
1479        "mdbook",
1480        "mdBook",
1481        // Container tools (safe operations only)
1482        "docker",
1483        "docker-compose",
1484        "docker-buildx",
1485        "podman",
1486        "buildah",
1487        "docker-build",
1488        "docker-run",
1489        "docker-ps",
1490        "docker-images",
1491        "docker-inspect",
1492        "docker-exec",
1493        "docker-logs",
1494        "docker-stats",
1495        "docker-system",
1496        "docker-network",
1497        // Database tools (development usage)
1498        "sqlite3",
1499        "mysql",
1500        "psql",
1501        "mongosh",
1502        "redis-cli",
1503        "redis-server",
1504        // Cloud and deployment tools
1505        "aws",
1506        "gcloud",
1507        "az",
1508        "kubectl",
1509        "helm",
1510        "terraform",
1511        "tf",
1512        "terragrunt",
1513        "serverless",
1514        "sls",
1515        "pulumi",
1516        "cdk",
1517        "sam",
1518        "localstack",
1519        "minikube",
1520        // Security and analysis tools
1521        "gitleaks",
1522        "trivy",
1523        "snyk",
1524        "npm-audit",
1525        "pip-audit",
1526        "cargo-audit",
1527        "bandit",
1528        "safety",
1529        "pipenv",
1530        "poetry",
1531        // Performance profiling tools
1532        "perf",
1533        "strace",
1534        "ltrace",
1535        "valgrind",
1536        "gdb",
1537        "lldb",
1538        "sar",
1539        "iostat",
1540        "vmstat",
1541        "htop",
1542        "iotop",
1543        "nethogs",
1544        "iftop",
1545        "speedtest-cli",
1546        "ab",
1547        "wrk",
1548        "hey",
1549        // CI/CD tools
1550        "gh",
1551        "gitlab-ci",
1552        "bitbucket",
1553        "azure-pipelines",
1554        "circleci",
1555        "jenkins",
1556        "drone",
1557        "buildkite",
1558        "travis",
1559        "appveyor",
1560        // Package managers for various languages
1561        "composer",
1562        "pear",
1563        "gem",
1564        "rbenv",
1565        "rvm",
1566        "nvm",
1567        "nodenv",
1568        "pyenv",
1569        "rbenv",
1570        "sdkman",
1571        "jenv",
1572        "lein",
1573        "boot",
1574        "mix",
1575        "rebar3",
1576        "erl",
1577        "elixir",
1578        // Web development tools
1579        "webpack",
1580        "rollup",
1581        "vite",
1582        "parcel",
1583        "esbuild",
1584        "snowpack",
1585        "turbo",
1586        "swc",
1587        "babel",
1588        "postcss",
1589        "sass",
1590        "scss",
1591        "less",
1592        "stylus",
1593        "tailwindcss",
1594        // Mobile development tools
1595        "xcodebuild",
1596        "fastlane",
1597        "gradle",
1598        "./gradlew",
1599        "cordova",
1600        "ionic",
1601        "react-native",
1602        "flutter",
1603        "expo",
1604        "capacitor",
1605    ];
1606}
1607
1608pub mod mcp {
1609    pub const RENDERER_CONTEXT7: &str = "context7";
1610    pub const RENDERER_SEQUENTIAL_THINKING: &str = "sequential-thinking";
1611
1612    /// Default startup timeout for MCP servers in milliseconds (60 seconds)
1613    /// Can be overridden via config: mcp.startup_timeout_seconds
1614    pub const DEFAULT_STARTUP_TIMEOUT_MS: u64 = 60_000;
1615}
1616
1617pub mod project_doc {
1618    pub const DEFAULT_MAX_BYTES: usize = 16 * 1024;
1619}
1620
1621pub mod instructions {
1622    pub const DEFAULT_MAX_BYTES: usize = 16 * 1024;
1623}
1624
1625/// LLM generation parameters
1626pub mod llm_generation {
1627    /// Default temperature for main LLM responses (0.0-1.0)
1628    /// Controls randomness/creativity: 0=deterministic, 1=random
1629    /// 0.7 provides balanced creativity and consistency
1630    pub const DEFAULT_TEMPERATURE: f32 = 0.7;
1631
1632    /// Default temperature for prompt refinement (0.0-1.0)
1633    /// Lower than main temperature for more deterministic refinement
1634    pub const DEFAULT_REFINE_TEMPERATURE: f32 = 0.3;
1635}
1636
1637/// Context window management defaults
1638/// Based on Anthropic context window documentation:
1639/// https://docs.anthropic.com/en/docs/build-with-claude/context-windows
1640pub mod context {
1641    /// Head ratio percentage for code files (legacy, kept for compatibility)
1642    pub const CODE_HEAD_RATIO_PERCENT: usize = 60;
1643
1644    /// Head ratio percentage for log files (legacy, kept for compatibility)
1645    pub const LOG_HEAD_RATIO_PERCENT: usize = 20;
1646
1647    // =========================================================================
1648    // Context Window Sizes
1649    // =========================================================================
1650
1651    /// Standard context window size (200K tokens) - default for most models
1652    pub const STANDARD_CONTEXT_WINDOW: usize = 200_000;
1653
1654    /// Extended context window size (1M tokens) - beta feature
1655    /// Available for Claude Sonnet 4, Sonnet 4.5 in usage tier 4
1656    /// Requires beta header: "context-1m-2025-08-07"
1657    pub const EXTENDED_CONTEXT_WINDOW: usize = 1_000_000;
1658
1659    /// Claude.ai Enterprise context window (500K tokens)
1660    pub const ENTERPRISE_CONTEXT_WINDOW: usize = 500_000;
1661
1662    // =========================================================================
1663    // Token Budget Thresholds (for proactive context management)
1664    // =========================================================================
1665
1666    /// First warning threshold - start preparing for context handoff
1667    /// At 70% usage: Consider updating key artifacts to persist context
1668    pub const TOKEN_BUDGET_WARNING_THRESHOLD: f64 = 0.70;
1669
1670    /// Second warning threshold - active context management needed
1671    /// At 85% usage: Actively summarize and persist state
1672    pub const TOKEN_BUDGET_HIGH_THRESHOLD: f64 = 0.85;
1673
1674    /// Critical threshold - immediate action required
1675    /// At 90% usage: Force context handoff or summary
1676    pub const TOKEN_BUDGET_CRITICAL_THRESHOLD: f64 = 0.90;
1677
1678    // =========================================================================
1679    // Extended Thinking Token Management
1680    // =========================================================================
1681
1682    /// Minimum budget tokens for extended thinking (Anthropic requirement)
1683    pub const MIN_THINKING_BUDGET: u32 = 1_024;
1684
1685    /// Recommended budget tokens for complex reasoning tasks
1686    pub const RECOMMENDED_THINKING_BUDGET: u32 = 10_000;
1687
1688    /// Default thinking budget for production use (64K output models: Opus 4.5, Sonnet 4.5, Haiku 4.5)
1689    /// Extended thinking is now auto-enabled by default as of January 2026
1690    pub const DEFAULT_THINKING_BUDGET: u32 = 31_999;
1691
1692    /// Maximum thinking budget for 64K output models (Opus 4.5, Sonnet 4.5, Haiku 4.5)
1693    /// Use MAX_THINKING_TOKENS=63999 environment variable to enable this
1694    pub const MAX_THINKING_BUDGET_64K: u32 = 63_999;
1695
1696    /// Maximum thinking budget for 32K output models (Opus 4)
1697    pub const MAX_THINKING_BUDGET_32K: u32 = 31_999;
1698
1699    // =========================================================================
1700    // Beta Headers
1701    // =========================================================================
1702
1703    /// Beta header for 1M token context window
1704    /// Include in requests to enable extended context for Sonnet 4/4.5
1705    pub const BETA_CONTEXT_1M: &str = "context-1m-2025-08-07";
1706
1707    // =========================================================================
1708    // Context-Aware Model Detection
1709    // =========================================================================
1710
1711    /// Models that support context awareness (budget tracking in prompts)
1712    /// Context awareness: model tracks remaining token budget throughout conversation
1713    /// Currently: Claude Sonnet 4.5, Claude Haiku 4.5
1714    pub const CONTEXT_AWARE_MODELS: &[&str] = &[
1715        "claude-sonnet-4-5",
1716        "claude-sonnet-4-5-20250514",
1717        "claude-haiku-4-5",
1718        "claude-haiku-4-5-20250514",
1719    ];
1720
1721    /// Check if a model supports context awareness
1722    pub fn supports_context_awareness(model: &str) -> bool {
1723        CONTEXT_AWARE_MODELS.iter().any(|m| model.contains(m))
1724    }
1725
1726    /// Models eligible for 1M context window (beta)
1727    /// Requires usage tier 4 or custom rate limits
1728    pub const EXTENDED_CONTEXT_ELIGIBLE_MODELS: &[&str] = &[
1729        "claude-sonnet-4",
1730        "claude-sonnet-4-5",
1731        "claude-sonnet-4-20250514",
1732        "claude-sonnet-4-5-20250514",
1733    ];
1734
1735    /// Check if a model is eligible for 1M context window
1736    pub fn supports_extended_context(model: &str) -> bool {
1737        EXTENDED_CONTEXT_ELIGIBLE_MODELS
1738            .iter()
1739            .any(|m| model.contains(m))
1740    }
1741}
1742
1743/// Chunking constants for large file handling
1744pub mod chunking {
1745    /// Maximum lines before triggering chunking for read_file
1746    pub const MAX_LINES_THRESHOLD: usize = 2_000;
1747
1748    /// Number of lines to read from start of file when chunking
1749    pub const CHUNK_START_LINES: usize = 800;
1750
1751    /// Number of lines to read from end of file when chunking
1752    pub const CHUNK_END_LINES: usize = 800;
1753
1754    /// Maximum content size for write_file before chunking (in bytes)
1755    pub const MAX_WRITE_CONTENT_SIZE: usize = 500_000; // 500KB
1756
1757    /// Chunk size for write operations (in bytes)
1758    pub const WRITE_CHUNK_SIZE: usize = 50_000; // 50KB chunks
1759}
1760
1761/// Diff preview controls for file operations
1762pub mod diff {
1763    /// Maximum number of bytes allowed in diff preview inputs
1764    pub const MAX_PREVIEW_BYTES: usize = 200_000;
1765
1766    /// Number of context lines to include around changes in unified diff output
1767    pub const CONTEXT_RADIUS: usize = 3;
1768
1769    /// Maximum number of diff lines to keep in preview output before condensation
1770    pub const MAX_PREVIEW_LINES: usize = 160;
1771
1772    /// Number of leading diff lines to retain when condensing previews
1773    pub const HEAD_LINE_COUNT: usize = 96;
1774
1775    /// Number of trailing diff lines to retain when condensing previews
1776    pub const TAIL_LINE_COUNT: usize = 32;
1777
1778    /// Maximum number of files to show inline diffs for before suppression
1779    pub const MAX_INLINE_DIFF_FILES: usize = 10;
1780
1781    /// Maximum total diff lines across all files before suppression
1782    pub const MAX_TOTAL_DIFF_LINES: usize = 500;
1783
1784    /// Maximum additions + deletions in a single file before suppression
1785    pub const MAX_SINGLE_FILE_CHANGES: usize = 200;
1786
1787    /// Maximum number of files to list in suppression summary
1788    pub const MAX_FILES_IN_SUMMARY: usize = 20;
1789
1790    /// Message shown when inline diffs are suppressed
1791    pub const SUPPRESSION_MESSAGE: &str = "Inline diffs have been suppressed for recent changes because there are too many to display.";
1792
1793    /// Hint message shown with suppressed diffs
1794    pub const SUPPRESSION_HINT: &str = "Tip: Use `git diff` to view the full changes.";
1795}
1796
1797/// Memory monitoring thresholds and constants
1798pub mod memory {
1799    /// Soft memory limit in bytes (400 MB) - triggers warning and TTL reduction
1800    pub const SOFT_LIMIT_BYTES: usize = 400 * 1024 * 1024;
1801
1802    /// Hard memory limit in bytes (600 MB) - triggers aggressive eviction
1803    pub const HARD_LIMIT_BYTES: usize = 600 * 1024 * 1024;
1804
1805    /// Memory check interval in milliseconds (100 ms)
1806    pub const CHECK_INTERVAL_MS: u64 = 100;
1807
1808    /// TTL reduction factor under warning pressure (reduce from 5min to 2min)
1809    pub const WARNING_TTL_REDUCTION_FACTOR: f64 = 0.4;
1810
1811    /// TTL reduction factor under critical pressure (reduce from 5min to 30s)
1812    pub const CRITICAL_TTL_REDUCTION_FACTOR: f64 = 0.1;
1813
1814    /// Minimum RSA size to track in checkpoints (1 MB)
1815    /// Minimum RSS size to track in checkpoints (1 MiB)
1816    pub const MIN_RSS_CHECKPOINT_BYTES: usize = 1024 * 1024;
1817
1818    /// Maximum memory checkpoint history to keep
1819    pub const MAX_CHECKPOINT_HISTORY: usize = 100;
1820
1821    /// Default threshold for memory pressure report (MB)
1822    pub const DEFAULT_REPORT_THRESHOLD_MB: usize = 50;
1823}