diff --git a/packages/a2a-server/src/task.ts b/packages/a2a-server/src/task.ts index 17c10466..375014f1 100644 --- a/packages/a2a-server/src/task.ts +++ b/packages/a2a-server/src/task.ts @@ -416,7 +416,7 @@ export class Task { private createScheduler(): CoreToolScheduler { const scheduler = new CoreToolScheduler({ - /* @ts-expect-error */ + /* @ts-expect-error We have extended the type of ToolResultDisplay */ outputUpdateHandler: this._schedulerOutputUpdate.bind(this), onAllToolCallsComplete: this._schedulerAllToolCallsComplete.bind(this), onToolCallsUpdate: this._schedulerToolCallsUpdate.bind(this), diff --git a/packages/cli/src/ui/components/QuitConfirmationDialog.tsx b/packages/cli/src/ui/components/QuitConfirmationDialog.tsx index c3487860..659a5d38 100644 --- a/packages/cli/src/ui/components/QuitConfirmationDialog.tsx +++ b/packages/cli/src/ui/components/QuitConfirmationDialog.tsx @@ -5,7 +5,7 @@ */ import { Box, Text } from 'ink'; -import React from 'react'; +import type React from 'react'; import { Colors } from '../colors.js'; import { RadioButtonSelect, diff --git a/packages/cli/src/ui/components/messages/SummaryMessage.tsx b/packages/cli/src/ui/components/messages/SummaryMessage.tsx index 602e9a6a..82819f95 100644 --- a/packages/cli/src/ui/components/messages/SummaryMessage.tsx +++ b/packages/cli/src/ui/components/messages/SummaryMessage.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import type { SummaryProps } from '../../types.js'; import Spinner from 'ink-spinner'; diff --git a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx index bc5cd41d..2c2867e8 100644 --- a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx @@ -38,260 +38,260 @@ export const ToolConfirmationMessage: React.FC< availableTerminalHeight, terminalWidth, }) => { - const { onConfirm } = confirmationDetails; - 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> = new Array< - RadioSelectItem - >(); - - // 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 { onConfirm } = confirmationDetails; + const childWidth = terminalWidth - 2; // 2 for padding + const handleConfirm = async (outcome: ToolConfirmationOutcome) => { if (confirmationDetails.type === 'edit') { - if (confirmationDetails.isModifying) { - return ( - - Modify in progress: - - Save and close external editor to continue - - + const ideClient = config.getIdeClient(); + if (config.getIdeMode()) { + const cliOutcome = + outcome === ToolConfirmationOutcome.Cancel ? 'rejected' : 'accepted'; + await ideClient?.resolveDiffFromCli( + confirmationDetails.filePath, + cliOutcome, ); } + } + onConfirm(outcome); + }; - question = `Apply this change?`; - options.push({ - label: 'Yes, allow once', - value: ToolConfirmationOutcome.ProceedOnce, - }); - if (isTrustedFolder) { - options.push({ - 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, - }); + const isTrustedFolder = config.isTrustedFolder() !== false; + + useKeypress( + (key) => { + if (!isFocused) return; + if (key.name === 'escape' || (key.ctrl && key.name === 'c')) { + handleConfirm(ToolConfirmationOutcome.Cancel); } + }, + { isActive: isFocused }, + ); - bodyContent = ( - - ); - } else if (confirmationDetails.type === 'exec') { - const executionProps = - confirmationDetails as ToolExecuteConfirmationDetails; + const handleSelect = (item: ToolConfirmationOutcome) => handleConfirm(item); - question = `Allow execution of: '${executionProps.rootCommand}'?`; - 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, - }); + let bodyContent: React.ReactNode | null = null; // Removed contextDisplay here + let question: string; - let bodyContentHeight = availableBodyContentHeight(); - if (bodyContentHeight !== undefined) { - bodyContentHeight -= 2; // Account for padding; - } - bodyContent = ( - - - - - {executionProps.command} - - - - - ); - } else if (confirmationDetails.type === 'info') { - const infoProps = confirmationDetails; - const displayUrls = - infoProps.urls && - !(infoProps.urls.length === 1 && infoProps.urls[0] === infoProps.prompt); + const options: Array> = new Array< + RadioSelectItem + >(); - 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, - }); + // Body content is now the DiffRenderer, passing filename to it + // The bordered box is removed from here and handled within DiffRenderer - bodyContent = ( - - - + 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); + } + + if (confirmationDetails.type === 'edit') { + if (confirmationDetails.isModifying) { + return ( + + Modify in progress: + + Save and close external editor to continue - {displayUrls && infoProps.urls && infoProps.urls.length > 0 && ( - - URLs to fetch: - {infoProps.urls.map((url) => ( - - {' '} - - - - ))} - - )} ); - } else { - // mcp tool confirmation - const mcpProps = confirmationDetails as ToolMcpConfirmationDetails; + } - bodyContent = ( - - MCP Server: {mcpProps.serverName} - Tool: {mcpProps.toolName} - - ); - - question = `Allow execution of MCP tool "${mcpProps.toolName}" from server "${mcpProps.serverName}"?`; + question = `Apply this change?`; + options.push({ + label: 'Yes, allow once', + value: ToolConfirmationOutcome.ProceedOnce, + }); + if (isTrustedFolder) { options.push({ - label: 'Yes, allow once', - value: ToolConfirmationOutcome.ProceedOnce, + 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, }); - 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 ( - - {/* Body Content (Diff Renderer or Command Info) */} - {/* No separate context display here anymore for edits */} - - {bodyContent} - + bodyContent = ( + + ); + } else if (confirmationDetails.type === 'exec') { + const executionProps = + confirmationDetails as ToolExecuteConfirmationDetails; - {/* Confirmation Question */} - - {question} - + question = `Allow execution of: '${executionProps.rootCommand}'?`; + 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, + }); - {/* Select Input for Options */} - - + let bodyContentHeight = availableBodyContentHeight(); + if (bodyContentHeight !== undefined) { + bodyContentHeight -= 2; // Account for padding; + } + bodyContent = ( + + + + + {executionProps.command} + + ); - }; + } 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 = ( + + + + + {displayUrls && infoProps.urls && infoProps.urls.length > 0 && ( + + URLs to fetch: + {infoProps.urls.map((url) => ( + + {' '} + - + + ))} + + )} + + ); + } else { + // mcp tool confirmation + const mcpProps = confirmationDetails as ToolMcpConfirmationDetails; + + bodyContent = ( + + MCP Server: {mcpProps.serverName} + Tool: {mcpProps.toolName} + + ); + + 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 ( + + {/* Body Content (Diff Renderer or Command Info) */} + {/* No separate context display here anymore for edits */} + + {bodyContent} + + + {/* Confirmation Question */} + + {question} + + + {/* Select Input for Options */} + + + + + ); +}; diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx index 6cf14c06..9fe50315 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx @@ -60,12 +60,12 @@ export const ToolGroupMessage: React.FC = ({ const countOneLineToolCalls = toolCalls.length - countToolCallsWithResults; const availableTerminalHeightPerToolMessage = availableTerminalHeight ? Math.max( - Math.floor( - (availableTerminalHeight - staticHeight - countOneLineToolCalls) / - Math.max(1, countToolCallsWithResults), - ), - 1, - ) + Math.floor( + (availableTerminalHeight - staticHeight - countOneLineToolCalls) / + Math.max(1, countToolCallsWithResults), + ), + 1, + ) : undefined; return ( diff --git a/packages/cli/src/ui/components/messages/ToolMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolMessage.test.tsx index 0ae1d3a3..0e7b1b15 100644 --- a/packages/cli/src/ui/components/messages/ToolMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolMessage.test.tsx @@ -11,6 +11,7 @@ import { ToolMessage } from './ToolMessage.js'; import { StreamingState, ToolCallStatus } from '../../types.js'; import { Text } from 'ink'; 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 vi.mock('../GeminiRespondingSpinner.js', () => ({ @@ -68,7 +69,7 @@ const renderWithContext = ( }; describe('', () => { - const mockConfig = {} as any; // Mock config for tests + const mockConfig = {} as Config; const baseProps: ToolMessageProps = { callId: 'tool-123', diff --git a/packages/cli/src/ui/components/messages/ToolMessage.tsx b/packages/cli/src/ui/components/messages/ToolMessage.tsx index c2eab256..f2acea2a 100644 --- a/packages/cli/src/ui/components/messages/ToolMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolMessage.tsx @@ -194,9 +194,9 @@ export const ToolMessage: React.FC = ({ }) => { const availableHeight = availableTerminalHeight ? Math.max( - availableTerminalHeight - STATIC_HEIGHT - RESERVED_LINE_COUNT, - MIN_LINES_SHOWN + 1, // enforce minimum lines shown - ) + availableTerminalHeight - STATIC_HEIGHT - RESERVED_LINE_COUNT, + MIN_LINES_SHOWN + 1, // enforce minimum lines shown + ) : undefined; // Long tool call response in MarkdownDisplay doesn't respect availableTerminalHeight properly, diff --git a/packages/cli/src/ui/components/subagents/create/AgentCreationWizard.tsx b/packages/cli/src/ui/components/subagents/create/AgentCreationWizard.tsx index b2c7009a..a22fb422 100644 --- a/packages/cli/src/ui/components/subagents/create/AgentCreationWizard.tsx +++ b/packages/cli/src/ui/components/subagents/create/AgentCreationWizard.tsx @@ -16,7 +16,7 @@ import { CreationSummary } from './CreationSummary.js'; import { type WizardStepProps } from '../types.js'; import { WIZARD_STEPS } from '../constants.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 { theme } from '../../../semantic-colors.js'; import { TextEntryStep } from './TextEntryStep.js'; diff --git a/packages/cli/src/ui/components/subagents/create/CreationSummary.tsx b/packages/cli/src/ui/components/subagents/create/CreationSummary.tsx index ba26f878..e6009019 100644 --- a/packages/cli/src/ui/components/subagents/create/CreationSummary.tsx +++ b/packages/cli/src/ui/components/subagents/create/CreationSummary.tsx @@ -6,8 +6,11 @@ import { useCallback, useState, useEffect } from 'react'; import { Box, Text, useInput } from 'ink'; -import { type WizardStepProps } from '../types.js'; -import { SubagentManager, type SubagentConfig } from '@qwen-code/qwen-code-core'; +import type { WizardStepProps } from '../types.js'; +import type { + SubagentManager, + SubagentConfig, +} from '@qwen-code/qwen-code-core'; import { theme } from '../../../semantic-colors.js'; import { shouldShowColor, getColorForDisplay } from '../utils.js'; import { useLaunchEditor } from '../../../hooks/useLaunchEditor.js'; diff --git a/packages/cli/src/ui/components/subagents/create/DescriptionInput.tsx b/packages/cli/src/ui/components/subagents/create/DescriptionInput.tsx index 24b9f7c2..57335f39 100644 --- a/packages/cli/src/ui/components/subagents/create/DescriptionInput.tsx +++ b/packages/cli/src/ui/components/subagents/create/DescriptionInput.tsx @@ -9,7 +9,7 @@ import { Box, Text } from 'ink'; import Spinner from 'ink-spinner'; import type { WizardStepProps, WizardAction } from '../types.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 { keyMatchers, Command } from '../../../keyMatchers.js'; import { theme } from '../../../semantic-colors.js'; diff --git a/packages/cli/src/ui/components/subagents/create/ToolSelector.tsx b/packages/cli/src/ui/components/subagents/create/ToolSelector.tsx index fe4215d6..538d2eca 100644 --- a/packages/cli/src/ui/components/subagents/create/ToolSelector.tsx +++ b/packages/cli/src/ui/components/subagents/create/ToolSelector.tsx @@ -8,7 +8,7 @@ import { useState, useMemo, useEffect } from 'react'; import { Box, Text } from 'ink'; import { RadioButtonSelect } from '../../shared/RadioButtonSelect.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'; interface ToolOption { diff --git a/packages/cli/src/ui/components/subagents/manage/ActionSelectionStep.tsx b/packages/cli/src/ui/components/subagents/manage/ActionSelectionStep.tsx index 4fc112fb..793d5082 100644 --- a/packages/cli/src/ui/components/subagents/manage/ActionSelectionStep.tsx +++ b/packages/cli/src/ui/components/subagents/manage/ActionSelectionStep.tsx @@ -35,8 +35,8 @@ export const ActionSelectionStep = ({ const actions = selectedAgent?.isBuiltin ? allActions.filter( - (action) => action.value === 'view' || action.value === 'back', - ) + (action) => action.value === 'view' || action.value === 'back', + ) : allActions; const handleActionSelect = (value: 'view' | 'edit' | 'delete' | 'back') => { diff --git a/packages/cli/src/ui/components/subagents/manage/AgentSelectionStep.tsx b/packages/cli/src/ui/components/subagents/manage/AgentSelectionStep.tsx index c64cb946..fd5517fd 100644 --- a/packages/cli/src/ui/components/subagents/manage/AgentSelectionStep.tsx +++ b/packages/cli/src/ui/components/subagents/manage/AgentSelectionStep.tsx @@ -318,12 +318,12 @@ export const AgentSelectionStep = ({ {(projectAgents.length > 0 || userAgents.length > 0 || builtinAgents.length > 0) && ( - - - Using: {enabledAgentsCount} agents - - - )} + + + Using: {enabledAgentsCount} agents + + + )} ); }; diff --git a/packages/cli/src/ui/components/subagents/manage/AgentsManagerDialog.tsx b/packages/cli/src/ui/components/subagents/manage/AgentsManagerDialog.tsx index 73cb3c0b..36d65034 100644 --- a/packages/cli/src/ui/components/subagents/manage/AgentsManagerDialog.tsx +++ b/packages/cli/src/ui/components/subagents/manage/AgentsManagerDialog.tsx @@ -17,7 +17,7 @@ import { MANAGEMENT_STEPS } from '../types.js'; import { Colors } from '../../../colors.js'; import { theme } from '../../../semantic-colors.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 { onClose: () => void; @@ -170,8 +170,8 @@ export function AgentsManagerDialog({ // Use agent color for the Agent Viewer header const headerColor = currentStep === MANAGEMENT_STEPS.AGENT_VIEWER && - selectedAgent && - shouldShowColor(selectedAgent.color) + selectedAgent && + shouldShowColor(selectedAgent.color) ? getColorForDisplay(selectedAgent.color) : undefined; diff --git a/packages/cli/src/ui/components/subagents/runtime/AgentExecutionDisplay.tsx b/packages/cli/src/ui/components/subagents/runtime/AgentExecutionDisplay.tsx index d8113dd6..685e31b1 100644 --- a/packages/cli/src/ui/components/subagents/runtime/AgentExecutionDisplay.tsx +++ b/packages/cli/src/ui/components/subagents/runtime/AgentExecutionDisplay.tsx @@ -167,8 +167,8 @@ export const AgentExecutionDisplay: React.FC = ({ {(data.status === 'completed' || data.status === 'failed' || data.status === 'cancelled') && ( - - )} + + )} {/* Footer with keyboard shortcuts */} {footerText && ( diff --git a/packages/cli/src/ui/components/subagents/types.ts b/packages/cli/src/ui/components/subagents/types.ts index 1b9d8a48..b4574e5a 100644 --- a/packages/cli/src/ui/components/subagents/types.ts +++ b/packages/cli/src/ui/components/subagents/types.ts @@ -4,7 +4,7 @@ * 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. diff --git a/packages/cli/src/ui/hooks/useDialogClose.ts b/packages/cli/src/ui/hooks/useDialogClose.ts index fc842fb3..1711210a 100644 --- a/packages/cli/src/ui/hooks/useDialogClose.ts +++ b/packages/cli/src/ui/hooks/useDialogClose.ts @@ -6,7 +6,7 @@ import { useCallback } from 'react'; 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 { // Theme dialog diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts index 7d05d98c..c3c49929 100644 --- a/packages/core/src/core/client.ts +++ b/packages/core/src/core/client.ts @@ -15,8 +15,8 @@ import type { Tool, } from '@google/genai'; import { ProxyAgent, setGlobalDispatcher } from 'undici'; -import { UserTierId } from '../code_assist/types.js'; -import { Config } from '../config/config.js'; +import type { UserTierId } from '../code_assist/types.js'; +import type { Config } from '../config/config.js'; import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js'; import type { File, IdeContext } from '../ide/ideContext.js'; import { ideContext } from '../ide/ideContext.js'; diff --git a/packages/core/src/core/openaiContentGenerator/pipeline.ts b/packages/core/src/core/openaiContentGenerator/pipeline.ts index d2922fab..bf4b3892 100644 --- a/packages/core/src/core/openaiContentGenerator/pipeline.ts +++ b/packages/core/src/core/openaiContentGenerator/pipeline.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import OpenAI from 'openai'; +import type OpenAI from 'openai'; import { type GenerateContentParameters, GenerateContentResponse, } from '@google/genai'; -import { Config } from '../../config/config.js'; +import type { Config } from '../../config/config.js'; import { type ContentGeneratorConfig } from '../contentGenerator.js'; import { type OpenAICompatibleProvider } from './provider/index.js'; import { OpenAIContentConverter } from './converter.js'; diff --git a/packages/core/src/subagents/subagent-events.ts b/packages/core/src/subagents/subagent-events.ts index de677b5b..19ec0971 100644 --- a/packages/core/src/subagents/subagent-events.ts +++ b/packages/core/src/subagents/subagent-events.ts @@ -5,8 +5,8 @@ */ import { EventEmitter } from 'events'; -import { - type ToolCallConfirmationDetails, +import type { + ToolCallConfirmationDetails, ToolConfirmationOutcome, } from '../tools/tools.js'; diff --git a/packages/core/src/subagents/subagent-manager.test.ts b/packages/core/src/subagents/subagent-manager.test.ts index 7f7f74d9..7f31d601 100644 --- a/packages/core/src/subagents/subagent-manager.test.ts +++ b/packages/core/src/subagents/subagent-manager.test.ts @@ -10,8 +10,8 @@ import * as path from 'path'; import * as os from 'os'; import { SubagentManager } from './subagent-manager.js'; import { type SubagentConfig, SubagentError } from './types.js'; -import { ToolRegistry } from '../tools/tool-registry.js'; -import { Config } from '../config/config.js'; +import type { ToolRegistry } from '../tools/tool-registry.js'; +import type { Config } from '../config/config.js'; import { makeFakeConfig } from '../test-utils/config.js'; // Mock file system operations diff --git a/packages/core/src/subagents/subagent-manager.ts b/packages/core/src/subagents/subagent-manager.ts index 3b2629fc..5ec6abf3 100644 --- a/packages/core/src/subagents/subagent-manager.ts +++ b/packages/core/src/subagents/subagent-manager.ts @@ -27,7 +27,7 @@ import type { import { SubagentError, SubagentErrorCode } from './types.js'; import { SubagentValidator } from './validation.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'; const QWEN_CONFIG_DIR = '.qwen'; diff --git a/packages/core/src/subagents/subagent.test.ts b/packages/core/src/subagents/subagent.test.ts index cc7ab0f1..b774c693 100644 --- a/packages/core/src/subagents/subagent.test.ts +++ b/packages/core/src/subagents/subagent.test.ts @@ -26,7 +26,7 @@ import { DEFAULT_GEMINI_MODEL } from '../config/models.js'; import { createContentGenerator } from '../core/contentGenerator.js'; import { GeminiChat } from '../core/geminiChat.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 { getEnvironmentContext } from '../utils/environmentContext.js'; import { ContextState, SubAgentScope } from './subagent.js'; diff --git a/packages/core/src/subagents/subagent.ts b/packages/core/src/subagents/subagent.ts index 0f787888..02cf0e73 100644 --- a/packages/core/src/subagents/subagent.ts +++ b/packages/core/src/subagents/subagent.ts @@ -5,7 +5,7 @@ */ 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 { CoreToolScheduler, @@ -43,7 +43,10 @@ import type { SubAgentStreamTextEvent, SubAgentErrorEvent, } from './subagent-events.js'; -import { SubAgentEventEmitter, SubAgentEventType } from './subagent-events.js'; +import { + type SubAgentEventEmitter, + SubAgentEventType, +} from './subagent-events.js'; import { SubagentStatistics, type SubagentStatsSummary, diff --git a/packages/core/src/tools/task.test.ts b/packages/core/src/tools/task.test.ts index 9de30ab9..eeea0b76 100644 --- a/packages/core/src/tools/task.test.ts +++ b/packages/core/src/tools/task.test.ts @@ -8,13 +8,13 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import { TaskTool, type TaskParams } from './task.js'; import type { PartListUnion } from '@google/genai'; 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 { type SubagentConfig, SubagentTerminateMode, } 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'; // Type for accessing protected methods in tests diff --git a/packages/core/src/tools/task.ts b/packages/core/src/tools/task.ts index ef0d411b..75eedc1e 100644 --- a/packages/core/src/tools/task.ts +++ b/packages/core/src/tools/task.ts @@ -15,8 +15,8 @@ import type { ToolCallConfirmationDetails, ToolConfirmationPayload, } from './tools.js'; -import { Config } from '../config/config.js'; -import { SubagentManager } from '../subagents/subagent-manager.js'; +import type { Config } from '../config/config.js'; +import type { SubagentManager } from '../subagents/subagent-manager.js'; import { type SubagentConfig, SubagentTerminateMode, diff --git a/packages/core/src/utils/nextSpeakerChecker.test.ts b/packages/core/src/utils/nextSpeakerChecker.test.ts index 5c7019b0..e38beb81 100644 --- a/packages/core/src/utils/nextSpeakerChecker.test.ts +++ b/packages/core/src/utils/nextSpeakerChecker.test.ts @@ -13,7 +13,7 @@ import { type Mock, afterEach, } 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 { GeminiClient } from '../core/client.js'; import { Config } from '../config/config.js'; diff --git a/packages/core/src/utils/subagentGenerator.test.ts b/packages/core/src/utils/subagentGenerator.test.ts index 2f687678..3651048a 100644 --- a/packages/core/src/utils/subagentGenerator.test.ts +++ b/packages/core/src/utils/subagentGenerator.test.ts @@ -13,7 +13,7 @@ import { type Mock, afterEach, } 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 { GeminiClient } from '../core/client.js'; import { Config } from '../config/config.js'; diff --git a/packages/core/src/utils/subagentGenerator.ts b/packages/core/src/utils/subagentGenerator.ts index 58e8a121..ae5867db 100644 --- a/packages/core/src/utils/subagentGenerator.ts +++ b/packages/core/src/utils/subagentGenerator.ts @@ -4,9 +4,9 @@ * 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 { 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.