use std::sync::Arc; use crate::agents_md::LoadedAgentsMd; use crate::config::TokenBudgetConfig; use crate::environment_selection::TurnEnvironmentSnapshot; use crate::session::step_settings::ResolvedStepSettings; use crate::session::turn_context::TurnContext; use crate::tools::router::ToolRouter; use codex_exec_server::ExecutorCapabilityDiscoverySnapshot; use codex_exec_server::ResolvedSelectedCapabilityRoot; use codex_mcp::McpBinding; use codex_otel::SessionTelemetry; /// Request-scoped state that may change between model sampling requests. pub(crate) struct StepContext { pub(crate) turn: Arc, /// One immutable settings version captured before request preparation. pub(crate) settings: Arc, /// Frozen turn preferences resolved against this step's captured model. pub(crate) token_budget: Option, /// Telemetry context tagged with this sampling request's model. pub(crate) session_telemetry: SessionTelemetry, pub(crate) environments: TurnEnvironmentSnapshot, /// Capability roots bound to ready environments in this exact step. pub(crate) selected_capability_roots: Vec, /// Executor-materialized capability files shared by MCP and skills in this exact step. pub(crate) executor_capability_discovery: Option>, /// The exact MCP connections, configuration, and catalog captured for this step. pub(crate) mcp: Arc, /// The finalized tool plan advertised and executed for this exact sampling request. pub(crate) tool_router: Arc, /// The canonical AGENTS.md value observed with this environment snapshot. pub(crate) loaded_agents_md: Option>, }