core: remove cross-crate re-exports from lib.rs (#16512)

## Why

`codex-core` was re-exporting APIs owned by sibling `codex-*` crates,
which made downstream crates depend on `codex-core` as a proxy module
instead of the actual owner crate.

Removing those forwards makes crate boundaries explicit and lets leaf
crates drop unnecessary `codex-core` dependencies. In this PR, this
reduces the dependency on `codex-core` to `codex-login` in the following
files:

```
codex-rs/backend-client/Cargo.toml
codex-rs/mcp-server/tests/common/Cargo.toml
```

## What

- Remove `codex-rs/core/src/lib.rs` re-exports for symbols owned by
`codex-login`, `codex-mcp`, `codex-rollout`, `codex-analytics`,
`codex-protocol`, `codex-shell-command`, `codex-sandboxing`,
`codex-tools`, and `codex-utils-path`.
- Delete the `default_client` forwarding shim in `codex-rs/core`.
- Update in-crate and downstream callsites to import directly from the
owning `codex-*` crate.
- Add direct Cargo dependencies where callsites now target the owner
crate, and remove `codex-core` from `codex-rs/backend-client`.
This commit is contained in:
Michael Bolin
2026-04-01 23:06:24 -07:00
committed by GitHub
parent 9f71d57a65
commit aa2403e2eb
170 changed files with 495 additions and 512 deletions

View File

@@ -1,6 +1,5 @@
use std::sync::Arc;
use crate::AuthManager;
use crate::RolloutRecorder;
use crate::SkillsManager;
use crate::agent::AgentControl;
@@ -8,11 +7,9 @@ use crate::client::ModelClient;
use crate::config::StartedNetworkProxy;
use crate::exec_policy::ExecPolicyManager;
use crate::mcp::McpManager;
use crate::mcp_connection_manager::McpConnectionManager;
use crate::models_manager::manager::ModelsManager;
use crate::plugins::PluginsManager;
use crate::skills_watcher::SkillsWatcher;
use crate::state_db::StateDbHandle;
use crate::tools::code_mode::CodeModeService;
use crate::tools::network_approval::NetworkApprovalService;
use crate::tools::sandboxing::ApprovalStore;
@@ -20,7 +17,10 @@ use crate::unified_exec::UnifiedExecProcessManager;
use codex_analytics::AnalyticsEventsClient;
use codex_exec_server::Environment;
use codex_hooks::Hooks;
use codex_login::AuthManager;
use codex_mcp::mcp_connection_manager::McpConnectionManager;
use codex_otel::SessionTelemetry;
use codex_rollout::state_db::StateDbHandle;
use std::path::PathBuf;
use tokio::sync::Mutex;
use tokio::sync::RwLock;

View File

@@ -9,10 +9,10 @@ use std::collections::HashSet;
use crate::codex::PreviousTurnSettings;
use crate::codex::SessionConfiguration;
use crate::context_manager::ContextManager;
use crate::protocol::RateLimitSnapshot;
use crate::protocol::TokenUsage;
use crate::protocol::TokenUsageInfo;
use crate::session_startup_prewarm::SessionStartupPrewarmHandle;
use codex_protocol::protocol::RateLimitSnapshot;
use codex_protocol::protocol::TokenUsage;
use codex_protocol::protocol::TokenUsageInfo;
use codex_protocol::protocol::TurnContextItem;
use codex_utils_output_truncation::TruncationPolicy;

View File

@@ -1,6 +1,7 @@
use super::*;
use crate::codex::make_session_configuration_for_tests;
use crate::protocol::RateLimitWindow;
use codex_protocol::protocol::CreditsSnapshot;
use codex_protocol::protocol::RateLimitWindow;
use pretty_assertions::assert_eq;
#[tokio::test]
@@ -112,7 +113,7 @@ async fn set_rate_limits_carries_credits_and_plan_type_from_codex_to_codex_other
resets_at: Some(100),
}),
secondary: None,
credits: Some(crate::protocol::CreditsSnapshot {
credits: Some(CreditsSnapshot {
has_credits: true,
unlimited: false,
balance: Some("50".to_string()),
@@ -144,7 +145,7 @@ async fn set_rate_limits_carries_credits_and_plan_type_from_codex_to_codex_other
resets_at: Some(200),
}),
secondary: None,
credits: Some(crate::protocol::CreditsSnapshot {
credits: Some(CreditsSnapshot {
has_credits: true,
unlimited: false,
balance: Some("50".to_string()),

View File

@@ -18,10 +18,10 @@ use rmcp::model::RequestId;
use tokio::sync::oneshot;
use crate::codex::TurnContext;
use crate::protocol::ReviewDecision;
use crate::protocol::TokenUsage;
use crate::tasks::SessionTask;
use codex_protocol::models::PermissionProfile;
use codex_protocol::protocol::ReviewDecision;
use codex_protocol::protocol::TokenUsage;
/// Metadata about the currently running turn.
pub(crate) struct ActiveTurn {