@google/adk 2.2.0 → 2.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/a2a/a2a_remote_agent.js +4 -1
- package/dist/cjs/a2a/agent_card.js +102 -26
- package/dist/cjs/a2a/agent_to_a2a.js +1 -1
- package/dist/cjs/a2a/event_converter_utils.js +5 -1
- package/dist/cjs/a2a/metadata_converter_utils.js +2 -1
- package/dist/cjs/agents/functions.js +199 -25
- package/dist/cjs/agents/instructions.js +4 -1
- package/dist/cjs/agents/invocation_context.js +26 -4
- package/dist/cjs/agents/langgraph_agent.js +152 -0
- package/dist/cjs/agents/llm_agent.js +175 -101
- package/dist/cjs/agents/processors/code_execution_request_processor.js +10 -6
- package/dist/cjs/agents/remote_agent.js +187 -0
- package/dist/cjs/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/cjs/auth/auth_handler.js +37 -5
- package/dist/cjs/auth/auth_schemes.js +9 -0
- package/dist/cjs/cli/cli_eval.js +532 -0
- package/dist/cjs/cli/utils/envs.js +116 -0
- package/dist/cjs/cli/utils/evals.js +137 -0
- package/dist/cjs/cli/utils/logs.js +150 -0
- package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/cjs/code_executors/code_execution_utils.js +48 -16
- package/dist/cjs/code_executors/code_executor_context.js +6 -2
- package/dist/cjs/common.js +90 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +12 -10
- package/dist/cjs/context/token_based_context_compactor.js +2 -1
- package/dist/cjs/events/abort_events.js +135 -0
- package/dist/cjs/events/event.js +4 -2
- package/dist/cjs/events/internal_metadata.js +131 -0
- package/dist/cjs/examples/example_util.js +23 -2
- package/dist/cjs/flows/llm_flows/audio_transcriber.js +170 -0
- package/dist/cjs/index.js +97 -1
- package/dist/cjs/integrations/agent_registry/helpers.js +1 -1
- package/dist/cjs/models/gemini_llm_connection.js +16 -8
- package/dist/cjs/models/google_llm.js +13 -16
- package/dist/cjs/models/llm_response.js +9 -1
- package/dist/cjs/models/registry.js +1 -1
- package/dist/cjs/models/routed_llm.js +9 -8
- package/dist/cjs/planners/plan_re_act_planner.js +1 -1
- package/dist/cjs/plugins/debug_logging_plugin.js +653 -0
- package/dist/cjs/plugins/plugin_manager.js +1 -1
- package/dist/cjs/plugins/tool_call_integrity_plugin.js +364 -0
- package/dist/cjs/runner/in_memory_runner.js +6 -11
- package/dist/cjs/runner/runner.js +121 -35
- package/dist/cjs/sessions/db/operations.js +1 -1
- package/dist/cjs/sessions/in_memory_session_service.js +3 -1
- package/dist/cjs/sessions/state.js +8 -4
- package/dist/cjs/sessions/vertex_ai_session_service.js +34 -15
- package/dist/cjs/telemetry/tracing.js +97 -66
- package/dist/cjs/tools/agent_tool.js +44 -0
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +142 -0
- package/dist/cjs/tools/apihub_tool/clients/apihub_client.js +272 -0
- package/dist/cjs/tools/apihub_tool/clients/secret_client.js +148 -0
- package/dist/cjs/tools/apihub_tool/clients/service_account.js +48 -0
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +185 -0
- package/dist/cjs/tools/application_integration_tool/clients/cloud_request.js +133 -0
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +603 -0
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +219 -0
- package/dist/cjs/tools/crewai_tool.js +132 -0
- package/dist/cjs/tools/example_tool.js +10 -0
- package/dist/cjs/tools/function_tool.js +319 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +97 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +226 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +58 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +440 -0
- package/dist/cjs/tools/google_api_tool/index.js +64 -0
- package/dist/cjs/tools/langchain_tool.js +172 -0
- package/dist/cjs/tools/mcp/index.js +12 -0
- package/dist/cjs/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +46 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +14 -2
- package/dist/cjs/tools/retrieval/base_retrieval_tool.js +18 -3
- package/dist/cjs/tools/toolbox_tool.js +108 -0
- package/dist/cjs/utils/env_aware_utils.js +6 -8
- package/dist/cjs/utils/error_utils.js +11 -11
- package/dist/cjs/utils/file_extension_utils.js +11 -0
- package/dist/cjs/utils/file_utils.js +2 -24
- package/dist/cjs/utils/gemini_schema_util.js +4 -1
- package/dist/cjs/utils/json_utils.js +49 -0
- package/dist/cjs/utils/live_connection_utils.js +4 -5
- package/dist/cjs/utils/logger_node.js +7 -1
- package/dist/cjs/utils/object_notation_utils.js +6 -3
- package/dist/cjs/utils/streaming_utils.js +12 -12
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_remote_agent.js +4 -1
- package/dist/esm/a2a/agent_card.js +103 -27
- package/dist/esm/a2a/agent_to_a2a.js +5 -2
- package/dist/esm/a2a/event_converter_utils.js +5 -1
- package/dist/esm/a2a/metadata_converter_utils.js +2 -1
- package/dist/esm/agents/functions.js +198 -25
- package/dist/esm/agents/instructions.js +4 -1
- package/dist/esm/agents/invocation_context.js +24 -4
- package/dist/esm/agents/langgraph_agent.js +123 -0
- package/dist/esm/agents/llm_agent.js +185 -104
- package/dist/esm/agents/processors/code_execution_request_processor.js +13 -8
- package/dist/esm/agents/remote_agent.js +164 -0
- package/dist/esm/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/esm/auth/auth_handler.js +37 -5
- package/dist/esm/auth/auth_schemes.js +8 -0
- package/dist/esm/cli/cli_eval.js +510 -0
- package/dist/esm/cli/utils/envs.js +78 -0
- package/dist/esm/cli/utils/evals.js +109 -0
- package/dist/esm/cli/utils/logs.js +111 -0
- package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/esm/code_executors/code_execution_utils.js +46 -16
- package/dist/esm/code_executors/code_executor_context.js +5 -2
- package/dist/esm/common.js +87 -3
- package/dist/esm/context/summarizers/llm_summarizer.js +12 -10
- package/dist/esm/context/token_based_context_compactor.js +2 -1
- package/dist/esm/events/abort_events.js +110 -0
- package/dist/esm/events/event.js +4 -2
- package/dist/esm/events/internal_metadata.js +97 -0
- package/dist/esm/examples/example_util.js +21 -1
- package/dist/esm/flows/llm_flows/audio_transcriber.js +142 -0
- package/dist/esm/index.js +99 -1
- package/dist/esm/integrations/agent_registry/helpers.js +1 -1
- package/dist/esm/models/gemini_llm_connection.js +16 -8
- package/dist/esm/models/google_llm.js +14 -17
- package/dist/esm/models/llm_response.js +9 -1
- package/dist/esm/models/registry.js +1 -1
- package/dist/esm/models/routed_llm.js +9 -8
- package/dist/esm/planners/plan_re_act_planner.js +1 -1
- package/dist/esm/plugins/debug_logging_plugin.js +615 -0
- package/dist/esm/plugins/plugin_manager.js +1 -1
- package/dist/esm/plugins/tool_call_integrity_plugin.js +339 -0
- package/dist/esm/runner/in_memory_runner.js +6 -11
- package/dist/esm/runner/runner.js +124 -35
- package/dist/esm/sessions/db/operations.js +1 -1
- package/dist/esm/sessions/in_memory_session_service.js +3 -1
- package/dist/esm/sessions/state.js +8 -4
- package/dist/esm/sessions/vertex_ai_session_service.js +34 -15
- package/dist/esm/telemetry/tracing.js +97 -66
- package/dist/esm/tools/agent_tool.js +44 -0
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +106 -0
- package/dist/esm/tools/apihub_tool/clients/apihub_client.js +244 -0
- package/dist/esm/tools/apihub_tool/clients/secret_client.js +132 -0
- package/dist/esm/tools/apihub_tool/clients/service_account.js +21 -0
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +163 -0
- package/dist/esm/tools/application_integration_tool/clients/cloud_request.js +103 -0
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +561 -0
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +215 -0
- package/dist/esm/tools/crewai_tool.js +107 -0
- package/dist/esm/tools/example_tool.js +13 -1
- package/dist/esm/tools/function_tool.js +316 -0
- package/dist/esm/tools/google_api_tool/google_api_tool.js +70 -0
- package/dist/esm/tools/google_api_tool/google_api_tool_set.js +188 -0
- package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +24 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +393 -0
- package/dist/esm/tools/google_api_tool/index.js +33 -0
- package/dist/esm/tools/langchain_tool.js +148 -0
- package/dist/esm/tools/mcp/index.js +6 -0
- package/dist/esm/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +50 -3
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +15 -2
- package/dist/esm/tools/retrieval/base_retrieval_tool.js +16 -2
- package/dist/esm/tools/toolbox_tool.js +80 -0
- package/dist/esm/utils/env_aware_utils.js +6 -8
- package/dist/esm/utils/error_utils.js +9 -10
- package/dist/esm/utils/file_extension_utils.js +11 -0
- package/dist/esm/utils/file_utils.js +2 -23
- package/dist/esm/utils/gemini_schema_util.js +4 -1
- package/dist/esm/utils/json_utils.js +21 -0
- package/dist/esm/utils/live_connection_utils.js +4 -5
- package/dist/esm/utils/logger_node.js +7 -1
- package/dist/esm/utils/object_notation_utils.js +4 -2
- package/dist/esm/utils/streaming_utils.js +11 -11
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +9 -0
- package/dist/types/a2a/agent_card.d.ts +44 -1
- package/dist/types/a2a/agent_to_a2a.d.ts +9 -0
- package/dist/types/a2a/index.d.ts +1 -0
- package/dist/types/agents/functions.d.ts +33 -1
- package/dist/types/agents/invocation_context.d.ts +20 -1
- package/dist/types/agents/langgraph_agent.d.ts +153 -0
- package/dist/types/agents/remote_agent.d.ts +68 -0
- package/dist/types/auth/auth_handler.d.ts +28 -1
- package/dist/types/auth/auth_schemes.d.ts +13 -0
- package/dist/types/cli/cli_eval.d.ts +173 -0
- package/dist/types/cli/utils/envs.d.ts +23 -0
- package/dist/types/cli/utils/evals.d.ts +47 -0
- package/dist/types/cli/utils/logs.d.ts +38 -0
- package/dist/types/code_executors/code_execution_utils.d.ts +39 -0
- package/dist/types/code_executors/code_executor_context.d.ts +1 -0
- package/dist/types/common.d.ts +30 -4
- package/dist/types/events/abort_events.d.ts +43 -0
- package/dist/types/events/event.d.ts +4 -0
- package/dist/types/events/internal_metadata.d.ts +78 -0
- package/dist/types/examples/example_util.d.ts +17 -0
- package/dist/types/flows/llm_flows/audio_transcriber.d.ts +85 -0
- package/dist/types/index.d.ts +16 -1
- package/dist/types/models/gemini_llm_connection.d.ts +6 -7
- package/dist/types/models/routed_llm.d.ts +1 -1
- package/dist/types/plugins/debug_logging_plugin.d.ts +157 -0
- package/dist/types/plugins/tool_call_integrity_plugin.d.ts +116 -0
- package/dist/types/runner/in_memory_runner.d.ts +2 -1
- package/dist/types/runner/runner.d.ts +34 -0
- package/dist/types/sessions/state.d.ts +5 -1
- package/dist/types/sessions/vertex_ai_session_service.d.ts +8 -0
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/telemetry/tracing.d.ts +4 -2
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +122 -0
- package/dist/types/tools/apihub_tool/clients/apihub_client.d.ts +142 -0
- package/dist/types/tools/apihub_tool/clients/secret_client.d.ts +55 -0
- package/dist/types/tools/apihub_tool/clients/service_account.d.ts +11 -0
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +86 -0
- package/dist/types/tools/application_integration_tool/clients/cloud_request.d.ts +53 -0
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +215 -0
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +72 -0
- package/dist/types/tools/crewai_tool.d.ts +85 -0
- package/dist/types/tools/example_tool.d.ts +10 -0
- package/dist/types/tools/function_tool.d.ts +32 -0
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +30 -0
- package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +78 -0
- package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +33 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +164 -0
- package/dist/types/tools/google_api_tool/index.d.ts +11 -0
- package/dist/types/tools/langchain_tool.d.ts +103 -0
- package/dist/types/tools/mcp/index.d.ts +3 -0
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +34 -1
- package/dist/types/tools/mcp/mcp_toolset.d.ts +15 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +19 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +18 -1
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +2 -1
- package/dist/types/tools/retrieval/base_retrieval_tool.d.ts +15 -0
- package/dist/types/tools/toolbox_tool.d.ts +73 -0
- package/dist/types/utils/env_aware_utils.d.ts +18 -2
- package/dist/types/utils/error_utils.d.ts +7 -0
- package/dist/types/utils/file_utils.d.ts +6 -1
- package/dist/types/utils/gemini_schema_util.d.ts +1 -2
- package/dist/types/utils/json_utils.d.ts +11 -0
- package/dist/types/utils/object_notation_utils.d.ts +7 -0
- package/dist/types/utils/streaming_utils.d.ts +11 -4
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +105 -106
- package/dist/web/index_web.js.map +4 -4
- package/package.json +8 -3
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
|
+
import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
7
8
|
import type { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
8
9
|
import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
9
10
|
/**
|
|
@@ -40,10 +41,42 @@ export interface StreamableHTTPConnectionParams {
|
|
|
40
41
|
terminateOnClose?: boolean;
|
|
41
42
|
transportOptions?: StreamableHTTPClientTransportOptions;
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Defines the parameters for establishing a connection to an MCP server over
|
|
46
|
+
* the HTTP+SSE transport.
|
|
47
|
+
*
|
|
48
|
+
* Usage:
|
|
49
|
+
* const connectionParams: SseConnectionParams = {
|
|
50
|
+
* type: 'SseConnectionParams',
|
|
51
|
+
* url: 'http://localhost:8090/sse'
|
|
52
|
+
* };
|
|
53
|
+
*/
|
|
54
|
+
export interface SseConnectionParams {
|
|
55
|
+
type: 'SseConnectionParams';
|
|
56
|
+
url: string;
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated
|
|
59
|
+
* Use transportOptions.requestInit.headers instead.
|
|
60
|
+
* This field will be ignored if transportOptions is provided even if no headers are specified in transportOptions.
|
|
61
|
+
*/
|
|
62
|
+
header?: Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* HTTP headers to send with the SSE and POST requests when
|
|
65
|
+
* `transportOptions.requestInit` is not provided.
|
|
66
|
+
*/
|
|
67
|
+
headers?: Record<string, unknown>;
|
|
68
|
+
timeout?: number;
|
|
69
|
+
sseReadTimeout?: number;
|
|
70
|
+
transportOptions?: SSEClientTransportOptions;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Alias for {@link SseConnectionParams}.
|
|
74
|
+
*/
|
|
75
|
+
export type SseServerParams = SseConnectionParams;
|
|
43
76
|
/**
|
|
44
77
|
* A union of all supported MCP connection parameter types.
|
|
45
78
|
*/
|
|
46
|
-
export type MCPConnectionParams = StdioConnectionParams | StreamableHTTPConnectionParams;
|
|
79
|
+
export type MCPConnectionParams = StdioConnectionParams | SseConnectionParams | StreamableHTTPConnectionParams;
|
|
47
80
|
/**
|
|
48
81
|
* Manages Model Context Protocol (MCP) client sessions.
|
|
49
82
|
*
|
|
@@ -8,6 +8,7 @@ import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
|
8
8
|
import { BaseTool } from '../base_tool.js';
|
|
9
9
|
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
10
10
|
import { MCPConnectionParams } from './mcp_session_manager.js';
|
|
11
|
+
export type { SseConnectionParams, SseServerParams, } from './mcp_session_manager.js';
|
|
11
12
|
/**
|
|
12
13
|
* A toolset that dynamically discovers and provides tools from a Model Context
|
|
13
14
|
* Protocol (MCP) server.
|
|
@@ -37,6 +38,20 @@ import { MCPConnectionParams } from './mcp_session_manager.js';
|
|
|
37
38
|
* const mcpToolset = new MCPToolset(connectionParams);
|
|
38
39
|
* const tools = await mcpToolset.getTools();
|
|
39
40
|
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import {MCPToolset} from '@google/adk';
|
|
45
|
+
* import type {SseConnectionParams} from '@google/adk';
|
|
46
|
+
*
|
|
47
|
+
* const sseParams: SseConnectionParams = {
|
|
48
|
+
* type: 'SseConnectionParams',
|
|
49
|
+
* url: 'http://localhost:8090/sse',
|
|
50
|
+
* };
|
|
51
|
+
*
|
|
52
|
+
* const sseToolset = new MCPToolset(sseParams);
|
|
53
|
+
* const sseTools = await sseToolset.getTools();
|
|
54
|
+
* ```
|
|
40
55
|
*/
|
|
41
56
|
export declare class MCPToolset extends BaseToolset {
|
|
42
57
|
private readonly mcpSessionManager;
|
|
@@ -12,6 +12,25 @@ import { ApiParameter } from '../openapi_spec_parser/operation_parser.js';
|
|
|
12
12
|
* model-supplied.
|
|
13
13
|
*/
|
|
14
14
|
export declare const INTERNAL_AUTH_PREFIX = "_auth_prefix_vaf_";
|
|
15
|
+
/**
|
|
16
|
+
* The client settings an application registers with an OpenID Connect
|
|
17
|
+
* provider.
|
|
18
|
+
*/
|
|
19
|
+
export interface OpenIdConfig {
|
|
20
|
+
/** The client ID the provider issued to the application. */
|
|
21
|
+
clientId: string;
|
|
22
|
+
/** The provider's authorization endpoint. */
|
|
23
|
+
authUri: string;
|
|
24
|
+
/** The provider's token endpoint. */
|
|
25
|
+
tokenUri: string;
|
|
26
|
+
/** The client secret the provider issued to the application. */
|
|
27
|
+
clientSecret: string;
|
|
28
|
+
/**
|
|
29
|
+
* Where the provider sends the user after sign-in. When unset, the provider
|
|
30
|
+
* uses the redirect URI registered for the client.
|
|
31
|
+
*/
|
|
32
|
+
redirectUri?: string;
|
|
33
|
+
}
|
|
15
34
|
/**
|
|
16
35
|
* Applies the given credential to the request headers and URL.
|
|
17
36
|
*
|
package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts
CHANGED
|
@@ -31,13 +31,30 @@ export type CustomCredentialExchangers = Partial<Record<AuthCredentialTypes, Bas
|
|
|
31
31
|
* });
|
|
32
32
|
*/
|
|
33
33
|
export declare class AutoAuthCredentialExchanger implements BaseCredentialExchanger {
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The exchanger used for each auth credential type.
|
|
36
|
+
*
|
|
37
|
+
* By default `OAUTH2` and `OPEN_ID_CONNECT` run
|
|
38
|
+
* {@link OAuth2CredentialExchanger} and convert any access token with
|
|
39
|
+
* {@link generateAuthToken}, and `SERVICE_ACCOUNT` maps to a
|
|
40
|
+
* {@link ServiceAccountCredentialExchanger}, with any custom exchangers from
|
|
41
|
+
* the constructor merged over them. The map is live: an entry added or
|
|
42
|
+
* replaced after construction is used by the next {@link exchange} call.
|
|
43
|
+
*/
|
|
44
|
+
readonly exchangers: Map<AuthCredentialTypes, BaseCredentialExchanger>;
|
|
35
45
|
/**
|
|
36
46
|
* @param customExchangers - Optional exchangers that add to or override the
|
|
37
47
|
* built-in ones. The key is the auth credential type; the value is the
|
|
38
48
|
* exchanger instance to use for that type.
|
|
39
49
|
*/
|
|
40
50
|
constructor(customExchangers?: CustomCredentialExchangers);
|
|
51
|
+
/**
|
|
52
|
+
* Exchanges the credential with the exchanger registered for its type.
|
|
53
|
+
*
|
|
54
|
+
* @returns The credential unchanged, with `wasExchanged: false`, when no
|
|
55
|
+
* exchanger is registered for its type. Otherwise the delegate's result,
|
|
56
|
+
* or `null` when there is no credential at all.
|
|
57
|
+
*/
|
|
41
58
|
exchange(params: {
|
|
42
59
|
authScheme?: AuthScheme;
|
|
43
60
|
authCredential: AuthCredential;
|
|
@@ -71,7 +71,8 @@ export declare class ToolAuthHandler {
|
|
|
71
71
|
static fromToolContext(context: Context, authScheme?: AuthScheme, authCredential?: AuthCredential, options?: ToolAuthHandlerOptions): ToolAuthHandler;
|
|
72
72
|
prepareAuthCredentials(): Promise<AuthPreparationResult>;
|
|
73
73
|
/**
|
|
74
|
-
* Exchanges `credential`, or returns `undefined` when the exchange failed
|
|
74
|
+
* Exchanges `credential`, or returns `undefined` when the exchange failed or
|
|
75
|
+
* produced an interactive credential that still holds no token.
|
|
75
76
|
*
|
|
76
77
|
* An exchange failure is transient far more often than it is fatal, so it
|
|
77
78
|
* becomes a `pending` result the client can resume from rather than an
|
|
@@ -5,6 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { FunctionDeclaration } from '@google/genai';
|
|
7
7
|
import { BaseTool } from '../base_tool.js';
|
|
8
|
+
/**
|
|
9
|
+
* Unique symbol to identify `BaseRetrievalTool` classes.
|
|
10
|
+
* Defined once and shared by all `BaseRetrievalTool` instances.
|
|
11
|
+
*/
|
|
12
|
+
declare const BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL: unique symbol;
|
|
13
|
+
/**
|
|
14
|
+
* Type guard to check if an object is an instance of `BaseRetrievalTool`.
|
|
15
|
+
*
|
|
16
|
+
* @param obj The object to check.
|
|
17
|
+
* @returns True if the object is an instance of `BaseRetrievalTool`, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isBaseRetrievalTool(obj: unknown): obj is BaseRetrievalTool;
|
|
8
20
|
/**
|
|
9
21
|
* The base class for tools that answer a single natural-language query by
|
|
10
22
|
* retrieving text the framework fetches itself.
|
|
@@ -17,5 +29,8 @@ import { BaseTool } from '../base_tool.js';
|
|
|
17
29
|
* `src/google/adk/tools/retrieval/base_retrieval_tool.py` at ref `v0.1.0`.
|
|
18
30
|
*/
|
|
19
31
|
export declare abstract class BaseRetrievalTool extends BaseTool {
|
|
32
|
+
/** Unique symbol to identify `BaseRetrievalTool` class. */
|
|
33
|
+
readonly [BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL] = true;
|
|
20
34
|
_getDeclaration(): FunctionDeclaration;
|
|
21
35
|
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { LangchainTool, LangchainToolLike } from './langchain_tool.js';
|
|
7
|
+
/**
|
|
8
|
+
* Structural interface for a Toolbox client instance.
|
|
9
|
+
*/
|
|
10
|
+
export interface ToolboxClientLike {
|
|
11
|
+
/**
|
|
12
|
+
* Loads a single tool by name (camelCase convention).
|
|
13
|
+
*/
|
|
14
|
+
loadTool?: (toolName: string) => LangchainToolLike;
|
|
15
|
+
/**
|
|
16
|
+
* Loads a single tool by name (snake_case convention).
|
|
17
|
+
*/
|
|
18
|
+
load_tool?: (toolName: string) => LangchainToolLike;
|
|
19
|
+
/**
|
|
20
|
+
* Loads a toolset by name (camelCase convention).
|
|
21
|
+
*/
|
|
22
|
+
loadToolset?: (toolsetName: string) => LangchainToolLike[];
|
|
23
|
+
/**
|
|
24
|
+
* Loads a toolset by name (snake_case convention).
|
|
25
|
+
*/
|
|
26
|
+
load_toolset?: (toolsetName: string) => LangchainToolLike[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Configuration options for {@link ToolboxTool}.
|
|
30
|
+
*/
|
|
31
|
+
export interface ToolboxToolOptions {
|
|
32
|
+
/**
|
|
33
|
+
* The URL of the Toolbox server.
|
|
34
|
+
*/
|
|
35
|
+
url?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Optional pre-configured Toolbox client instance.
|
|
38
|
+
*/
|
|
39
|
+
client?: ToolboxClientLike;
|
|
40
|
+
}
|
|
41
|
+
declare const TOOLBOX_TOOL_SIGNATURE_SYMBOL: unique symbol;
|
|
42
|
+
/**
|
|
43
|
+
* Type guard to check if an object is an instance of {@link ToolboxTool}.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isToolboxTool(obj: unknown): obj is ToolboxTool;
|
|
46
|
+
/**
|
|
47
|
+
* Provides access to Toolbox tools and toolsets wrapped as {@link LangchainTool}
|
|
48
|
+
* instances.
|
|
49
|
+
*/
|
|
50
|
+
export declare class ToolboxTool {
|
|
51
|
+
/** A unique symbol to identify ADK ToolboxTool class. */
|
|
52
|
+
readonly [TOOLBOX_TOOL_SIGNATURE_SYMBOL] = true;
|
|
53
|
+
/**
|
|
54
|
+
* The URL of the Toolbox server, if provided.
|
|
55
|
+
*/
|
|
56
|
+
readonly url?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The underlying Toolbox client.
|
|
59
|
+
*/
|
|
60
|
+
readonly toolboxClient: ToolboxClientLike;
|
|
61
|
+
constructor(urlOrOptions: string | ToolboxToolOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Loads a single tool from the Toolbox client and wraps it in a
|
|
64
|
+
* {@link LangchainTool}.
|
|
65
|
+
*/
|
|
66
|
+
getTool(toolName: string): LangchainTool;
|
|
67
|
+
/**
|
|
68
|
+
* Loads a toolset from the Toolbox client and wraps each tool in a
|
|
69
|
+
* {@link LangchainTool}.
|
|
70
|
+
*/
|
|
71
|
+
getToolset(toolsetName: string): LangchainTool[];
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -34,15 +34,31 @@ export declare function randomUUID(): string;
|
|
|
34
34
|
/**
|
|
35
35
|
* Encodes the given string or Uint8Array to base64.
|
|
36
36
|
*
|
|
37
|
+
* `window.btoa` is byte-oriented and throws on any code unit above `U+00FF`,
|
|
38
|
+
* so a string is first encoded to UTF-8 bytes. Node's `Buffer` encodes a
|
|
39
|
+
* string as UTF-8 too, which keeps both environments on one contract and lets
|
|
40
|
+
* `base64Decode` round-trip its output.
|
|
41
|
+
*
|
|
37
42
|
* @param data The data to encode.
|
|
38
43
|
* @return The base64-encoded string.
|
|
39
44
|
*/
|
|
40
45
|
export declare function base64Encode(data: string | Uint8Array): string;
|
|
41
46
|
/**
|
|
42
|
-
* Decodes the given base64 string to
|
|
47
|
+
* Decodes the given base64 string to UTF-8 text.
|
|
48
|
+
*
|
|
49
|
+
* `window.atob` is byte-oriented: it returns a latin1 "binary string" with one
|
|
50
|
+
* code unit per decoded byte, so a multi-byte UTF-8 sequence surfaces as
|
|
51
|
+
* mojibake. Node's `Buffer` decodes the same bytes as UTF-8, so the browser
|
|
52
|
+
* branch recovers the bytes from `atob` and decodes them explicitly. That keeps
|
|
53
|
+
* both environments on the single contract `File.content` and
|
|
54
|
+
* `materializeFiles` already assume.
|
|
55
|
+
*
|
|
56
|
+
* `ignoreBOM` keeps a leading byte order mark as `U+FEFF`, which is what
|
|
57
|
+
* `Buffer` does. `TextDecoder` strips it by default, so a spreadsheet CSV
|
|
58
|
+
* exported as UTF-8 with a BOM would otherwise lose a character.
|
|
43
59
|
*
|
|
44
60
|
* @param data The base64-encoded string.
|
|
45
|
-
* @return The decoded string.
|
|
61
|
+
* @return The decoded UTF-8 string.
|
|
46
62
|
*/
|
|
47
63
|
export declare function base64Decode(data: string): string;
|
|
48
64
|
/**
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Returns the plain, non-recursive message for a single thrown value.
|
|
8
|
+
*
|
|
9
|
+
* Reads `.message` from any object that carries a string `message` property,
|
|
10
|
+
* and falls back to `String(err)` for primitives and other values.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getErrorMessage(err: unknown): string;
|
|
6
13
|
/**
|
|
7
14
|
* Formats an arbitrary thrown value into a readable, root-cause message.
|
|
8
15
|
*
|
|
@@ -17,5 +17,10 @@ import { File } from '../code_executors/code_execution_utils.js';
|
|
|
17
17
|
* @param dir The directory to materialize the files into.
|
|
18
18
|
*/
|
|
19
19
|
export declare function materializeFiles(files: File[], dir: string): Promise<File[]>;
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Guesses the MIME type of a file from its extension.
|
|
22
|
+
* @param filePath A file name or path.
|
|
23
|
+
* @returns The MIME type, or 'application/octet-stream' if the extension is
|
|
24
|
+
* unknown or absent.
|
|
25
|
+
*/
|
|
21
26
|
export declare function guessMimeType(filePath: string): string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Schema } from '@google/genai';
|
|
7
|
-
type MCPToolSchema = {
|
|
7
|
+
export type MCPToolSchema = {
|
|
8
8
|
type: 'object';
|
|
9
9
|
properties?: Record<string, unknown>;
|
|
10
10
|
required?: string[];
|
|
@@ -23,4 +23,3 @@ export declare function toGeminiSchema(mcpSchema?: MCPToolSchema): Schema | unde
|
|
|
23
23
|
* @throws {TypeError} If the input is neither an object nor nullish.
|
|
24
24
|
*/
|
|
25
25
|
export declare function openApiSchemaToGeminiSchema(openApiSchema?: unknown): Schema | undefined;
|
|
26
|
-
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/** A JSON object keyed by string. */
|
|
7
|
+
export type JsonObject = Record<string, unknown>;
|
|
8
|
+
/** Narrows an arbitrary value to a plain JSON object (non-null, non-array). */
|
|
9
|
+
export declare function isJsonObject(value: unknown): value is JsonObject;
|
|
10
|
+
/** Returns `value` when it is a JSON object, or `{}` otherwise. */
|
|
11
|
+
export declare function toJsonObject(value: unknown): JsonObject;
|
|
@@ -19,3 +19,10 @@ export declare function toCamelCase(obj: unknown, preserveKeys?: string[]): unkn
|
|
|
19
19
|
* @returns The object with snake_case keys.
|
|
20
20
|
*/
|
|
21
21
|
export declare function toSnakeCase(obj: unknown, preserveKeys?: string[]): unknown;
|
|
22
|
+
/**
|
|
23
|
+
* Converts a camelCase, PascalCase, or hyphenated key to snake_case.
|
|
24
|
+
*
|
|
25
|
+
* @param key The key to convert.
|
|
26
|
+
* @returns The snake_case key.
|
|
27
|
+
*/
|
|
28
|
+
export declare const toSnakeCaseKey: (key: string) => string;
|
|
@@ -5,14 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { GenerateContentResponse, Part } from '@google/genai';
|
|
7
7
|
import { LlmResponse } from '../models/llm_response.js';
|
|
8
|
+
/** Options for {@link GeminiStreamingResponseAggregator}. */
|
|
9
|
+
export interface GeminiStreamingResponseAggregatorOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Whether to flush parts as they arrive. Defaults to the
|
|
12
|
+
* PROGRESSIVE_SSE_STREAMING feature flag.
|
|
13
|
+
*/
|
|
14
|
+
isProgressiveMode?: boolean;
|
|
15
|
+
}
|
|
8
16
|
/**
|
|
9
|
-
* Aggregates partial streaming responses.
|
|
17
|
+
* Aggregates partial Gemini streaming responses.
|
|
10
18
|
*
|
|
11
19
|
* It aggregates content from partial responses, and generates LlmResponses for
|
|
12
20
|
* individual (partial) model responses, as well as for aggregated content.
|
|
13
21
|
*/
|
|
14
|
-
export declare class
|
|
15
|
-
private readonly isProgressiveMode;
|
|
22
|
+
export declare class GeminiStreamingResponseAggregator {
|
|
16
23
|
private usageMetadata?;
|
|
17
24
|
private groundingMetadata?;
|
|
18
25
|
private citationMetadata?;
|
|
@@ -20,7 +27,7 @@ export declare class StreamingResponseAggregator {
|
|
|
20
27
|
private finishReason?;
|
|
21
28
|
private lastThoughtSignature;
|
|
22
29
|
private readonly strategy;
|
|
23
|
-
constructor(isProgressiveMode?:
|
|
30
|
+
constructor({ isProgressiveMode, }?: GeminiStreamingResponseAggregatorOptions);
|
|
24
31
|
processResponse(response: GenerateContentResponse): AsyncGenerator<LlmResponse, void, void>;
|
|
25
32
|
close(): LlmResponse | undefined;
|
|
26
33
|
}
|
package/dist/types/version.d.ts
CHANGED