@google/adk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/a2a/a2a_event.js +290 -0
- package/dist/cjs/a2a/event_converter_utils.js +201 -0
- package/dist/cjs/a2a/executor_context.js +53 -0
- package/dist/cjs/a2a/metadata_converter_utils.js +125 -0
- package/dist/cjs/a2a/part_converter_utils.js +23 -21
- package/dist/cjs/agents/base_agent.js +3 -3
- package/dist/cjs/{tools/tool_context.js → agents/context.js} +70 -15
- package/dist/cjs/agents/functions.js +2 -2
- package/dist/cjs/agents/llm_agent.js +21 -674
- package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +132 -0
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +68 -0
- package/dist/cjs/agents/processors/code_execution_request_processor.js +389 -0
- package/dist/cjs/agents/processors/content_request_processor.js +66 -0
- package/dist/cjs/agents/processors/identity_llm_request_processor.js +54 -0
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +85 -0
- package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +165 -0
- package/dist/cjs/common.js +11 -7
- package/dist/cjs/index.js +89 -53
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/models/llm_response.js +2 -0
- package/dist/cjs/plugins/base_plugin.js +1 -1
- package/dist/cjs/runner/runner.js +1 -1
- package/dist/cjs/sessions/database_session_service.js +4 -1
- package/dist/cjs/sessions/db/operations.js +24 -12
- package/dist/cjs/tools/base_tool.js +3 -0
- package/dist/cjs/tools/base_toolset.js +13 -3
- package/dist/cjs/tools/exit_loop_tool.js +63 -0
- package/dist/cjs/tools/mcp/mcp_toolset.js +9 -5
- package/dist/cjs/utils/logger.js +61 -54
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_event.js +243 -0
- package/dist/esm/a2a/event_converter_utils.js +187 -0
- package/dist/esm/a2a/executor_context.js +23 -0
- package/dist/esm/a2a/metadata_converter_utils.js +90 -0
- package/dist/esm/a2a/part_converter_utils.js +25 -21
- package/dist/esm/agents/base_agent.js +3 -3
- package/dist/esm/{tools/tool_context.js → agents/context.js} +66 -11
- package/dist/esm/agents/functions.js +2 -2
- package/dist/esm/agents/llm_agent.js +14 -683
- package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +101 -0
- package/dist/esm/agents/processors/basic_llm_request_processor.js +37 -0
- package/dist/esm/agents/processors/code_execution_request_processor.js +363 -0
- package/dist/esm/agents/processors/content_request_processor.js +38 -0
- package/dist/esm/agents/processors/identity_llm_request_processor.js +23 -0
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +54 -0
- package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +140 -0
- package/dist/esm/common.js +11 -9
- package/dist/esm/index.js +95 -18
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/models/llm_response.js +2 -0
- package/dist/esm/plugins/base_plugin.js +1 -1
- package/dist/esm/runner/runner.js +1 -1
- package/dist/esm/sessions/database_session_service.js +4 -1
- package/dist/esm/sessions/db/operations.js +31 -7
- package/dist/esm/tools/base_tool.js +3 -0
- package/dist/esm/tools/base_toolset.js +11 -2
- package/dist/esm/tools/exit_loop_tool.js +32 -0
- package/dist/esm/tools/mcp/mcp_toolset.js +9 -5
- package/dist/esm/utils/logger.js +51 -54
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_event.d.ts +122 -0
- package/dist/types/a2a/event_converter_utils.d.ts +20 -0
- package/dist/types/a2a/executor_context.d.ts +33 -0
- package/dist/types/a2a/metadata_converter_utils.d.ts +62 -0
- package/dist/types/a2a/part_converter_utils.d.ts +4 -3
- package/dist/types/agents/base_agent.d.ts +2 -2
- package/dist/types/{tools/tool_context.d.ts → agents/context.d.ts} +43 -8
- package/dist/types/agents/llm_agent.d.ts +8 -31
- package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +18 -0
- package/dist/types/agents/{base_llm_processor.d.ts → processors/base_llm_processor.d.ts} +4 -4
- package/dist/types/agents/processors/basic_llm_request_processor.d.ts +13 -0
- package/dist/types/agents/processors/code_execution_request_processor.d.ts +34 -0
- package/dist/types/agents/processors/content_request_processor.d.ts +13 -0
- package/dist/types/agents/processors/identity_llm_request_processor.d.ts +13 -0
- package/dist/types/agents/processors/instructions_llm_request_processor.d.ts +16 -0
- package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +13 -0
- package/dist/types/auth/credential_service/base_credential_service.d.ts +3 -3
- package/dist/types/auth/credential_service/in_memory_credential_service.d.ts +3 -3
- package/dist/types/common.d.ts +4 -4
- package/dist/types/models/llm_response.d.ts +5 -1
- package/dist/types/plugins/base_plugin.d.ts +12 -13
- package/dist/types/plugins/logging_plugin.d.ts +9 -10
- package/dist/types/plugins/plugin_manager.d.ts +9 -10
- package/dist/types/plugins/security_plugin.d.ts +2 -2
- package/dist/types/sessions/database_session_service.d.ts +2 -1
- package/dist/types/sessions/db/operations.d.ts +1 -1
- package/dist/types/tools/base_tool.d.ts +3 -3
- package/dist/types/tools/base_toolset.d.ts +12 -3
- package/dist/types/tools/exit_loop_tool.d.ts +24 -0
- package/dist/types/tools/forwarding_artifact_service.d.ts +2 -2
- package/dist/types/tools/function_tool.d.ts +2 -2
- package/dist/types/tools/mcp/mcp_toolset.d.ts +1 -1
- package/dist/types/utils/logger.d.ts +5 -9
- package/dist/types/version.d.ts +1 -1
- package/dist/web/a2a/a2a_event.js +243 -0
- package/dist/web/a2a/event_converter_utils.js +201 -0
- package/dist/web/a2a/executor_context.js +23 -0
- package/dist/web/a2a/metadata_converter_utils.js +107 -0
- package/dist/web/a2a/part_converter_utils.js +25 -21
- package/dist/web/agents/base_agent.js +3 -3
- package/dist/web/{tools/tool_context.js → agents/context.js} +66 -11
- package/dist/web/agents/functions.js +2 -2
- package/dist/web/agents/llm_agent.js +14 -661
- package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +100 -0
- package/dist/web/agents/processors/basic_llm_request_processor.js +71 -0
- package/dist/web/agents/processors/code_execution_request_processor.js +365 -0
- package/dist/web/agents/processors/content_request_processor.js +56 -0
- package/dist/web/agents/processors/identity_llm_request_processor.js +41 -0
- package/dist/web/agents/processors/instructions_llm_request_processor.js +72 -0
- package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +158 -0
- package/dist/web/common.js +11 -9
- package/dist/web/index.js +13 -18
- package/dist/web/index.js.map +7 -0
- package/dist/web/models/llm_response.js +2 -0
- package/dist/web/plugins/base_plugin.js +1 -1
- package/dist/web/runner/runner.js +1 -1
- package/dist/web/sessions/database_session_service.js +4 -1
- package/dist/web/sessions/db/operations.js +31 -7
- package/dist/web/tools/base_tool.js +3 -0
- package/dist/web/tools/base_toolset.js +11 -2
- package/dist/web/tools/exit_loop_tool.js +32 -0
- package/dist/web/tools/mcp/mcp_toolset.js +27 -5
- package/dist/web/utils/logger.js +51 -54
- package/dist/web/version.js +1 -1
- package/package.json +3 -2
- package/dist/cjs/agents/callback_context.js +0 -101
- package/dist/esm/agents/callback_context.js +0 -71
- package/dist/types/agents/callback_context.d.ts +0 -42
- package/dist/web/agents/callback_context.js +0 -71
- /package/dist/cjs/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
- /package/dist/esm/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
- /package/dist/web/agents/{base_llm_processor.js → processors/base_llm_processor.js} +0 -0
|
@@ -29,6 +29,7 @@ __export(part_converter_utils_exports, {
|
|
|
29
29
|
toA2APart: () => toA2APart,
|
|
30
30
|
toA2AParts: () => toA2AParts,
|
|
31
31
|
toA2ATextPart: () => toA2ATextPart,
|
|
32
|
+
toGenAIContent: () => toGenAIContent,
|
|
32
33
|
toGenAIPart: () => toGenAIPart,
|
|
33
34
|
toGenAIPartData: () => toGenAIPartData,
|
|
34
35
|
toGenAIPartFile: () => toGenAIPartFile,
|
|
@@ -36,17 +37,13 @@ __export(part_converter_utils_exports, {
|
|
|
36
37
|
toGenAIParts: () => toGenAIParts
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(part_converter_utils_exports);
|
|
40
|
+
var import_genai = require("@google/genai");
|
|
41
|
+
var import_metadata_converter_utils = require("./metadata_converter_utils.js");
|
|
39
42
|
/**
|
|
40
43
|
* @license
|
|
41
44
|
* Copyright 2026 Google LLC
|
|
42
45
|
* SPDX-License-Identifier: Apache-2.0
|
|
43
46
|
*/
|
|
44
|
-
var MetadataKeys = /* @__PURE__ */ ((MetadataKeys2) => {
|
|
45
|
-
MetadataKeys2["TYPE"] = "adk_type";
|
|
46
|
-
MetadataKeys2["LONG_RUNNING"] = "adk_is_long_running";
|
|
47
|
-
MetadataKeys2["THOUGHT"] = "adk_thought";
|
|
48
|
-
return MetadataKeys2;
|
|
49
|
-
})(MetadataKeys || {});
|
|
50
47
|
var DataPartType = /* @__PURE__ */ ((DataPartType2) => {
|
|
51
48
|
DataPartType2["FUNCTION_CALL"] = "function_call";
|
|
52
49
|
DataPartType2["FUNCTION_RESPONSE"] = "function_response";
|
|
@@ -54,7 +51,7 @@ var DataPartType = /* @__PURE__ */ ((DataPartType2) => {
|
|
|
54
51
|
DataPartType2["CODE_EXECUTABLE_CODE"] = "executable_code";
|
|
55
52
|
return DataPartType2;
|
|
56
53
|
})(DataPartType || {});
|
|
57
|
-
function toA2AParts(parts, longRunningToolIDs = []) {
|
|
54
|
+
function toA2AParts(parts = [], longRunningToolIDs = []) {
|
|
58
55
|
return parts.map((part) => toA2APart(part, longRunningToolIDs));
|
|
59
56
|
}
|
|
60
57
|
function toA2APart(part, longRunningToolIDs) {
|
|
@@ -68,9 +65,9 @@ function toA2APart(part, longRunningToolIDs) {
|
|
|
68
65
|
}
|
|
69
66
|
function toA2ATextPart(part) {
|
|
70
67
|
const a2aPart = { kind: "text", text: part.text || "" };
|
|
71
|
-
if (
|
|
68
|
+
if (part.thought) {
|
|
72
69
|
a2aPart.metadata = {
|
|
73
|
-
[
|
|
70
|
+
[import_metadata_converter_utils.A2AMetadataKeys.THOUGHT]: true
|
|
74
71
|
};
|
|
75
72
|
}
|
|
76
73
|
return a2aPart;
|
|
@@ -99,31 +96,31 @@ function toA2AFilePart(part) {
|
|
|
99
96
|
throw new Error(`Not a file part: ${JSON.stringify(part)}`);
|
|
100
97
|
}
|
|
101
98
|
function toA2ADataPart(part, longRunningToolIDs = []) {
|
|
102
|
-
let
|
|
99
|
+
let dataPartType;
|
|
103
100
|
let data;
|
|
104
101
|
if (part.functionCall) {
|
|
105
|
-
|
|
102
|
+
dataPartType = "function_call" /* FUNCTION_CALL */;
|
|
106
103
|
data = part.functionCall;
|
|
107
104
|
} else if (part.functionResponse) {
|
|
108
|
-
|
|
105
|
+
dataPartType = "function_response" /* FUNCTION_RESPONSE */;
|
|
109
106
|
data = part.functionResponse;
|
|
110
107
|
} else if (part.executableCode) {
|
|
111
|
-
|
|
108
|
+
dataPartType = "executable_code" /* CODE_EXECUTABLE_CODE */;
|
|
112
109
|
data = part.executableCode;
|
|
113
110
|
} else if (part.codeExecutionResult) {
|
|
114
|
-
|
|
111
|
+
dataPartType = "code_execution_result" /* CODE_EXEC_RESULT */;
|
|
115
112
|
data = part.codeExecutionResult;
|
|
116
113
|
} else {
|
|
117
114
|
throw new Error(`Unknown part type: ${JSON.stringify(part)}`);
|
|
118
115
|
}
|
|
119
116
|
const metadata = {
|
|
120
|
-
[
|
|
117
|
+
[import_metadata_converter_utils.A2AMetadataKeys.DATA_PART_TYPE]: dataPartType
|
|
121
118
|
};
|
|
122
|
-
if (part.functionCall && part.functionCall.
|
|
123
|
-
metadata[
|
|
119
|
+
if (part.functionCall && part.functionCall.id && longRunningToolIDs.includes(part.functionCall.id)) {
|
|
120
|
+
metadata[import_metadata_converter_utils.A2AMetadataKeys.IS_LONG_RUNNING] = true;
|
|
124
121
|
}
|
|
125
|
-
if (part.functionResponse && part.functionResponse.
|
|
126
|
-
metadata[
|
|
122
|
+
if (part.functionResponse && part.functionResponse.id && longRunningToolIDs.includes(part.functionResponse.id)) {
|
|
123
|
+
metadata[import_metadata_converter_utils.A2AMetadataKeys.IS_LONG_RUNNING] = true;
|
|
127
124
|
}
|
|
128
125
|
return {
|
|
129
126
|
kind: "data",
|
|
@@ -131,6 +128,10 @@ function toA2ADataPart(part, longRunningToolIDs = []) {
|
|
|
131
128
|
metadata
|
|
132
129
|
};
|
|
133
130
|
}
|
|
131
|
+
function toGenAIContent(a2aMessage) {
|
|
132
|
+
const parts = toGenAIParts(a2aMessage.parts);
|
|
133
|
+
return a2aMessage.role === "user" ? (0, import_genai.createUserContent)(parts) : (0, import_genai.createModelContent)(parts);
|
|
134
|
+
}
|
|
134
135
|
function toGenAIParts(a2aParts) {
|
|
135
136
|
return a2aParts.map((a2aPart) => toGenAIPart(a2aPart));
|
|
136
137
|
}
|
|
@@ -150,7 +151,7 @@ function toGenAIPartText(a2aPart) {
|
|
|
150
151
|
var _a;
|
|
151
152
|
return {
|
|
152
153
|
text: a2aPart.text,
|
|
153
|
-
thought: !!((_a = a2aPart.metadata) == null ? void 0 : _a[
|
|
154
|
+
thought: !!((_a = a2aPart.metadata) == null ? void 0 : _a[import_metadata_converter_utils.A2AMetadataKeys.THOUGHT])
|
|
154
155
|
};
|
|
155
156
|
}
|
|
156
157
|
function toGenAIPartFile(a2aPart) {
|
|
@@ -178,7 +179,7 @@ function toGenAIPartData(a2aPart) {
|
|
|
178
179
|
throw new Error(`No data in part: ${JSON.stringify(a2aPart)}`);
|
|
179
180
|
}
|
|
180
181
|
const data = a2aPart.data;
|
|
181
|
-
const type = (_a = a2aPart.metadata) == null ? void 0 : _a[
|
|
182
|
+
const type = (_a = a2aPart.metadata) == null ? void 0 : _a[import_metadata_converter_utils.A2AMetadataKeys.DATA_PART_TYPE];
|
|
182
183
|
if (type === "function_call" /* FUNCTION_CALL */) {
|
|
183
184
|
return { functionCall: data };
|
|
184
185
|
}
|
|
@@ -202,6 +203,7 @@ function toGenAIPartData(a2aPart) {
|
|
|
202
203
|
toA2APart,
|
|
203
204
|
toA2AParts,
|
|
204
205
|
toA2ATextPart,
|
|
206
|
+
toGenAIContent,
|
|
205
207
|
toGenAIPart,
|
|
206
208
|
toGenAIPartData,
|
|
207
209
|
toGenAIPartFile,
|
|
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(base_agent_exports);
|
|
|
32
32
|
var import_api = require("@opentelemetry/api");
|
|
33
33
|
var import_event = require("../events/event.js");
|
|
34
34
|
var import_tracing = require("../telemetry/tracing.js");
|
|
35
|
-
var
|
|
35
|
+
var import_context = require("./context.js");
|
|
36
36
|
var import_invocation_context = require("./invocation_context.js");
|
|
37
37
|
/**
|
|
38
38
|
* @license
|
|
@@ -180,7 +180,7 @@ class BaseAgent {
|
|
|
180
180
|
if (this.beforeAgentCallback.length === 0) {
|
|
181
181
|
return void 0;
|
|
182
182
|
}
|
|
183
|
-
const callbackContext = new
|
|
183
|
+
const callbackContext = new import_context.Context({ invocationContext });
|
|
184
184
|
for (const callback of this.beforeAgentCallback) {
|
|
185
185
|
const content = await callback(callbackContext);
|
|
186
186
|
if (content) {
|
|
@@ -215,7 +215,7 @@ class BaseAgent {
|
|
|
215
215
|
if (this.afterAgentCallback.length === 0) {
|
|
216
216
|
return void 0;
|
|
217
217
|
}
|
|
218
|
-
const callbackContext = new
|
|
218
|
+
const callbackContext = new import_context.Context({ invocationContext });
|
|
219
219
|
for (const callback of this.afterAgentCallback) {
|
|
220
220
|
const content = await callback(callbackContext);
|
|
221
221
|
if (content) {
|
|
@@ -22,39 +22,94 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
22
22
|
return to;
|
|
23
23
|
};
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var
|
|
26
|
-
__export(
|
|
27
|
-
|
|
25
|
+
var context_exports = {};
|
|
26
|
+
__export(context_exports, {
|
|
27
|
+
Context: () => Context
|
|
28
28
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
30
|
-
var import_callback_context = require("../agents/callback_context.js");
|
|
29
|
+
module.exports = __toCommonJS(context_exports);
|
|
31
30
|
var import_auth_handler = require("../auth/auth_handler.js");
|
|
31
|
+
var import_event_actions = require("../events/event_actions.js");
|
|
32
|
+
var import_state = require("../sessions/state.js");
|
|
32
33
|
var import_tool_confirmation = require("../tools/tool_confirmation.js");
|
|
34
|
+
var import_readonly_context = require("./readonly_context.js");
|
|
33
35
|
/**
|
|
34
36
|
* @license
|
|
35
37
|
* Copyright 2025 Google LLC
|
|
36
38
|
* SPDX-License-Identifier: Apache-2.0
|
|
37
39
|
*/
|
|
38
|
-
class
|
|
40
|
+
class Context extends import_readonly_context.ReadonlyContext {
|
|
39
41
|
/**
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
42
|
+
* @param options The configuration options for the Context.
|
|
43
|
+
* @param options.invocationContext The invocation context.
|
|
44
|
+
* @param options.eventActions The event actions of the current call.
|
|
45
|
+
* @param options.functionCallId The function call id of the current tool call.
|
|
43
46
|
* This id was returned in the function call event from LLM to identify a
|
|
44
47
|
* function call. If LLM didn't return this id, ADK will assign one to it.
|
|
45
48
|
* This id is used to map function call response to the original function
|
|
46
49
|
* call.
|
|
47
|
-
* @param
|
|
50
|
+
* @param options.toolConfirmation The tool confirmation of the current tool
|
|
48
51
|
* call.
|
|
49
52
|
*/
|
|
50
|
-
constructor(
|
|
51
|
-
super(
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
53
|
+
constructor(options) {
|
|
54
|
+
super(options.invocationContext);
|
|
55
|
+
this.eventActions = options.eventActions || (0, import_event_actions.createEventActions)();
|
|
56
|
+
this._state = new import_state.State(
|
|
57
|
+
options.invocationContext.session.state,
|
|
58
|
+
this.eventActions.stateDelta
|
|
59
|
+
);
|
|
60
|
+
this.functionCallId = options.functionCallId;
|
|
61
|
+
this.toolConfirmation = options.toolConfirmation;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The delta-aware state of the current session.
|
|
65
|
+
*/
|
|
66
|
+
get state() {
|
|
67
|
+
return this._state;
|
|
54
68
|
}
|
|
55
69
|
get actions() {
|
|
56
70
|
return this.eventActions;
|
|
57
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Loads an artifact attached to the current session.
|
|
74
|
+
*
|
|
75
|
+
* @param filename The filename of the artifact.
|
|
76
|
+
* @param version The version of the artifact. If not provided, the latest
|
|
77
|
+
* version will be used.
|
|
78
|
+
* @return A promise that resolves to the loaded artifact.
|
|
79
|
+
*/
|
|
80
|
+
loadArtifact(filename, version) {
|
|
81
|
+
if (!this.invocationContext.artifactService) {
|
|
82
|
+
throw new Error("Artifact service is not initialized.");
|
|
83
|
+
}
|
|
84
|
+
return this.invocationContext.artifactService.loadArtifact({
|
|
85
|
+
appName: this.invocationContext.appName,
|
|
86
|
+
userId: this.invocationContext.userId,
|
|
87
|
+
sessionId: this.invocationContext.session.id,
|
|
88
|
+
filename,
|
|
89
|
+
version
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Saves an artifact attached to the current session.
|
|
94
|
+
*
|
|
95
|
+
* @param filename The filename of the artifact.
|
|
96
|
+
* @param artifact The artifact to save.
|
|
97
|
+
* @return A promise that resolves to the version of the saved artifact.
|
|
98
|
+
*/
|
|
99
|
+
async saveArtifact(filename, artifact) {
|
|
100
|
+
if (!this.invocationContext.artifactService) {
|
|
101
|
+
throw new Error("Artifact service is not initialized.");
|
|
102
|
+
}
|
|
103
|
+
const version = await this.invocationContext.artifactService.saveArtifact({
|
|
104
|
+
appName: this.invocationContext.appName,
|
|
105
|
+
userId: this.invocationContext.userId,
|
|
106
|
+
sessionId: this.invocationContext.session.id,
|
|
107
|
+
filename,
|
|
108
|
+
artifact
|
|
109
|
+
});
|
|
110
|
+
this.eventActions.artifactDelta[filename] = version;
|
|
111
|
+
return version;
|
|
112
|
+
}
|
|
58
113
|
requestCredential(authConfig) {
|
|
59
114
|
if (!this.functionCallId) {
|
|
60
115
|
throw new Error("functionCallId is not set.");
|
|
@@ -120,5 +175,5 @@ class ToolContext extends import_callback_context.CallbackContext {
|
|
|
120
175
|
}
|
|
121
176
|
// Annotate the CommonJS export names for ESM import in node:
|
|
122
177
|
0 && (module.exports = {
|
|
123
|
-
|
|
178
|
+
Context
|
|
124
179
|
});
|
|
@@ -42,9 +42,9 @@ var import_genai = require("@google/genai");
|
|
|
42
42
|
var import_lodash_es = require("lodash-es");
|
|
43
43
|
var import_event = require("../events/event.js");
|
|
44
44
|
var import_event_actions = require("../events/event_actions.js");
|
|
45
|
-
var import_tool_context = require("../tools/tool_context.js");
|
|
46
45
|
var import_env_aware_utils = require("../utils/env_aware_utils.js");
|
|
47
46
|
var import_logger = require("../utils/logger.js");
|
|
47
|
+
var import_context = require("./context.js");
|
|
48
48
|
var import_tracing = require("../telemetry/tracing.js");
|
|
49
49
|
/**
|
|
50
50
|
* @license
|
|
@@ -388,7 +388,7 @@ function getToolAndContext({
|
|
|
388
388
|
`Function ${functionCall.name} is not found in the toolsDict.`
|
|
389
389
|
);
|
|
390
390
|
}
|
|
391
|
-
const toolContext = new
|
|
391
|
+
const toolContext = new import_context.Context({
|
|
392
392
|
invocationContext,
|
|
393
393
|
functionCallId: functionCall.id || void 0,
|
|
394
394
|
toolConfirmation
|