MCPcopy Create free account
hub / github.com/AI45Lab/Code / prepare_session_options

Function prepare_session_options

core/src/agent_api/session_builder.rs:23–36  ·  view source on GitHub ↗
(agent: &Agent, opts: SessionOptions)

Source from the content-addressed store, hash-verified

21use super::session_runtime::{build_session_runtime, SessionRuntimeInput};
22
23pub(super) fn prepare_session_options(agent: &Agent, opts: SessionOptions) -> SessionOptions {
24 let mut opts = merge_mcp_managers(agent, opts);
25 if opts.session_id.is_none() {
26 // Use the host-provided ID generator if one was supplied via
27 // SessionOptions — this is the entry point that enables
28 // deterministic-replay tooling to pin session ids.
29 let env = opts
30 .host_env
31 .clone()
32 .unwrap_or_else(|| Arc::clone(&agent.config.host_env));
33 opts.session_id = Some(env.next_id());
34 }
35 opts
36}
37
38fn merge_mcp_managers(agent: &Agent, opts: SessionOptions) -> SessionOptions {
39 match (&agent.global_mcp, &opts.mcp_manager) {

Callers 2

create_sessionFunction · 0.85
resume_sessionFunction · 0.85

Calls 3

merge_mcp_managersFunction · 0.85
cloneMethod · 0.45
next_idMethod · 0.45

Tested by

no test coverage detected