@google/adk 2.1.0 → 2.2.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/agent_card.js +8 -0
- package/dist/cjs/a2a/agent_executor.js +8 -3
- 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 +45 -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_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/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/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 +38 -2
- 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_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/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 +16 -4
- 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/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/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 +112 -79
- package/dist/web/index_web.js.map +4 -4
- package/package.json +8 -2
|
@@ -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;
|
|
@@ -33,10 +33,38 @@ export declare function isGemini1Model(modelString: string): boolean;
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function isGemini2OrAbove(modelString: string): boolean;
|
|
35
35
|
/**
|
|
36
|
-
* Check if the model is a Gemini 3.x
|
|
36
|
+
* Check if the model is a Gemini 3.x Live model.
|
|
37
|
+
*
|
|
38
|
+
* Matches the whole `gemini-3.N-*live*` family, not just the `-flash-live`
|
|
39
|
+
* spelling: ids such as `gemini-3.8-live` and `gemini-3.5-transcribe-live` are
|
|
40
|
+
* Live models too, and they need the same realtime handling. Non-live 3.x
|
|
41
|
+
* models such as `gemini-3.0-flash` are still excluded. Gemini 3.5 Live
|
|
42
|
+
* Translate ids are excluded as well, mirroring adk-python's
|
|
43
|
+
* `_is_gemini_3_x_live`, which handles them through a dedicated translate
|
|
44
|
+
* branch instead.
|
|
45
|
+
*
|
|
46
|
+
* @param modelString Either a simple model name or path-based model name
|
|
47
|
+
* @return true if it's a Gemini 3.x Live model, false otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isGemini3xLive(modelString: string | undefined): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if the model is a Gemini 3.5 Live Translate model.
|
|
52
|
+
*
|
|
53
|
+
* Live Translate ids contain "-live" but are translation endpoints rather
|
|
54
|
+
* than conversational Live models, so they must not take the Gemini 3.x Live
|
|
55
|
+
* conversational path. Mirrors adk-python's `is_gemini_3_5_live_translate`.
|
|
56
|
+
*
|
|
57
|
+
* @param modelString Either a simple model name or path-based model name
|
|
58
|
+
* @return true if it's a Gemini 3.5 Live Translate model, false otherwise.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isGemini35LiveTranslate(modelString: string | undefined): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Check if the model is a Gemini 3.x Live model.
|
|
37
63
|
*
|
|
38
64
|
* @param modelString Either a simple model name or path-based model name
|
|
39
|
-
* @return true if it's a Gemini 3.x
|
|
65
|
+
* @return true if it's a Gemini 3.x Live model, false otherwise.
|
|
66
|
+
* @deprecated Renamed to {@link isGemini3xLive}, which covers every Gemini 3.x
|
|
67
|
+
* Live id rather than only those spelled `-flash-live`.
|
|
40
68
|
*/
|
|
41
69
|
export declare function isGemini3xFlashLive(modelString: string | undefined): boolean;
|
|
42
70
|
/**
|
package/dist/types/version.d.ts
CHANGED