Przeglądaj źródła

combine stdout and stderr in bash tool output (#300)

Co-authored-by: opencode <[email protected]>
Co-authored-by: Dax Raad <[email protected]>
Tom 8 miesięcy temu
rodzic
commit
0e8c3359d1
1 zmienionych plików z 9 dodań i 1 usunięć
  1. 9 1
      packages/opencode/src/tool/bash.ts

+ 9 - 1
packages/opencode/src/tool/bash.ts

@@ -63,10 +63,18 @@ export const BashTool = Tool.define({
       metadata: {
         stderr,
         stdout,
+        exit: process.exitCode,
         description: params.description,
         title: params.command,
       },
-      output: stdout.replaceAll(/\x1b\[[0-9;]*m/g, ""),
+      output: [
+        `<stdout>`,
+        stdout ?? "",
+        `</stdout>`,
+        `<stderr>`,
+        stderr ?? "",
+        `</stderr>`,
+      ].join("\n"),
     }
   },
 })