mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
## Summary - split `models-manager` out of `core` and add `ModelsManagerConfig` plus `Config::to_models_manager_config()` so model metadata paths stop depending on `core::Config` - move login-owned/auth-owned code out of `core` into `codex-login`, move model provider config into `codex-model-provider-info`, move API bridge mapping into `codex-api`, move protocol-owned types/impls into `codex-protocol`, and move response debug helpers into a dedicated `response-debug-context` crate - move feedback tag emission into `codex-feedback`, relocate tests to the crates that now own the code, and keep broad temporary re-exports so this PR avoids a giant import-only rewrite ## Major moves and decisions - created `codex-models-manager` as the owner for model cache/catalog/config/model info logic, including the new `ModelsManagerConfig` struct - created `codex-model-provider-info` as the owner for provider config parsing/defaults and kept temporary `codex-login`/`codex-core` re-exports for old import paths - moved `api_bridge` error mapping + `CoreAuthProvider` into `codex-api`, while `codex-login::api_bridge` temporarily re-exports those symbols and keeps the `auth_provider_from_auth` wrapper - moved `auth_env_telemetry` and `provider_auth` ownership to `codex-login` - moved `CodexErr` ownership to `codex-protocol::error`, plus `StreamOutput`, `bytes_to_string_smart`, and network policy helpers to protocol-owned modules - created `codex-response-debug-context` for `extract_response_debug_context`, `telemetry_transport_error_message`, and related response-debug plumbing instead of leaving that behavior in `core` - moved `FeedbackRequestTags`, `emit_feedback_request_tags`, and `emit_feedback_request_tags_with_auth_env` to `codex-feedback` - deferred removal of temporary re-exports and the mechanical import rewrites to a stacked follow-up PR so this PR stays reviewable ## Test moves - moved auth refresh coverage from `core/tests/suite/auth_refresh.rs` to `login/tests/suite/auth_refresh.rs` - moved text encoding coverage from `core/tests/suite/text_encoding_fix.rs` to `protocol/src/exec_output_tests.rs` - moved model info override coverage from `core/tests/suite/model_info_overrides.rs` to `models-manager/src/model_info_overrides_tests.rs` --------- Co-authored-by: Codex <noreply@openai.com>
197 lines
6.3 KiB
Rust
197 lines
6.3 KiB
Rust
//! Root of the `codex-core` library.
|
|
|
|
// Prevent accidental direct writes to stdout/stderr in library code. All
|
|
// user-visible output must go through the appropriate abstraction (e.g.,
|
|
// the TUI or the tracing stack).
|
|
#![deny(clippy::print_stdout, clippy::print_stderr)]
|
|
|
|
pub use codex_login::api_bridge;
|
|
mod apply_patch;
|
|
mod apps;
|
|
mod arc_monitor;
|
|
pub use codex_login as auth;
|
|
pub use codex_login::auth_env_telemetry;
|
|
pub use codex_login::default_client;
|
|
mod client;
|
|
mod client_common;
|
|
pub mod codex;
|
|
mod realtime_context;
|
|
mod realtime_conversation;
|
|
pub use codex::SteerInputError;
|
|
mod codex_thread;
|
|
mod compact_remote;
|
|
pub use codex_thread::CodexThread;
|
|
pub use codex_thread::ThreadConfigSnapshot;
|
|
mod agent;
|
|
mod codex_delegate;
|
|
mod command_canonicalization;
|
|
mod commit_attribution;
|
|
pub mod config;
|
|
pub mod config_loader;
|
|
pub mod connectors;
|
|
mod context_manager;
|
|
mod contextual_user_message;
|
|
mod environment_context;
|
|
pub use codex_protocol::error;
|
|
pub mod exec;
|
|
pub mod exec_env;
|
|
mod exec_policy;
|
|
pub mod external_agent_config;
|
|
pub mod file_watcher;
|
|
mod flags;
|
|
#[cfg(test)]
|
|
mod git_info_tests;
|
|
mod guardian;
|
|
mod hook_runtime;
|
|
pub mod instructions;
|
|
pub mod landlock;
|
|
pub mod mcp;
|
|
mod mcp_skill_dependencies;
|
|
mod mcp_tool_approval_templates;
|
|
pub use codex_models_manager as models_manager;
|
|
mod network_policy_decision;
|
|
pub mod network_proxy_loader;
|
|
mod original_image_detail;
|
|
pub use codex_mcp::mcp_connection_manager;
|
|
pub use codex_mcp::mcp_connection_manager::MCP_SANDBOX_STATE_CAPABILITY;
|
|
pub use codex_mcp::mcp_connection_manager::MCP_SANDBOX_STATE_METHOD;
|
|
pub use codex_mcp::mcp_connection_manager::SandboxState;
|
|
mod mcp_tool_call;
|
|
mod memories;
|
|
pub mod mention_syntax;
|
|
pub mod message_history;
|
|
pub use codex_login::model_provider_info;
|
|
pub use codex_login::provider_auth;
|
|
pub mod utils;
|
|
pub use utils::path_utils;
|
|
pub mod personality_migration;
|
|
pub mod plugins;
|
|
pub(crate) mod mentions {
|
|
pub(crate) use crate::plugins::build_connector_slug_counts;
|
|
pub(crate) use crate::plugins::build_skill_name_counts;
|
|
pub(crate) use crate::plugins::collect_explicit_app_ids;
|
|
pub(crate) use crate::plugins::collect_explicit_plugin_mentions;
|
|
pub(crate) use crate::plugins::collect_tool_mentions_from_messages;
|
|
}
|
|
mod sandbox_tags;
|
|
pub mod sandboxing;
|
|
mod session_prefix;
|
|
mod session_startup_prewarm;
|
|
mod shell_detect;
|
|
pub mod skills;
|
|
pub(crate) use skills::SkillError;
|
|
pub(crate) use skills::SkillInjections;
|
|
pub(crate) use skills::SkillLoadOutcome;
|
|
pub(crate) use skills::SkillMetadata;
|
|
pub(crate) use skills::SkillsLoadInput;
|
|
pub(crate) use skills::SkillsManager;
|
|
pub(crate) use skills::build_skill_injections;
|
|
pub(crate) use skills::build_skill_name_counts;
|
|
pub(crate) use skills::collect_env_var_dependencies;
|
|
pub(crate) use skills::collect_explicit_skill_mentions;
|
|
pub(crate) use skills::config_rules;
|
|
pub(crate) use skills::injection;
|
|
pub(crate) use skills::loader;
|
|
pub(crate) use skills::manager;
|
|
pub(crate) use skills::maybe_emit_implicit_skill_invocation;
|
|
pub(crate) use skills::render_skills_section;
|
|
pub(crate) use skills::resolve_skill_dependencies_for_turn;
|
|
pub(crate) use skills::skills_load_input_from_config;
|
|
mod skills_watcher;
|
|
mod stream_events_utils;
|
|
pub mod test_support;
|
|
mod text_encoding {
|
|
pub use codex_protocol::exec_output::bytes_to_string_smart;
|
|
}
|
|
mod unified_exec;
|
|
pub mod windows_sandbox;
|
|
pub use client::X_RESPONSESAPI_INCLUDE_TIMING_METRICS_HEADER;
|
|
pub use codex_login::DEFAULT_LMSTUDIO_PORT;
|
|
pub use codex_login::DEFAULT_OLLAMA_PORT;
|
|
pub use codex_login::LMSTUDIO_OSS_PROVIDER_ID;
|
|
pub use codex_login::ModelProviderInfo;
|
|
pub use codex_login::OLLAMA_OSS_PROVIDER_ID;
|
|
pub use codex_login::OPENAI_PROVIDER_ID;
|
|
pub use codex_login::WireApi;
|
|
pub use codex_login::built_in_model_providers;
|
|
pub use codex_login::create_oss_provider_with_base_url;
|
|
pub use codex_protocol::config_types::ModelProviderAuthInfo;
|
|
pub use text_encoding::bytes_to_string_smart;
|
|
mod event_mapping;
|
|
pub use codex_response_debug_context as response_debug_context;
|
|
pub mod review_format;
|
|
pub mod review_prompts;
|
|
mod thread_manager;
|
|
pub mod web_search;
|
|
pub mod windows_sandbox_read_grants;
|
|
pub use thread_manager::ForkSnapshot;
|
|
pub use thread_manager::NewThread;
|
|
pub use thread_manager::ThreadManager;
|
|
#[deprecated(note = "use ThreadManager")]
|
|
pub type ConversationManager = ThreadManager;
|
|
#[deprecated(note = "use NewThread")]
|
|
pub type NewConversation = NewThread;
|
|
#[deprecated(note = "use CodexThread")]
|
|
pub type CodexConversation = CodexThread;
|
|
pub mod project_doc;
|
|
mod rollout;
|
|
pub(crate) mod safety;
|
|
pub mod seatbelt;
|
|
mod session_rollout_init_error;
|
|
pub mod shell;
|
|
pub mod shell_snapshot;
|
|
pub mod spawn;
|
|
pub mod state_db_bridge;
|
|
mod thread_rollout_truncation;
|
|
mod tools;
|
|
pub mod turn_diff_tracker;
|
|
mod turn_metadata;
|
|
mod turn_timing;
|
|
pub use rollout::ARCHIVED_SESSIONS_SUBDIR;
|
|
pub use rollout::INTERACTIVE_SESSION_SOURCES;
|
|
pub use rollout::RolloutRecorder;
|
|
pub use rollout::RolloutRecorderParams;
|
|
pub use rollout::SESSIONS_SUBDIR;
|
|
pub use rollout::SessionMeta;
|
|
pub use rollout::append_thread_name;
|
|
pub use rollout::find_archived_thread_path_by_id_str;
|
|
#[deprecated(note = "use find_thread_path_by_id_str")]
|
|
pub use rollout::find_conversation_path_by_id_str;
|
|
pub use rollout::find_thread_name_by_id;
|
|
pub use rollout::find_thread_path_by_id_str;
|
|
pub use rollout::find_thread_path_by_name_str;
|
|
pub use rollout::list::Cursor;
|
|
pub use rollout::list::ThreadItem;
|
|
pub use rollout::list::ThreadSortKey;
|
|
pub use rollout::list::ThreadsPage;
|
|
pub use rollout::list::parse_cursor;
|
|
pub use rollout::list::read_head_for_summary;
|
|
pub use rollout::list::read_session_meta_line;
|
|
pub use rollout::policy::EventPersistenceMode;
|
|
pub use rollout::rollout_date_parts;
|
|
pub use rollout::session_index::find_thread_names_by_ids;
|
|
mod function_tool;
|
|
mod state;
|
|
mod tasks;
|
|
mod user_shell_command;
|
|
pub mod util;
|
|
|
|
pub use client::ModelClient;
|
|
pub use client::ModelClientSession;
|
|
pub use client::X_CODEX_TURN_METADATA_HEADER;
|
|
pub use client_common::Prompt;
|
|
pub use client_common::REVIEW_PROMPT;
|
|
pub use client_common::ResponseEvent;
|
|
pub use client_common::ResponseStream;
|
|
pub use compact::content_items_to_text;
|
|
pub use event_mapping::parse_turn_item;
|
|
pub use exec_policy::ExecPolicyError;
|
|
pub use exec_policy::check_execpolicy_for_warnings;
|
|
pub use exec_policy::format_exec_policy_error_with_source;
|
|
pub use exec_policy::load_exec_policy;
|
|
pub use file_watcher::FileWatcherEvent;
|
|
pub use turn_metadata::build_turn_metadata_header;
|
|
pub mod compact;
|
|
pub mod memory_trace;
|
|
pub mod otel_init;
|