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
3 changes: 2 additions & 1 deletion packages/core/src/agents/a2a-client-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import {
type SendMessageResult,
} 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,
createAuthenticatingFetchWithRetry,
ClientFactoryOptions,
type AuthenticationHandler,
type Client,
} from '@a2a-js/sdk/client';
import { debugLogger } from '../utils/debugLogger.js';

Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/agents/agentLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import {
AgentLoadError,
} from './agentLoader.js';
import { GEMINI_MODEL_ALIAS_PRO } from '../config/models.js';
import type { LocalAgentDefinition } from './types.js';
import { DEFAULT_MAX_TIME_MINUTES, DEFAULT_MAX_TURNS } from './types.js';
import {
DEFAULT_MAX_TIME_MINUTES,
DEFAULT_MAX_TURNS,
type LocalAgentDefinition,
} from './types.js';

describe('loader', () => {
let tempDir: string;
Expand Down
15 changes: 7 additions & 8 deletions packages/core/src/agents/local-executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ import {
AgentFinishEvent,
RecoveryAttemptEvent,
} from '../telemetry/types.js';
import type {
AgentInputs,
LocalAgentDefinition,
SubagentActivityEvent,
OutputConfig,
import {
AgentTerminateMode,
type AgentInputs,
type LocalAgentDefinition,
type SubagentActivityEvent,
type OutputConfig,
} from './types.js';
import { AgentTerminateMode } from './types.js';
import type { AnyDeclarativeTool, AnyToolInvocation } from '../tools/tools.js';
import type { ToolCallRequestInfo } from '../scheduler/types.js';
import { CompressionStatus } from '../core/turn.js';
Expand All @@ -69,8 +69,7 @@ import type {
ModelConfigKey,
ResolvedModelConfig,
} from '../services/modelConfigService.js';
import type { AgentRegistry } from './registry.js';
import { getModelConfigAlias } from './registry.js';
import { getModelConfigAlias, type AgentRegistry } from './registry.js';
import type { ModelRouterService } from '../routing/modelRouterService.js';

const {
Expand Down
24 changes: 11 additions & 13 deletions packages/core/src/agents/local-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import type { Config } from '../config/config.js';
import { reportError } from '../utils/errorReporting.js';
import { GeminiChat, StreamEventType } from '../core/geminiChat.js';
import { Type } from '@google/genai';
import type {
Content,
Part,
FunctionCall,
FunctionDeclaration,
Schema,
import {
Type,
type Content,
type Part,
type FunctionCall,
type FunctionDeclaration,
type Schema,
} from '@google/genai';
import { ToolRegistry } from '../tools/tool-registry.js';
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
Expand All @@ -33,17 +33,15 @@ import {
LlmRole,
RecoveryAttemptEvent,
} from '../telemetry/types.js';
import type {
LocalAgentDefinition,
AgentInputs,
OutputObject,
SubagentActivityEvent,
} from './types.js';
import {
AgentTerminateMode,
DEFAULT_QUERY_STRING,
DEFAULT_MAX_TURNS,
DEFAULT_MAX_TIME_MINUTES,
type LocalAgentDefinition,
type AgentInputs,
type OutputObject,
type SubagentActivityEvent,
} from './types.js';
import { getErrorMessage } from '../utils/errors.js';
import { templateString } from './utils.js';
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/agents/local-invocation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import {
afterEach,
type Mocked,
} from 'vitest';
import type {
LocalAgentDefinition,
SubagentActivityEvent,
AgentInputs,
SubagentProgress,
import {
AgentTerminateMode,
type LocalAgentDefinition,
type SubagentActivityEvent,
type AgentInputs,
type SubagentProgress,
} from './types.js';
import { LocalSubagentInvocation } from './local-invocation.js';
import { LocalAgentExecutor } from './local-executor.js';
import { AgentTerminateMode } from './types.js';
import { makeFakeConfig } from '../test-utils/config.js';
import type { Config } from '../config/config.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js';
Expand Down
26 changes: 14 additions & 12 deletions packages/core/src/agents/remote-invocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type {
ToolConfirmationOutcome,
ToolResult,
ToolCallConfirmationDetails,
import {
BaseToolInvocation,
type ToolConfirmationOutcome,
type ToolResult,
type ToolCallConfirmationDetails,
} from '../tools/tools.js';
import { BaseToolInvocation } from '../tools/tools.js';
import { DEFAULT_QUERY_STRING } from './types.js';
import type {
RemoteAgentInputs,
RemoteAgentDefinition,
AgentInputs,
import {
DEFAULT_QUERY_STRING,
type RemoteAgentInputs,
type RemoteAgentDefinition,
type AgentInputs,
} from './types.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js';
import { A2AClientManager } from './a2a-client-manager.js';
import {
A2AClientManager,
type SendMessageResult,
} from './a2a-client-manager.js';
import { extractIdsFromResponse, A2AResultReassembler } from './a2aUtils.js';
import { GoogleAuth } from 'google-auth-library';
import type { AuthenticationHandler } from '@a2a-js/sdk/client';
import { debugLogger } from '../utils/debugLogger.js';
import type { AnsiOutput } from '../utils/terminalSerializer.js';
import type { SendMessageResult } from './a2a-client-manager.js';
import { A2AAuthProviderFactory } from './auth-provider/factory.js';

/**
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/agents/subagent-tool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { SubagentTool } from './subagent-tool.js';
import { SubagentToolWrapper } from './subagent-tool-wrapper.js';
import { Kind } from '../tools/tools.js';
import {
Kind,
type DeclarativeTool,
type ToolCallConfirmationDetails,
type ToolInvocation,
type ToolResult,
} from '../tools/tools.js';
import type {
LocalAgentDefinition,
RemoteAgentDefinition,
Expand All @@ -17,12 +23,6 @@ import { makeFakeConfig } from '../test-utils/config.js';
import { createMockMessageBus } from '../test-utils/mock-message-bus.js';
import type { Config } from '../config/config.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js';
import type {
DeclarativeTool,
ToolCallConfirmationDetails,
ToolInvocation,
ToolResult,
} from '../tools/tools.js';
import {
GeminiCliOperation,
GEN_AI_AGENT_DESCRIPTION,
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/code_assist/codeAssist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { ContentGenerator } from '../core/contentGenerator.js';
import { AuthType } from '../core/contentGenerator.js';
import { AuthType, type ContentGenerator } from '../core/contentGenerator.js';
import { getOauthClient } from './oauth2.js';
import { setupUser } from './setup.js';
import type { HttpOptions } from './server.js';
import { CodeAssistServer } from './server.js';
import { CodeAssistServer, type HttpOptions } from './server.js';
import type { Config } from '../config/config.js';
import { LoggingContentGenerator } from '../core/loggingContentGenerator.js';

Expand Down
10 changes: 4 additions & 6 deletions packages/core/src/code_assist/converter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@
*/

import { describe, it, expect } from 'vitest';
import type { CaGenerateContentResponse } from './converter.js';
import {
toGenerateContentRequest,
fromGenerateContentResponse,
toContents,
type CaGenerateContentResponse,
} from './converter.js';
import type {
ContentListUnion,
GenerateContentParameters,
Part,
} from '@google/genai';
import {
GenerateContentResponse,
FinishReason,
BlockedReason,
type ContentListUnion,
type GenerateContentParameters,
type Part,
} from '@google/genai';

describe('converter', () => {
Expand Down
44 changes: 22 additions & 22 deletions packages/core/src/code_assist/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type {
Content,
ContentListUnion,
ContentUnion,
GenerateContentConfig,
GenerateContentParameters,
CountTokensParameters,
CountTokensResponse,
GenerationConfigRoutingConfig,
MediaResolution,
Candidate,
ModelSelectionConfig,
GenerateContentResponsePromptFeedback,
GenerateContentResponseUsageMetadata,
Part,
SafetySetting,
PartUnion,
SpeechConfigUnion,
ThinkingConfig,
ToolListUnion,
ToolConfig,
import {
GenerateContentResponse,
type Content,
type ContentListUnion,
type ContentUnion,
type GenerateContentConfig,
type GenerateContentParameters,
type CountTokensParameters,
type CountTokensResponse,
type GenerationConfigRoutingConfig,
type MediaResolution,
type Candidate,
type ModelSelectionConfig,
type GenerateContentResponsePromptFeedback,
type GenerateContentResponseUsageMetadata,
type Part,
type SafetySetting,
type PartUnion,
type SpeechConfigUnion,
type ThinkingConfig,
type ToolListUnion,
type ToolConfig,
} from '@google/genai';
import { GenerateContentResponse } from '@google/genai';
import { debugLogger } from '../utils/debugLogger.js';
import type { Credits } from './types.js';

Expand Down
19 changes: 15 additions & 4 deletions packages/core/src/code_assist/oauth2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { Credentials } from 'google-auth-library';
import type { Mock } from 'vitest';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
OAuth2Client,
Compute,
GoogleAuth,
type Credentials,
} from 'google-auth-library';
import {
describe,
it,
expect,
vi,
beforeEach,
afterEach,
type Mock,
} from 'vitest';
import {
getOauthClient,
resetOauthClientForTesting,
Expand All @@ -15,7 +27,6 @@ import {
authEvents,
} from './oauth2.js';
import { UserAccountManager } from '../utils/userAccountManager.js';
import { OAuth2Client, Compute, GoogleAuth } from 'google-auth-library';
import * as fs from 'node:fs';
import * as path from 'node:path';
import http from 'node:http';
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/code_assist/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { Credentials, AuthClient, JWTInput } from 'google-auth-library';
import {
OAuth2Client,
Compute,
CodeChallengeMethod,
GoogleAuth,
type Credentials,
type AuthClient,
type JWTInput,
} from 'google-auth-library';
import * as http from 'node:http';
import url from 'node:url';
Expand Down
44 changes: 21 additions & 23 deletions packages/core/src/code_assist/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
*/

import type { AuthClient } from 'google-auth-library';
import type {
CodeAssistGlobalUserSettingResponse,
LoadCodeAssistRequest,
LoadCodeAssistResponse,
LongRunningOperationResponse,
OnboardUserRequest,
SetCodeAssistGlobalUserSettingRequest,
ClientMetadata,
RetrieveUserQuotaRequest,
RetrieveUserQuotaResponse,
FetchAdminControlsRequest,
FetchAdminControlsResponse,
ConversationOffered,
ConversationInteraction,
StreamingLatency,
RecordCodeAssistMetricsRequest,
GeminiUserTier,
Credits,
import {
UserTierId,
type CodeAssistGlobalUserSettingResponse,
type LoadCodeAssistRequest,
type LoadCodeAssistResponse,
type LongRunningOperationResponse,
type OnboardUserRequest,
type SetCodeAssistGlobalUserSettingRequest,
type ClientMetadata,
type RetrieveUserQuotaRequest,
type RetrieveUserQuotaResponse,
type FetchAdminControlsRequest,
type FetchAdminControlsResponse,
type ConversationOffered,
type ConversationInteraction,
type StreamingLatency,
type RecordCodeAssistMetricsRequest,
type GeminiUserTier,
type Credits,
} from './types.js';
import { UserTierId } from './types.js';
import type {
ListExperimentsRequest,
ListExperimentsResponse,
Expand All @@ -49,15 +49,13 @@ import {
} from '../billing/billing.js';
import { logBillingEvent } from '../telemetry/loggers.js';
import { CreditsUsedEvent } from '../telemetry/billingEvents.js';
import type {
CaCountTokenResponse,
CaGenerateContentResponse,
} from './converter.js';
import {
fromCountTokenResponse,
fromGenerateContentResponse,
toCountTokenRequest,
toGenerateContentRequest,
type CaCountTokenResponse,
type CaGenerateContentResponse,
} from './converter.js';
import {
formatProtoJsonDuration,
Expand Down
Loading
Loading