Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

528 B
Raw Blame
import * as color from 'src/ui/colors';

const maybePrintPipe = (isLastEntry: boolean) => (isLastEntry ? ' ' : color.gray('│'));

export const formatSpanAttributes = (attributes: Record<string, unknown>, isLastEntry: boolean) => {
  const entries = Object.entries(attributes);
  if (entries.length === 0) {
    return [];
  }

  const lines = Array.from(entries).map(
    ([key, value]) =>
      `${maybePrintPipe(isLastEntry)}    ${color.white(key)}${color.gray(':')} ${value}`
  );

  return `\r\n${lines.join('\r\n')}`;
};