@@ -12,6 +12,7 @@ use crate::skills::SkillRegistry;
1212use crate :: store:: { FileSessionStore , LlmConfigData , SessionData , SessionStore } ;
1313use crate :: text:: truncate_utf8;
1414use crate :: tools:: ToolExecutor ;
15+ use crate :: PlanningMode ;
1516use a3s_memory:: MemoryStore ;
1617use anyhow:: { Context , Result } ;
1718use 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