This PR overhauls how active tool calls and completed tool calls are displayed: 1. More use of colour to indicate success/failure and distinguish between components like tool name+arguments 2. Previously, the entire `CallToolResult` was serialized to JSON and pretty-printed. Now, we extract each individual `CallToolResultContent` and print those 1. The previous solution was wasting space by unnecessarily showing details of the `CallToolResult` struct to users, without formatting the actual tool call results nicely 2. We're now able to show users more information from tool results in less space, with nicer formatting when tools return JSON results ### Before: <img width="1251" alt="Screenshot 2025-06-03 at 11 24 26" src="https://github.com/user-attachments/assets/5a58f222-219c-4c53-ace7-d887194e30cf" /> ### After: <img width="1265" alt="image" src="https://github.com/user-attachments/assets/99fe54d0-9ebe-406a-855b-7aa529b91274" /> ## Future Work 1. Integrate image tool result handling better. We should be able to display images even if they're not the first `CallToolResultContent` 2. Users should have some way to view the full version of truncated tool results 3. It would be nice to add some left padding for tool results, make it more clear that they are results. This is doable, just a little fiddly due to the way `first_visible_line` scrolling works 4. There's almost certainly a better way to format JSON than "all on 1 line with spaces to make Ratatui wrapping work". But I think that works OK for now.
59 lines
1.4 KiB
TOML
59 lines
1.4 KiB
TOML
[package]
|
|
name = "codex-tui"
|
|
version = { workspace = true }
|
|
edition = "2024"
|
|
|
|
[[bin]]
|
|
name = "codex-tui"
|
|
path = "src/main.rs"
|
|
|
|
[lib]
|
|
name = "codex_tui"
|
|
path = "src/lib.rs"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
base64 = "0.22.1"
|
|
clap = { version = "4", features = ["derive"] }
|
|
codex-ansi-escape = { path = "../ansi-escape" }
|
|
codex-core = { path = "../core" }
|
|
codex-common = { path = "../common", features = ["cli", "elapsed"] }
|
|
codex-linux-sandbox = { path = "../linux-sandbox" }
|
|
color-eyre = "0.6.3"
|
|
crossterm = { version = "0.28.1", features = ["bracketed-paste"] }
|
|
image = { version = "^0.25.6", default-features = false, features = ["jpeg"] }
|
|
lazy_static = "1"
|
|
mcp-types = { path = "../mcp-types" }
|
|
path-clean = "1.0.1"
|
|
ratatui = { version = "0.29.0", features = [
|
|
"unstable-widget-ref",
|
|
"unstable-rendered-line-info",
|
|
] }
|
|
ratatui-image = "8.0.0"
|
|
regex-lite = "0.1"
|
|
serde_json = { version = "1", features = ["preserve_order"] }
|
|
shlex = "1.3.0"
|
|
strum = "0.27.1"
|
|
strum_macros = "0.27.1"
|
|
tokio = { version = "1", features = [
|
|
"io-std",
|
|
"macros",
|
|
"process",
|
|
"rt-multi-thread",
|
|
"signal",
|
|
] }
|
|
tracing = { version = "0.1.41", features = ["log"] }
|
|
tracing-appender = "0.2.3"
|
|
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
|
tui-input = "0.11.1"
|
|
tui-markdown = "0.3.3"
|
|
tui-textarea = "0.7.0"
|
|
unicode-segmentation = "1.12.0"
|
|
uuid = "1"
|
|
|
|
[dev-dependencies]
|
|
pretty_assertions = "1"
|