@google/adk 2.1.0 → 2.2.1
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/agent_card.js +8 -0
- package/dist/cjs/a2a/agent_executor.js +8 -3
- package/dist/cjs/a2a/event_converter_utils.js +5 -1
- package/dist/cjs/a2a/metadata_converter_utils.js +2 -1
- package/dist/cjs/agents/llm_agent.js +15 -1
- package/dist/cjs/agents/processors/content_processor_utils.js +10 -2
- package/dist/cjs/agents/processors/nl_planning_processor.js +114 -0
- package/dist/cjs/artifacts/gcs_artifact_service.js +13 -7
- package/dist/cjs/auth/auth_credential.js +12 -2
- package/dist/cjs/code_executors/code_execution_utils.js +3 -3
- package/dist/cjs/common.js +63 -0
- package/dist/cjs/events/abort_events.js +135 -0
- package/dist/cjs/events/internal_metadata.js +131 -0
- package/dist/cjs/examples/example.js +92 -0
- package/dist/cjs/examples/example_util.js +28 -4
- package/dist/cjs/examples/index.js +39 -0
- package/dist/cjs/examples/vertex_ai_example_store.js +39 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/memory/vertex_ai_memory_bank_service.js +17 -5
- package/dist/cjs/models/base_llm.js +1 -6
- package/dist/cjs/models/chrome_prompt_llm.js +16 -2
- package/dist/cjs/models/chrome_prompt_utils.js +54 -2
- package/dist/cjs/models/gemini_continuation.js +232 -0
- package/dist/cjs/models/gemini_llm_connection.js +5 -4
- package/dist/cjs/planners/base_planner.js +56 -0
- package/dist/cjs/planners/built_in_planner.js +85 -0
- package/dist/cjs/planners/plan_re_act_planner.js +172 -0
- package/dist/cjs/plugins/base_plugin.js +46 -61
- 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/runner.js +17 -3
- package/dist/cjs/tools/example_tool.js +1 -1
- package/dist/cjs/tools/mcp/mcp_session_manager.js +14 -8
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +281 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +15 -1
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js +70 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +120 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +10 -10
- package/dist/cjs/tools/openapi_tool/common/common.js +139 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +11 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +73 -13
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +146 -34
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +14 -2
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +90 -28
- package/dist/cjs/tools/skill/skill_toolset.js +2 -0
- package/dist/cjs/tools/tool_context.js +41 -0
- package/dist/cjs/tools/webmcp/index.js +37 -0
- package/dist/cjs/tools/webmcp/webmcp_tool.js +156 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +116 -0
- package/dist/cjs/tools/webmcp/webmcp_types.js +50 -0
- package/dist/cjs/utils/case_utils.js +52 -2
- package/dist/cjs/utils/client_labels.js +67 -0
- package/dist/cjs/utils/gemini_schema_util.js +103 -3
- package/dist/cjs/utils/hash_utils.js +73 -0
- package/dist/cjs/utils/live_connection_utils.js +10 -9
- package/dist/cjs/utils/model_name.js +17 -2
- package/dist/cjs/utils/simple_zod_to_json.js +5 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/agent_card.js +8 -0
- package/dist/esm/a2a/agent_executor.js +8 -3
- package/dist/esm/a2a/event_converter_utils.js +5 -1
- package/dist/esm/a2a/metadata_converter_utils.js +2 -1
- package/dist/esm/agents/llm_agent.js +18 -1
- package/dist/esm/agents/processors/content_processor_utils.js +10 -2
- package/dist/esm/agents/processors/nl_planning_processor.js +87 -0
- package/dist/esm/artifacts/gcs_artifact_service.js +13 -7
- package/dist/esm/auth/auth_credential.js +11 -1
- package/dist/esm/code_executors/code_execution_utils.js +3 -3
- package/dist/esm/common.js +58 -2
- package/dist/esm/events/abort_events.js +110 -0
- package/dist/esm/events/internal_metadata.js +97 -0
- package/dist/esm/examples/example.js +85 -0
- package/dist/esm/examples/example_util.js +25 -3
- package/dist/esm/examples/index.js +11 -0
- package/dist/esm/examples/vertex_ai_example_store.js +11 -0
- package/dist/esm/index.js +51 -1
- package/dist/esm/memory/vertex_ai_memory_bank_service.js +17 -5
- package/dist/esm/models/base_llm.js +2 -7
- package/dist/esm/models/chrome_prompt_llm.js +20 -3
- package/dist/esm/models/chrome_prompt_utils.js +51 -2
- package/dist/esm/models/gemini_continuation.js +205 -0
- package/dist/esm/models/gemini_llm_connection.js +6 -5
- package/dist/esm/planners/base_planner.js +28 -0
- package/dist/esm/planners/built_in_planner.js +57 -0
- package/dist/esm/planners/plan_re_act_planner.js +145 -0
- package/dist/esm/plugins/base_plugin.js +46 -61
- 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/runner.js +20 -3
- package/dist/esm/tools/example_tool.js +1 -1
- package/dist/esm/tools/mcp/mcp_session_manager.js +14 -8
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +272 -1
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +15 -1
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js +43 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +93 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +10 -12
- package/dist/esm/tools/openapi_tool/common/common.js +112 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +11 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +80 -13
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +146 -33
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +14 -2
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +89 -28
- package/dist/esm/tools/skill/skill_toolset.js +2 -0
- package/dist/esm/tools/tool_context.js +15 -0
- package/dist/esm/tools/webmcp/index.js +10 -0
- package/dist/esm/tools/webmcp/webmcp_tool.js +131 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +89 -0
- package/dist/esm/tools/webmcp/webmcp_types.js +22 -0
- package/dist/esm/utils/case_utils.js +49 -1
- package/dist/esm/utils/client_labels.js +65 -0
- package/dist/esm/utils/gemini_schema_util.js +102 -3
- package/dist/esm/utils/hash_utils.js +45 -0
- package/dist/esm/utils/live_connection_utils.js +11 -10
- package/dist/esm/utils/model_name.js +15 -2
- package/dist/esm/utils/simple_zod_to_json.js +5 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/agents/llm_agent.d.ts +12 -1
- package/dist/types/agents/processors/nl_planning_processor.d.ts +30 -0
- package/dist/types/auth/auth_credential.d.ts +9 -0
- package/dist/types/common.d.ts +19 -4
- package/dist/types/events/abort_events.d.ts +43 -0
- package/dist/types/events/internal_metadata.d.ts +78 -0
- package/dist/types/examples/base_example_provider.d.ts +2 -2
- package/dist/types/examples/example.d.ts +75 -0
- package/dist/types/examples/example_util.d.ts +13 -2
- package/dist/types/examples/index.d.ts +18 -0
- package/dist/types/examples/vertex_ai_example_store.d.ts +7 -0
- package/dist/types/index.d.ts +12 -3
- package/dist/types/memory/memory_entry.d.ts +15 -0
- package/dist/types/memory/vertex_ai_memory_bank_service.d.ts +9 -0
- package/dist/types/models/chrome_prompt_utils.d.ts +29 -0
- package/dist/types/models/gemini_continuation.d.ts +59 -0
- package/dist/types/planners/base_planner.d.ts +50 -0
- package/dist/types/planners/built_in_planner.d.ts +53 -0
- package/dist/types/planners/plan_re_act_planner.d.ts +21 -0
- package/dist/types/plugins/base_plugin.d.ts +52 -52
- 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/skills/skill_registry.d.ts +8 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +110 -1
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +32 -2
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.d.ts +35 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.d.ts +54 -0
- package/dist/types/tools/openapi_tool/common/common.d.ts +60 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +7 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +56 -2
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +73 -5
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +11 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +42 -8
- package/dist/types/tools/tool_context.d.ts +19 -0
- package/dist/types/tools/webmcp/index.d.ts +12 -0
- package/dist/types/tools/webmcp/webmcp_tool.d.ts +47 -0
- package/dist/types/tools/webmcp/webmcp_toolset.d.ts +67 -0
- package/dist/types/tools/webmcp/webmcp_types.d.ts +69 -0
- package/dist/types/utils/case_utils.d.ts +36 -0
- package/dist/types/utils/client_labels.d.ts +33 -0
- package/dist/types/utils/gemini_schema_util.d.ts +13 -0
- package/dist/types/utils/hash_utils.d.ts +25 -0
- package/dist/types/utils/logger.d.ts +10 -2
- package/dist/types/utils/model_name.d.ts +30 -2
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +113 -80
- package/dist/web/index_web.js.map +4 -4
- package/package.json +8 -2
|
@@ -19,13 +19,32 @@ export interface ApiParameter {
|
|
|
19
19
|
* that are compatible with Gemini's tool function declarations.
|
|
20
20
|
*/
|
|
21
21
|
export declare class OperationParser {
|
|
22
|
-
private readonly operation;
|
|
23
22
|
private params;
|
|
24
23
|
private returnValue?;
|
|
25
24
|
private preservePropertyNames;
|
|
26
|
-
|
|
25
|
+
private readonly operation;
|
|
26
|
+
/**
|
|
27
|
+
* @param operation The operation to parse. A string is parsed as JSON, and a
|
|
28
|
+
* plain object is used as given.
|
|
29
|
+
* @param options.preservePropertyNames Keeps the original parameter and
|
|
30
|
+
* function names instead of converting them to snake_case.
|
|
31
|
+
* @param options.shouldParse Whether to parse the operation during
|
|
32
|
+
* construction. Defaults to `true`.
|
|
33
|
+
*/
|
|
34
|
+
constructor(operation: OpenAPIV3.OperationObject | Record<string, unknown> | string, options?: {
|
|
27
35
|
preservePropertyNames?: boolean;
|
|
36
|
+
shouldParse?: boolean;
|
|
28
37
|
});
|
|
38
|
+
/**
|
|
39
|
+
* Builds a parser from parameters that were already parsed, without walking
|
|
40
|
+
* the operation again.
|
|
41
|
+
*
|
|
42
|
+
* @param operation The operation the parameters came from.
|
|
43
|
+
* @param params The parsed parameters.
|
|
44
|
+
* @param returnValue The parsed return value, if any.
|
|
45
|
+
* @returns A parser holding the given parameters.
|
|
46
|
+
*/
|
|
47
|
+
static load(operation: OpenAPIV3.OperationObject | Record<string, unknown> | string, params: ApiParameter[], returnValue?: ApiParameter): OperationParser;
|
|
29
48
|
private getParamName;
|
|
30
49
|
private processOperationParameters;
|
|
31
50
|
private processRequestBody;
|
|
@@ -56,4 +75,39 @@ export declare class OperationParser {
|
|
|
56
75
|
* @returns A string representing the description.
|
|
57
76
|
*/
|
|
58
77
|
getDescription(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the name of the security scheme this operation declares.
|
|
80
|
+
*
|
|
81
|
+
* Only operation-level security is considered. Document-level security is
|
|
82
|
+
* not visible from here, so a caller that needs the fallback uses
|
|
83
|
+
* `OpenApiSpecParser` instead.
|
|
84
|
+
*
|
|
85
|
+
* @returns The first declared scheme name, or `''` when the operation
|
|
86
|
+
* declares none.
|
|
87
|
+
*/
|
|
88
|
+
getAuthSchemeName(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Gets the parsed return value of the operation.
|
|
91
|
+
*
|
|
92
|
+
* @returns The return value, or `undefined` when the parser was constructed
|
|
93
|
+
* with `shouldParse: false` and nothing was loaded.
|
|
94
|
+
*/
|
|
95
|
+
getReturnValue(): ApiParameter | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the Python-style type hint of the return value.
|
|
98
|
+
*
|
|
99
|
+
* @returns A type name such as `str`, or `Any` when the operation declares
|
|
100
|
+
* no typed 2xx response.
|
|
101
|
+
*/
|
|
102
|
+
getReturnTypeHint(): string;
|
|
103
|
+
/**
|
|
104
|
+
* Generates a Python-style docstring describing the operation, every
|
|
105
|
+
* parameter and the return value.
|
|
106
|
+
*
|
|
107
|
+
* The type names inside it are Python's, because the artifact is a docstring
|
|
108
|
+
* in adk-python's format and the same text reaches the model in both SDKs.
|
|
109
|
+
*
|
|
110
|
+
* @returns The generated docstring.
|
|
111
|
+
*/
|
|
112
|
+
getPydocString(): string;
|
|
59
113
|
}
|
|
@@ -3,21 +3,89 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { OpenAPIV3 } from 'openapi-types';
|
|
7
6
|
import { Context } from '../../../agents/context.js';
|
|
8
7
|
import { AuthCredential } from '../../../auth/auth_credential.js';
|
|
8
|
+
import { AuthScheme } from '../../../auth/auth_schemes.js';
|
|
9
|
+
import { BaseCredentialExchanger } from '../../../auth/exchanger/base_credential_exchanger.js';
|
|
10
|
+
/** The outcome of preparing a tool's credential. */
|
|
9
11
|
export interface AuthPreparationResult {
|
|
10
12
|
state: 'pending' | 'done';
|
|
13
|
+
authScheme?: AuthScheme;
|
|
11
14
|
authCredential?: AuthCredential;
|
|
12
15
|
}
|
|
16
|
+
/** Collaborators a caller may substitute when building a {@link ToolAuthHandler}. */
|
|
17
|
+
export interface ToolAuthHandlerOptions {
|
|
18
|
+
/** Key under which a credential service loads and saves this credential. */
|
|
19
|
+
credentialKey?: string;
|
|
20
|
+
/** Exchanger to use instead of the default `AutoAuthCredentialExchanger`. */
|
|
21
|
+
credentialExchanger?: BaseCredentialExchanger;
|
|
22
|
+
/** Store to use instead of one built over the tool's own context. */
|
|
23
|
+
credentialStore?: ToolContextCredentialStore;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Stores and retrieves exchanged credentials in the session state carried by a
|
|
27
|
+
* {@link Context}.
|
|
28
|
+
*/
|
|
29
|
+
export declare class ToolContextCredentialStore {
|
|
30
|
+
private readonly context;
|
|
31
|
+
constructor(context: Context);
|
|
32
|
+
/**
|
|
33
|
+
* Returns the state key that holds the credential exchanged for this scheme
|
|
34
|
+
* and credential pair.
|
|
35
|
+
*
|
|
36
|
+
* Both operands are hashed into the key, so two tools configured with
|
|
37
|
+
* different schemes, or with different credentials under one scheme, never
|
|
38
|
+
* share a slot.
|
|
39
|
+
*
|
|
40
|
+
* The key deliberately carries no `temp:` prefix. Session state is a copy and
|
|
41
|
+
* only the delta is persisted, and `temp:` is cleared at the end of a run,
|
|
42
|
+
* while an exchanged token has to stay readable across runs.
|
|
43
|
+
*/
|
|
44
|
+
getCredentialKey(authScheme?: AuthScheme, authCredential?: AuthCredential): string;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the credential stored for this scheme and credential pair, or
|
|
47
|
+
* `undefined` when there is none.
|
|
48
|
+
*
|
|
49
|
+
* @throws Error if the state entry under the key is not an
|
|
50
|
+
* {@link AuthCredential}, which means something else wrote to the key.
|
|
51
|
+
*/
|
|
52
|
+
getCredential(authScheme?: AuthScheme, authCredential?: AuthCredential): AuthCredential | undefined;
|
|
53
|
+
storeCredential(key: string, credential: AuthCredential): void;
|
|
54
|
+
/**
|
|
55
|
+
* Makes the credential under `key` unreadable again.
|
|
56
|
+
*
|
|
57
|
+
* adk-python deletes the state entry. `State` has no delete, so this writes
|
|
58
|
+
* `undefined`, which `State.get` returns for a missing key as well, and
|
|
59
|
+
* {@link getCredential} therefore misses exactly as a delete would make it.
|
|
60
|
+
*/
|
|
61
|
+
removeCredential(key: string): void;
|
|
62
|
+
}
|
|
13
63
|
export declare class ToolAuthHandler {
|
|
14
64
|
private readonly context;
|
|
15
65
|
private readonly authScheme?;
|
|
16
66
|
private readonly authCredential?;
|
|
17
67
|
private readonly credentialKey?;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
68
|
+
private readonly credentialExchanger?;
|
|
69
|
+
private readonly credentialStore;
|
|
70
|
+
constructor(context: Context, authScheme?: AuthScheme, authCredential?: AuthCredential, options?: ToolAuthHandlerOptions);
|
|
71
|
+
static fromToolContext(context: Context, authScheme?: AuthScheme, authCredential?: AuthCredential, options?: ToolAuthHandlerOptions): ToolAuthHandler;
|
|
22
72
|
prepareAuthCredentials(): Promise<AuthPreparationResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Exchanges `credential`, or returns `undefined` when the exchange failed.
|
|
75
|
+
*
|
|
76
|
+
* An exchange failure is transient far more often than it is fatal, so it
|
|
77
|
+
* becomes a `pending` result the client can resume from rather than an
|
|
78
|
+
* exception that fails the whole tool call.
|
|
79
|
+
*/
|
|
80
|
+
private tryExchange;
|
|
81
|
+
/**
|
|
82
|
+
* Asks the client for a credential, after checking that an interactive
|
|
83
|
+
* scheme has the OAuth2 client configuration it cannot proceed without.
|
|
84
|
+
*
|
|
85
|
+
* @throws Error if an `oauth2` or `openIdConnect` scheme has no OAuth2
|
|
86
|
+
* credential.
|
|
87
|
+
* @throws AuthCredentialMissingError if that credential omits `clientId` or
|
|
88
|
+
* `clientSecret`.
|
|
89
|
+
*/
|
|
90
|
+
private requestCredential;
|
|
23
91
|
}
|
|
@@ -8,6 +8,7 @@ import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
|
8
8
|
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
9
9
|
import { BaseTool } from '../base_tool.js';
|
|
10
10
|
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
11
|
+
import { RestApiTool } from './rest_api_tool.js';
|
|
11
12
|
export declare class OpenAPIToolset extends BaseToolset {
|
|
12
13
|
private tools;
|
|
13
14
|
constructor(options?: {
|
|
@@ -23,5 +24,15 @@ export declare class OpenAPIToolset extends BaseToolset {
|
|
|
23
24
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
24
25
|
});
|
|
25
26
|
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the parsed tool with the given name, or `undefined` when the spec
|
|
29
|
+
* produced no such tool.
|
|
30
|
+
*
|
|
31
|
+
* The lookup is over every tool parsed from the spec and does not apply
|
|
32
|
+
* `toolFilter`, which selects what an agent exposes to the model rather than
|
|
33
|
+
* what the toolset holds. When the toolset was constructed with `prefix`,
|
|
34
|
+
* pass the prefixed name.
|
|
35
|
+
*/
|
|
36
|
+
getTool(toolName: string): RestApiTool | undefined;
|
|
26
37
|
close(): Promise<void>;
|
|
27
38
|
}
|
|
@@ -8,8 +8,26 @@ import { OpenAPIV3 } from 'openapi-types';
|
|
|
8
8
|
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
9
9
|
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
10
10
|
import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
|
|
11
|
-
import { ApiParameter } from './openapi_spec_parser/operation_parser.js';
|
|
11
|
+
import { ApiParameter, OperationParser } from './openapi_spec_parser/operation_parser.js';
|
|
12
12
|
import { OperationEndpoint } from './openapi_spec_parser/openapi_spec_parser.js';
|
|
13
|
+
/**
|
|
14
|
+
* The parsed operation `createRestApiTool` accepts.
|
|
15
|
+
*
|
|
16
|
+
* `name` and `description` are optional and are derived from the operation
|
|
17
|
+
* when they are absent. `parameters` and `returnValue` carry an operation the
|
|
18
|
+
* caller has already parsed, so its names, locations and schemas stay
|
|
19
|
+
* authoritative.
|
|
20
|
+
*/
|
|
21
|
+
export interface ParsedOperationInput {
|
|
22
|
+
name?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
endpoint: OperationEndpoint;
|
|
25
|
+
operation: OpenAPIV3.OperationObject;
|
|
26
|
+
authScheme?: OpenAPIV3.SecuritySchemeObject;
|
|
27
|
+
authCredential?: AuthCredential;
|
|
28
|
+
parameters?: ApiParameter[];
|
|
29
|
+
returnValue?: ApiParameter;
|
|
30
|
+
}
|
|
13
31
|
export declare class RestApiTool extends BaseTool {
|
|
14
32
|
private readonly endpoint;
|
|
15
33
|
private readonly operation;
|
|
@@ -22,6 +40,7 @@ export declare class RestApiTool extends BaseTool {
|
|
|
22
40
|
preservePropertyNames?: boolean;
|
|
23
41
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
24
42
|
credentialKey?: string;
|
|
43
|
+
operationParser?: OperationParser;
|
|
25
44
|
});
|
|
26
45
|
configureAuthScheme(authScheme: OpenAPIV3.SecuritySchemeObject): void;
|
|
27
46
|
configureAuthCredential(authCredential: AuthCredential): void;
|
|
@@ -34,17 +53,32 @@ export interface PreparedParams {
|
|
|
34
53
|
headers: Record<string, string>;
|
|
35
54
|
body: unknown;
|
|
36
55
|
bodyData: Record<string, unknown>;
|
|
56
|
+
cookies: Record<string, string>;
|
|
37
57
|
}
|
|
38
58
|
export declare function prepareRequestParams(endpoint: OperationEndpoint, parameters: ApiParameter[], args: Record<string, unknown>): PreparedParams;
|
|
39
59
|
export declare function prepareRequestBody(requestBody: OpenAPIV3.RequestBodyObject | OpenAPIV3.ReferenceObject | undefined, body: unknown, bodyData: Record<string, unknown>, headers: Record<string, string>): unknown;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Builds a `RestApiTool` from a parsed operation.
|
|
62
|
+
*
|
|
63
|
+
* @param parsed The operation, with the parameters already parsed when the
|
|
64
|
+
* caller has them.
|
|
65
|
+
* @param options Options forwarded to the tool and to its operation parser.
|
|
66
|
+
* @returns The tool for that operation.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createRestApiTool(parsed: ParsedOperationInput, options?: {
|
|
47
69
|
preservePropertyNames?: boolean;
|
|
48
70
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
49
71
|
credentialKey?: string;
|
|
50
72
|
}): RestApiTool;
|
|
73
|
+
/**
|
|
74
|
+
* Builds a `RestApiTool` from the JSON string form of a parsed operation.
|
|
75
|
+
*
|
|
76
|
+
* This is the only entry point that accepts undecoded input, so it is where
|
|
77
|
+
* the auth scheme is checked. A scheme reaching `createRestApiTool` as an
|
|
78
|
+
* object is already constrained by its type.
|
|
79
|
+
*
|
|
80
|
+
* @param parsedOperationJson A serialized {@link ParsedOperationInput}.
|
|
81
|
+
* @returns The tool for that operation.
|
|
82
|
+
* @throws {Error} If the auth scheme does not declare a known `type`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function createRestApiToolFromJson(parsedOperationJson: string): RestApiTool;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The tool-facing names for the unified agent context.
|
|
8
|
+
*
|
|
9
|
+
* `ToolContext` and `CallbackContext` are aliases of {@link Context}, not
|
|
10
|
+
* subclasses, so a context the framework builds satisfies either name. This
|
|
11
|
+
* mirrors `adk-python`'s `google.adk.tools.tool_context`, which binds
|
|
12
|
+
* `ToolContext = Context`.
|
|
13
|
+
*
|
|
14
|
+
* Python also re-exports `AuthHandler`, `AuthConfig` and `AuthCredential` from
|
|
15
|
+
* this module. adk-js does not: the package `exports` map has no entry for this
|
|
16
|
+
* path, so no consumer can import them from here, and all three already ship
|
|
17
|
+
* from the package root.
|
|
18
|
+
*/
|
|
19
|
+
export { Context as CallbackContext, Context as ToolContext, } from '../agents/context.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* `@google/adk/tools/webmcp` subpath: the WebMCP tools only, without the full
|
|
8
|
+
* ADK barrel. Also re-exported from `@google/adk`.
|
|
9
|
+
*/
|
|
10
|
+
export * from './webmcp_tool.js';
|
|
11
|
+
export * from './webmcp_toolset.js';
|
|
12
|
+
export * from './webmcp_types.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { WebMCPDocument, WebMCPRegisteredTool } from './webmcp_types.js';
|
|
9
|
+
/** Parameters for {@link WebMCPTool}. */
|
|
10
|
+
export interface WebMCPToolParams {
|
|
11
|
+
/** The tool as reported by `document.modelContext.getTools()`. */
|
|
12
|
+
tool: WebMCPRegisteredTool;
|
|
13
|
+
/**
|
|
14
|
+
* Overrides the name exposed to the model, which the toolset uses to apply
|
|
15
|
+
* its prefix. Defaults to the tool's own name.
|
|
16
|
+
*/
|
|
17
|
+
name?: string;
|
|
18
|
+
/** Document to read `modelContext` from. Defaults to the global document. */
|
|
19
|
+
document?: WebMCPDocument;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A tool registered by the page on `document.modelContext`.
|
|
23
|
+
*
|
|
24
|
+
* Converts the tool's JSON Schema into a Gemini `FunctionDeclaration` and
|
|
25
|
+
* executes it through `document.modelContext.executeTool()`, so the page runs
|
|
26
|
+
* its own handler and updates its own UI.
|
|
27
|
+
*
|
|
28
|
+
* A tool annotated `consequentialHint` reports itself as requiring
|
|
29
|
+
* confirmation, so significant page actions flow through ADK's existing tool
|
|
30
|
+
* confirmation rather than firing unprompted.
|
|
31
|
+
*/
|
|
32
|
+
export declare class WebMCPTool extends BaseTool {
|
|
33
|
+
readonly webmcpTool: WebMCPRegisteredTool;
|
|
34
|
+
private readonly doc?;
|
|
35
|
+
constructor(params: WebMCPToolParams);
|
|
36
|
+
/**
|
|
37
|
+
* The tool's JSON Schema as an object.
|
|
38
|
+
*
|
|
39
|
+
* `inputSchema` is specified as an object, but a browser handing back a JSON
|
|
40
|
+
* string would otherwise convert to a parameterless declaration, leaving the
|
|
41
|
+
* model no argument names to fill in — it then calls the tool with `{}`.
|
|
42
|
+
*/
|
|
43
|
+
private resolveInputSchema;
|
|
44
|
+
_getDeclaration(): FunctionDeclaration;
|
|
45
|
+
checkRequireConfirmation(): Promise<boolean>;
|
|
46
|
+
runAsync(request: RunAsyncToolRequest): Promise<unknown>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
7
|
+
import { BaseTool } from '../base_tool.js';
|
|
8
|
+
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
9
|
+
import { WebMCPDocument } from './webmcp_types.js';
|
|
10
|
+
/** Options for {@link WebMCPToolset}. */
|
|
11
|
+
export interface WebMCPToolsetOptions {
|
|
12
|
+
/** Restricts which tools reach the model, by name or predicate. */
|
|
13
|
+
toolFilter?: ToolPredicate | string[];
|
|
14
|
+
/** Prefixes every discovered tool name with `${prefix}_`. */
|
|
15
|
+
prefix?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Secure origins to also collect tools from, for cross-origin iframes. A
|
|
18
|
+
* cross-origin tool is only returned if its page also exposed it to this
|
|
19
|
+
* origin via `exposedTo`.
|
|
20
|
+
*/
|
|
21
|
+
fromOrigins?: string[];
|
|
22
|
+
/** Document to read `modelContext` from. Defaults to the global document. */
|
|
23
|
+
document?: WebMCPDocument;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A toolset backed by the tools a web page registers with WebMCP.
|
|
27
|
+
*
|
|
28
|
+
* WebMCP lets a page declare typed, callable tools on `document.modelContext`.
|
|
29
|
+
* This toolset surfaces them to an in-browser agent, so the agent drives the
|
|
30
|
+
* page through the handlers it published instead of scraping the DOM. Each
|
|
31
|
+
* tool's own `execute` runs in the page, so its UI updates as a side effect.
|
|
32
|
+
*
|
|
33
|
+
* Unlike {@link MCPToolset}, nothing is transported anywhere: discovery and
|
|
34
|
+
* execution are same-document browser calls.
|
|
35
|
+
*
|
|
36
|
+
* Outside a browser, or in a browser without WebMCP, `getTools()` returns an
|
|
37
|
+
* empty array rather than throwing, so this is safe to construct anywhere.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import {LlmAgent} from '@google/adk';
|
|
42
|
+
* import {WebMCPToolset} from '@google/adk/tools/webmcp';
|
|
43
|
+
*
|
|
44
|
+
* const agent = new LlmAgent({
|
|
45
|
+
* name: 'page_agent',
|
|
46
|
+
* model: 'gemini-3.8-live',
|
|
47
|
+
* tools: [new WebMCPToolset()],
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @see https://developer.chrome.com/docs/ai/webmcp
|
|
52
|
+
*/
|
|
53
|
+
export declare class WebMCPToolset extends BaseToolset {
|
|
54
|
+
private readonly doc?;
|
|
55
|
+
private readonly fromOrigins?;
|
|
56
|
+
private readonly changeListeners;
|
|
57
|
+
constructor(options?: WebMCPToolsetOptions);
|
|
58
|
+
/** Whether this document exposes WebMCP. */
|
|
59
|
+
isSupported(): boolean;
|
|
60
|
+
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Subscribes to the WebMCP `toolchange` event, which fires when the page
|
|
63
|
+
* registers or removes tools. Returns an unsubscribe function.
|
|
64
|
+
*/
|
|
65
|
+
onToolChange(listener: () => void): () => void;
|
|
66
|
+
close(): Promise<void>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Minimal structural types for the WebMCP browser API.
|
|
8
|
+
*
|
|
9
|
+
* Declared here rather than taken from the `webmcp-types` package so the core
|
|
10
|
+
* package gains no dependency for a browser-only, still-experimental API. They
|
|
11
|
+
* describe only the surface this toolset uses.
|
|
12
|
+
*
|
|
13
|
+
* @see https://developer.chrome.com/docs/ai/webmcp
|
|
14
|
+
*/
|
|
15
|
+
/** Metadata a page may attach to a registered tool. */
|
|
16
|
+
export interface WebMCPToolAnnotations {
|
|
17
|
+
/** The tool only reads state. */
|
|
18
|
+
readOnlyHint?: boolean;
|
|
19
|
+
/** The tool's output may contain untrusted content. */
|
|
20
|
+
untrustedContentHint?: boolean;
|
|
21
|
+
/** The tool performs a significant or non-reversible real-world action. */
|
|
22
|
+
consequentialHint?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** A tool as reported by `document.modelContext.getTools()`. */
|
|
25
|
+
export interface WebMCPRegisteredTool {
|
|
26
|
+
name: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
/**
|
|
30
|
+
* JSON Schema for the tool's arguments.
|
|
31
|
+
*
|
|
32
|
+
* Typed loosely on purpose: the specification says object, but browsers have
|
|
33
|
+
* been observed handing back a JSON string, and a schema that is silently
|
|
34
|
+
* misread leaves the model unable to pass any arguments at all.
|
|
35
|
+
*/
|
|
36
|
+
inputSchema?: object | string;
|
|
37
|
+
annotations?: WebMCPToolAnnotations;
|
|
38
|
+
origin?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Options accepted by `getTools()`. */
|
|
41
|
+
export interface WebMCPGetToolsOptions {
|
|
42
|
+
/** Secure origins to include tools from, for cross-origin iframes. */
|
|
43
|
+
fromOrigins?: string[];
|
|
44
|
+
}
|
|
45
|
+
/** Options accepted by `executeTool()`. */
|
|
46
|
+
export interface WebMCPExecuteToolOptions {
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}
|
|
49
|
+
/** The `document.modelContext` object. */
|
|
50
|
+
export interface WebMCPModelContext extends EventTarget {
|
|
51
|
+
getTools(options?: WebMCPGetToolsOptions): Promise<WebMCPRegisteredTool[]>;
|
|
52
|
+
executeTool(tool: WebMCPRegisteredTool, args?: unknown, options?: WebMCPExecuteToolOptions): Promise<unknown>;
|
|
53
|
+
}
|
|
54
|
+
/** A Document that may expose WebMCP. */
|
|
55
|
+
export interface WebMCPDocument {
|
|
56
|
+
modelContext?: WebMCPModelContext;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the WebMCP entry point for a document, or undefined when the browser
|
|
60
|
+
* does not expose one.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getModelContext(doc?: WebMCPDocument): WebMCPModelContext | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Whether WebMCP is available.
|
|
65
|
+
*
|
|
66
|
+
* False outside a browser and in browsers without the API, so importing this
|
|
67
|
+
* module from Node is harmless.
|
|
68
|
+
*/
|
|
69
|
+
export declare function isWebMCPSupported(doc?: WebMCPDocument): boolean;
|
|
@@ -10,3 +10,39 @@
|
|
|
10
10
|
* @returns The converted value.
|
|
11
11
|
*/
|
|
12
12
|
export declare function camelCaseKeys(val: unknown): unknown;
|
|
13
|
+
/**
|
|
14
|
+
* Converts one string into snake_case.
|
|
15
|
+
*
|
|
16
|
+
* Handles lowerCamelCase, UpperCamelCase and space-separated text, as well as
|
|
17
|
+
* acronyms such as `REST API` and runs of consecutive uppercase letters.
|
|
18
|
+
*
|
|
19
|
+
* The `Name` suffix separates this from `toSnakeCase` in
|
|
20
|
+
* `object_notation_utils.ts`, which converts the keys of an object and takes a
|
|
21
|
+
* different argument.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* toSnakeCaseName('camelCase'); // 'camel_case'
|
|
26
|
+
* toSnakeCaseName('UpperCamelCase'); // 'upper_camel_case'
|
|
27
|
+
* toSnakeCaseName('REST API'); // 'rest_api'
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param text The input string.
|
|
31
|
+
* @returns The snake_case form of `text`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toSnakeCaseName(text: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Prefixes a Python keyword, the way adk-python's `rename_python_keywords`
|
|
36
|
+
* does. Mirrors the reference exactly: the set is Python's, not TypeScript's.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* renameReservedKeywords('in'); // 'param_in'
|
|
41
|
+
* renameReservedKeywords('total'); // 'total'
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param s The candidate identifier.
|
|
45
|
+
* @param prefix The prefix to add when `s` is reserved.
|
|
46
|
+
* @returns `prefix + s` when `s` is reserved, otherwise `s` unchanged.
|
|
47
|
+
*/
|
|
48
|
+
export declare function renameReservedKeywords(s: string, prefix?: string): string;
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* The header shapes that `fetch` accepts. This matches the DOM library's
|
|
8
|
+
* `HeadersInit`, which is not used by name because the lint configuration
|
|
9
|
+
* defines only Node globals and its `no-undef` rule rejects it.
|
|
10
|
+
*/
|
|
11
|
+
type HeadersInput = Headers | Array<[string, string]> | Record<string, string>;
|
|
6
12
|
export declare function parseUserAgent(userAgent: string): string;
|
|
7
13
|
/**
|
|
8
14
|
* Runs the given callback within a context that has the specified client label.
|
|
@@ -17,3 +23,30 @@ export declare function runWithClientLabel<R>(clientLabel: string, callback: ()
|
|
|
17
23
|
* Returns the current list of client labels that can be added to HTTP Headers.
|
|
18
24
|
*/
|
|
19
25
|
export declare function getClientLabels(): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Returns the HTTP headers that identify a request as coming from ADK.
|
|
28
|
+
*
|
|
29
|
+
* Both headers carry the current client labels, including a label set with
|
|
30
|
+
* {@link runWithClientLabel} when called inside that context.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getTrackingHeaders(): Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a copy of `headers` with the ADK tracking headers merged in.
|
|
35
|
+
*
|
|
36
|
+
* HTTP header names are case-insensitive, so a caller's `User-Agent` or
|
|
37
|
+
* `X-Goog-Api-Client` in any casing is folded onto the lower-case name and the
|
|
38
|
+
* header is sent once. For each tracking header, the ADK tokens come first,
|
|
39
|
+
* followed by every caller token that is not already present. Caller values
|
|
40
|
+
* are split on whitespace and empty tokens are dropped; adk-python splits on a
|
|
41
|
+
* single space, so the two differ only for values with repeated or non-space
|
|
42
|
+
* whitespace. Commas are not treated as separators, so a `Headers` object that
|
|
43
|
+
* joined two values of one header with `, ` keeps the comma on the first
|
|
44
|
+
* token. All other headers keep the caller's name and value.
|
|
45
|
+
*
|
|
46
|
+
* The input is never mutated.
|
|
47
|
+
*
|
|
48
|
+
* @param headers The caller's headers, in any `HeadersInit` shape.
|
|
49
|
+
* @return A new plain object with the merged headers.
|
|
50
|
+
*/
|
|
51
|
+
export declare function mergeTrackingHeaders(headers?: HeadersInput): Record<string, string>;
|
|
52
|
+
export {};
|
|
@@ -10,4 +10,17 @@ type MCPToolSchema = {
|
|
|
10
10
|
required?: string[];
|
|
11
11
|
};
|
|
12
12
|
export declare function toGeminiSchema(mcpSchema?: MCPToolSchema): Schema | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Converts an OpenAPI schema to a Gemini `Schema`.
|
|
15
|
+
*
|
|
16
|
+
* This is the counterpart of `toGeminiSchema` for an arbitrary OpenAPI schema
|
|
17
|
+
* rather than an MCP tool input schema. An OpenAPI document may carry any key
|
|
18
|
+
* it likes, so a key the Gemini `Schema` does not declare is dropped instead of
|
|
19
|
+
* being forwarded to a backend that rejects it.
|
|
20
|
+
*
|
|
21
|
+
* @param openApiSchema The OpenAPI schema, which may be any value.
|
|
22
|
+
* @returns The converted schema, or `undefined` when there is no input.
|
|
23
|
+
* @throws {TypeError} If the input is neither an object nor nullish.
|
|
24
|
+
*/
|
|
25
|
+
export declare function openApiSchemaToGeminiSchema(openApiSchema?: unknown): Schema | undefined;
|
|
13
26
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Serializes `value` to JSON with the keys of every object sorted, so two
|
|
8
|
+
* structurally equal values stringify identically whatever order their
|
|
9
|
+
* properties were assigned in.
|
|
10
|
+
*
|
|
11
|
+
* Array order is meaningful and is preserved. A value JSON cannot represent at
|
|
12
|
+
* the top level, such as `undefined` or a function, stringifies to
|
|
13
|
+
* `'undefined'`, because `JSON.stringify` returns no string for it and callers
|
|
14
|
+
* need one.
|
|
15
|
+
*/
|
|
16
|
+
export declare function stableStringify(value: unknown): string;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a short lowercase hex digest of `value`, computed with FNV-1a over
|
|
19
|
+
* {@link stableStringify}.
|
|
20
|
+
*
|
|
21
|
+
* This is not a cryptographic hash and must not be used as one. It exists to
|
|
22
|
+
* keep distinct values in distinct cache slots, which is the same job
|
|
23
|
+
* adk-python gives the builtin `hash()`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function stableHash(value: unknown): string;
|
|
@@ -33,7 +33,11 @@ export declare const CONSOLE_METHOD: {
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function setLogger(customLogger: Logger | null): void;
|
|
35
35
|
/**
|
|
36
|
-
* Gets the
|
|
36
|
+
* Gets the logger instance that is currently installed.
|
|
37
|
+
*
|
|
38
|
+
* The result is a snapshot. A later {@link setLogger} call swaps the instance,
|
|
39
|
+
* and this reference keeps writing to the old one. The {@link logger} facade
|
|
40
|
+
* resolves the installed instance on every call.
|
|
37
41
|
*/
|
|
38
42
|
export declare function getLogger(): Logger;
|
|
39
43
|
/**
|
|
@@ -55,6 +59,10 @@ export declare function resetLogger(): void;
|
|
|
55
59
|
*/
|
|
56
60
|
export declare function setLogLevel(level: LogLevel): void;
|
|
57
61
|
/**
|
|
58
|
-
* The logger
|
|
62
|
+
* The ADK logger.
|
|
63
|
+
*
|
|
64
|
+
* Every method forwards to the instance installed by {@link setLogger} at call
|
|
65
|
+
* time, so this object is safe to capture at module scope, including across a
|
|
66
|
+
* {@link setLogger} call with `null` to disable logging.
|
|
59
67
|
*/
|
|
60
68
|
export declare const logger: Logger;
|