diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock index 198c986d87..53451bb2b1 100644 --- a/codex-rs/Cargo.lock +++ b/codex-rs/Cargo.lock @@ -863,6 +863,7 @@ dependencies = [ "codex-rmcp-client", "core_test_support", "dirs", + "dunce", "env-flags", "escargot", "eventsource-stream", @@ -1200,6 +1201,7 @@ dependencies = [ "crossterm", "diffy", "dirs", + "dunce", "image", "insta", "itertools 0.14.0", @@ -1798,6 +1800,12 @@ version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5" +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dupe" version = "0.9.1" @@ -4064,7 +4072,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/codex-rs/Cargo.toml b/codex-rs/Cargo.toml index 01dc47a70d..06c83c819e 100644 --- a/codex-rs/Cargo.toml +++ b/codex-rs/Cargo.toml @@ -97,6 +97,7 @@ derive_more = "2" diffy = "0.4.2" dirs = "6" dotenvy = "0.15.7" +dunce = "1.0.4" env-flags = "0.1.1" env_logger = "0.11.5" escargot = "0.5" diff --git a/codex-rs/core/Cargo.toml b/codex-rs/core/Cargo.toml index 22ba1ee626..8c56e7d132 100644 --- a/codex-rs/core/Cargo.toml +++ b/codex-rs/core/Cargo.toml @@ -27,6 +27,7 @@ codex-protocol = { workspace = true } codex-app-server-protocol = { workspace = true } codex-otel = { workspace = true, features = ["otel"] } dirs = { workspace = true } +dunce = { workspace = true } env-flags = { workspace = true } eventsource-stream = { workspace = true } futures = { workspace = true } diff --git a/codex-rs/core/src/project_doc.rs b/codex-rs/core/src/project_doc.rs index 476f0e1f00..c33b1a5dac 100644 --- a/codex-rs/core/src/project_doc.rs +++ b/codex-rs/core/src/project_doc.rs @@ -14,6 +14,7 @@ //! 3. We do **not** walk past the Git root. use crate::config::Config; +use dunce::canonicalize as normalize_path; use std::path::PathBuf; use tokio::io::AsyncReadExt; use tracing::error; @@ -109,7 +110,7 @@ pub async fn read_project_docs(config: &Config) -> std::io::Result std::io::Result> { let mut dir = config.cwd.clone(); - if let Ok(canon) = dir.canonicalize() { + if let Ok(canon) = normalize_path(&dir) { dir = canon; } diff --git a/codex-rs/tui/Cargo.toml b/codex-rs/tui/Cargo.toml index 21472d8fe9..7356ae334b 100644 --- a/codex-rs/tui/Cargo.toml +++ b/codex-rs/tui/Cargo.toml @@ -44,6 +44,7 @@ color-eyre = { workspace = true } crossterm = { workspace = true, features = ["bracketed-paste", "event-stream"] } diffy = { workspace = true } dirs = { workspace = true } +dunce = { workspace = true } image = { workspace = true, features = ["jpeg", "png"] } itertools = { workspace = true } lazy_static = { workspace = true } diff --git a/codex-rs/tui/src/status/helpers.rs b/codex-rs/tui/src/status/helpers.rs index 47faae27dc..1889d7f4f4 100644 --- a/codex-rs/tui/src/status/helpers.rs +++ b/codex-rs/tui/src/status/helpers.rs @@ -11,6 +11,10 @@ use unicode_width::UnicodeWidthStr; use super::account::StatusAccountDisplay; +fn normalize_agents_display_path(path: &Path) -> String { + dunce::simplified(path).display().to_string() +} + pub(crate) fn compose_model_display( config: &Config, entries: &[(&str, String)], @@ -59,13 +63,13 @@ pub(crate) fn compose_agents_summary(config: &Config) -> String { let up = format!("..{}", std::path::MAIN_SEPARATOR); format!("{}{}", up.repeat(ups), file_name) } else if let Ok(stripped) = p.strip_prefix(&config.cwd) { - stripped.display().to_string() + normalize_agents_display_path(stripped) } else { - p.display().to_string() + normalize_agents_display_path(&p) } } } else { - p.display().to_string() + normalize_agents_display_path(&p) }; rels.push(display); }