Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/a2a-server/src/agent/task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ import {
type Mock,
} from 'vitest';
import { Task } from './task.js';
import type {
ToolCall,
Config,
ToolCallRequestInfo,
GitService,
CompletedToolCall,
} from '@google/gemini-cli-core';
import {
GeminiEventType,
type Config,
type ToolCallRequestInfo,
type GitService,
type CompletedToolCall,
ApprovalMode,
ToolConfirmationOutcome,
} from '@google/gemini-cli-core';
import { createMockConfig } from '../utils/testing_utils.js';
import type { ExecutionEventBus, RequestContext } from '@a2a-js/sdk/server';
import { CoderAgentEvent } from '../types.js';
import type { ToolCall } from '@google/gemini-cli-core';

const mockProcessRestorableToolCalls = vi.hoisted(() => vi.fn());

Expand Down
3 changes: 1 addition & 2 deletions packages/a2a-server/src/agent/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import {
EDIT_TOOL_NAMES,
processRestorableToolCalls,
} from '@google/gemini-cli-core';
import type { RequestContext } from '@a2a-js/sdk/server';
import { type ExecutionEventBus } from '@a2a-js/sdk/server';
import type { RequestContext, ExecutionEventBus } from '@a2a-js/sdk/server';
import type {
TaskStatusUpdateEvent,
TaskArtifactUpdateEvent,
Expand Down
8 changes: 5 additions & 3 deletions packages/a2a-server/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import * as dotenv from 'dotenv';

import type { TelemetryTarget } from '@google/gemini-cli-core';
import type {
TelemetryTarget,
ConfigParameters,
ExtensionLoader,
} from '@google/gemini-cli-core';
import {
AuthType,
Config,
type ConfigParameters,
FileDiscoveryService,
ApprovalMode,
loadServerHierarchicalMemory,
GEMINI_DIR,
DEFAULT_GEMINI_EMBEDDING_MODEL,
type ExtensionLoader,
startupProfiler,
PREVIEW_GEMINI_MODEL,
homedir,
Expand Down
9 changes: 4 additions & 5 deletions packages/a2a-server/src/http/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { Config } from '@google/gemini-cli-core';
import {
GeminiEventType,
ApprovalMode,
type ToolCallConfirmationDetails,
import type {
Config,
ToolCallConfirmationDetails,
} from '@google/gemini-cli-core';
import { GeminiEventType, ApprovalMode } from '@google/gemini-cli-core';
import type {
TaskStatusUpdateEvent,
SendStreamingMessageSuccessResponse,
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/agents/a2a-client-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import {
} from './a2a-client-manager.js';
import type { AgentCard, Task } from '@a2a-js/sdk';
import type { AuthenticationHandler, Client } from '@a2a-js/sdk/client';
import { ClientFactory, DefaultAgentCardResolver } from '@a2a-js/sdk/client';
import { debugLogger } from '../utils/debugLogger.js';
import {
ClientFactory,
DefaultAgentCardResolver,
createAuthenticatingFetchWithRetry,
ClientFactoryOptions,
} from '@a2a-js/sdk/client';
import { debugLogger } from '../utils/debugLogger.js';

vi.mock('../utils/debugLogger.js', () => ({
debugLogger: {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/agents/agentLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import yaml from 'js-yaml';
import { load } from 'js-yaml';
import * as fs from 'node:fs/promises';
import { type Dirent } from 'node:fs';
import * as path from 'node:path';
Expand Down Expand Up @@ -262,7 +262,7 @@ export async function parseAgentMarkdown(

let rawFrontmatter: unknown;
try {
rawFrontmatter = yaml.load(frontmatterStr);
rawFrontmatter = load(frontmatterStr);
} catch (error) {
throw new AgentLoadError(
filePath,
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/agents/local-invocation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
*/

import { describe, it, expect, vi, beforeEach, type Mocked } from 'vitest';
import type { LocalAgentDefinition } from './types.js';
import type {
LocalAgentDefinition,
SubagentActivityEvent,
AgentInputs,
} from './types.js';
import { LocalSubagentInvocation } from './local-invocation.js';
import { LocalAgentExecutor } from './local-executor.js';
import type { SubagentActivityEvent, AgentInputs } from './types.js';
import { AgentTerminateMode } from './types.js';
import { makeFakeConfig } from '../test-utils/config.js';
import { ToolErrorType } from '../tools/tool-error.js';
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/agents/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { AgentRegistry, getModelConfigAlias } from './registry.js';
import { makeFakeConfig } from '../test-utils/config.js';
import type { AgentDefinition, LocalAgentDefinition } from './types.js';
import type { Config, GeminiCLIExtension } from '../config/config.js';
import type {
Config,
GeminiCLIExtension,
ConfigParameters,
} from '../config/config.js';
import { debugLogger } from '../utils/debugLogger.js';
import { coreEvents, CoreEvent } from '../utils/events.js';
import { A2AClientManager } from './a2a-client-manager.js';
Expand All @@ -22,7 +26,6 @@ import {
} from '../config/models.js';
import * as tomlLoader from './agentLoader.js';
import { SimpleExtensionLoader } from '../utils/extensionLoader.js';
import type { ConfigParameters } from '../config/config.js';
import type { ToolRegistry } from '../tools/tool-registry.js';
import { ThinkingLevel } from '@google/genai';
import type { AcknowledgedAgentsService } from './acknowledgedAgents.js';
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/agents/remote-invocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { ToolConfirmationOutcome } from '../tools/tools.js';
import {
BaseToolInvocation,
type ToolResult,
type ToolCallConfirmationDetails,
import type {
ToolConfirmationOutcome,
ToolResult,
ToolCallConfirmationDetails,
} from '../tools/tools.js';
import { BaseToolInvocation } from '../tools/tools.js';
import { DEFAULT_QUERY_STRING } from './types.js';
import type {
RemoteAgentInputs,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/code_assist/converter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import {
import type {
ContentListUnion,
GenerateContentParameters,
Part,
} from '@google/genai';
import {
GenerateContentResponse,
FinishReason,
BlockedReason,
type Part,
} from '@google/genai';

describe('converter', () => {
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { setGeminiMdFilename as mockSetGeminiMdFilename } from '../tools/memoryT
import {
DEFAULT_TELEMETRY_TARGET,
DEFAULT_OTLP_ENDPOINT,
uiTelemetryService,
} from '../telemetry/index.js';
import type { ContentGeneratorConfig } from '../core/contentGenerator.js';
import {
Expand Down Expand Up @@ -201,14 +202,15 @@ vi.mock('../services/contextManager.js', () => ({

import { BaseLlmClient } from '../core/baseLlmClient.js';
import { tokenLimit } from '../core/tokenLimits.js';
import { uiTelemetryService } from '../telemetry/index.js';
import { getCodeAssistServer } from '../code_assist/codeAssist.js';
import { getExperiments } from '../code_assist/experiments/experiments.js';
import type { CodeAssistServer } from '../code_assist/server.js';
import { ContextManager } from '../services/contextManager.js';
import { UserTierId } from '../code_assist/types.js';
import type { ModelConfigService } from '../services/modelConfigService.js';
import type { ModelConfigServiceConfig } from '../services/modelConfigService.js';
import type {
ModelConfigService,
ModelConfigServiceConfig,
} from '../services/modelConfigService.js';
import { ExitPlanModeTool } from '../tools/exit-plan-mode.js';
import { EnterPlanModeTool } from '../tools/enter-plan-mode.js';

Expand Down
19 changes: 11 additions & 8 deletions packages/core/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ import { ideContextStore } from '../ide/ideContext.js';
import { WriteTodosTool } from '../tools/write-todos.js';
import type { FileSystemService } from '../services/fileSystemService.js';
import { StandardFileSystemService } from '../services/fileSystemService.js';
import { logRipgrepFallback, logFlashFallback } from '../telemetry/loggers.js';
import {
logRipgrepFallback,
logFlashFallback,
logApprovalModeSwitch,
logApprovalModeDuration,
} from '../telemetry/loggers.js';
import {
RipgrepFallbackEvent,
FlashFallbackEvent,
Expand Down Expand Up @@ -103,9 +108,11 @@ import type { EventEmitter } from 'node:events';
import { PolicyEngine } from '../policy/policy-engine.js';
import { ApprovalMode, type PolicyEngineConfig } from '../policy/types.js';
import { HookSystem } from '../hooks/index.js';
import type { UserTierId } from '../code_assist/types.js';
import type { RetrieveUserQuotaResponse } from '../code_assist/types.js';
import type { AdminControlsSettings } from '../code_assist/types.js';
import type {
UserTierId,
RetrieveUserQuotaResponse,
AdminControlsSettings,
} from '../code_assist/types.js';
import type { HierarchicalMemory } from './memory.js';
import { getCodeAssistServer } from '../code_assist/codeAssist.js';
import type { Experiments } from '../code_assist/experiments/experiments.js';
Expand All @@ -119,10 +126,6 @@ import { debugLogger } from '../utils/debugLogger.js';
import { SkillManager, type SkillDefinition } from '../skills/skillManager.js';
import { startupProfiler } from '../telemetry/startupProfiler.js';
import type { AgentDefinition } from '../agents/types.js';
import {
logApprovalModeSwitch,
logApprovalModeDuration,
} from '../telemetry/loggers.js';
import { fetchAdminControls } from '../code_assist/admin/admin_controls.js';
import { isSubpath } from '../utils/paths.js';
import { UserHintService } from './userHintService.js';
Expand Down
10 changes: 6 additions & 4 deletions packages/core/src/core/baseLlmClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@ import {
type Mock,
} from 'vitest';

import { BaseLlmClient, type GenerateJsonOptions } from './baseLlmClient.js';
import type {
GenerateContentOptions,
GenerateJsonOptions,
} from './baseLlmClient.js';
import { BaseLlmClient } from './baseLlmClient.js';
import type { ContentGenerator } from './contentGenerator.js';
import type { ModelAvailabilityService } from '../availability/modelAvailabilityService.js';
import { createAvailabilityServiceMock } from '../availability/testUtils.js';
import type { GenerateContentOptions } from './baseLlmClient.js';
import type { GenerateContentResponse } from '@google/genai';
import type { Config } from '../config/config.js';
import { AuthType } from './contentGenerator.js';
import { reportError } from '../utils/errorReporting.js';
import { logMalformedJsonResponse } from '../telemetry/loggers.js';
import { retryWithBackoff } from '../utils/retry.js';
import { MalformedJsonResponseEvent } from '../telemetry/types.js';
import { MalformedJsonResponseEvent, LlmRole } from '../telemetry/types.js';
import { getErrorMessage } from '../utils/errors.js';
import type { ModelConfigService } from '../services/modelConfigService.js';
import { makeResolvedModelConfig } from '../services/modelConfigServiceTestUtils.js';
import { LlmRole } from '../telemetry/types.js';

vi.mock('../utils/errorReporting.js');
vi.mock('../telemetry/loggers.js');
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/core/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import {
getInitialChatHistory,
} from '../utils/environmentContext.js';
import type { ServerGeminiStreamEvent, ChatCompressionInfo } from './turn.js';
import { CompressionStatus } from './turn.js';
import { Turn, GeminiEventType } from './turn.js';
import { CompressionStatus, Turn, GeminiEventType } from './turn.js';
import type { Config } from '../config/config.js';
import { getCoreSystemPrompt } from './prompts.js';
import { checkNextSpeaker } from '../utils/nextSpeakerChecker.js';
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/core/coreToolHookTriggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

import { type McpToolContext, BeforeToolHookOutput } from '../hooks/types.js';
import type { Config } from '../config/config.js';
import type { ToolResult, AnyDeclarativeTool } from '../tools/tools.js';
import type {
ToolResult,
AnyDeclarativeTool,
AnyToolInvocation,
} from '../tools/tools.js';
import { ToolErrorType } from '../tools/tool-error.js';
import { debugLogger } from '../utils/debugLogger.js';
import type { AnsiOutput, ShellExecutionConfig } from '../index.js';
import type { AnyToolInvocation } from '../tools/tools.js';
import { ShellToolInvocation } from '../tools/shell.js';
import { DiscoveredMCPToolInvocation } from '../tools/mcp-tool.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/hookAggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
BeforeToolSelectionHookOutput,
AfterModelHookOutput,
AfterAgentHookOutput,
HookEventName,
} from './types.js';
import { HookEventName } from './types.js';

/**
* Aggregated hook result
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/hooks/hookEventHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import type {
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { HookEventHandler } from './hookEventHandler.js';
import type { Config } from '../config/config.js';
import type { HookConfig } from './types.js';
import type { HookPlanner } from './hookPlanner.js';
import type { HookRunner } from './hookRunner.js';
import type { HookAggregator } from './hookAggregator.js';
import { HookEventName, HookType } from './types.js';
import type { HookConfig, HookExecutionResult } from './types.js';
import {
NotificationType,
SessionStartSource,
type HookExecutionResult,
HookEventName,
HookType,
} from './types.js';
import type { HookPlanner } from './hookPlanner.js';
import type { HookRunner } from './hookRunner.js';
import type { HookAggregator } from './hookAggregator.js';

// Mock debugLogger
const mockDebugLogger = vi.hoisted(() => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/hooks/hookPlanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import type { HookRegistry, HookRegistryEntry } from './hookRegistry.js';
import type { HookExecutionPlan } from './types.js';
import { getHookKey, type HookEventName } from './types.js';
import type { HookExecutionPlan, HookEventName } from './types.js';
import { getHookKey } from './types.js';
import { debugLogger } from '../utils/debugLogger.js';

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/hooks/hookRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process';
import { HookRunner } from './hookRunner.js';
import { HookEventName, HookType, ConfigSource } from './types.js';
import type { HookConfig } from './types.js';
import type { HookInput } from './types.js';
import type { HookConfig, HookInput } from './types.js';
import type { Readable, Writable } from 'node:stream';
import type { Config } from '../config/config.js';

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/ide/ide-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { vi } from 'vitest';
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';

vi.mock('node:child_process', async (importOriginal) => {
const actual = await importOriginal();
Expand All @@ -24,7 +24,6 @@ vi.mock('../utils/paths.js', async (importOriginal) => {
};
});

import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { getIdeInstaller } from './ide-installer.js';
import * as child_process from 'node:child_process';
import * as fs from 'node:fs';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/scheduler/state-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import type {
ExecutingToolCall,
ToolCallResponseInfo,
} from './types.js';
import { CoreToolCallStatus } from './types.js';
import { ROOT_SCHEDULER_ID } from './types.js';
import { CoreToolCallStatus, ROOT_SCHEDULER_ID } from './types.js';
import type {
ToolConfirmationOutcome,
ToolResultDisplay,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/scheduler/tool-executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { ToolExecutor } from './tool-executor.js';
import type { Config } from '../index.js';
import type { Config, AnyToolInvocation } from '../index.js';
import type { ToolResult } from '../tools/tools.js';
import { makeFakeConfig } from '../test-utils/config.js';
import { MockTool } from '../test-utils/mock-tool.js';
import type { ScheduledToolCall } from './types.js';
import { CoreToolCallStatus } from './types.js';
import type { AnyToolInvocation } from '../index.js';
import { SHELL_TOOL_NAME } from '../tools/tool-names.js';
import * as fileUtils from '../utils/fileUtils.js';
import * as coreToolHookTriggers from '../core/coreToolHookTriggers.js';
Expand Down
Loading
Loading