mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
5cc5f12efc
## Why Follow-up to #20291. The v2 item-event-to-notification translation had been embedded in `app-server/src/bespoke_event_handling.rs`, which made it hard to reuse anywhere else. This PR moves that stateless mapping into shared protocol code so other entry points can produce the same `ServerNotification` payloads without copying app-server logic. That also lets `thread-manager-sample` demonstrate the same notification surface that the app server exposes, instead of only printing the final assistant message. ## What changed - move `item_event_to_server_notification` into `codex-app-server-protocol::protocol::event_mapping` - keep the mapper tests next to the shared implementation in `codex-app-server-protocol` - re-export the mapper from `codex-core-api` so lightweight consumers can use it without reaching into `app-server-protocol` directly - simplify `app-server/src/bespoke_event_handling.rs` so it delegates the stateless event-to-notification projection to the shared helper - update `thread-manager-sample` to: - print mapped notifications as newline-delimited JSON - use the shared mapper through `codex-core-api` - enable the default feature set so the sample exposes the normal tool surface - use a `read_only` permission profile so shell commands can run in the sample without widening permissions ## Testing - `cargo test -p codex-app-server-protocol` - `cargo test -p codex-core-api` - `cargo test -p codex-app-server bespoke_event_handling::tests` - `cargo test -p codex-thread-manager-sample` - `cargo run -p codex-thread-manager-sample -- "briefly explore the repo with pwd and ls, then summarize it"`
75 lines
3.4 KiB
Rust
75 lines
3.4 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::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::ThreadManager;
|
|
pub use codex_core::ThreadShutdownReport;
|
|
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::plugins::PluginsManager;
|
|
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;
|