qwen-code/packages/cli/src/ui/components/PlanSummaryDisplay.tsx
DragonnZhang 4ce6f6f597 Keep rejected plan content visible in plan mode
When a plan is rejected, preserve and display the plan content so users
can still see what was proposed. The rejection message is now shown in
yellow (AccentYellow) instead of green to visually indicate the rejected
state.

Changes:
- Add 'rejected' flag to PlanResultDisplay interface
- Update PlanSummaryDisplay to conditionally color message based on rejection
- Preserve plan content in coreToolScheduler when plan is cancelled
- Add tests for both rejected and approved plan rendering

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-06 19:00:49 +08:00

42 lines
1 KiB
TypeScript

/**
* @license
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
import { Box, Text } from 'ink';
import { MarkdownDisplay } from '../utils/MarkdownDisplay.js';
import { Colors } from '../colors.js';
import type { PlanResultDisplay } from '@qwen-code/qwen-code-core';
interface PlanSummaryDisplayProps {
data: PlanResultDisplay;
availableHeight?: number;
childWidth: number;
}
export const PlanSummaryDisplay: React.FC<PlanSummaryDisplayProps> = ({
data,
availableHeight,
childWidth,
}) => {
const { message, plan, rejected } = data;
const messageColor = rejected ? Colors.AccentYellow : Colors.AccentGreen;
return (
<Box flexDirection="column">
<Box marginBottom={1}>
<Text color={messageColor} wrap="wrap">
{message}
</Text>
</Box>
<MarkdownDisplay
text={plan}
isPending={false}
availableTerminalHeight={availableHeight}
contentWidth={childWidth}
/>
</Box>
);
};