Skip to content

Commit 3a78a37

Browse files
committed
feat(code): add set_planning_mode to SessionManager
1 parent f48513b commit 3a78a37

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

core/src/session/manager.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::skills::SkillRegistry;
1212
use crate::store::{FileSessionStore, LlmConfigData, SessionData, SessionStore};
1313
use crate::text::truncate_utf8;
1414
use crate::tools::ToolExecutor;
15+
use crate::PlanningMode;
1516
use a3s_memory::MemoryStore;
1617
use anyhow::{Context, Result};
1718
use std::collections::HashMap;
@@ -1570,4 +1571,26 @@ impl SessionManager {
15701571
let session = session_lock.read().await;
15711572
Ok(session.confirmation_policy().await)
15721573
}
1574+
1575+
/// Set planning mode for a session.
1576+
///
1577+
/// When set to `Enabled`, the next generation will use the planning phase.
1578+
/// When set to `Disabled`, planning is skipped.
1579+
/// When set to `Auto` (default), planning is determined by intent detection.
1580+
pub async fn set_planning_mode(
1581+
&self,
1582+
session_id: &str,
1583+
mode: PlanningMode,
1584+
) -> Result<PlanningMode> {
1585+
{
1586+
let session_lock = self.get_session(session_id).await?;
1587+
let mut session = session_lock.write().await;
1588+
session.config.planning_mode = mode;
1589+
}
1590+
1591+
// Persist to store
1592+
self.persist_in_background(session_id, "set_planning_mode");
1593+
1594+
Ok(mode)
1595+
}
15731596
}

0 commit comments

Comments
 (0)