Update shell.ts

Add exit_code before output or error to signal the model
This commit is contained in:
Aishanee Shah
2026-02-18 11:40:05 -05:00
committed by GitHub
parent 72bf0c0add
commit 032e40ff54
+4 -4
View File
@@ -355,6 +355,10 @@ export class ShellToolInvocation extends BaseToolInvocation<
// Create a formatted error string for display, replacing the wrapper command // Create a formatted error string for display, replacing the wrapper command
// with the user-facing command. // with the user-facing command.
if (result.exitCode !== null) {
parts.push(`<exit_code>${result.exitCode}</exit_code>`);
}
const output = result.output || '(empty)'; const output = result.output || '(empty)';
const parts = [`<output><![CDATA[${output}]]></output>`]; const parts = [`<output><![CDATA[${output}]]></output>`];
if (result.error) { if (result.error) {
@@ -365,10 +369,6 @@ export class ShellToolInvocation extends BaseToolInvocation<
parts.push(`<error><![CDATA[${finalError}]]></error>`); parts.push(`<error><![CDATA[${finalError}]]></error>`);
} }
if (result.exitCode !== null) {
parts.push(`<exit_code>${result.exitCode}</exit_code>`);
}
if (result.signal) { if (result.signal) {
parts.push(`<signal>${result.signal}</signal>`); parts.push(`<signal>${result.signal}</signal>`);
} }