mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 21:03:19 +00:00
Clean up bash output formatting
- Remove "Command aborted by user" message (Aborted already shown separately) - Remove STDOUT/STDERR labels - just show output cleanly - Stderr is now separated by newline without labels - Timeout and error messages moved to end of output
This commit is contained in:
parent
6e9fa8dde1
commit
fe5706885d
1 changed files with 22 additions and 4 deletions
|
|
@ -59,16 +59,30 @@ export const bashTool: AgentTool<typeof bashSchema> = {
|
|||
}
|
||||
|
||||
if (signal?.aborted) {
|
||||
let output = "";
|
||||
if (stdout) output += stdout;
|
||||
if (stderr) {
|
||||
if (output) output += "\n";
|
||||
output += stderr;
|
||||
}
|
||||
resolve({
|
||||
output: `Command aborted by user\nSTDOUT: ${stdout}\nSTDERR: ${stderr}`,
|
||||
output: output || "(no output)",
|
||||
details: undefined,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (timedOut) {
|
||||
let output = "";
|
||||
if (stdout) output += stdout;
|
||||
if (stderr) {
|
||||
if (output) output += "\n";
|
||||
output += stderr;
|
||||
}
|
||||
if (output) output += "\n\n";
|
||||
output += "Command timed out after 30 seconds";
|
||||
resolve({
|
||||
output: `Command timed out after 30 seconds\nSTDOUT: ${stdout}\nSTDERR: ${stderr}`,
|
||||
output,
|
||||
details: undefined,
|
||||
});
|
||||
return;
|
||||
|
|
@ -76,11 +90,15 @@ export const bashTool: AgentTool<typeof bashSchema> = {
|
|||
|
||||
let output = "";
|
||||
if (stdout) output += stdout;
|
||||
if (stderr) output += stderr ? `\nSTDERR:\n${stderr}` : "";
|
||||
if (stderr) {
|
||||
if (output) output += "\n";
|
||||
output += stderr;
|
||||
}
|
||||
|
||||
if (code !== 0 && code !== null) {
|
||||
if (output) output += "\n\n";
|
||||
resolve({
|
||||
output: `Command exited with code ${code}\n${output}`,
|
||||
output: `${output}Command exited with code ${code}`,
|
||||
details: undefined,
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue