use std::sync::Arc; use crate::ExtensionData; use crate::ExtensionMetrics; use codex_mcp::McpResourceClient; use codex_protocol::protocol::SessionSource; use codex_protocol::protocol::TurnEnvironmentSelection; /// Trusted, host-resolved billing attribution for a thread. /// /// Extensions may forward this value to first-party APIs. It is seeded by Core /// after resolving persisted and host-provided originator state, rather than /// from model- or tool-controlled input. #[derive(Clone, Debug, Eq, PartialEq)] pub struct ThreadOriginator(pub String); /// Input supplied when the host starts a runtime for a thread. pub struct ThreadStartInput<'a, C> { /// Host configuration visible at thread start. pub config: &'a C, /// Source that created the session for this thread. pub session_source: &'a SessionSource, /// Whether persistent thread-scoped state is available for this thread. pub persistent_thread_state_available: bool, /// Execution environments selected for this thread. pub environments: &'a [TurnEnvironmentSelection], /// MCP resource access supplied by the host for this session. pub mcp_resource_client: Option>, /// Session-attributed metrics supplied by the host. pub extension_metrics: Option>, /// Store scoped to the host session runtime. pub session_store: &'a ExtensionData, /// Store scoped to this thread runtime. pub thread_store: &'a ExtensionData, } /// Input supplied when the host resumes an existing thread. pub struct ThreadResumeInput<'a> { /// Store scoped to the host session runtime. pub session_store: &'a ExtensionData, /// Store scoped to this thread runtime. pub thread_store: &'a ExtensionData, } /// Why a thread has no immediately pending work. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum ThreadIdleCause { /// The previous turn completed and automatic follow-up work can run. Completed, /// The user interrupted the previous turn. Interrupted, /// The previous turn ended with a terminal error. Failed, } /// Input supplied when the host has no immediately pending thread work. pub struct ThreadIdleInput<'a> { /// Why the thread became idle. pub cause: ThreadIdleCause, /// Store scoped to the host session runtime. pub session_store: &'a ExtensionData, /// Store scoped to this thread runtime. pub thread_store: &'a ExtensionData, } /// Input supplied when the host stops a thread runtime. pub struct ThreadStopInput<'a> { /// Store scoped to the host session runtime. pub session_store: &'a ExtensionData, /// Store scoped to this thread runtime. pub thread_store: &'a ExtensionData, }