Sync upstream Gemini-CLI v0.8.2 (#838)

This commit is contained in:
tanzhenxin
2025-10-23 09:27:04 +08:00
committed by GitHub
parent 096fabb5d6
commit eb95c131be
644 changed files with 70389 additions and 23709 deletions

View File

@@ -17,7 +17,6 @@ import { type WizardStepProps } from '../types.js';
import { WIZARD_STEPS } from '../constants.js';
import { getStepKind } from '../utils.js';
import type { Config } from '@qwen-code/qwen-code-core';
import { Colors } from '../../../colors.js';
import { theme } from '../../../semantic-colors.js';
import { TextEntryStep } from './TextEntryStep.js';
import { useKeypress } from '../../../hooks/useKeypress.js';
@@ -131,15 +130,17 @@ export function AgentCreationWizard({
<Text color={theme.status.warning} bold>
Debug Info:
</Text>
<Text color={Colors.Gray}>Step: {state.currentStep}</Text>
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>Step: {state.currentStep}</Text>
<Text color={theme.text.secondary}>
Can Proceed: {state.canProceed ? 'Yes' : 'No'}
</Text>
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
Generating: {state.isGenerating ? 'Yes' : 'No'}
</Text>
<Text color={Colors.Gray}>Location: {state.location}</Text>
<Text color={Colors.Gray}>Method: {state.generationMethod}</Text>
<Text color={theme.text.secondary}>Location: {state.location}</Text>
<Text color={theme.text.secondary}>
Method: {state.generationMethod}
</Text>
{state.validationErrors.length > 0 && (
<Text color={theme.status.error}>
Errors: {state.validationErrors.join(', ')}
@@ -303,7 +304,7 @@ export function AgentCreationWizard({
{/* Main content wrapped in bounding box */}
<Box
borderStyle="single"
borderColor={Colors.Gray}
borderColor={theme.border.default}
flexDirection="column"
padding={1}
width="100%"

View File

@@ -8,7 +8,7 @@ import { useState, useEffect } from 'react';
import { Box, Text } from 'ink';
import { RadioButtonSelect } from '../../shared/RadioButtonSelect.js';
import { type ColorOption } from '../types.js';
import { Colors } from '../../../colors.js';
import { theme } from '../../../semantic-colors.js';
import { COLOR_OPTIONS } from '../constants.js';
const colorOptions: ColorOption[] = COLOR_OPTIONS;
@@ -61,6 +61,7 @@ export function ColorSelector({
<Box flexDirection="column">
<RadioButtonSelect
items={colorOptions.map((option) => ({
key: option.id,
label: option.name,
value: option.id,
}))}
@@ -74,7 +75,7 @@ export function ColorSelector({
</Box>
<Box flexDirection="row">
<Text color={Colors.Gray}>Preview:</Text>
<Text color={theme.text.secondary}>Preview:</Text>
<Box marginLeft={2}>
<Text color={currentColor.value}>{` ${agentName} `}</Text>
</Box>

View File

@@ -5,7 +5,7 @@
*/
import { useCallback, useState, useEffect } from 'react';
import { Box, Text, useInput } from 'ink';
import { Box, Text } from 'ink';
import type { WizardStepProps } from '../types.js';
import type {
SubagentManager,
@@ -14,6 +14,7 @@ import type {
import { theme } from '../../../semantic-colors.js';
import { shouldShowColor, getColorForDisplay } from '../utils.js';
import { useLaunchEditor } from '../../../hooks/useLaunchEditor.js';
import { useKeypress } from '../../../hooks/useKeypress.js';
/**
* Step 6: Final confirmation and actions.
@@ -192,19 +193,22 @@ export function CreationSummary({
]);
// Handle keyboard input
useInput((input, key) => {
if (saveSuccess) return;
useKeypress(
(key) => {
if (saveSuccess) return;
if (key.return || input === 's') {
handleSave();
return;
}
if (key.name === 'return' || key.sequence === 's') {
handleSave();
return;
}
if (input === 'e') {
handleEdit();
return;
}
});
if (key.sequence === 'e') {
handleEdit();
return;
}
},
{ isActive: true },
);
if (saveSuccess) {
return (

View File

@@ -13,7 +13,6 @@ import { type Config, subagentGenerator } from '@qwen-code/qwen-code-core';
import { useKeypress, type Key } from '../../../hooks/useKeypress.js';
import { keyMatchers, Command } from '../../../keyMatchers.js';
import { theme } from '../../../semantic-colors.js';
import { Colors } from '../../../colors.js';
import { TextInput } from '../../shared/TextInput.js';
/**
@@ -52,7 +51,7 @@ export function DescriptionInput({
try {
const generated = await subagentGenerator(
userDescription,
config.getGeminiClient(),
config,
abortController.signal,
);
@@ -142,7 +141,7 @@ export function DescriptionInput({
return (
<Box flexDirection="column" gap={1}>
<Box>
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
Describe what this subagent should do and when it should be used. (Be
comprehensive for best results)
</Text>

View File

@@ -43,6 +43,7 @@ export function GenerationMethodSelector({
<Box flexDirection="column">
<RadioButtonSelect
items={generationOptions.map((option) => ({
key: option.value,
label: option.label,
value: option.value,
}))}

View File

@@ -38,6 +38,7 @@ export function LocationSelector({ state, dispatch, onNext }: WizardStepProps) {
<Box flexDirection="column">
<RadioButtonSelect
items={locationOptions.map((option) => ({
key: option.value,
label: option.label,
value: option.value,
}))}

View File

@@ -7,7 +7,7 @@
import { useCallback } from 'react';
import { Box, Text } from 'ink';
import type { WizardStepProps } from '../types.js';
import { Colors } from '../../../colors.js';
import { theme } from '../../../semantic-colors.js';
import { TextInput } from '../../shared/TextInput.js';
interface TextEntryStepProps
@@ -60,7 +60,7 @@ export function TextEntryStep({
<Box flexDirection="column" gap={1}>
{description && (
<Box>
<Text color={Colors.Gray}>{description}</Text>
<Text color={theme.text.secondary}>{description}</Text>
</Box>
)}

View File

@@ -9,7 +9,7 @@ import { Box, Text } from 'ink';
import { RadioButtonSelect } from '../../shared/RadioButtonSelect.js';
import type { ToolCategory } from '../types.js';
import { Kind, type Config } from '@qwen-code/qwen-code-core';
import { Colors } from '../../../colors.js';
import { theme } from '../../../semantic-colors.js';
interface ToolOption {
label: string;
@@ -184,6 +184,7 @@ export function ToolSelector({
<Box flexDirection="column">
<RadioButtonSelect
items={toolOptions.map((option) => ({
key: option.value,
label: option.label,
value: option.value,
}))}
@@ -200,12 +201,12 @@ export function ToolSelector({
{currentCategory && (
<Box flexDirection="column">
{currentCategory.id === 'all' ? (
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
All tools selected, including MCP tools
</Text>
) : currentCategory.tools.length > 0 ? (
<>
<Text color={Colors.Gray}>Selected tools:</Text>
<Text color={theme.text.secondary}>Selected tools:</Text>
<Box flexDirection="column" marginLeft={2}>
{(() => {
// Filter the already categorized tools to show only those in current category
@@ -222,17 +223,17 @@ export function ToolSelector({
return (
<>
{categoryReadTools.length > 0 && (
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
Read-only tools: {categoryReadTools.join(', ')}
</Text>
)}
{categoryEditTools.length > 0 && (
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
Edit tools: {categoryEditTools.join(', ')}
</Text>
)}
{categoryExecuteTools.length > 0 && (
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
Execution tools: {categoryExecuteTools.join(', ')}
</Text>
)}

View File

@@ -27,10 +27,10 @@ export const ActionSelectionStep = ({
// Filter actions based on whether the agent is built-in
const allActions = [
{ label: 'View Agent', value: 'view' as const },
{ label: 'Edit Agent', value: 'edit' as const },
{ label: 'Delete Agent', value: 'delete' as const },
{ label: 'Back', value: 'back' as const },
{ key: 'view', label: 'View Agent', value: 'view' as const },
{ key: 'edit', label: 'Edit Agent', value: 'edit' as const },
{ key: 'delete', label: 'Delete Agent', value: 'delete' as const },
{ key: 'back', label: 'Back', value: 'back' as const },
];
const actions = selectedAgent?.isBuiltin

View File

@@ -82,6 +82,7 @@ export function EditOptionsStep({
<Box flexDirection="column">
<RadioButtonSelect
items={editOptions.map((option) => ({
key: option.id,
label: option.label,
value: option.id,
}))}

View File

@@ -7,7 +7,6 @@
import { useState, useEffect, useMemo } from 'react';
import { Box, Text } from 'ink';
import { theme } from '../../../semantic-colors.js';
import { Colors } from '../../../colors.js';
import { useKeypress } from '../../../hooks/useKeypress.js';
import { type SubagentConfig } from '@qwen-code/qwen-code-core';
@@ -242,7 +241,9 @@ export const AgentSelectionStep = ({
</Text>
)}
{agent.level === 'user' && projectNames.has(agent.name) && (
<Text color={isSelected ? theme.status.warning : Colors.Gray}>
<Text
color={isSelected ? theme.status.warning : theme.text.secondary}
>
{' '}
(overridden by project level agent)
</Text>

View File

@@ -14,7 +14,6 @@ import { AgentDeleteStep } from './AgentDeleteStep.js';
import { ToolSelector } from '../create/ToolSelector.js';
import { ColorSelector } from '../create/ColorSelector.js';
import { MANAGEMENT_STEPS } from '../types.js';
import { Colors } from '../../../colors.js';
import { theme } from '../../../semantic-colors.js';
import { getColorForDisplay, shouldShowColor } from '../utils.js';
import type { SubagentConfig, Config } from '@qwen-code/qwen-code-core';
@@ -317,7 +316,7 @@ export function AgentsManagerDialog({
{/* Main content wrapped in bounding box */}
<Box
borderStyle="single"
borderColor={Colors.Gray}
borderColor={theme.border.default}
flexDirection="column"
padding={1}
width="100%"

View File

@@ -6,7 +6,6 @@
import React, { useMemo } from 'react';
import { Box, Text } from 'ink';
import { Colors } from '../../../colors.js';
import type {
TaskResultDisplay,
SubagentStatsSummary,
@@ -47,7 +46,7 @@ const getStatusColor = (
case 'failed':
return theme.status.error;
default:
return Colors.Gray;
return theme.text.secondary;
}
};
@@ -157,7 +156,7 @@ export const AgentExecutionDisplay: React.FC<AgentExecutionDisplayProps> = ({
{/* Show count of additional tool calls if there are more than 1 */}
{data.toolCalls.length > 1 && !data.pendingConfirmation && (
<Box flexDirection="row" paddingLeft={4}>
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
+{data.toolCalls.length - 1} more tool calls (ctrl+r to
expand)
</Text>
@@ -259,7 +258,7 @@ export const AgentExecutionDisplay: React.FC<AgentExecutionDisplayProps> = ({
{/* Footer with keyboard shortcuts */}
{footerText && (
<Box flexDirection="row">
<Text color={Colors.Gray}>{footerText}</Text>
<Text color={theme.text.secondary}>{footerText}</Text>
</Box>
)}
</Box>
@@ -283,7 +282,7 @@ const TaskPromptSection: React.FC<{
<Box flexDirection="row">
<Text color={theme.text.primary}>Task Detail: </Text>
{shouldTruncate && displayMode === 'default' && (
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
{' '}
Showing the first {MAX_TASK_PROMPT_LINES} lines.
</Text>
@@ -340,7 +339,7 @@ const ToolCallsList: React.FC<{
<Box flexDirection="row" marginBottom={1}>
<Text color={theme.text.primary}>Tools:</Text>
{shouldTruncate && displayMode === 'default' && (
<Text color={Colors.Gray}>
<Text color={theme.text.secondary}>
{' '}
Showing the last {MAX_TOOL_CALLS} of {calls.length} tools.
</Text>
@@ -415,7 +414,7 @@ const ToolCallItem: React.FC<{
<Box minWidth={STATUS_INDICATOR_WIDTH}>{statusIcon}</Box>
<Text wrap="truncate-end">
<Text>{toolCall.name}</Text>{' '}
<Text color={Colors.Gray}>{description}</Text>
<Text color={theme.text.secondary}>{description}</Text>
{toolCall.error && (
<Text color={theme.status.error}> - {toolCall.error}</Text>
)}
@@ -425,7 +424,7 @@ const ToolCallItem: React.FC<{
{/* Second line: truncated returnDisplay output - hidden in compact mode */}
{!compact && truncatedOutput && (
<Box flexDirection="row" paddingLeft={STATUS_INDICATOR_WIDTH}>
<Text color={Colors.Gray}>{truncatedOutput}</Text>
<Text color={theme.text.secondary}>{truncatedOutput}</Text>
</Box>
)}
</Box>
@@ -444,7 +443,7 @@ const ExecutionSummaryDetails: React.FC<{
if (!stats) {
return (
<Box flexDirection="column" paddingLeft={1}>
<Text color={Colors.Gray}> No summary available</Text>
<Text color={theme.text.secondary}> No summary available</Text>
</Box>
);
}
@@ -473,7 +472,7 @@ const ToolUsageStats: React.FC<{
if (!executionSummary) {
return (
<Box flexDirection="column" paddingLeft={1}>
<Text color={Colors.Gray}> No tool usage data available</Text>
<Text color={theme.text.secondary}> No tool usage data available</Text>
</Box>
);
}
@@ -485,15 +484,15 @@ const ToolUsageStats: React.FC<{
</Text>
<Text>
<Text>Success Rate:</Text>{' '}
<Text color={Colors.AccentGreen}>
<Text color={theme.status.success}>
{executionSummary.successRate.toFixed(1)}%
</Text>{' '}
(
<Text color={Colors.AccentGreen}>
<Text color={theme.status.success}>
{executionSummary.successfulToolCalls} success
</Text>
,{' '}
<Text color={Colors.AccentRed}>
<Text color={theme.status.error}>
{executionSummary.failedToolCalls} failed
</Text>
)