/** * @license * Copyright 2025 Qwen Team * SPDX-License-Identifier: Apache-2.0 */ import type React from 'react'; import { Box, Text } from 'ink'; import stringWidth from 'string-width'; import { theme } from '../../semantic-colors.js'; import { RenderInline } from '../../utils/InlineMarkdownRenderer.js'; interface StatusMessageProps { text: string; prefix: string; prefixColor: string; textColor: string; children?: React.ReactNode; } interface StatusTextProps { text: string; } /** * Shared renderer for status-like history messages (info/warning/error/retry). * Keeps prefix spacing and wrapping behavior consistent across variants. */ export const StatusMessage: React.FC = ({ text, prefix, prefixColor, textColor, children, }) => { if (!text || text.trim() === '') { return null; } const prefixWidth = stringWidth(prefix) + 1; return ( {prefix} {children} ); }; export const InfoMessage: React.FC = ({ text }) => ( ); export const SuccessMessage: React.FC = ({ text }) => ( ); export const WarningMessage: React.FC = ({ text }) => ( ); export const ErrorMessage: React.FC = ({ text, hint, }) => ( {hint && ({hint})} ); export const RetryCountdownMessage: React.FC = ({ text }) => ( );