refactor: move disable_session_naming into AgentConfig (#7062)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -94,6 +94,7 @@ pub struct AgentConfig {
|
||||
pub permission_manager: Arc<PermissionManager>,
|
||||
pub scheduler_service: Option<Arc<dyn SchedulerTrait>>,
|
||||
pub goose_mode: GooseMode,
|
||||
pub disable_session_naming: bool,
|
||||
}
|
||||
|
||||
impl AgentConfig {
|
||||
@@ -102,12 +103,14 @@ impl AgentConfig {
|
||||
permission_manager: Arc<PermissionManager>,
|
||||
scheduler_service: Option<Arc<dyn SchedulerTrait>>,
|
||||
goose_mode: GooseMode,
|
||||
disable_session_naming: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
session_manager,
|
||||
permission_manager,
|
||||
scheduler_service,
|
||||
goose_mode,
|
||||
disable_session_naming,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,6 +192,9 @@ impl Agent {
|
||||
PermissionManager::instance(),
|
||||
None,
|
||||
Config::global().get_goose_mode().unwrap_or(GooseMode::Auto),
|
||||
Config::global()
|
||||
.get_goose_disable_session_naming()
|
||||
.unwrap_or(false),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -1112,10 +1118,7 @@ impl Agent {
|
||||
let provider = self.provider().await?;
|
||||
let session_manager = self.config.session_manager.clone();
|
||||
let session_id = session_config.id.clone();
|
||||
let naming_disabled = Config::global()
|
||||
.get_goose_disable_session_naming()
|
||||
.unwrap_or(false);
|
||||
if !naming_disabled {
|
||||
if !self.config.disable_session_naming {
|
||||
let manager_for_spawn = session_manager.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = manager_for_spawn
|
||||
|
||||
@@ -89,6 +89,9 @@ impl AgentManager {
|
||||
permission_manager,
|
||||
Some(Arc::clone(&self.scheduler)),
|
||||
mode,
|
||||
Config::global()
|
||||
.get_goose_disable_session_naming()
|
||||
.unwrap_or(false),
|
||||
);
|
||||
let agent = Arc::new(Agent::with_config(config));
|
||||
if let Some(provider) = &*self.default_provider.read().await {
|
||||
|
||||
@@ -128,6 +128,7 @@ mod tests {
|
||||
permission_manager,
|
||||
Some(mock_scheduler),
|
||||
GooseMode::Auto,
|
||||
false,
|
||||
);
|
||||
let agent = Agent::with_config(config);
|
||||
|
||||
@@ -168,6 +169,7 @@ mod tests {
|
||||
permission_manager,
|
||||
Some(mock_scheduler),
|
||||
GooseMode::Auto,
|
||||
false,
|
||||
);
|
||||
let agent = Agent::with_config(config);
|
||||
|
||||
@@ -221,6 +223,7 @@ mod tests {
|
||||
permission_manager,
|
||||
Some(mock_scheduler),
|
||||
GooseMode::Auto,
|
||||
false,
|
||||
);
|
||||
let agent = Agent::with_config(config);
|
||||
|
||||
@@ -541,6 +544,7 @@ mod tests {
|
||||
PermissionManager::instance(),
|
||||
None,
|
||||
GooseMode::Auto,
|
||||
false,
|
||||
);
|
||||
|
||||
let agent = Agent::with_config(config);
|
||||
|
||||
Reference in New Issue
Block a user