feat: Added new environment variable to force showing tool call logging when not in a tty
This commit is contained in:
2 files changed
+14
-2
No files matched your search
+8
-2
@@ -1485,7 +1485,10 @@ impl ToolCall {
|
|||||||
let json_data = self.parse_arguments()?;
|
let json_data = self.parse_arguments()?;
|
||||||
let cmd_name = self.name.as_str();
|
let cmd_name = self.name.as_str();
|
||||||
let quiet = ctx.current_depth > 0;
|
let quiet = ctx.current_depth > 0;
|
||||||
if *IS_STDOUT_TERMINAL && ctx.current_depth == 0 && !HEADLESS.load(Ordering::SeqCst) {
|
if (*IS_STDOUT_TERMINAL || *SHOW_TOOL_CALLS)
|
||||||
|
&& ctx.current_depth == 0
|
||||||
|
&& !HEADLESS.load(Ordering::SeqCst)
|
||||||
|
{
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
format_call_log(cmd_name, &[json_data.to_string()], &json_data)
|
format_call_log(cmd_name, &[json_data.to_string()], &json_data)
|
||||||
@@ -1562,7 +1565,10 @@ impl ToolCall {
|
|||||||
|
|
||||||
cmd_args.push(json_data.to_string());
|
cmd_args.push(json_data.to_string());
|
||||||
|
|
||||||
if *IS_STDOUT_TERMINAL && current_depth == 0 && !HEADLESS.load(Ordering::SeqCst) {
|
if (*IS_STDOUT_TERMINAL || *SHOW_TOOL_CALLS)
|
||||||
|
&& current_depth == 0
|
||||||
|
&& !HEADLESS.load(Ordering::SeqCst)
|
||||||
|
{
|
||||||
println!("{}", format_call_log(&cmd_name, &cmd_args, &json_data));
|
println!("{}", format_call_log(&cmd_name, &cmd_args, &json_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ pub static CODE_BLOCK_RE: LazyLock<Regex> =
|
|||||||
pub static THINK_TAG_RE: LazyLock<Regex> =
|
pub static THINK_TAG_RE: LazyLock<Regex> =
|
||||||
LazyLock::new(|| Regex::new(r"(?s)^\s*<think>.*?</think>(\s*|$)").unwrap());
|
LazyLock::new(|| Regex::new(r"(?s)^\s*<think>.*?</think>(\s*|$)").unwrap());
|
||||||
pub static IS_STDOUT_TERMINAL: LazyLock<bool> = LazyLock::new(|| io::stdout().is_terminal());
|
pub static IS_STDOUT_TERMINAL: LazyLock<bool> = LazyLock::new(|| io::stdout().is_terminal());
|
||||||
|
pub static SHOW_TOOL_CALLS: LazyLock<bool> = LazyLock::new(|| {
|
||||||
|
env::var(get_env_name("show_tool_calls"))
|
||||||
|
.ok()
|
||||||
|
.and_then(|v| parse_bool(&v))
|
||||||
|
.unwrap_or_default()
|
||||||
|
});
|
||||||
pub static HEADLESS: AtomicBool = AtomicBool::new(false);
|
pub static HEADLESS: AtomicBool = AtomicBool::new(false);
|
||||||
pub static ACP_SERVER: AtomicBool = AtomicBool::new(false);
|
pub static ACP_SERVER: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user