Skip to content
Open
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
8 changes: 4 additions & 4 deletions core/test/a2a/a2a_agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
} from '@a2a-js/sdk';
import {ClientFactory} from '@a2a-js/sdk/client';
import {ExecutionEventBus, RequestContext} from '@a2a-js/sdk/server';
import {Language, Outcome} from '@google/genai';
import {beforeEach, describe, expect, it, Mock, vi} from 'vitest';
import {A2AEvent} from '../../src/a2a/a2a_event.js';
import {
A2AAgentExecutor,
Event as AdkEvent,
Expand All @@ -27,10 +30,7 @@ import {
Runner,
RunnerConfig,
Session,
} from '@google/adk';
import {Language, Outcome} from '@google/genai';
import {beforeEach, describe, expect, it, Mock, vi} from 'vitest';
import {A2AEvent} from '../../src/a2a/a2a_event.js';
} from '../../src/index.js';

vi.mock('@a2a-js/sdk/client', () => {
const Client = vi.fn().mockImplementation(() => ({
Expand Down
2 changes: 1 addition & 1 deletion core/test/a2a/agent_card_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
LoopAgent,
ParallelAgent,
SequentialAgent,
} from '@google/adk';
} from '../../src/index.js';

// Minimal CustomAgent for testing BaseAgent path
class CustomAgent extends BaseAgent {
Expand Down
4 changes: 2 additions & 2 deletions core/test/a2a/agent_executor_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import {TaskStatusUpdateEvent, TextPart} from '@a2a-js/sdk';
import {ExecutionEventBus, RequestContext} from '@a2a-js/sdk/server';
import {beforeEach, describe, expect, it, Mocked, vi} from 'vitest';
import {
A2AAgentExecutor,
Event as AdkEvent,
Expand All @@ -15,8 +16,7 @@ import {
Runner,
RunnerConfig,
Session,
} from '@google/adk';
import {beforeEach, describe, expect, it, Mocked, vi} from 'vitest';
} from '../../src/index.js';

// Mock the Runner to control its async generator
vi.mock('../../src/runner/runner.js', async (importOriginal) => {
Expand Down
2 changes: 1 addition & 1 deletion core/test/a2a/event_converter_utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {
TaskArtifactUpdateEvent,
TaskStatusUpdateEvent,
} from '@a2a-js/sdk';
import {createEvent, createEventActions} from '@google/adk';
import {describe, expect, it, vi} from 'vitest';
import {A2AEvent} from '../../src/a2a/a2a_event.js';
import {toA2AMessage, toAdkEvent} from '../../src/a2a/event_converter_utils.js';
import {createEvent, createEventActions} from '../../src/index.js';
import * as envAwareUtils from '../../src/utils/env_aware_utils.js';

vi.mock('../../src/utils/env_aware_utils.js', async (importOriginal) => {
Expand Down
12 changes: 6 additions & 6 deletions core/test/a2a/event_processor_utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
*/

import {DataPart, Task, TextPart} from '@a2a-js/sdk';
import {
Event as AdkEvent,
ExecutorContext,
createEvent,
createEventActions,
} from '@google/adk';
import {Content as GenAIContent} from '@google/genai';
import {describe, expect, it, vi} from 'vitest';
import {
getFinalTaskStatusUpdate,
getTaskInputRequiredEvent,
} from '../../src/a2a/event_processor_utils.js';
import {
Event as AdkEvent,
ExecutorContext,
createEvent,
createEventActions,
} from '../../src/index.js';

import {toA2AParts} from '../../src/a2a/part_converter_utils.js';

Expand Down
2 changes: 1 addition & 1 deletion core/test/a2a/executor_context_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/

import {RequestContext} from '@a2a-js/sdk/server';
import {Session} from '@google/adk';
import {Content} from '@google/genai';
import {describe, expect, it} from 'vitest';
import {createExecutorContext} from '../../src/a2a/executor_context.js';
import {Session} from '../../src/index.js';

describe('createExecutorContext', () => {
const mockUserContent: Content = {role: 'user', parts: [{text: 'hello'}]};
Expand Down
2 changes: 1 addition & 1 deletion core/test/a2a/metadata_converter_utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import {Message, Task} from '@a2a-js/sdk';
import {Event as AdkEvent, createEventActions} from '@google/adk';
import {describe, expect, it} from 'vitest';
import {toAdkEvent} from '../../src/a2a/event_converter_utils.js';
import {
Expand All @@ -14,6 +13,7 @@ import {
getA2AEventMetadata,
getAdkEventMetadata,
} from '../../src/a2a/metadata_converter_utils.js';
import {Event as AdkEvent, createEventActions} from '../../src/index.js';

describe('metadata_converter_utils', () => {
describe('getAdkEventMetadata', () => {
Expand Down
4 changes: 2 additions & 2 deletions core/test/a2a/remote_agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import {
ClientFactory,
DefaultAgentCardResolver,
} from '@a2a-js/sdk/client';
import {beforeEach, describe, expect, it, vi} from 'vitest';
import {
Event as AdkEvent,
createEvent,
InvocationContext,
RemoteA2AAgent,
RemoteA2AAgentConfig,
Session,
} from '@google/adk';
import {beforeEach, describe, expect, it, vi} from 'vitest';
} from '../../src/index.js';

type A2AStreamEventData =
| Message
Expand Down
2 changes: 1 addition & 1 deletion core/test/agents/active_streaming_tool_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {ActiveStreamingTool, Task} from '@google/adk';
import {describe, expect, it} from 'vitest';
import {ActiveStreamingTool, Task} from '../../src/index.js';

describe('ActiveStreamingTool', () => {
it('should construct with default parameters', () => {
Expand Down
4 changes: 2 additions & 2 deletions core/test/agents/base_agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {describe, expect, it} from 'vitest';
import {
AgentTransferLlmRequestProcessor,
BaseAgent,
Expand All @@ -15,8 +16,7 @@ import {
PluginManager,
Session,
createEvent,
} from '@google/adk';
import {describe, expect, it} from 'vitest';
} from '../../src/index.js';

class MockAgent extends BaseAgent {
constructor(config: BaseAgentConfig) {
Expand Down
23 changes: 11 additions & 12 deletions core/test/agents/functions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {FunctionCall} from '@google/genai';
import {beforeEach, describe, expect, it, vi} from 'vitest';
import {z} from 'zod';
import {
findEventByFunctionCallId,
findMatchingFunctionCall,
generateClientFunctionCallId,
getLongRunningFunctionCalls,
mergeParallelFunctionResponseEvents,
} from '../../src/agents/functions.js';
import {
BasePlugin,
BaseTool,
Expand All @@ -18,17 +28,7 @@ import {
SingleAfterToolCallback,
SingleBeforeToolCallback,
ToolConfirmation,
} from '@google/adk';
import {FunctionCall} from '@google/genai';
import {beforeEach, describe, expect, it, vi} from 'vitest';
import {z} from 'zod';
import {
findEventByFunctionCallId,
findMatchingFunctionCall,
generateClientFunctionCallId,
getLongRunningFunctionCalls,
mergeParallelFunctionResponseEvents,
} from '../../src/agents/functions.js';
} from '../../src/index.js';

// Get the test target function
const {
Expand Down Expand Up @@ -709,7 +709,6 @@ describe('getLongRunningFunctionCalls', () => {
isLongRunning: false,
}),
};
// @ts-expect-error ts will argue about toolsDict because getLongRunningFunctionCalls is improted from the source and BaseTool is imported from '@google/adk'.
const result = getLongRunningFunctionCalls(functionCalls, toolsDict);
expect(result.has('call-1')).toBe(true);
expect(result.has('call-2')).toBe(false);
Expand Down
2 changes: 1 addition & 1 deletion core/test/agents/instructions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {InvocationContext, ReadonlyContext} from '@google/adk';
import {describe, expect, it, vi} from 'vitest';
import {injectSessionState} from '../../src/agents/instructions.js';
import {InvocationContext, ReadonlyContext} from '../../src/index.js';

/**
* Builds a minimal ReadonlyContext backed by a plain-object invocation context.
Expand Down
4 changes: 2 additions & 2 deletions core/test/agents/invocation_context_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {describe, expect, it} from 'vitest';
import {
BaseAgent,
BaseAgentConfig,
Expand All @@ -13,8 +14,7 @@ import {
PluginManager,
Session,
createEvent,
} from '@google/adk';
import {describe, expect, it} from 'vitest';
} from '../../src/index.js';

function makeSession(): Session {
return {
Expand Down
2 changes: 1 addition & 1 deletion core/test/agents/live_request_queue_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {LiveRequest, LiveRequestQueue} from '@google/adk';
import {createUserContent} from '@google/genai';
import {describe, expect, it} from 'vitest';
import {LiveRequest, LiveRequestQueue} from '../../src/index.js';

describe('LiveRequestQueue', () => {
it('should handle sendContent', async () => {
Expand Down
26 changes: 13 additions & 13 deletions core/test/agents/llm_agent_auth_integration_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {
BaseLlm,
BaseLlmConnection,
Event,
getFunctionCalls,
getFunctionResponses,
InMemorySessionService,
LlmAgent,
LlmRequest,
LlmResponse,
RestApiTool,
Runner,
} from '@google/adk';
import * as http from 'http';
import {OpenAPIV3} from 'openapi-types';
import {
Expand All @@ -29,6 +16,19 @@ import {
it,
vi,
} from 'vitest';
import {
BaseLlm,
BaseLlmConnection,
Event,
getFunctionCalls,
getFunctionResponses,
InMemorySessionService,
LlmAgent,
LlmRequest,
LlmResponse,
RestApiTool,
Runner,
} from '../../src/index.js';

class MockLlm extends BaseLlm {
responses: LlmResponse[] = [];
Expand Down
10 changes: 5 additions & 5 deletions core/test/agents/llm_agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {Content, Schema, Type} from '@google/genai';
import {beforeEach, describe, expect, it} from 'vitest';
import {z as z3} from 'zod/v3';
import {z as z4} from 'zod/v4';
import {
AUTH_PREPROCESSOR,
BaseLlm,
Expand All @@ -25,11 +29,7 @@ import {
RunAsyncToolRequest,
Session,
ToolProcessLlmRequest,
} from '@google/adk';
import {Content, Schema, Type} from '@google/genai';
import {beforeEach, describe, expect, it} from 'vitest';
import {z as z3} from 'zod/v3';
import {z as z4} from 'zod/v4';
} from '../../src/index.js';

class MockLlmConnection implements BaseLlmConnection {
sendHistory(_history: Content[]): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions core/test/agents/loop_agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {describe, expect, it} from 'vitest';
import {
BaseAgent,
BaseAgentConfig,
Expand All @@ -15,8 +16,7 @@ import {
createEvent,
createEventActions,
isLoopAgent,
} from '@google/adk';
import {describe, expect, it} from 'vitest';
} from '../../src/index.js';

class MockSubAgent extends BaseAgent {
private eventsToYield: Event[];
Expand Down
4 changes: 2 additions & 2 deletions core/test/agents/parallel_agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {describe, expect, it} from 'vitest';
import {
BaseAgent,
BaseAgentConfig,
Expand All @@ -14,8 +15,7 @@ import {
createEvent,
createSession,
isParallelAgent,
} from '@google/adk';
import {describe, expect, it} from 'vitest';
} from '../../src/index.js';

class MockSubAgent extends BaseAgent {
private eventsToYield: Event[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {describe, expect, it} from 'vitest';
import {
AgentTransferLlmRequestProcessor,
BaseAgent,
Expand All @@ -13,8 +14,7 @@ import {
LlmAgent,
LlmRequest,
PluginManager,
} from '@google/adk';
import {describe, expect, it} from 'vitest';
} from '../../../src/index.js';

const AGENT_TRANSFER_LLM_REQUEST_PROCESSOR =
new AgentTransferLlmRequestProcessor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {Content, Blob as GenaiBlob, Modality} from '@google/genai';
import {beforeAll, describe, expect, it} from 'vitest';
import {BASIC_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/basic_llm_request_processor.js';
import {
BaseAgent,
BaseLlm,
Expand All @@ -17,10 +20,7 @@ import {
LlmResponse,
PluginManager,
RunConfig,
} from '@google/adk';
import {Content, Blob as GenaiBlob, Modality} from '@google/genai';
import {beforeAll, describe, expect, it} from 'vitest';
import {BASIC_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/basic_llm_request_processor.js';
} from '../../../src/index.js';

class TestLlmConnection implements BaseLlmConnection {
async sendHistory(_history: Content[]): Promise<void> {}
Expand Down
Loading
Loading