(params: {
command: string
cwd: string
stdout: string | null
stderr: string | null
exitCode: number
errorMessage?: string
})
| 5 | import type { ToolResultOutput } from '@codebuff/common/types/messages/content-part' |
| 6 | |
| 7 | export function createRunTerminalToolResult(params: { |
| 8 | command: string |
| 9 | cwd: string |
| 10 | stdout: string | null |
| 11 | stderr: string | null |
| 12 | exitCode: number |
| 13 | errorMessage?: string |
| 14 | }): ToolResultOutput[] { |
| 15 | const { command, cwd, stdout, stderr, exitCode, errorMessage } = params |
| 16 | if (errorMessage) { |
| 17 | return [ |
| 18 | { |
| 19 | type: 'json' as const, |
| 20 | value: { command, startingCwd: cwd, errorMessage }, |
| 21 | }, |
| 22 | ] |
| 23 | } |
| 24 | return [ |
| 25 | { |
| 26 | type: 'json' as const, |
| 27 | value: { |
| 28 | command, |
| 29 | startingCwd: cwd, |
| 30 | stdout: stdout || null, |
| 31 | stderr: stderr || null, |
| 32 | exitCode, |
| 33 | }, |
| 34 | }, |
| 35 | ] |
| 36 | } |
| 37 | |
| 38 | export function buildBashHistoryMessages(params: { |
| 39 | command: string |
no outgoing calls
no test coverage detected