Update shell.ts

Wrap XML content in CDATA
This commit is contained in:
Aishanee Shah
2026-02-18 00:01:33 -05:00
committed by GitHub
parent 4501c78470
commit aa5f09626e
+3 -4
View File
@@ -354,16 +354,15 @@ export class ShellToolInvocation extends BaseToolInvocation<
} else { } else {
// 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.
const output = result.output || '(empty)';
const parts = [`<output>${output}</output>`];
const output = result.output || '(empty)';
const parts = [`<output><![CDATA[${output}]]></output>`];
if (result.error) { if (result.error) {
const finalError = result.error.message.replaceAll( const finalError = result.error.message.replaceAll(
commandToExecute, commandToExecute,
this.params.command, this.params.command,
); );
parts.push(`<error>${finalError}</error>`); parts.push(`<error><![CDATA[${finalError}]]></error>`);
}
if (result.exitCode !== null) { if (result.exitCode !== null) {
parts.push(`<exit_code>${result.exitCode}</exit_code>`); parts.push(`<exit_code>${result.exitCode}</exit_code>`);