"use client" import { cn } from "../../utils/cn" import { formatToolArgValue, formatToolResult } from "./utils/tool-call-helpers" /** * Monospace code body shared by ArgRow / ResultBlock. * * Uses the ODS `text-code` composite token (Azeret Mono 500, h6 responsive * scale, no transform) — the token this file was originally flagged for. */ const CODE_PRE_CLASS = "bg-ods-bg border border-ods-border rounded-md p-[var(--spacing-system-sf)] w-full max-h-64 overflow-auto overscroll-contain text-code text-ods-text-primary whitespace-pre" /** * Single arg row: inline `key: value` or labeled `
` block.
* Shared between ApprovalBatchMessage and ToolExecutionDisplay so both
* surfaces render long script bodies / JSON the same way.
*/
export function ArgRow({ argKey, value }: { argKey: string; value: unknown }) {
const formatted = formatToolArgValue(value)
if (formatted.kind === "inline") {
return (
{argKey}:
{formatted.text}
)
}
return (
{argKey}:
{formatted.text}
)
}
/**
* Result block for a tool execution. Renders inline for short single-line
* output and as a scrollable `` for code / JSON / multiline output.
*/
export function ResultBlock({ result, className }: { result: string | undefined | null; className?: string }) {
const formatted = formatToolResult(result)
if (!formatted.text) return null
if (formatted.kind === "inline") {
return (
Result:
{formatted.text}
)
}
return (
Result:
{formatted.text}
)
}
/**
* Raw command/script body as an unlabeled code block. Used by the CLIENT (Fae)
* card in the expanded state, where the collapsed line shows the human-readable
* `toolExplanation` and the actual command moves into the body (Figma 1972-6100).
*/
export function CommandBlock({ command, className }: { command: string; className?: string }) {
if (!command) return null
return (
{command}
)
}