mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Avoid cloning MCP invocations in TUI history (#38103)
## What changed Update MCP invocation formatting to borrow the invocation and its server and tool names instead of cloning them when rendering TUI history cells. GitOrigin-RevId: ac824d86d445215d6b730c6a28b4ec4dfc4f5b8c
This commit is contained in:
1 parent
c909d1bc04
commit
eb9dceba1a
1 file changed
+5
-5
@@ -164,7 +164,7 @@ impl McpToolCallCell {
|
|||||||
.unwrap_or_else(|| "node_repl.js".to_string());
|
.unwrap_or_else(|| "node_repl.js".to_string());
|
||||||
Line::from(title.cyan())
|
Line::from(title.cyan())
|
||||||
} else {
|
} else {
|
||||||
line_to_static(&format_mcp_invocation(self.invocation.clone()))
|
line_to_static(&format_mcp_invocation(&self.invocation))
|
||||||
};
|
};
|
||||||
let mut compact_spans = vec![bullet.clone(), " ".into(), header_text.bold(), " ".into()];
|
let mut compact_spans = vec![bullet.clone(), " ".into(), header_text.bold(), " ".into()];
|
||||||
let mut compact_header = Line::from(compact_spans.clone());
|
let mut compact_header = Line::from(compact_spans.clone());
|
||||||
@@ -296,7 +296,7 @@ impl HistoryCell for McpToolCallCell {
|
|||||||
};
|
};
|
||||||
let mut lines = vec![Line::from(format!(
|
let mut lines = vec![Line::from(format!(
|
||||||
"{header_text} {}",
|
"{header_text} {}",
|
||||||
format_mcp_invocation(self.invocation.clone())
|
format_mcp_invocation(&self.invocation)
|
||||||
))];
|
))];
|
||||||
|
|
||||||
if let Some(result) = &self.result {
|
if let Some(result) = &self.result {
|
||||||
@@ -745,7 +745,7 @@ impl HistoryCell for McpInventoryLoadingCell {
|
|||||||
pub(crate) fn new_mcp_inventory_loading(animations_enabled: bool) -> McpInventoryLoadingCell {
|
pub(crate) fn new_mcp_inventory_loading(animations_enabled: bool) -> McpInventoryLoadingCell {
|
||||||
McpInventoryLoadingCell::new(animations_enabled)
|
McpInventoryLoadingCell::new(animations_enabled)
|
||||||
}
|
}
|
||||||
fn format_mcp_invocation<'a>(invocation: McpInvocation) -> Line<'a> {
|
fn format_mcp_invocation(invocation: &McpInvocation) -> Line<'_> {
|
||||||
let args_str = invocation
|
let args_str = invocation
|
||||||
.arguments
|
.arguments
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@@ -756,9 +756,9 @@ fn format_mcp_invocation<'a>(invocation: McpInvocation) -> Line<'a> {
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let invocation_spans = vec![
|
let invocation_spans = vec![
|
||||||
invocation.server.clone().cyan(),
|
invocation.server.as_str().cyan(),
|
||||||
".".into(),
|
".".into(),
|
||||||
invocation.tool.cyan(),
|
invocation.tool.as_str().cyan(),
|
||||||
"(".into(),
|
"(".into(),
|
||||||
args_str.dim(),
|
args_str.dim(),
|
||||||
")".into(),
|
")".into(),
|
||||||
|
|||||||
Reference in new issue
Block a user