@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
|
@@ -7,6 +7,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7
7
|
* Copyright 2025 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
|
+
import { getFunctionResponses } from "../events/event.js";
|
|
11
|
+
import { logger } from "../utils/logger.js";
|
|
10
12
|
import {
|
|
11
13
|
isBaseExampleProvider
|
|
12
14
|
} from "./base_example_provider.js";
|
|
@@ -68,17 +70,37 @@ function convertExamplesToText(examples, model) {
|
|
|
68
70
|
return `${EXAMPLES_INTRO}${examplesStr}${EXAMPLES_END}`;
|
|
69
71
|
}
|
|
70
72
|
__name(convertExamplesToText, "convertExamplesToText");
|
|
71
|
-
function
|
|
73
|
+
function getLatestMessageFromUser(session) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const events = session.events;
|
|
76
|
+
if (!events || events.length === 0) {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
const event = events[events.length - 1];
|
|
80
|
+
if (event.author === "user" && getFunctionResponses(event).length === 0) {
|
|
81
|
+
if (((_a = event.content) == null ? void 0 : _a.parts) && ((_b = event.content.parts[0]) == null ? void 0 : _b.text)) {
|
|
82
|
+
return event.content.parts[0].text;
|
|
83
|
+
} else {
|
|
84
|
+
logger.warn("No message from user for fetching example.");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
__name(getLatestMessageFromUser, "getLatestMessageFromUser");
|
|
90
|
+
const _getLatestMessageFromUser = getLatestMessageFromUser;
|
|
91
|
+
async function buildExampleSi(examples, query, model) {
|
|
72
92
|
if (Array.isArray(examples)) {
|
|
73
93
|
return convertExamplesToText(examples, model);
|
|
74
94
|
}
|
|
75
95
|
if (isBaseExampleProvider(examples)) {
|
|
76
|
-
return convertExamplesToText(examples.getExamples(query), model);
|
|
96
|
+
return convertExamplesToText(await examples.getExamples(query), model);
|
|
77
97
|
}
|
|
78
98
|
throw new Error("Invalid example configuration");
|
|
79
99
|
}
|
|
80
100
|
__name(buildExampleSi, "buildExampleSi");
|
|
81
101
|
export {
|
|
102
|
+
_getLatestMessageFromUser,
|
|
82
103
|
buildExampleSi,
|
|
83
|
-
convertExamplesToText
|
|
104
|
+
convertExamplesToText,
|
|
105
|
+
getLatestMessageFromUser
|
|
84
106
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2025 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
export * from "./base_example_provider.js";
|
|
9
|
+
export * from "./example.js";
|
|
10
|
+
export * from "./example_util.js";
|
|
11
|
+
export * from "./vertex_ai_example_store.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2025 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import { VertexAiExampleStore } from "./example.js";
|
|
9
|
+
export {
|
|
10
|
+
VertexAiExampleStore
|
|
11
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -37,12 +37,42 @@ import {
|
|
|
37
37
|
validateSkillDir
|
|
38
38
|
} from "./skills/loader.js";
|
|
39
39
|
import { LOAD_WEB_PAGE, loadWebPage } from "./tools/load_web_page.js";
|
|
40
|
+
import {
|
|
41
|
+
credentialToParam,
|
|
42
|
+
dictToAuthScheme,
|
|
43
|
+
INTERNAL_AUTH_PREFIX,
|
|
44
|
+
openidDictToSchemeCredential,
|
|
45
|
+
openidUrlToSchemeCredential,
|
|
46
|
+
serviceAccountDictToSchemeCredential,
|
|
47
|
+
serviceAccountSchemeCredential,
|
|
48
|
+
tokenToSchemeCredential
|
|
49
|
+
} from "./tools/openapi_tool/auth/auth_helpers.js";
|
|
50
|
+
import { AutoAuthCredentialExchanger } from "./tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js";
|
|
51
|
+
import {
|
|
52
|
+
AuthCredentialMissingError,
|
|
53
|
+
BaseAuthCredentialExchanger
|
|
54
|
+
} from "./tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js";
|
|
55
|
+
import {
|
|
56
|
+
exchangeCredential,
|
|
57
|
+
OAuth2BearerExchanger
|
|
58
|
+
} from "./tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js";
|
|
59
|
+
import { ServiceAccountCredentialExchanger } from "./tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js";
|
|
60
|
+
import {
|
|
61
|
+
createApiParameter,
|
|
62
|
+
generateParamDoc,
|
|
63
|
+
generateReturnDoc,
|
|
64
|
+
getTypeHint
|
|
65
|
+
} from "./tools/openapi_tool/common/common.js";
|
|
40
66
|
import { OpenApiSpecParser } from "./tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js";
|
|
41
67
|
import { OperationParser } from "./tools/openapi_tool/openapi_spec_parser/operation_parser.js";
|
|
42
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
ToolAuthHandler,
|
|
70
|
+
ToolContextCredentialStore
|
|
71
|
+
} from "./tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js";
|
|
43
72
|
import { OpenAPIToolset } from "./tools/openapi_tool/openapi_toolset.js";
|
|
44
73
|
import {
|
|
45
74
|
createRestApiTool,
|
|
75
|
+
createRestApiToolFromJson,
|
|
46
76
|
RestApiTool
|
|
47
77
|
} from "./tools/openapi_tool/rest_api_tool.js";
|
|
48
78
|
import { FilesRetrieval } from "./tools/retrieval/files_retrieval.js";
|
|
@@ -59,6 +89,9 @@ export * from "./telemetry/setup.js";
|
|
|
59
89
|
export * from "./tools/mcp/index.js";
|
|
60
90
|
export {
|
|
61
91
|
AgentEngineSandboxCodeExecutor,
|
|
92
|
+
AuthCredentialMissingError,
|
|
93
|
+
AutoAuthCredentialExchanger,
|
|
94
|
+
BaseAuthCredentialExchanger,
|
|
62
95
|
CodeExecutionLanguage,
|
|
63
96
|
ContainerCodeExecutor,
|
|
64
97
|
DatabaseSessionService,
|
|
@@ -66,10 +99,12 @@ export {
|
|
|
66
99
|
FilesRetrieval,
|
|
67
100
|
GCPSkillRegistry,
|
|
68
101
|
GcsArtifactService,
|
|
102
|
+
INTERNAL_AUTH_PREFIX,
|
|
69
103
|
InvocationContext,
|
|
70
104
|
LOAD_WEB_PAGE,
|
|
71
105
|
LoadSkillResourceTool,
|
|
72
106
|
LocalEnvironment,
|
|
107
|
+
OAuth2BearerExchanger,
|
|
73
108
|
OpenAPIToolset,
|
|
74
109
|
OpenApiSpecParser,
|
|
75
110
|
OperationParser,
|
|
@@ -77,18 +112,33 @@ export {
|
|
|
77
112
|
RunSkillInlineScriptErrorCode,
|
|
78
113
|
RunSkillInlineScriptTool,
|
|
79
114
|
RunSkillScriptTool,
|
|
115
|
+
ServiceAccountCredentialExchanger,
|
|
80
116
|
SkillToolset,
|
|
81
117
|
ToolAuthHandler,
|
|
118
|
+
ToolContextCredentialStore,
|
|
82
119
|
UnsafeLocalCodeExecutor,
|
|
83
120
|
VertexAiMemoryBankService,
|
|
84
121
|
VertexAiRagMemoryService,
|
|
85
122
|
VertexAiSessionService,
|
|
123
|
+
createApiParameter,
|
|
86
124
|
createRestApiTool,
|
|
125
|
+
createRestApiToolFromJson,
|
|
126
|
+
credentialToParam,
|
|
127
|
+
dictToAuthScheme,
|
|
128
|
+
exchangeCredential,
|
|
129
|
+
generateParamDoc,
|
|
130
|
+
generateReturnDoc,
|
|
87
131
|
getArtifactServiceFromUri,
|
|
88
132
|
getSessionServiceFromUri,
|
|
133
|
+
getTypeHint,
|
|
89
134
|
loadAllSkillsInDir,
|
|
90
135
|
loadSkillFromDir,
|
|
91
136
|
loadSkillFromZipBuffer,
|
|
92
137
|
loadWebPage,
|
|
138
|
+
openidDictToSchemeCredential,
|
|
139
|
+
openidUrlToSchemeCredential,
|
|
140
|
+
serviceAccountDictToSchemeCredential,
|
|
141
|
+
serviceAccountSchemeCredential,
|
|
142
|
+
tokenToSchemeCredential,
|
|
93
143
|
validateSkillDir
|
|
94
144
|
};
|
|
@@ -40,7 +40,7 @@ const ENABLE_CONSOLIDATION_KEY = "enable_consolidation";
|
|
|
40
40
|
const MAX_DIRECT_MEMORIES_PER_GENERATE_CALL = 5;
|
|
41
41
|
function shouldFilterOutEvent(content) {
|
|
42
42
|
return !((content == null ? void 0 : content.parts) || []).some(
|
|
43
|
-
(p) => p.text || p.inlineData || p.fileData
|
|
43
|
+
(p) => p.text || p.inlineData || p.fileData || p.functionCall || p.functionResponse || p.executableCode || p.codeExecutionResult || p.toolCall || p.toolResponse
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
__name(shouldFilterOutEvent, "shouldFilterOutEvent");
|
|
@@ -126,6 +126,15 @@ const _VertexAiMemoryBankService = class _VertexAiMemoryBankService {
|
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Adds explicit memory items using Vertex Memory Bank.
|
|
129
|
+
*
|
|
130
|
+
* When a `MemoryEntry.id` is set, it is forwarded as the `memoryId` of the
|
|
131
|
+
* created memory, so the caller picks the last component of the memory
|
|
132
|
+
* resource name instead of letting the service generate one. An explicit
|
|
133
|
+
* `customMetadata['memoryId']` takes precedence over `MemoryEntry.id`.
|
|
134
|
+
*
|
|
135
|
+
* The id is forwarded unvalidated, so an id the API rejects fails the create
|
|
136
|
+
* call. Vertex accepts up to 63 characters from `[a-z0-9-]`, starting with a
|
|
137
|
+
* letter and ending with a letter or number.
|
|
129
138
|
*/
|
|
130
139
|
async addMemory(request) {
|
|
131
140
|
if (isConsolidationEnabled(request.customMetadata)) {
|
|
@@ -201,7 +210,8 @@ const _VertexAiMemoryBankService = class _VertexAiMemoryBankService {
|
|
|
201
210
|
const memoryRevisionLabels = revisionLabelsForMemory(memory);
|
|
202
211
|
const config = buildCreateMemoryConfig({
|
|
203
212
|
customMetadata: memoryMetadata,
|
|
204
|
-
memoryRevisionLabels
|
|
213
|
+
memoryRevisionLabels,
|
|
214
|
+
memoryId: memory.id
|
|
205
215
|
});
|
|
206
216
|
const params = {
|
|
207
217
|
name: `reasoningEngines/${this.agentEngineId}`,
|
|
@@ -302,6 +312,9 @@ function buildCreateMemoryConfig(params) {
|
|
|
302
312
|
};
|
|
303
313
|
}
|
|
304
314
|
}
|
|
315
|
+
if (params.memoryId !== void 0 && config["memoryId"] === void 0) {
|
|
316
|
+
config["memoryId"] = params.memoryId;
|
|
317
|
+
}
|
|
305
318
|
const revisionLabels = {
|
|
306
319
|
...customRevisionLabels,
|
|
307
320
|
...params.memoryRevisionLabels
|
|
@@ -435,9 +448,8 @@ function mergeCustomMetadataForMemory(params) {
|
|
|
435
448
|
if (params.customMetadata) {
|
|
436
449
|
Object.assign(mergedMetadata, params.customMetadata);
|
|
437
450
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
Object.assign(mergedMetadata, memoryWithMetadata.customMetadata);
|
|
451
|
+
if (params.memory.customMetadata) {
|
|
452
|
+
Object.assign(mergedMetadata, params.memory.customMetadata);
|
|
441
453
|
}
|
|
442
454
|
if (Object.keys(mergedMetadata).length === 0) {
|
|
443
455
|
return void 0;
|
|
@@ -8,7 +8,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
10
|
var _a;
|
|
11
|
-
import {
|
|
11
|
+
import { getTrackingHeaders } from "../utils/client_labels.js";
|
|
12
12
|
const BASE_MODEL_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.baseModel");
|
|
13
13
|
function isBaseLlm(obj) {
|
|
14
14
|
return typeof obj === "object" && obj !== null && BASE_MODEL_SYMBOL in obj && obj[BASE_MODEL_SYMBOL] === true;
|
|
@@ -30,12 +30,7 @@ const _BaseLlm = class _BaseLlm {
|
|
|
30
30
|
this.model = model;
|
|
31
31
|
}
|
|
32
32
|
get trackingHeaders() {
|
|
33
|
-
|
|
34
|
-
const headerValue = labels.join(" ");
|
|
35
|
-
return {
|
|
36
|
-
"x-goog-api-client": headerValue,
|
|
37
|
-
"user-agent": headerValue
|
|
38
|
-
};
|
|
33
|
+
return getTrackingHeaders();
|
|
39
34
|
}
|
|
40
35
|
/**
|
|
41
36
|
* Appends a user content, so that model can continue to output.
|
|
@@ -19,7 +19,10 @@ import {
|
|
|
19
19
|
finalText,
|
|
20
20
|
isAbortError,
|
|
21
21
|
isRecord,
|
|
22
|
-
|
|
22
|
+
looksLikeEnvelope,
|
|
23
|
+
renderToolInstructions,
|
|
24
|
+
salvageFinalText,
|
|
25
|
+
TRUNCATED_REPLY
|
|
23
26
|
} from "./chrome_prompt_utils.js";
|
|
24
27
|
import { stripAdkIdentityPreamble } from "./chrome_prompt_utils.js";
|
|
25
28
|
const _ChromeModelUnavailableError = class _ChromeModelUnavailableError extends Error {
|
|
@@ -231,11 +234,19 @@ const _ChromeBuiltInLlm = class _ChromeBuiltInLlm extends BaseLlm {
|
|
|
231
234
|
}
|
|
232
235
|
}
|
|
233
236
|
if (!isRecord(parsed)) {
|
|
237
|
+
const salvaged = salvageFinalText(raw);
|
|
238
|
+
if (salvaged !== void 0) {
|
|
239
|
+
this.diagnostic({
|
|
240
|
+
phase: "parse-fallback",
|
|
241
|
+
note: "truncated envelope; recovered the text"
|
|
242
|
+
});
|
|
243
|
+
return finalText(salvaged);
|
|
244
|
+
}
|
|
234
245
|
this.diagnostic({
|
|
235
246
|
phase: "parse-fallback",
|
|
236
247
|
note: "unparseable JSON; treated as text"
|
|
237
248
|
});
|
|
238
|
-
return finalText(raw);
|
|
249
|
+
return finalText(looksLikeEnvelope(raw) ? TRUNCATED_REPLY : raw);
|
|
239
250
|
}
|
|
240
251
|
if (parsed["kind"] === "tool" && typeof parsed["name"] === "string") {
|
|
241
252
|
const name = parsed["name"];
|
|
@@ -253,7 +264,13 @@ const _ChromeBuiltInLlm = class _ChromeBuiltInLlm extends BaseLlm {
|
|
|
253
264
|
turnComplete: true
|
|
254
265
|
};
|
|
255
266
|
}
|
|
256
|
-
|
|
267
|
+
if (typeof parsed["text"] === "string") return finalText(parsed["text"]);
|
|
268
|
+
if (parsed["text"] !== void 0) return finalText(String(parsed["text"]));
|
|
269
|
+
this.diagnostic({
|
|
270
|
+
phase: "parse-fallback",
|
|
271
|
+
note: "envelope carried no text"
|
|
272
|
+
});
|
|
273
|
+
return finalText(looksLikeEnvelope(raw) ? TRUNCATED_REPLY : raw);
|
|
257
274
|
}
|
|
258
275
|
async connect(_llmRequest) {
|
|
259
276
|
throw new Error(
|
|
@@ -43,7 +43,8 @@ function buildToolChoiceSchema(declarations) {
|
|
|
43
43
|
kind: { type: "string", enum: ["final"] },
|
|
44
44
|
text: { type: "string" }
|
|
45
45
|
},
|
|
46
|
-
required: ["kind", "text"]
|
|
46
|
+
required: ["kind", "text"],
|
|
47
|
+
additionalProperties: false
|
|
47
48
|
}
|
|
48
49
|
];
|
|
49
50
|
for (const declaration of declarations) {
|
|
@@ -55,7 +56,8 @@ function buildToolChoiceSchema(declarations) {
|
|
|
55
56
|
name: { type: "string", enum: [declaration.name] },
|
|
56
57
|
args: argumentSchema(declaration)
|
|
57
58
|
},
|
|
58
|
-
required: ["kind", "name", "args"]
|
|
59
|
+
required: ["kind", "name", "args"],
|
|
60
|
+
additionalProperties: false
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
return branches.length === 1 ? branches[0] : { anyOf: branches };
|
|
@@ -177,7 +179,52 @@ function errorResponse(error) {
|
|
|
177
179
|
return { errorCode: name, errorMessage: message, turnComplete: true };
|
|
178
180
|
}
|
|
179
181
|
__name(errorResponse, "errorResponse");
|
|
182
|
+
const TRUNCATED_REPLY = "The model started an answer and did not finish it. Ask again.";
|
|
183
|
+
function looksLikeEnvelope(raw) {
|
|
184
|
+
return /^\s*[[{]/.test(raw) || /"kind"\s*:/.test(raw);
|
|
185
|
+
}
|
|
186
|
+
__name(looksLikeEnvelope, "looksLikeEnvelope");
|
|
187
|
+
function salvageFinalText(raw) {
|
|
188
|
+
var _a;
|
|
189
|
+
const key = raw.match(/"text"\s*:\s*"/);
|
|
190
|
+
if ((key == null ? void 0 : key.index) === void 0) return void 0;
|
|
191
|
+
const escapes = {
|
|
192
|
+
n: "\n",
|
|
193
|
+
t: " ",
|
|
194
|
+
r: "\r",
|
|
195
|
+
b: "\b",
|
|
196
|
+
f: "\f",
|
|
197
|
+
'"': '"',
|
|
198
|
+
"\\": "\\",
|
|
199
|
+
"/": "/"
|
|
200
|
+
};
|
|
201
|
+
let out = "";
|
|
202
|
+
for (let i = key.index + key[0].length; i < raw.length; i++) {
|
|
203
|
+
const char = raw[i];
|
|
204
|
+
if (char === '"') break;
|
|
205
|
+
if (char !== "\\") {
|
|
206
|
+
out += char;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const next = raw[i + 1];
|
|
210
|
+
if (next === void 0) break;
|
|
211
|
+
if (next === "u") {
|
|
212
|
+
const hex = raw.slice(i + 2, i + 6);
|
|
213
|
+
if (/^[0-9a-fA-F]{4}$/.test(hex)) {
|
|
214
|
+
out += String.fromCharCode(parseInt(hex, 16));
|
|
215
|
+
i += 5;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
out += (_a = escapes[next]) != null ? _a : next;
|
|
220
|
+
i++;
|
|
221
|
+
}
|
|
222
|
+
const text = out.trim();
|
|
223
|
+
return text.length ? text : void 0;
|
|
224
|
+
}
|
|
225
|
+
__name(salvageFinalText, "salvageFinalText");
|
|
180
226
|
export {
|
|
227
|
+
TRUNCATED_REPLY,
|
|
181
228
|
buildToolChoiceSchema,
|
|
182
229
|
collectFunctionDeclarations,
|
|
183
230
|
contentsToMessages,
|
|
@@ -186,7 +233,9 @@ export {
|
|
|
186
233
|
finalText,
|
|
187
234
|
isAbortError,
|
|
188
235
|
isRecord,
|
|
236
|
+
looksLikeEnvelope,
|
|
189
237
|
renderToolInstructions,
|
|
190
238
|
renderToolResult,
|
|
239
|
+
salvageFinalText,
|
|
191
240
|
stripAdkIdentityPreamble
|
|
192
241
|
};
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import {
|
|
11
|
+
FinishReason
|
|
12
|
+
} from "@google/genai";
|
|
13
|
+
import { removeClientFunctionCallId } from "../agents/processors/content_processor_utils.js";
|
|
14
|
+
import { logger } from "../utils/logger.js";
|
|
15
|
+
import { createLlmResponse } from "./llm_response.js";
|
|
16
|
+
const MAX_RESUMES = 256;
|
|
17
|
+
function resumeToken(response) {
|
|
18
|
+
var _a;
|
|
19
|
+
const candidate = (_a = response.candidates) == null ? void 0 : _a[0];
|
|
20
|
+
if ((candidate == null ? void 0 : candidate.finishReason) !== FinishReason.CONTINUATION) {
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
if (!candidate.continuationToken) {
|
|
24
|
+
logger.warn(
|
|
25
|
+
"The model paused the generation for continuation, but the response carries no continuation token, so the partial output is returned."
|
|
26
|
+
);
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
return candidate.continuationToken;
|
|
30
|
+
}
|
|
31
|
+
__name(resumeToken, "resumeToken");
|
|
32
|
+
const _GeminiContinuation = class _GeminiContinuation {
|
|
33
|
+
constructor(contents, config) {
|
|
34
|
+
this.config = config;
|
|
35
|
+
this.parts = [];
|
|
36
|
+
this.resumes = 0;
|
|
37
|
+
this.contents = [...contents];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Adds one request's output to the generation: its parts to the content and
|
|
41
|
+
* its usage to the total.
|
|
42
|
+
*/
|
|
43
|
+
addOutput(newParts, newUsage) {
|
|
44
|
+
this.usage = addUsage(this.usage, newUsage);
|
|
45
|
+
this.appendParts(newParts);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns the request that resumes the generation after a request that
|
|
49
|
+
* ended with `nextToken`. Returns undefined if the request did not pause,
|
|
50
|
+
* returned the previous token again, or the generation was already resumed
|
|
51
|
+
* {@link MAX_RESUMES} times.
|
|
52
|
+
*/
|
|
53
|
+
resumeRequest(nextToken) {
|
|
54
|
+
if (nextToken === void 0) {
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
if (!this.willResume(nextToken)) {
|
|
58
|
+
if (nextToken === this.token) {
|
|
59
|
+
logger.warn(
|
|
60
|
+
"The model returned the same continuation token twice; returning the output generated so far."
|
|
61
|
+
);
|
|
62
|
+
} else {
|
|
63
|
+
logger.warn(
|
|
64
|
+
`The model paused the generation ${MAX_RESUMES} times; returning the output generated so far.`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
69
|
+
this.token = nextToken;
|
|
70
|
+
this.resumes++;
|
|
71
|
+
logger.debug("The model paused the generation; resuming it.");
|
|
72
|
+
return this.buildResumeRequest(nextToken);
|
|
73
|
+
}
|
|
74
|
+
/** Returns `response` with the content and usage of all requests, if resumed. */
|
|
75
|
+
complete(response) {
|
|
76
|
+
var _a;
|
|
77
|
+
if (!this.resumed) {
|
|
78
|
+
return createLlmResponse(response);
|
|
79
|
+
}
|
|
80
|
+
const candidate = (_a = response.candidates) == null ? void 0 : _a[0];
|
|
81
|
+
return createLlmResponse({
|
|
82
|
+
...response,
|
|
83
|
+
usageMetadata: this.usage,
|
|
84
|
+
candidates: candidate && this.parts.length > 0 ? [{ ...candidate, content: this.content() }] : response.candidates
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns the final streamed `response`, with usage summed across all
|
|
89
|
+
* requests if resumed.
|
|
90
|
+
*/
|
|
91
|
+
withSummedUsage(response) {
|
|
92
|
+
return this.resumed ? { ...response, usageMetadata: this.usage } : response;
|
|
93
|
+
}
|
|
94
|
+
/** Returns whether a request that ended with `nextToken` is resumed. */
|
|
95
|
+
willResume(nextToken) {
|
|
96
|
+
return nextToken !== this.token && this.resumes < MAX_RESUMES;
|
|
97
|
+
}
|
|
98
|
+
/** Whether the generation took more than one request. */
|
|
99
|
+
get resumed() {
|
|
100
|
+
return this.token !== void 0;
|
|
101
|
+
}
|
|
102
|
+
content() {
|
|
103
|
+
return { role: "model", parts: [...this.parts] };
|
|
104
|
+
}
|
|
105
|
+
buildResumeRequest(nextToken) {
|
|
106
|
+
const contents = [...this.contents];
|
|
107
|
+
if (this.parts.length > 0) {
|
|
108
|
+
const content = structuredClone(this.content());
|
|
109
|
+
removeClientFunctionCallId(content);
|
|
110
|
+
contents.push(content);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
contents,
|
|
114
|
+
config: { ...this.config, continuationToken: nextToken }
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/** Appends `newParts`, joining text as the streaming aggregator does. */
|
|
118
|
+
appendParts(newParts) {
|
|
119
|
+
for (const part of newParts) {
|
|
120
|
+
const last = this.parts.length - 1;
|
|
121
|
+
const previous = last >= 0 ? this.parts[last] : void 0;
|
|
122
|
+
if (previous && canJoin(previous, part)) {
|
|
123
|
+
const joined = { text: previous.text + part.text };
|
|
124
|
+
if (previous.thought !== void 0) {
|
|
125
|
+
joined.thought = previous.thought;
|
|
126
|
+
}
|
|
127
|
+
const signature = previous.thoughtSignature || part.thoughtSignature;
|
|
128
|
+
if (signature !== void 0) {
|
|
129
|
+
joined.thoughtSignature = signature;
|
|
130
|
+
}
|
|
131
|
+
this.parts[last] = joined;
|
|
132
|
+
} else {
|
|
133
|
+
this.parts.push(part);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
__name(_GeminiContinuation, "GeminiContinuation");
|
|
139
|
+
let GeminiContinuation = _GeminiContinuation;
|
|
140
|
+
function canJoin(first, second) {
|
|
141
|
+
var _a, _b;
|
|
142
|
+
return isText(first) && isText(second) && ((_a = first.thought) != null ? _a : false) === ((_b = second.thought) != null ? _b : false);
|
|
143
|
+
}
|
|
144
|
+
__name(canJoin, "canJoin");
|
|
145
|
+
function isText(part) {
|
|
146
|
+
if (!part.text) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
return Object.entries(part).every(
|
|
150
|
+
([key, value]) => value === void 0 || key === "text" || key === "thought" || key === "thoughtSignature"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
__name(isText, "isText");
|
|
154
|
+
const COUNT_FIELDS = [
|
|
155
|
+
"promptTokenCount",
|
|
156
|
+
"candidatesTokenCount",
|
|
157
|
+
"totalTokenCount",
|
|
158
|
+
"cachedContentTokenCount",
|
|
159
|
+
"thoughtsTokenCount",
|
|
160
|
+
"toolUsePromptTokenCount"
|
|
161
|
+
];
|
|
162
|
+
const MODALITY_FIELDS = [
|
|
163
|
+
"promptTokensDetails",
|
|
164
|
+
"candidatesTokensDetails",
|
|
165
|
+
"cacheTokensDetails",
|
|
166
|
+
"toolUsePromptTokensDetails"
|
|
167
|
+
];
|
|
168
|
+
function addUsage(total, next) {
|
|
169
|
+
var _a, _b;
|
|
170
|
+
if (!total || !next) {
|
|
171
|
+
return total != null ? total : next;
|
|
172
|
+
}
|
|
173
|
+
const combined = { ...next };
|
|
174
|
+
for (const field of COUNT_FIELDS) {
|
|
175
|
+
if (total[field] !== void 0 || next[field] !== void 0) {
|
|
176
|
+
combined[field] = ((_a = total[field]) != null ? _a : 0) + ((_b = next[field]) != null ? _b : 0);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
for (const field of MODALITY_FIELDS) {
|
|
180
|
+
if (total[field] !== void 0 || next[field] !== void 0) {
|
|
181
|
+
combined[field] = addModalityCounts(total[field], next[field]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return combined;
|
|
185
|
+
}
|
|
186
|
+
__name(addUsage, "addUsage");
|
|
187
|
+
function addModalityCounts(first, second) {
|
|
188
|
+
var _a, _b;
|
|
189
|
+
const totals = /* @__PURE__ */ new Map();
|
|
190
|
+
for (const count of [...first != null ? first : [], ...second != null ? second : []]) {
|
|
191
|
+
totals.set(
|
|
192
|
+
count.modality,
|
|
193
|
+
((_a = totals.get(count.modality)) != null ? _a : 0) + ((_b = count.tokenCount) != null ? _b : 0)
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
return [...totals].map(
|
|
197
|
+
([modality, tokenCount]) => modality === void 0 ? { tokenCount } : { modality, tokenCount }
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
__name(addModalityCounts, "addModalityCounts");
|
|
201
|
+
export {
|
|
202
|
+
GeminiContinuation,
|
|
203
|
+
MAX_RESUMES,
|
|
204
|
+
resumeToken
|
|
205
|
+
};
|
|
@@ -9,7 +9,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
9
9
|
*/
|
|
10
10
|
import { LiveResponseAggregator } from "../utils/live_connection_utils.js";
|
|
11
11
|
import { logger } from "../utils/logger.js";
|
|
12
|
-
import {
|
|
12
|
+
import { isGemini35LiveTranslate, isGemini3xLive } from "../utils/model_name.js";
|
|
13
13
|
const _GeminiLlmConnection = class _GeminiLlmConnection {
|
|
14
14
|
constructor(geminiSession, modelVersion, messageQueue) {
|
|
15
15
|
this.geminiSession = geminiSession;
|
|
@@ -33,7 +33,7 @@ const _GeminiLlmConnection = class _GeminiLlmConnection {
|
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
35
|
if (contents.length > 0) {
|
|
36
|
-
const isGemini3x =
|
|
36
|
+
const isGemini3x = isGemini3xLive(this.modelVersion);
|
|
37
37
|
this.geminiSession.sendClientContent({
|
|
38
38
|
turns: contents,
|
|
39
39
|
turnComplete: isGemini3x ? true : contents[contents.length - 1].role === "user"
|
|
@@ -63,7 +63,7 @@ const _GeminiLlmConnection = class _GeminiLlmConnection {
|
|
|
63
63
|
});
|
|
64
64
|
} else {
|
|
65
65
|
logger.debug("Sending LLM new content", content);
|
|
66
|
-
const isGemini3x =
|
|
66
|
+
const isGemini3x = isGemini3xLive(this.modelVersion);
|
|
67
67
|
if (isGemini3x && content.parts.length === 1 && content.parts[0].text) {
|
|
68
68
|
logger.debug("Using sendRealtimeInput for Gemini 3.x text input");
|
|
69
69
|
this.geminiSession.sendRealtimeInput({ text: content.parts[0].text });
|
|
@@ -83,9 +83,10 @@ const _GeminiLlmConnection = class _GeminiLlmConnection {
|
|
|
83
83
|
async sendRealtime(blob) {
|
|
84
84
|
var _a, _b, _c;
|
|
85
85
|
logger.debug("Sending LLM Blob:", blob);
|
|
86
|
-
const isGemini3x =
|
|
86
|
+
const isGemini3x = isGemini3xLive(this.modelVersion);
|
|
87
87
|
const isNativeAudio = (_a = this.modelVersion) == null ? void 0 : _a.includes("native-audio");
|
|
88
|
-
|
|
88
|
+
const isLiveTranslate = isGemini35LiveTranslate(this.modelVersion);
|
|
89
|
+
if (isGemini3x || isNativeAudio || isLiveTranslate) {
|
|
89
90
|
if ((_b = blob.mimeType) == null ? void 0 : _b.startsWith("audio/")) {
|
|
90
91
|
this.geminiSession.sendRealtimeInput({ audio: blob });
|
|
91
92
|
} else if ((_c = blob.mimeType) == null ? void 0 : _c.startsWith("image/")) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
var _a;
|
|
11
|
+
const BASE_PLANNER_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.basePlanner");
|
|
12
|
+
function isBasePlanner(obj) {
|
|
13
|
+
return typeof obj === "object" && obj !== null && BASE_PLANNER_SIGNATURE_SYMBOL in obj && obj[BASE_PLANNER_SIGNATURE_SYMBOL] === true;
|
|
14
|
+
}
|
|
15
|
+
__name(isBasePlanner, "isBasePlanner");
|
|
16
|
+
_a = BASE_PLANNER_SIGNATURE_SYMBOL;
|
|
17
|
+
const _BasePlanner = class _BasePlanner {
|
|
18
|
+
constructor() {
|
|
19
|
+
/** A unique symbol to identify ADK base planner class. */
|
|
20
|
+
this[_a] = true;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
__name(_BasePlanner, "BasePlanner");
|
|
24
|
+
let BasePlanner = _BasePlanner;
|
|
25
|
+
export {
|
|
26
|
+
BasePlanner,
|
|
27
|
+
isBasePlanner
|
|
28
|
+
};
|