@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
|
@@ -25,7 +25,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var case_utils_exports = {};
|
|
27
27
|
__export(case_utils_exports, {
|
|
28
|
-
camelCaseKeys: () => camelCaseKeys
|
|
28
|
+
camelCaseKeys: () => camelCaseKeys,
|
|
29
|
+
renameReservedKeywords: () => renameReservedKeywords,
|
|
30
|
+
toSnakeCaseName: () => toSnakeCaseName
|
|
29
31
|
});
|
|
30
32
|
module.exports = __toCommonJS(case_utils_exports);
|
|
31
33
|
/**
|
|
@@ -49,7 +51,55 @@ function camelCaseKeys(val) {
|
|
|
49
51
|
return val;
|
|
50
52
|
}
|
|
51
53
|
__name(camelCaseKeys, "camelCaseKeys");
|
|
54
|
+
const PYTHON_KEYWORDS = /* @__PURE__ */ new Set([
|
|
55
|
+
"False",
|
|
56
|
+
"None",
|
|
57
|
+
"True",
|
|
58
|
+
"and",
|
|
59
|
+
"as",
|
|
60
|
+
"assert",
|
|
61
|
+
"async",
|
|
62
|
+
"await",
|
|
63
|
+
"break",
|
|
64
|
+
"class",
|
|
65
|
+
"continue",
|
|
66
|
+
"def",
|
|
67
|
+
"del",
|
|
68
|
+
"elif",
|
|
69
|
+
"else",
|
|
70
|
+
"except",
|
|
71
|
+
"finally",
|
|
72
|
+
"for",
|
|
73
|
+
"from",
|
|
74
|
+
"global",
|
|
75
|
+
"if",
|
|
76
|
+
"import",
|
|
77
|
+
"in",
|
|
78
|
+
"is",
|
|
79
|
+
"lambda",
|
|
80
|
+
"nonlocal",
|
|
81
|
+
"not",
|
|
82
|
+
"or",
|
|
83
|
+
"pass",
|
|
84
|
+
"raise",
|
|
85
|
+
"return",
|
|
86
|
+
"try",
|
|
87
|
+
"while",
|
|
88
|
+
"with",
|
|
89
|
+
"yield"
|
|
90
|
+
]);
|
|
91
|
+
const DEFAULT_RESERVED_WORD_PREFIX = "param_";
|
|
92
|
+
function toSnakeCaseName(text) {
|
|
93
|
+
return text.replace(/[^a-zA-Z0-9]+/g, "_").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").toLowerCase().replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
94
|
+
}
|
|
95
|
+
__name(toSnakeCaseName, "toSnakeCaseName");
|
|
96
|
+
function renameReservedKeywords(s, prefix = DEFAULT_RESERVED_WORD_PREFIX) {
|
|
97
|
+
return PYTHON_KEYWORDS.has(s) ? prefix + s : s;
|
|
98
|
+
}
|
|
99
|
+
__name(renameReservedKeywords, "renameReservedKeywords");
|
|
52
100
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
101
|
0 && (module.exports = {
|
|
54
|
-
camelCaseKeys
|
|
102
|
+
camelCaseKeys,
|
|
103
|
+
renameReservedKeywords,
|
|
104
|
+
toSnakeCaseName
|
|
55
105
|
});
|
|
@@ -26,6 +26,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
26
|
var client_labels_exports = {};
|
|
27
27
|
__export(client_labels_exports, {
|
|
28
28
|
getClientLabels: () => getClientLabels,
|
|
29
|
+
getTrackingHeaders: () => getTrackingHeaders,
|
|
30
|
+
mergeTrackingHeaders: () => mergeTrackingHeaders,
|
|
29
31
|
parseUserAgent: () => parseUserAgent,
|
|
30
32
|
runWithClientLabel: () => runWithClientLabel
|
|
31
33
|
});
|
|
@@ -42,6 +44,7 @@ const ADK_LABEL = "google-adk";
|
|
|
42
44
|
const LANGUAGE_LABEL = "gl-typescript";
|
|
43
45
|
const AGENT_ENGINE_TELEMETRY_TAG = "remote_reasoning_engine";
|
|
44
46
|
const AGENT_ENGINE_TELEMETRY_ENV_VARIABLE_NAME = "GOOGLE_CLOUD_AGENT_ENGINE_ID";
|
|
47
|
+
const TRACKING_HEADER_NAMES = ["x-goog-api-client", "user-agent"];
|
|
45
48
|
const clientLabelLocalStorage = new import_node_async_hooks.AsyncLocalStorage();
|
|
46
49
|
const USER_AGENT_PATTERNS = [
|
|
47
50
|
["Edge", /(?:Edg|Edge|EdgA)\/([0-9.]+)/i],
|
|
@@ -91,9 +94,73 @@ function getClientLabels() {
|
|
|
91
94
|
return labels;
|
|
92
95
|
}
|
|
93
96
|
__name(getClientLabels, "getClientLabels");
|
|
97
|
+
function getTrackingHeaders() {
|
|
98
|
+
const headerValue = getClientLabels().join(" ");
|
|
99
|
+
return {
|
|
100
|
+
"x-goog-api-client": headerValue,
|
|
101
|
+
"user-agent": headerValue
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
__name(getTrackingHeaders, "getTrackingHeaders");
|
|
105
|
+
function isTrackingHeaderName(name) {
|
|
106
|
+
return TRACKING_HEADER_NAMES.some((trackingName) => trackingName === name);
|
|
107
|
+
}
|
|
108
|
+
__name(isTrackingHeaderName, "isTrackingHeaderName");
|
|
109
|
+
function isHeaders(headers) {
|
|
110
|
+
return typeof headers.forEach === "function";
|
|
111
|
+
}
|
|
112
|
+
__name(isHeaders, "isHeaders");
|
|
113
|
+
function headerEntries(headers) {
|
|
114
|
+
if (!headers) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(headers)) {
|
|
118
|
+
return headers.map(([name, value]) => [name, value]);
|
|
119
|
+
}
|
|
120
|
+
if (isHeaders(headers)) {
|
|
121
|
+
const entries = [];
|
|
122
|
+
headers.forEach((value, name) => {
|
|
123
|
+
entries.push([name, value]);
|
|
124
|
+
});
|
|
125
|
+
return entries;
|
|
126
|
+
}
|
|
127
|
+
return Object.entries(headers);
|
|
128
|
+
}
|
|
129
|
+
__name(headerEntries, "headerEntries");
|
|
130
|
+
function mergeTrackingHeaders(headers) {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
const merged = {};
|
|
133
|
+
const callerValues = /* @__PURE__ */ new Map();
|
|
134
|
+
for (const [name, value] of headerEntries(headers)) {
|
|
135
|
+
const lowerName = name.toLowerCase();
|
|
136
|
+
if (isTrackingHeaderName(lowerName)) {
|
|
137
|
+
callerValues.set(lowerName, [
|
|
138
|
+
...(_a = callerValues.get(lowerName)) != null ? _a : [],
|
|
139
|
+
value
|
|
140
|
+
]);
|
|
141
|
+
} else {
|
|
142
|
+
merged[name] = value;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
for (const [name, trackingValue] of Object.entries(getTrackingHeaders())) {
|
|
146
|
+
const tokens = trackingValue.split(" ");
|
|
147
|
+
for (const value of (_b = callerValues.get(name)) != null ? _b : []) {
|
|
148
|
+
for (const token of value.split(/\s+/)) {
|
|
149
|
+
if (token && !tokens.includes(token)) {
|
|
150
|
+
tokens.push(token);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
merged[name] = tokens.join(" ");
|
|
155
|
+
}
|
|
156
|
+
return merged;
|
|
157
|
+
}
|
|
158
|
+
__name(mergeTrackingHeaders, "mergeTrackingHeaders");
|
|
94
159
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
160
|
0 && (module.exports = {
|
|
96
161
|
getClientLabels,
|
|
162
|
+
getTrackingHeaders,
|
|
163
|
+
mergeTrackingHeaders,
|
|
97
164
|
parseUserAgent,
|
|
98
165
|
runWithClientLabel
|
|
99
166
|
});
|
|
@@ -25,10 +25,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var gemini_schema_util_exports = {};
|
|
27
27
|
__export(gemini_schema_util_exports, {
|
|
28
|
+
openApiSchemaToGeminiSchema: () => openApiSchemaToGeminiSchema,
|
|
28
29
|
toGeminiSchema: () => toGeminiSchema
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(gemini_schema_util_exports);
|
|
31
32
|
var import_genai = require("@google/genai");
|
|
33
|
+
var import_case_utils = require("./case_utils.js");
|
|
32
34
|
/**
|
|
33
35
|
* @license
|
|
34
36
|
* Copyright 2025 Google LLC
|
|
@@ -74,10 +76,18 @@ function toGeminiSchema(mcpSchema) {
|
|
|
74
76
|
let isNullable = false;
|
|
75
77
|
let nonNullTypes;
|
|
76
78
|
if (Array.isArray(sourceType)) {
|
|
77
|
-
|
|
79
|
+
const fromAnyOf = Boolean(mcp.anyOf);
|
|
80
|
+
const branches = sourceType.map(
|
|
81
|
+
(branch) => {
|
|
82
|
+
if (typeof branch !== "boolean") return branch;
|
|
83
|
+
return fromAnyOf ? { type: "object" } : "object";
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
mcp = fromAnyOf ? { ...mcp, anyOf: branches } : { ...mcp, type: branches };
|
|
87
|
+
nonNullTypes = branches.filter(
|
|
78
88
|
(t) => getTypeFromArrayItem(t) !== "null"
|
|
79
89
|
);
|
|
80
|
-
isNullable =
|
|
90
|
+
isNullable = branches.some(
|
|
81
91
|
(t) => getTypeFromArrayItem(t) === "null"
|
|
82
92
|
);
|
|
83
93
|
if (nonNullTypes.length === 1) {
|
|
@@ -134,7 +144,7 @@ function toGeminiSchema(mcpSchema) {
|
|
|
134
144
|
geminiSchema.description = mcp.description;
|
|
135
145
|
}
|
|
136
146
|
if (mcp.enum) {
|
|
137
|
-
geminiSchema.enum = mcp.enum.map(String);
|
|
147
|
+
geminiSchema.enum = mcp.enum.filter((v) => v != null).map(String);
|
|
138
148
|
}
|
|
139
149
|
if (isNullable && mcp.type !== "null") {
|
|
140
150
|
geminiSchema.nullable = true;
|
|
@@ -162,7 +172,97 @@ function toGeminiSchema(mcpSchema) {
|
|
|
162
172
|
return recursiveConvert(mcpSchema);
|
|
163
173
|
}
|
|
164
174
|
__name(toGeminiSchema, "toGeminiSchema");
|
|
175
|
+
const GEMINI_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
|
|
176
|
+
"anyOf",
|
|
177
|
+
"default",
|
|
178
|
+
"description",
|
|
179
|
+
"enum",
|
|
180
|
+
"example",
|
|
181
|
+
"format",
|
|
182
|
+
"items",
|
|
183
|
+
"maxItems",
|
|
184
|
+
"maxLength",
|
|
185
|
+
"maxProperties",
|
|
186
|
+
"maximum",
|
|
187
|
+
"minItems",
|
|
188
|
+
"minLength",
|
|
189
|
+
"minProperties",
|
|
190
|
+
"minimum",
|
|
191
|
+
"nullable",
|
|
192
|
+
"pattern",
|
|
193
|
+
"properties",
|
|
194
|
+
"propertyOrdering",
|
|
195
|
+
"required",
|
|
196
|
+
"title",
|
|
197
|
+
"type"
|
|
198
|
+
]);
|
|
199
|
+
const GEMINI_REJECTED_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
|
|
200
|
+
"title",
|
|
201
|
+
"default",
|
|
202
|
+
"format"
|
|
203
|
+
]);
|
|
204
|
+
const EMPTY_OBJECT_PLACEHOLDER = "dummy_DO_NOT_GENERATE";
|
|
205
|
+
function toGeminiSchemaField(key) {
|
|
206
|
+
return (0, import_case_utils.toSnakeCaseName)(key).replace(
|
|
207
|
+
/_([a-z0-9])/g,
|
|
208
|
+
(_match, letter) => letter.toUpperCase()
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
__name(toGeminiSchemaField, "toGeminiSchemaField");
|
|
212
|
+
function isPlainObject(value) {
|
|
213
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
214
|
+
}
|
|
215
|
+
__name(isPlainObject, "isPlainObject");
|
|
216
|
+
function convertSchemaField(field, value) {
|
|
217
|
+
if (field === "type") {
|
|
218
|
+
return toGeminiType(typeof value === "string" ? value : void 0);
|
|
219
|
+
}
|
|
220
|
+
if (field === "properties" && isPlainObject(value)) {
|
|
221
|
+
return Object.fromEntries(
|
|
222
|
+
Object.entries(value).map(([name, property]) => [
|
|
223
|
+
name,
|
|
224
|
+
openApiSchemaToGeminiSchema(property)
|
|
225
|
+
])
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (field === "items" && isPlainObject(value)) {
|
|
229
|
+
return openApiSchemaToGeminiSchema(value);
|
|
230
|
+
}
|
|
231
|
+
if (field === "anyOf" && Array.isArray(value)) {
|
|
232
|
+
return value.map((item) => openApiSchemaToGeminiSchema(item));
|
|
233
|
+
}
|
|
234
|
+
return value;
|
|
235
|
+
}
|
|
236
|
+
__name(convertSchemaField, "convertSchemaField");
|
|
237
|
+
function openApiSchemaToGeminiSchema(openApiSchema) {
|
|
238
|
+
if (openApiSchema === void 0 || openApiSchema === null) {
|
|
239
|
+
return void 0;
|
|
240
|
+
}
|
|
241
|
+
if (!isPlainObject(openApiSchema)) {
|
|
242
|
+
throw new TypeError("openapi_schema must be a dictionary");
|
|
243
|
+
}
|
|
244
|
+
const source = { ...openApiSchema };
|
|
245
|
+
if (!source["type"]) {
|
|
246
|
+
source["type"] = "object";
|
|
247
|
+
}
|
|
248
|
+
const properties = source["properties"];
|
|
249
|
+
const hasProperties = isPlainObject(properties) && Object.keys(properties).length > 0;
|
|
250
|
+
if (source["type"] === "object" && !hasProperties) {
|
|
251
|
+
source["properties"] = { [EMPTY_OBJECT_PLACEHOLDER]: { type: "string" } };
|
|
252
|
+
}
|
|
253
|
+
const converted = {};
|
|
254
|
+
for (const [key, value] of Object.entries(source)) {
|
|
255
|
+
const field = toGeminiSchemaField(key);
|
|
256
|
+
if (!GEMINI_SCHEMA_FIELDS.has(field) || GEMINI_REJECTED_SCHEMA_FIELDS.has(field)) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
converted[field] = convertSchemaField(field, value);
|
|
260
|
+
}
|
|
261
|
+
return converted;
|
|
262
|
+
}
|
|
263
|
+
__name(openApiSchemaToGeminiSchema, "openApiSchemaToGeminiSchema");
|
|
165
264
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
265
|
0 && (module.exports = {
|
|
266
|
+
openApiSchemaToGeminiSchema,
|
|
167
267
|
toGeminiSchema
|
|
168
268
|
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var hash_utils_exports = {};
|
|
27
|
+
__export(hash_utils_exports, {
|
|
28
|
+
stableHash: () => stableHash,
|
|
29
|
+
stableStringify: () => stableStringify
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(hash_utils_exports);
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2026 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
36
|
+
*/
|
|
37
|
+
const FNV_OFFSET_BASIS = 2166136261;
|
|
38
|
+
const FNV_PRIME = 16777619;
|
|
39
|
+
function stableStringify(value) {
|
|
40
|
+
var _a;
|
|
41
|
+
return (_a = JSON.stringify(sortKeysDeep(value))) != null ? _a : "undefined";
|
|
42
|
+
}
|
|
43
|
+
__name(stableStringify, "stableStringify");
|
|
44
|
+
function stableHash(value) {
|
|
45
|
+
const text = stableStringify(value);
|
|
46
|
+
let hash = FNV_OFFSET_BASIS;
|
|
47
|
+
for (let i = 0; i < text.length; i++) {
|
|
48
|
+
hash ^= text.charCodeAt(i);
|
|
49
|
+
hash = Math.imul(hash, FNV_PRIME);
|
|
50
|
+
}
|
|
51
|
+
return (hash >>> 0).toString(16);
|
|
52
|
+
}
|
|
53
|
+
__name(stableHash, "stableHash");
|
|
54
|
+
function sortKeysDeep(value) {
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
return value.map(sortKeysDeep);
|
|
57
|
+
}
|
|
58
|
+
if (value === null || typeof value !== "object") {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
const source = value;
|
|
62
|
+
const sorted = {};
|
|
63
|
+
for (const key of Object.keys(source).sort()) {
|
|
64
|
+
sorted[key] = sortKeysDeep(source[key]);
|
|
65
|
+
}
|
|
66
|
+
return sorted;
|
|
67
|
+
}
|
|
68
|
+
__name(sortKeysDeep, "sortKeysDeep");
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
stableHash,
|
|
72
|
+
stableStringify
|
|
73
|
+
});
|
|
@@ -95,18 +95,19 @@ const _LiveResponseAggregator = class _LiveResponseAggregator {
|
|
|
95
95
|
yield llmResponse;
|
|
96
96
|
}
|
|
97
97
|
if (serverContent.inputTranscription) {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
const isGemini3x = (0, import_model_name.isGemini3xLive)(this.modelVersion);
|
|
99
|
+
const { text, finished } = serverContent.inputTranscription;
|
|
100
|
+
if (text) {
|
|
101
|
+
if (!isGemini3x) {
|
|
102
|
+
this.inputTranscriptionText += text;
|
|
103
|
+
}
|
|
100
104
|
yield {
|
|
101
|
-
inputTranscription: {
|
|
102
|
-
|
|
103
|
-
finished: false
|
|
104
|
-
},
|
|
105
|
-
partial: true,
|
|
105
|
+
inputTranscription: { text, finished: isGemini3x },
|
|
106
|
+
partial: !isGemini3x,
|
|
106
107
|
...this.modelVersion ? { modelVersion: this.modelVersion } : {}
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
|
-
if (
|
|
110
|
+
if (finished && !isGemini3x) {
|
|
110
111
|
yield {
|
|
111
112
|
inputTranscription: {
|
|
112
113
|
text: this.inputTranscriptionText,
|
|
@@ -224,7 +225,7 @@ const _LiveResponseAggregator = class _LiveResponseAggregator {
|
|
|
224
225
|
}))
|
|
225
226
|
);
|
|
226
227
|
}
|
|
227
|
-
const isGemini3x = (0, import_model_name.
|
|
228
|
+
const isGemini3x = (0, import_model_name.isGemini3xLive)(this.modelVersion);
|
|
228
229
|
if (isGemini3x && this.toolCallParts.length > 0) {
|
|
229
230
|
yield {
|
|
230
231
|
content: { role: "model", parts: this.toolCallParts },
|
|
@@ -28,7 +28,9 @@ __export(model_name_exports, {
|
|
|
28
28
|
extractModelName: () => extractModelName,
|
|
29
29
|
isGemini1Model: () => isGemini1Model,
|
|
30
30
|
isGemini2OrAbove: () => isGemini2OrAbove,
|
|
31
|
+
isGemini35LiveTranslate: () => isGemini35LiveTranslate,
|
|
31
32
|
isGemini3xFlashLive: () => isGemini3xFlashLive,
|
|
33
|
+
isGemini3xLive: () => isGemini3xLive,
|
|
32
34
|
isGeminiModel: () => isGeminiModel,
|
|
33
35
|
isGeminiModelIdCheckDisabled: () => isGeminiModelIdCheckDisabled
|
|
34
36
|
});
|
|
@@ -84,12 +86,23 @@ function isGemini2OrAbove(modelString) {
|
|
|
84
86
|
return parsedVersion.valid && parsedVersion.major >= 2;
|
|
85
87
|
}
|
|
86
88
|
__name(isGemini2OrAbove, "isGemini2OrAbove");
|
|
87
|
-
function
|
|
89
|
+
function isGemini3xLive(modelString) {
|
|
88
90
|
if (!modelString) {
|
|
89
91
|
return false;
|
|
90
92
|
}
|
|
91
93
|
const modelName = extractModelName(modelString);
|
|
92
|
-
return modelName.startsWith("gemini-3.") && modelName.includes("-
|
|
94
|
+
return modelName.startsWith("gemini-3.") && modelName.includes("-live") && !isGemini35LiveTranslate(modelString);
|
|
95
|
+
}
|
|
96
|
+
__name(isGemini3xLive, "isGemini3xLive");
|
|
97
|
+
function isGemini35LiveTranslate(modelString) {
|
|
98
|
+
if (!modelString) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return extractModelName(modelString).startsWith("gemini-3.5-live-translate");
|
|
102
|
+
}
|
|
103
|
+
__name(isGemini35LiveTranslate, "isGemini35LiveTranslate");
|
|
104
|
+
function isGemini3xFlashLive(modelString) {
|
|
105
|
+
return isGemini3xLive(modelString);
|
|
93
106
|
}
|
|
94
107
|
__name(isGemini3xFlashLive, "isGemini3xFlashLive");
|
|
95
108
|
function isGeminiModelIdCheckDisabled() {
|
|
@@ -101,7 +114,9 @@ __name(isGeminiModelIdCheckDisabled, "isGeminiModelIdCheckDisabled");
|
|
|
101
114
|
extractModelName,
|
|
102
115
|
isGemini1Model,
|
|
103
116
|
isGemini2OrAbove,
|
|
117
|
+
isGemini35LiveTranslate,
|
|
104
118
|
isGemini3xFlashLive,
|
|
119
|
+
isGemini3xLive,
|
|
105
120
|
isGeminiModel,
|
|
106
121
|
isGeminiModelIdCheckDisabled
|
|
107
122
|
});
|
|
@@ -114,6 +114,11 @@ function zodObjectToSchema(schema) {
|
|
|
114
114
|
if (isZodV3Schema(schema)) {
|
|
115
115
|
return (0, import_zod_to_json_schema.zodToJsonSchema)(schema, {
|
|
116
116
|
target: "openApi3",
|
|
117
|
+
// The genai `Schema` type has no `$ref`, so a pointer back at an earlier
|
|
118
|
+
// occurrence of a reused sub-schema reaches the model as an untyped
|
|
119
|
+
// parameter. Inline every occurrence instead. A cycle has no finite
|
|
120
|
+
// inlining and degrades to an unconstrained schema.
|
|
121
|
+
$refStrategy: "none",
|
|
117
122
|
emailStrategy: "format:email",
|
|
118
123
|
postProcess: /* @__PURE__ */ __name((jsonSchema) => {
|
|
119
124
|
var _a, _b, _c, _d, _e, _f, _g;
|
package/dist/cjs/version.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(version_exports);
|
|
|
32
32
|
* Copyright 2025 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: Apache-2.0
|
|
34
34
|
*/
|
|
35
|
-
const version = "2.1
|
|
35
|
+
const version = "2.2.1";
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
38
38
|
version
|
|
@@ -182,6 +182,14 @@ async function buildLLMAgentSkills(agent) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
+
if (agent.codeExecutor) {
|
|
186
|
+
skills.push({
|
|
187
|
+
id: `${agent.name}-code-executor`,
|
|
188
|
+
name: "code-execution",
|
|
189
|
+
description: "Can execute code",
|
|
190
|
+
tags: ["llm", "code_execution"]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
185
193
|
return skills;
|
|
186
194
|
}
|
|
187
195
|
__name(buildLLMAgentSkills, "buildLLMAgentSkills");
|
|
@@ -70,7 +70,10 @@ const _A2AAgentExecutor = class _A2AAgentExecutor {
|
|
|
70
70
|
await this.publishFinalTaskStatus({
|
|
71
71
|
executorContext,
|
|
72
72
|
eventBus,
|
|
73
|
-
event:
|
|
73
|
+
event: {
|
|
74
|
+
...unansweredRequestEvent,
|
|
75
|
+
metadata: getA2ASessionMetadata(executorContext)
|
|
76
|
+
}
|
|
74
77
|
});
|
|
75
78
|
return;
|
|
76
79
|
}
|
|
@@ -79,14 +82,16 @@ const _A2AAgentExecutor = class _A2AAgentExecutor {
|
|
|
79
82
|
createTask({
|
|
80
83
|
taskId: ctx.taskId,
|
|
81
84
|
contextId: ctx.contextId,
|
|
82
|
-
message: a2aUserMessage
|
|
85
|
+
message: a2aUserMessage,
|
|
86
|
+
metadata: getA2ASessionMetadata(executorContext)
|
|
83
87
|
})
|
|
84
88
|
);
|
|
85
89
|
}
|
|
86
90
|
eventBus.publish(
|
|
87
91
|
createTaskWorkingEvent({
|
|
88
92
|
taskId: ctx.taskId,
|
|
89
|
-
contextId: ctx.contextId
|
|
93
|
+
contextId: ctx.contextId,
|
|
94
|
+
metadata: getA2ASessionMetadata(executorContext)
|
|
90
95
|
})
|
|
91
96
|
);
|
|
92
97
|
const adkEvents = [];
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "@google/genai";
|
|
14
14
|
import { createEvent } from "../events/event.js";
|
|
15
15
|
import { createEventActions } from "../events/event_actions.js";
|
|
16
|
+
import { withoutInternalMetadata } from "../events/internal_metadata.js";
|
|
16
17
|
import { randomUUID } from "../utils/env_aware_utils.js";
|
|
17
18
|
import {
|
|
18
19
|
getEventMetadata,
|
|
@@ -191,7 +192,10 @@ function createAdkEventFromMetadata(a2aEvent) {
|
|
|
191
192
|
citationMetadata: metadata[A2AMetadataKeys.CITATION_METADATA],
|
|
192
193
|
groundingMetadata: metadata[A2AMetadataKeys.GROUNDING_METADATA],
|
|
193
194
|
usageMetadata: metadata[A2AMetadataKeys.USAGE_METADATA],
|
|
194
|
-
|
|
195
|
+
// A remote peer cannot set ADK-internal keys on the events we emit for it.
|
|
196
|
+
customMetadata: withoutInternalMetadata(
|
|
197
|
+
metadata[A2AMetadataKeys.CUSTOM_METADATA]
|
|
198
|
+
),
|
|
195
199
|
// Only fields in PEER_SETTABLE_ACTION_FIELDS may be restored from
|
|
196
200
|
// metadata a remote A2A peer controls. Every other action field either
|
|
197
201
|
// mutates the caller's own session or drives the caller's own control
|
|
@@ -7,6 +7,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7
7
|
* Copyright 2026 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
|
+
import { publicMetadata } from "../events/internal_metadata.js";
|
|
10
11
|
import { isTask } from "./a2a_event.js";
|
|
11
12
|
const ADK_METADATA_KEY_PREFIX = "adk_";
|
|
12
13
|
const A2A_METADATA_KEY_PREFIX = "a2a:";
|
|
@@ -64,7 +65,7 @@ function getA2AEventMetadata(adkEvent, {
|
|
|
64
65
|
[A2AMetadataKeys.CITATION_METADATA]: adkEvent.citationMetadata,
|
|
65
66
|
[A2AMetadataKeys.GROUNDING_METADATA]: adkEvent.groundingMetadata,
|
|
66
67
|
[A2AMetadataKeys.USAGE_METADATA]: adkEvent.usageMetadata,
|
|
67
|
-
[A2AMetadataKeys.CUSTOM_METADATA]: adkEvent.customMetadata,
|
|
68
|
+
[A2AMetadataKeys.CUSTOM_METADATA]: publicMetadata(adkEvent.customMetadata),
|
|
68
69
|
[A2AMetadataKeys.PARTIAL]: adkEvent.partial,
|
|
69
70
|
[A2AMetadataKeys.IS_LONG_RUNNING]: (adkEvent.longRunningToolIds || []).length > 0
|
|
70
71
|
};
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import { isDefaultEventActions } from "../events/event_actions.js";
|
|
27
27
|
import { isBaseLlm } from "../models/base_llm.js";
|
|
28
28
|
import { LLMRegistry } from "../models/registry.js";
|
|
29
|
+
import { isBuiltInPlanner } from "../planners/built_in_planner.js";
|
|
29
30
|
import { isBaseTool } from "../tools/base_tool.js";
|
|
30
31
|
import { logger } from "../utils/logger.js";
|
|
31
32
|
import { canUseOutputSchemaWithTools } from "../utils/output_schema_utils.js";
|
|
@@ -54,6 +55,10 @@ import { ContextCompactorRequestProcessor } from "./processors/context_compactor
|
|
|
54
55
|
import { IDENTITY_LLM_REQUEST_PROCESSOR } from "./processors/identity_llm_request_processor.js";
|
|
55
56
|
import { INSTRUCTIONS_LLM_REQUEST_PROCESSOR } from "./processors/instructions_llm_request_processor.js";
|
|
56
57
|
import { INTERACTIONS_REQUEST_PROCESSOR } from "./processors/interactions_request_processor.js";
|
|
58
|
+
import {
|
|
59
|
+
NL_PLANNING_REQUEST_PROCESSOR,
|
|
60
|
+
NL_PLANNING_RESPONSE_PROCESSOR
|
|
61
|
+
} from "./processors/nl_planning_processor.js";
|
|
57
62
|
import { REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR } from "./processors/request_confirmation_llm_request_processor.js";
|
|
58
63
|
import { REQUEST_INPUT_LLM_REQUEST_PROCESSOR } from "./processors/request_input_llm_request_processor.js";
|
|
59
64
|
import { TOOL_FILTER_REQUEST_PROCESSOR } from "./processors/tool_filter_request_processor.js";
|
|
@@ -155,6 +160,7 @@ const _LlmAgent = class _LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNAT
|
|
|
155
160
|
this.beforeToolCallback = config.beforeToolCallback;
|
|
156
161
|
this.afterToolCallback = config.afterToolCallback;
|
|
157
162
|
this.codeExecutor = config.codeExecutor;
|
|
163
|
+
this.planner = config.planner;
|
|
158
164
|
this.requestProcessors = (_i = config.requestProcessors) != null ? _i : [
|
|
159
165
|
BASIC_LLM_REQUEST_PROCESSOR,
|
|
160
166
|
AUTH_PREPROCESSOR,
|
|
@@ -163,6 +169,10 @@ const _LlmAgent = class _LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNAT
|
|
|
163
169
|
REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR,
|
|
164
170
|
REQUEST_INPUT_LLM_REQUEST_PROCESSOR,
|
|
165
171
|
CONTENT_REQUEST_PROCESSOR,
|
|
172
|
+
// Planning clears the thought flags that the planning response
|
|
173
|
+
// processor sets, so it must run after the contents are built and
|
|
174
|
+
// before code execution rewrites them.
|
|
175
|
+
NL_PLANNING_REQUEST_PROCESSOR,
|
|
166
176
|
INTERACTIONS_REQUEST_PROCESSOR,
|
|
167
177
|
CODE_EXECUTION_REQUEST_PROCESSOR,
|
|
168
178
|
TOOL_FILTER_REQUEST_PROCESSOR
|
|
@@ -183,7 +193,9 @@ const _LlmAgent = class _LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNAT
|
|
|
183
193
|
);
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
|
-
this.responseProcessors = (_j = config.responseProcessors) != null ? _j : [
|
|
196
|
+
this.responseProcessors = (_j = config.responseProcessors) != null ? _j : [
|
|
197
|
+
NL_PLANNING_RESPONSE_PROCESSOR
|
|
198
|
+
];
|
|
187
199
|
const agentTransferDisabled = this.disallowTransferToParent && this.disallowTransferToPeers && !((_k = this.subAgents) == null ? void 0 : _k.length);
|
|
188
200
|
if (!agentTransferDisabled) {
|
|
189
201
|
this.requestProcessors.push(AGENT_TRANSFER_LLM_REQUEST_PROCESSOR);
|
|
@@ -202,6 +214,11 @@ const _LlmAgent = class _LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNAT
|
|
|
202
214
|
"Response schema must be set via LlmAgent.output_schema."
|
|
203
215
|
);
|
|
204
216
|
}
|
|
217
|
+
if (config.generateContentConfig.thinkingConfig && isBuiltInPlanner(this.planner) && this.planner.thinkingConfig) {
|
|
218
|
+
logger.warn(
|
|
219
|
+
`Agent ${this.name}: both generateContentConfig.thinkingConfig and planner.thinkingConfig are set. The planner's thinkingConfig takes precedence.`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
205
222
|
} else {
|
|
206
223
|
this.generateContentConfig = {};
|
|
207
224
|
}
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
REQUEST_CREDENTIAL_FUNCTION_CALL_NAME,
|
|
26
26
|
REQUEST_INPUT_FUNCTION_CALL_NAME
|
|
27
27
|
} from "../functions.js";
|
|
28
|
+
const UNSTRINGIFIABLE_VALUE = "<unstringifiable value>";
|
|
28
29
|
function removeClientFunctionCallId(content) {
|
|
29
30
|
var _a, _b, _c, _d, _e;
|
|
30
31
|
for (const part of (_a = content == null ? void 0 : content.parts) != null ? _a : []) {
|
|
@@ -388,9 +389,16 @@ function safeStringify(obj) {
|
|
|
388
389
|
return obj;
|
|
389
390
|
}
|
|
390
391
|
try {
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
const json = JSON.stringify(obj);
|
|
393
|
+
if (typeof json === "string") {
|
|
394
|
+
return json;
|
|
395
|
+
}
|
|
396
|
+
} catch {
|
|
397
|
+
}
|
|
398
|
+
try {
|
|
393
399
|
return String(obj);
|
|
400
|
+
} catch {
|
|
401
|
+
return UNSTRINGIFIABLE_VALUE;
|
|
394
402
|
}
|
|
395
403
|
}
|
|
396
404
|
__name(safeStringify, "safeStringify");
|