mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
feat(tui2): add feature-flagged tui2 frontend (#7793)
Introduce a new codex-tui2 crate that re-exports the existing interactive TUI surface and delegates run_main directly to codex-tui. This keeps behavior identical while giving tui2 its own crate for future viewport work. Wire the codex CLI to select the frontend via the tui2 feature flag. When the merged CLI overrides include features.tui2=true (e.g. via --enable tui2), interactive runs are routed through codex_tui2::run_main; otherwise they continue to use the original codex_tui::run_main. Register Feature::Tui2 in the core feature registry and add the tui2 crate and dependency entries so the new frontend builds alongside the existing TUI. This is a stub that only wires up the feature flag for this. <img width="619" height="364" alt="image" src="https://github.com/user-attachments/assets/4893f030-932f-471e-a443-63fe6b5d8ed9" />
This commit is contained in:
1 parent
225a5f7ffb
commit
0c8828c5e2
9 files changed
+161
-12
No files matched your search
@@ -0,0 +1,29 @@
|
||||
[package]
|
||||
name = "codex-tui2"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "codex_tui2"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "codex-tui2"
|
||||
path = "src/main.rs"
|
||||
|
||||
[features]
|
||||
# Keep feature surface aligned with codex-tui while tui2 delegates to it.
|
||||
vt100-tests = []
|
||||
debug-logs = []
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
clap = { workspace = true, features = ["derive"] }
|
||||
codex-arg0 = { workspace = true }
|
||||
codex-common = { workspace = true }
|
||||
codex-core = { workspace = true }
|
||||
codex-tui = { workspace = true }
|
||||
@@ -0,0 +1,24 @@
|
||||
#![deny(clippy::print_stdout, clippy::print_stderr)]
|
||||
#![deny(clippy::disallowed_methods)]
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub use codex_tui::AppExitInfo;
|
||||
pub use codex_tui::Cli;
|
||||
pub use codex_tui::update_action;
|
||||
|
||||
/// Entry point for the experimental TUI v2 crate.
|
||||
///
|
||||
/// Currently this is a thin shim that delegates to the existing `codex-tui`
|
||||
/// implementation so behavior and rendering remain identical while the new
|
||||
/// viewport is developed behind a feature toggle.
|
||||
pub async fn run_main(
|
||||
cli: Cli,
|
||||
codex_linux_sandbox_exe: Option<PathBuf>,
|
||||
) -> std::io::Result<AppExitInfo> {
|
||||
#[allow(clippy::print_stdout)] // for now
|
||||
{
|
||||
println!("Note: You are running the experimental TUI v2 implementation.");
|
||||
}
|
||||
codex_tui::run_main(cli, codex_linux_sandbox_exe).await
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
use clap::Parser;
|
||||
use codex_arg0::arg0_dispatch_or_else;
|
||||
use codex_common::CliConfigOverrides;
|
||||
use codex_core::protocol::FinalOutput;
|
||||
use codex_tui2::Cli;
|
||||
use codex_tui2::run_main;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct TopCli {
|
||||
#[clap(flatten)]
|
||||
config_overrides: CliConfigOverrides,
|
||||
|
||||
#[clap(flatten)]
|
||||
inner: Cli,
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
arg0_dispatch_or_else(|codex_linux_sandbox_exe| async move {
|
||||
let top_cli = TopCli::parse();
|
||||
let mut inner = top_cli.inner;
|
||||
inner
|
||||
.config_overrides
|
||||
.raw_overrides
|
||||
.splice(0..0, top_cli.config_overrides.raw_overrides);
|
||||
let exit_info = run_main(inner, codex_linux_sandbox_exe).await?;
|
||||
let token_usage = exit_info.token_usage;
|
||||
if !token_usage.is_zero() {
|
||||
println!("{}", FinalOutput::from(token_usage));
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user