From bf509cdd506971b81f77c90aab00d2c4b20f299c Mon Sep 17 00:00:00 2001 From: Amaad Martin Date: Sun, 2 Aug 2026 02:49:55 -0700 Subject: [PATCH 1/4] Chore: import ADK symbols from source in core/test, not the package specifier core/test mixed two ways of importing ADK symbols: 125 statements used the package specifier '@google/adk' and 3 used deep subpaths under it, while other files imported relatively from ../../src. TypeScript resolves the package specifier through the node_modules/@google/adk workspace symlink to the built declarations in core/dist/types, so it saw two structurally identical but nominally distinct copies of every class carrying a private member or a brand symbol. That produced 124 spurious errors of the "separate declarations of a private property" and "Property '[BASE_AGENT_SIGNATURE_SYMBOL]' is missing" families under tsc --noEmit. No such duplication exists at runtime: vitest.config.ts already aliases '@google/adk' to ./core/src for every project, so the suite has always loaded exactly one copy, from source. Only TypeScript disagreed with the runtime. Rewrite the 128 affected import statements to depth-correct relative paths into core/src, so tsc sees the same single copy vitest does, and run prettier so the rewritten specifiers land in their new sort order. The 3 deep subpaths are additionally unresolvable for a real consumer: core/package.json exports declares only ".". tsc --noEmit: 281 -> 157 errors. Test-only change; no src file is touched and no runtime module graph changes. --- core/test/a2a/a2a_agent_test.ts | 8 +++--- core/test/a2a/agent_card_test.ts | 2 +- core/test/a2a/agent_executor_test.ts | 4 +-- core/test/a2a/event_converter_utils_test.ts | 2 +- core/test/a2a/event_processor_utils_test.ts | 12 ++++----- core/test/a2a/executor_context_test.ts | 2 +- .../test/a2a/metadata_converter_utils_test.ts | 2 +- core/test/a2a/remote_agent_test.ts | 4 +-- .../test/agents/active_streaming_tool_test.ts | 2 +- core/test/agents/base_agent_test.ts | 4 +-- core/test/agents/functions_test.ts | 22 ++++++++-------- core/test/agents/instructions_test.ts | 2 +- core/test/agents/invocation_context_test.ts | 4 +-- core/test/agents/live_request_queue_test.ts | 2 +- .../agents/llm_agent_auth_integration_test.ts | 26 +++++++++---------- core/test/agents/llm_agent_test.ts | 10 +++---- core/test/agents/loop_agent_test.ts | 4 +-- core/test/agents/parallel_agent_test.ts | 4 +-- ...ent_transfer_llm_request_processor_test.ts | 4 +-- .../basic_llm_request_processor_test.ts | 8 +++--- .../code_execution_request_processor_test.ts | 16 ++++++------ .../content_processor_utils_test.ts | 2 +- .../content_request_processor_test.ts | 4 +-- ...ontext_compactor_request_processor_test.ts | 4 +-- .../identity_llm_request_processor_test.ts | 6 ++--- ...instructions_llm_request_processor_test.ts | 6 ++--- .../interactions_request_processor_test.ts | 4 +-- ...confirmation_llm_request_processor_test.ts | 6 ++--- .../tool_filter_request_processor_test.ts | 10 +++---- core/test/agents/routed_agent_test.ts | 4 +-- core/test/agents/sequential_agent_test.ts | 4 +-- core/test/apps/resumability_config_test.ts | 2 +- .../artifacts/artifact_service_test_utils.ts | 2 +- .../artifacts/file_artifact_service_test.ts | 2 +- .../artifacts/gcs_artifact_service_test.ts | 2 +- .../in_memory_artifact_service_test.ts | 2 +- core/test/artifacts/registry_test.ts | 4 +-- core/test/auth/auth_handler_test.ts | 7 ++++- core/test/auth/auth_preprocessor_test.ts | 6 ++--- core/test/auth/auth_provider_registry_test.ts | 6 ++++- core/test/auth/auth_schemes_test.ts | 2 +- .../in_memory_credential_service_test.ts | 4 +-- .../session_state_credential_service_test.ts | 4 +-- .../exchanger/credential_exchanger_test.ts | 6 ++++- .../oauth2_credential_exchanger_test.ts | 14 +++++----- .../test/auth/oauth2/oauth2_discovery_test.ts | 2 +- core/test/auth/oauth2/oauth2_utils_test.ts | 2 +- .../credential_refresher_registry_test.ts | 4 +-- ...agent_engine_sandbox_code_executor_test.ts | 4 +-- .../built_in_code_executor_test.ts | 4 +-- .../unsafe_local_code_executor_test.ts | 8 +++--- ...agent_controlled_context_compactor_test.ts | 4 +-- .../anchored_context_compactor_test.ts | 4 +-- .../summarizers/llm_summarizer_test.ts | 4 +-- .../token_based_context_compactor_test.ts | 4 +-- ...ajectory_thought_pruning_compactor_test.ts | 6 ++--- .../truncating_context_compactor_test.ts | 4 +-- core/test/events/compacted_event_test.ts | 2 +- core/test/events/event_test.ts | 20 +++++++------- core/test/features/feature_registry_test.ts | 4 +-- .../memory/in_memory_memory_service_test.ts | 4 +-- .../vertex_ai_memory_bank_service_test.ts | 6 ++--- core/test/models/apigee_llm_test.ts | 2 +- core/test/models/base_llm_test.ts | 4 +-- core/test/models/google_llm_test.ts | 6 ++--- core/test/models/registry_test.ts | 4 +-- core/test/models/routed_llm_test.ts | 4 +-- core/test/plugins/base_plugin_test.ts | 6 ++--- .../plugins/global_instruction_plugin_test.ts | 4 +-- core/test/plugins/logging_plugin_test.ts | 6 ++--- core/test/plugins/plugin_manager_test.ts | 6 ++--- core/test/plugins/security_plugin_test.ts | 2 +- core/test/runner/in_memory_runner_test.ts | 4 +-- core/test/runner/runner_test.ts | 6 ++--- core/test/runner/streaming_runner_test.ts | 6 ++--- .../sessions/database_session_service_test.ts | 8 +++--- .../in_memory_session_service_test.ts | 4 +-- core/test/sessions/registry_test.ts | 5 +++- .../vertex_ai_session_service_test.ts | 8 +++--- core/test/telemetry/google_cloud_test.ts | 8 +++--- core/test/telemetry/setup_test.ts | 2 +- core/test/telemetry/tracing_test.ts | 2 +- core/test/tools/agent_tool_test.ts | 4 +-- core/test/tools/base_toolset_test.ts | 4 +-- .../tools/consolidate_context_tool_test.ts | 6 ++--- .../tools/enterprise_web_search_tool_test.ts | 6 ++--- core/test/tools/example_tool_test.ts | 4 +-- core/test/tools/exit_loop_tool_test.ts | 4 +-- core/test/tools/function_tool_test.ts | 2 +- core/test/tools/get_user_choice_tool_test.ts | 6 ++++- .../tools/google_maps_grounding_tool_test.ts | 4 +-- core/test/tools/google_search_tool_test.ts | 2 +- core/test/tools/load_artifacts_tool_test.ts | 6 ++--- core/test/tools/load_memory_tool_test.ts | 2 +- core/test/tools/load_web_page_test.ts | 2 +- core/test/tools/long_running_tool_test.ts | 2 +- .../tools/mcp/load_mcp_resource_tool_test.ts | 6 ++--- .../tools/mcp/mcp_session_manager_test.ts | 2 +- core/test/tools/mcp/mcp_tool_test.ts | 8 +++--- .../openapi_tool/openapi_spec_parser_test.ts | 2 +- .../openapi_toolset_integration_test.ts | 2 +- .../openapi_tool/openapi_toolset_test.ts | 6 ++++- .../openapi_tool/operation_parser_test.ts | 2 +- .../tools/openapi_tool/rest_api_tool_test.ts | 6 ++--- .../openapi_tool/tool_auth_handler_test.ts | 4 +-- core/test/tools/preload_memory_tool_test.ts | 2 +- core/test/tools/request_input_tool_test.ts | 6 ++++- .../tools/skills/list_skills_tool_test.ts | 4 +-- .../skills/load_skill_resource_tool_test.ts | 4 +-- .../test/tools/skills/load_skill_tool_test.ts | 4 +-- .../run_skill_inline_script_tool_test.ts | 4 +-- .../skills/run_skill_script_tool_test.ts | 4 +-- core/test/tools/skills/skill_registry_test.ts | 6 ++--- core/test/tools/skills/skill_toolset_test.ts | 4 +-- core/test/tools/tool_confirmation_test.ts | 2 +- core/test/tools/url_context_tool_test.ts | 2 +- .../tools/vertex_rag_retrieval_tool_test.ts | 2 +- core/test/utils/client_labels_test.ts | 2 +- core/test/utils/file_utils_test.ts | 2 +- core/test/utils/logger_test.ts | 8 +++++- core/test/utils/model_name_test.ts | 2 +- core/test/utils/simple_zod_to_json_test.ts | 2 +- core/test/utils/task_test.ts | 2 +- core/test/utils/variant_utils_test.ts | 2 +- 124 files changed, 315 insertions(+), 281 deletions(-) diff --git a/core/test/a2a/a2a_agent_test.ts b/core/test/a2a/a2a_agent_test.ts index 613db3baa..986d08658 100644 --- a/core/test/a2a/a2a_agent_test.ts +++ b/core/test/a2a/a2a_agent_test.ts @@ -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, @@ -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(() => ({ diff --git a/core/test/a2a/agent_card_test.ts b/core/test/a2a/agent_card_test.ts index d1175d6ee..aca422ff3 100644 --- a/core/test/a2a/agent_card_test.ts +++ b/core/test/a2a/agent_card_test.ts @@ -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 { diff --git a/core/test/a2a/agent_executor_test.ts b/core/test/a2a/agent_executor_test.ts index 8876931cd..5c2642191 100644 --- a/core/test/a2a/agent_executor_test.ts +++ b/core/test/a2a/agent_executor_test.ts @@ -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, @@ -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) => { diff --git a/core/test/a2a/event_converter_utils_test.ts b/core/test/a2a/event_converter_utils_test.ts index 414d63a73..48b8e6656 100644 --- a/core/test/a2a/event_converter_utils_test.ts +++ b/core/test/a2a/event_converter_utils_test.ts @@ -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) => { diff --git a/core/test/a2a/event_processor_utils_test.ts b/core/test/a2a/event_processor_utils_test.ts index 0665e1fff..66e21ad5b 100644 --- a/core/test/a2a/event_processor_utils_test.ts +++ b/core/test/a2a/event_processor_utils_test.ts @@ -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'; diff --git a/core/test/a2a/executor_context_test.ts b/core/test/a2a/executor_context_test.ts index 4b16730a8..6fec3e087 100644 --- a/core/test/a2a/executor_context_test.ts +++ b/core/test/a2a/executor_context_test.ts @@ -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'}]}; diff --git a/core/test/a2a/metadata_converter_utils_test.ts b/core/test/a2a/metadata_converter_utils_test.ts index f6323a634..28359684c 100644 --- a/core/test/a2a/metadata_converter_utils_test.ts +++ b/core/test/a2a/metadata_converter_utils_test.ts @@ -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 { @@ -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', () => { diff --git a/core/test/a2a/remote_agent_test.ts b/core/test/a2a/remote_agent_test.ts index 13add468a..9b5672a56 100644 --- a/core/test/a2a/remote_agent_test.ts +++ b/core/test/a2a/remote_agent_test.ts @@ -16,6 +16,7 @@ import { ClientFactory, DefaultAgentCardResolver, } from '@a2a-js/sdk/client'; +import {beforeEach, describe, expect, it, vi} from 'vitest'; import { Event as AdkEvent, createEvent, @@ -23,8 +24,7 @@ import { RemoteA2AAgent, RemoteA2AAgentConfig, Session, -} from '@google/adk'; -import {beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; type A2AStreamEventData = | Message diff --git a/core/test/agents/active_streaming_tool_test.ts b/core/test/agents/active_streaming_tool_test.ts index 3bd159bd6..50e38f2d2 100644 --- a/core/test/agents/active_streaming_tool_test.ts +++ b/core/test/agents/active_streaming_tool_test.ts @@ -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', () => { diff --git a/core/test/agents/base_agent_test.ts b/core/test/agents/base_agent_test.ts index b139a1b77..75b97cd51 100644 --- a/core/test/agents/base_agent_test.ts +++ b/core/test/agents/base_agent_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { AgentTransferLlmRequestProcessor, BaseAgent, @@ -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) { diff --git a/core/test/agents/functions_test.ts b/core/test/agents/functions_test.ts index cd39ced1c..76f958806 100644 --- a/core/test/agents/functions_test.ts +++ b/core/test/agents/functions_test.ts @@ -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, @@ -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 { diff --git a/core/test/agents/instructions_test.ts b/core/test/agents/instructions_test.ts index 6b7ed862e..b298876e7 100644 --- a/core/test/agents/instructions_test.ts +++ b/core/test/agents/instructions_test.ts @@ -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. diff --git a/core/test/agents/invocation_context_test.ts b/core/test/agents/invocation_context_test.ts index ff761a677..92f808530 100644 --- a/core/test/agents/invocation_context_test.ts +++ b/core/test/agents/invocation_context_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, BaseAgentConfig, @@ -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 { diff --git a/core/test/agents/live_request_queue_test.ts b/core/test/agents/live_request_queue_test.ts index a7ccce8d7..05fc45c31 100644 --- a/core/test/agents/live_request_queue_test.ts +++ b/core/test/agents/live_request_queue_test.ts @@ -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 () => { diff --git a/core/test/agents/llm_agent_auth_integration_test.ts b/core/test/agents/llm_agent_auth_integration_test.ts index 14f6ea813..790a8323f 100644 --- a/core/test/agents/llm_agent_auth_integration_test.ts +++ b/core/test/agents/llm_agent_auth_integration_test.ts @@ -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 { @@ -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[] = []; diff --git a/core/test/agents/llm_agent_test.ts b/core/test/agents/llm_agent_test.ts index a5089bc68..37467ca1f 100644 --- a/core/test/agents/llm_agent_test.ts +++ b/core/test/agents/llm_agent_test.ts @@ -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, @@ -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 { diff --git a/core/test/agents/loop_agent_test.ts b/core/test/agents/loop_agent_test.ts index e7f583edb..19854c289 100644 --- a/core/test/agents/loop_agent_test.ts +++ b/core/test/agents/loop_agent_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, BaseAgentConfig, @@ -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[]; diff --git a/core/test/agents/parallel_agent_test.ts b/core/test/agents/parallel_agent_test.ts index 6307324b2..6c1ed8a7f 100644 --- a/core/test/agents/parallel_agent_test.ts +++ b/core/test/agents/parallel_agent_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, BaseAgentConfig, @@ -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[]; diff --git a/core/test/agents/processors/agent_transfer_llm_request_processor_test.ts b/core/test/agents/processors/agent_transfer_llm_request_processor_test.ts index d13b81a40..e175f6816 100644 --- a/core/test/agents/processors/agent_transfer_llm_request_processor_test.ts +++ b/core/test/agents/processors/agent_transfer_llm_request_processor_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { AgentTransferLlmRequestProcessor, BaseAgent, @@ -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(); diff --git a/core/test/agents/processors/basic_llm_request_processor_test.ts b/core/test/agents/processors/basic_llm_request_processor_test.ts index 888040132..969c7e2ac 100644 --- a/core/test/agents/processors/basic_llm_request_processor_test.ts +++ b/core/test/agents/processors/basic_llm_request_processor_test.ts @@ -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, @@ -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 {} diff --git a/core/test/agents/processors/code_execution_request_processor_test.ts b/core/test/agents/processors/code_execution_request_processor_test.ts index cf67f3088..407f47ea1 100644 --- a/core/test/agents/processors/code_execution_request_processor_test.ts +++ b/core/test/agents/processors/code_execution_request_processor_test.ts @@ -4,14 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - BaseAgent, - InvocationContext, - LlmAgent, - LlmRequest, - PluginManager, - createSession, -} from '@google/adk'; import {describe, expect, it} from 'vitest'; import { CODE_EXECUTION_REQUEST_PROCESSOR, @@ -22,6 +14,14 @@ import { ExecuteCodeParams, } from '../../../src/code_executors/base_code_executor.js'; import {CodeExecutionResult} from '../../../src/code_executors/code_execution_utils.js'; +import { + BaseAgent, + InvocationContext, + LlmAgent, + LlmRequest, + PluginManager, + createSession, +} from '../../../src/index.js'; class MockBaseAgent extends BaseAgent { constructor(name: string) { diff --git a/core/test/agents/processors/content_processor_utils_test.ts b/core/test/agents/processors/content_processor_utils_test.ts index c0ef218c3..606446826 100644 --- a/core/test/agents/processors/content_processor_utils_test.ts +++ b/core/test/agents/processors/content_processor_utils_test.ts @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {CompactedEvent, createEvent} from '@google/adk'; import {Content} from '@google/genai'; import {describe, expect, it} from 'vitest'; import { @@ -13,6 +12,7 @@ import { mergeFunctionResponseEvents, removeClientFunctionCallId, } from '../../../src/agents/processors/content_processor_utils.js'; +import {CompactedEvent, createEvent} from '../../../src/index.js'; describe('getContents', () => { it('should handle object responses in convertForeignEvent', () => { diff --git a/core/test/agents/processors/content_request_processor_test.ts b/core/test/agents/processors/content_request_processor_test.ts index 3fbf6f9f8..db9d6c902 100644 --- a/core/test/agents/processors/content_request_processor_test.ts +++ b/core/test/agents/processors/content_request_processor_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, CompactedEvent, @@ -15,8 +16,7 @@ import { LlmRequest, PluginManager, Session, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; function createMockEvent(id: string, timestamp: number, text: string): Event { return { diff --git a/core/test/agents/processors/context_compactor_request_processor_test.ts b/core/test/agents/processors/context_compactor_request_processor_test.ts index 3687e5de8..534e74834 100644 --- a/core/test/agents/processors/context_compactor_request_processor_test.ts +++ b/core/test/agents/processors/context_compactor_request_processor_test.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { BaseContextCompactor, ContextCompactorRequestProcessor, InvocationContext, LlmRequest, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; import {ContextCompactionTrigger} from '../../../src/plugins/base_plugin.js'; describe('ContextCompactorRequestProcessor', () => { diff --git a/core/test/agents/processors/identity_llm_request_processor_test.ts b/core/test/agents/processors/identity_llm_request_processor_test.ts index 0ff0668ae..9ce7eec12 100644 --- a/core/test/agents/processors/identity_llm_request_processor_test.ts +++ b/core/test/agents/processors/identity_llm_request_processor_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; +import {IDENTITY_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/identity_llm_request_processor.js'; import { BaseAgent, InvocationContext, @@ -11,9 +13,7 @@ import { LlmRequest, PluginManager, createSession, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; -import {IDENTITY_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/identity_llm_request_processor.js'; +} from '../../../src/index.js'; class MockRootAgent extends BaseAgent { constructor(name: string, subAgents: BaseAgent[] = []) { diff --git a/core/test/agents/processors/instructions_llm_request_processor_test.ts b/core/test/agents/processors/instructions_llm_request_processor_test.ts index 2f64e501a..a2d543368 100644 --- a/core/test/agents/processors/instructions_llm_request_processor_test.ts +++ b/core/test/agents/processors/instructions_llm_request_processor_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; +import {INSTRUCTIONS_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/instructions_llm_request_processor.js'; import { BaseAgent, createSession, @@ -13,9 +15,7 @@ import { LlmRequest, PluginManager, ReadonlyContext, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; -import {INSTRUCTIONS_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/instructions_llm_request_processor.js'; +} from '../../../src/index.js'; class MockRootAgent extends BaseAgent { constructor(name: string, subAgents: BaseAgent[] = []) { diff --git a/core/test/agents/processors/interactions_request_processor_test.ts b/core/test/agents/processors/interactions_request_processor_test.ts index e630fcb9e..b8af47a1a 100644 --- a/core/test/agents/processors/interactions_request_processor_test.ts +++ b/core/test/agents/processors/interactions_request_processor_test.ts @@ -6,6 +6,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, BaseLlm, @@ -18,8 +19,7 @@ import { LlmRequest, PluginManager, Session, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; class MockLlm extends BaseLlm { constructor() { diff --git a/core/test/agents/processors/request_confirmation_llm_request_processor_test.ts b/core/test/agents/processors/request_confirmation_llm_request_processor_test.ts index fb876a055..591b02196 100644 --- a/core/test/agents/processors/request_confirmation_llm_request_processor_test.ts +++ b/core/test/agents/processors/request_confirmation_llm_request_processor_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; +import {REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/request_confirmation_llm_request_processor.js'; import { BaseAgent, InvocationContext, @@ -13,9 +15,7 @@ import { REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, createEvent, createSession, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; -import {REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR} from '../../../src/agents/processors/request_confirmation_llm_request_processor.js'; +} from '../../../src/index.js'; vi.mock('../../../src/agents/functions.js', async (importOriginal) => { const original = diff --git a/core/test/agents/processors/tool_filter_request_processor_test.ts b/core/test/agents/processors/tool_filter_request_processor_test.ts index 949d15a94..a76775ec4 100644 --- a/core/test/agents/processors/tool_filter_request_processor_test.ts +++ b/core/test/agents/processors/tool_filter_request_processor_test.ts @@ -4,6 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; +import {handleFunctionCallsAsync} from '../../../src/agents/functions.js'; +import {TOOL_FILTER_REQUEST_PROCESSOR} from '../../../src/agents/processors/tool_filter_request_processor.js'; +import {createEvent} from '../../../src/events/event.js'; import { BaseAgent, BasePlugin, @@ -15,11 +19,7 @@ import { PluginManager, ReadonlyContext, createSession, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; -import {handleFunctionCallsAsync} from '../../../src/agents/functions.js'; -import {TOOL_FILTER_REQUEST_PROCESSOR} from '../../../src/agents/processors/tool_filter_request_processor.js'; -import {createEvent} from '../../../src/events/event.js'; +} from '../../../src/index.js'; class MockTool extends BaseTool { constructor(name: string) { diff --git a/core/test/agents/routed_agent_test.ts b/core/test/agents/routed_agent_test.ts index 4df282afe..356ec822b 100644 --- a/core/test/agents/routed_agent_test.ts +++ b/core/test/agents/routed_agent_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {beforeEach, describe, expect, it} from 'vitest'; import { BaseAgent, BaseAgentConfig, @@ -15,8 +16,7 @@ import { Session, createEvent, isRoutedAgent, -} from '@google/adk'; -import {beforeEach, describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import {Logger, setLogger} from '../../src/utils/logger.js'; class MockAgent extends BaseAgent { diff --git a/core/test/agents/sequential_agent_test.ts b/core/test/agents/sequential_agent_test.ts index 554802e71..a4f33f78b 100644 --- a/core/test/agents/sequential_agent_test.ts +++ b/core/test/agents/sequential_agent_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, BaseAgentConfig, @@ -14,8 +15,7 @@ import { isSequentialAgent, PluginManager, SequentialAgent, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; class MockSubAgent extends BaseAgent { private eventsToYield: Event[]; diff --git a/core/test/apps/resumability_config_test.ts b/core/test/apps/resumability_config_test.ts index aae5c28dd..deaf2611e 100644 --- a/core/test/apps/resumability_config_test.ts +++ b/core/test/apps/resumability_config_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {createResumabilityConfig} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {createResumabilityConfig} from '../../src/index.js'; describe('createResumabilityConfig', () => { it('should default to isResumable = false when no params given', () => { diff --git a/core/test/artifacts/artifact_service_test_utils.ts b/core/test/artifacts/artifact_service_test_utils.ts index f31e815ce..ab8850418 100644 --- a/core/test/artifacts/artifact_service_test_utils.ts +++ b/core/test/artifacts/artifact_service_test_utils.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {BaseArtifactService, CompositeSessionKey} from '@google/adk'; import {Part} from '@google/genai'; import {afterEach, beforeEach, describe, expect, it} from 'vitest'; +import {BaseArtifactService, CompositeSessionKey} from '../../src/index.js'; /** * Runs the shared artifact service tests. diff --git a/core/test/artifacts/file_artifact_service_test.ts b/core/test/artifacts/file_artifact_service_test.ts index 0356b0edd..917b65a6c 100644 --- a/core/test/artifacts/file_artifact_service_test.ts +++ b/core/test/artifacts/file_artifact_service_test.ts @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {FileArtifactService} from '@google/adk'; import * as fs from 'fs/promises'; import * as os from 'os'; import * as path from 'path'; @@ -14,6 +13,7 @@ import { getSessionArtifactsDir, getUserRoot, } from '../../src/artifacts/file_artifact_service.js'; +import {FileArtifactService} from '../../src/index.js'; import {runArtifactServiceTests} from './artifact_service_test_utils.js'; describe('FileArtifactService', () => { diff --git a/core/test/artifacts/gcs_artifact_service_test.ts b/core/test/artifacts/gcs_artifact_service_test.ts index 14c4b92ea..b9ee7a54a 100644 --- a/core/test/artifacts/gcs_artifact_service_test.ts +++ b/core/test/artifacts/gcs_artifact_service_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {GcsArtifactService} from '@google/adk'; import {describe, expect, it, vi} from 'vitest'; +import {GcsArtifactService} from '../../src/index.js'; import {runArtifactServiceTests} from './artifact_service_test_utils.js'; const {StorageMock, storageMock} = vi.hoisted(() => { diff --git a/core/test/artifacts/in_memory_artifact_service_test.ts b/core/test/artifacts/in_memory_artifact_service_test.ts index 4fa2f9049..404320323 100644 --- a/core/test/artifacts/in_memory_artifact_service_test.ts +++ b/core/test/artifacts/in_memory_artifact_service_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {InMemoryArtifactService} from '@google/adk'; import {describe} from 'vitest'; +import {InMemoryArtifactService} from '../../src/index.js'; import {runArtifactServiceTests} from './artifact_service_test_utils.js'; describe('InMemoryArtifactService', () => { diff --git a/core/test/artifacts/registry_test.ts b/core/test/artifacts/registry_test.ts index 3e664f051..15228e685 100644 --- a/core/test/artifacts/registry_test.ts +++ b/core/test/artifacts/registry_test.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { FileArtifactService, GcsArtifactService, InMemoryArtifactService, getArtifactServiceFromUri, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; describe('getArtifactServiceFromUri', () => { it('returns InMemoryArtifactService for memory uri', () => { diff --git a/core/test/auth/auth_handler_test.ts b/core/test/auth/auth_handler_test.ts index f657c68a0..865b6e6f2 100644 --- a/core/test/auth/auth_handler_test.ts +++ b/core/test/auth/auth_handler_test.ts @@ -4,8 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {AuthConfig, AuthCredentialTypes, AuthHandler, State} from '@google/adk'; import {describe, expect, it, vi} from 'vitest'; +import { + AuthConfig, + AuthCredentialTypes, + AuthHandler, + State, +} from '../../src/index.js'; vi.mock('../../src/auth/oauth2/oauth2_credential_exchanger.js', () => ({ OAuth2CredentialExchanger: class { diff --git a/core/test/auth/auth_preprocessor_test.ts b/core/test/auth/auth_preprocessor_test.ts index a9a29b34a..efda6b685 100644 --- a/core/test/auth/auth_preprocessor_test.ts +++ b/core/test/auth/auth_preprocessor_test.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Mock, describe, expect, it, vi} from 'vitest'; +import {REQUEST_EUC_FUNCTION_CALL_NAME} from '../../src/agents/functions.js'; import { AUTH_PREPROCESSOR, Event, InvocationContext, createEvent, -} from '@google/adk'; -import {Mock, describe, expect, it, vi} from 'vitest'; -import {REQUEST_EUC_FUNCTION_CALL_NAME} from '../../src/agents/functions.js'; +} from '../../src/index.js'; vi.mock('../../src/agents/functions.js', async (importOriginal) => { const actual = (await importOriginal()) as { diff --git a/core/test/auth/auth_provider_registry_test.ts b/core/test/auth/auth_provider_registry_test.ts index ab295ef2b..81f924a9e 100644 --- a/core/test/auth/auth_provider_registry_test.ts +++ b/core/test/auth/auth_provider_registry_test.ts @@ -4,8 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {AuthProviderRegistry, AuthScheme, BaseAuthProvider} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import { + AuthProviderRegistry, + AuthScheme, + BaseAuthProvider, +} from '../../src/index.js'; // Mock auth provider for testing class MockAuthProvider implements BaseAuthProvider { diff --git a/core/test/auth/auth_schemes_test.ts b/core/test/auth/auth_schemes_test.ts index f5b526a2b..3c63aad0f 100644 --- a/core/test/auth/auth_schemes_test.ts +++ b/core/test/auth/auth_schemes_test.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {OAuthGrantType} from '@google/adk'; import {describe, expect, it} from 'vitest'; import {getOAuthGrantTypeFromFlow} from '../../src/auth/auth_schemes.js'; +import {OAuthGrantType} from '../../src/index.js'; describe('auth_schemes', () => { describe('getOAuthGrantTypeFromFlow', () => { diff --git a/core/test/auth/credential_service/in_memory_credential_service_test.ts b/core/test/auth/credential_service/in_memory_credential_service_test.ts index 7ae4cbaf1..64eb1b688 100644 --- a/core/test/auth/credential_service/in_memory_credential_service_test.ts +++ b/core/test/auth/credential_service/in_memory_credential_service_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { AuthConfig, AuthCredential, @@ -13,8 +14,7 @@ import { InMemoryCredentialService, InvocationContext, createSession, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; function createMockContext(appName: string, userId: string): Context { return new Context({ diff --git a/core/test/auth/credential_service/session_state_credential_service_test.ts b/core/test/auth/credential_service/session_state_credential_service_test.ts index 3ebe3a366..213461ba2 100644 --- a/core/test/auth/credential_service/session_state_credential_service_test.ts +++ b/core/test/auth/credential_service/session_state_credential_service_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { AuthConfig, AuthCredential, @@ -11,8 +12,7 @@ import { AuthScheme, Context, SessionStateCredentialService, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; describe('SessionStateCredentialService', () => { it('should load credential from state', async () => { diff --git a/core/test/auth/exchanger/credential_exchanger_test.ts b/core/test/auth/exchanger/credential_exchanger_test.ts index 404f209b1..3f5c1f043 100644 --- a/core/test/auth/exchanger/credential_exchanger_test.ts +++ b/core/test/auth/exchanger/credential_exchanger_test.ts @@ -4,10 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {AuthCredential, AuthCredentialTypes, AuthScheme} from '@google/adk'; import {describe, expect, it} from 'vitest'; import {BaseCredentialExchanger} from '../../../src/auth/exchanger/base_credential_exchanger.js'; import {CredentialExchangerRegistry} from '../../../src/auth/exchanger/credential_exchanger_registry.js'; +import { + AuthCredential, + AuthCredentialTypes, + AuthScheme, +} from '../../../src/index.js'; // Mock credential exchanger for testing class MockCredentialExchanger implements BaseCredentialExchanger { diff --git a/core/test/auth/oauth2/oauth2_credential_exchanger_test.ts b/core/test/auth/oauth2/oauth2_credential_exchanger_test.ts index 9214afae4..a9e940abe 100644 --- a/core/test/auth/oauth2/oauth2_credential_exchanger_test.ts +++ b/core/test/auth/oauth2/oauth2_credential_exchanger_test.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - AuthCredential, - AuthScheme, - CredentialExchangeError, - OAuth2CredentialExchanger, - OAuthGrantType, -} from '@google/adk'; import {describe, expect, it, vi} from 'vitest'; import { determineGrantType, @@ -18,6 +11,13 @@ import { exchangeClientCredentials, } from '../../../src/auth/oauth2/oauth2_credential_exchanger.js'; import * as oauth2Utils from '../../../src/auth/oauth2/oauth2_utils.js'; +import { + AuthCredential, + AuthScheme, + CredentialExchangeError, + OAuth2CredentialExchanger, + OAuthGrantType, +} from '../../../src/index.js'; vi.mock('../../../src/auth/oauth2/oauth2_utils.js', () => ({ getTokenEndpoint: vi.fn(), diff --git a/core/test/auth/oauth2/oauth2_discovery_test.ts b/core/test/auth/oauth2/oauth2_discovery_test.ts index a6f63d644..23efe48b4 100644 --- a/core/test/auth/oauth2/oauth2_discovery_test.ts +++ b/core/test/auth/oauth2/oauth2_discovery_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {OAuth2DiscoveryManager} from '@google/adk'; import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; +import {OAuth2DiscoveryManager} from '../../../src/index.js'; describe('OAuth2DiscoveryManager', () => { let manager: OAuth2DiscoveryManager; diff --git a/core/test/auth/oauth2/oauth2_utils_test.ts b/core/test/auth/oauth2/oauth2_utils_test.ts index ec88238c5..fc29120bd 100644 --- a/core/test/auth/oauth2/oauth2_utils_test.ts +++ b/core/test/auth/oauth2/oauth2_utils_test.ts @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {AuthScheme, OAuth2Auth} from '@google/adk'; import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; import { AuthorizationCodeParams, @@ -16,6 +15,7 @@ import { parseAuthorizationCode, RefreshTokenParams, } from '../../../src/auth/oauth2/oauth2_utils.js'; +import {AuthScheme, OAuth2Auth} from '../../../src/index.js'; describe('oauth2_utils', () => { describe('getTokenEndpoint', () => { diff --git a/core/test/auth/refresher/credential_refresher_registry_test.ts b/core/test/auth/refresher/credential_refresher_registry_test.ts index 4f04dc4c2..486bb4db7 100644 --- a/core/test/auth/refresher/credential_refresher_registry_test.ts +++ b/core/test/auth/refresher/credential_refresher_registry_test.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { AuthCredential, AuthCredentialTypes, BaseCredentialRefresher, CredentialRefresherRegistry, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; // Mock credential refresher for testing class MockRefresher implements BaseCredentialRefresher { diff --git a/core/test/code_executors/agent_engine_sandbox_code_executor_test.ts b/core/test/code_executors/agent_engine_sandbox_code_executor_test.ts index 24369eb95..1cc40db3b 100644 --- a/core/test/code_executors/agent_engine_sandbox_code_executor_test.ts +++ b/core/test/code_executors/agent_engine_sandbox_code_executor_test.ts @@ -5,12 +5,12 @@ */ import {Client} from '@google-cloud/vertexai'; +import {beforeEach, describe, expect, it, vi} from 'vitest'; import { AgentEngineSandboxCodeExecutor, CodeExecutionLanguage, InvocationContext, -} from '@google/adk'; -import {beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; describe('AgentEngineSandboxCodeExecutor', () => { let executor: AgentEngineSandboxCodeExecutor; diff --git a/core/test/code_executors/built_in_code_executor_test.ts b/core/test/code_executors/built_in_code_executor_test.ts index 7d9901600..1cc8003e9 100644 --- a/core/test/code_executors/built_in_code_executor_test.ts +++ b/core/test/code_executors/built_in_code_executor_test.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {ExecuteCodeParams} from '@google/adk'; -import {BuiltInCodeExecutor, LlmRequest} from '@google/adk'; import {beforeEach, describe, expect, it} from 'vitest'; +import type {ExecuteCodeParams} from '../../src/index.js'; +import {BuiltInCodeExecutor, LlmRequest} from '../../src/index.js'; describe('BuiltInCodeExecutor', () => { let executor: BuiltInCodeExecutor; diff --git a/core/test/code_executors/unsafe_local_code_executor_test.ts b/core/test/code_executors/unsafe_local_code_executor_test.ts index 82a0d2d01..22912648c 100644 --- a/core/test/code_executors/unsafe_local_code_executor_test.ts +++ b/core/test/code_executors/unsafe_local_code_executor_test.ts @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {EventEmitter} from 'node:events'; +import * as os from 'node:os'; +import {beforeEach, describe, expect, it, vi} from 'vitest'; import { CodeExecutionLanguage, ExecuteCodeParams, @@ -12,10 +15,7 @@ import { PluginManager, UnsafeLocalCodeExecutor, createSession, -} from '@google/adk'; -import {EventEmitter} from 'node:events'; -import * as os from 'node:os'; -import {beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; // Only `spawn` is mocked; it defaults to the real implementation (see // `beforeEach`) so the pre-existing tests still execute real scripts. diff --git a/core/test/context/agent_controlled_context_compactor_test.ts b/core/test/context/agent_controlled_context_compactor_test.ts index 8f3c4cbe6..e20fca1e8 100644 --- a/core/test/context/agent_controlled_context_compactor_test.ts +++ b/core/test/context/agent_controlled_context_compactor_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { AgentControlledContextCompactor, BaseAgent, @@ -13,8 +14,7 @@ import { InvocationContext, PluginManager, Session, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; class MockSummarizer implements BaseSummarizer { async summarize(events: Event[]): Promise { diff --git a/core/test/context/anchored_context_compactor_test.ts b/core/test/context/anchored_context_compactor_test.ts index ae1a26d0f..c23d5c1b8 100644 --- a/core/test/context/anchored_context_compactor_test.ts +++ b/core/test/context/anchored_context_compactor_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { AnchoredContextCompactor, BaseAgent, @@ -14,8 +15,7 @@ import { PluginManager, Session, isScratchpadEvent, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; class MockSummarizer implements BaseSummarizer { async summarize(events: Event[]): Promise { diff --git a/core/test/context/summarizers/llm_summarizer_test.ts b/core/test/context/summarizers/llm_summarizer_test.ts index 2f38ffe07..76578487f 100644 --- a/core/test/context/summarizers/llm_summarizer_test.ts +++ b/core/test/context/summarizers/llm_summarizer_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseLlm, BaseLlmConnection, @@ -12,8 +13,7 @@ import { LlmResponse, LlmSummarizer, createEvent, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; class MockLlm extends BaseLlm { constructor(private responses: LlmResponse[]) { diff --git a/core/test/context/token_based_context_compactor_test.ts b/core/test/context/token_based_context_compactor_test.ts index f8e77dca2..d12ad1ff8 100644 --- a/core/test/context/token_based_context_compactor_test.ts +++ b/core/test/context/token_based_context_compactor_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, BaseSummarizer, @@ -13,8 +14,7 @@ import { PluginManager, Session, TokenBasedContextCompactor, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; class MockSummarizer implements BaseSummarizer { async summarize(events: Event[]): Promise { diff --git a/core/test/context/trajectory_thought_pruning_compactor_test.ts b/core/test/context/trajectory_thought_pruning_compactor_test.ts index d1eb7df0e..39774eed1 100644 --- a/core/test/context/trajectory_thought_pruning_compactor_test.ts +++ b/core/test/context/trajectory_thought_pruning_compactor_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {FunctionCall, FunctionResponse} from '@google/genai'; +import {describe, expect, it} from 'vitest'; import { BaseAgent, Event, @@ -11,9 +13,7 @@ import { PluginManager, Session, TrajectoryThoughtPruningCompactor, -} from '@google/adk'; -import {FunctionCall, FunctionResponse} from '@google/genai'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; function createMockEvent( id: string, diff --git a/core/test/context/truncating_context_compactor_test.ts b/core/test/context/truncating_context_compactor_test.ts index cc84ed678..5b6dbed7a 100644 --- a/core/test/context/truncating_context_compactor_test.ts +++ b/core/test/context/truncating_context_compactor_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseAgent, Event, @@ -11,8 +12,7 @@ import { PluginManager, Session, TruncatingContextCompactor, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; function createDummyEvent(id: string): Event { return { diff --git a/core/test/events/compacted_event_test.ts b/core/test/events/compacted_event_test.ts index f2fe00b83..aa157d2d7 100644 --- a/core/test/events/compacted_event_test.ts +++ b/core/test/events/compacted_event_test.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {createEvent} from '@google/adk'; import {describe, expect, it} from 'vitest'; import { createCompactedEvent, isCompactedEvent, } from '../../src/events/compacted_event.js'; +import {createEvent} from '../../src/index.js'; describe('isCompactedEvent', () => { it('returns true for a valid CompactedEvent', () => { diff --git a/core/test/events/event_test.ts b/core/test/events/event_test.ts index b429ae754..68ab24ce1 100644 --- a/core/test/events/event_test.ts +++ b/core/test/events/event_test.ts @@ -4,6 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Outcome} from '@google/genai'; +import {describe, expect, it} from 'vitest'; +import { + createNewEventId, + generateClientFunctionCallId, + populateClientFunctionCallId, + transformToCamelCaseEvent, + transformToSnakeCaseEvent, +} from '../../src/events/event.js'; import { AuthConfig, createEvent, @@ -15,16 +24,7 @@ import { isFinalResponse, pruneThoughts, stringifyContent, -} from '@google/adk'; -import {Outcome} from '@google/genai'; -import {describe, expect, it} from 'vitest'; -import { - createNewEventId, - generateClientFunctionCallId, - populateClientFunctionCallId, - transformToCamelCaseEvent, - transformToSnakeCaseEvent, -} from '../../src/events/event.js'; +} from '../../src/index.js'; describe('Event Utils', () => { describe('createEvent', () => { diff --git a/core/test/features/feature_registry_test.ts b/core/test/features/feature_registry_test.ts index f8a354968..c1590769c 100644 --- a/core/test/features/feature_registry_test.ts +++ b/core/test/features/feature_registry_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; import { FeatureName, FeatureStage, @@ -12,8 +13,7 @@ import { overrideFeatureEnabled, registerFeature, withTemporaryFeatureOverride, -} from '@google/adk'; -import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; describe('FeatureRegistry', () => { const originalEnv = process.env; diff --git a/core/test/memory/in_memory_memory_service_test.ts b/core/test/memory/in_memory_memory_service_test.ts index c172b3e62..dcbf5eb9b 100644 --- a/core/test/memory/in_memory_memory_service_test.ts +++ b/core/test/memory/in_memory_memory_service_test.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {beforeEach, describe, expect, it} from 'vitest'; import { InMemoryMemoryService, InMemorySessionService, createEvent, -} from '@google/adk'; -import {beforeEach, describe, expect, it} from 'vitest'; +} from '../../src/index.js'; describe('InMemoryMemoryService', () => { let service: InMemoryMemoryService; diff --git a/core/test/memory/vertex_ai_memory_bank_service_test.ts b/core/test/memory/vertex_ai_memory_bank_service_test.ts index f29a2b4f3..5b0c5f69f 100644 --- a/core/test/memory/vertex_ai_memory_bank_service_test.ts +++ b/core/test/memory/vertex_ai_memory_bank_service_test.ts @@ -5,6 +5,8 @@ */ import {Client} from '@google-cloud/vertexai'; +import {Content, Part} from '@google/genai'; +import {beforeEach, describe, expect, it, vi} from 'vitest'; import { createEvent, createSession, @@ -13,9 +15,7 @@ import { MemoryEntry, VertexAiMemoryBankService, VertexAiMemoryBankServiceOptions, -} from '@google/adk'; -import {Content, Part} from '@google/genai'; -import {beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; describe('VertexAiMemoryBankService', () => { let service: VertexAiMemoryBankService; diff --git a/core/test/models/apigee_llm_test.ts b/core/test/models/apigee_llm_test.ts index 4a88d0324..3f4ac439b 100644 --- a/core/test/models/apigee_llm_test.ts +++ b/core/test/models/apigee_llm_test.ts @@ -14,7 +14,7 @@ import { Gemini, LLMRegistry, LlmRequest, -} from '@google/adk'; +} from '../../src/index.js'; const geminiModelString = 'apigee/gemini/gemini-1.5-flash'; const vertexModelString = 'apigee/vertex_ai/model-id'; diff --git a/core/test/models/base_llm_test.ts b/core/test/models/base_llm_test.ts index 24c2020ed..4c44aa740 100644 --- a/core/test/models/base_llm_test.ts +++ b/core/test/models/base_llm_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseLlm, BaseLlmConnection, @@ -12,8 +13,7 @@ import { isBaseLlm, runWithClientLabel, version, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; class TestLlm extends BaseLlm { constructor() { diff --git a/core/test/models/google_llm_test.ts b/core/test/models/google_llm_test.ts index 1d745c403..0a8205abd 100644 --- a/core/test/models/google_llm_test.ts +++ b/core/test/models/google_llm_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {GenerateContentResponse, GoogleGenAI, HttpOptions} from '@google/genai'; +import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; import { Gemini, GeminiParams, @@ -11,9 +13,7 @@ import { LlmResponse, geminiInitParams, version, -} from '@google/adk'; -import {GenerateContentResponse, GoogleGenAI, HttpOptions} from '@google/genai'; -import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; vi.mock('@google/genai', async (importOriginal) => { const actual = await importOriginal(); diff --git a/core/test/models/registry_test.ts b/core/test/models/registry_test.ts index 1f4bcf79a..25bc5fe4d 100644 --- a/core/test/models/registry_test.ts +++ b/core/test/models/registry_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {beforeAll, describe, expect, it} from 'vitest'; import { BaseLlm, BaseLlmConnection, @@ -11,8 +12,7 @@ import { LLMRegistry, LlmRequest, LlmResponse, -} from '@google/adk'; -import {beforeAll, describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import { Blob, diff --git a/core/test/models/routed_llm_test.ts b/core/test/models/routed_llm_test.ts index 7468bb5f5..9a7f90290 100644 --- a/core/test/models/routed_llm_test.ts +++ b/core/test/models/routed_llm_test.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseLlm, BaseLlmConnection, LlmRequest, LlmResponse, RoutedLlm, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import {Logger, setLogger} from '../../src/utils/logger.js'; class MockLlm extends BaseLlm { diff --git a/core/test/plugins/base_plugin_test.ts b/core/test/plugins/base_plugin_test.ts index 405d53613..79859dbcc 100644 --- a/core/test/plugins/base_plugin_test.ts +++ b/core/test/plugins/base_plugin_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Content} from '@google/genai'; +import {describe, expect, it} from 'vitest'; import { BaseAgent, BasePlugin, @@ -14,9 +16,7 @@ import { InvocationContext, LlmRequest, LlmResponse, -} from '@google/adk'; -import {Content} from '@google/genai'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import {ContextCompactionTrigger} from '../../src/plugins/base_plugin.js'; import {resetLogger, setLogger} from '../../src/utils/logger.js'; diff --git a/core/test/plugins/global_instruction_plugin_test.ts b/core/test/plugins/global_instruction_plugin_test.ts index 87a1454c9..b5debc350 100644 --- a/core/test/plugins/global_instruction_plugin_test.ts +++ b/core/test/plugins/global_instruction_plugin_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseLlm, Context, @@ -14,8 +15,7 @@ import { LlmRequest, LlmResponse, ReadonlyContext, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; class MockLlm extends BaseLlm { lastRequest?: LlmRequest; diff --git a/core/test/plugins/logging_plugin_test.ts b/core/test/plugins/logging_plugin_test.ts index c2d3fc1fe..5dd808b7f 100644 --- a/core/test/plugins/logging_plugin_test.ts +++ b/core/test/plugins/logging_plugin_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Content} from '@google/genai'; +import {afterEach, beforeEach, describe, expect, it} from 'vitest'; import { BaseAgent, BaseTool, @@ -13,9 +15,7 @@ import { InvocationContext, LlmRequest, LlmResponse, -} from '@google/adk'; -import {Content} from '@google/genai'; -import {afterEach, beforeEach, describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import {LoggingPlugin} from '../../src/plugins/logging_plugin.js'; import {resetLogger, setLogger} from '../../src/utils/logger.js'; diff --git a/core/test/plugins/plugin_manager_test.ts b/core/test/plugins/plugin_manager_test.ts index a2e76a9d7..97785d7ad 100644 --- a/core/test/plugins/plugin_manager_test.ts +++ b/core/test/plugins/plugin_manager_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Content} from '@google/genai'; +import {beforeEach, describe, expect, it} from 'vitest'; import { BaseAgent, BasePlugin, @@ -14,9 +16,7 @@ import { LlmRequest, LlmResponse, PluginManager, -} from '@google/adk'; -import {Content} from '@google/genai'; -import {beforeEach, describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import {ContextCompactionTrigger} from '../../src/plugins/base_plugin.js'; type PluginCallbackName = keyof BasePlugin; diff --git a/core/test/plugins/security_plugin_test.ts b/core/test/plugins/security_plugin_test.ts index ee2db76c7..58f1fc9b5 100644 --- a/core/test/plugins/security_plugin_test.ts +++ b/core/test/plugins/security_plugin_test.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {BaseTool, createEvent} from '@google/adk'; import {describe, expect, it} from 'vitest'; import {Context} from '../../src/agents/context.js'; +import {BaseTool, createEvent} from '../../src/index.js'; import { BasePolicyEngine, getAskUserConfirmationFunctionCalls, diff --git a/core/test/runner/in_memory_runner_test.ts b/core/test/runner/in_memory_runner_test.ts index 96ae4f2f2..97ff21820 100644 --- a/core/test/runner/in_memory_runner_test.ts +++ b/core/test/runner/in_memory_runner_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { BaseAgent, BasePlugin, @@ -14,8 +15,7 @@ import { InMemoryRunner, InvocationContext, LlmAgent, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; const TEST_USER_ID = 'test_user_id'; const TEST_MESSAGE = 'Hello, agent!'; diff --git a/core/test/runner/runner_test.ts b/core/test/runner/runner_test.ts index 904db5e3f..8ac75c0e5 100644 --- a/core/test/runner/runner_test.ts +++ b/core/test/runner/runner_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Content, FunctionCall, FunctionResponse} from '@google/genai'; +import {beforeEach, describe, expect, it, vi} from 'vitest'; import { App, BaseAgent, @@ -18,9 +20,7 @@ import { isRoutableLlmAgent, LlmAgent, Runner, -} from '@google/adk'; -import {Content, FunctionCall, FunctionResponse} from '@google/genai'; -import {beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; const TEST_APP_ID = 'test_app_id'; const TEST_USER_ID = 'test_user_id'; diff --git a/core/test/runner/streaming_runner_test.ts b/core/test/runner/streaming_runner_test.ts index ff47639d9..c0f5ef4b1 100644 --- a/core/test/runner/streaming_runner_test.ts +++ b/core/test/runner/streaming_runner_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Content, Language, Outcome} from '@google/genai'; +import {beforeEach, describe, expect, it, vi} from 'vitest'; import { BaseAgent, BaseLlm, @@ -21,9 +23,7 @@ import { RunAsyncToolRequest, Runner, toStructuredEvents, -} from '@google/adk'; -import {Content, Language, Outcome} from '@google/genai'; -import {beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; const TEST_APP_ID = 'test_app_id'; const TEST_USER_ID = 'test_user_id'; diff --git a/core/test/sessions/database_session_service_test.ts b/core/test/sessions/database_session_service_test.ts index 76fbe15ce..373f852b8 100644 --- a/core/test/sessions/database_session_service_test.ts +++ b/core/test/sessions/database_session_service_test.ts @@ -4,16 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {MikroORM} from '@mikro-orm/core'; +import {SqliteDriver} from '@mikro-orm/sqlite'; +import {afterEach, beforeEach, describe, expect, it} from 'vitest'; import { createEvent, createEventActions, DatabaseSessionService, Event, State, -} from '@google/adk'; -import {MikroORM} from '@mikro-orm/core'; -import {SqliteDriver} from '@mikro-orm/sqlite'; -import {afterEach, beforeEach, describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import {isDatabaseConnectionString} from '../../src/sessions/database_session_service.js'; import {validateDatabaseSchemaVersion} from '../../src/sessions/db/operations.js'; diff --git a/core/test/sessions/in_memory_session_service_test.ts b/core/test/sessions/in_memory_session_service_test.ts index e345b2411..41ebce7fa 100644 --- a/core/test/sessions/in_memory_session_service_test.ts +++ b/core/test/sessions/in_memory_session_service_test.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {beforeEach, describe, expect, it} from 'vitest'; import { InMemorySessionService, Session, State, createEvent, createEventActions, -} from '@google/adk'; -import {beforeEach, describe, expect, it} from 'vitest'; +} from '../../src/index.js'; import {isInMemoryConnectionString} from '../../src/sessions/in_memory_session_service.js'; describe('isInMemoryConnectionString', () => { diff --git a/core/test/sessions/registry_test.ts b/core/test/sessions/registry_test.ts index f94ec1d37..a3e11e2a7 100644 --- a/core/test/sessions/registry_test.ts +++ b/core/test/sessions/registry_test.ts @@ -4,8 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {InMemorySessionService, getSessionServiceFromUri} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import { + InMemorySessionService, + getSessionServiceFromUri, +} from '../../src/index.js'; describe('Registry', () => { describe('getSessionServiceFromUri', () => { diff --git a/core/test/sessions/vertex_ai_session_service_test.ts b/core/test/sessions/vertex_ai_session_service_test.ts index c0e834607..1e204c533 100644 --- a/core/test/sessions/vertex_ai_session_service_test.ts +++ b/core/test/sessions/vertex_ai_session_service_test.ts @@ -5,10 +5,10 @@ */ import {Sessions} from '@google-cloud/vertexai/build/src/genai/sessions.js'; -import {createEvent, State, VertexAiSessionService} from '@google/adk'; -import {Session} from '@google/adk/sessions/session.js'; import {ApiError} from '@google/genai'; import {beforeEach, describe, expect, it, vi} from 'vitest'; +import {createEvent, State, VertexAiSessionService} from '../../src/index.js'; +import {Session} from '../../src/sessions/session.js'; // Mock the unreleased nodejs-vertexai package so the import resolves vi.mock('nodejs-vertexai', () => ({ @@ -24,8 +24,8 @@ vi.mock('nodejs-vertexai', () => ({ import { isVertexAiConnectionString, quoteFilterLiteral, -} from '@google/adk/sessions/vertex_ai_session_service.js'; -import {logger} from '@google/adk/utils/logger.js'; +} from '../../src/sessions/vertex_ai_session_service.js'; +import {logger} from '../../src/utils/logger.js'; describe('isVertexAiConnectionString', () => { it('returns true for vertexai://', () => { diff --git a/core/test/telemetry/google_cloud_test.ts b/core/test/telemetry/google_cloud_test.ts index 2cf050416..aa7fd269d 100644 --- a/core/test/telemetry/google_cloud_test.ts +++ b/core/test/telemetry/google_cloud_test.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {detectResources, Resource} from '@opentelemetry/resources'; +import {GoogleAuth} from 'google-auth-library'; +import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; import { getGcpExporters, getGcpResource, OtelExportersConfig, -} from '@google/adk'; -import {detectResources, Resource} from '@opentelemetry/resources'; -import {GoogleAuth} from 'google-auth-library'; -import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; vi.hoisted(() => { vi.resetModules(); diff --git a/core/test/telemetry/setup_test.ts b/core/test/telemetry/setup_test.ts index 3fa6aa0e8..c0b268efd 100644 --- a/core/test/telemetry/setup_test.ts +++ b/core/test/telemetry/setup_test.ts @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {OTelHooks, maybeSetOtelProviders} from '@google/adk'; import {metrics, trace} from '@opentelemetry/api'; import {logs} from '@opentelemetry/api-logs'; import {MetricReader} from '@opentelemetry/sdk-metrics'; import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; +import {OTelHooks, maybeSetOtelProviders} from '../../src/index.js'; vi.hoisted(() => { vi.resetModules(); diff --git a/core/test/telemetry/tracing_test.ts b/core/test/telemetry/tracing_test.ts index a150f1a63..9c075ada2 100644 --- a/core/test/telemetry/tracing_test.ts +++ b/core/test/telemetry/tracing_test.ts @@ -16,7 +16,7 @@ import { LlmResponse, Session, createEventActions, -} from '@google/adk'; +} from '../../src/index.js'; import { traceAgentInvocation, traceCallLlm, diff --git a/core/test/tools/agent_tool_test.ts b/core/test/tools/agent_tool_test.ts index b8e958b59..ea073cbc2 100644 --- a/core/test/tools/agent_tool_test.ts +++ b/core/test/tools/agent_tool_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { AgentTool, Context, @@ -16,8 +17,7 @@ import { PluginManager, Runner, State, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../src/index.js'; vi.mock('../../src/runner/runner.js', async (importOriginal) => { const actual = diff --git a/core/test/tools/base_toolset_test.ts b/core/test/tools/base_toolset_test.ts index cf8838ec3..a4ff2bf91 100644 --- a/core/test/tools/base_toolset_test.ts +++ b/core/test/tools/base_toolset_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { BaseTool, BaseToolset, @@ -12,8 +13,7 @@ import { LlmRequest, ReadonlyContext, ToolPredicate, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; class DummyTool extends BaseTool { constructor(name: string) { diff --git a/core/test/tools/consolidate_context_tool_test.ts b/core/test/tools/consolidate_context_tool_test.ts index 25b171c60..c5decaf94 100644 --- a/core/test/tools/consolidate_context_tool_test.ts +++ b/core/test/tools/consolidate_context_tool_test.ts @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Type} from '@google/genai'; +import {describe, expect, it} from 'vitest'; import { BaseAgent, ConsolidateContextTool, @@ -11,9 +13,7 @@ import { createSession, InvocationContext, PluginManager, -} from '@google/adk'; -import {Type} from '@google/genai'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; describe('ConsolidateContextTool', () => { it('computes the correct declaration', () => { diff --git a/core/test/tools/enterprise_web_search_tool_test.ts b/core/test/tools/enterprise_web_search_tool_test.ts index aa07a26ad..8e3cf7813 100644 --- a/core/test/tools/enterprise_web_search_tool_test.ts +++ b/core/test/tools/enterprise_web_search_tool_test.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Tool} from '@google/genai'; +import {describe, expect, it} from 'vitest'; import { ENTERPRISE_WEB_SEARCH, EnterpriseWebSearchTool, LlmRequest, -} from '@google/adk'; -import {Tool} from '@google/genai'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; function makeRequest(model?: string, tools: Tool[] = []): LlmRequest { return { diff --git a/core/test/tools/example_tool_test.ts b/core/test/tools/example_tool_test.ts index 963dbf940..10d94adad 100644 --- a/core/test/tools/example_tool_test.ts +++ b/core/test/tools/example_tool_test.ts @@ -6,6 +6,7 @@ import {describe, expect, it, vi} from 'vitest'; +import {Content} from '@google/genai'; import { BaseAgent, BaseExampleProvider, @@ -16,8 +17,7 @@ import { InvocationContext, LlmRequest, PluginManager, -} from '@google/adk'; -import {Content} from '@google/genai'; +} from '../../src/index.js'; const SIMPLE_EXAMPLE: Example = { input: {parts: [{text: 'What is 2+2?'}]}, diff --git a/core/test/tools/exit_loop_tool_test.ts b/core/test/tools/exit_loop_tool_test.ts index 6b80b07f0..a1b567ed4 100644 --- a/core/test/tools/exit_loop_tool_test.ts +++ b/core/test/tools/exit_loop_tool_test.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { Context, createEventActions, EXIT_LOOP, ExitLoopTool, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; describe('ExitLoopTool', () => { it('computes the correct declaration', () => { diff --git a/core/test/tools/function_tool_test.ts b/core/test/tools/function_tool_test.ts index 9ed3a01a0..6849fc4a9 100644 --- a/core/test/tools/function_tool_test.ts +++ b/core/test/tools/function_tool_test.ts @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {Context, FunctionTool, isFunctionTool} from '@google/adk'; import {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 {Context, FunctionTool, isFunctionTool} from '../../src/index.js'; describe('FunctionTool', () => { let emptyContext: Context; diff --git a/core/test/tools/get_user_choice_tool_test.ts b/core/test/tools/get_user_choice_tool_test.ts index aefa81898..5a180dcd2 100644 --- a/core/test/tools/get_user_choice_tool_test.ts +++ b/core/test/tools/get_user_choice_tool_test.ts @@ -4,8 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {Context, createEventActions, getUserChoiceTool} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import { + Context, + createEventActions, + getUserChoiceTool, +} from '../../src/index.js'; describe('getUserChoiceTool', () => { it('computes the correct declaration', () => { diff --git a/core/test/tools/google_maps_grounding_tool_test.ts b/core/test/tools/google_maps_grounding_tool_test.ts index 2425d58e6..f214646f9 100644 --- a/core/test/tools/google_maps_grounding_tool_test.ts +++ b/core/test/tools/google_maps_grounding_tool_test.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { GOOGLE_MAPS_GROUNDING, GoogleMapsGroundingTool, LlmRequest, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; function makeRequest(model?: string, tools = []): LlmRequest { return { diff --git a/core/test/tools/google_search_tool_test.ts b/core/test/tools/google_search_tool_test.ts index f304d94ba..466bb9f29 100644 --- a/core/test/tools/google_search_tool_test.ts +++ b/core/test/tools/google_search_tool_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {GOOGLE_SEARCH, GoogleSearchTool, LlmRequest} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {GOOGLE_SEARCH, GoogleSearchTool, LlmRequest} from '../../src/index.js'; function makeRequest(model?: string, tools = []): LlmRequest { return { diff --git a/core/test/tools/load_artifacts_tool_test.ts b/core/test/tools/load_artifacts_tool_test.ts index c963b147f..2ed177353 100644 --- a/core/test/tools/load_artifacts_tool_test.ts +++ b/core/test/tools/load_artifacts_tool_test.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Blob, Part, Type} from '@google/genai'; +import {describe, expect, it} from 'vitest'; import { Context, LOAD_ARTIFACTS, LlmRequest, LoadArtifactsTool, -} from '@google/adk'; -import {Blob, Part, Type} from '@google/genai'; -import {describe, expect, it} from 'vitest'; +} from '../../src/index.js'; class StubToolContext { private artifactsByName: Record; diff --git a/core/test/tools/load_memory_tool_test.ts b/core/test/tools/load_memory_tool_test.ts index 1490376e2..a955cf97c 100644 --- a/core/test/tools/load_memory_tool_test.ts +++ b/core/test/tools/load_memory_tool_test.ts @@ -14,7 +14,7 @@ import { LoadMemoryTool, MemoryEntry, SearchMemoryResponse, -} from '@google/adk'; +} from '../../src/index.js'; class StubToolContext { private memories: MemoryEntry[]; diff --git a/core/test/tools/load_web_page_test.ts b/core/test/tools/load_web_page_test.ts index 18b444935..3b54ec05c 100644 --- a/core/test/tools/load_web_page_test.ts +++ b/core/test/tools/load_web_page_test.ts @@ -6,8 +6,8 @@ import {lookup} from 'node:dns/promises'; -import {FunctionTool, LOAD_WEB_PAGE, loadWebPage} from '@google/adk'; import {afterEach, beforeEach, describe, expect, it, Mock, vi} from 'vitest'; +import {FunctionTool, LOAD_WEB_PAGE, loadWebPage} from '../../src/index.js'; vi.mock('node:dns/promises', () => ({ lookup: vi.fn(), diff --git a/core/test/tools/long_running_tool_test.ts b/core/test/tools/long_running_tool_test.ts index 9fac799eb..6b88c93cd 100644 --- a/core/test/tools/long_running_tool_test.ts +++ b/core/test/tools/long_running_tool_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {LongRunningFunctionTool} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {LongRunningFunctionTool} from '../../src/index.js'; const LONG_RUNNING_INSTRUCTION = `\n\nNOTE: This is a long-running operation. Do not call this tool again if it has already returned some intermediate or pending status.`; diff --git a/core/test/tools/mcp/load_mcp_resource_tool_test.ts b/core/test/tools/mcp/load_mcp_resource_tool_test.ts index 6d3039052..44f3dd0bc 100644 --- a/core/test/tools/mcp/load_mcp_resource_tool_test.ts +++ b/core/test/tools/mcp/load_mcp_resource_tool_test.ts @@ -4,15 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Content, Type} from '@google/genai'; +import {beforeEach, describe, expect, it, Mock, vi} from 'vitest'; import { Context, LlmRequest, LoadMcpResourceTool, MCPToolset, RunAsyncToolRequest, -} from '@google/adk'; -import {Content, Type} from '@google/genai'; -import {beforeEach, describe, expect, it, Mock, vi} from 'vitest'; +} from '../../../src/index.js'; /** * Builds a {@link LoadMcpResourceTool} backed by a minimal mock toolset. Only diff --git a/core/test/tools/mcp/mcp_session_manager_test.ts b/core/test/tools/mcp/mcp_session_manager_test.ts index bc51fc321..2f691f8db 100644 --- a/core/test/tools/mcp/mcp_session_manager_test.ts +++ b/core/test/tools/mcp/mcp_session_manager_test.ts @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {MCPSessionManager} from '@google/adk'; import {Client} from '@modelcontextprotocol/sdk/client/index.js'; import {StdioClientTransport} from '@modelcontextprotocol/sdk/client/stdio.js'; import {StreamableHTTPClientTransport} from '@modelcontextprotocol/sdk/client/streamableHttp.js'; import {describe, expect, it, vi} from 'vitest'; +import {MCPSessionManager} from '../../../src/index.js'; vi.hoisted(() => { vi.resetModules(); diff --git a/core/test/tools/mcp/mcp_tool_test.ts b/core/test/tools/mcp/mcp_tool_test.ts index cf8dd622a..4c5f9280f 100644 --- a/core/test/tools/mcp/mcp_tool_test.ts +++ b/core/test/tools/mcp/mcp_tool_test.ts @@ -4,15 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {Client} from '@modelcontextprotocol/sdk/client/index.js'; +import {Tool} from '@modelcontextprotocol/sdk/types.js'; +import {describe, expect, it, vi} from 'vitest'; import { Context, InvocationContext, MCPSessionManager, MCPTool, -} from '@google/adk'; -import {Client} from '@modelcontextprotocol/sdk/client/index.js'; -import {Tool} from '@modelcontextprotocol/sdk/types.js'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; describe('MCPTool', () => { it('passes abort signal to callTool', async () => { diff --git a/core/test/tools/openapi_tool/openapi_spec_parser_test.ts b/core/test/tools/openapi_tool/openapi_spec_parser_test.ts index 2840961d8..a84f847c8 100644 --- a/core/test/tools/openapi_tool/openapi_spec_parser_test.ts +++ b/core/test/tools/openapi_tool/openapi_spec_parser_test.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {OpenApiSpecParser} from '@google/adk'; import {OpenAPIV3} from 'openapi-types'; import {describe, expect, it} from 'vitest'; +import {OpenApiSpecParser} from '../../../src/index.js'; describe('OpenApiSpecParser', () => { it('should resolve internal references', () => { diff --git a/core/test/tools/openapi_tool/openapi_toolset_integration_test.ts b/core/test/tools/openapi_tool/openapi_toolset_integration_test.ts index 22fdbf3fa..0b8515318 100644 --- a/core/test/tools/openapi_tool/openapi_toolset_integration_test.ts +++ b/core/test/tools/openapi_tool/openapi_toolset_integration_test.ts @@ -4,10 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {Context, OpenAPIToolset} from '@google/adk'; import * as fs from 'fs'; import * as path from 'path'; import {beforeEach, describe, expect, it, vi} from 'vitest'; +import {Context, OpenAPIToolset} from '../../../src/index.js'; describe('OpenAPIToolset Integration', () => { let truanonSpec: string; diff --git a/core/test/tools/openapi_tool/openapi_toolset_test.ts b/core/test/tools/openapi_tool/openapi_toolset_test.ts index da2e32380..4909409df 100644 --- a/core/test/tools/openapi_tool/openapi_toolset_test.ts +++ b/core/test/tools/openapi_tool/openapi_toolset_test.ts @@ -4,9 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {OpenApiSpecParser, OpenAPIToolset, ReadonlyContext} from '@google/adk'; import {OpenAPIV3} from 'openapi-types'; import {describe, expect, it} from 'vitest'; +import { + OpenApiSpecParser, + OpenAPIToolset, + ReadonlyContext, +} from '../../../src/index.js'; describe('OpenAPIToolset', () => { const mockSpec: OpenAPIV3.Document = { diff --git a/core/test/tools/openapi_tool/operation_parser_test.ts b/core/test/tools/openapi_tool/operation_parser_test.ts index 8d8e5d2b6..5176ff194 100644 --- a/core/test/tools/openapi_tool/operation_parser_test.ts +++ b/core/test/tools/openapi_tool/operation_parser_test.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {OperationParser} from '@google/adk'; import {OpenAPIV3} from 'openapi-types'; import {describe, expect, it} from 'vitest'; +import {OperationParser} from '../../../src/index.js'; describe('OperationParser', () => { it('should throw error if operationId is missing', () => { diff --git a/core/test/tools/openapi_tool/rest_api_tool_test.ts b/core/test/tools/openapi_tool/rest_api_tool_test.ts index 974e1aa63..89a331905 100644 --- a/core/test/tools/openapi_tool/rest_api_tool_test.ts +++ b/core/test/tools/openapi_tool/rest_api_tool_test.ts @@ -4,15 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {OpenAPIV3} from 'openapi-types'; +import {afterEach, describe, expect, it, vi} from 'vitest'; import { AuthCredential, Context, createRestApiTool, RestApiTool, ToolAuthHandler, -} from '@google/adk'; -import {OpenAPIV3} from 'openapi-types'; -import {afterEach, describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; import { prepareRequestBody, prepareRequestParams, diff --git a/core/test/tools/openapi_tool/tool_auth_handler_test.ts b/core/test/tools/openapi_tool/tool_auth_handler_test.ts index 2a718e4a5..635deee2f 100644 --- a/core/test/tools/openapi_tool/tool_auth_handler_test.ts +++ b/core/test/tools/openapi_tool/tool_auth_handler_test.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { AuthCredential, AuthCredentialTypes, Context, ToolAuthHandler, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; import {State} from '../../../src/sessions/state.js'; import {AutoAuthCredentialExchanger} from '../../../src/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js'; diff --git a/core/test/tools/preload_memory_tool_test.ts b/core/test/tools/preload_memory_tool_test.ts index 4f77bec96..27f54e86c 100644 --- a/core/test/tools/preload_memory_tool_test.ts +++ b/core/test/tools/preload_memory_tool_test.ts @@ -13,7 +13,7 @@ import { PRELOAD_MEMORY, PreloadMemoryTool, SearchMemoryResponse, -} from '@google/adk'; +} from '../../src/index.js'; // We mock the logger.warn since we test a failing case import {vi} from 'vitest'; diff --git a/core/test/tools/request_input_tool_test.ts b/core/test/tools/request_input_tool_test.ts index 2fbb9c8f2..2f572f342 100644 --- a/core/test/tools/request_input_tool_test.ts +++ b/core/test/tools/request_input_tool_test.ts @@ -4,8 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {Context, createEventActions, requestInputTool} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import { + Context, + createEventActions, + requestInputTool, +} from '../../src/index.js'; describe('requestInputTool', () => { it('computes the correct declaration', () => { diff --git a/core/test/tools/skills/list_skills_tool_test.ts b/core/test/tools/skills/list_skills_tool_test.ts index 7eaea9c2b..8b3659e87 100644 --- a/core/test/tools/skills/list_skills_tool_test.ts +++ b/core/test/tools/skills/list_skills_tool_test.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { Context, InvocationContext, ListSkillsTool, Skill, SkillToolset, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; describe('ListSkillsTool', () => { const mockSkill: Skill = { diff --git a/core/test/tools/skills/load_skill_resource_tool_test.ts b/core/test/tools/skills/load_skill_resource_tool_test.ts index 98fb8eac4..a9a4bb9aa 100644 --- a/core/test/tools/skills/load_skill_resource_tool_test.ts +++ b/core/test/tools/skills/load_skill_resource_tool_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { Context, InvocationContext, @@ -11,8 +12,7 @@ import { LoadSkillResourceTool, Skill, SkillToolset, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; describe('LoadSkillResourceTool', () => { const mockSkill: Skill = { diff --git a/core/test/tools/skills/load_skill_tool_test.ts b/core/test/tools/skills/load_skill_tool_test.ts index 770da302d..791ad18f1 100644 --- a/core/test/tools/skills/load_skill_tool_test.ts +++ b/core/test/tools/skills/load_skill_tool_test.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it} from 'vitest'; import { Context, InvocationContext, LoadSkillTool, Skill, SkillToolset, -} from '@google/adk'; -import {describe, expect, it} from 'vitest'; +} from '../../../src/index.js'; describe('LoadSkillTool', () => { const mockSkill: Skill = { diff --git a/core/test/tools/skills/run_skill_inline_script_tool_test.ts b/core/test/tools/skills/run_skill_inline_script_tool_test.ts index 36664b070..4bcac6bf0 100644 --- a/core/test/tools/skills/run_skill_inline_script_tool_test.ts +++ b/core/test/tools/skills/run_skill_inline_script_tool_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { BaseCodeExecutor, CodeExecutionLanguage, @@ -17,8 +18,7 @@ import { RunSkillInlineScriptErrorCode, RunSkillInlineScriptTool, SkillToolset, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; import {ToolConfirmation} from '../../../src/tools/tool_confirmation.js'; import {materializeFiles} from '../../../src/utils/file_utils.js'; diff --git a/core/test/tools/skills/run_skill_script_tool_test.ts b/core/test/tools/skills/run_skill_script_tool_test.ts index 15c796b05..73fb47f8d 100644 --- a/core/test/tools/skills/run_skill_script_tool_test.ts +++ b/core/test/tools/skills/run_skill_script_tool_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { BaseCodeExecutor, CodeExecutionLanguage, @@ -16,8 +17,7 @@ import { RunSkillScriptTool, Skill, SkillToolset, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; import {materializeFiles} from '../../../src/utils/file_utils.js'; vi.mock('../../../src/utils/file_utils.js', () => ({ diff --git a/core/test/tools/skills/skill_registry_test.ts b/core/test/tools/skills/skill_registry_test.ts index 81ac9a706..b31b10b9e 100644 --- a/core/test/tools/skills/skill_registry_test.ts +++ b/core/test/tools/skills/skill_registry_test.ts @@ -5,6 +5,8 @@ */ import {Client} from '@google-cloud/vertexai'; +import AdmZip from 'adm-zip'; +import {describe, expect, it, vi} from 'vitest'; import { Context, GCPSkillRegistry, @@ -17,9 +19,7 @@ import { Skill, SkillToolset, loadSkillFromZipBuffer, -} from '@google/adk'; -import AdmZip from 'adm-zip'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; describe('skill_registry', () => { function createMockContext(agentName = 'test-agent') { diff --git a/core/test/tools/skills/skill_toolset_test.ts b/core/test/tools/skills/skill_toolset_test.ts index 8028a9ba2..47b5214ef 100644 --- a/core/test/tools/skills/skill_toolset_test.ts +++ b/core/test/tools/skills/skill_toolset_test.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {describe, expect, it, vi} from 'vitest'; import { BaseTool, BaseToolset, @@ -13,8 +14,7 @@ import { ReadonlyContext, Skill, SkillToolset, -} from '@google/adk'; -import {describe, expect, it, vi} from 'vitest'; +} from '../../../src/index.js'; describe('skill_toolset', () => { const mockSkill: Skill = { diff --git a/core/test/tools/tool_confirmation_test.ts b/core/test/tools/tool_confirmation_test.ts index 0fe1280e9..7b20fca33 100644 --- a/core/test/tools/tool_confirmation_test.ts +++ b/core/test/tools/tool_confirmation_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {ToolConfirmation} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {ToolConfirmation} from '../../src/index.js'; describe('ToolConfirmation', () => { it('stores all provided fields', () => { diff --git a/core/test/tools/url_context_tool_test.ts b/core/test/tools/url_context_tool_test.ts index d6a4ed58d..f27d11cb8 100644 --- a/core/test/tools/url_context_tool_test.ts +++ b/core/test/tools/url_context_tool_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {LlmRequest, URL_CONTEXT, UrlContextTool} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {LlmRequest, URL_CONTEXT, UrlContextTool} from '../../src/index.js'; function makeRequest(model?: string, tools = []): LlmRequest { return { diff --git a/core/test/tools/vertex_rag_retrieval_tool_test.ts b/core/test/tools/vertex_rag_retrieval_tool_test.ts index 13f6f44f8..7539aac58 100644 --- a/core/test/tools/vertex_rag_retrieval_tool_test.ts +++ b/core/test/tools/vertex_rag_retrieval_tool_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {VertexRagRetrievalTool} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {VertexRagRetrievalTool} from '../../src/index.js'; const RAG_CORPUS = 'projects/my-project/locations/us-central1/ragCorpora/my-corpus'; diff --git a/core/test/utils/client_labels_test.ts b/core/test/utils/client_labels_test.ts index 190378975..2ffb85dc6 100644 --- a/core/test/utils/client_labels_test.ts +++ b/core/test/utils/client_labels_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {getClientLabels, runWithClientLabel} from '@google/adk'; import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; +import {getClientLabels, runWithClientLabel} from '../../src/index.js'; import {parseUserAgent} from '../../src/utils/client_labels.js'; describe('client_labels', () => { diff --git a/core/test/utils/file_utils_test.ts b/core/test/utils/file_utils_test.ts index ba44f8cc3..48fde293f 100644 --- a/core/test/utils/file_utils_test.ts +++ b/core/test/utils/file_utils_test.ts @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {FileContentEncoding} from '@google/adk'; import * as fs from 'node:fs/promises'; import * as os from 'node:os'; import * as path from 'node:path'; import {afterEach, beforeEach, describe, expect, it} from 'vitest'; +import {FileContentEncoding} from '../../src/index.js'; import {materializeFiles} from '../../src/utils/file_utils.js'; describe('file_utils', () => { diff --git a/core/test/utils/logger_test.ts b/core/test/utils/logger_test.ts index 2865a9de0..5f60022c9 100644 --- a/core/test/utils/logger_test.ts +++ b/core/test/utils/logger_test.ts @@ -4,8 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {getLogger, Logger, LogLevel, setLogger, setLogLevel} from '@google/adk'; import {afterEach, beforeEach, describe, expect, it} from 'vitest'; +import { + getLogger, + Logger, + LogLevel, + setLogger, + setLogLevel, +} from '../../src/index.js'; import {resetLogger} from '../../src/utils/logger.js'; describe('setLogger', () => { diff --git a/core/test/utils/model_name_test.ts b/core/test/utils/model_name_test.ts index caabe4022..d25533a1e 100644 --- a/core/test/utils/model_name_test.ts +++ b/core/test/utils/model_name_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {isGemini2OrAbove, isGemini3xFlashLive} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {isGemini2OrAbove, isGemini3xFlashLive} from '../../src/index.js'; describe('isGemini2OrAbove', () => { describe('valid models', () => { diff --git a/core/test/utils/simple_zod_to_json_test.ts b/core/test/utils/simple_zod_to_json_test.ts index 9ccf893ca..096d72b0b 100644 --- a/core/test/utils/simple_zod_to_json_test.ts +++ b/core/test/utils/simple_zod_to_json_test.ts @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {zodObjectToSchema} from '@google/adk'; import {Type} from '@google/genai'; import {describe, expect, it} from 'vitest'; import {z as z3} from 'zod/v3'; import {z as z4} from 'zod/v4'; +import {zodObjectToSchema} from '../../src/index.js'; describe('zodObjectToSchema', () => { describe.each([ diff --git a/core/test/utils/task_test.ts b/core/test/utils/task_test.ts index be1ba0a9f..7a2e64ed1 100644 --- a/core/test/utils/task_test.ts +++ b/core/test/utils/task_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {Task} from '@google/adk'; import {describe, expect, it} from 'vitest'; +import {Task} from '../../src/index.js'; describe('task utils', () => { describe('Task class', () => { diff --git a/core/test/utils/variant_utils_test.ts b/core/test/utils/variant_utils_test.ts index 4f949e433..5527c1607 100644 --- a/core/test/utils/variant_utils_test.ts +++ b/core/test/utils/variant_utils_test.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import {GoogleLLMVariant} from '@google/adk'; import {afterEach, describe, expect, it} from 'vitest'; +import {GoogleLLMVariant} from '../../src/index.js'; import {getGoogleLlmVariant} from '../../src/utils/variant_utils.js'; describe('variant_utils', () => { From 875187082001e0ec1497bca4e9e738c3710925d2 Mon Sep 17 00:00:00 2001 From: Amaad Martin Date: Sun, 2 Aug 2026 02:51:41 -0700 Subject: [PATCH 2/4] Fix: drop eight invalid type-position casts and two stale suppressions in core/test runner_test.ts wrote `as unknown as Content['parts']![0]` at eight sites. `!` is a value-position non-null assertion and is not valid in a type position, so tsc rejected each one with TS17019 and the eight object literals they annotated went unchecked as a knock-on effect. esbuild strips type annotations without parsing them, which is why vitest never noticed. Rather than repair the cast syntax, delete the casts. Every one of the eight annotated a `{inlineData: {mimeType, data, displayName}}` literal, and all three fields are declared on Blob in @google/genai, so each literal is already a valid Part. The enclosing `const newMessage: Content` contextually types the array, so removing the cast makes the literals genuinely checked against Part instead of laundered through `unknown`. A typo in `mimeType` is now a compile error where before it was silently accepted. Both `@ts-expect-error` directives that the previous commit made unused are removed, as TS2578 otherwise fails the build: - functions_test.ts blamed "toolsDict ... imported from the source and BaseTool imported from '@google/adk'" -- exactly the module-identity split that no longer exists. - runner_test.ts claimed to suppress an omitted `appName`, but appName is declared optional on RunnerOptions (it can arrive via app.name) and the error it actually suppressed was the duplicated sessionService type. The test still exercises the real runtime guard that throws when appName is absent. tsc --noEmit: 157 -> 139 errors. Zero TS17019 and zero TS2578 remain; both files now type-check completely clean. --- core/test/agents/functions_test.ts | 1 - core/test/runner/runner_test.ts | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/core/test/agents/functions_test.ts b/core/test/agents/functions_test.ts index 76f958806..4476c56e0 100644 --- a/core/test/agents/functions_test.ts +++ b/core/test/agents/functions_test.ts @@ -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); diff --git a/core/test/runner/runner_test.ts b/core/test/runner/runner_test.ts index 8ac75c0e5..e635933fb 100644 --- a/core/test/runner/runner_test.ts +++ b/core/test/runner/runner_test.ts @@ -733,7 +733,6 @@ describe('Runner error handling', () => { it('should throw clear error when appName is not configured in runner', async () => { const agent = new MockLlmAgent('test_agent'); - // @ts-expect-error - Intentionally omitting appName to test error handling const runner = new Runner({ agent: agent, sessionService, @@ -928,7 +927,7 @@ describe('Runner artifact saving (`saveInputBlobsAsArtifacts`)', () => { data: 'JVBERi0xLjQ...', displayName: 'file.pdf', }, - } as unknown as Content['parts']![0], + }, ], }; @@ -983,7 +982,7 @@ describe('Runner artifact saving (`saveInputBlobsAsArtifacts`)', () => { data: 'JVBERi0xLjQ...', displayName: 'file.pdf', }, - } as unknown as Content['parts']![0], + }, ], }; @@ -1026,7 +1025,7 @@ describe('Runner artifact saving (`saveInputBlobsAsArtifacts`)', () => { parts: [ { inlineData: inlineDataObj, - } as unknown as Content['parts']![0], + }, ], }; @@ -1066,7 +1065,7 @@ describe('Runner artifact saving (`saveInputBlobsAsArtifacts`)', () => { data: 'JVBERi0xLjQ...', displayName: 'named_doc.pdf', }, - } as unknown as Content['parts']![0], + }, { inlineData: { mimeType: 'image/png', @@ -1124,14 +1123,14 @@ describe('Runner artifact saving (`saveInputBlobsAsArtifacts`)', () => { data: 'JVBERi0xLjQ...', displayName: 'good.pdf', }, - } as unknown as Content['parts']![0], + }, { inlineData: { mimeType: 'image/png', data: 'bad_data', displayName: 'bad.png', }, - } as unknown as Content['parts']![0], + }, ], }; @@ -1180,7 +1179,7 @@ describe('Runner artifact saving (`saveInputBlobsAsArtifacts`)', () => { data: 'data', displayName: 'file1.pdf', }, - } as unknown as Content['parts']![0], + }, ], }; @@ -1217,7 +1216,7 @@ describe('Runner artifact saving (`saveInputBlobsAsArtifacts`)', () => { data: 'data', displayName: 'file2.pdf', }, - } as unknown as Content['parts']![0], + }, ], }; From f01204fab5c5ad41088dab996bca66b275fb8a75 Mon Sep 17 00:00:00 2001 From: Amaad Martin Date: Sun, 2 Aug 2026 02:56:55 -0700 Subject: [PATCH 3/4] Chore: pin the core/test ADK import convention with an ESLint guard The previous two commits removed every '@google/adk' specifier from core/test, but nothing stops one reappearing -- and one silently reintroduces the whole dist-vs-src duplication for whichever types it pulls in, with no test failure to signal it, because vitest aliases the specifier to core/src and so keeps passing. Restrict '@google/adk' and '@google/adk/**' under core/test/**/*.ts, with a message that states the fix and the reason. Scoped to core/test only: dev/test still imports the package specifier in 8 files and is out of scope here. Cover the guard with a test that runs the real ESLint against the real eslint.config.js via lintText, which resolves config for a virtual path and so writes nothing to disk. It pins all three properties the guard needs: that it fires on the package root, a type-only import, a re-export and a deep subpath; that it stays silent on the relative path the convention mandates and on non-ADK packages; and that it does not leak outside core/test. Each assertion was verified to fail against a mutated config -- deleting the block fails the four rejection cases, widening `files` to '**/*.ts' fails the scoping case, and broadening the group to '**' fails the two negative cases. --- eslint.config.js | 17 ++++ ...eslint_core_test_import_convention_test.ts | 83 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 tests/integration/repo_config/eslint_core_test_import_convention_test.ts diff --git a/eslint.config.js b/eslint.config.js index 0d0f13deb..6ca10e5eb 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -36,4 +36,21 @@ export default defineConfig([ ] }, }, + { + files: ["core/test/**/*.ts"], + rules: { + "no-restricted-imports": [ + "error", + { + "patterns": [ + { + "group": ["@google/adk", "@google/adk/**"], + "message": + "core/test must import ADK symbols from the source tree via a relative path (e.g. '../../src/index.js'). The package specifier resolves through the workspace symlink to the built declarations in core/dist/types, so TypeScript sees two distinct declarations of every class, while vitest aliases it to core/src -- the type checker and the runtime disagree." + } + ] + } + ] + }, + }, ]); diff --git a/tests/integration/repo_config/eslint_core_test_import_convention_test.ts b/tests/integration/repo_config/eslint_core_test_import_convention_test.ts new file mode 100644 index 000000000..519855e0e --- /dev/null +++ b/tests/integration/repo_config/eslint_core_test_import_convention_test.ts @@ -0,0 +1,83 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import {ESLint} from 'eslint'; +import path from 'node:path'; +import {fileURLToPath} from 'node:url'; +import {describe, expect, it} from 'vitest'; + +const REPO_ROOT = path.resolve( + path.dirname(fileURLToPath(import.meta.url)), + '../../..', +); + +const RULE_ID = 'no-restricted-imports'; + +const eslint = new ESLint({cwd: REPO_ROOT}); + +/** + * Lints `source` as if it lived at `relativePath` and returns the messages the + * import-convention guard produced. `lintText` resolves the real + * `eslint.config.js` against that path, so this exercises the shipped config + * rather than a copy of it, and writes nothing to disk. + */ +async function guardViolations( + source: string, + relativePath: string, +): Promise { + const [result] = await eslint.lintText(source, { + filePath: path.join(REPO_ROOT, relativePath), + }); + return result.messages + .filter((message) => message.ruleId === RULE_ID) + .map((message) => message.message); +} + +const RESTRICTED_IMPORTS = [ + ['the package root', "import {App} from '@google/adk';"], + ['a type-only package root', "import type {App} from '@google/adk';"], + ['a re-export', "export {App} from '@google/adk';"], + [ + 'a deep subpath', + "import {Session} from '@google/adk/sessions/session.js';", + ], +] as const; + +describe('core/test ADK import convention', () => { + it.each(RESTRICTED_IMPORTS)('rejects %s import', async (_label, source) => { + const violations = await guardViolations(source, 'core/test/probe_test.ts'); + + expect(violations).toHaveLength(1); + expect(violations[0]).toContain("'../../src/index.js'"); + }); + + it('allows the relative source path the convention mandates', async () => { + const violations = await guardViolations( + "import {App} from '../../src/index.js';", + 'core/test/probe_test.ts', + ); + + expect(violations).toEqual([]); + }); + + it('leaves non-ADK package specifiers alone', async () => { + const violations = await guardViolations( + "import {Content} from '@google/genai';\nimport {z} from 'zod';", + 'core/test/probe_test.ts', + ); + + expect(violations).toEqual([]); + }); + + it('is scoped to core/test and does not restrict other test trees', async () => { + const violations = await guardViolations( + "import {App} from '@google/adk';", + 'dev/test/probe_test.ts', + ); + + expect(violations).toEqual([]); + }); +}); From 4976fd976b93af722ae8c63a151e4c97c2c157d0 Mon Sep 17 00:00:00 2001 From: Amaad Martin Date: Sun, 2 Aug 2026 04:19:56 -0700 Subject: [PATCH 4/4] Test: restore the package-specifier guarantee the import rewrite dropped core/test/tools/example_tool_test.ts had one test whose subject was the import specifier itself: 'is importable from @google/adk (public export)'. Rewriting its import to '../../src/index.js' left the title asserting something the file no longer does, and moved the test's guarantee from the published package surface down to the source barrel, where nothing was left pinning the former. Retitle it to 'is exported from the package barrel', which is what it now checks, and leave its assertion alone. Restore the lost guarantee as a new test under tests/integration, where the package specifier is still legal and the core/test ESLint guard deliberately does not reach. tsc resolves '@google/adk' to the declarations in core/dist/types, so a symbol dropped from the built package fails there even while the source barrel still exports it -- a check core/test can no longer perform by construction. The new test drives ExampleTool through real framework objects (a real LlmAgent, InvocationContext, Session and Context, no casts and no stubs) and asserts the few-shot block actually lands on the outgoing request, so it is not the tautology the old one had become. Verified against two mutations: dropping the ExampleTool re-export from core/src/common.ts fails it with "ExampleTool is not a constructor", and short-circuiting processLlmRequest fails the systemInstruction assertion. tsc --noEmit stays at 139 errors: the new file contributes none, which is itself the evidence that it type-checks against the published declarations. --- core/test/tools/example_tool_test.ts | 2 +- tests/integration/tools/example_tool_test.ts | 63 ++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/integration/tools/example_tool_test.ts diff --git a/core/test/tools/example_tool_test.ts b/core/test/tools/example_tool_test.ts index 10d94adad..d43a87c8e 100644 --- a/core/test/tools/example_tool_test.ts +++ b/core/test/tools/example_tool_test.ts @@ -149,7 +149,7 @@ describe('ExampleTool', () => { ); }); - it('is importable from @google/adk (public export)', () => { + it('is exported from the package barrel', () => { expect(new ExampleTool([])).toBeInstanceOf(ExampleTool); }); }); diff --git a/tests/integration/tools/example_tool_test.ts b/tests/integration/tools/example_tool_test.ts new file mode 100644 index 000000000..828b362f2 --- /dev/null +++ b/tests/integration/tools/example_tool_test.ts @@ -0,0 +1,63 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + Context, + createSession, + Example, + ExampleTool, + InvocationContext, + LlmAgent, + LlmRequest, + PluginManager, +} from '@google/adk'; +import {describe, expect, it} from 'vitest'; + +/** + * `core/test` reaches ADK symbols through a relative path into `core/src`, so + * nothing there can pin the *published* surface. This file imports through the + * `@google/adk` specifier instead, which `tsc` resolves to the declarations in + * `core/dist/types`: a symbol dropped from the built package fails here even + * though the source barrel still exports it. + */ + +const EXAMPLE: Example = { + input: {parts: [{text: 'What is 2+2?'}]}, + output: [{role: 'model', parts: [{text: '4'}]}], +}; + +function makeContext(text: string): Context { + const invocationContext = new InvocationContext({ + invocationId: 'test-invocation', + agent: new LlmAgent({name: 'test_agent', model: 'gemini-2.0-flash'}), + session: createSession({id: 'test-session', appName: 'test-app'}), + pluginManager: new PluginManager([]), + userContent: {role: 'user', parts: [{text}]}, + }); + return new Context({invocationContext}); +} + +describe('ExampleTool via the @google/adk package specifier', () => { + it('appends the few-shot block to an outgoing request', async () => { + const llmRequest: LlmRequest = { + contents: [], + toolsDict: {}, + liveConnectConfig: {}, + config: {}, + model: 'gemini-2.0-flash', + }; + + await new ExampleTool([EXAMPLE]).processLlmRequest({ + toolContext: makeContext('What is 2+2?'), + llmRequest, + }); + + const instruction = llmRequest.config?.systemInstruction; + expect(instruction).toContain(''); + expect(instruction).toContain('What is 2+2?'); + expect(instruction).toContain('4'); + }); +});