mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
## What changed - Show a compact session header with a randomly selected greeting, preserving the greeting and blossom state from startup into the live session. - Center a settled blossom in unused fullscreen space and replay its animation on click. Hide it while typing or when space is insufficient, and respect `tui.animations` and `tui.effects.welcome`. - Hide startup tips in the fullscreen transcript while retaining them in terminal scrollback, and prevent hidden entries from shifting the first visible header. - Keep the composer visible and responsive during daemon startup, routing startup diagnostics through tracing while direct lifecycle commands retain stderr output. ## Testing Add regression tests and update snapshots for blossom placement and click replay, welcome opt-outs, greeting stability, startup transitions, tip visibility, and transcript spacing. GitOrigin-RevId: ec7b082fbe25ced1180cad3348f5c76e48c0e92b
64 lines
2.7 KiB
Rust
64 lines
2.7 KiB
Rust
//! Invocation overrides apply on fresh starts or explicitly confirmed managed restarts.
|
|
//! The lifecycle lock serializes persistence against other clients and updates.
|
|
|
|
use crate::Daemon;
|
|
use crate::LifecycleOutput;
|
|
use crate::ensure_supported_platform;
|
|
use anyhow::Result;
|
|
use anyhow::ensure;
|
|
use std::collections::BTreeMap;
|
|
|
|
/// Start a missing daemon with these features, preserving other saved overrides,
|
|
/// or leave a running daemon unchanged.
|
|
/// Callers must check the running server's configuration before using it.
|
|
/// Startup diagnostics go to tracing, so a caller with a live TUI can keep rendering.
|
|
pub async fn start_with_features(features: &BTreeMap<String, bool>) -> Result<LifecycleOutput> {
|
|
ensure_supported_platform()?;
|
|
#[cfg(windows)]
|
|
crate::backend::windows::ensure_not_elevated()?;
|
|
let mut daemon = Daemon::from_environment()?;
|
|
daemon.log_diagnostics = true;
|
|
let _operation_lock = daemon.acquire_operation_lock().await?;
|
|
let selected = daemon.current_installation()?;
|
|
let mut overrides = selected.load_settings().await?.feature_overrides;
|
|
overrides.extend(features.clone());
|
|
Box::pin(selected.start(&overrides)).await
|
|
}
|
|
|
|
/// Apply confirmed feature settings to an existing managed daemon and restart it.
|
|
/// Callers must obtain consent for changes to shared services and interrupted work,
|
|
/// then verify effective server compatibility after this operation completes.
|
|
pub async fn restart_with_features(features: &BTreeMap<String, bool>) -> Result<LifecycleOutput> {
|
|
ensure_supported_platform()?;
|
|
#[cfg(windows)]
|
|
crate::backend::windows::ensure_not_elevated()?;
|
|
let daemon = Daemon::from_environment()?;
|
|
let _operation_lock = daemon.acquire_operation_lock().await?;
|
|
let selected = daemon.current_installation()?;
|
|
Box::pin(selected.restart_with_features_locked(features)).await
|
|
}
|
|
|
|
impl Daemon {
|
|
pub(super) async fn restart(&self) -> Result<LifecycleOutput> {
|
|
self.restart_with_settings(self.load_settings().await?)
|
|
.await
|
|
}
|
|
|
|
pub(super) async fn restart_with_features_locked(
|
|
&self,
|
|
features: &BTreeMap<String, bool>,
|
|
) -> Result<LifecycleOutput> {
|
|
let mut settings = self.load_settings().await?;
|
|
ensure!(
|
|
self.running_backend_instance(&settings).await?.is_some(),
|
|
"no running managed daemon; rerun the command to check the current server"
|
|
);
|
|
let previous = settings.feature_overrides.clone();
|
|
settings.feature_overrides.extend(features.clone());
|
|
if settings.feature_overrides == previous {
|
|
return self.start(&previous).await;
|
|
}
|
|
self.restart_with_settings(settings).await
|
|
}
|
|
}
|