import React from 'react';
import { Text } from '../../ink.js';
import type { Tools } from '../../Tool.js';
import { findToolByName } from '../../Tool.js';
import type { ToolActivity } from '../../tasks/LocalAgentTask/LocalAgentTask.js';
import type { ThemeName } from '../../utils/theme.js';
export function renderToolActivity(activity: ToolActivity, tools: Tools, theme: ThemeName): React.ReactNode {
  const tool = findToolByName(tools, activity.toolName);
  if (!tool) {
    return activity.toolName;
  }
  try {
    const parsed = tool.inputSchema.safeParse(activity.input);
    const parsedInput = parsed.success ? parsed.data : {};
    const userFacingName = tool.userFacingName(parsedInput);
    if (!userFacingName) {
      return activity.toolName;
    }
    const toolArgs = tool.renderToolUseMessage(parsedInput, {
      theme,
      verbose: false
    });
    if (toolArgs) {
      return <Text>
          {userFacingName}({toolArgs})
        </Text>;
    }
    return userFacingName;
  } catch {
    return activity.toolName;
  }
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJSZWFjdCIsIlRleHQiLCJUb29scyIsImZpbmRUb29sQnlOYW1lIiwiVG9vbEFjdGl2aXR5IiwiVGhlbWVOYW1lIiwicmVuZGVyVG9vbEFjdGl2aXR5IiwiYWN0aXZpdHkiLCJ0b29scyIsInRoZW1lIiwiUmVhY3ROb2RlIiwidG9vbCIsInRvb2xOYW1lIiwicGFyc2VkIiwiaW5wdXRTY2hlbWEiLCJzYWZlUGFyc2UiLCJpbnB1dCIsInBhcnNlZElucHV0Iiwic3VjY2VzcyIsImRhdGEiLCJ1c2VyRmFjaW5nTmFtZSIsInRvb2xBcmdzIiwicmVuZGVyVG9vbFVzZU1lc3NhZ2UiLCJ2ZXJib3NlIl0sInNvdXJjZXMiOlsicmVuZGVyVG9vbEFjdGl2aXR5LnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnXG5pbXBvcnQgeyBUZXh0IH0gZnJvbSAnLi4vLi4vaW5rLmpzJ1xuaW1wb3J0IHR5cGUgey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