mirror of
https://github.com/openai/codex.git
synced 2026-05-16 17:23:57 +00:00
## Why We want the agent graph store to be passed down the stack as a real dependency, the same way we already treat the thread store. This will let us inject the agent graph store as a real dependency and support implementations other than the local SQLite-backed one. Right now most code instantiates a state DB and an agent graph store just-in-time. Ideally, we would not depend on the state DB directly but only read through the higher-level interfaces. This change makes the dependency boundaries explicit and moves state DB initialization to process bootstrap instead of hiding it inside local store implementations. ## What changed - `ThreadManager` now requires a `StateDbHandle` and an `AgentGraphStore` at construction time instead of treating them as optional internals. - The local store constructors no longer lazily initialize SQLite. Callers now initialize the state DB once per process and use that shared handle to build: - `LocalThreadStore` - `LocalAgentGraphStore` - App bootstraps (`app-server`, `mcp-server`, `prompt_debug`, and the thread-manager sample) now initialize the state DB up front and inject the resulting handle down the stack. - `app-server` now consistently uses its process-scoped state DB handle instead of reopening SQLite or trying to recover it from loaded threads. - Device-key storage now reuses the shared state DB handle instead of maintaining its own lazy opener. - The thread archive / descendant traversal paths now use the injected `AgentGraphStore` instead of reaching through local thread-store-specific state. ## Verification - `cargo check -p codex-core -p codex-thread-store -p codex-app-server -p codex-mcp-server -p codex-thread-manager-sample --tests` - `cargo test -p codex-thread-store` - `cargo test -p codex-core thread_manager_accepts_separate_agent_graph_store_and_thread_store -- --nocapture` - `cargo test -p codex-app-server thread_archive_archives_spawned_descendants -- --nocapture`
79 lines
3.6 KiB
Rust
79 lines
3.6 KiB
Rust
//! Public facade for thread management APIs built on `codex-core`.
|
|
|
|
#![deny(private_bounds, private_interfaces, unreachable_pub)]
|
|
|
|
pub use codex_analytics::AnalyticsEventsClient;
|
|
pub use codex_app_server_protocol::ServerNotification;
|
|
pub use codex_app_server_protocol::item_event_to_server_notification;
|
|
pub use codex_arg0::Arg0DispatchPaths;
|
|
pub use codex_arg0::arg0_dispatch_or_else;
|
|
pub use codex_config::ConfigLayerStack;
|
|
pub use codex_config::config_toml::ProjectConfig;
|
|
pub use codex_config::config_toml::RealtimeAudioConfig;
|
|
pub use codex_config::config_toml::RealtimeConfig;
|
|
pub use codex_config::types::AuthCredentialsStoreMode;
|
|
pub use codex_config::types::History;
|
|
pub use codex_config::types::MemoriesConfig;
|
|
pub use codex_config::types::ModelAvailabilityNuxConfig;
|
|
pub use codex_config::types::Notice;
|
|
pub use codex_config::types::OAuthCredentialsStoreMode;
|
|
pub use codex_config::types::OtelConfig;
|
|
pub use codex_config::types::SessionPickerViewMode;
|
|
pub use codex_config::types::ToolSuggestConfig;
|
|
pub use codex_config::types::TuiKeymap;
|
|
pub use codex_config::types::TuiNotificationSettings;
|
|
pub use codex_config::types::UriBasedFileOpener;
|
|
pub use codex_core::CodexThread;
|
|
pub use codex_core::ForkSnapshot;
|
|
pub use codex_core::McpManager;
|
|
pub use codex_core::NewThread;
|
|
pub use codex_core::StartThreadOptions;
|
|
pub use codex_core::StateDbHandle;
|
|
pub use codex_core::ThreadManager;
|
|
pub use codex_core::ThreadShutdownReport;
|
|
pub use codex_core::agent_graph_store_from_state_db;
|
|
pub use codex_core::config::Config;
|
|
pub use codex_core::config::Constrained;
|
|
pub use codex_core::config::GhostSnapshotConfig;
|
|
pub use codex_core::config::MultiAgentV2Config;
|
|
pub use codex_core::config::Permissions;
|
|
pub use codex_core::config::TerminalResizeReflowConfig;
|
|
pub use codex_core::config::ThreadStoreConfig;
|
|
pub use codex_core::config::find_codex_home;
|
|
pub use codex_core::init_state_db;
|
|
pub use codex_core::init_state_db_from_config;
|
|
pub use codex_core::skills::SkillsManager;
|
|
pub use codex_core::thread_store_from_config;
|
|
pub use codex_exec_server::EnvironmentManager;
|
|
pub use codex_exec_server::EnvironmentManagerArgs;
|
|
pub use codex_exec_server::ExecServerRuntimePaths;
|
|
pub use codex_features::Feature;
|
|
pub use codex_features::Features;
|
|
pub use codex_login::AuthManager;
|
|
pub use codex_login::default_client::set_default_originator;
|
|
pub use codex_model_provider_info::OPENAI_PROVIDER_ID;
|
|
pub use codex_model_provider_info::built_in_model_providers;
|
|
pub use codex_models_manager::manager::RefreshStrategy;
|
|
pub use codex_models_manager::manager::SharedModelsManager;
|
|
pub use codex_protocol::ThreadId;
|
|
pub use codex_protocol::config_types::AltScreenMode;
|
|
pub use codex_protocol::config_types::ApprovalsReviewer;
|
|
pub use codex_protocol::config_types::CollaborationModeMask;
|
|
pub use codex_protocol::config_types::ShellEnvironmentPolicy;
|
|
pub use codex_protocol::config_types::WebSearchMode;
|
|
pub use codex_protocol::dynamic_tools::DynamicToolSpec;
|
|
pub use codex_protocol::error::Result as CodexResult;
|
|
pub use codex_protocol::models::PermissionProfile;
|
|
pub use codex_protocol::openai_models::ModelPreset;
|
|
pub use codex_protocol::protocol::AskForApproval;
|
|
pub use codex_protocol::protocol::EventMsg;
|
|
pub use codex_protocol::protocol::InitialHistory;
|
|
pub use codex_protocol::protocol::McpServerRefreshConfig;
|
|
pub use codex_protocol::protocol::Op;
|
|
pub use codex_protocol::protocol::SessionConfiguredEvent;
|
|
pub use codex_protocol::protocol::SessionSource;
|
|
pub use codex_protocol::protocol::TurnEnvironmentSelection;
|
|
pub use codex_protocol::protocol::W3cTraceContext;
|
|
pub use codex_protocol::user_input::UserInput;
|
|
pub use codex_utils_absolute_path::AbsolutePathBuf;
|