import React from 'react';
import { MessageResponse } from '../../components/MessageResponse.js';
import { Text } from '../../ink.js';
import { jsonParse } from '../../utils/slowOperations.js';
import type { Input, SendMessageToolOutput } from './SendMessageTool.js';
export function renderToolUseMessage(input: Partial<Input>): React.ReactNode {
  if (typeof input.message !== 'object' || input.message === null) {
    return null;
  }
  if (input.message.type === 'plan_approval_response') {
    return input.message.approve ? `approve plan from: ${input.to}` : `reject plan from: ${input.to}`;
  }
  return null;
}
export function renderToolResultMessage(content: SendMessageToolOutput | string, _progressMessages: unknown, {
  verbose
}: {
  verbose: boolean;
}): React.ReactNode {
  const result: SendMessageToolOutput = typeof content === 'string' ? jsonParse(content) : content;
  if ('routing' in result && result.routing) {
    return null;
  }
  if ('request_id' in result && 'target' in result) {
    return null;
  }
  return <MessageResponse>
      <Text dimColor>{result.message}</Text>
    </MessageResponse>;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJSZWFjdCIsIk1lc3NhZ2VSZXNwb25zZSIsIlRleHQiLCJqc29uUGFyc2UiLCJJbnB1dCIsIlNlbmRNZXNzYWdlVG9vbE91dHB1dCIsInJlbmRlclRvb2xVc2VNZXNzYWdlIiwiaW5wdXQiLCJQYXJ0aWFsIiwiUmVhY3ROb2RlIiwibWVzc2FnZSIsInR5cGUiLCJhcHByb3ZlIiwidG8iLCJyZW5kZXJUb29sUmVzdWx0TWVzc2FnZSIsImNvbnRlbnQiLCJfcHJvZ3Jlc3NNZXNzYWdlcyIsInZlcmJvc2UiLCJyZXN1bHQiLCJyb3V0aW5nIl0sInNvdXJjZXMiOlsiVUkudHN4Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCdcbmltcG9ydCB7IE1lc3NhZ2VSZXNwb25zZSB9IGZyb20gJy4uLy4uL2NvbXBvbmVudHMvTWVzc2FnZVJlc3BvbnNlLmpzJ1xuaW1wb3J0IHsgVGV4dCB9IGZyb20gJ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