@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,188 +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 * as fs from "node:fs";
|
|
21
|
-
import * as path from "node:path";
|
|
22
|
-
import { experimental } from "../../utils/experimental.js";
|
|
23
|
-
import { BaseToolset } from "../base_toolset.js";
|
|
24
|
-
import { OpenAPIToolset } from "../openapi_tool/openapi_toolset.js";
|
|
25
|
-
import { GoogleApiTool, isGoogleApiTool } from "./google_api_tool.js";
|
|
26
|
-
import { GoogleApiToOpenApiConverter } from "./googleapi_to_openapi_converter.js";
|
|
27
|
-
const GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
28
|
-
"google.adk.googleApiToolSet"
|
|
29
|
-
);
|
|
30
|
-
const GOOGLE_OIDC_AUTH_ENDPOINT = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
31
|
-
const GOOGLE_OIDC_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
|
|
32
|
-
const GOOGLE_OIDC_USERINFO_ENDPOINT = "https://openidconnect.googleapis.com/v1/userinfo";
|
|
33
|
-
const GOOGLE_OIDC_REVOCATION_ENDPOINT = "https://oauth2.googleapis.com/revoke";
|
|
34
|
-
function isGoogleApiToolSet(obj) {
|
|
35
|
-
return typeof obj === "object" && obj !== null && GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL in obj && obj[GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL] === true;
|
|
36
|
-
}
|
|
37
|
-
__name(isGoogleApiToolSet, "isGoogleApiToolSet");
|
|
38
|
-
let GoogleApiToolSet = class extends (_b = BaseToolset, _a = GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL, _b) {
|
|
39
|
-
constructor(tools, options = {}) {
|
|
40
|
-
var _a2;
|
|
41
|
-
super((_a2 = options.toolFilter) != null ? _a2 : []);
|
|
42
|
-
this[_a] = true;
|
|
43
|
-
this.apiName = options.apiName;
|
|
44
|
-
this.apiVersion = options.apiVersion;
|
|
45
|
-
if (tools !== void 0) {
|
|
46
|
-
this.tools = tools.map(
|
|
47
|
-
(tool) => isGoogleApiTool(tool) ? tool : new GoogleApiTool(tool)
|
|
48
|
-
);
|
|
49
|
-
this.toolsLoaded = true;
|
|
50
|
-
} else {
|
|
51
|
-
this.tools = [];
|
|
52
|
-
this.toolsLoaded = false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async ensureToolsLoaded() {
|
|
56
|
-
if (this.toolsLoaded || !this.apiName || !this.apiVersion) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (!this.loadingPromise) {
|
|
60
|
-
const apiName = this.apiName;
|
|
61
|
-
const apiVersion = this.apiVersion;
|
|
62
|
-
this.loadingPromise = (async () => {
|
|
63
|
-
try {
|
|
64
|
-
const loaded = await GoogleApiToolSet.loadToolSet(
|
|
65
|
-
apiName,
|
|
66
|
-
apiVersion
|
|
67
|
-
);
|
|
68
|
-
this.tools = loaded.tools;
|
|
69
|
-
if (this.pendingAuth) {
|
|
70
|
-
for (const tool of this.tools) {
|
|
71
|
-
tool.configureAuth(
|
|
72
|
-
this.pendingAuth.clientId,
|
|
73
|
-
this.pendingAuth.clientSecret
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
this.toolsLoaded = true;
|
|
78
|
-
} finally {
|
|
79
|
-
this.loadingPromise = void 0;
|
|
80
|
-
}
|
|
81
|
-
})();
|
|
82
|
-
}
|
|
83
|
-
await this.loadingPromise;
|
|
84
|
-
}
|
|
85
|
-
async getTools(context) {
|
|
86
|
-
await this.ensureToolsLoaded();
|
|
87
|
-
return this.tools.filter(
|
|
88
|
-
(tool) => this.isToolSelected(tool, context)
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
async getTool(toolName) {
|
|
92
|
-
await this.ensureToolsLoaded();
|
|
93
|
-
return this.tools.find((tool) => tool.name === toolName);
|
|
94
|
-
}
|
|
95
|
-
configureAuth(clientId, clientSecret) {
|
|
96
|
-
this.pendingAuth = { clientId, clientSecret };
|
|
97
|
-
for (const tool of this.tools) {
|
|
98
|
-
tool.configureAuth(clientId, clientSecret);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async close() {
|
|
102
|
-
return Promise.resolve();
|
|
103
|
-
}
|
|
104
|
-
static loadToolSetWithOidcAuth(options = {}) {
|
|
105
|
-
var _a2;
|
|
106
|
-
let specStr;
|
|
107
|
-
if (options.specFile) {
|
|
108
|
-
const dir = (_a2 = options.callerDir) != null ? _a2 : process.cwd();
|
|
109
|
-
const yamlPath = path.isAbsolute(options.specFile) ? options.specFile : path.join(dir, options.specFile);
|
|
110
|
-
specStr = fs.readFileSync(yamlPath, "utf-8");
|
|
111
|
-
}
|
|
112
|
-
const authScheme = {
|
|
113
|
-
type: "openIdConnect",
|
|
114
|
-
openIdConnectUrl: "",
|
|
115
|
-
authorizationEndpoint: GOOGLE_OIDC_AUTH_ENDPOINT,
|
|
116
|
-
tokenEndpoint: GOOGLE_OIDC_TOKEN_ENDPOINT,
|
|
117
|
-
userinfoEndpoint: GOOGLE_OIDC_USERINFO_ENDPOINT,
|
|
118
|
-
revocationEndpoint: GOOGLE_OIDC_REVOCATION_ENDPOINT,
|
|
119
|
-
tokenEndpointAuthMethodsSupported: [
|
|
120
|
-
"client_secret_post",
|
|
121
|
-
"client_secret_basic"
|
|
122
|
-
],
|
|
123
|
-
grantTypesSupported: ["authorization_code"],
|
|
124
|
-
scopes: options.scopes
|
|
125
|
-
};
|
|
126
|
-
return new OpenAPIToolset({
|
|
127
|
-
specDict: options.specDict,
|
|
128
|
-
specStr,
|
|
129
|
-
specType: "yaml",
|
|
130
|
-
authScheme
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
static async loadToolSet(apiName, apiVersion) {
|
|
134
|
-
var _a2, _b2, _c, _d, _e;
|
|
135
|
-
const specDict = await new GoogleApiToOpenApiConverter(
|
|
136
|
-
apiName,
|
|
137
|
-
apiVersion
|
|
138
|
-
).convert();
|
|
139
|
-
const oauth2Scheme = (_b2 = (_a2 = specDict.components) == null ? void 0 : _a2.securitySchemes) == null ? void 0 : _b2["oauth2"];
|
|
140
|
-
const scopesMap = (_e = (_d = (_c = oauth2Scheme == null ? void 0 : oauth2Scheme.flows) == null ? void 0 : _c.authorizationCode) == null ? void 0 : _d.scopes) != null ? _e : {};
|
|
141
|
-
const firstScope = Object.keys(scopesMap)[0];
|
|
142
|
-
const scopes = firstScope ? [firstScope] : void 0;
|
|
143
|
-
const openapiToolset = this.loadToolSetWithOidcAuth({
|
|
144
|
-
specDict,
|
|
145
|
-
scopes
|
|
146
|
-
});
|
|
147
|
-
const tools = await openapiToolset.getTools();
|
|
148
|
-
return new this(tools, { apiName, apiVersion });
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
__name(GoogleApiToolSet, "GoogleApiToolSet");
|
|
152
|
-
__decorateClass([
|
|
153
|
-
experimental
|
|
154
|
-
], GoogleApiToolSet.prototype, "getTools", 1);
|
|
155
|
-
__decorateClass([
|
|
156
|
-
experimental
|
|
157
|
-
], GoogleApiToolSet.prototype, "getTool", 1);
|
|
158
|
-
__decorateClass([
|
|
159
|
-
experimental
|
|
160
|
-
], GoogleApiToolSet.prototype, "configureAuth", 1);
|
|
161
|
-
__decorateClass([
|
|
162
|
-
experimental
|
|
163
|
-
], GoogleApiToolSet.prototype, "close", 1);
|
|
164
|
-
__decorateClass([
|
|
165
|
-
experimental
|
|
166
|
-
], GoogleApiToolSet, "loadToolSetWithOidcAuth", 1);
|
|
167
|
-
__decorateClass([
|
|
168
|
-
experimental
|
|
169
|
-
], GoogleApiToolSet, "loadToolSet", 1);
|
|
170
|
-
GoogleApiToolSet = __decorateClass([
|
|
171
|
-
experimental
|
|
172
|
-
], GoogleApiToolSet);
|
|
173
|
-
function createLazyGoogleApiToolSet(apiName, apiVersion) {
|
|
174
|
-
const BaseConstructor = Object.getPrototypeOf(
|
|
175
|
-
GoogleApiToolSet
|
|
176
|
-
);
|
|
177
|
-
return Reflect.construct(
|
|
178
|
-
BaseConstructor,
|
|
179
|
-
[void 0, { apiName, apiVersion }],
|
|
180
|
-
GoogleApiToolSet
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
__name(createLazyGoogleApiToolSet, "createLazyGoogleApiToolSet");
|
|
184
|
-
export {
|
|
185
|
-
GoogleApiToolSet,
|
|
186
|
-
createLazyGoogleApiToolSet,
|
|
187
|
-
isGoogleApiToolSet
|
|
188
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
-
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright 2026 Google LLC
|
|
6
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
-
*/
|
|
8
|
-
import { createLazyGoogleApiToolSet } from "./google_api_tool_set.js";
|
|
9
|
-
const calendarToolSet = createLazyGoogleApiToolSet("calendar", "v3");
|
|
10
|
-
const bigqueryToolSet = createLazyGoogleApiToolSet("bigquery", "v2");
|
|
11
|
-
const gmailToolSet = createLazyGoogleApiToolSet("gmail", "v1");
|
|
12
|
-
const youtubeToolSet = createLazyGoogleApiToolSet("youtube", "v3");
|
|
13
|
-
const slidesToolSet = createLazyGoogleApiToolSet("slides", "v1");
|
|
14
|
-
const sheetsToolSet = createLazyGoogleApiToolSet("sheets", "v4");
|
|
15
|
-
const docsToolSet = createLazyGoogleApiToolSet("docs", "v1");
|
|
16
|
-
export {
|
|
17
|
-
bigqueryToolSet,
|
|
18
|
-
calendarToolSet,
|
|
19
|
-
docsToolSet,
|
|
20
|
-
gmailToolSet,
|
|
21
|
-
sheetsToolSet,
|
|
22
|
-
slidesToolSet,
|
|
23
|
-
youtubeToolSet
|
|
24
|
-
};
|
|
@@ -1,148 +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
|
-
buildFunctionDeclarationForLangchain,
|
|
16
|
-
buildFunctionDeclarationUtil,
|
|
17
|
-
FunctionTool
|
|
18
|
-
} from "./function_tool.js";
|
|
19
|
-
const LANGCHAIN_TOOL_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.langchainTool");
|
|
20
|
-
function isLangchainTool(obj) {
|
|
21
|
-
return typeof obj === "object" && obj !== null && LANGCHAIN_TOOL_SIGNATURE_SYMBOL in obj && obj[LANGCHAIN_TOOL_SIGNATURE_SYMBOL] === true;
|
|
22
|
-
}
|
|
23
|
-
__name(isLangchainTool, "isLangchainTool");
|
|
24
|
-
function isLangchainToolConfig(value) {
|
|
25
|
-
return typeof value === "object" && value !== null && "tool" in value && typeof value.tool === "object" && value.tool !== null;
|
|
26
|
-
}
|
|
27
|
-
__name(isLangchainToolConfig, "isLangchainToolConfig");
|
|
28
|
-
function resolveRunnerFunction(tool) {
|
|
29
|
-
if (typeof tool._run === "function") {
|
|
30
|
-
return tool._run.bind(tool);
|
|
31
|
-
}
|
|
32
|
-
if (typeof tool._call === "function") {
|
|
33
|
-
return tool._call.bind(tool);
|
|
34
|
-
}
|
|
35
|
-
if (typeof tool.invoke === "function") {
|
|
36
|
-
return tool.invoke.bind(tool);
|
|
37
|
-
}
|
|
38
|
-
if (typeof tool.run === "function") {
|
|
39
|
-
return tool.run.bind(tool);
|
|
40
|
-
}
|
|
41
|
-
throw new TypeError(
|
|
42
|
-
"LangchainTool requires a tool object with a _run, _call, invoke, or run method."
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
__name(resolveRunnerFunction, "resolveRunnerFunction");
|
|
46
|
-
function isStructuredLangchainTool(tool) {
|
|
47
|
-
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;
|
|
48
|
-
}
|
|
49
|
-
__name(isStructuredLangchainTool, "isStructuredLangchainTool");
|
|
50
|
-
function extractLangchainPropertiesMap(tool) {
|
|
51
|
-
var _a2;
|
|
52
|
-
if (tool.args && typeof tool.args === "object") {
|
|
53
|
-
return structuredClone(tool.args);
|
|
54
|
-
}
|
|
55
|
-
const schemaSource = (_a2 = tool.argsSchema) != null ? _a2 : tool.schema;
|
|
56
|
-
if (!schemaSource) {
|
|
57
|
-
return {};
|
|
58
|
-
}
|
|
59
|
-
let rawSchema;
|
|
60
|
-
if (typeof schemaSource.modelJsonSchema === "function") {
|
|
61
|
-
rawSchema = schemaSource.modelJsonSchema();
|
|
62
|
-
} else if (typeof schemaSource.jsonSchema === "function") {
|
|
63
|
-
rawSchema = schemaSource.jsonSchema();
|
|
64
|
-
} else if (isZodSchema(schemaSource)) {
|
|
65
|
-
rawSchema = structuredClone(toJsonSchema(schemaSource));
|
|
66
|
-
} else {
|
|
67
|
-
rawSchema = structuredClone(schemaSource);
|
|
68
|
-
}
|
|
69
|
-
const properties = rawSchema["properties"] && typeof rawSchema["properties"] === "object" ? structuredClone(
|
|
70
|
-
rawSchema["properties"]
|
|
71
|
-
) : structuredClone(rawSchema);
|
|
72
|
-
const requiredSet = Array.isArray(rawSchema["required"]) ? new Set(rawSchema["required"]) : void 0;
|
|
73
|
-
for (const [key, prop] of Object.entries(properties)) {
|
|
74
|
-
if (!prop || typeof prop !== "object") {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (Array.isArray(prop["type"])) {
|
|
78
|
-
const types = prop["type"];
|
|
79
|
-
delete prop["type"];
|
|
80
|
-
prop["anyOf"] = types.map((t) => ({ type: t }));
|
|
81
|
-
} else if (requiredSet !== void 0 && !requiredSet.has(key) && !("default" in prop) && !("anyOf" in prop) && typeof prop["type"] === "string") {
|
|
82
|
-
const propType = prop["type"];
|
|
83
|
-
delete prop["type"];
|
|
84
|
-
prop["anyOf"] = [{ type: propType }, { type: "null" }];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return properties;
|
|
88
|
-
}
|
|
89
|
-
__name(extractLangchainPropertiesMap, "extractLangchainPropertiesMap");
|
|
90
|
-
const _LangchainTool = class _LangchainTool extends (_b = FunctionTool, _a = LANGCHAIN_TOOL_SIGNATURE_SYMBOL, _b) {
|
|
91
|
-
constructor(toolOrConfig, options) {
|
|
92
|
-
var _a2, _b2, _c, _d;
|
|
93
|
-
const config = isLangchainToolConfig(toolOrConfig) ? toolOrConfig : {
|
|
94
|
-
tool: toolOrConfig,
|
|
95
|
-
name: options == null ? void 0 : options.name,
|
|
96
|
-
description: options == null ? void 0 : options.description
|
|
97
|
-
};
|
|
98
|
-
const runnerFn = resolveRunnerFunction(config.tool);
|
|
99
|
-
const rawFn = (_c = (_b2 = (_a2 = config.tool._run) != null ? _a2 : config.tool._call) != null ? _b2 : config.tool.invoke) != null ? _c : config.tool.run;
|
|
100
|
-
const resolvedName = config.name || config.tool.name || (rawFn == null ? void 0 : rawFn.name) || "langchain_tool";
|
|
101
|
-
const resolvedDescription = config.description || config.tool.description || "";
|
|
102
|
-
const schemaCandidate = (_d = config.tool.argsSchema) != null ? _d : config.tool.schema;
|
|
103
|
-
super({
|
|
104
|
-
name: resolvedName,
|
|
105
|
-
description: resolvedDescription,
|
|
106
|
-
parameters: isZodObject(schemaCandidate) ? schemaCandidate : void 0,
|
|
107
|
-
execute: /* @__PURE__ */ __name(async (args, toolContext) => {
|
|
108
|
-
return await runnerFn(
|
|
109
|
-
args != null ? args : {},
|
|
110
|
-
toolContext
|
|
111
|
-
);
|
|
112
|
-
}, "execute")
|
|
113
|
-
});
|
|
114
|
-
/** A unique symbol to identify ADK LangchainTool class. */
|
|
115
|
-
this[_a] = true;
|
|
116
|
-
this.tool = config.tool;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Builds the `FunctionDeclaration` for the wrapped LangChain tool.
|
|
120
|
-
*/
|
|
121
|
-
_getDeclaration() {
|
|
122
|
-
var _a2, _b2, _c;
|
|
123
|
-
if (isStructuredLangchainTool(this.tool)) {
|
|
124
|
-
const propertiesMap = extractLangchainPropertiesMap(this.tool);
|
|
125
|
-
const rawFn = (_c = (_b2 = (_a2 = this.tool._run) != null ? _a2 : this.tool._call) != null ? _b2 : this.tool.invoke) != null ? _c : this.tool.run;
|
|
126
|
-
return buildFunctionDeclarationForLangchain(
|
|
127
|
-
this.apiVariant === GoogleLLMVariant.VERTEX_AI,
|
|
128
|
-
this.name,
|
|
129
|
-
this.description,
|
|
130
|
-
rawFn,
|
|
131
|
-
propertiesMap
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
return buildFunctionDeclarationUtil(
|
|
135
|
-
this.apiVariant === GoogleLLMVariant.VERTEX_AI,
|
|
136
|
-
this.name,
|
|
137
|
-
this.description,
|
|
138
|
-
this.tool.run,
|
|
139
|
-
{ properties: extractLangchainPropertiesMap(this.tool) }
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
__name(_LangchainTool, "LangchainTool");
|
|
144
|
-
let LangchainTool = _LangchainTool;
|
|
145
|
-
export {
|
|
146
|
-
LangchainTool,
|
|
147
|
-
isLangchainTool
|
|
148
|
-
};
|
|
@@ -1,80 +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;
|
|
11
|
-
import { LangchainTool } from "./langchain_tool.js";
|
|
12
|
-
const TOOLBOX_TOOL_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.toolboxTool");
|
|
13
|
-
function isToolboxTool(obj) {
|
|
14
|
-
return typeof obj === "object" && obj !== null && TOOLBOX_TOOL_SIGNATURE_SYMBOL in obj && obj[TOOLBOX_TOOL_SIGNATURE_SYMBOL] === true;
|
|
15
|
-
}
|
|
16
|
-
__name(isToolboxTool, "isToolboxTool");
|
|
17
|
-
function createUnconfiguredToolboxClient(url) {
|
|
18
|
-
const endpoint = url != null ? url : "unspecified URL";
|
|
19
|
-
const throwMissingClient = /* @__PURE__ */ __name(() => {
|
|
20
|
-
throw new Error(
|
|
21
|
-
`ToolboxTool requires a ToolboxClientLike instance (for endpoint "${endpoint}"). Pass {url, client} to the ToolboxTool constructor.`
|
|
22
|
-
);
|
|
23
|
-
}, "throwMissingClient");
|
|
24
|
-
return {
|
|
25
|
-
loadTool: throwMissingClient,
|
|
26
|
-
loadToolset: throwMissingClient
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
__name(createUnconfiguredToolboxClient, "createUnconfiguredToolboxClient");
|
|
30
|
-
_a = TOOLBOX_TOOL_SIGNATURE_SYMBOL;
|
|
31
|
-
const _ToolboxTool = class _ToolboxTool {
|
|
32
|
-
constructor(urlOrOptions) {
|
|
33
|
-
/** A unique symbol to identify ADK ToolboxTool class. */
|
|
34
|
-
this[_a] = true;
|
|
35
|
-
var _a2;
|
|
36
|
-
if (typeof urlOrOptions === "string") {
|
|
37
|
-
this.url = urlOrOptions;
|
|
38
|
-
this.toolboxClient = createUnconfiguredToolboxClient(urlOrOptions);
|
|
39
|
-
} else {
|
|
40
|
-
this.url = urlOrOptions.url;
|
|
41
|
-
this.toolboxClient = (_a2 = urlOrOptions.client) != null ? _a2 : createUnconfiguredToolboxClient(urlOrOptions.url);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Loads a single tool from the Toolbox client and wraps it in a
|
|
46
|
-
* {@link LangchainTool}.
|
|
47
|
-
*/
|
|
48
|
-
getTool(toolName) {
|
|
49
|
-
var _a2, _b, _c;
|
|
50
|
-
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);
|
|
51
|
-
if (!loader) {
|
|
52
|
-
throw new Error(
|
|
53
|
-
"ToolboxClient does not implement loadTool or load_tool."
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
const tool = loader(toolName);
|
|
57
|
-
return new LangchainTool(tool);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Loads a toolset from the Toolbox client and wraps each tool in a
|
|
61
|
-
* {@link LangchainTool}.
|
|
62
|
-
*/
|
|
63
|
-
getToolset(toolsetName) {
|
|
64
|
-
var _a2, _b, _c;
|
|
65
|
-
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);
|
|
66
|
-
if (!loader) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
"ToolboxClient does not implement loadToolset or load_toolset."
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
const tools = loader(toolsetName);
|
|
72
|
-
return tools.map((tool) => new LangchainTool(tool));
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
__name(_ToolboxTool, "ToolboxTool");
|
|
76
|
-
let ToolboxTool = _ToolboxTool;
|
|
77
|
-
export {
|
|
78
|
-
ToolboxTool,
|
|
79
|
-
isToolboxTool
|
|
80
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { Event } from '../events/event.js';
|
|
7
|
-
import { BaseAgent, BaseAgentConfig } from './base_agent.js';
|
|
8
|
-
import { InvocationContext } from './invocation_context.js';
|
|
9
|
-
/**
|
|
10
|
-
* Custom `fetch` function signature accepted by {@link RemoteAgentConfig.fetchImpl}.
|
|
11
|
-
*/
|
|
12
|
-
export type RemoteAgentFetch = typeof fetch;
|
|
13
|
-
/**
|
|
14
|
-
* Configuration options for {@link RemoteAgent}.
|
|
15
|
-
*/
|
|
16
|
-
export interface RemoteAgentConfig extends BaseAgentConfig {
|
|
17
|
-
/**
|
|
18
|
-
* Remote HTTP endpoint URL that accepts an invocation payload and returns a JSON array of events.
|
|
19
|
-
*/
|
|
20
|
-
url: string;
|
|
21
|
-
/**
|
|
22
|
-
* Request timeout in milliseconds; defaults to `120_000` (120 seconds).
|
|
23
|
-
*/
|
|
24
|
-
timeoutMs?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Optional custom `fetch` implementation used for HTTP requests.
|
|
27
|
-
*/
|
|
28
|
-
fetchImpl?: RemoteAgentFetch;
|
|
29
|
-
/**
|
|
30
|
-
* Sub-agents are disabled on {@link RemoteAgent}.
|
|
31
|
-
*/
|
|
32
|
-
subAgents?: never;
|
|
33
|
-
}
|
|
34
|
-
declare const REMOTE_AGENT_SIGNATURE_SYMBOL: unique symbol;
|
|
35
|
-
/**
|
|
36
|
-
* Type guard to check if an object is an instance of {@link RemoteAgent}.
|
|
37
|
-
*
|
|
38
|
-
* @param obj The object to check.
|
|
39
|
-
* @returns True if the object is an instance of {@link RemoteAgent}.
|
|
40
|
-
*/
|
|
41
|
-
export declare function isRemoteAgent(obj: unknown): obj is RemoteAgent;
|
|
42
|
-
/**
|
|
43
|
-
* Experimental agent that forwards invocation context and session state to a
|
|
44
|
-
* remote HTTP endpoint.
|
|
45
|
-
*
|
|
46
|
-
* Trust assumption: returned event payloads (including `id`, `timestamp`, and
|
|
47
|
-
* `actions` such as `stateDelta`, `artifactDelta`, `transferToAgent`, and
|
|
48
|
-
* `escalate`) are deserialized via `transformToCamelCaseEvent` and passed
|
|
49
|
-
* to {@link createEvent} without schema or authorization filtering; only
|
|
50
|
-
* `author` is overwritten with this agent's `name`. Configure `url` only with a
|
|
51
|
-
* trusted remote endpoint.
|
|
52
|
-
*/
|
|
53
|
-
export declare class RemoteAgent extends BaseAgent<RemoteAgentConfig> {
|
|
54
|
-
readonly [REMOTE_AGENT_SIGNATURE_SYMBOL] = true;
|
|
55
|
-
/**
|
|
56
|
-
* Remote HTTP endpoint URL.
|
|
57
|
-
*/
|
|
58
|
-
readonly url: string;
|
|
59
|
-
/**
|
|
60
|
-
* Request timeout in milliseconds.
|
|
61
|
-
*/
|
|
62
|
-
readonly timeoutMs: number;
|
|
63
|
-
private readonly fetchImpl;
|
|
64
|
-
constructor(config: RemoteAgentConfig);
|
|
65
|
-
protected runAsyncImpl(ctx: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
66
|
-
protected runLiveImpl(_ctx: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
67
|
-
}
|
|
68
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
-
import { Context } from '../agents/context.js';
|
|
8
|
-
import { SchemaLike } from '../utils/schema.js';
|
|
9
|
-
import { FunctionTool, ToolInputParameters } from './function_tool.js';
|
|
10
|
-
/**
|
|
11
|
-
* Schema formats accepted on a wrapped CrewAI tool.
|
|
12
|
-
*/
|
|
13
|
-
export type CrewaiSchemaLike = SchemaLike | {
|
|
14
|
-
jsonSchema: () => Record<string, unknown>;
|
|
15
|
-
} | {
|
|
16
|
-
modelJsonSchema: () => Record<string, unknown>;
|
|
17
|
-
} | Record<string, unknown>;
|
|
18
|
-
/**
|
|
19
|
-
* Structural interface for a CrewAI tool instance.
|
|
20
|
-
*/
|
|
21
|
-
export interface CrewaiToolLike {
|
|
22
|
-
/**
|
|
23
|
-
* The name of the CrewAI tool.
|
|
24
|
-
*/
|
|
25
|
-
name?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The description of the CrewAI tool.
|
|
28
|
-
*/
|
|
29
|
-
description?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Optional parameters schema for the tool.
|
|
32
|
-
*/
|
|
33
|
-
argsSchema?: CrewaiSchemaLike;
|
|
34
|
-
/**
|
|
35
|
-
* Executes the CrewAI tool with the given arguments.
|
|
36
|
-
*/
|
|
37
|
-
run(args: Record<string, unknown>, toolContext?: Context): unknown | Promise<unknown>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Configuration options for {@link CrewaiTool}.
|
|
41
|
-
*/
|
|
42
|
-
export interface CrewaiToolConfig {
|
|
43
|
-
/**
|
|
44
|
-
* The wrapped CrewAI tool instance.
|
|
45
|
-
*/
|
|
46
|
-
tool: CrewaiToolLike;
|
|
47
|
-
/**
|
|
48
|
-
* Optional custom name override. When omitted or empty, defaults to
|
|
49
|
-
* `tool.name` with spaces replaced by underscores and lowercased.
|
|
50
|
-
*/
|
|
51
|
-
name?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Optional custom description override. When omitted or empty, defaults to
|
|
54
|
-
* `tool.description`.
|
|
55
|
-
*/
|
|
56
|
-
description?: string;
|
|
57
|
-
}
|
|
58
|
-
declare const CREWAI_TOOL_SIGNATURE_SYMBOL: unique symbol;
|
|
59
|
-
/**
|
|
60
|
-
* Type guard to check if an object is an instance of {@link CrewaiTool}.
|
|
61
|
-
*/
|
|
62
|
-
export declare function isCrewaiTool(obj: unknown): obj is CrewaiTool;
|
|
63
|
-
/**
|
|
64
|
-
* Wrapper class that adapts a CrewAI tool for use in ADK.
|
|
65
|
-
*
|
|
66
|
-
* If the original tool name and description are not suitable, you can override
|
|
67
|
-
* them in the constructor.
|
|
68
|
-
*/
|
|
69
|
-
export declare class CrewaiTool extends FunctionTool<ToolInputParameters> {
|
|
70
|
-
/** A unique symbol to identify ADK CrewaiTool class. */
|
|
71
|
-
readonly [CREWAI_TOOL_SIGNATURE_SYMBOL] = true;
|
|
72
|
-
/**
|
|
73
|
-
* The wrapped CrewAI tool.
|
|
74
|
-
*/
|
|
75
|
-
readonly tool: CrewaiToolLike;
|
|
76
|
-
constructor(toolOrConfig: CrewaiToolConfig | CrewaiToolLike, options?: {
|
|
77
|
-
name?: string;
|
|
78
|
-
description?: string;
|
|
79
|
-
});
|
|
80
|
-
/**
|
|
81
|
-
* Builds the `FunctionDeclaration` for the wrapped CrewAI tool.
|
|
82
|
-
*/
|
|
83
|
-
_getDeclaration(): FunctionDeclaration;
|
|
84
|
-
}
|
|
85
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { OpenAPIV3 } from 'openapi-types';
|
|
7
|
-
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
8
|
-
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
9
|
-
import { OpenAPIToolset } from '../openapi_tool/openapi_toolset.js';
|
|
10
|
-
import { RestApiTool } from '../openapi_tool/rest_api_tool.js';
|
|
11
|
-
import { GoogleApiTool } from './google_api_tool.js';
|
|
12
|
-
declare const GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL: unique symbol;
|
|
13
|
-
/**
|
|
14
|
-
* Options for constructing a {@link GoogleApiToolSet}.
|
|
15
|
-
*/
|
|
16
|
-
export interface GoogleApiToolSetOptions {
|
|
17
|
-
apiName?: string;
|
|
18
|
-
apiVersion?: string;
|
|
19
|
-
toolFilter?: ToolPredicate | string[];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Options for loading an {@link OpenAPIToolset} pre-configured with Google
|
|
23
|
-
* OpenID Connect endpoints.
|
|
24
|
-
*/
|
|
25
|
-
export interface LoadToolSetWithOidcAuthOptions {
|
|
26
|
-
specFile?: string;
|
|
27
|
-
specDict?: OpenAPIV3.Document;
|
|
28
|
-
scopes?: string[];
|
|
29
|
-
callerDir?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Type guard to check if an object is an instance of {@link GoogleApiToolSet}.
|
|
33
|
-
*/
|
|
34
|
-
export declare function isGoogleApiToolSet(obj: unknown): obj is GoogleApiToolSet;
|
|
35
|
-
/**
|
|
36
|
-
* Toolset that wraps Google Discovery API operations as {@link GoogleApiTool}
|
|
37
|
-
* instances configured for Google OpenID Connect authentication.
|
|
38
|
-
*/
|
|
39
|
-
export declare class GoogleApiToolSet extends BaseToolset {
|
|
40
|
-
readonly [GOOGLE_API_TOOL_SET_SIGNATURE_SYMBOL] = true;
|
|
41
|
-
readonly apiName?: string;
|
|
42
|
-
readonly apiVersion?: string;
|
|
43
|
-
private tools;
|
|
44
|
-
private toolsLoaded;
|
|
45
|
-
private loadingPromise?;
|
|
46
|
-
private pendingAuth?;
|
|
47
|
-
constructor(tools?: Array<RestApiTool | GoogleApiTool>, options?: GoogleApiToolSetOptions);
|
|
48
|
-
private ensureToolsLoaded;
|
|
49
|
-
/**
|
|
50
|
-
* Returns all tools in the toolset matching the active `toolFilter`.
|
|
51
|
-
*/
|
|
52
|
-
getTools(context?: ReadonlyContext): Promise<GoogleApiTool[]>;
|
|
53
|
-
/**
|
|
54
|
-
* Finds a tool in the toolset by name.
|
|
55
|
-
*/
|
|
56
|
-
getTool(toolName: string): Promise<GoogleApiTool | undefined>;
|
|
57
|
-
/**
|
|
58
|
-
* Configures OAuth2 client ID and secret across all tools in the toolset.
|
|
59
|
-
*/
|
|
60
|
-
configureAuth(clientId: string, clientSecret: string): void;
|
|
61
|
-
close(): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Builds an {@link OpenAPIToolset} from an OpenAPI specification dictionary
|
|
64
|
-
* or YAML/JSON file and configures it with Google's OpenID Connect endpoints.
|
|
65
|
-
*/
|
|
66
|
-
static loadToolSetWithOidcAuth(options?: LoadToolSetWithOidcAuthOptions): OpenAPIToolset;
|
|
67
|
-
/**
|
|
68
|
-
* Fetches and converts a Google API Discovery document and returns a
|
|
69
|
-
* {@link GoogleApiToolSet} containing its operations.
|
|
70
|
-
*/
|
|
71
|
-
static loadToolSet(apiName: string, apiVersion: string): Promise<GoogleApiToolSet>;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Creates a lazy-loaded {@link GoogleApiToolSet} singleton without triggering
|
|
75
|
-
* the `@experimental` class constructor warning at module import time.
|
|
76
|
-
*/
|
|
77
|
-
export declare function createLazyGoogleApiToolSet(apiName: string, apiVersion: string): GoogleApiToolSet;
|
|
78
|
-
export {};
|