fi: import type errors

This commit is contained in:
mingholy.lmh
2025-09-15 14:26:01 +08:00
parent f3cf732493
commit e9b423b43a
29 changed files with 289 additions and 282 deletions

View File

@@ -416,7 +416,7 @@ export class Task {
private createScheduler(): CoreToolScheduler { private createScheduler(): CoreToolScheduler {
const scheduler = new CoreToolScheduler({ const scheduler = new CoreToolScheduler({
/* @ts-expect-error */ /* @ts-expect-error We have extended the type of ToolResultDisplay */
outputUpdateHandler: this._schedulerOutputUpdate.bind(this), outputUpdateHandler: this._schedulerOutputUpdate.bind(this),
onAllToolCallsComplete: this._schedulerAllToolCallsComplete.bind(this), onAllToolCallsComplete: this._schedulerAllToolCallsComplete.bind(this),
onToolCallsUpdate: this._schedulerToolCallsUpdate.bind(this), onToolCallsUpdate: this._schedulerToolCallsUpdate.bind(this),

View File

@@ -5,7 +5,7 @@
*/ */
import { Box, Text } from 'ink'; import { Box, Text } from 'ink';
import React from 'react'; import type React from 'react';
import { Colors } from '../colors.js'; import { Colors } from '../colors.js';
import { import {
RadioButtonSelect, RadioButtonSelect,

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import React from 'react'; import type React from 'react';
import { Box, Text } from 'ink'; import { Box, Text } from 'ink';
import type { SummaryProps } from '../../types.js'; import type { SummaryProps } from '../../types.js';
import Spinner from 'ink-spinner'; import Spinner from 'ink-spinner';

View File

@@ -38,260 +38,260 @@ export const ToolConfirmationMessage: React.FC<
availableTerminalHeight, availableTerminalHeight,
terminalWidth, terminalWidth,
}) => { }) => {
const { onConfirm } = confirmationDetails; const { onConfirm } = confirmationDetails;
const childWidth = terminalWidth - 2; // 2 for padding const childWidth = terminalWidth - 2; // 2 for padding
const handleConfirm = async (outcome: ToolConfirmationOutcome) => {
if (confirmationDetails.type === 'edit') {
const ideClient = config.getIdeClient();
if (config.getIdeMode()) {
const cliOutcome =
outcome === ToolConfirmationOutcome.Cancel ? 'rejected' : 'accepted';
await ideClient?.resolveDiffFromCli(
confirmationDetails.filePath,
cliOutcome,
);
}
}
onConfirm(outcome);
};
const isTrustedFolder = config.isTrustedFolder() !== false;
useKeypress(
(key) => {
if (!isFocused) return;
if (key.name === 'escape' || (key.ctrl && key.name === 'c')) {
handleConfirm(ToolConfirmationOutcome.Cancel);
}
},
{ isActive: isFocused },
);
const handleSelect = (item: ToolConfirmationOutcome) => handleConfirm(item);
let bodyContent: React.ReactNode | null = null; // Removed contextDisplay here
let question: string;
const options: Array<RadioSelectItem<ToolConfirmationOutcome>> = new Array<
RadioSelectItem<ToolConfirmationOutcome>
>();
// Body content is now the DiffRenderer, passing filename to it
// The bordered box is removed from here and handled within DiffRenderer
function availableBodyContentHeight() {
if (options.length === 0) {
// This should not happen in practice as options are always added before this is called.
throw new Error('Options not provided for confirmation message');
}
if (availableTerminalHeight === undefined) {
return undefined;
}
// Calculate the vertical space (in lines) consumed by UI elements
// surrounding the main body content.
const PADDING_OUTER_Y = 2; // Main container has `padding={1}` (top & bottom).
const MARGIN_BODY_BOTTOM = 1; // margin on the body container.
const HEIGHT_QUESTION = 1; // The question text is one line.
const MARGIN_QUESTION_BOTTOM = 1; // Margin on the question container.
const HEIGHT_OPTIONS = options.length; // Each option in the radio select takes one line.
const surroundingElementsHeight =
PADDING_OUTER_Y +
MARGIN_BODY_BOTTOM +
HEIGHT_QUESTION +
MARGIN_QUESTION_BOTTOM +
HEIGHT_OPTIONS;
return Math.max(availableTerminalHeight - surroundingElementsHeight, 1);
}
const handleConfirm = async (outcome: ToolConfirmationOutcome) => {
if (confirmationDetails.type === 'edit') { if (confirmationDetails.type === 'edit') {
if (confirmationDetails.isModifying) { const ideClient = config.getIdeClient();
return ( if (config.getIdeMode()) {
<Box const cliOutcome =
minWidth="90%" outcome === ToolConfirmationOutcome.Cancel ? 'rejected' : 'accepted';
borderStyle="round" await ideClient?.resolveDiffFromCli(
borderColor={Colors.Gray} confirmationDetails.filePath,
justifyContent="space-around" cliOutcome,
padding={1}
overflow="hidden"
>
<Text>Modify in progress: </Text>
<Text color={Colors.AccentGreen}>
Save and close external editor to continue
</Text>
</Box>
); );
} }
}
onConfirm(outcome);
};
question = `Apply this change?`; const isTrustedFolder = config.isTrustedFolder() !== false;
options.push({
label: 'Yes, allow once', useKeypress(
value: ToolConfirmationOutcome.ProceedOnce, (key) => {
}); if (!isFocused) return;
if (isTrustedFolder) { if (key.name === 'escape' || (key.ctrl && key.name === 'c')) {
options.push({ handleConfirm(ToolConfirmationOutcome.Cancel);
label: 'Yes, allow always',
value: ToolConfirmationOutcome.ProceedAlways,
});
}
if (config.getIdeMode()) {
options.push({
label: 'No (esc)',
value: ToolConfirmationOutcome.Cancel,
});
} else {
options.push({
label: 'Modify with external editor',
value: ToolConfirmationOutcome.ModifyWithEditor,
});
options.push({
label: 'No, suggest changes (esc)',
value: ToolConfirmationOutcome.Cancel,
});
} }
},
{ isActive: isFocused },
);
bodyContent = ( const handleSelect = (item: ToolConfirmationOutcome) => handleConfirm(item);
<DiffRenderer
diffContent={confirmationDetails.fileDiff}
filename={confirmationDetails.fileName}
availableTerminalHeight={availableBodyContentHeight()}
terminalWidth={childWidth}
/>
);
} else if (confirmationDetails.type === 'exec') {
const executionProps =
confirmationDetails as ToolExecuteConfirmationDetails;
question = `Allow execution of: '${executionProps.rootCommand}'?`; let bodyContent: React.ReactNode | null = null; // Removed contextDisplay here
options.push({ let question: string;
label: 'Yes, allow once',
value: ToolConfirmationOutcome.ProceedOnce,
});
if (isTrustedFolder) {
options.push({
label: `Yes, allow always ...`,
value: ToolConfirmationOutcome.ProceedAlways,
});
}
options.push({
label: 'No, suggest changes (esc)',
value: ToolConfirmationOutcome.Cancel,
});
let bodyContentHeight = availableBodyContentHeight(); const options: Array<RadioSelectItem<ToolConfirmationOutcome>> = new Array<
if (bodyContentHeight !== undefined) { RadioSelectItem<ToolConfirmationOutcome>
bodyContentHeight -= 2; // Account for padding; >();
}
bodyContent = (
<Box flexDirection="column">
<Box paddingX={1} marginLeft={1}>
<MaxSizedBox
maxHeight={bodyContentHeight}
maxWidth={Math.max(childWidth - 4, 1)}
>
<Box>
<Text color={Colors.AccentCyan}>{executionProps.command}</Text>
</Box>
</MaxSizedBox>
</Box>
</Box>
);
} else if (confirmationDetails.type === 'info') {
const infoProps = confirmationDetails;
const displayUrls =
infoProps.urls &&
!(infoProps.urls.length === 1 && infoProps.urls[0] === infoProps.prompt);
question = `Do you want to proceed?`; // Body content is now the DiffRenderer, passing filename to it
options.push({ // The bordered box is removed from here and handled within DiffRenderer
label: 'Yes, allow once',
value: ToolConfirmationOutcome.ProceedOnce,
});
if (isTrustedFolder) {
options.push({
label: 'Yes, allow always',
value: ToolConfirmationOutcome.ProceedAlways,
});
}
options.push({
label: 'No, suggest changes (esc)',
value: ToolConfirmationOutcome.Cancel,
});
bodyContent = ( function availableBodyContentHeight() {
<Box flexDirection="column" paddingX={1} marginLeft={1}> if (options.length === 0) {
<Text color={Colors.AccentCyan}> // This should not happen in practice as options are always added before this is called.
<RenderInline text={infoProps.prompt} /> throw new Error('Options not provided for confirmation message');
}
if (availableTerminalHeight === undefined) {
return undefined;
}
// Calculate the vertical space (in lines) consumed by UI elements
// surrounding the main body content.
const PADDING_OUTER_Y = 2; // Main container has `padding={1}` (top & bottom).
const MARGIN_BODY_BOTTOM = 1; // margin on the body container.
const HEIGHT_QUESTION = 1; // The question text is one line.
const MARGIN_QUESTION_BOTTOM = 1; // Margin on the question container.
const HEIGHT_OPTIONS = options.length; // Each option in the radio select takes one line.
const surroundingElementsHeight =
PADDING_OUTER_Y +
MARGIN_BODY_BOTTOM +
HEIGHT_QUESTION +
MARGIN_QUESTION_BOTTOM +
HEIGHT_OPTIONS;
return Math.max(availableTerminalHeight - surroundingElementsHeight, 1);
}
if (confirmationDetails.type === 'edit') {
if (confirmationDetails.isModifying) {
return (
<Box
minWidth="90%"
borderStyle="round"
borderColor={Colors.Gray}
justifyContent="space-around"
padding={1}
overflow="hidden"
>
<Text>Modify in progress: </Text>
<Text color={Colors.AccentGreen}>
Save and close external editor to continue
</Text> </Text>
{displayUrls && infoProps.urls && infoProps.urls.length > 0 && (
<Box flexDirection="column" marginTop={1}>
<Text>URLs to fetch:</Text>
{infoProps.urls.map((url) => (
<Text key={url}>
{' '}
- <RenderInline text={url} />
</Text>
))}
</Box>
)}
</Box> </Box>
); );
} else { }
// mcp tool confirmation
const mcpProps = confirmationDetails as ToolMcpConfirmationDetails;
bodyContent = ( question = `Apply this change?`;
<Box flexDirection="column" paddingX={1} marginLeft={1}> options.push({
<Text color={Colors.AccentCyan}>MCP Server: {mcpProps.serverName}</Text> label: 'Yes, allow once',
<Text color={Colors.AccentCyan}>Tool: {mcpProps.toolName}</Text> value: ToolConfirmationOutcome.ProceedOnce,
</Box> });
); if (isTrustedFolder) {
question = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`;
options.push({ options.push({
label: 'Yes, allow once', label: 'Yes, allow always',
value: ToolConfirmationOutcome.ProceedOnce, value: ToolConfirmationOutcome.ProceedAlways,
});
}
if (config.getIdeMode()) {
options.push({
label: 'No (esc)',
value: ToolConfirmationOutcome.Cancel,
});
} else {
options.push({
label: 'Modify with external editor',
value: ToolConfirmationOutcome.ModifyWithEditor,
}); });
if (isTrustedFolder) {
options.push({
label: `Yes, always allow tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"`,
value: ToolConfirmationOutcome.ProceedAlwaysTool, // Cast until types are updated
});
options.push({
label: `Yes, always allow all tools from server "${mcpProps.serverName}"`,
value: ToolConfirmationOutcome.ProceedAlwaysServer,
});
}
options.push({ options.push({
label: 'No, suggest changes (esc)', label: 'No, suggest changes (esc)',
value: ToolConfirmationOutcome.Cancel, value: ToolConfirmationOutcome.Cancel,
}); });
} }
return ( bodyContent = (
<Box flexDirection="column" padding={1} width={childWidth}> <DiffRenderer
{/* Body Content (Diff Renderer or Command Info) */} diffContent={confirmationDetails.fileDiff}
{/* No separate context display here anymore for edits */} filename={confirmationDetails.fileName}
<Box flexGrow={1} flexShrink={1} overflow="hidden" marginBottom={1}> availableTerminalHeight={availableBodyContentHeight()}
{bodyContent} terminalWidth={childWidth}
</Box> />
);
} else if (confirmationDetails.type === 'exec') {
const executionProps =
confirmationDetails as ToolExecuteConfirmationDetails;
{/* Confirmation Question */} question = `Allow execution of: '${executionProps.rootCommand}'?`;
<Box marginBottom={1} flexShrink={0}> options.push({
<Text wrap="truncate">{question}</Text> label: 'Yes, allow once',
</Box> value: ToolConfirmationOutcome.ProceedOnce,
});
if (isTrustedFolder) {
options.push({
label: `Yes, allow always ...`,
value: ToolConfirmationOutcome.ProceedAlways,
});
}
options.push({
label: 'No, suggest changes (esc)',
value: ToolConfirmationOutcome.Cancel,
});
{/* Select Input for Options */} let bodyContentHeight = availableBodyContentHeight();
<Box flexShrink={0}> if (bodyContentHeight !== undefined) {
<RadioButtonSelect bodyContentHeight -= 2; // Account for padding;
items={options} }
onSelect={handleSelect} bodyContent = (
isFocused={isFocused} <Box flexDirection="column">
/> <Box paddingX={1} marginLeft={1}>
<MaxSizedBox
maxHeight={bodyContentHeight}
maxWidth={Math.max(childWidth - 4, 1)}
>
<Box>
<Text color={Colors.AccentCyan}>{executionProps.command}</Text>
</Box>
</MaxSizedBox>
</Box> </Box>
</Box> </Box>
); );
}; } else if (confirmationDetails.type === 'info') {
const infoProps = confirmationDetails;
const displayUrls =
infoProps.urls &&
!(infoProps.urls.length === 1 && infoProps.urls[0] === infoProps.prompt);
question = `Do you want to proceed?`;
options.push({
label: 'Yes, allow once',
value: ToolConfirmationOutcome.ProceedOnce,
});
if (isTrustedFolder) {
options.push({
label: 'Yes, allow always',
value: ToolConfirmationOutcome.ProceedAlways,
});
}
options.push({
label: 'No, suggest changes (esc)',
value: ToolConfirmationOutcome.Cancel,
});
bodyContent = (
<Box flexDirection="column" paddingX={1} marginLeft={1}>
<Text color={Colors.AccentCyan}>
<RenderInline text={infoProps.prompt} />
</Text>
{displayUrls && infoProps.urls && infoProps.urls.length > 0 && (
<Box flexDirection="column" marginTop={1}>
<Text>URLs to fetch:</Text>
{infoProps.urls.map((url) => (
<Text key={url}>
{' '}
- <RenderInline text={url} />
</Text>
))}
</Box>
)}
</Box>
);
} else {
// mcp tool confirmation
const mcpProps = confirmationDetails as ToolMcpConfirmationDetails;
bodyContent = (
<Box flexDirection="column" paddingX={1} marginLeft={1}>
<Text color={Colors.AccentCyan}>MCP Server: {mcpProps.serverName}</Text>
<Text color={Colors.AccentCyan}>Tool: {mcpProps.toolName}</Text>
</Box>
);
question = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`;
options.push({
label: 'Yes, allow once',
value: ToolConfirmationOutcome.ProceedOnce,
});
if (isTrustedFolder) {
options.push({
label: `Yes, always allow tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"`,
value: ToolConfirmationOutcome.ProceedAlwaysTool, // Cast until types are updated
});
options.push({
label: `Yes, always allow all tools from server "${mcpProps.serverName}"`,
value: ToolConfirmationOutcome.ProceedAlwaysServer,
});
}
options.push({
label: 'No, suggest changes (esc)',
value: ToolConfirmationOutcome.Cancel,
});
}
return (
<Box flexDirection="column" padding={1} width={childWidth}>
{/* Body Content (Diff Renderer or Command Info) */}
{/* No separate context display here anymore for edits */}
<Box flexGrow={1} flexShrink={1} overflow="hidden" marginBottom={1}>
{bodyContent}
</Box>
{/* Confirmation Question */}
<Box marginBottom={1} flexShrink={0}>
<Text wrap="truncate">{question}</Text>
</Box>
{/* Select Input for Options */}
<Box flexShrink={0}>
<RadioButtonSelect
items={options}
onSelect={handleSelect}
isFocused={isFocused}
/>
</Box>
</Box>
);
};

View File

@@ -60,12 +60,12 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
const countOneLineToolCalls = toolCalls.length - countToolCallsWithResults; const countOneLineToolCalls = toolCalls.length - countToolCallsWithResults;
const availableTerminalHeightPerToolMessage = availableTerminalHeight const availableTerminalHeightPerToolMessage = availableTerminalHeight
? Math.max( ? Math.max(
Math.floor( Math.floor(
(availableTerminalHeight - staticHeight - countOneLineToolCalls) / (availableTerminalHeight - staticHeight - countOneLineToolCalls) /
Math.max(1, countToolCallsWithResults), Math.max(1, countToolCallsWithResults),
), ),
1, 1,
) )
: undefined; : undefined;
return ( return (

View File

@@ -11,6 +11,7 @@ import { ToolMessage } from './ToolMessage.js';
import { StreamingState, ToolCallStatus } from '../../types.js'; import { StreamingState, ToolCallStatus } from '../../types.js';
import { Text } from 'ink'; import { Text } from 'ink';
import { StreamingContext } from '../../contexts/StreamingContext.js'; import { StreamingContext } from '../../contexts/StreamingContext.js';
import type { Config } from '@qwen-code/qwen-code-core';
// Mock child components or utilities if they are complex or have side effects // Mock child components or utilities if they are complex or have side effects
vi.mock('../GeminiRespondingSpinner.js', () => ({ vi.mock('../GeminiRespondingSpinner.js', () => ({
@@ -68,7 +69,7 @@ const renderWithContext = (
}; };
describe('<ToolMessage />', () => { describe('<ToolMessage />', () => {
const mockConfig = {} as any; // Mock config for tests const mockConfig = {} as Config;
const baseProps: ToolMessageProps = { const baseProps: ToolMessageProps = {
callId: 'tool-123', callId: 'tool-123',

View File

@@ -194,9 +194,9 @@ export const ToolMessage: React.FC<ToolMessageProps> = ({
}) => { }) => {
const availableHeight = availableTerminalHeight const availableHeight = availableTerminalHeight
? Math.max( ? Math.max(
availableTerminalHeight - STATIC_HEIGHT - RESERVED_LINE_COUNT, availableTerminalHeight - STATIC_HEIGHT - RESERVED_LINE_COUNT,
MIN_LINES_SHOWN + 1, // enforce minimum lines shown MIN_LINES_SHOWN + 1, // enforce minimum lines shown
) )
: undefined; : undefined;
// Long tool call response in MarkdownDisplay doesn't respect availableTerminalHeight properly, // Long tool call response in MarkdownDisplay doesn't respect availableTerminalHeight properly,

View File

@@ -16,7 +16,7 @@ import { CreationSummary } from './CreationSummary.js';
import { type WizardStepProps } from '../types.js'; import { type WizardStepProps } from '../types.js';
import { WIZARD_STEPS } from '../constants.js'; import { WIZARD_STEPS } from '../constants.js';
import { getStepKind } from '../utils.js'; import { getStepKind } from '../utils.js';
import { Config } from '@qwen-code/qwen-code-core'; import type { Config } from '@qwen-code/qwen-code-core';
import { Colors } from '../../../colors.js'; import { Colors } from '../../../colors.js';
import { theme } from '../../../semantic-colors.js'; import { theme } from '../../../semantic-colors.js';
import { TextEntryStep } from './TextEntryStep.js'; import { TextEntryStep } from './TextEntryStep.js';

View File

@@ -6,8 +6,11 @@
import { useCallback, useState, useEffect } from 'react'; import { useCallback, useState, useEffect } from 'react';
import { Box, Text, useInput } from 'ink'; import { Box, Text, useInput } from 'ink';
import { type WizardStepProps } from '../types.js'; import type { WizardStepProps } from '../types.js';
import { SubagentManager, type SubagentConfig } from '@qwen-code/qwen-code-core'; import type {
SubagentManager,
SubagentConfig,
} from '@qwen-code/qwen-code-core';
import { theme } from '../../../semantic-colors.js'; import { theme } from '../../../semantic-colors.js';
import { shouldShowColor, getColorForDisplay } from '../utils.js'; import { shouldShowColor, getColorForDisplay } from '../utils.js';
import { useLaunchEditor } from '../../../hooks/useLaunchEditor.js'; import { useLaunchEditor } from '../../../hooks/useLaunchEditor.js';

View File

@@ -9,7 +9,7 @@ import { Box, Text } from 'ink';
import Spinner from 'ink-spinner'; import Spinner from 'ink-spinner';
import type { WizardStepProps, WizardAction } from '../types.js'; import type { WizardStepProps, WizardAction } from '../types.js';
import { sanitizeInput } from '../utils.js'; import { sanitizeInput } from '../utils.js';
import { Config, subagentGenerator } from '@qwen-code/qwen-code-core'; import { type Config, subagentGenerator } from '@qwen-code/qwen-code-core';
import { useKeypress, type Key } from '../../../hooks/useKeypress.js'; import { useKeypress, type Key } from '../../../hooks/useKeypress.js';
import { keyMatchers, Command } from '../../../keyMatchers.js'; import { keyMatchers, Command } from '../../../keyMatchers.js';
import { theme } from '../../../semantic-colors.js'; import { theme } from '../../../semantic-colors.js';

View File

@@ -8,7 +8,7 @@ import { useState, useMemo, useEffect } from 'react';
import { Box, Text } from 'ink'; import { Box, Text } from 'ink';
import { RadioButtonSelect } from '../../shared/RadioButtonSelect.js'; import { RadioButtonSelect } from '../../shared/RadioButtonSelect.js';
import type { ToolCategory } from '../types.js'; import type { ToolCategory } from '../types.js';
import { Kind, Config } from '@qwen-code/qwen-code-core'; import { Kind, type Config } from '@qwen-code/qwen-code-core';
import { Colors } from '../../../colors.js'; import { Colors } from '../../../colors.js';
interface ToolOption { interface ToolOption {

View File

@@ -35,8 +35,8 @@ export const ActionSelectionStep = ({
const actions = selectedAgent?.isBuiltin const actions = selectedAgent?.isBuiltin
? allActions.filter( ? allActions.filter(
(action) => action.value === 'view' || action.value === 'back', (action) => action.value === 'view' || action.value === 'back',
) )
: allActions; : allActions;
const handleActionSelect = (value: 'view' | 'edit' | 'delete' | 'back') => { const handleActionSelect = (value: 'view' | 'edit' | 'delete' | 'back') => {

View File

@@ -318,12 +318,12 @@ export const AgentSelectionStep = ({
{(projectAgents.length > 0 || {(projectAgents.length > 0 ||
userAgents.length > 0 || userAgents.length > 0 ||
builtinAgents.length > 0) && ( builtinAgents.length > 0) && (
<Box marginTop={1}> <Box marginTop={1}>
<Text color={theme.text.secondary}> <Text color={theme.text.secondary}>
Using: {enabledAgentsCount} agents Using: {enabledAgentsCount} agents
</Text> </Text>
</Box> </Box>
)} )}
</Box> </Box>
); );
}; };

View File

@@ -17,7 +17,7 @@ import { MANAGEMENT_STEPS } from '../types.js';
import { Colors } from '../../../colors.js'; import { Colors } from '../../../colors.js';
import { theme } from '../../../semantic-colors.js'; import { theme } from '../../../semantic-colors.js';
import { getColorForDisplay, shouldShowColor } from '../utils.js'; import { getColorForDisplay, shouldShowColor } from '../utils.js';
import { Config, type SubagentConfig } from '@qwen-code/qwen-code-core'; import type { Config, SubagentConfig } from '@qwen-code/qwen-code-core';
interface AgentsManagerDialogProps { interface AgentsManagerDialogProps {
onClose: () => void; onClose: () => void;
@@ -170,8 +170,8 @@ export function AgentsManagerDialog({
// Use agent color for the Agent Viewer header // Use agent color for the Agent Viewer header
const headerColor = const headerColor =
currentStep === MANAGEMENT_STEPS.AGENT_VIEWER && currentStep === MANAGEMENT_STEPS.AGENT_VIEWER &&
selectedAgent && selectedAgent &&
shouldShowColor(selectedAgent.color) shouldShowColor(selectedAgent.color)
? getColorForDisplay(selectedAgent.color) ? getColorForDisplay(selectedAgent.color)
: undefined; : undefined;

View File

@@ -167,8 +167,8 @@ export const AgentExecutionDisplay: React.FC<AgentExecutionDisplayProps> = ({
{(data.status === 'completed' || {(data.status === 'completed' ||
data.status === 'failed' || data.status === 'failed' ||
data.status === 'cancelled') && ( data.status === 'cancelled') && (
<ResultsSection data={data} displayMode={displayMode} /> <ResultsSection data={data} displayMode={displayMode} />
)} )}
{/* Footer with keyboard shortcuts */} {/* Footer with keyboard shortcuts */}
{footerText && ( {footerText && (

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { type SubagentLevel, Config } from '@qwen-code/qwen-code-core'; import type { SubagentLevel, Config } from '@qwen-code/qwen-code-core';
/** /**
* State management for the subagent creation wizard. * State management for the subagent creation wizard.

View File

@@ -6,7 +6,7 @@
import { useCallback } from 'react'; import { useCallback } from 'react';
import { SettingScope } from '../../config/settings.js'; import { SettingScope } from '../../config/settings.js';
import { AuthType } from '@qwen-code/qwen-code-core'; import type { AuthType } from '@qwen-code/qwen-code-core';
export interface DialogCloseOptions { export interface DialogCloseOptions {
// Theme dialog // Theme dialog

View File

@@ -15,8 +15,8 @@ import type {
Tool, Tool,
} from '@google/genai'; } from '@google/genai';
import { ProxyAgent, setGlobalDispatcher } from 'undici'; import { ProxyAgent, setGlobalDispatcher } from 'undici';
import { UserTierId } from '../code_assist/types.js'; import type { UserTierId } from '../code_assist/types.js';
import { Config } from '../config/config.js'; import type { Config } from '../config/config.js';
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js'; import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
import type { File, IdeContext } from '../ide/ideContext.js'; import type { File, IdeContext } from '../ide/ideContext.js';
import { ideContext } from '../ide/ideContext.js'; import { ideContext } from '../ide/ideContext.js';

View File

@@ -4,12 +4,12 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import OpenAI from 'openai'; import type OpenAI from 'openai';
import { import {
type GenerateContentParameters, type GenerateContentParameters,
GenerateContentResponse, GenerateContentResponse,
} from '@google/genai'; } from '@google/genai';
import { Config } from '../../config/config.js'; import type { Config } from '../../config/config.js';
import { type ContentGeneratorConfig } from '../contentGenerator.js'; import { type ContentGeneratorConfig } from '../contentGenerator.js';
import { type OpenAICompatibleProvider } from './provider/index.js'; import { type OpenAICompatibleProvider } from './provider/index.js';
import { OpenAIContentConverter } from './converter.js'; import { OpenAIContentConverter } from './converter.js';

View File

@@ -5,8 +5,8 @@
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { import type {
type ToolCallConfirmationDetails, ToolCallConfirmationDetails,
ToolConfirmationOutcome, ToolConfirmationOutcome,
} from '../tools/tools.js'; } from '../tools/tools.js';

View File

@@ -10,8 +10,8 @@ import * as path from 'path';
import * as os from 'os'; import * as os from 'os';
import { SubagentManager } from './subagent-manager.js'; import { SubagentManager } from './subagent-manager.js';
import { type SubagentConfig, SubagentError } from './types.js'; import { type SubagentConfig, SubagentError } from './types.js';
import { ToolRegistry } from '../tools/tool-registry.js'; import type { ToolRegistry } from '../tools/tool-registry.js';
import { Config } from '../config/config.js'; import type { Config } from '../config/config.js';
import { makeFakeConfig } from '../test-utils/config.js'; import { makeFakeConfig } from '../test-utils/config.js';
// Mock file system operations // Mock file system operations

View File

@@ -27,7 +27,7 @@ import type {
import { SubagentError, SubagentErrorCode } from './types.js'; import { SubagentError, SubagentErrorCode } from './types.js';
import { SubagentValidator } from './validation.js'; import { SubagentValidator } from './validation.js';
import { SubAgentScope } from './subagent.js'; import { SubAgentScope } from './subagent.js';
import { Config } from '../config/config.js'; import type { Config } from '../config/config.js';
import { BuiltinAgentRegistry } from './builtin-agents.js'; import { BuiltinAgentRegistry } from './builtin-agents.js';
const QWEN_CONFIG_DIR = '.qwen'; const QWEN_CONFIG_DIR = '.qwen';

View File

@@ -26,7 +26,7 @@ import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
import { createContentGenerator } from '../core/contentGenerator.js'; import { createContentGenerator } from '../core/contentGenerator.js';
import { GeminiChat } from '../core/geminiChat.js'; import { GeminiChat } from '../core/geminiChat.js';
import { executeToolCall } from '../core/nonInteractiveToolExecutor.js'; import { executeToolCall } from '../core/nonInteractiveToolExecutor.js';
import { ToolRegistry } from '../tools/tool-registry.js'; import type { ToolRegistry } from '../tools/tool-registry.js';
import { type AnyDeclarativeTool } from '../tools/tools.js'; import { type AnyDeclarativeTool } from '../tools/tools.js';
import { getEnvironmentContext } from '../utils/environmentContext.js'; import { getEnvironmentContext } from '../utils/environmentContext.js';
import { ContextState, SubAgentScope } from './subagent.js'; import { ContextState, SubAgentScope } from './subagent.js';

View File

@@ -5,7 +5,7 @@
*/ */
import { reportError } from '../utils/errorReporting.js'; import { reportError } from '../utils/errorReporting.js';
import { Config } from '../config/config.js'; import type { Config } from '../config/config.js';
import { type ToolCallRequestInfo } from '../core/turn.js'; import { type ToolCallRequestInfo } from '../core/turn.js';
import { import {
CoreToolScheduler, CoreToolScheduler,
@@ -43,7 +43,10 @@ import type {
SubAgentStreamTextEvent, SubAgentStreamTextEvent,
SubAgentErrorEvent, SubAgentErrorEvent,
} from './subagent-events.js'; } from './subagent-events.js';
import { SubAgentEventEmitter, SubAgentEventType } from './subagent-events.js'; import {
type SubAgentEventEmitter,
SubAgentEventType,
} from './subagent-events.js';
import { import {
SubagentStatistics, SubagentStatistics,
type SubagentStatsSummary, type SubagentStatsSummary,

View File

@@ -8,13 +8,13 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { TaskTool, type TaskParams } from './task.js'; import { TaskTool, type TaskParams } from './task.js';
import type { PartListUnion } from '@google/genai'; import type { PartListUnion } from '@google/genai';
import type { ToolResultDisplay, TaskResultDisplay } from './tools.js'; import type { ToolResultDisplay, TaskResultDisplay } from './tools.js';
import { Config } from '../config/config.js'; import type { Config } from '../config/config.js';
import { SubagentManager } from '../subagents/subagent-manager.js'; import { SubagentManager } from '../subagents/subagent-manager.js';
import { import {
type SubagentConfig, type SubagentConfig,
SubagentTerminateMode, SubagentTerminateMode,
} from '../subagents/types.js'; } from '../subagents/types.js';
import { SubAgentScope, ContextState } from '../subagents/subagent.js'; import { type SubAgentScope, ContextState } from '../subagents/subagent.js';
import { partToString } from '../utils/partUtils.js'; import { partToString } from '../utils/partUtils.js';
// Type for accessing protected methods in tests // Type for accessing protected methods in tests

View File

@@ -15,8 +15,8 @@ import type {
ToolCallConfirmationDetails, ToolCallConfirmationDetails,
ToolConfirmationPayload, ToolConfirmationPayload,
} from './tools.js'; } from './tools.js';
import { Config } from '../config/config.js'; import type { Config } from '../config/config.js';
import { SubagentManager } from '../subagents/subagent-manager.js'; import type { SubagentManager } from '../subagents/subagent-manager.js';
import { import {
type SubagentConfig, type SubagentConfig,
SubagentTerminateMode, SubagentTerminateMode,

View File

@@ -13,7 +13,7 @@ import {
type Mock, type Mock,
afterEach, afterEach,
} from 'vitest'; } from 'vitest';
import { type Content, GoogleGenAI, Models } from '@google/genai'; import type { Content, GoogleGenAI, Models } from '@google/genai';
import { DEFAULT_QWEN_FLASH_MODEL } from '../config/models.js'; import { DEFAULT_QWEN_FLASH_MODEL } from '../config/models.js';
import { GeminiClient } from '../core/client.js'; import { GeminiClient } from '../core/client.js';
import { Config } from '../config/config.js'; import { Config } from '../config/config.js';

View File

@@ -13,7 +13,7 @@ import {
type Mock, type Mock,
afterEach, afterEach,
} from 'vitest'; } from 'vitest';
import { type Content, GoogleGenAI, Models } from '@google/genai'; import type { Content, GoogleGenAI, Models } from '@google/genai';
import { DEFAULT_QWEN_MODEL } from '../config/models.js'; import { DEFAULT_QWEN_MODEL } from '../config/models.js';
import { GeminiClient } from '../core/client.js'; import { GeminiClient } from '../core/client.js';
import { Config } from '../config/config.js'; import { Config } from '../config/config.js';

View File

@@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
import { type Content } from '@google/genai'; import type { Content } from '@google/genai';
import { DEFAULT_QWEN_MODEL } from '../config/models.js'; import { DEFAULT_QWEN_MODEL } from '../config/models.js';
import { GeminiClient } from '../core/client.js'; import type { GeminiClient } from '../core/client.js';
const SYSTEM_PROMPT = `You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability. const SYSTEM_PROMPT = `You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.