(
agent: &Agent,
workspace: impl Into<String>,
options: Option<SessionOptions>,
)
| 25 | } |
| 26 | |
| 27 | pub(super) fn create_session( |
| 28 | agent: &Agent, |
| 29 | workspace: impl Into<String>, |
| 30 | options: Option<SessionOptions>, |
| 31 | ) -> Result<AgentSession> { |
| 32 | bail_if_agent_closed(agent)?; |
| 33 | |
| 34 | let merged_opts = session_builder::prepare_session_options(agent, options.unwrap_or_default()); |
| 35 | let session_id = merged_opts |
| 36 | .session_id |
| 37 | .as_deref() |
| 38 | .expect("prepare_session_options assigns session_id"); |
| 39 | let llm_client = session_config::resolve_session_llm_client( |
| 40 | &agent.code_config, |
| 41 | &merged_opts, |
| 42 | Some(session_id), |
| 43 | )?; |
| 44 | |
| 45 | session_builder::build_agent_session(agent, workspace.into(), llm_client, &merged_opts) |
| 46 | } |
| 47 | |
| 48 | /// Register a freshly built session's close handle into the parent agent's |
| 49 | /// registry. Called by `session_builder::build_agent_session` immediately |
no test coverage detected