MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / addBashMessageToHistory

Function addBashMessageToHistory

cli/src/commands/router.ts:219–246  ·  view source on GitHub ↗
(params: {
  command: string
  stdout: string
  stderr: string | null
  exitCode: number
  cwd: string
  setMessages: RouterParams['setMessages']
})

Source from the content-addressed store, hash-verified

217 * Note: This is UI-only; we no longer send these commands to the AI context.
218 */
219export function addBashMessageToHistory(params: {
220 command: string
221 stdout: string
222 stderr: string | null
223 exitCode: number
224 cwd: string
225 setMessages: RouterParams['setMessages']
226}) {
227 const { command, stdout, stderr, exitCode, cwd, setMessages } = params
228 const toolResultOutput = createRunTerminalToolResult({
229 command,
230 cwd,
231 stdout: stdout || null,
232 stderr: stderr ?? null,
233 exitCode,
234 })
235 const toolCallId = crypto.randomUUID()
236 const outputJson = JSON.stringify(toolResultOutput)
237 const { assistantMessage } = buildBashHistoryMessages({
238 command,
239 cwd,
240 toolCallId,
241 output: outputJson,
242 isComplete: true,
243 })
244
245 setMessages((prev) => [...prev, assistantMessage])
246}
247
248export async function routeUserPrompt(
249 params: RouterParams,

Callers 1

ChatFunction · 0.90

Calls 2

buildBashHistoryMessagesFunction · 0.90

Tested by

no test coverage detected