1pub mod bash_runner;
97pub mod cli;
98pub mod code;
99pub mod commands;
100pub mod config;
101pub mod constants;
102pub mod core;
103pub mod gemini;
104pub mod llm;
105pub mod markdown_storage;
106pub mod models;
107pub mod project;
108pub mod project_doc;
109pub mod prompts;
110pub mod safety;
111pub mod simple_indexer;
112pub mod tool_policy;
113pub mod tools;
114pub mod types;
115pub mod ui;
116pub mod utils;
117
118pub use bash_runner::BashRunner;
120pub use cli::args::{Cli, Commands};
121pub use code::code_completion::{CompletionEngine, CompletionSuggestion};
122pub use commands::stats::handle_stats_command;
123pub use config::types::{
124 AnalysisDepth, CapabilityLevel, CommandResult, CompressionLevel, ContextConfig, LoggingConfig,
125 OutputFormat, PerformanceMetrics, ReasoningEffortLevel, SessionInfo, ToolConfig,
126};
127pub use config::{AgentConfig, VTCodeConfig};
128pub use core::agent::core::Agent;
129pub use core::context_compression::{
130 CompressedContext, ContextCompressionConfig, ContextCompressor,
131};
132pub use core::conversation_summarizer::ConversationSummarizer;
133pub use core::performance_profiler::PerformanceProfiler;
134pub use core::prompt_caching::{CacheStats, PromptCache, PromptCacheConfig, PromptOptimizer};
135pub use core::timeout_detector::TimeoutDetector;
136pub use gemini::{Content, FunctionDeclaration, Part};
137pub use llm::{AnyClient, make_client};
138pub use markdown_storage::{MarkdownStorage, ProjectData, ProjectStorage, SimpleKVStorage};
139pub use project::{SimpleCache, SimpleProjectManager};
140pub use prompts::{
141 generate_lightweight_instruction, generate_specialized_instruction, generate_system_instruction,
142};
143pub use simple_indexer::SimpleIndexer;
144pub use tool_policy::{ToolPolicy, ToolPolicyManager};
145pub use tools::advanced_search::{AdvancedSearchTool, SearchOptions};
146pub use tools::grep_search::GrepSearchManager;
147pub use tools::tree_sitter::TreeSitterAnalyzer;
148pub use tools::{
149 ToolRegistration, ToolRegistry, build_function_declarations,
150 build_function_declarations_for_level,
151};
152pub use ui::diff_renderer::DiffRenderer;
153pub use utils::dot_config::{
154 CacheConfig, DotConfig, DotManager, ProviderConfigs, UiConfig, UserPreferences,
155 WorkspaceTrustLevel, WorkspaceTrustRecord, WorkspaceTrustStore, initialize_dot_folder,
156 load_user_config, save_user_config, update_theme_preference,
157};
158pub use utils::vtcodegitignore::initialize_vtcode_gitignore;
159
160#[cfg(test)]
161mod tests {
162 use super::*;
163
164 use tempfile::TempDir;
165
166 #[test]
167 fn test_library_exports() {
168 let _cache = PromptCache::new();
170 }
171
172 #[test]
173 fn test_module_structure() {
174 }
177
178 #[test]
179 fn test_version_consistency() {
180 }
183
184 #[tokio::test]
185 async fn test_tool_registry_integration() {
186 use crate::config::constants::tools;
187
188 let temp_dir = TempDir::new().unwrap();
189 std::env::set_current_dir(&temp_dir).unwrap();
190
191 let mut registry = ToolRegistry::new(temp_dir.path().to_path_buf());
192
193 let list_args = serde_json::json!({
195 "path": "."
196 });
197
198 let result = registry.execute_tool(tools::LIST_FILES, list_args).await;
199 assert!(result.is_ok());
200
201 let response: serde_json::Value = result.unwrap();
202 assert!(response["files"].is_array());
203 }
204
205 #[tokio::test]
206 async fn test_pty_basic_command() {
207 let temp_dir = TempDir::new().unwrap();
208 let workspace = temp_dir.path().to_path_buf();
209 let mut registry = ToolRegistry::new(workspace.clone());
210
211 let args = serde_json::json!({
213 "command": "echo",
214 "args": ["Hello, PTY!"]
215 });
216
217 let result = registry.execute_tool("run_pty_cmd", args).await;
218 assert!(result.is_ok());
219 let response: serde_json::Value = result.unwrap();
220 assert_eq!(response["success"], true);
221 assert_eq!(response["code"], 0);
222 assert!(response["output"].as_str().unwrap().contains("Hello, PTY!"));
223 }
224
225 #[tokio::test]
226 async fn test_pty_session_management() {
227 let temp_dir = TempDir::new().unwrap();
228 let workspace = temp_dir.path().to_path_buf();
229 let mut registry = ToolRegistry::new(workspace.clone());
230
231 let args = serde_json::json!({
233 "session_id": "test_session",
234 "command": "bash"
235 });
236
237 let result = registry.execute_tool("create_pty_session", args).await;
238 assert!(result.is_ok());
239 let response: serde_json::Value = result.unwrap();
240 assert_eq!(response["success"], true);
241 assert_eq!(response["session_id"], "test_session");
242
243 let args = serde_json::json!({});
245 let result = registry.execute_tool("list_pty_sessions", args).await;
246 assert!(result.is_ok());
247 let response: serde_json::Value = result.unwrap();
248 assert!(
249 response["sessions"]
250 .as_array()
251 .unwrap()
252 .contains(&"test_session".into())
253 );
254
255 let args = serde_json::json!({
257 "session_id": "test_session"
258 });
259
260 let result = registry.execute_tool("close_pty_session", args).await;
261 assert!(result.is_ok());
262 let response: serde_json::Value = result.unwrap();
263 assert_eq!(response["success"], true);
264 assert_eq!(response["session_id"], "test_session");
265 }
266}