@google/adk 0.2.2 → 0.2.3
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/agents/content_processor_utils.js +12 -2
- package/dist/cjs/agents/functions.js +13 -3
- package/dist/cjs/agents/llm_agent.js +13 -3
- package/dist/cjs/code_executors/built_in_code_executor.js +1 -1
- package/dist/cjs/code_executors/code_execution_utils.js +12 -2
- package/dist/cjs/code_executors/code_executor_context.js +12 -2
- package/dist/cjs/common.js +3 -0
- package/dist/cjs/index.js +11 -16
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/sessions/in_memory_session_service.js +13 -3
- package/dist/cjs/utils/model_name.js +24 -4
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/content_processor_utils.js +1 -1
- package/dist/esm/agents/functions.js +1 -1
- package/dist/esm/agents/llm_agent.js +1 -1
- package/dist/esm/code_executors/built_in_code_executor.js +2 -2
- package/dist/esm/code_executors/code_execution_utils.js +1 -1
- package/dist/esm/code_executors/code_executor_context.js +1 -1
- package/dist/esm/common.js +2 -0
- package/dist/esm/index.js +11 -16
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/sessions/in_memory_session_service.js +1 -1
- package/dist/esm/utils/model_name.js +23 -3
- package/dist/esm/version.js +1 -1
- package/dist/types/common.d.ts +1 -0
- package/dist/types/utils/model_name.d.ts +1 -1
- package/dist/types/version.d.ts +2 -2
- package/dist/web/agents/content_processor_utils.js +1 -1
- package/dist/web/agents/functions.js +1 -1
- package/dist/web/agents/llm_agent.js +1 -1
- package/dist/web/code_executors/built_in_code_executor.js +2 -2
- package/dist/web/code_executors/code_execution_utils.js +1 -1
- package/dist/web/code_executors/code_executor_context.js +1 -1
- package/dist/web/common.js +2 -0
- package/dist/web/index.js +1 -6
- package/dist/web/index.js.map +3 -3
- package/dist/web/sessions/in_memory_session_service.js +1 -1
- package/dist/web/utils/model_name.js +23 -3
- package/dist/web/version.js +1 -1
- package/package.json +3 -3
- package/dist/cjs/utils/deep_clone.js +0 -44
- package/dist/esm/utils/deep_clone.js +0 -14
- package/dist/types/utils/deep_clone.d.ts +0 -1
- package/dist/web/utils/deep_clone.js +0 -14
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
|
+
var __create = Object.create;
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
14
|
var __export = (target, all) => {
|
|
13
15
|
for (var name in all)
|
|
@@ -21,6 +23,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
23
|
}
|
|
22
24
|
return to;
|
|
23
25
|
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
24
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
35
|
var content_processor_utils_exports = {};
|
|
26
36
|
__export(content_processor_utils_exports, {
|
|
@@ -28,7 +38,7 @@ __export(content_processor_utils_exports, {
|
|
|
28
38
|
getCurrentTurnContents: () => getCurrentTurnContents
|
|
29
39
|
});
|
|
30
40
|
module.exports = __toCommonJS(content_processor_utils_exports);
|
|
31
|
-
var
|
|
41
|
+
var import_cloneDeep = __toESM(require("lodash-es/cloneDeep.js"), 1);
|
|
32
42
|
var import_event = require("../events/event.js");
|
|
33
43
|
var import_functions = require("./functions.js");
|
|
34
44
|
/**
|
|
@@ -60,7 +70,7 @@ function getContents(events, agentName, currentBranch) {
|
|
|
60
70
|
resultEvents = rearrangeEventsForAsyncFunctionResponsesInHistory(resultEvents);
|
|
61
71
|
const contents = [];
|
|
62
72
|
for (const event of resultEvents) {
|
|
63
|
-
const content = (0,
|
|
73
|
+
const content = (0, import_cloneDeep.default)(event.content);
|
|
64
74
|
(0, import_functions.removeClientFunctionCallId)(content);
|
|
65
75
|
contents.push(content);
|
|
66
76
|
}
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
|
+
var __create = Object.create;
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
14
|
var __export = (target, all) => {
|
|
13
15
|
for (var name in all)
|
|
@@ -21,6 +23,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
23
|
}
|
|
22
24
|
return to;
|
|
23
25
|
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
24
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
35
|
var functions_exports = {};
|
|
26
36
|
__export(functions_exports, {
|
|
@@ -39,7 +49,7 @@ __export(functions_exports, {
|
|
|
39
49
|
});
|
|
40
50
|
module.exports = __toCommonJS(functions_exports);
|
|
41
51
|
var import_genai = require("@google/genai");
|
|
42
|
-
var
|
|
52
|
+
var import_isEmpty = __toESM(require("lodash-es/isEmpty.js"), 1);
|
|
43
53
|
var import_event = require("../events/event.js");
|
|
44
54
|
var import_event_actions = require("../events/event_actions.js");
|
|
45
55
|
var import_tool_context = require("../tools/tool_context.js");
|
|
@@ -95,7 +105,7 @@ function getLongRunningFunctionCalls(functionCalls, toolsDict) {
|
|
|
95
105
|
}
|
|
96
106
|
function generateAuthEvent(invocationContext, functionResponseEvent) {
|
|
97
107
|
var _a;
|
|
98
|
-
if (!((_a = functionResponseEvent.actions) == null ? void 0 : _a.requestedAuthConfigs) || (0,
|
|
108
|
+
if (!((_a = functionResponseEvent.actions) == null ? void 0 : _a.requestedAuthConfigs) || (0, import_isEmpty.default)(functionResponseEvent.actions.requestedAuthConfigs)) {
|
|
99
109
|
return void 0;
|
|
100
110
|
}
|
|
101
111
|
const parts = [];
|
|
@@ -131,7 +141,7 @@ function generateRequestConfirmationEvent({
|
|
|
131
141
|
functionResponseEvent
|
|
132
142
|
}) {
|
|
133
143
|
var _a, _b;
|
|
134
|
-
if (!((_a = functionResponseEvent.actions) == null ? void 0 : _a.requestedToolConfirmations) || (0,
|
|
144
|
+
if (!((_a = functionResponseEvent.actions) == null ? void 0 : _a.requestedToolConfirmations) || (0, import_isEmpty.default)(functionResponseEvent.actions.requestedToolConfirmations)) {
|
|
135
145
|
return;
|
|
136
146
|
}
|
|
137
147
|
const parts = [];
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
|
+
var __create = Object.create;
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
14
|
var __export = (target, all) => {
|
|
13
15
|
for (var name in all)
|
|
@@ -21,6 +23,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
23
|
}
|
|
22
24
|
return to;
|
|
23
25
|
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
24
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
35
|
var llm_agent_exports = {};
|
|
26
36
|
__export(llm_agent_exports, {
|
|
@@ -29,7 +39,7 @@ __export(llm_agent_exports, {
|
|
|
29
39
|
responseProcessor: () => responseProcessor
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(llm_agent_exports);
|
|
32
|
-
var
|
|
42
|
+
var import_cloneDeep = __toESM(require("lodash-es/cloneDeep.js"), 1);
|
|
33
43
|
var import_zod = require("zod");
|
|
34
44
|
var import_base_code_executor = require("../code_executors/base_code_executor.js");
|
|
35
45
|
var import_built_in_code_executor = require("../code_executors/built_in_code_executor.js");
|
|
@@ -483,7 +493,7 @@ async function* runPreProcessor(invocationContext, llmRequest) {
|
|
|
483
493
|
(0, import_code_execution_utils.buildExecutableCodePart)(codeStr)
|
|
484
494
|
]
|
|
485
495
|
};
|
|
486
|
-
llmRequest.contents.push((0,
|
|
496
|
+
llmRequest.contents.push((0, import_cloneDeep.default)(codeContent));
|
|
487
497
|
yield (0, import_event.createEvent)({
|
|
488
498
|
invocationId: invocationContext.invocationId,
|
|
489
499
|
author: agent.name,
|
|
@@ -512,7 +522,7 @@ async function* runPreProcessor(invocationContext, llmRequest) {
|
|
|
512
522
|
codeExecutionResult
|
|
513
523
|
);
|
|
514
524
|
yield executionResultEvent;
|
|
515
|
-
llmRequest.contents.push((0,
|
|
525
|
+
llmRequest.contents.push((0, import_cloneDeep.default)(executionResultEvent.content));
|
|
516
526
|
}
|
|
517
527
|
}
|
|
518
528
|
async function* runPostProcessor(invocationContext, llmResponse) {
|
|
@@ -43,7 +43,7 @@ class BuiltInCodeExecutor extends import_base_code_executor.BaseCodeExecutor {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
processLlmRequest(llmRequest) {
|
|
46
|
-
if (llmRequest.model && (0, import_model_name.
|
|
46
|
+
if (llmRequest.model && (0, import_model_name.isGemini2OrAbove)(llmRequest.model)) {
|
|
47
47
|
llmRequest.config = llmRequest.config || {};
|
|
48
48
|
llmRequest.config.tools = llmRequest.config.tools || [];
|
|
49
49
|
llmRequest.config.tools.push({ codeExecution: {} });
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
|
+
var __create = Object.create;
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
14
|
var __export = (target, all) => {
|
|
13
15
|
for (var name in all)
|
|
@@ -21,6 +23,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
23
|
}
|
|
22
24
|
return to;
|
|
23
25
|
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
24
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
35
|
var code_execution_utils_exports = {};
|
|
26
36
|
__export(code_execution_utils_exports, {
|
|
@@ -32,7 +42,7 @@ __export(code_execution_utils_exports, {
|
|
|
32
42
|
});
|
|
33
43
|
module.exports = __toCommonJS(code_execution_utils_exports);
|
|
34
44
|
var import_genai = require("@google/genai");
|
|
35
|
-
var
|
|
45
|
+
var import_cloneDeep = __toESM(require("lodash-es/cloneDeep.js"), 1);
|
|
36
46
|
var import_env_aware_utils = require("../utils/env_aware_utils.js");
|
|
37
47
|
/**
|
|
38
48
|
* @license
|
|
@@ -58,7 +68,7 @@ function extractCodeAndTruncateContent(content, codeBlockDelimiters) {
|
|
|
58
68
|
if (!textParts.length) {
|
|
59
69
|
return "";
|
|
60
70
|
}
|
|
61
|
-
const firstTextPart = (0,
|
|
71
|
+
const firstTextPart = (0, import_cloneDeep.default)(textParts[0]);
|
|
62
72
|
const responseText = textParts.map((part) => part.text).join("\n");
|
|
63
73
|
const leadingDelimiterPattern = codeBlockDelimiters.map((d) => d[0]).join("|");
|
|
64
74
|
const trailingDelimiterPattern = codeBlockDelimiters.map((d) => d[1]).join("|");
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
|
+
var __create = Object.create;
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
14
|
var __export = (target, all) => {
|
|
13
15
|
for (var name in all)
|
|
@@ -21,13 +23,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
23
|
}
|
|
22
24
|
return to;
|
|
23
25
|
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
24
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
35
|
var code_executor_context_exports = {};
|
|
26
36
|
__export(code_executor_context_exports, {
|
|
27
37
|
CodeExecutorContext: () => CodeExecutorContext
|
|
28
38
|
});
|
|
29
39
|
module.exports = __toCommonJS(code_executor_context_exports);
|
|
30
|
-
var
|
|
40
|
+
var import_cloneDeep = __toESM(require("lodash-es/cloneDeep.js"), 1);
|
|
31
41
|
/**
|
|
32
42
|
* @license
|
|
33
43
|
* Copyright 2025 Google LLC
|
|
@@ -52,7 +62,7 @@ class CodeExecutorContext {
|
|
|
52
62
|
*/
|
|
53
63
|
getStateDelta() {
|
|
54
64
|
return {
|
|
55
|
-
[CONTEXT_KEY]: (0,
|
|
65
|
+
[CONTEXT_KEY]: (0, import_cloneDeep.default)(this.context)
|
|
56
66
|
};
|
|
57
67
|
}
|
|
58
68
|
/**
|
package/dist/cjs/common.js
CHANGED
|
@@ -71,6 +71,7 @@ __export(common_exports, {
|
|
|
71
71
|
isBaseAgent: () => import_base_agent.isBaseAgent,
|
|
72
72
|
isBaseLlm: () => import_base_llm.isBaseLlm,
|
|
73
73
|
isFinalResponse: () => import_event.isFinalResponse,
|
|
74
|
+
isGemini2OrAbove: () => import_model_name.isGemini2OrAbove,
|
|
74
75
|
setLogLevel: () => import_logger.setLogLevel,
|
|
75
76
|
stringifyContent: () => import_event.stringifyContent,
|
|
76
77
|
version: () => import_version.version,
|
|
@@ -113,6 +114,7 @@ var import_long_running_tool = require("./tools/long_running_tool.js");
|
|
|
113
114
|
var import_tool_confirmation = require("./tools/tool_confirmation.js");
|
|
114
115
|
var import_tool_context = require("./tools/tool_context.js");
|
|
115
116
|
var import_logger = require("./utils/logger.js");
|
|
117
|
+
var import_model_name = require("./utils/model_name.js");
|
|
116
118
|
var import_simple_zod_to_json = require("./utils/simple_zod_to_json.js");
|
|
117
119
|
var import_version = require("./version.js");
|
|
118
120
|
__reExport(common_exports, require("./artifacts/base_artifact_service.js"), module.exports);
|
|
@@ -172,6 +174,7 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
|
|
|
172
174
|
isBaseAgent,
|
|
173
175
|
isBaseLlm,
|
|
174
176
|
isFinalResponse,
|
|
177
|
+
isGemini2OrAbove,
|
|
175
178
|
setLogLevel,
|
|
176
179
|
stringifyContent,
|
|
177
180
|
version,
|