diff --git a/python_binding_and_cmdline/refact/cli_main.py b/python_binding_and_cmdline/refact/cli_main.py index 43a5adb55..720a4a1a2 100644 --- a/python_binding_and_cmdline/refact/cli_main.py +++ b/python_binding_and_cmdline/refact/cli_main.py @@ -55,7 +55,7 @@ async def welcome_message(settings: cli_settings.CmdlineArgs, tip: str): text = f""" ~/.cache/refact/cli.yaml -- set up this program ~/.cache/refact/bring-your-own-key.yaml -- set up models you want to use -~/.cache/refact/integrations.yaml -- set up github, jira, make, gdb, and other tools, including which actions require confirmation +~/.cache/refact/integrations.d/* -- set up github, jira, make, gdb, and other tools, including which actions require confirmation ~/.cache/refact/privacy.yaml -- which files should never leave your computer Project: {settings.project_path} To exit, type 'exit' or Ctrl+D. {tip}. diff --git a/src/global_context.rs b/src/global_context.rs index 51abff304..67666e4c6 100644 --- a/src/global_context.rs +++ b/src/global_context.rs @@ -82,7 +82,7 @@ pub struct CommandLine { #[structopt(long, short="w", default_value="", help="Workspace folder to find all the files. An LSP or HTTP request can override this later.")] pub workspace_folder: String, - #[structopt(long, help="create manually bring-your-own-key.yaml, integrations.yaml, customization.yaml and privacy.yaml and EXIT")] + #[structopt(long, help="create manually bring-your-own-key.yaml, customization.yaml and privacy.yaml and exit.")] pub only_create_yaml_configs: bool, #[structopt(long, help="Print combined customization settings from both system defaults and customization.yaml.")] pub print_customization: bool, @@ -93,7 +93,7 @@ pub struct CommandLine { #[structopt(long, help="A way to tell this binary it can run more tools without confirmation.")] pub inside_container: bool, - #[structopt(long, default_value="", help="Specify an alternative integrations.yaml, this also disables the global integrations.d")] + #[structopt(long, default_value="", help="Specify the integrations.yaml, this also disables the global integrations.d")] pub integrations_yaml: String, } diff --git a/src/http/routers/v1/links.rs b/src/http/routers/v1/links.rs index 8ab1f6d45..99dbd82ff 100644 --- a/src/http/routers/v1/links.rs +++ b/src/http/routers/v1/links.rs @@ -95,7 +95,7 @@ pub async fn handle_v1_links( // GIT uncommitted if post.meta.chat_mode == ChatMode::AGENT { let commits = get_commit_information_from_current_changes(gcx.clone()).await; - + let mut project_changes = Vec::new(); for commit in &commits { project_changes.push(format!( @@ -133,7 +133,7 @@ pub async fn handle_v1_links( } } - // Failures above + // Failures in integrations if post.meta.chat_mode == ChatMode::AGENT { for failed_integr_name in failed_integration_names_after_last_user_message(&post.messages) { links.push(Link { diff --git a/src/integrations/integr_pdb.rs b/src/integrations/integr_pdb.rs index 9b99e1580..f3fef15a8 100644 --- a/src/integrations/integr_pdb.rs +++ b/src/integrations/integr_pdb.rs @@ -231,7 +231,7 @@ async fn start_pdb_session( timeout_seconds: u64, ) -> Result { if !(command_args.len() >= 3 && command_args[0] == "python" && command_args[1] == "-m" && command_args[2] == "pdb") { - return Err("Usage: python -m pdb ... To use a different Python environment, set `python_path` in `integrations.yaml`.".to_string()); + return Err("Usage: python -m pdb ... To use a different Python environment, use a path to python binary.".to_string()); } command_args.remove(0); diff --git a/src/integrations/setting_up_integrations.rs b/src/integrations/setting_up_integrations.rs index fa806b918..939993e7d 100644 --- a/src/integrations/setting_up_integrations.rs +++ b/src/integrations/setting_up_integrations.rs @@ -269,10 +269,6 @@ pub fn read_integrations_d( pub async fn get_integrations_yaml_path(gcx: Arc>) -> String { let gcx_locked = gcx.read().await; let r = gcx_locked.cmdline.integrations_yaml.clone(); - // if r.is_empty() { - // let config_dir = gcx_locked.config_dir.join("integrations.yaml"); - // return config_dir.to_string_lossy().to_string(); - // } r } @@ -433,7 +429,7 @@ pub async fn integration_config_get( pub async fn integration_config_save( integr_config_path: &String, integr_values: &serde_json::Value, -) -> Result<(), String> { +) -> Result<(), String> { let config_path = crate::files_correction::canonical_path(integr_config_path); let (integr_name, _project_path) = crate::integrations::setting_up_integrations::split_path_into_project_and_integration(&config_path) .map_err(|e| format!("Failed to split path: {}", e))?; diff --git a/src/tools/tools_description.rs b/src/tools/tools_description.rs index a2976d591..c62167fd7 100644 --- a/src/tools/tools_description.rs +++ b/src/tools/tools_description.rs @@ -1,4 +1,3 @@ -use std::path::PathBuf; use std::collections::HashMap; use std::sync::Arc; use indexmap::IndexMap; @@ -102,50 +101,19 @@ pub trait Tool: Send + Sync { } } -pub async fn read_integrations_yaml(config_dir: &PathBuf) -> Result { - let yaml_path = config_dir.join("integrations.yaml"); - - let file = std::fs::File::open(&yaml_path).map_err( - |e| format!("Failed to open {}: {}", yaml_path.display(), e) - )?; - - let reader = std::io::BufReader::new(file); - serde_yaml::from_reader(reader).map_err( - |e| { - let location = e.location().map(|loc| format!(" at line {}, column {}", loc.line(), loc.column())).unwrap_or_default(); - format!("Failed to parse {}{}: {}", yaml_path.display(), location, e) - } - ) -} - pub async fn tools_merged_and_filtered( gcx: Arc>, _supports_clicks: bool, // XXX ) -> Result>>>, String> { - let (ast_on, vecdb_on, allow_experimental, config_dir) = { + let (ast_on, vecdb_on, allow_experimental) = { let gcx_locked = gcx.read().await; #[cfg(feature="vecdb")] let vecdb_on = gcx_locked.vec_db.lock().await.is_some(); #[cfg(not(feature="vecdb"))] let vecdb_on = false; - (gcx_locked.ast_service.is_some(), vecdb_on, gcx_locked.cmdline.experimental, gcx_locked.config_dir.clone()) - }; - - let integrations_value = match read_integrations_yaml(&config_dir).await { - Ok(value) => value, - Err(e) => return Err(format!("Problem in integrations.yaml: {}", e)), + (gcx_locked.ast_service.is_some(), vecdb_on, gcx_locked.cmdline.experimental) }; - if let Some(env_vars) = integrations_value.get("environment_variables") { - if let Some(env_vars_map) = env_vars.as_mapping() { - for (key, value) in env_vars_map { - if let (Some(key_str), Some(value_str)) = (key.as_str(), value.as_str()) { - std::env::set_var(key_str, value_str); - } - } - } - } - let mut tools_all = IndexMap::from([ ("definition".to_string(), Arc::new(AMutex::new(Box::new(crate::tools::tool_ast_definition::ToolAstDefinition{}) as Box))), ("references".to_string(), Arc::new(AMutex::new(Box::new(crate::tools::tool_ast_reference::ToolAstReference{}) as Box))), @@ -164,47 +132,6 @@ pub async fn tools_merged_and_filtered( #[cfg(feature="vecdb")] tools_all.insert("knowledge".to_string(), Arc::new(AMutex::new(Box::new(crate::tools::tool_knowledge::ToolGetKnowledge{}) as Box))); - if allow_experimental { - // The approach here: if it exists, it shouldn't have syntax errors, note the "?" - // if let Some(gh_config) = integrations_value.get("github") { - // tools_all.insert("github".to_string(), Arc::new(AMutex::new(Box::new(ToolGithub::new_from_yaml(gh_config)?) as Box))); - // } - // if let Some(gl_config) = integrations_value.get("gitlab") { - // tools_all.insert("gitlab".to_string(), Arc::new(AMutex::new(Box::new(ToolGitlab::new_from_yaml(gl_config)?) as Box))); - // } - // if let Some(pdb_config) = integrations_value.get("pdb") { - // tools_all.insert("pdb".to_string(), Arc::new(AMutex::new(Box::new(ToolPdb::new_from_yaml(pdb_config)?) as Box))); - // } - // if let Some(chrome_config) = integrations_value.get("chrome") { - // tools_all.insert("chrome".to_string(), Arc::new(AMutex::new(Box::new(ToolChrome::new_from_yaml(chrome_config, supports_clicks)?) as Box))); - // } - // if let Some(postgres_config) = integrations_value.get("postgres") { - // tools_all.insert("postgres".to_string(), Arc::new(AMutex::new(Box::new(ToolPostgres::new_from_yaml(postgres_config)?) as Box))); - // } - // if let Some(docker_config) = integrations_value.get("docker") { - // tools_all.insert("docker".to_string(), Arc::new(AMutex::new(Box::new(ToolDocker::new_from_yaml(docker_config)?) as Box))); - // } - // if let Ok(caps) = crate::global_context::try_load_caps_quickly_if_not_present(gcx.clone(), 0).await { - // let have_thinking_model = { - // let caps_locked = caps.read().unwrap(); - // caps_locked.running_models.contains(&"o1-mini".to_string()) - // }; - // if have_thinking_model { - // tools_all.insert("deep_thinking".to_string(), Arc::new(AMutex::new(Box::new(crate::tools::tool_deep_thinking::ToolDeepThinking{}) as Box))); - // } - // } - } - - // if let Some(cmdline) = integrations_value.get("cmdline") { - // let cmdline_tools = crate::tools::tool_cmdline::cmdline_tool_from_yaml_value(cmdline, false)?; - // tools_all.extend(cmdline_tools); - // } - - // if let Some(cmdline) = integrations_value.get("cmdline_services") { - // let cmdline_tools = crate::tools::tool_cmdline::cmdline_tool_from_yaml_value(cmdline, true)?; - // tools_all.extend(cmdline_tools); - // } - let integrations = crate::integrations::running_integrations::load_integration_tools( gcx.clone(), "".to_string(),