diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index 8bcd87de..09040cfa 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -56,12 +56,12 @@ import { RadioButtonSelect } from './components/shared/RadioButtonSelect.js'; import { ModelSelectionDialog } from './components/ModelSelectionDialog.js'; import { ModelSwitchDialog, - VisionSwitchOutcome, + type VisionSwitchOutcome, } from './components/ModelSwitchDialog.js'; import { AVAILABLE_MODELS_QWEN, getOpenAIAvailableModelFromEnv, - AvailableModel, + type AvailableModel, } from './models/availableModels.js'; import { processVisionSwitchOutcome } from './hooks/useVisionAutoSwitch.js'; import { diff --git a/packages/cli/src/ui/commands/modelCommand.ts b/packages/cli/src/ui/commands/modelCommand.ts index 20ce783f..9e4fdcb0 100644 --- a/packages/cli/src/ui/commands/modelCommand.ts +++ b/packages/cli/src/ui/commands/modelCommand.ts @@ -5,17 +5,17 @@ */ import { AuthType } from '@qwen-code/qwen-code-core'; -import { +import type { SlashCommand, CommandContext, - CommandKind, OpenDialogActionReturn, MessageActionReturn, } from './types.js'; +import { CommandKind } from './types.js'; import { AVAILABLE_MODELS_QWEN, getOpenAIAvailableModelFromEnv, - AvailableModel, + type AvailableModel, } from '../models/availableModels.js'; function getAvailableModelsForAuthType(authType: AuthType): AvailableModel[] { diff --git a/packages/cli/src/ui/components/ModelSelectionDialog.test.tsx b/packages/cli/src/ui/components/ModelSelectionDialog.test.tsx index 436b7146..4a5b6bcf 100644 --- a/packages/cli/src/ui/components/ModelSelectionDialog.test.tsx +++ b/packages/cli/src/ui/components/ModelSelectionDialog.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { render } from 'ink-testing-library'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import { ModelSelectionDialog } from './ModelSelectionDialog.js'; -import { AvailableModel } from '../models/availableModels.js'; -import { RadioSelectItem } from './shared/RadioButtonSelect.js'; +import type { AvailableModel } from '../models/availableModels.js'; +import type { RadioSelectItem } from './shared/RadioButtonSelect.js'; // Mock the useKeypress hook const mockUseKeypress = vi.hoisted(() => vi.fn()); diff --git a/packages/cli/src/ui/components/ModelSelectionDialog.tsx b/packages/cli/src/ui/components/ModelSelectionDialog.tsx index 7dbc570a..d43e69f3 100644 --- a/packages/cli/src/ui/components/ModelSelectionDialog.tsx +++ b/packages/cli/src/ui/components/ModelSelectionDialog.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 { Colors } from '../colors.js'; import { @@ -12,7 +12,7 @@ import { type RadioSelectItem, } from './shared/RadioButtonSelect.js'; import { useKeypress } from '../hooks/useKeypress.js'; -import { AvailableModel } from '../models/availableModels.js'; +import type { AvailableModel } from '../models/availableModels.js'; export interface ModelSelectionDialogProps { availableModels: AvailableModel[]; diff --git a/packages/cli/src/ui/components/ModelSwitchDialog.tsx b/packages/cli/src/ui/components/ModelSwitchDialog.tsx index 62b9bbce..1a8c73d4 100644 --- a/packages/cli/src/ui/components/ModelSwitchDialog.tsx +++ b/packages/cli/src/ui/components/ModelSwitchDialog.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 { Colors } from '../colors.js'; import { diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 2e48e798..125620cf 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -39,7 +39,7 @@ import type { LoadedSettings } from '../../config/settings.js'; // --- MOCKS --- const mockSendMessageStream = vi .fn() - .mockReturnValue((async function* () { })()); + .mockReturnValue((async function* () {})()); const mockStartChat = vi.fn(); const MockedGeminiClientClass = vi.hoisted(() => @@ -52,7 +52,7 @@ const MockedGeminiClientClass = vi.hoisted(() => ); const MockedUserPromptEvent = vi.hoisted(() => - vi.fn().mockImplementation(() => { }), + vi.fn().mockImplementation(() => {}), ); const mockParseAndFormatApiError = vi.hoisted(() => vi.fn()); @@ -237,7 +237,7 @@ describe('useGeminiStream', () => { } as unknown as any); // GeminiChat -> any mockSendMessageStream .mockClear() - .mockReturnValue((async function* () { })()); + .mockReturnValue((async function* () {})()); handleAtCommandSpy = vi.spyOn(atCommandProcessor, 'handleAtCommand'); }); @@ -295,12 +295,12 @@ describe('useGeminiStream', () => { props.handleSlashCommand, props.shellModeActive, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ); }, { @@ -456,12 +456,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -535,12 +535,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -643,12 +643,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -752,12 +752,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -813,7 +813,7 @@ describe('useGeminiStream', () => { if (options.isActive) { keypressCallback = callback; } else { - keypressCallback = () => { }; + keypressCallback = () => {}; } }); }); @@ -828,7 +828,7 @@ describe('useGeminiStream', () => { const mockStream = (async function* () { yield { type: 'content', value: 'Part 1' }; // Keep the stream open - await new Promise(() => { }); + await new Promise(() => {}); })(); mockSendMessageStream.mockReturnValue(mockStream); @@ -867,7 +867,7 @@ describe('useGeminiStream', () => { const mockStream = (async function* () { yield { type: 'content', value: 'Part 1' }; // Keep the stream open - await new Promise(() => { }); + await new Promise(() => {}); })(); mockSendMessageStream.mockReturnValue(mockStream); @@ -881,11 +881,11 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, + () => {}, + () => {}, cancelSubmitSpy, ), ); @@ -1192,12 +1192,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, mockPerformMemoryRefresh, false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1245,12 +1245,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1295,12 +1295,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1343,12 +1343,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1392,12 +1392,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1481,12 +1481,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1596,12 +1596,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1674,12 +1674,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1728,12 +1728,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1937,12 +1937,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -1969,12 +1969,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -2022,12 +2022,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); @@ -2059,12 +2059,12 @@ describe('useGeminiStream', () => { mockHandleSlashCommand, false, () => 'vscode' as EditorType, - () => { }, + () => {}, () => Promise.resolve(), false, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, ), ); diff --git a/packages/cli/src/ui/hooks/useVisionAutoSwitch.test.ts b/packages/cli/src/ui/hooks/useVisionAutoSwitch.test.ts index 21e4636c..ee7c1059 100644 --- a/packages/cli/src/ui/hooks/useVisionAutoSwitch.test.ts +++ b/packages/cli/src/ui/hooks/useVisionAutoSwitch.test.ts @@ -7,8 +7,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; -import { Part, PartListUnion } from '@google/genai'; -import { AuthType, Config } from '@qwen-code/qwen-code-core'; +import type { Part, PartListUnion } from '@google/genai'; +import { AuthType, type Config } from '@qwen-code/qwen-code-core'; import { shouldOfferVisionSwitch, processVisionSwitchOutcome, diff --git a/packages/cli/src/ui/hooks/useVisionAutoSwitch.ts b/packages/cli/src/ui/hooks/useVisionAutoSwitch.ts index b9569b37..36764ee5 100644 --- a/packages/cli/src/ui/hooks/useVisionAutoSwitch.ts +++ b/packages/cli/src/ui/hooks/useVisionAutoSwitch.ts @@ -5,7 +5,7 @@ */ import { type PartListUnion, type Part } from '@google/genai'; -import { AuthType, Config } from '@qwen-code/qwen-code-core'; +import { AuthType, type Config } from '@qwen-code/qwen-code-core'; import { useCallback, useRef } from 'react'; import { VisionSwitchOutcome } from '../components/ModelSwitchDialog.js'; import { @@ -13,7 +13,7 @@ import { isVisionModel, } from '../models/availableModels.js'; import { MessageType } from '../types.js'; -import { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { UseHistoryManagerReturn } from './useHistoryManager.js'; /** * Checks if a PartListUnion contains image parts diff --git a/packages/core/src/core/openaiContentGenerator/pipeline.ts b/packages/core/src/core/openaiContentGenerator/pipeline.ts index 95950aa6..a6bd5533 100644 --- a/packages/core/src/core/openaiContentGenerator/pipeline.ts +++ b/packages/core/src/core/openaiContentGenerator/pipeline.ts @@ -9,10 +9,10 @@ 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'; +import type { OpenAIContentConverter } from './converter.js'; import type { TelemetryService, RequestContext } from './telemetryService.js'; import type { ErrorHandler } from './errorHandler.js'; diff --git a/packages/core/src/utils/request-tokenizer/imageTokenizer.ts b/packages/core/src/utils/request-tokenizer/imageTokenizer.ts index 5bd4f2cf..5fbeb128 100644 --- a/packages/core/src/utils/request-tokenizer/imageTokenizer.ts +++ b/packages/core/src/utils/request-tokenizer/imageTokenizer.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ImageMetadata } from './types.js'; +import type { ImageMetadata } from './types.js'; /** * Image tokenizer for calculating image tokens based on dimensions diff --git a/packages/core/src/utils/request-tokenizer/requestTokenizer.test.ts b/packages/core/src/utils/request-tokenizer/requestTokenizer.test.ts index 7e4493d4..cb69163b 100644 --- a/packages/core/src/utils/request-tokenizer/requestTokenizer.test.ts +++ b/packages/core/src/utils/request-tokenizer/requestTokenizer.test.ts @@ -6,7 +6,7 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { DefaultRequestTokenizer } from './requestTokenizer.js'; -import { CountTokensParameters } from '@google/genai'; +import type { CountTokensParameters } from '@google/genai'; describe('DefaultRequestTokenizer', () => { let tokenizer: DefaultRequestTokenizer; diff --git a/packages/core/src/utils/request-tokenizer/requestTokenizer.ts b/packages/core/src/utils/request-tokenizer/requestTokenizer.ts index 5f1bd16c..173bb261 100644 --- a/packages/core/src/utils/request-tokenizer/requestTokenizer.ts +++ b/packages/core/src/utils/request-tokenizer/requestTokenizer.ts @@ -4,8 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CountTokensParameters, Content, Part, PartUnion } from '@google/genai'; -import { +import type { + CountTokensParameters, + Content, + Part, + PartUnion, +} from '@google/genai'; +import type { RequestTokenizer, TokenizerConfig, TokenCalculationResult, diff --git a/packages/core/src/utils/request-tokenizer/types.ts b/packages/core/src/utils/request-tokenizer/types.ts index b7c09f21..38c47699 100644 --- a/packages/core/src/utils/request-tokenizer/types.ts +++ b/packages/core/src/utils/request-tokenizer/types.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CountTokensParameters } from '@google/genai'; +import type { CountTokensParameters } from '@google/genai'; /** * Token calculation result for different content types