@google/adk 2.3.0 → 2.4.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/agents/agent_engine_client.js +172 -0
- package/dist/cjs/agents/base_agent.js +20 -4
- package/dist/cjs/agents/functions.js +28 -0
- package/dist/cjs/agents/instructions.js +2 -1
- package/dist/cjs/agents/llm_agent.js +19 -6
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/cjs/agents/processors/content_processor_utils.js +38 -10
- package/dist/cjs/agents/processors/content_request_processor.js +34 -2
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/nl_planning_processor.js +12 -3
- package/dist/cjs/cli/utils/logs.js +6 -6
- package/dist/cjs/code_executors/container_code_executor.js +27 -16
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/cjs/common.js +9 -20
- package/dist/cjs/errors/input_validation_error.js +3 -2
- package/dist/cjs/index.js +9 -2
- package/dist/cjs/plugins/base_plugin.js +13 -23
- package/dist/cjs/sessions/base_session_service.js +14 -8
- package/dist/cjs/sessions/database_session_service.js +50 -28
- package/dist/cjs/sessions/stale_session_error.js +59 -0
- package/dist/cjs/skills/loader.js +52 -18
- package/dist/cjs/telemetry/setup.js +0 -1
- package/dist/cjs/telemetry/tracing.js +53 -10
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +18 -23
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +120 -42
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +163 -95
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +13 -9
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +184 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +173 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolsets.js +124 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +2 -2
- package/dist/cjs/tools/google_api_tool/index.js +20 -23
- package/dist/cjs/tools/load_artifacts_tool.js +12 -6
- package/dist/cjs/tools/load_memory_tool.js +12 -10
- package/dist/cjs/tools/mcp/mcp_toolset.js +1 -14
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +7 -13
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/cjs/tools/toolbox_toolset.js +174 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/cjs/utils/client_labels.js +19 -2
- package/dist/cjs/utils/failover_utils.js +1 -1
- package/dist/cjs/utils/gemini_schema_util.js +24 -6
- package/dist/cjs/utils/logger_node.js +4 -0
- package/dist/cjs/utils/output_schema_utils.js +5 -2
- package/dist/cjs/utils/task.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/agent_engine_client.js +144 -0
- package/dist/esm/agents/base_agent.js +20 -4
- package/dist/esm/agents/functions.js +28 -0
- package/dist/esm/agents/instructions.js +2 -1
- package/dist/esm/agents/llm_agent.js +19 -6
- package/dist/esm/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/esm/agents/processors/content_processor_utils.js +38 -10
- package/dist/esm/agents/processors/content_request_processor.js +34 -2
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/nl_planning_processor.js +12 -3
- package/dist/esm/cli/utils/logs.js +4 -4
- package/dist/esm/code_executors/container_code_executor.js +27 -16
- package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/esm/common.js +10 -13
- package/dist/esm/errors/input_validation_error.js +3 -2
- package/dist/esm/index.js +17 -3
- package/dist/esm/plugins/base_plugin.js +13 -23
- package/dist/esm/sessions/base_session_service.js +12 -7
- package/dist/esm/sessions/database_session_service.js +49 -28
- package/dist/esm/sessions/stale_session_error.js +31 -0
- package/dist/esm/skills/loader.js +51 -17
- package/dist/esm/telemetry/setup.js +1 -2
- package/dist/esm/telemetry/tracing.js +57 -11
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +17 -22
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +124 -42
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +163 -95
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +13 -9
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +158 -0
- package/dist/esm/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +146 -0
- package/dist/esm/tools/google_api_tool/google_api_toolsets.js +94 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +2 -2
- package/dist/esm/tools/google_api_tool/index.js +18 -20
- package/dist/esm/tools/load_artifacts_tool.js +10 -5
- package/dist/esm/tools/load_memory_tool.js +12 -10
- package/dist/esm/tools/mcp/mcp_toolset.js +1 -14
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +6 -12
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/esm/tools/toolbox_toolset.js +148 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/esm/utils/client_labels.js +19 -2
- package/dist/esm/utils/failover_utils.js +1 -1
- package/dist/esm/utils/gemini_schema_util.js +23 -6
- package/dist/esm/utils/logger_node.js +4 -0
- package/dist/esm/utils/output_schema_utils.js +5 -2
- package/dist/esm/utils/task.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/agents/agent_engine_client.d.ts +37 -0
- package/dist/types/agents/base_agent.d.ts +12 -0
- package/dist/types/agents/llm_agent.d.ts +5 -1
- package/dist/types/agents/processors/content_processor_utils.d.ts +4 -2
- package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
- package/dist/types/cli/utils/logs.d.ts +1 -1
- package/dist/types/code_executors/container_code_executor.d.ts +17 -5
- package/dist/types/common.d.ts +5 -9
- package/dist/types/errors/input_validation_error.d.ts +2 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/plugins/base_plugin.d.ts +0 -10
- package/dist/types/sessions/base_session_service.d.ts +5 -0
- package/dist/types/sessions/database_session_service.d.ts +17 -1
- package/dist/types/sessions/stale_session_error.d.ts +21 -0
- package/dist/types/skills/loader.d.ts +3 -2
- package/dist/types/telemetry/tracing.d.ts +17 -3
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +14 -21
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +32 -9
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +22 -8
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +3 -3
- package/dist/types/tools/application_integration_tool/integration_connector_tool.d.ts +70 -0
- package/dist/types/tools/base_toolset.d.ts +6 -5
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +10 -3
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +55 -0
- package/dist/types/tools/google_api_tool/google_api_toolsets.d.ts +48 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +5 -4
- package/dist/types/tools/google_api_tool/index.d.ts +4 -5
- package/dist/types/tools/load_artifacts_tool.d.ts +14 -1
- package/dist/types/tools/load_memory_tool.d.ts +23 -1
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +12 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +8 -0
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +5 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +10 -0
- package/dist/types/tools/toolbox_toolset.d.ts +159 -0
- package/dist/types/utils/client_labels.d.ts +2 -1
- package/dist/types/utils/gemini_schema_util.d.ts +8 -0
- package/dist/types/utils/output_schema_utils.d.ts +3 -2
- package/dist/types/utils/simple_zod_to_json.d.ts +1 -2
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +74 -66
- package/dist/web/index_web.js.map +4 -4
- package/package.json +34 -27
- package/dist/cjs/agents/remote_agent.js +0 -187
- package/dist/cjs/tools/crewai_tool.js +0 -132
- package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +0 -226
- package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +0 -58
- package/dist/cjs/tools/langchain_tool.js +0 -172
- package/dist/cjs/tools/toolbox_tool.js +0 -108
- package/dist/esm/agents/remote_agent.js +0 -164
- package/dist/esm/tools/crewai_tool.js +0 -107
- package/dist/esm/tools/google_api_tool/google_api_tool_set.js +0 -188
- package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +0 -24
- package/dist/esm/tools/langchain_tool.js +0 -148
- package/dist/esm/tools/toolbox_tool.js +0 -80
- package/dist/types/agents/remote_agent.d.ts +0 -68
- package/dist/types/tools/crewai_tool.d.ts +0 -85
- package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +0 -78
- package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +0 -33
- package/dist/types/tools/langchain_tool.d.ts +0 -103
- package/dist/types/tools/toolbox_tool.d.ts +0 -73
|
@@ -1,58 +0,0 @@
|
|
|
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 __export = (target, all) => {
|
|
13
|
-
for (var name in all)
|
|
14
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
-
for (let key of __getOwnPropNames(from))
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var google_api_tool_sets_exports = {};
|
|
26
|
-
__export(google_api_tool_sets_exports, {
|
|
27
|
-
bigqueryToolSet: () => bigqueryToolSet,
|
|
28
|
-
calendarToolSet: () => calendarToolSet,
|
|
29
|
-
docsToolSet: () => docsToolSet,
|
|
30
|
-
gmailToolSet: () => gmailToolSet,
|
|
31
|
-
sheetsToolSet: () => sheetsToolSet,
|
|
32
|
-
slidesToolSet: () => slidesToolSet,
|
|
33
|
-
youtubeToolSet: () => youtubeToolSet
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(google_api_tool_sets_exports);
|
|
36
|
-
var import_google_api_tool_set = require("./google_api_tool_set.js");
|
|
37
|
-
/**
|
|
38
|
-
* @license
|
|
39
|
-
* Copyright 2026 Google LLC
|
|
40
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
41
|
-
*/
|
|
42
|
-
const calendarToolSet = (0, import_google_api_tool_set.createLazyGoogleApiToolSet)("calendar", "v3");
|
|
43
|
-
const bigqueryToolSet = (0, import_google_api_tool_set.createLazyGoogleApiToolSet)("bigquery", "v2");
|
|
44
|
-
const gmailToolSet = (0, import_google_api_tool_set.createLazyGoogleApiToolSet)("gmail", "v1");
|
|
45
|
-
const youtubeToolSet = (0, import_google_api_tool_set.createLazyGoogleApiToolSet)("youtube", "v3");
|
|
46
|
-
const slidesToolSet = (0, import_google_api_tool_set.createLazyGoogleApiToolSet)("slides", "v1");
|
|
47
|
-
const sheetsToolSet = (0, import_google_api_tool_set.createLazyGoogleApiToolSet)("sheets", "v4");
|
|
48
|
-
const docsToolSet = (0, import_google_api_tool_set.createLazyGoogleApiToolSet)("docs", "v1");
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
bigqueryToolSet,
|
|
52
|
-
calendarToolSet,
|
|
53
|
-
docsToolSet,
|
|
54
|
-
gmailToolSet,
|
|
55
|
-
sheetsToolSet,
|
|
56
|
-
slidesToolSet,
|
|
57
|
-
youtubeToolSet
|
|
58
|
-
});
|
|
@@ -1,172 +0,0 @@
|
|
|
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 langchain_tool_exports = {};
|
|
27
|
-
__export(langchain_tool_exports, {
|
|
28
|
-
LangchainTool: () => LangchainTool,
|
|
29
|
-
isLangchainTool: () => isLangchainTool
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(langchain_tool_exports);
|
|
32
|
-
var import_schema = require("../utils/schema.js");
|
|
33
|
-
var import_simple_zod_to_json = require("../utils/simple_zod_to_json.js");
|
|
34
|
-
var import_variant_utils = require("../utils/variant_utils.js");
|
|
35
|
-
var import_function_tool = require("./function_tool.js");
|
|
36
|
-
/**
|
|
37
|
-
* @license
|
|
38
|
-
* Copyright 2026 Google LLC
|
|
39
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
40
|
-
*/
|
|
41
|
-
var _a, _b;
|
|
42
|
-
const LANGCHAIN_TOOL_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.langchainTool");
|
|
43
|
-
function isLangchainTool(obj) {
|
|
44
|
-
return typeof obj === "object" && obj !== null && LANGCHAIN_TOOL_SIGNATURE_SYMBOL in obj && obj[LANGCHAIN_TOOL_SIGNATURE_SYMBOL] === true;
|
|
45
|
-
}
|
|
46
|
-
__name(isLangchainTool, "isLangchainTool");
|
|
47
|
-
function isLangchainToolConfig(value) {
|
|
48
|
-
return typeof value === "object" && value !== null && "tool" in value && typeof value.tool === "object" && value.tool !== null;
|
|
49
|
-
}
|
|
50
|
-
__name(isLangchainToolConfig, "isLangchainToolConfig");
|
|
51
|
-
function resolveRunnerFunction(tool) {
|
|
52
|
-
if (typeof tool._run === "function") {
|
|
53
|
-
return tool._run.bind(tool);
|
|
54
|
-
}
|
|
55
|
-
if (typeof tool._call === "function") {
|
|
56
|
-
return tool._call.bind(tool);
|
|
57
|
-
}
|
|
58
|
-
if (typeof tool.invoke === "function") {
|
|
59
|
-
return tool.invoke.bind(tool);
|
|
60
|
-
}
|
|
61
|
-
if (typeof tool.run === "function") {
|
|
62
|
-
return tool.run.bind(tool);
|
|
63
|
-
}
|
|
64
|
-
throw new TypeError(
|
|
65
|
-
"LangchainTool requires a tool object with a _run, _call, invoke, or run method."
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
__name(resolveRunnerFunction, "resolveRunnerFunction");
|
|
69
|
-
function isStructuredLangchainTool(tool) {
|
|
70
|
-
return typeof tool._run === "function" || typeof tool._call === "function" || typeof tool.invoke === "function" || tool.argsSchema !== void 0 || tool.schema !== void 0 || tool.args !== void 0;
|
|
71
|
-
}
|
|
72
|
-
__name(isStructuredLangchainTool, "isStructuredLangchainTool");
|
|
73
|
-
function extractLangchainPropertiesMap(tool) {
|
|
74
|
-
var _a2;
|
|
75
|
-
if (tool.args && typeof tool.args === "object") {
|
|
76
|
-
return structuredClone(tool.args);
|
|
77
|
-
}
|
|
78
|
-
const schemaSource = (_a2 = tool.argsSchema) != null ? _a2 : tool.schema;
|
|
79
|
-
if (!schemaSource) {
|
|
80
|
-
return {};
|
|
81
|
-
}
|
|
82
|
-
let rawSchema;
|
|
83
|
-
if (typeof schemaSource.modelJsonSchema === "function") {
|
|
84
|
-
rawSchema = schemaSource.modelJsonSchema();
|
|
85
|
-
} else if (typeof schemaSource.jsonSchema === "function") {
|
|
86
|
-
rawSchema = schemaSource.jsonSchema();
|
|
87
|
-
} else if ((0, import_simple_zod_to_json.isZodSchema)(schemaSource)) {
|
|
88
|
-
rawSchema = structuredClone((0, import_schema.toJsonSchema)(schemaSource));
|
|
89
|
-
} else {
|
|
90
|
-
rawSchema = structuredClone(schemaSource);
|
|
91
|
-
}
|
|
92
|
-
const properties = rawSchema["properties"] && typeof rawSchema["properties"] === "object" ? structuredClone(
|
|
93
|
-
rawSchema["properties"]
|
|
94
|
-
) : structuredClone(rawSchema);
|
|
95
|
-
const requiredSet = Array.isArray(rawSchema["required"]) ? new Set(rawSchema["required"]) : void 0;
|
|
96
|
-
for (const [key, prop] of Object.entries(properties)) {
|
|
97
|
-
if (!prop || typeof prop !== "object") {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (Array.isArray(prop["type"])) {
|
|
101
|
-
const types = prop["type"];
|
|
102
|
-
delete prop["type"];
|
|
103
|
-
prop["anyOf"] = types.map((t) => ({ type: t }));
|
|
104
|
-
} else if (requiredSet !== void 0 && !requiredSet.has(key) && !("default" in prop) && !("anyOf" in prop) && typeof prop["type"] === "string") {
|
|
105
|
-
const propType = prop["type"];
|
|
106
|
-
delete prop["type"];
|
|
107
|
-
prop["anyOf"] = [{ type: propType }, { type: "null" }];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return properties;
|
|
111
|
-
}
|
|
112
|
-
__name(extractLangchainPropertiesMap, "extractLangchainPropertiesMap");
|
|
113
|
-
const _LangchainTool = class _LangchainTool extends (_b = import_function_tool.FunctionTool, _a = LANGCHAIN_TOOL_SIGNATURE_SYMBOL, _b) {
|
|
114
|
-
constructor(toolOrConfig, options) {
|
|
115
|
-
var _a2, _b2, _c, _d;
|
|
116
|
-
const config = isLangchainToolConfig(toolOrConfig) ? toolOrConfig : {
|
|
117
|
-
tool: toolOrConfig,
|
|
118
|
-
name: options == null ? void 0 : options.name,
|
|
119
|
-
description: options == null ? void 0 : options.description
|
|
120
|
-
};
|
|
121
|
-
const runnerFn = resolveRunnerFunction(config.tool);
|
|
122
|
-
const rawFn = (_c = (_b2 = (_a2 = config.tool._run) != null ? _a2 : config.tool._call) != null ? _b2 : config.tool.invoke) != null ? _c : config.tool.run;
|
|
123
|
-
const resolvedName = config.name || config.tool.name || (rawFn == null ? void 0 : rawFn.name) || "langchain_tool";
|
|
124
|
-
const resolvedDescription = config.description || config.tool.description || "";
|
|
125
|
-
const schemaCandidate = (_d = config.tool.argsSchema) != null ? _d : config.tool.schema;
|
|
126
|
-
super({
|
|
127
|
-
name: resolvedName,
|
|
128
|
-
description: resolvedDescription,
|
|
129
|
-
parameters: (0, import_simple_zod_to_json.isZodObject)(schemaCandidate) ? schemaCandidate : void 0,
|
|
130
|
-
execute: /* @__PURE__ */ __name(async (args, toolContext) => {
|
|
131
|
-
return await runnerFn(
|
|
132
|
-
args != null ? args : {},
|
|
133
|
-
toolContext
|
|
134
|
-
);
|
|
135
|
-
}, "execute")
|
|
136
|
-
});
|
|
137
|
-
/** A unique symbol to identify ADK LangchainTool class. */
|
|
138
|
-
this[_a] = true;
|
|
139
|
-
this.tool = config.tool;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Builds the `FunctionDeclaration` for the wrapped LangChain tool.
|
|
143
|
-
*/
|
|
144
|
-
_getDeclaration() {
|
|
145
|
-
var _a2, _b2, _c;
|
|
146
|
-
if (isStructuredLangchainTool(this.tool)) {
|
|
147
|
-
const propertiesMap = extractLangchainPropertiesMap(this.tool);
|
|
148
|
-
const rawFn = (_c = (_b2 = (_a2 = this.tool._run) != null ? _a2 : this.tool._call) != null ? _b2 : this.tool.invoke) != null ? _c : this.tool.run;
|
|
149
|
-
return (0, import_function_tool.buildFunctionDeclarationForLangchain)(
|
|
150
|
-
this.apiVariant === import_variant_utils.GoogleLLMVariant.VERTEX_AI,
|
|
151
|
-
this.name,
|
|
152
|
-
this.description,
|
|
153
|
-
rawFn,
|
|
154
|
-
propertiesMap
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
return (0, import_function_tool.buildFunctionDeclarationUtil)(
|
|
158
|
-
this.apiVariant === import_variant_utils.GoogleLLMVariant.VERTEX_AI,
|
|
159
|
-
this.name,
|
|
160
|
-
this.description,
|
|
161
|
-
this.tool.run,
|
|
162
|
-
{ properties: extractLangchainPropertiesMap(this.tool) }
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
__name(_LangchainTool, "LangchainTool");
|
|
167
|
-
let LangchainTool = _LangchainTool;
|
|
168
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
169
|
-
0 && (module.exports = {
|
|
170
|
-
LangchainTool,
|
|
171
|
-
isLangchainTool
|
|
172
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
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 toolbox_tool_exports = {};
|
|
27
|
-
__export(toolbox_tool_exports, {
|
|
28
|
-
ToolboxTool: () => ToolboxTool,
|
|
29
|
-
isToolboxTool: () => isToolboxTool
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(toolbox_tool_exports);
|
|
32
|
-
var import_langchain_tool = require("./langchain_tool.js");
|
|
33
|
-
/**
|
|
34
|
-
* @license
|
|
35
|
-
* Copyright 2026 Google LLC
|
|
36
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
37
|
-
*/
|
|
38
|
-
var _a;
|
|
39
|
-
const TOOLBOX_TOOL_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.toolboxTool");
|
|
40
|
-
function isToolboxTool(obj) {
|
|
41
|
-
return typeof obj === "object" && obj !== null && TOOLBOX_TOOL_SIGNATURE_SYMBOL in obj && obj[TOOLBOX_TOOL_SIGNATURE_SYMBOL] === true;
|
|
42
|
-
}
|
|
43
|
-
__name(isToolboxTool, "isToolboxTool");
|
|
44
|
-
function createUnconfiguredToolboxClient(url) {
|
|
45
|
-
const endpoint = url != null ? url : "unspecified URL";
|
|
46
|
-
const throwMissingClient = /* @__PURE__ */ __name(() => {
|
|
47
|
-
throw new Error(
|
|
48
|
-
`ToolboxTool requires a ToolboxClientLike instance (for endpoint "${endpoint}"). Pass {url, client} to the ToolboxTool constructor.`
|
|
49
|
-
);
|
|
50
|
-
}, "throwMissingClient");
|
|
51
|
-
return {
|
|
52
|
-
loadTool: throwMissingClient,
|
|
53
|
-
loadToolset: throwMissingClient
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
__name(createUnconfiguredToolboxClient, "createUnconfiguredToolboxClient");
|
|
57
|
-
_a = TOOLBOX_TOOL_SIGNATURE_SYMBOL;
|
|
58
|
-
const _ToolboxTool = class _ToolboxTool {
|
|
59
|
-
constructor(urlOrOptions) {
|
|
60
|
-
/** A unique symbol to identify ADK ToolboxTool class. */
|
|
61
|
-
this[_a] = true;
|
|
62
|
-
var _a2;
|
|
63
|
-
if (typeof urlOrOptions === "string") {
|
|
64
|
-
this.url = urlOrOptions;
|
|
65
|
-
this.toolboxClient = createUnconfiguredToolboxClient(urlOrOptions);
|
|
66
|
-
} else {
|
|
67
|
-
this.url = urlOrOptions.url;
|
|
68
|
-
this.toolboxClient = (_a2 = urlOrOptions.client) != null ? _a2 : createUnconfiguredToolboxClient(urlOrOptions.url);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Loads a single tool from the Toolbox client and wraps it in a
|
|
73
|
-
* {@link LangchainTool}.
|
|
74
|
-
*/
|
|
75
|
-
getTool(toolName) {
|
|
76
|
-
var _a2, _b, _c;
|
|
77
|
-
const loader = (_c = (_a2 = this.toolboxClient.loadTool) == null ? void 0 : _a2.bind(this.toolboxClient)) != null ? _c : (_b = this.toolboxClient.load_tool) == null ? void 0 : _b.bind(this.toolboxClient);
|
|
78
|
-
if (!loader) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
"ToolboxClient does not implement loadTool or load_tool."
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
const tool = loader(toolName);
|
|
84
|
-
return new import_langchain_tool.LangchainTool(tool);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Loads a toolset from the Toolbox client and wraps each tool in a
|
|
88
|
-
* {@link LangchainTool}.
|
|
89
|
-
*/
|
|
90
|
-
getToolset(toolsetName) {
|
|
91
|
-
var _a2, _b, _c;
|
|
92
|
-
const loader = (_c = (_a2 = this.toolboxClient.loadToolset) == null ? void 0 : _a2.bind(this.toolboxClient)) != null ? _c : (_b = this.toolboxClient.load_toolset) == null ? void 0 : _b.bind(this.toolboxClient);
|
|
93
|
-
if (!loader) {
|
|
94
|
-
throw new Error(
|
|
95
|
-
"ToolboxClient does not implement loadToolset or load_toolset."
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
const tools = loader(toolsetName);
|
|
99
|
-
return tools.map((tool) => new import_langchain_tool.LangchainTool(tool));
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
__name(_ToolboxTool, "ToolboxTool");
|
|
103
|
-
let ToolboxTool = _ToolboxTool;
|
|
104
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
-
0 && (module.exports = {
|
|
106
|
-
ToolboxTool,
|
|
107
|
-
isToolboxTool
|
|
108
|
-
});
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
-
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
8
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9
|
-
if (decorator = decorators[i])
|
|
10
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
11
|
-
if (kind && result) __defProp(target, key, result);
|
|
12
|
-
return result;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* @license
|
|
16
|
-
* Copyright 2026 Google LLC
|
|
17
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18
|
-
*/
|
|
19
|
-
var _a, _b;
|
|
20
|
-
import {
|
|
21
|
-
createEvent,
|
|
22
|
-
transformToCamelCaseEvent,
|
|
23
|
-
transformToSnakeCaseEvent
|
|
24
|
-
} from "../events/event.js";
|
|
25
|
-
import { experimental } from "../utils/experimental.js";
|
|
26
|
-
import { BaseAgent } from "./base_agent.js";
|
|
27
|
-
const DEFAULT_REMOTE_AGENT_TIMEOUT_MS = 12e4;
|
|
28
|
-
const MILLIS_PER_SECOND = 1e3;
|
|
29
|
-
const SESSION_PRESERVE_KEYS = /* @__PURE__ */ new Set(["state", "events"]);
|
|
30
|
-
const EVENT_PRESERVE_KEYS = /* @__PURE__ */ new Set([
|
|
31
|
-
"actions.state_delta",
|
|
32
|
-
"actions.artifact_delta",
|
|
33
|
-
"actions.requested_auth_configs",
|
|
34
|
-
"actions.requested_tool_confirmations",
|
|
35
|
-
"actions.custom_metadata",
|
|
36
|
-
"custom_metadata",
|
|
37
|
-
"content.parts.function_call.args",
|
|
38
|
-
"content.parts.function_response.response",
|
|
39
|
-
"output",
|
|
40
|
-
"route",
|
|
41
|
-
"actions.agent_state"
|
|
42
|
-
]);
|
|
43
|
-
const REMOTE_AGENT_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.remoteAgent");
|
|
44
|
-
function isRemoteAgent(obj) {
|
|
45
|
-
return typeof obj === "object" && obj !== null && REMOTE_AGENT_SIGNATURE_SYMBOL in obj && obj[REMOTE_AGENT_SIGNATURE_SYMBOL] === true;
|
|
46
|
-
}
|
|
47
|
-
__name(isRemoteAgent, "isRemoteAgent");
|
|
48
|
-
function isRecord(value) {
|
|
49
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
50
|
-
}
|
|
51
|
-
__name(isRecord, "isRecord");
|
|
52
|
-
function stripNullish(value, preserveKeys, parentKey = "") {
|
|
53
|
-
if (Array.isArray(value)) {
|
|
54
|
-
return value.map((item) => stripNullish(item, preserveKeys, parentKey));
|
|
55
|
-
}
|
|
56
|
-
if (value !== null && typeof value === "object") {
|
|
57
|
-
return stripNullishRecord(value, preserveKeys, parentKey);
|
|
58
|
-
}
|
|
59
|
-
return value;
|
|
60
|
-
}
|
|
61
|
-
__name(stripNullish, "stripNullish");
|
|
62
|
-
function stripNullishRecord(record, preserveKeys, parentKey = "") {
|
|
63
|
-
const result = {};
|
|
64
|
-
for (const [key, entryValue] of Object.entries(record)) {
|
|
65
|
-
if (entryValue === void 0 || entryValue === null) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
const fullPath = parentKey !== "" ? `${parentKey}.${key}` : key;
|
|
69
|
-
result[key] = preserveKeys.has(fullPath) ? entryValue : stripNullish(entryValue, preserveKeys, fullPath);
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
__name(stripNullishRecord, "stripNullishRecord");
|
|
74
|
-
function serializeEventToSnakeCase(event) {
|
|
75
|
-
const snakeEvent = transformToSnakeCaseEvent(event);
|
|
76
|
-
snakeEvent["timestamp"] = event.timestamp / MILLIS_PER_SECOND;
|
|
77
|
-
return stripNullishRecord(snakeEvent, EVENT_PRESERVE_KEYS);
|
|
78
|
-
}
|
|
79
|
-
__name(serializeEventToSnakeCase, "serializeEventToSnakeCase");
|
|
80
|
-
function serializeSessionToSnakeCase(session) {
|
|
81
|
-
return stripNullishRecord(
|
|
82
|
-
{
|
|
83
|
-
id: session.id,
|
|
84
|
-
app_name: session.appName,
|
|
85
|
-
user_id: session.userId,
|
|
86
|
-
state: session.state,
|
|
87
|
-
events: session.events.map((event) => serializeEventToSnakeCase(event)),
|
|
88
|
-
last_update_time: session.lastUpdateTime / MILLIS_PER_SECOND
|
|
89
|
-
},
|
|
90
|
-
SESSION_PRESERVE_KEYS
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
__name(serializeSessionToSnakeCase, "serializeSessionToSnakeCase");
|
|
94
|
-
let RemoteAgent = class extends (_b = BaseAgent, _a = REMOTE_AGENT_SIGNATURE_SYMBOL, _b) {
|
|
95
|
-
constructor(config) {
|
|
96
|
-
var _a2, _b2;
|
|
97
|
-
const runtimeSubAgents = config.subAgents;
|
|
98
|
-
if (Array.isArray(runtimeSubAgents) ? runtimeSubAgents.length > 0 : Boolean(runtimeSubAgents)) {
|
|
99
|
-
throw new Error("subAgents is disabled in RemoteAgent.");
|
|
100
|
-
}
|
|
101
|
-
super({ ...config, subAgents: [] });
|
|
102
|
-
this[_a] = true;
|
|
103
|
-
this.url = config.url;
|
|
104
|
-
this.timeoutMs = (_a2 = config.timeoutMs) != null ? _a2 : DEFAULT_REMOTE_AGENT_TIMEOUT_MS;
|
|
105
|
-
this.fetchImpl = (_b2 = config.fetchImpl) != null ? _b2 : globalThis.fetch;
|
|
106
|
-
}
|
|
107
|
-
async *runAsyncImpl(ctx) {
|
|
108
|
-
var _a2;
|
|
109
|
-
const data = {
|
|
110
|
-
invocation_id: ctx.invocationId,
|
|
111
|
-
session: serializeSessionToSnakeCase(ctx.session)
|
|
112
|
-
};
|
|
113
|
-
const timeoutSignal = AbortSignal.timeout(this.timeoutMs);
|
|
114
|
-
const signal = ctx.abortSignal ? AbortSignal.any([ctx.abortSignal, timeoutSignal]) : timeoutSignal;
|
|
115
|
-
const response = await this.fetchImpl(this.url, {
|
|
116
|
-
method: "POST",
|
|
117
|
-
headers: { "Content-Type": "application/json" },
|
|
118
|
-
body: JSON.stringify(data),
|
|
119
|
-
signal
|
|
120
|
-
});
|
|
121
|
-
if (response.status >= 400) {
|
|
122
|
-
throw new Error(
|
|
123
|
-
`RemoteAgent request to '${this.url}' failed with HTTP status ${response.status}.`
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
const rawEvents = await response.json();
|
|
127
|
-
if (!Array.isArray(rawEvents)) {
|
|
128
|
-
throw new Error(
|
|
129
|
-
`RemoteAgent expected a JSON array of events from '${this.url}'.`
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
for (const rawEvent of rawEvents) {
|
|
133
|
-
if (!isRecord(rawEvent)) {
|
|
134
|
-
throw new Error(
|
|
135
|
-
`RemoteAgent expected each item in the response from '${this.url}' to be a JSON event object.`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
if ((_a2 = ctx.abortSignal) == null ? void 0 : _a2.aborted) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const camelEvent = transformToCamelCaseEvent(rawEvent);
|
|
142
|
-
const invocationId = camelEvent.invocationId !== void 0 && camelEvent.invocationId !== "" ? camelEvent.invocationId : ctx.invocationId;
|
|
143
|
-
const timestamp = typeof camelEvent.timestamp === "number" ? camelEvent.timestamp * MILLIS_PER_SECOND : void 0;
|
|
144
|
-
yield createEvent({
|
|
145
|
-
...camelEvent,
|
|
146
|
-
invocationId,
|
|
147
|
-
timestamp,
|
|
148
|
-
author: this.name
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
async *runLiveImpl(_ctx) {
|
|
153
|
-
yield* [];
|
|
154
|
-
throw new Error("This is not supported yet for RemoteAgent.");
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
__name(RemoteAgent, "RemoteAgent");
|
|
158
|
-
RemoteAgent = __decorateClass([
|
|
159
|
-
experimental
|
|
160
|
-
], RemoteAgent);
|
|
161
|
-
export {
|
|
162
|
-
RemoteAgent,
|
|
163
|
-
isRemoteAgent
|
|
164
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
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, _b;
|
|
11
|
-
import { toJsonSchema } from "../utils/schema.js";
|
|
12
|
-
import { isZodObject, isZodSchema } from "../utils/simple_zod_to_json.js";
|
|
13
|
-
import { GoogleLLMVariant } from "../utils/variant_utils.js";
|
|
14
|
-
import {
|
|
15
|
-
buildFunctionDeclarationForParamsForCrewai,
|
|
16
|
-
FunctionTool
|
|
17
|
-
} from "./function_tool.js";
|
|
18
|
-
const CREWAI_TOOL_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.crewaiTool");
|
|
19
|
-
function isCrewaiTool(obj) {
|
|
20
|
-
return typeof obj === "object" && obj !== null && CREWAI_TOOL_SIGNATURE_SYMBOL in obj && obj[CREWAI_TOOL_SIGNATURE_SYMBOL] === true;
|
|
21
|
-
}
|
|
22
|
-
__name(isCrewaiTool, "isCrewaiTool");
|
|
23
|
-
function isCrewaiToolConfig(value) {
|
|
24
|
-
return typeof value === "object" && value !== null && "tool" in value && typeof value.tool === "object" && value.tool !== null && typeof value.tool.run === "function";
|
|
25
|
-
}
|
|
26
|
-
__name(isCrewaiToolConfig, "isCrewaiToolConfig");
|
|
27
|
-
function normalizeCrewaiSchemaJson(argsSchema) {
|
|
28
|
-
if (!argsSchema) {
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
31
|
-
if (typeof argsSchema.modelJsonSchema === "function") {
|
|
32
|
-
return argsSchema.modelJsonSchema();
|
|
33
|
-
}
|
|
34
|
-
if (typeof argsSchema.jsonSchema === "function") {
|
|
35
|
-
return argsSchema.jsonSchema();
|
|
36
|
-
}
|
|
37
|
-
if (isZodSchema(argsSchema)) {
|
|
38
|
-
const raw = structuredClone(toJsonSchema(argsSchema));
|
|
39
|
-
const requiredSet = new Set(
|
|
40
|
-
Array.isArray(raw["required"]) ? raw["required"] : []
|
|
41
|
-
);
|
|
42
|
-
const properties = raw["properties"];
|
|
43
|
-
if (properties && typeof properties === "object") {
|
|
44
|
-
for (const [key, prop] of Object.entries(properties)) {
|
|
45
|
-
if (!prop || typeof prop !== "object") {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (Array.isArray(prop["type"])) {
|
|
49
|
-
const types = prop["type"];
|
|
50
|
-
delete prop["type"];
|
|
51
|
-
prop["anyOf"] = types.map((t) => ({ type: t }));
|
|
52
|
-
} else if (!requiredSet.has(key) && !("default" in prop) && !("anyOf" in prop) && typeof prop["type"] === "string") {
|
|
53
|
-
const propType = prop["type"];
|
|
54
|
-
delete prop["type"];
|
|
55
|
-
prop["anyOf"] = [{ type: propType }, { type: "null" }];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return raw;
|
|
60
|
-
}
|
|
61
|
-
return structuredClone(argsSchema);
|
|
62
|
-
}
|
|
63
|
-
__name(normalizeCrewaiSchemaJson, "normalizeCrewaiSchemaJson");
|
|
64
|
-
const _CrewaiTool = class _CrewaiTool extends (_b = FunctionTool, _a = CREWAI_TOOL_SIGNATURE_SYMBOL, _b) {
|
|
65
|
-
constructor(toolOrConfig, options) {
|
|
66
|
-
const config = isCrewaiToolConfig(toolOrConfig) ? toolOrConfig : {
|
|
67
|
-
tool: toolOrConfig,
|
|
68
|
-
name: options == null ? void 0 : options.name,
|
|
69
|
-
description: options == null ? void 0 : options.description
|
|
70
|
-
};
|
|
71
|
-
const resolvedName = config.name || (config.tool.name ? config.tool.name.replace(/ /g, "_").toLowerCase() : config.tool.run.name || "crewai_tool");
|
|
72
|
-
const resolvedDescription = config.description || config.tool.description || "";
|
|
73
|
-
super({
|
|
74
|
-
name: resolvedName,
|
|
75
|
-
description: resolvedDescription,
|
|
76
|
-
parameters: isZodObject(config.tool.argsSchema) ? config.tool.argsSchema : void 0,
|
|
77
|
-
execute: /* @__PURE__ */ __name(async (args, toolContext) => {
|
|
78
|
-
return await config.tool.run(
|
|
79
|
-
args != null ? args : {},
|
|
80
|
-
toolContext
|
|
81
|
-
);
|
|
82
|
-
}, "execute")
|
|
83
|
-
});
|
|
84
|
-
/** A unique symbol to identify ADK CrewaiTool class. */
|
|
85
|
-
this[_a] = true;
|
|
86
|
-
this.tool = config.tool;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Builds the `FunctionDeclaration` for the wrapped CrewAI tool.
|
|
90
|
-
*/
|
|
91
|
-
_getDeclaration() {
|
|
92
|
-
const schemaJson = normalizeCrewaiSchemaJson(this.tool.argsSchema);
|
|
93
|
-
return buildFunctionDeclarationForParamsForCrewai(
|
|
94
|
-
this.apiVariant === GoogleLLMVariant.VERTEX_AI,
|
|
95
|
-
this.name,
|
|
96
|
-
this.description,
|
|
97
|
-
this.tool.run,
|
|
98
|
-
schemaJson
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
__name(_CrewaiTool, "CrewaiTool");
|
|
103
|
-
let CrewaiTool = _CrewaiTool;
|
|
104
|
-
export {
|
|
105
|
-
CrewaiTool,
|
|
106
|
-
isCrewaiTool
|
|
107
|
-
};
|