@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
|
@@ -214,55 +214,48 @@ function connectorPayload(jsonSchema) {
|
|
|
214
214
|
}
|
|
215
215
|
__name(connectorPayload, "connectorPayload");
|
|
216
216
|
function postOperation(options) {
|
|
217
|
-
const {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
217
|
+
const {
|
|
218
|
+
summary,
|
|
219
|
+
description,
|
|
220
|
+
operationId,
|
|
221
|
+
xOperation,
|
|
222
|
+
xEntity,
|
|
223
|
+
xAction,
|
|
224
|
+
requestSchemaRef,
|
|
225
|
+
responseSchema
|
|
226
|
+
} = options;
|
|
227
|
+
const post = {
|
|
228
|
+
summary,
|
|
229
|
+
description,
|
|
230
|
+
operationId,
|
|
231
|
+
"x-operation": xOperation,
|
|
232
|
+
requestBody: {
|
|
233
|
+
content: {
|
|
234
|
+
"application/json": {
|
|
235
|
+
schema: { $ref: requestSchemaRef }
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
responses: {
|
|
240
|
+
"200": {
|
|
241
|
+
description: "Success response",
|
|
224
242
|
content: {
|
|
225
243
|
"application/json": {
|
|
226
|
-
schema:
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
responses: {
|
|
231
|
-
"200": {
|
|
232
|
-
description: "Success response",
|
|
233
|
-
content: {
|
|
234
|
-
"application/json": {
|
|
235
|
-
schema: responseSchema
|
|
236
|
-
}
|
|
244
|
+
schema: responseSchema
|
|
237
245
|
}
|
|
238
246
|
}
|
|
239
247
|
}
|
|
240
248
|
}
|
|
241
249
|
};
|
|
250
|
+
if (xEntity !== void 0) {
|
|
251
|
+
post["x-entity"] = xEntity;
|
|
252
|
+
}
|
|
253
|
+
if (xAction !== void 0) {
|
|
254
|
+
post["x-action"] = xAction;
|
|
255
|
+
}
|
|
256
|
+
return { post };
|
|
242
257
|
}
|
|
243
258
|
__name(postOperation, "postOperation");
|
|
244
|
-
function entityIdRequest() {
|
|
245
|
-
return {
|
|
246
|
-
type: "object",
|
|
247
|
-
required: [
|
|
248
|
-
"entityId",
|
|
249
|
-
"operation",
|
|
250
|
-
"connectionName",
|
|
251
|
-
"serviceName",
|
|
252
|
-
"host",
|
|
253
|
-
"entity"
|
|
254
|
-
],
|
|
255
|
-
properties: {
|
|
256
|
-
entityId: schemaRef("entityId"),
|
|
257
|
-
operation: schemaRef("operation"),
|
|
258
|
-
connectionName: schemaRef("connectionName"),
|
|
259
|
-
serviceName: schemaRef("serviceName"),
|
|
260
|
-
host: schemaRef("host"),
|
|
261
|
-
entity: schemaRef("entity")
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
__name(entityIdRequest, "entityIdRequest");
|
|
266
259
|
function getActionOperation(options) {
|
|
267
260
|
const {
|
|
268
261
|
action,
|
|
@@ -271,7 +264,7 @@ function getActionOperation(options) {
|
|
|
271
264
|
toolName = "",
|
|
272
265
|
toolInstructions = ""
|
|
273
266
|
} = options;
|
|
274
|
-
let description = `Use this tool
|
|
267
|
+
let description = `Use this tool to execute ${action}`;
|
|
275
268
|
if (operation === "EXECUTE_QUERY") {
|
|
276
269
|
description += " Use pageSize = 50 and timeout = 120 until user specifies a different value otherwise. If user provides a query in natural language, convert it to SQL query and then execute it using the tool.";
|
|
277
270
|
}
|
|
@@ -279,6 +272,8 @@ function getActionOperation(options) {
|
|
|
279
272
|
summary: actionDisplayName,
|
|
280
273
|
description: `${description} ${toolInstructions}`,
|
|
281
274
|
operationId: `${toolName}_${actionDisplayName}`,
|
|
275
|
+
xOperation: operation,
|
|
276
|
+
xAction: action,
|
|
282
277
|
requestSchemaRef: `#/components/schemas/${actionDisplayName}_Request`,
|
|
283
278
|
responseSchema: schemaRef(`${actionDisplayName}_Response`)
|
|
284
279
|
});
|
|
@@ -293,8 +288,10 @@ function listOperation(options) {
|
|
|
293
288
|
} = options;
|
|
294
289
|
return postOperation({
|
|
295
290
|
summary: `List ${entity}`,
|
|
296
|
-
description: `Returns
|
|
291
|
+
description: `Returns the list of ${entity} data. If the page token was available in the response, let users know there are more records available. Ask if the user wants to fetch the next page of results. When passing filter use the following format: \`field_name1='value1' AND field_name2='value2'\`. ${toolInstructions}`,
|
|
297
292
|
operationId: `${toolName}_list_${entity}`,
|
|
293
|
+
xOperation: "LIST_ENTITIES",
|
|
294
|
+
xEntity: entity,
|
|
298
295
|
requestSchemaRef: `#/components/schemas/list_${entity}_Request`,
|
|
299
296
|
responseSchema: {
|
|
300
297
|
description: `Returns a list of ${entity} of json schema: ${schemaAsString}`,
|
|
@@ -312,8 +309,10 @@ function getOperation(options) {
|
|
|
312
309
|
} = options;
|
|
313
310
|
return postOperation({
|
|
314
311
|
summary: `Get ${entity}`,
|
|
315
|
-
description: `Returns the details of the ${entity}.
|
|
312
|
+
description: `Returns the details of the ${entity}. ${toolInstructions}`,
|
|
316
313
|
operationId: `${toolName}_get_${entity}`,
|
|
314
|
+
xOperation: "GET_ENTITY",
|
|
315
|
+
xEntity: entity,
|
|
317
316
|
requestSchemaRef: `#/components/schemas/get_${entity}_Request`,
|
|
318
317
|
responseSchema: {
|
|
319
318
|
description: `Returns ${entity} of json schema: ${schemaAsString}`,
|
|
@@ -325,9 +324,11 @@ __name(getOperation, "getOperation");
|
|
|
325
324
|
function createOperation(options) {
|
|
326
325
|
const { entity, toolName = "", toolInstructions = "" } = options;
|
|
327
326
|
return postOperation({
|
|
328
|
-
summary: `
|
|
329
|
-
description: `Creates a new
|
|
327
|
+
summary: `Creates a new ${entity}`,
|
|
328
|
+
description: `Creates a new ${entity}. ${toolInstructions}`,
|
|
330
329
|
operationId: `${toolName}_create_${entity}`,
|
|
330
|
+
xOperation: "CREATE_ENTITY",
|
|
331
|
+
xEntity: entity,
|
|
331
332
|
requestSchemaRef: `#/components/schemas/create_${entity}_Request`,
|
|
332
333
|
responseSchema: schemaRef("execute-connector_Response")
|
|
333
334
|
});
|
|
@@ -336,9 +337,11 @@ __name(createOperation, "createOperation");
|
|
|
336
337
|
function updateOperation(options) {
|
|
337
338
|
const { entity, toolName = "", toolInstructions = "" } = options;
|
|
338
339
|
return postOperation({
|
|
339
|
-
summary: `
|
|
340
|
-
description: `Updates
|
|
340
|
+
summary: `Updates the ${entity}`,
|
|
341
|
+
description: `Updates the ${entity}. ${toolInstructions}`,
|
|
341
342
|
operationId: `${toolName}_update_${entity}`,
|
|
343
|
+
xOperation: "UPDATE_ENTITY",
|
|
344
|
+
xEntity: entity,
|
|
342
345
|
requestSchemaRef: `#/components/schemas/update_${entity}_Request`,
|
|
343
346
|
responseSchema: schemaRef("execute-connector_Response")
|
|
344
347
|
});
|
|
@@ -347,15 +350,28 @@ __name(updateOperation, "updateOperation");
|
|
|
347
350
|
function deleteOperation(options) {
|
|
348
351
|
const { entity, toolName = "", toolInstructions = "" } = options;
|
|
349
352
|
return postOperation({
|
|
350
|
-
summary: `Delete ${entity}`,
|
|
351
|
-
description: `Deletes
|
|
353
|
+
summary: `Delete the ${entity}`,
|
|
354
|
+
description: `Deletes the ${entity}. ${toolInstructions}`,
|
|
352
355
|
operationId: `${toolName}_delete_${entity}`,
|
|
356
|
+
xOperation: "DELETE_ENTITY",
|
|
357
|
+
xEntity: entity,
|
|
353
358
|
requestSchemaRef: `#/components/schemas/delete_${entity}_Request`,
|
|
354
359
|
responseSchema: schemaRef("execute-connector_Response")
|
|
355
360
|
});
|
|
356
361
|
}
|
|
357
362
|
__name(deleteOperation, "deleteOperation");
|
|
358
|
-
function createOperationRequest(entity) {
|
|
363
|
+
function createOperationRequest(entity, options) {
|
|
364
|
+
const properties = {
|
|
365
|
+
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
366
|
+
operation: schemaRef("operation"),
|
|
367
|
+
connectionName: schemaRef("connectionName"),
|
|
368
|
+
serviceName: schemaRef("serviceName"),
|
|
369
|
+
host: schemaRef("host"),
|
|
370
|
+
entity: schemaRef("entity")
|
|
371
|
+
};
|
|
372
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
373
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
374
|
+
}
|
|
359
375
|
return {
|
|
360
376
|
type: "object",
|
|
361
377
|
required: [
|
|
@@ -366,18 +382,24 @@ function createOperationRequest(entity) {
|
|
|
366
382
|
"host",
|
|
367
383
|
"entity"
|
|
368
384
|
],
|
|
369
|
-
properties
|
|
370
|
-
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
371
|
-
operation: schemaRef("operation"),
|
|
372
|
-
connectionName: schemaRef("connectionName"),
|
|
373
|
-
serviceName: schemaRef("serviceName"),
|
|
374
|
-
host: schemaRef("host"),
|
|
375
|
-
entity: schemaRef("entity")
|
|
376
|
-
}
|
|
385
|
+
properties
|
|
377
386
|
};
|
|
378
387
|
}
|
|
379
388
|
__name(createOperationRequest, "createOperationRequest");
|
|
380
|
-
function updateOperationRequest(entity) {
|
|
389
|
+
function updateOperationRequest(entity, options) {
|
|
390
|
+
const properties = {
|
|
391
|
+
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
392
|
+
entityId: schemaRef("entityId"),
|
|
393
|
+
operation: schemaRef("operation"),
|
|
394
|
+
connectionName: schemaRef("connectionName"),
|
|
395
|
+
serviceName: schemaRef("serviceName"),
|
|
396
|
+
host: schemaRef("host"),
|
|
397
|
+
entity: schemaRef("entity"),
|
|
398
|
+
filterClause: schemaRef("filterClause")
|
|
399
|
+
};
|
|
400
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
401
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
402
|
+
}
|
|
381
403
|
return {
|
|
382
404
|
type: "object",
|
|
383
405
|
required: [
|
|
@@ -389,44 +411,96 @@ function updateOperationRequest(entity) {
|
|
|
389
411
|
"host",
|
|
390
412
|
"entity"
|
|
391
413
|
],
|
|
392
|
-
properties
|
|
393
|
-
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
394
|
-
entityId: schemaRef("entityId"),
|
|
395
|
-
operation: schemaRef("operation"),
|
|
396
|
-
connectionName: schemaRef("connectionName"),
|
|
397
|
-
serviceName: schemaRef("serviceName"),
|
|
398
|
-
host: schemaRef("host"),
|
|
399
|
-
entity: schemaRef("entity")
|
|
400
|
-
}
|
|
414
|
+
properties
|
|
401
415
|
};
|
|
402
416
|
}
|
|
403
417
|
__name(updateOperationRequest, "updateOperationRequest");
|
|
404
|
-
function getOperationRequest() {
|
|
405
|
-
|
|
418
|
+
function getOperationRequest(options) {
|
|
419
|
+
const properties = {
|
|
420
|
+
entityId: schemaRef("entityId"),
|
|
421
|
+
operation: schemaRef("operation"),
|
|
422
|
+
connectionName: schemaRef("connectionName"),
|
|
423
|
+
serviceName: schemaRef("serviceName"),
|
|
424
|
+
host: schemaRef("host"),
|
|
425
|
+
entity: schemaRef("entity")
|
|
426
|
+
};
|
|
427
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
428
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
429
|
+
}
|
|
430
|
+
return {
|
|
431
|
+
type: "object",
|
|
432
|
+
required: [
|
|
433
|
+
"entityId",
|
|
434
|
+
"operation",
|
|
435
|
+
"connectionName",
|
|
436
|
+
"serviceName",
|
|
437
|
+
"host",
|
|
438
|
+
"entity"
|
|
439
|
+
],
|
|
440
|
+
properties
|
|
441
|
+
};
|
|
406
442
|
}
|
|
407
443
|
__name(getOperationRequest, "getOperationRequest");
|
|
408
|
-
function deleteOperationRequest() {
|
|
409
|
-
|
|
444
|
+
function deleteOperationRequest(options) {
|
|
445
|
+
const properties = {
|
|
446
|
+
entityId: schemaRef("entityId"),
|
|
447
|
+
operation: schemaRef("operation"),
|
|
448
|
+
connectionName: schemaRef("connectionName"),
|
|
449
|
+
serviceName: schemaRef("serviceName"),
|
|
450
|
+
host: schemaRef("host"),
|
|
451
|
+
entity: schemaRef("entity"),
|
|
452
|
+
filterClause: schemaRef("filterClause")
|
|
453
|
+
};
|
|
454
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
455
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
type: "object",
|
|
459
|
+
required: [
|
|
460
|
+
"entityId",
|
|
461
|
+
"operation",
|
|
462
|
+
"connectionName",
|
|
463
|
+
"serviceName",
|
|
464
|
+
"host",
|
|
465
|
+
"entity"
|
|
466
|
+
],
|
|
467
|
+
properties
|
|
468
|
+
};
|
|
410
469
|
}
|
|
411
470
|
__name(deleteOperationRequest, "deleteOperationRequest");
|
|
412
|
-
function listOperationRequest() {
|
|
471
|
+
function listOperationRequest(options) {
|
|
472
|
+
const properties = {
|
|
473
|
+
filterClause: schemaRef("filterClause"),
|
|
474
|
+
pageSize: schemaRef("pageSize"),
|
|
475
|
+
pageToken: schemaRef("pageToken"),
|
|
476
|
+
operation: schemaRef("operation"),
|
|
477
|
+
connectionName: schemaRef("connectionName"),
|
|
478
|
+
serviceName: schemaRef("serviceName"),
|
|
479
|
+
host: schemaRef("host"),
|
|
480
|
+
entity: schemaRef("entity")
|
|
481
|
+
};
|
|
482
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
483
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
484
|
+
}
|
|
413
485
|
return {
|
|
414
486
|
type: "object",
|
|
415
487
|
required: ["operation", "connectionName", "serviceName", "host", "entity"],
|
|
416
|
-
properties
|
|
417
|
-
filterClause: schemaRef("filterClause"),
|
|
418
|
-
pageSize: schemaRef("pageSize"),
|
|
419
|
-
pageToken: schemaRef("pageToken"),
|
|
420
|
-
operation: schemaRef("operation"),
|
|
421
|
-
connectionName: schemaRef("connectionName"),
|
|
422
|
-
serviceName: schemaRef("serviceName"),
|
|
423
|
-
host: schemaRef("host"),
|
|
424
|
-
entity: schemaRef("entity")
|
|
425
|
-
}
|
|
488
|
+
properties
|
|
426
489
|
};
|
|
427
490
|
}
|
|
428
491
|
__name(listOperationRequest, "listOperationRequest");
|
|
429
|
-
function actionRequest(action) {
|
|
492
|
+
function actionRequest(action, options) {
|
|
493
|
+
const properties = {
|
|
494
|
+
operation: schemaRef("operation"),
|
|
495
|
+
connectionName: schemaRef("connectionName"),
|
|
496
|
+
serviceName: schemaRef("serviceName"),
|
|
497
|
+
host: schemaRef("host"),
|
|
498
|
+
action: schemaRef("action"),
|
|
499
|
+
connectorInputPayload: schemaRef(`connectorInputPayload_${action}`)
|
|
500
|
+
};
|
|
501
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
502
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
503
|
+
}
|
|
430
504
|
return {
|
|
431
505
|
type: "object",
|
|
432
506
|
required: [
|
|
@@ -437,14 +511,7 @@ function actionRequest(action) {
|
|
|
437
511
|
"action",
|
|
438
512
|
"connectorInputPayload"
|
|
439
513
|
],
|
|
440
|
-
properties
|
|
441
|
-
operation: schemaRef("operation"),
|
|
442
|
-
connectionName: schemaRef("connectionName"),
|
|
443
|
-
serviceName: schemaRef("serviceName"),
|
|
444
|
-
host: schemaRef("host"),
|
|
445
|
-
action: schemaRef("action"),
|
|
446
|
-
connectorInputPayload: schemaRef(`connectorInputPayload_${action}`)
|
|
447
|
-
}
|
|
514
|
+
properties
|
|
448
515
|
};
|
|
449
516
|
}
|
|
450
517
|
__name(actionRequest, "actionRequest");
|
|
@@ -491,16 +558,17 @@ let ConnectionsClient = class {
|
|
|
491
558
|
this.tokenSource = new import_cloud_request.CloudPlatformTokenSource(options.serviceAccountJson);
|
|
492
559
|
}
|
|
493
560
|
/**
|
|
494
|
-
* Reads the service name and host of the connection, and
|
|
495
|
-
* an authentication override.
|
|
561
|
+
* Reads the resource name, service name and host of the connection, and
|
|
562
|
+
* whether it allows an authentication override.
|
|
496
563
|
*/
|
|
497
564
|
async getConnectionDetails() {
|
|
498
565
|
const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}?view=BASIC`;
|
|
499
566
|
const connectionData = (0, import_json_utils.toJsonObject)(await this.executeApiCall(url));
|
|
567
|
+
const name = toStringValue(connectionData["name"]);
|
|
500
568
|
const host = toStringValue(connectionData["host"]);
|
|
501
569
|
const serviceName = host ? toStringValue(connectionData["tlsServiceDirectory"]) : toStringValue(connectionData["serviceDirectory"]);
|
|
502
570
|
const authOverrideEnabled = connectionData["authOverrideEnabled"] === true;
|
|
503
|
-
return { serviceName, host, authOverrideEnabled };
|
|
571
|
+
return { name, serviceName, host, authOverrideEnabled };
|
|
504
572
|
}
|
|
505
573
|
/**
|
|
506
574
|
* Reads the JSON schema of an entity and the operations it supports.
|
|
@@ -53,7 +53,7 @@ let IntegrationClient = class {
|
|
|
53
53
|
this.project = options.project;
|
|
54
54
|
this.location = options.location;
|
|
55
55
|
this.integration = options.integration;
|
|
56
|
-
this.
|
|
56
|
+
this.triggers = options.triggers;
|
|
57
57
|
this.connection = options.connection;
|
|
58
58
|
this.entityOperations = (_a = options.entityOperations) != null ? _a : {};
|
|
59
59
|
this.actions = (_b = options.actions) != null ? _b : [];
|
|
@@ -68,7 +68,10 @@ let IntegrationClient = class {
|
|
|
68
68
|
* that carries no parseable spec.
|
|
69
69
|
*/
|
|
70
70
|
async getOpenApiSpecForIntegration() {
|
|
71
|
+
var _a;
|
|
71
72
|
const url = `https://${this.location}-integrations.googleapis.com/v1/projects/${this.project}/locations/${this.location}:generateOpenApiSpec`;
|
|
73
|
+
const triggerId = (_a = this.triggers) != null ? _a : null;
|
|
74
|
+
const invalidRequestMessage = `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), integration(${this.integration}).`;
|
|
72
75
|
const body = await (0, import_cloud_request.sendCloudRequest)({
|
|
73
76
|
url,
|
|
74
77
|
method: "POST",
|
|
@@ -76,13 +79,13 @@ let IntegrationClient = class {
|
|
|
76
79
|
apiTriggerResources: [
|
|
77
80
|
{
|
|
78
81
|
integrationResource: this.integration,
|
|
79
|
-
triggerId
|
|
82
|
+
triggerId
|
|
80
83
|
}
|
|
81
84
|
],
|
|
82
85
|
fileFormat: "JSON"
|
|
83
86
|
},
|
|
84
87
|
tokenSource: this.tokenSource,
|
|
85
|
-
invalidRequestMessage
|
|
88
|
+
invalidRequestMessage
|
|
86
89
|
});
|
|
87
90
|
try {
|
|
88
91
|
const spec = (0, import_json_utils.isJsonObject)(body) ? body["openApiSpec"] : void 0;
|
|
@@ -188,20 +191,21 @@ let IntegrationClient = class {
|
|
|
188
191
|
}
|
|
189
192
|
for (const action of this.actions) {
|
|
190
193
|
const { inputSchema, outputSchema, displayName } = await connectionsClient.getActionSchema(action);
|
|
194
|
+
const actionDisplayName = displayName.replace(/ /g, "");
|
|
191
195
|
let operation = "EXECUTE_ACTION";
|
|
192
196
|
if (action === EXECUTE_CUSTOM_QUERY_ACTION) {
|
|
193
|
-
schemas[`${
|
|
197
|
+
schemas[`${actionDisplayName}_Request`] = (0, import_connections_client.executeCustomQueryRequest)();
|
|
194
198
|
operation = "EXECUTE_QUERY";
|
|
195
199
|
} else {
|
|
196
|
-
schemas[`${
|
|
197
|
-
schemas[`connectorInputPayload_${
|
|
200
|
+
schemas[`${actionDisplayName}_Request`] = (0, import_connections_client.actionRequest)(actionDisplayName);
|
|
201
|
+
schemas[`connectorInputPayload_${actionDisplayName}`] = (0, import_connections_client.connectorPayload)(inputSchema);
|
|
198
202
|
}
|
|
199
|
-
schemas[`connectorOutputPayload_${
|
|
200
|
-
schemas[`${
|
|
203
|
+
schemas[`connectorOutputPayload_${actionDisplayName}`] = (0, import_connections_client.connectorPayload)(outputSchema);
|
|
204
|
+
schemas[`${actionDisplayName}_Response`] = (0, import_connections_client.actionResponse)(actionDisplayName);
|
|
201
205
|
connectorSpec.paths[`${pathPrefix}#${action}`] = (0, import_connections_client.getActionOperation)({
|
|
202
206
|
action,
|
|
203
207
|
operation,
|
|
204
|
-
actionDisplayName
|
|
208
|
+
actionDisplayName,
|
|
205
209
|
toolName,
|
|
206
210
|
toolInstructions
|
|
207
211
|
});
|
|
@@ -0,0 +1,184 @@
|
|
|
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 __decorateClass = (decorators, target, key, kind) => {
|
|
27
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
28
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
29
|
+
if (decorator = decorators[i])
|
|
30
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
31
|
+
if (kind && result) __defProp(target, key, result);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
var integration_connector_tool_exports = {};
|
|
35
|
+
__export(integration_connector_tool_exports, {
|
|
36
|
+
IntegrationConnectorTool: () => IntegrationConnectorTool
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(integration_connector_tool_exports);
|
|
39
|
+
var import_experimental = require("../../utils/experimental.js");
|
|
40
|
+
var import_logger = require("../../utils/logger.js");
|
|
41
|
+
var import_base_tool = require("../base_tool.js");
|
|
42
|
+
var import_tool_auth_handler = require("../openapi_tool/openapi_spec_parser/tool_auth_handler.js");
|
|
43
|
+
/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2026 Google LLC
|
|
46
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
47
|
+
*/
|
|
48
|
+
const DYNAMIC_AUTH_EXCLUDE_FIELDS = Object.freeze([
|
|
49
|
+
"dynamic_auth_config",
|
|
50
|
+
"dynamicAuthConfig"
|
|
51
|
+
]);
|
|
52
|
+
let IntegrationConnectorTool = class extends import_base_tool.BaseTool {
|
|
53
|
+
constructor(options) {
|
|
54
|
+
var _a, _b, _c;
|
|
55
|
+
super(options);
|
|
56
|
+
this.connectionName = options.connectionName;
|
|
57
|
+
this.connectionHost = options.connectionHost;
|
|
58
|
+
this.connectionServiceName = options.connectionServiceName;
|
|
59
|
+
this.entity = (_a = options.entity) != null ? _a : "";
|
|
60
|
+
this.operation = (_b = options.operation) != null ? _b : "";
|
|
61
|
+
this.action = (_c = options.action) != null ? _c : "";
|
|
62
|
+
this.restApiTool = options.restApiTool;
|
|
63
|
+
this.authScheme = options.authScheme;
|
|
64
|
+
this.authCredential = options.authCredential;
|
|
65
|
+
}
|
|
66
|
+
_getDeclaration() {
|
|
67
|
+
const declaration = this.restApiTool._getDeclaration();
|
|
68
|
+
const rawParameters = declaration == null ? void 0 : declaration.parameters;
|
|
69
|
+
let parameters;
|
|
70
|
+
if (rawParameters) {
|
|
71
|
+
parameters = { ...rawParameters };
|
|
72
|
+
if (rawParameters.properties) {
|
|
73
|
+
const properties = { ...rawParameters.properties };
|
|
74
|
+
for (const field of [
|
|
75
|
+
...IntegrationConnectorTool.EXCLUDE_FIELDS,
|
|
76
|
+
...DYNAMIC_AUTH_EXCLUDE_FIELDS
|
|
77
|
+
]) {
|
|
78
|
+
delete properties[field];
|
|
79
|
+
}
|
|
80
|
+
parameters.properties = properties;
|
|
81
|
+
}
|
|
82
|
+
if (rawParameters.required) {
|
|
83
|
+
parameters.required = rawParameters.required.filter(
|
|
84
|
+
(field) => !IntegrationConnectorTool.EXCLUDE_FIELDS.includes(field) && !DYNAMIC_AUTH_EXCLUDE_FIELDS.includes(field) && !IntegrationConnectorTool.OPTIONAL_FIELDS.includes(field)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
name: this.name,
|
|
90
|
+
description: this.description,
|
|
91
|
+
parameters
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async runAsync(request) {
|
|
95
|
+
const toolAuthHandler = import_tool_auth_handler.ToolAuthHandler.fromToolContext(
|
|
96
|
+
request.toolContext,
|
|
97
|
+
this.authScheme,
|
|
98
|
+
this.authCredential
|
|
99
|
+
);
|
|
100
|
+
const authResult = await toolAuthHandler.prepareAuthCredentials();
|
|
101
|
+
if (authResult.state === "pending") {
|
|
102
|
+
return {
|
|
103
|
+
pending: true,
|
|
104
|
+
message: "Needs your authorization to access your data."
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const updatedArgs = {
|
|
108
|
+
...request.args,
|
|
109
|
+
connection_name: this.connectionName,
|
|
110
|
+
connectionName: this.connectionName,
|
|
111
|
+
service_name: this.connectionServiceName,
|
|
112
|
+
serviceName: this.connectionServiceName,
|
|
113
|
+
host: this.connectionHost
|
|
114
|
+
};
|
|
115
|
+
if (this.entity) {
|
|
116
|
+
updatedArgs["entity"] = this.entity;
|
|
117
|
+
}
|
|
118
|
+
if (this.operation) {
|
|
119
|
+
updatedArgs["operation"] = this.operation;
|
|
120
|
+
}
|
|
121
|
+
if (this.action) {
|
|
122
|
+
updatedArgs["action"] = this.action;
|
|
123
|
+
}
|
|
124
|
+
if (authResult.authCredential) {
|
|
125
|
+
const token = prepareDynamicEuc(authResult.authCredential);
|
|
126
|
+
const dynamicAuthPayload = {
|
|
127
|
+
"oauth2_auth_code_flow.access_token": token != null ? token : {}
|
|
128
|
+
};
|
|
129
|
+
updatedArgs["dynamic_auth_config"] = dynamicAuthPayload;
|
|
130
|
+
updatedArgs["dynamicAuthConfig"] = dynamicAuthPayload;
|
|
131
|
+
}
|
|
132
|
+
import_logger.logger.debug(`Running tool: ${this.name}`);
|
|
133
|
+
return this.restApiTool.runAsync({
|
|
134
|
+
args: updatedArgs,
|
|
135
|
+
toolContext: request.toolContext
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
__name(IntegrationConnectorTool, "IntegrationConnectorTool");
|
|
140
|
+
/**
|
|
141
|
+
* Request fields that {@link IntegrationConnectorTool} injects at runtime and
|
|
142
|
+
* excludes from the function declaration shown to the model.
|
|
143
|
+
*/
|
|
144
|
+
IntegrationConnectorTool.EXCLUDE_FIELDS = Object.freeze([
|
|
145
|
+
"connection_name",
|
|
146
|
+
"connectionName",
|
|
147
|
+
"service_name",
|
|
148
|
+
"serviceName",
|
|
149
|
+
"host",
|
|
150
|
+
"entity",
|
|
151
|
+
"operation",
|
|
152
|
+
"action"
|
|
153
|
+
]);
|
|
154
|
+
/**
|
|
155
|
+
* Request fields that {@link IntegrationConnectorTool} removes from the
|
|
156
|
+
* `required` list in the function declaration shown to the model.
|
|
157
|
+
*/
|
|
158
|
+
IntegrationConnectorTool.OPTIONAL_FIELDS = Object.freeze([
|
|
159
|
+
"page_size",
|
|
160
|
+
"pageSize",
|
|
161
|
+
"page_token",
|
|
162
|
+
"pageToken",
|
|
163
|
+
"filter",
|
|
164
|
+
"filter_clause",
|
|
165
|
+
"filterClause"
|
|
166
|
+
]);
|
|
167
|
+
__decorateClass([
|
|
168
|
+
import_experimental.experimental
|
|
169
|
+
], IntegrationConnectorTool.prototype, "_getDeclaration", 1);
|
|
170
|
+
__decorateClass([
|
|
171
|
+
import_experimental.experimental
|
|
172
|
+
], IntegrationConnectorTool.prototype, "runAsync", 1);
|
|
173
|
+
IntegrationConnectorTool = __decorateClass([
|
|
174
|
+
import_experimental.experimental
|
|
175
|
+
], IntegrationConnectorTool);
|
|
176
|
+
function prepareDynamicEuc(authCredential) {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
return ((_b = (_a = authCredential.http) == null ? void 0 : _a.credentials) == null ? void 0 : _b.token) || void 0;
|
|
179
|
+
}
|
|
180
|
+
__name(prepareDynamicEuc, "prepareDynamicEuc");
|
|
181
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
182
|
+
0 && (module.exports = {
|
|
183
|
+
IntegrationConnectorTool
|
|
184
|
+
});
|
|
@@ -52,7 +52,7 @@ function isGoogleApiTool(obj) {
|
|
|
52
52
|
}
|
|
53
53
|
__name(isGoogleApiTool, "isGoogleApiTool");
|
|
54
54
|
let GoogleApiTool = class extends (_b = import_base_tool.BaseTool, _a = GOOGLE_API_TOOL_SIGNATURE_SYMBOL, _b) {
|
|
55
|
-
constructor(restApiTool) {
|
|
55
|
+
constructor(restApiTool, options = {}) {
|
|
56
56
|
super({
|
|
57
57
|
name: restApiTool.name,
|
|
58
58
|
description: restApiTool.description,
|
|
@@ -60,6 +60,9 @@ let GoogleApiTool = class extends (_b = import_base_tool.BaseTool, _a = GOOGLE_A
|
|
|
60
60
|
});
|
|
61
61
|
this[_a] = true;
|
|
62
62
|
this.restApiTool = restApiTool;
|
|
63
|
+
if (options.clientId !== void 0 || options.clientSecret !== void 0) {
|
|
64
|
+
this.configureAuth(options.clientId, options.clientSecret);
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
_getDeclaration() {
|
|
65
68
|
return this.restApiTool._getDeclaration();
|