mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
remove dead working_dir threading
This commit is contained in:
@@ -387,7 +387,6 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> CliSession {
|
||||
session_id: Some(session_id.clone()),
|
||||
extension_manager: Some(Arc::downgrade(&agent.extension_manager)),
|
||||
tool_route_manager: Some(Arc::downgrade(&agent.tool_route_manager)),
|
||||
working_dir: None,
|
||||
sub_recipes: Some(agent.sub_recipes()),
|
||||
})
|
||||
.await;
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::agents::subagent_client;
|
||||
use crate::agents::todo_extension;
|
||||
use crate::recipe::SubRecipe;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
@@ -126,7 +125,6 @@ pub struct PlatformExtensionContext {
|
||||
Option<std::sync::Weak<crate::agents::extension_manager::ExtensionManager>>,
|
||||
pub tool_route_manager:
|
||||
Option<std::sync::Weak<crate::agents::tool_route_manager::ToolRouteManager>>,
|
||||
pub working_dir: Option<PathBuf>,
|
||||
pub sub_recipes: Option<Arc<RwLock<HashMap<String, SubRecipe>>>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,6 @@ impl ExtensionManager {
|
||||
session_id: None,
|
||||
extension_manager: None,
|
||||
tool_route_manager: None,
|
||||
working_dir: None,
|
||||
sub_recipes: None,
|
||||
}),
|
||||
provider,
|
||||
|
||||
@@ -14,7 +14,6 @@ use rmcp::model::{
|
||||
ServerCapabilities, ServerNotification, Tool, ToolsCapability,
|
||||
};
|
||||
use serde_json::Value;
|
||||
use std::path::PathBuf;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
@@ -81,13 +80,6 @@ impl SubagentClient {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_working_dir(&self) -> PathBuf {
|
||||
self.context
|
||||
.working_dir
|
||||
.clone()
|
||||
.unwrap_or_else(|| std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")))
|
||||
}
|
||||
|
||||
async fn build_tool(&self) -> Tool {
|
||||
let sub_recipes = self.get_sub_recipes().await;
|
||||
let sub_recipes_vec: Vec<_> = sub_recipes.values().cloned().collect();
|
||||
@@ -159,13 +151,13 @@ impl McpClientTrait for SubagentClient {
|
||||
]))));
|
||||
};
|
||||
|
||||
// Get working_dir from parent session if available
|
||||
// Get working_dir from parent session, fall back to current dir
|
||||
let working_dir = match &self.context.session_id {
|
||||
Some(session_id) => crate::session::SessionManager::get_session(session_id, false)
|
||||
.await
|
||||
.map(|s| s.working_dir)
|
||||
.unwrap_or_else(|_| self.get_working_dir()),
|
||||
None => self.get_working_dir(),
|
||||
.unwrap_or_else(|_| std::env::current_dir().unwrap_or_else(|_| ".".into())),
|
||||
None => std::env::current_dir().unwrap_or_else(|_| ".".into()),
|
||||
};
|
||||
|
||||
let extensions = self.get_extensions().await;
|
||||
|
||||
@@ -88,7 +88,6 @@ impl AgentManager {
|
||||
session_id: Some(session_id.clone()),
|
||||
extension_manager: Some(Arc::downgrade(&agent.extension_manager)),
|
||||
tool_route_manager: Some(Arc::downgrade(&agent.tool_route_manager)),
|
||||
working_dir: None,
|
||||
sub_recipes: Some(agent.sub_recipes()),
|
||||
})
|
||||
.await;
|
||||
|
||||
@@ -474,7 +474,6 @@ mod tests {
|
||||
session_id: Some("test_session".to_string()),
|
||||
extension_manager: Some(Arc::downgrade(&agent.extension_manager)),
|
||||
tool_route_manager: Some(Arc::downgrade(&agent.tool_route_manager)),
|
||||
working_dir: None,
|
||||
sub_recipes: Some(agent.sub_recipes()),
|
||||
})
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user