@google/adk 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/agents/base_agent.js +19 -1
- package/dist/cjs/agents/functions.js +4 -0
- package/dist/cjs/agents/instructions.js +81 -33
- package/dist/cjs/agents/invocation_context.js +0 -1
- package/dist/cjs/agents/llm_agent.js +52 -5
- package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/cjs/agents/processors/content_processor_utils.js +37 -24
- package/dist/cjs/agents/processors/content_request_processor.js +7 -0
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/cjs/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/cjs/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/cjs/auth/auth_preprocessor.js +12 -10
- package/dist/cjs/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +305 -0
- package/dist/cjs/code_executors/code_execution_utils.js +1 -1
- package/dist/cjs/code_executors/code_executor_context.js +7 -7
- package/dist/cjs/common.js +50 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +11 -0
- package/dist/cjs/context/token_based_context_compactor.js +1 -1
- package/dist/cjs/events/event.js +4 -2
- package/dist/cjs/index.js +14 -0
- package/dist/cjs/integrations/agent_registry/agent_registry.js +362 -0
- package/dist/cjs/integrations/agent_registry/agent_registry_mcp_toolset.js +122 -0
- package/dist/cjs/integrations/agent_registry/helpers.js +57 -0
- package/dist/cjs/integrations/agent_registry/types.js +50 -0
- package/dist/cjs/memory/vertex_ai_memory_bank_service.js +496 -0
- package/dist/cjs/models/gemini_llm_connection.js +62 -19
- package/dist/cjs/models/google_llm.js +26 -8
- package/dist/cjs/plugins/security_plugin.js +16 -0
- package/dist/cjs/runner/in_memory_runner.js +10 -5
- package/dist/cjs/runner/runner.js +32 -2
- package/dist/cjs/sessions/base_session_service.js +13 -2
- package/dist/cjs/sessions/database_session_service.js +51 -5
- package/dist/cjs/sessions/db/schema.js +45 -10
- package/dist/cjs/sessions/in_memory_session_service.js +72 -15
- package/dist/cjs/sessions/registry.js +4 -0
- package/dist/cjs/sessions/vertex_ai_session_service.js +429 -0
- package/dist/cjs/skills/gcp_skill_registry.js +104 -0
- package/dist/cjs/skills/loader.js +65 -0
- package/dist/cjs/skills/skill_registry.js +27 -0
- package/dist/cjs/tools/agent_tool.js +10 -5
- package/dist/cjs/tools/exit_loop_tool.js +9 -0
- package/dist/cjs/tools/function_tool.js +7 -2
- package/dist/cjs/tools/google_maps_grounding_tool.js +80 -0
- package/dist/cjs/tools/long_running_tool.js +2 -1
- package/dist/cjs/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/cjs/tools/mcp/mcp_tool.js +10 -6
- package/dist/cjs/tools/mcp/mcp_toolset.js +26 -3
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +78 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +84 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +133 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +232 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +224 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +127 -0
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +133 -0
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +256 -0
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +27 -28
- package/dist/cjs/tools/skill/load_skill_tool.js +12 -1
- package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/cjs/tools/skill/search_skills_tool.js +108 -0
- package/dist/cjs/tools/skill/skill_toolset.js +40 -5
- package/dist/cjs/tools/vertex_rag_retrieval_tool.js +64 -0
- package/dist/cjs/utils/async_queue.js +88 -0
- package/dist/cjs/utils/case_utils.js +53 -0
- package/dist/cjs/utils/env_aware_utils.js +4 -0
- package/dist/cjs/utils/file_utils.js +28 -0
- package/dist/cjs/utils/gemini_schema_util.js +18 -0
- package/dist/cjs/utils/live_connection_utils.js +284 -0
- package/dist/cjs/utils/model_name.js +9 -0
- package/dist/cjs/utils/partial_copy.js +51 -0
- package/dist/cjs/utils/streaming_utils.js +169 -122
- package/dist/cjs/utils/vertex_ai_utils.js +50 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/base_agent.js +19 -1
- package/dist/esm/agents/functions.js +4 -0
- package/dist/esm/agents/instructions.js +81 -33
- package/dist/esm/agents/invocation_context.js +0 -1
- package/dist/esm/agents/llm_agent.js +53 -5
- package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/esm/agents/processors/content_processor_utils.js +35 -23
- package/dist/esm/agents/processors/content_request_processor.js +7 -0
- package/dist/esm/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/esm/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/esm/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/esm/auth/auth_preprocessor.js +12 -10
- package/dist/esm/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +281 -0
- package/dist/esm/code_executors/code_execution_utils.js +1 -1
- package/dist/esm/code_executors/code_executor_context.js +7 -7
- package/dist/esm/common.js +43 -1
- package/dist/esm/context/summarizers/llm_summarizer.js +11 -0
- package/dist/esm/context/token_based_context_compactor.js +1 -1
- package/dist/esm/events/event.js +4 -2
- package/dist/esm/index.js +11 -0
- package/dist/esm/integrations/agent_registry/agent_registry.js +333 -0
- package/dist/esm/integrations/agent_registry/agent_registry_mcp_toolset.js +96 -0
- package/dist/esm/integrations/agent_registry/helpers.js +28 -0
- package/dist/esm/integrations/agent_registry/types.js +20 -0
- package/dist/esm/memory/vertex_ai_memory_bank_service.js +468 -0
- package/dist/esm/models/gemini_llm_connection.js +62 -19
- package/dist/esm/models/google_llm.js +26 -8
- package/dist/esm/plugins/security_plugin.js +16 -0
- package/dist/esm/runner/in_memory_runner.js +10 -5
- package/dist/esm/runner/runner.js +32 -2
- package/dist/esm/sessions/base_session_service.js +11 -1
- package/dist/esm/sessions/database_session_service.js +51 -5
- package/dist/esm/sessions/db/schema.js +44 -10
- package/dist/esm/sessions/in_memory_session_service.js +74 -16
- package/dist/esm/sessions/registry.js +7 -0
- package/dist/esm/sessions/vertex_ai_session_service.js +405 -0
- package/dist/esm/skills/gcp_skill_registry.js +78 -0
- package/dist/esm/skills/loader.js +64 -0
- package/dist/esm/skills/skill_registry.js +7 -0
- package/dist/esm/tools/agent_tool.js +10 -5
- package/dist/esm/tools/exit_loop_tool.js +9 -0
- package/dist/esm/tools/function_tool.js +7 -2
- package/dist/esm/tools/google_maps_grounding_tool.js +54 -0
- package/dist/esm/tools/long_running_tool.js +2 -1
- package/dist/esm/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/esm/tools/mcp/mcp_tool.js +10 -6
- package/dist/esm/tools/mcp/mcp_toolset.js +26 -3
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +48 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +60 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +111 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +206 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/esm/tools/skill/load_skill_resource_tool.js +26 -27
- package/dist/esm/tools/skill/load_skill_tool.js +12 -1
- package/dist/esm/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/esm/tools/skill/search_skills_tool.js +82 -0
- package/dist/esm/tools/skill/skill_toolset.js +40 -5
- package/dist/esm/tools/vertex_rag_retrieval_tool.js +36 -0
- package/dist/esm/utils/async_queue.js +60 -0
- package/dist/esm/utils/case_utils.js +25 -0
- package/dist/esm/utils/env_aware_utils.js +4 -0
- package/dist/esm/utils/file_utils.js +26 -0
- package/dist/esm/utils/gemini_schema_util.js +18 -0
- package/dist/esm/utils/live_connection_utils.js +256 -0
- package/dist/esm/utils/model_name.js +8 -0
- package/dist/esm/utils/partial_copy.js +23 -0
- package/dist/esm/utils/streaming_utils.js +167 -121
- package/dist/esm/utils/vertex_ai_utils.js +22 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +14 -0
- package/dist/types/a2a/a2a_remote_agent_utils.d.ts +29 -4
- package/dist/types/a2a/event_converter_utils.d.ts +14 -1
- package/dist/types/a2a/metadata_converter_utils.d.ts +18 -0
- package/dist/types/a2a/part_converter_utils.d.ts +51 -6
- package/dist/types/agents/invocation_context.d.ts +0 -9
- package/dist/types/agents/llm_agent.d.ts +14 -0
- package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +14 -0
- package/dist/types/agents/processors/base_llm_processor.d.ts +12 -4
- package/dist/types/agents/processors/basic_llm_request_processor.d.ts +12 -0
- package/dist/types/agents/processors/content_processor_utils.d.ts +26 -0
- package/dist/types/agents/processors/content_request_processor.d.ts +16 -0
- package/dist/types/agents/processors/context_compactor_request_processor.d.ts +12 -0
- package/dist/types/agents/processors/identity_llm_request_processor.d.ts +11 -0
- package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +14 -1
- package/dist/types/agents/processors/tool_filter_request_processor.d.ts +12 -1
- package/dist/types/agents/run_config.d.ts +15 -0
- package/dist/types/code_executors/agent_engine_sandbox_code_executor.d.ts +51 -0
- package/dist/types/common.d.ts +19 -1
- package/dist/types/context/summarizers/llm_summarizer.d.ts +17 -0
- package/dist/types/events/event_actions.d.ts +25 -8
- package/dist/types/events/structured_events.d.ts +13 -0
- package/dist/types/examples/example_util.d.ts +25 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/integrations/agent_registry/agent_registry.d.ts +94 -0
- package/dist/types/integrations/agent_registry/agent_registry_mcp_toolset.d.ts +62 -0
- package/dist/types/integrations/agent_registry/helpers.d.ts +7 -0
- package/dist/types/integrations/agent_registry/types.d.ts +101 -0
- package/dist/types/memory/vertex_ai_memory_bank_service.d.ts +52 -0
- package/dist/types/models/base_llm_connection.d.ts +10 -0
- package/dist/types/models/gemini_llm_connection.d.ts +15 -4
- package/dist/types/models/llm_response.d.ts +10 -1
- package/dist/types/plugins/security_plugin.d.ts +30 -0
- package/dist/types/runner/in_memory_runner.d.ts +28 -1
- package/dist/types/runner/runner.d.ts +47 -0
- package/dist/types/sessions/base_session_service.d.ts +22 -0
- package/dist/types/sessions/database_session_service.d.ts +1 -1
- package/dist/types/sessions/db/schema.d.ts +1 -0
- package/dist/types/sessions/in_memory_session_service.d.ts +1 -1
- package/dist/types/sessions/vertex_ai_session_service.d.ts +37 -0
- package/dist/types/skills/gcp_skill_registry.d.ts +24 -0
- package/dist/types/skills/loader.d.ts +7 -0
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/skills/skill_registry.d.ts +29 -0
- package/dist/types/tools/exit_loop_tool.d.ts +9 -0
- package/dist/types/tools/function_tool.d.ts +22 -2
- package/dist/types/tools/google_maps_grounding_tool.d.ts +22 -0
- package/dist/types/tools/long_running_tool.d.ts +11 -1
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +3 -0
- package/dist/types/tools/mcp/mcp_toolset.d.ts +2 -1
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +25 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +20 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.d.ts +20 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +34 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +59 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +23 -0
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +27 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +50 -0
- package/dist/types/tools/skill/load_skill_resource_tool.d.ts +1 -1
- package/dist/types/tools/skill/search_skills_tool.d.ts +14 -0
- package/dist/types/tools/skill/skill_toolset.d.ts +5 -0
- package/dist/types/tools/vertex_rag_retrieval_tool.d.ts +42 -0
- package/dist/types/utils/async_queue.d.ts +18 -0
- package/dist/types/utils/case_utils.d.ts +12 -0
- package/dist/types/utils/file_utils.d.ts +2 -0
- package/dist/types/utils/live_connection_utils.d.ts +30 -0
- package/dist/types/utils/model_name.d.ts +7 -0
- package/dist/types/utils/partial_copy.d.ts +13 -0
- package/dist/types/utils/streaming_utils.d.ts +7 -17
- package/dist/types/utils/vertex_ai_utils.d.ts +14 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/agents/base_agent.js +31 -1
- package/dist/web/agents/functions.js +4 -0
- package/dist/web/agents/instructions.js +81 -33
- package/dist/web/agents/invocation_context.js +0 -1
- package/dist/web/agents/llm_agent.js +53 -5
- package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/web/agents/processors/content_processor_utils.js +53 -23
- package/dist/web/agents/processors/content_request_processor.js +7 -0
- package/dist/web/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/web/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/web/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/web/auth/auth_preprocessor.js +12 -10
- package/dist/web/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/web/code_executors/agent_engine_sandbox_code_executor.js +281 -0
- package/dist/web/code_executors/code_execution_utils.js +1 -1
- package/dist/web/code_executors/code_executor_context.js +7 -7
- package/dist/web/common.js +43 -1
- package/dist/web/context/summarizers/llm_summarizer.js +11 -0
- package/dist/web/context/token_based_context_compactor.js +1 -1
- package/dist/web/events/event.js +4 -2
- package/dist/web/index.js +11 -0
- package/dist/web/integrations/agent_registry/agent_registry.js +333 -0
- package/dist/web/integrations/agent_registry/agent_registry_mcp_toolset.js +109 -0
- package/dist/web/integrations/agent_registry/helpers.js +28 -0
- package/dist/web/integrations/agent_registry/types.js +20 -0
- package/dist/web/memory/vertex_ai_memory_bank_service.js +475 -0
- package/dist/web/models/gemini_llm_connection.js +75 -19
- package/dist/web/models/google_llm.js +26 -8
- package/dist/web/plugins/security_plugin.js +16 -0
- package/dist/web/runner/in_memory_runner.js +10 -5
- package/dist/web/runner/runner.js +32 -2
- package/dist/web/sessions/base_session_service.js +11 -1
- package/dist/web/sessions/database_session_service.js +51 -5
- package/dist/web/sessions/db/schema.js +44 -10
- package/dist/web/sessions/in_memory_session_service.js +74 -16
- package/dist/web/sessions/registry.js +7 -0
- package/dist/web/sessions/vertex_ai_session_service.js +416 -0
- package/dist/web/skills/gcp_skill_registry.js +78 -0
- package/dist/web/skills/loader.js +64 -0
- package/dist/web/skills/skill_registry.js +7 -0
- package/dist/web/tools/agent_tool.js +10 -5
- package/dist/web/tools/exit_loop_tool.js +9 -0
- package/dist/web/tools/function_tool.js +7 -2
- package/dist/web/tools/google_maps_grounding_tool.js +54 -0
- package/dist/web/tools/long_running_tool.js +2 -1
- package/dist/web/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/web/tools/mcp/mcp_tool.js +10 -6
- package/dist/web/tools/mcp/mcp_toolset.js +26 -3
- package/dist/web/tools/openapi_tool/auth/auth_helpers.js +48 -0
- package/dist/web/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +60 -0
- package/dist/web/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +111 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +221 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
- package/dist/web/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/web/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/web/tools/skill/load_skill_resource_tool.js +26 -27
- package/dist/web/tools/skill/load_skill_tool.js +12 -1
- package/dist/web/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/web/tools/skill/search_skills_tool.js +82 -0
- package/dist/web/tools/skill/skill_toolset.js +40 -5
- package/dist/web/tools/vertex_rag_retrieval_tool.js +36 -0
- package/dist/web/utils/async_queue.js +60 -0
- package/dist/web/utils/case_utils.js +25 -0
- package/dist/web/utils/env_aware_utils.js +4 -0
- package/dist/web/utils/file_utils.js +26 -0
- package/dist/web/utils/gemini_schema_util.js +18 -0
- package/dist/web/utils/live_connection_utils.js +254 -0
- package/dist/web/utils/model_name.js +8 -0
- package/dist/web/utils/partial_copy.js +23 -0
- package/dist/web/utils/streaming_utils.js +221 -122
- package/dist/web/utils/vertex_ai_utils.js +22 -0
- package/dist/web/version.js +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Sessions } from '@google-cloud/vertexai/build/src/genai/sessions.js';
|
|
7
|
+
import { Event } from '../events/event.js';
|
|
8
|
+
import { AppendEventRequest, BaseSessionService, CreateSessionRequest, DeleteSessionRequest, GetSessionRequest, ListSessionsRequest, ListSessionsResponse } from './base_session_service.js';
|
|
9
|
+
import { Session } from './session.js';
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the given URI is a Vertex AI session service URI.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isVertexAiConnectionString(uri?: string): boolean;
|
|
14
|
+
export interface VertexAiSessionServiceOptions {
|
|
15
|
+
projectId?: string;
|
|
16
|
+
location?: string;
|
|
17
|
+
agentEngineId?: string;
|
|
18
|
+
expressModeApiKey?: string;
|
|
19
|
+
sessions?: Sessions;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A session service implementation that integrates with Vertex AI Agent Engine Sessions.
|
|
23
|
+
*/
|
|
24
|
+
export declare class VertexAiSessionService extends BaseSessionService {
|
|
25
|
+
private sessions;
|
|
26
|
+
private agentEngineId?;
|
|
27
|
+
private expressModeApiKey?;
|
|
28
|
+
private projectId?;
|
|
29
|
+
private location?;
|
|
30
|
+
constructor(options: VertexAiSessionServiceOptions);
|
|
31
|
+
private getReasoningEngineId;
|
|
32
|
+
createSession({ appName, userId, state, sessionId, }: CreateSessionRequest): Promise<Session>;
|
|
33
|
+
getSession({ appName, userId, sessionId, config, }: GetSessionRequest): Promise<Session | undefined>;
|
|
34
|
+
listSessions({ appName, userId, limit, offset, page, order, }: ListSessionsRequest): Promise<ListSessionsResponse>;
|
|
35
|
+
deleteSession({ appName, userId: _userId, sessionId, }: DeleteSessionRequest): Promise<void>;
|
|
36
|
+
appendEvent({ session, event, }: AppendEventRequest): Promise<Event>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Client } from '@google-cloud/vertexai';
|
|
7
|
+
import { Frontmatter, Skill } from './skill.js';
|
|
8
|
+
import { SkillRegistry } from './skill_registry.js';
|
|
9
|
+
export interface GCPSkillRegistryOptions {
|
|
10
|
+
projectId?: string;
|
|
11
|
+
location?: string;
|
|
12
|
+
client?: Client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* GCP implementation of SkillRegistry using GCP Skill Registry API.
|
|
16
|
+
*/
|
|
17
|
+
export declare class GCPSkillRegistry implements SkillRegistry {
|
|
18
|
+
private readonly projectId?;
|
|
19
|
+
private readonly location?;
|
|
20
|
+
private readonly client;
|
|
21
|
+
constructor(options?: GCPSkillRegistryOptions);
|
|
22
|
+
getSkill(name: string): Promise<Skill>;
|
|
23
|
+
searchSkills(query: string): Promise<Frontmatter[]>;
|
|
24
|
+
}
|
|
@@ -36,3 +36,10 @@ export declare function validateSkillDir(skillDir: string): Promise<string[]>;
|
|
|
36
36
|
* @returns A promise that resolves to a map of skill names to their corresponding Skill objects.
|
|
37
37
|
*/
|
|
38
38
|
export declare function loadAllSkillsInDir(skillsBasePath: string): Promise<Record<string, Skill>>;
|
|
39
|
+
/**
|
|
40
|
+
* Loads a complete skill directly from in-memory zip file buffer.
|
|
41
|
+
*
|
|
42
|
+
* @param zipBuffer - The raw Buffer of the zip file containing the skill.
|
|
43
|
+
* @returns A Skill object with all components loaded.
|
|
44
|
+
*/
|
|
45
|
+
export declare function loadSkillFromZipBuffer(zipBuffer: Buffer): Skill;
|
|
@@ -8,7 +8,7 @@ export declare const SNAKE_OR_KEBAB_NAME_PATTERN: RegExp;
|
|
|
8
8
|
/**
|
|
9
9
|
* Schema and Type for Skill Frontmatter metadata.
|
|
10
10
|
*/
|
|
11
|
-
export declare const FrontmatterSchema: z.
|
|
11
|
+
export declare const FrontmatterSchema: z.ZodPreprocess<z.ZodObject<{
|
|
12
12
|
name: z.ZodString;
|
|
13
13
|
description: z.ZodString;
|
|
14
14
|
license: z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Frontmatter, Skill } from './skill.js';
|
|
7
|
+
/**
|
|
8
|
+
* Interface for a skill registry.
|
|
9
|
+
*/
|
|
10
|
+
export interface SkillRegistry {
|
|
11
|
+
/**
|
|
12
|
+
* Fetches a skill from the registry.
|
|
13
|
+
*
|
|
14
|
+
* @param name The name of the skill.
|
|
15
|
+
* @returns A Promise resolving to a Skill object.
|
|
16
|
+
*/
|
|
17
|
+
getSkill(name: string): Promise<Skill>;
|
|
18
|
+
/**
|
|
19
|
+
* Searches for skills in the registry.
|
|
20
|
+
*
|
|
21
|
+
* @param query The search query.
|
|
22
|
+
* @returns A Promise resolving to a list of Frontmatter objects for discovery.
|
|
23
|
+
*/
|
|
24
|
+
searchSkills(query: string): Promise<Frontmatter[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the description for the search_skills tool.
|
|
27
|
+
*/
|
|
28
|
+
searchToolDescription?(): string | undefined;
|
|
29
|
+
}
|
|
@@ -14,8 +14,17 @@ import { BaseTool, RunAsyncToolRequest } from './base_tool.js';
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export declare class ExitLoopTool extends BaseTool {
|
|
17
|
+
/** Creates an ExitLoopTool with its fixed name and description. */
|
|
17
18
|
constructor();
|
|
19
|
+
/** Returns the function declaration for this tool. */
|
|
18
20
|
_getDeclaration(): FunctionDeclaration;
|
|
21
|
+
/**
|
|
22
|
+
* Sets `escalate` and `skipSummarization` on the event actions, signalling
|
|
23
|
+
* the {@link LoopAgent} to stop iterating.
|
|
24
|
+
*
|
|
25
|
+
* @param request The tool request containing the current tool context.
|
|
26
|
+
* @returns An empty string response.
|
|
27
|
+
*/
|
|
19
28
|
runAsync({ toolContext, }: RunAsyncToolRequest): Promise<unknown>;
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
@@ -12,7 +12,14 @@ import { BaseTool, RunAsyncToolRequest } from './base_tool.js';
|
|
|
12
12
|
* Input parameters of the function tool.
|
|
13
13
|
*/
|
|
14
14
|
export type ToolInputParameters = z3.ZodObject<z3.ZodRawShape> | z4.ZodObject<z4.ZodRawShape> | Schema | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The arguments passed to the function tool's `execute` callback, inferred
|
|
17
|
+
* from the `parameters` schema type.
|
|
18
|
+
*/
|
|
15
19
|
export type ToolExecuteArgument<TParameters extends ToolInputParameters> = TParameters extends z3.ZodObject<infer T, infer U, infer V> ? z3.infer<z3.ZodObject<T, U, V>> : TParameters extends z4.ZodObject<infer T> ? z4.infer<z4.ZodObject<T>> : TParameters extends Schema ? unknown : string;
|
|
20
|
+
/**
|
|
21
|
+
* The signature of the user-provided function executed by a {@link FunctionTool}.
|
|
22
|
+
*/
|
|
16
23
|
export type ToolExecuteFunction<TParameters extends ToolInputParameters> = (input: ToolExecuteArgument<TParameters>, tool_context?: Context) => Promise<unknown> | unknown;
|
|
17
24
|
/**
|
|
18
25
|
* The configuration options for creating a function-based tool.
|
|
@@ -40,6 +47,14 @@ declare const FUNCTION_TOOL_SIGNATURE_SYMBOL: unique symbol;
|
|
|
40
47
|
* @returns True if the object is an instance of BaseTool, false otherwise.
|
|
41
48
|
*/
|
|
42
49
|
export declare function isFunctionTool(obj: unknown): obj is FunctionTool;
|
|
50
|
+
/**
|
|
51
|
+
* A tool that wraps a user-defined function, making it callable by an LLM.
|
|
52
|
+
*
|
|
53
|
+
* The function's name, description, and parameter schema are exposed to the
|
|
54
|
+
* model as a function declaration. When the model requests a call, the
|
|
55
|
+
* framework validates the arguments and invokes the user-provided `execute`
|
|
56
|
+
* callback.
|
|
57
|
+
*/
|
|
43
58
|
export declare class FunctionTool<TParameters extends ToolInputParameters = undefined> extends BaseTool {
|
|
44
59
|
/** A unique symbol to identify ADK function tool class. */
|
|
45
60
|
readonly [FUNCTION_TOOL_SIGNATURE_SYMBOL] = true;
|
|
@@ -51,11 +66,16 @@ export declare class FunctionTool<TParameters extends ToolInputParameters = unde
|
|
|
51
66
|
*/
|
|
52
67
|
constructor(options: ToolOptions<TParameters>);
|
|
53
68
|
/**
|
|
54
|
-
*
|
|
69
|
+
* Returns the function declaration derived from the tool's name, description,
|
|
70
|
+
* and parameter schema.
|
|
55
71
|
*/
|
|
56
72
|
_getDeclaration(): FunctionDeclaration;
|
|
57
73
|
/**
|
|
58
|
-
*
|
|
74
|
+
* Validates the model-provided arguments against the parameter schema and
|
|
75
|
+
* invokes the user-defined `execute` function.
|
|
76
|
+
*
|
|
77
|
+
* @param req The tool request containing arguments and tool context.
|
|
78
|
+
* @returns A promise resolving to the function's return value.
|
|
59
79
|
*/
|
|
60
80
|
runAsync(req: RunAsyncToolRequest): Promise<unknown>;
|
|
61
81
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LlmRequest } from '../models/llm_request.js';
|
|
2
|
+
import { BaseTool, ToolProcessLlmRequest } from './base_tool.js';
|
|
3
|
+
/**
|
|
4
|
+
* Applies Google Maps grounding to the LLM request if supported.
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyGoogleMapsGrounding(llmRequest: LlmRequest): void;
|
|
7
|
+
/**
|
|
8
|
+
* A built-in tool that is automatically invoked by Gemini 2 models to ground
|
|
9
|
+
* query results with Google Maps.
|
|
10
|
+
*
|
|
11
|
+
* This tool operates internally within the model and does not require or
|
|
12
|
+
* perform local code execution.
|
|
13
|
+
*/
|
|
14
|
+
export declare class GoogleMapsGroundingTool extends BaseTool {
|
|
15
|
+
constructor();
|
|
16
|
+
runAsync(): Promise<unknown>;
|
|
17
|
+
processLlmRequest({ llmRequest, }: ToolProcessLlmRequest): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A global instance of {@link GoogleMapsGroundingTool}.
|
|
21
|
+
*/
|
|
22
|
+
export declare const GOOGLE_MAPS_GROUNDING: GoogleMapsGroundingTool;
|
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { FunctionDeclaration } from '@google/genai';
|
|
7
7
|
import { FunctionTool, ToolInputParameters, ToolOptions } from './function_tool.js';
|
|
8
|
+
/**
|
|
9
|
+
* A {@link FunctionTool} for long-running operations whose result is returned
|
|
10
|
+
* asynchronously.
|
|
11
|
+
*
|
|
12
|
+
* The framework invokes the user-provided function and delivers the response
|
|
13
|
+
* back to the model once it completes, identified by the `function_call_id`.
|
|
14
|
+
* The model is also instructed not to re-invoke the tool while a call is
|
|
15
|
+
* already in flight.
|
|
16
|
+
*/
|
|
8
17
|
export declare class LongRunningFunctionTool<TParameters extends ToolInputParameters = undefined> extends FunctionTool<TParameters> {
|
|
9
18
|
/**
|
|
10
19
|
* The constructor acts as the user-friendly factory.
|
|
@@ -12,7 +21,8 @@ export declare class LongRunningFunctionTool<TParameters extends ToolInputParame
|
|
|
12
21
|
*/
|
|
13
22
|
constructor(options: ToolOptions<TParameters>);
|
|
14
23
|
/**
|
|
15
|
-
*
|
|
24
|
+
* Returns the function declaration with an appended instruction warning the
|
|
25
|
+
* model not to re-invoke the tool while it is still running.
|
|
16
26
|
*/
|
|
17
27
|
_getDeclaration(): FunctionDeclaration;
|
|
18
28
|
}
|
|
@@ -59,6 +59,9 @@ export type MCPConnectionParams = StdioConnectionParams | StreamableHTTPConnecti
|
|
|
59
59
|
*/
|
|
60
60
|
export declare class MCPSessionManager {
|
|
61
61
|
private readonly connectionParams;
|
|
62
|
+
private readonly activeSessions;
|
|
62
63
|
constructor(connectionParams: MCPConnectionParams);
|
|
63
64
|
createSession(): Promise<Client>;
|
|
65
|
+
closeSession(client: Client): Promise<void>;
|
|
66
|
+
getActiveSessions(): Client[];
|
|
64
67
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
6
7
|
import { BaseTool } from '../base_tool.js';
|
|
7
8
|
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
8
9
|
import { MCPConnectionParams } from './mcp_session_manager.js';
|
|
@@ -38,6 +39,6 @@ import { MCPConnectionParams } from './mcp_session_manager.js';
|
|
|
38
39
|
export declare class MCPToolset extends BaseToolset {
|
|
39
40
|
private readonly mcpSessionManager;
|
|
40
41
|
constructor(connectionParams: MCPConnectionParams, toolFilter?: ToolPredicate | string[], prefix?: string);
|
|
41
|
-
getTools(): Promise<BaseTool[]>;
|
|
42
|
+
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
42
43
|
close(): Promise<void>;
|
|
43
44
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
import { AuthCredential } from '../../../auth/auth_credential.js';
|
|
8
|
+
/**
|
|
9
|
+
* Applies the given credential to the request headers and URL.
|
|
10
|
+
*
|
|
11
|
+
* @param url The target URL.
|
|
12
|
+
* @param headers The request headers.
|
|
13
|
+
* @param credential The auth credential.
|
|
14
|
+
* @param authScheme The auth scheme from OpenAPI spec.
|
|
15
|
+
* @returns The updated URL (if modified by query params).
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyCredential(url: string, headers: Record<string, string>, credential?: AuthCredential, authScheme?: OpenAPIV3.SecuritySchemeObject): string;
|
|
18
|
+
/**
|
|
19
|
+
* Helper to create a simple API Key auth scheme.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createApiKeyScheme(name: string, inLocation: 'header' | 'query' | 'cookie'): OpenAPIV3.SecuritySchemeObject;
|
|
22
|
+
/**
|
|
23
|
+
* Helper to create a simple Bearer Token auth scheme.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createBearerScheme(): OpenAPIV3.SecuritySchemeObject;
|
package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { AuthCredential } from '../../../../auth/auth_credential.js';
|
|
7
|
+
import { AuthScheme } from '../../../../auth/auth_schemes.js';
|
|
8
|
+
import { BaseCredentialExchanger, ExchangeResult } from '../../../../auth/exchanger/base_credential_exchanger.js';
|
|
9
|
+
/**
|
|
10
|
+
* Automatically selects the appropriate credential exchanger based on the auth scheme.
|
|
11
|
+
* Ported from Python implementation.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AutoAuthCredentialExchanger implements BaseCredentialExchanger {
|
|
14
|
+
private exchangers;
|
|
15
|
+
constructor();
|
|
16
|
+
exchange(params: {
|
|
17
|
+
authScheme?: AuthScheme;
|
|
18
|
+
authCredential: AuthCredential;
|
|
19
|
+
}): Promise<ExchangeResult>;
|
|
20
|
+
}
|
package/dist/types/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { AuthCredential } from '../../../../auth/auth_credential.js';
|
|
7
|
+
import { AuthScheme } from '../../../../auth/auth_schemes.js';
|
|
8
|
+
import { BaseCredentialExchanger, ExchangeResult } from '../../../../auth/exchanger/base_credential_exchanger.js';
|
|
9
|
+
/**
|
|
10
|
+
* Fetches credentials for Google Service Account.
|
|
11
|
+
* Ported from Python implementation.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ServiceAccountCredentialExchanger implements BaseCredentialExchanger {
|
|
14
|
+
exchange(params: {
|
|
15
|
+
authScheme?: AuthScheme;
|
|
16
|
+
authCredential: AuthCredential;
|
|
17
|
+
}): Promise<ExchangeResult>;
|
|
18
|
+
private exchangeForDefaultCredential;
|
|
19
|
+
private exchangeForExplicitCredential;
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
import { ApiParameter } from './operation_parser.js';
|
|
8
|
+
export interface OperationEndpoint {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
path: string;
|
|
11
|
+
method: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ParsedOperation {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
endpoint: OperationEndpoint;
|
|
17
|
+
operation: OpenAPIV3.OperationObject;
|
|
18
|
+
parameters: ApiParameter[];
|
|
19
|
+
returnValue?: ApiParameter;
|
|
20
|
+
authScheme?: OpenAPIV3.SecuritySchemeObject;
|
|
21
|
+
}
|
|
22
|
+
export declare class OpenApiSpecParser {
|
|
23
|
+
private preservePropertyNames;
|
|
24
|
+
constructor(options?: {
|
|
25
|
+
preservePropertyNames?: boolean;
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Parses an OpenAPI specification document and extracts a list of operations.
|
|
29
|
+
*
|
|
30
|
+
* @param openapiSpec The OpenAPI V3 document to parse.
|
|
31
|
+
* @returns An array of parsed operations.
|
|
32
|
+
*/
|
|
33
|
+
parse(openapiSpec: OpenAPIV3.Document): ParsedOperation[];
|
|
34
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
export interface ApiParameter {
|
|
8
|
+
originalName: string;
|
|
9
|
+
paramLocation: string;
|
|
10
|
+
paramSchema: OpenAPIV3.SchemaObject;
|
|
11
|
+
description?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parses an OpenAPI OperationObject and extracts its parameters, request body, and return value.
|
|
17
|
+
*
|
|
18
|
+
* It maps OpenAPI parameters and request bodies into a flat list of `ApiParameter` objects
|
|
19
|
+
* that are compatible with Gemini's tool function declarations.
|
|
20
|
+
*/
|
|
21
|
+
export declare class OperationParser {
|
|
22
|
+
private readonly operation;
|
|
23
|
+
private params;
|
|
24
|
+
private returnValue?;
|
|
25
|
+
private preservePropertyNames;
|
|
26
|
+
constructor(operation: OpenAPIV3.OperationObject, options?: {
|
|
27
|
+
preservePropertyNames?: boolean;
|
|
28
|
+
});
|
|
29
|
+
private getParamName;
|
|
30
|
+
private processOperationParameters;
|
|
31
|
+
private processRequestBody;
|
|
32
|
+
private processReturnValue;
|
|
33
|
+
private dedupeParamNames;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the list of parsed parameters extracted from the OpenAPI operation.
|
|
36
|
+
*
|
|
37
|
+
* @returns An array of parsed parameters.
|
|
38
|
+
*/
|
|
39
|
+
getParameters(): ApiParameter[];
|
|
40
|
+
/**
|
|
41
|
+
* Generates a JSON schema representing the arguments of the tool function call.
|
|
42
|
+
*
|
|
43
|
+
* @returns A JSON Schema object.
|
|
44
|
+
*/
|
|
45
|
+
getJsonSchema(): Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Gets a valid tool function name derived from the operation's operationId.
|
|
48
|
+
*
|
|
49
|
+
* @throws {Error} If the operation does not have an operationId.
|
|
50
|
+
* @returns A string representing the function name.
|
|
51
|
+
*/
|
|
52
|
+
getFunctionName(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the description of the tool, derived from the operation's description or summary.
|
|
55
|
+
*
|
|
56
|
+
* @returns A string representing the description.
|
|
57
|
+
*/
|
|
58
|
+
getDescription(): string;
|
|
59
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
import { Context } from '../../../agents/context.js';
|
|
8
|
+
import { AuthCredential } from '../../../auth/auth_credential.js';
|
|
9
|
+
export interface AuthPreparationResult {
|
|
10
|
+
state: 'pending' | 'done';
|
|
11
|
+
authCredential?: AuthCredential;
|
|
12
|
+
}
|
|
13
|
+
export declare class ToolAuthHandler {
|
|
14
|
+
private readonly context;
|
|
15
|
+
private readonly authScheme?;
|
|
16
|
+
private readonly authCredential?;
|
|
17
|
+
private readonly credentialKey?;
|
|
18
|
+
constructor(context: Context, authScheme?: OpenAPIV3.SecuritySchemeObject | undefined, authCredential?: AuthCredential | undefined, credentialKey?: string | undefined);
|
|
19
|
+
static fromToolContext(context: Context, authScheme?: OpenAPIV3.SecuritySchemeObject, authCredential?: AuthCredential, options?: {
|
|
20
|
+
credentialKey?: string;
|
|
21
|
+
}): ToolAuthHandler;
|
|
22
|
+
prepareAuthCredentials(): Promise<AuthPreparationResult>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
8
|
+
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
9
|
+
import { BaseTool } from '../base_tool.js';
|
|
10
|
+
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
11
|
+
export declare class OpenAPIToolset extends BaseToolset {
|
|
12
|
+
private tools;
|
|
13
|
+
constructor(options?: {
|
|
14
|
+
specDict?: OpenAPIV3.Document;
|
|
15
|
+
specStr?: string;
|
|
16
|
+
specType?: 'json' | 'yaml';
|
|
17
|
+
toolFilter?: ToolPredicate | string[];
|
|
18
|
+
prefix?: string;
|
|
19
|
+
preservePropertyNames?: boolean;
|
|
20
|
+
authScheme?: OpenAPIV3.SecuritySchemeObject;
|
|
21
|
+
authCredential?: AuthCredential;
|
|
22
|
+
credentialKey?: string;
|
|
23
|
+
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
24
|
+
});
|
|
25
|
+
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
+
import { OpenAPIV3 } from 'openapi-types';
|
|
8
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
9
|
+
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
10
|
+
import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
|
|
11
|
+
import { ApiParameter } from './openapi_spec_parser/operation_parser.js';
|
|
12
|
+
import { OperationEndpoint } from './openapi_spec_parser/openapi_spec_parser.js';
|
|
13
|
+
export declare class RestApiTool extends BaseTool {
|
|
14
|
+
private readonly endpoint;
|
|
15
|
+
private readonly operation;
|
|
16
|
+
private authScheme?;
|
|
17
|
+
private authCredential?;
|
|
18
|
+
private operationParser;
|
|
19
|
+
private headerProvider?;
|
|
20
|
+
private credentialKey?;
|
|
21
|
+
constructor(name: string, description: string, endpoint: OperationEndpoint, operation: OpenAPIV3.OperationObject, authScheme?: OpenAPIV3.SecuritySchemeObject | undefined, authCredential?: AuthCredential | undefined, options?: {
|
|
22
|
+
preservePropertyNames?: boolean;
|
|
23
|
+
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
24
|
+
credentialKey?: string;
|
|
25
|
+
});
|
|
26
|
+
configureAuthScheme(authScheme: OpenAPIV3.SecuritySchemeObject): void;
|
|
27
|
+
configureAuthCredential(authCredential: AuthCredential): void;
|
|
28
|
+
configureCredentialKey(credentialKey: string): void;
|
|
29
|
+
_getDeclaration(): FunctionDeclaration;
|
|
30
|
+
runAsync(request: RunAsyncToolRequest): Promise<unknown>;
|
|
31
|
+
}
|
|
32
|
+
export interface PreparedParams {
|
|
33
|
+
url: string;
|
|
34
|
+
headers: Record<string, string>;
|
|
35
|
+
body: unknown;
|
|
36
|
+
bodyData: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export declare function prepareRequestParams(endpoint: OperationEndpoint, parameters: ApiParameter[], args: Record<string, unknown>): PreparedParams;
|
|
39
|
+
export declare function prepareRequestBody(requestBody: OpenAPIV3.RequestBodyObject | OpenAPIV3.ReferenceObject | undefined, body: unknown, bodyData: Record<string, unknown>, headers: Record<string, string>): unknown;
|
|
40
|
+
export declare function createRestApiTool(parsed: {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
endpoint: OperationEndpoint;
|
|
44
|
+
operation: OpenAPIV3.OperationObject;
|
|
45
|
+
authScheme?: OpenAPIV3.SecuritySchemeObject;
|
|
46
|
+
}, options?: {
|
|
47
|
+
preservePropertyNames?: boolean;
|
|
48
|
+
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
49
|
+
credentialKey?: string;
|
|
50
|
+
}): RestApiTool;
|
|
@@ -10,6 +10,6 @@ export declare class LoadSkillResourceTool extends BaseTool {
|
|
|
10
10
|
private toolset;
|
|
11
11
|
constructor(toolset: SkillToolset);
|
|
12
12
|
_getDeclaration(): FunctionDeclaration;
|
|
13
|
-
runAsync({ args }: RunAsyncToolRequest): Promise<unknown>;
|
|
13
|
+
runAsync({ args, toolContext, }: RunAsyncToolRequest): Promise<unknown>;
|
|
14
14
|
processLlmRequest(request: ToolProcessLlmRequest): Promise<void>;
|
|
15
15
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
+
import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
|
|
8
|
+
import { SkillToolset } from './skill_toolset.js';
|
|
9
|
+
export declare class SearchSkillsTool extends BaseTool {
|
|
10
|
+
private toolset;
|
|
11
|
+
constructor(toolset: SkillToolset);
|
|
12
|
+
_getDeclaration(): FunctionDeclaration;
|
|
13
|
+
runAsync({ args }: RunAsyncToolRequest): Promise<unknown>;
|
|
14
|
+
}
|
|
@@ -8,6 +8,7 @@ import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
|
8
8
|
import { BaseCodeExecutor } from '../../code_executors/base_code_executor.js';
|
|
9
9
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
10
10
|
import { Skill } from '../../skills/skill.js';
|
|
11
|
+
import { SkillRegistry } from '../../skills/skill_registry.js';
|
|
11
12
|
import { BaseTool } from '../base_tool.js';
|
|
12
13
|
import { BaseToolset } from '../base_toolset.js';
|
|
13
14
|
export declare class SkillToolset extends BaseToolset {
|
|
@@ -15,14 +16,18 @@ export declare class SkillToolset extends BaseToolset {
|
|
|
15
16
|
private tools;
|
|
16
17
|
additionalTools: Array<BaseTool | BaseToolset>;
|
|
17
18
|
codeExecutor?: BaseCodeExecutor;
|
|
19
|
+
registry?: SkillRegistry;
|
|
18
20
|
private toolCache;
|
|
21
|
+
private fetchedSkillCache;
|
|
19
22
|
constructor(skills: Record<string, Skill> | Skill[], options?: {
|
|
20
23
|
codeExecutor?: BaseCodeExecutor;
|
|
21
24
|
additionalTools?: Array<BaseTool | BaseToolset>;
|
|
25
|
+
registry?: SkillRegistry;
|
|
22
26
|
});
|
|
23
27
|
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
24
28
|
close(): Promise<void>;
|
|
25
29
|
getSkill(name: string): Skill | undefined;
|
|
30
|
+
getOrFetchSkill(name: string, invocationId?: string): Promise<Skill | undefined>;
|
|
26
31
|
processLlmRequest(toolContext: Context, llmRequest: LlmRequest): Promise<void>;
|
|
27
32
|
private resolveAdditionalTools;
|
|
28
33
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { VertexRagStore } from '@google/genai';
|
|
7
|
+
import { BaseTool, ToolProcessLlmRequest } from './base_tool.js';
|
|
8
|
+
/**
|
|
9
|
+
* A tool that retrieves relevant content from a Vertex AI RAG corpus to ground
|
|
10
|
+
* model responses.
|
|
11
|
+
*
|
|
12
|
+
* This tool operates server-side; it modifies the LLM request config to enable
|
|
13
|
+
* RAG retrieval via the `retrieval.vertexRagStore` field and does not perform
|
|
14
|
+
* local code execution.
|
|
15
|
+
*
|
|
16
|
+
* **Note:** The Vertex AI RAG Engine only supports one corpus per
|
|
17
|
+
* `ragResources` array. Create one `VertexRagRetrievalTool` instance per
|
|
18
|
+
* corpus.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { VertexRagRetrievalTool } from '@google/adk';
|
|
23
|
+
* import { VertexRagStore } from '@google/genai';
|
|
24
|
+
*
|
|
25
|
+
* const ragTool = new VertexRagRetrievalTool({
|
|
26
|
+
* ragResources: [{ragCorpus: 'projects/my-project/locations/us-central1/ragCorpora/my-corpus'}],
|
|
27
|
+
* similarityTopK: 5,
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const agent = new LlmAgent({ tools: [ragTool], ... });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class VertexRagRetrievalTool extends BaseTool {
|
|
34
|
+
private readonly vertexRagStore;
|
|
35
|
+
constructor(config: VertexRagStore);
|
|
36
|
+
/**
|
|
37
|
+
* This tool is executed server-side by the Vertex AI RAG Engine.
|
|
38
|
+
* Local execution is not required.
|
|
39
|
+
*/
|
|
40
|
+
runAsync(): Promise<unknown>;
|
|
41
|
+
processLlmRequest({ llmRequest, }: ToolProcessLlmRequest): Promise<void>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A generic, async-safe queue that implements AsyncIterable.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
10
|
+
private queue;
|
|
11
|
+
private resolvers;
|
|
12
|
+
private closed;
|
|
13
|
+
private errorVal?;
|
|
14
|
+
push(value: T): void;
|
|
15
|
+
error(err: unknown): void;
|
|
16
|
+
close(): void;
|
|
17
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Recursively converts snake_case keys of an object to camelCase.
|
|
8
|
+
*
|
|
9
|
+
* @param val The value to convert.
|
|
10
|
+
* @returns The converted value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function camelCaseKeys(val: unknown): unknown;
|