@google/adk 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/dist/cjs/a2a/a2a_remote_agent.js +17 -2
  2. package/dist/cjs/a2a/a2a_remote_agent_utils.js +8 -4
  3. package/dist/cjs/a2a/agent_card.js +5 -81
  4. package/dist/cjs/a2a/agent_to_a2a.js +7 -0
  5. package/dist/cjs/a2a/event_converter_utils.js +10 -3
  6. package/dist/cjs/agents/agent_engine_client.js +399 -0
  7. package/dist/cjs/agents/base_agent.js +127 -68
  8. package/dist/cjs/agents/functions.js +64 -59
  9. package/dist/cjs/agents/instructions.js +8 -6
  10. package/dist/cjs/agents/invocation_context.js +2 -2
  11. package/dist/cjs/agents/llm_agent.js +124 -101
  12. package/dist/cjs/agents/processors/basic_llm_request_processor.js +1 -1
  13. package/dist/cjs/agents/processors/code_execution_request_processor.js +8 -0
  14. package/dist/cjs/agents/processors/content_processor_utils.js +72 -17
  15. package/dist/cjs/agents/processors/content_request_processor.js +51 -2
  16. package/dist/cjs/agents/processors/context_compactor_request_processor.js +5 -1
  17. package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
  18. package/dist/cjs/agents/processors/nl_planning_processor.js +13 -3
  19. package/dist/cjs/artifacts/file_artifact_service.js +1 -1
  20. package/dist/cjs/cli/cli_eval.js +884 -17
  21. package/dist/cjs/cli/utils/cleanup.js +84 -0
  22. package/dist/cjs/cli/utils/envs.js +33 -2
  23. package/dist/cjs/cli/utils/evals.js +75 -8
  24. package/dist/cjs/cli/utils/logs.js +134 -15
  25. package/dist/cjs/cli/utils/path_validation.js +83 -0
  26. package/dist/cjs/code_executors/container_code_executor.js +171 -38
  27. package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
  28. package/dist/cjs/common.js +59 -32
  29. package/dist/cjs/context/compaction_utils.js +19 -0
  30. package/dist/cjs/errors/input_validation_error.js +3 -2
  31. package/dist/cjs/events/event.js +7 -3
  32. package/dist/cjs/features/feature_registry.js +5 -0
  33. package/dist/cjs/index.js +34 -12
  34. package/dist/cjs/models/google_llm.js +33 -2
  35. package/dist/cjs/models/interactions_utils.js +3 -0
  36. package/dist/cjs/plugins/base_plugin.js +54 -40
  37. package/dist/cjs/plugins/plugin_manager.js +27 -0
  38. package/dist/cjs/runner/runner.js +306 -189
  39. package/dist/cjs/sessions/base_session_service.js +15 -12
  40. package/dist/cjs/sessions/database_session_service.js +232 -38
  41. package/dist/cjs/sessions/db/operations.js +70 -1
  42. package/dist/cjs/sessions/db/schema.js +4 -0
  43. package/dist/cjs/sessions/in_memory_session_service.js +2 -2
  44. package/dist/cjs/sessions/stale_session_error.js +59 -0
  45. package/dist/cjs/sessions/vertex_ai_session_service.js +11 -3
  46. package/dist/cjs/skills/loader.js +76 -41
  47. package/dist/cjs/telemetry/api/instrumentation.js +632 -0
  48. package/dist/cjs/telemetry/api/internal/common/accumulators.js +169 -0
  49. package/dist/cjs/telemetry/api/internal/common/attributes.js +131 -0
  50. package/dist/cjs/telemetry/api/internal/common/config.js +159 -0
  51. package/dist/cjs/telemetry/api/internal/common/error.js +98 -0
  52. package/dist/cjs/telemetry/api/internal/common/finish_reason.js +63 -0
  53. package/dist/cjs/telemetry/api/internal/common/genai_messages.js +217 -0
  54. package/dist/cjs/telemetry/api/internal/common/http_exchange.js +169 -0
  55. package/dist/cjs/telemetry/api/internal/common/provider_name.js +87 -0
  56. package/dist/cjs/telemetry/api/internal/common/redaction.js +148 -0
  57. package/dist/cjs/telemetry/api/internal/common/serialization.js +58 -0
  58. package/dist/cjs/telemetry/api/internal/common/token_usage.js +118 -0
  59. package/dist/cjs/telemetry/api/internal/logs/inference.js +50 -0
  60. package/dist/cjs/telemetry/api/internal/logs/logger.js +46 -0
  61. package/dist/cjs/telemetry/api/internal/logs/mcp.js +141 -0
  62. package/dist/cjs/telemetry/api/internal/metrics/agent.js +128 -0
  63. package/dist/cjs/telemetry/api/internal/metrics/inference_start_hook.js +56 -0
  64. package/dist/cjs/telemetry/api/internal/metrics/meters.js +189 -0
  65. package/dist/cjs/telemetry/api/internal/metrics/tool.js +147 -0
  66. package/dist/cjs/telemetry/api/internal/metrics/workflow.js +132 -0
  67. package/dist/cjs/telemetry/api/internal/trace/agent.js +52 -0
  68. package/dist/cjs/telemetry/api/internal/trace/compaction.js +78 -0
  69. package/dist/cjs/telemetry/api/internal/trace/inference.js +132 -0
  70. package/dist/cjs/telemetry/api/internal/trace/live.js +52 -0
  71. package/dist/cjs/telemetry/api/internal/trace/node.js +73 -0
  72. package/dist/cjs/telemetry/api/internal/trace/propagation.js +67 -0
  73. package/dist/cjs/telemetry/api/internal/trace/tool.js +122 -0
  74. package/dist/cjs/telemetry/api/internal/trace/tracer.js +77 -0
  75. package/dist/cjs/telemetry/api/internal/trace/workflow.js +77 -0
  76. package/dist/cjs/telemetry/export/agent_engine.js +90 -0
  77. package/dist/cjs/telemetry/export/agent_runtime.js +73 -0
  78. package/dist/cjs/telemetry/export/google_cloud.js +763 -0
  79. package/dist/cjs/telemetry/export/request_driven_metric_reader.js +303 -0
  80. package/dist/cjs/telemetry/{setup.js → export/setup.js} +72 -6
  81. package/dist/cjs/tools/agent_tool.js +9 -1
  82. package/dist/cjs/tools/apihub_tool/apihub_toolset.js +18 -23
  83. package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +109 -43
  84. package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +222 -114
  85. package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +34 -14
  86. package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +175 -0
  87. package/dist/cjs/tools/base_toolset.js +1 -1
  88. package/dist/cjs/tools/computer_use/base_computer.js +125 -0
  89. package/dist/cjs/tools/computer_use/computer_use_actions.js +502 -0
  90. package/dist/cjs/tools/computer_use/computer_use_tool.js +244 -0
  91. package/dist/cjs/tools/computer_use/computer_use_toolset.js +360 -0
  92. package/dist/cjs/tools/function_tool.js +15 -5
  93. package/dist/cjs/tools/google_api_tool/google_api_tool.js +4 -1
  94. package/dist/cjs/tools/google_api_tool/google_api_toolset.js +174 -0
  95. package/dist/cjs/tools/google_api_tool/google_api_toolsets.js +124 -0
  96. package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +5 -3
  97. package/dist/cjs/tools/google_api_tool/index.js +20 -23
  98. package/dist/cjs/tools/load_artifacts_tool.js +27 -11
  99. package/dist/cjs/tools/load_memory_tool.js +14 -15
  100. package/dist/cjs/tools/mcp/mcp_session_manager.js +23 -3
  101. package/dist/cjs/tools/mcp/mcp_tool.js +7 -3
  102. package/dist/cjs/tools/mcp/mcp_toolset.js +19 -20
  103. package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +30 -29
  104. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -4
  105. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
  106. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
  107. package/dist/cjs/tools/openapi_tool/openapi_toolset.js +7 -13
  108. package/dist/cjs/tools/openapi_tool/rest_api_tool.js +57 -10
  109. package/dist/cjs/tools/skill/load_skill_resource_tool.js +7 -0
  110. package/dist/cjs/tools/skill/load_skill_tool.js +3 -0
  111. package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -2
  112. package/dist/cjs/tools/toolbox_toolset.js +193 -0
  113. package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
  114. package/dist/cjs/utils/async_queue.js +37 -3
  115. package/dist/cjs/utils/client_labels.js +17 -2
  116. package/dist/cjs/utils/env_aware_utils.js +13 -7
  117. package/dist/cjs/utils/error_utils.js +40 -2
  118. package/dist/cjs/utils/failover_utils.js +11 -10
  119. package/dist/cjs/utils/gemini_schema_util.js +145 -14
  120. package/dist/cjs/utils/id_provider.js +63 -0
  121. package/dist/cjs/utils/logger_node.js +4 -0
  122. package/dist/cjs/utils/model_name.js +15 -0
  123. package/dist/cjs/utils/output_schema_utils.js +5 -2
  124. package/dist/cjs/utils/simple_zod_to_json.js +13 -31
  125. package/dist/cjs/utils/ssrf_guard.js +46 -16
  126. package/dist/cjs/utils/task.js +1 -1
  127. package/dist/cjs/version.js +1 -1
  128. package/dist/cjs/workflow/index.js +2 -0
  129. package/dist/cjs/workflow/node_runner.js +24 -80
  130. package/dist/cjs/workflow/nodes/parallel_worker.js +18 -7
  131. package/dist/cjs/workflow/run_llm_agent_as_node.js +19 -14
  132. package/dist/cjs/workflow/utils/retry_utils.js +2 -2
  133. package/dist/cjs/workflow/workflow.js +12 -12
  134. package/dist/esm/a2a/a2a_remote_agent.js +23 -3
  135. package/dist/esm/a2a/a2a_remote_agent_utils.js +8 -4
  136. package/dist/esm/a2a/agent_card.js +5 -83
  137. package/dist/esm/a2a/agent_to_a2a.js +7 -0
  138. package/dist/esm/a2a/event_converter_utils.js +10 -3
  139. package/dist/esm/agents/agent_engine_client.js +382 -0
  140. package/dist/esm/agents/base_agent.js +127 -72
  141. package/dist/esm/agents/functions.js +69 -63
  142. package/dist/esm/agents/instructions.js +8 -6
  143. package/dist/esm/agents/invocation_context.js +2 -2
  144. package/dist/esm/agents/llm_agent.js +130 -106
  145. package/dist/esm/agents/processors/basic_llm_request_processor.js +1 -1
  146. package/dist/esm/agents/processors/code_execution_request_processor.js +8 -0
  147. package/dist/esm/agents/processors/content_processor_utils.js +72 -17
  148. package/dist/esm/agents/processors/content_request_processor.js +51 -2
  149. package/dist/esm/agents/processors/context_compactor_request_processor.js +5 -1
  150. package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
  151. package/dist/esm/agents/processors/nl_planning_processor.js +13 -3
  152. package/dist/esm/artifacts/file_artifact_service.js +1 -1
  153. package/dist/esm/cli/cli_eval.js +880 -17
  154. package/dist/esm/cli/utils/cleanup.js +56 -0
  155. package/dist/esm/cli/utils/envs.js +33 -2
  156. package/dist/esm/cli/utils/evals.js +74 -8
  157. package/dist/esm/cli/utils/logs.js +132 -13
  158. package/dist/esm/cli/utils/path_validation.js +45 -0
  159. package/dist/esm/code_executors/container_code_executor.js +171 -38
  160. package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
  161. package/dist/esm/common.js +59 -19
  162. package/dist/esm/context/compaction_utils.js +19 -0
  163. package/dist/esm/errors/input_validation_error.js +3 -2
  164. package/dist/esm/events/event.js +7 -3
  165. package/dist/esm/features/feature_registry.js +5 -0
  166. package/dist/esm/index.js +36 -10
  167. package/dist/esm/models/google_llm.js +33 -2
  168. package/dist/esm/models/interactions_utils.js +3 -0
  169. package/dist/esm/plugins/base_plugin.js +54 -40
  170. package/dist/esm/plugins/plugin_manager.js +27 -0
  171. package/dist/esm/runner/runner.js +310 -192
  172. package/dist/esm/sessions/base_session_service.js +13 -11
  173. package/dist/esm/sessions/database_session_service.js +231 -38
  174. package/dist/esm/sessions/db/operations.js +70 -1
  175. package/dist/esm/sessions/db/schema.js +4 -0
  176. package/dist/esm/sessions/in_memory_session_service.js +2 -2
  177. package/dist/esm/sessions/stale_session_error.js +31 -0
  178. package/dist/esm/sessions/vertex_ai_session_service.js +11 -3
  179. package/dist/esm/skills/loader.js +76 -41
  180. package/dist/esm/telemetry/api/instrumentation.js +655 -0
  181. package/dist/esm/telemetry/api/internal/common/accumulators.js +139 -0
  182. package/dist/esm/telemetry/api/internal/common/attributes.js +94 -0
  183. package/dist/esm/telemetry/api/internal/common/config.js +128 -0
  184. package/dist/esm/telemetry/api/internal/common/error.js +69 -0
  185. package/dist/esm/telemetry/api/internal/common/finish_reason.js +35 -0
  186. package/dist/esm/telemetry/api/internal/common/genai_messages.js +188 -0
  187. package/dist/esm/telemetry/api/internal/common/http_exchange.js +142 -0
  188. package/dist/esm/telemetry/api/internal/common/provider_name.js +59 -0
  189. package/dist/esm/telemetry/api/internal/common/redaction.js +121 -0
  190. package/dist/esm/telemetry/api/internal/common/serialization.js +30 -0
  191. package/dist/esm/telemetry/api/internal/common/token_usage.js +85 -0
  192. package/dist/esm/telemetry/api/internal/logs/inference.js +23 -0
  193. package/dist/esm/telemetry/api/internal/logs/logger.js +19 -0
  194. package/dist/esm/telemetry/api/internal/logs/mcp.js +113 -0
  195. package/dist/esm/telemetry/api/internal/metrics/agent.js +107 -0
  196. package/dist/esm/telemetry/api/internal/metrics/inference_start_hook.js +29 -0
  197. package/dist/esm/telemetry/api/internal/metrics/meters.js +165 -0
  198. package/dist/esm/telemetry/api/internal/metrics/tool.js +119 -0
  199. package/dist/esm/telemetry/api/internal/metrics/workflow.js +112 -0
  200. package/dist/esm/telemetry/api/internal/trace/agent.js +25 -0
  201. package/dist/esm/telemetry/api/internal/trace/compaction.js +50 -0
  202. package/dist/esm/telemetry/api/internal/trace/inference.js +107 -0
  203. package/dist/esm/telemetry/api/internal/trace/live.js +28 -0
  204. package/dist/esm/telemetry/api/internal/trace/node.js +44 -0
  205. package/dist/esm/telemetry/api/internal/trace/propagation.js +39 -0
  206. package/dist/esm/telemetry/api/internal/trace/tool.js +96 -0
  207. package/dist/esm/telemetry/api/internal/trace/tracer.js +52 -0
  208. package/dist/esm/telemetry/api/internal/trace/workflow.js +54 -0
  209. package/dist/esm/telemetry/export/agent_engine.js +67 -0
  210. package/dist/esm/telemetry/export/agent_runtime.js +46 -0
  211. package/dist/esm/telemetry/export/google_cloud.js +733 -0
  212. package/dist/esm/telemetry/export/request_driven_metric_reader.js +276 -0
  213. package/dist/esm/telemetry/export/setup.js +160 -0
  214. package/dist/esm/tools/agent_tool.js +9 -1
  215. package/dist/esm/tools/apihub_tool/apihub_toolset.js +17 -22
  216. package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +114 -44
  217. package/dist/esm/tools/application_integration_tool/clients/connections_client.js +226 -115
  218. package/dist/esm/tools/application_integration_tool/clients/integration_client.js +34 -14
  219. package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +149 -0
  220. package/dist/esm/tools/base_toolset.js +1 -1
  221. package/dist/esm/tools/computer_use/base_computer.js +99 -0
  222. package/dist/esm/tools/computer_use/computer_use_actions.js +477 -0
  223. package/dist/esm/tools/computer_use/computer_use_tool.js +217 -0
  224. package/dist/esm/tools/computer_use/computer_use_toolset.js +344 -0
  225. package/dist/esm/tools/function_tool.js +15 -5
  226. package/dist/esm/tools/google_api_tool/google_api_tool.js +4 -1
  227. package/dist/esm/tools/google_api_tool/google_api_toolset.js +147 -0
  228. package/dist/esm/tools/google_api_tool/google_api_toolsets.js +94 -0
  229. package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +5 -3
  230. package/dist/esm/tools/google_api_tool/index.js +18 -20
  231. package/dist/esm/tools/load_artifacts_tool.js +25 -10
  232. package/dist/esm/tools/load_memory_tool.js +14 -15
  233. package/dist/esm/tools/mcp/mcp_session_manager.js +23 -3
  234. package/dist/esm/tools/mcp/mcp_tool.js +7 -3
  235. package/dist/esm/tools/mcp/mcp_toolset.js +19 -20
  236. package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +27 -26
  237. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -4
  238. package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
  239. package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
  240. package/dist/esm/tools/openapi_tool/openapi_toolset.js +6 -12
  241. package/dist/esm/tools/openapi_tool/rest_api_tool.js +57 -10
  242. package/dist/esm/tools/skill/load_skill_resource_tool.js +7 -0
  243. package/dist/esm/tools/skill/load_skill_tool.js +3 -0
  244. package/dist/esm/tools/skill/run_skill_script_tool.js +12 -2
  245. package/dist/esm/tools/toolbox_toolset.js +167 -0
  246. package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
  247. package/dist/esm/utils/async_queue.js +37 -3
  248. package/dist/esm/utils/client_labels.js +17 -2
  249. package/dist/esm/utils/env_aware_utils.js +12 -7
  250. package/dist/esm/utils/error_utils.js +37 -1
  251. package/dist/esm/utils/failover_utils.js +11 -10
  252. package/dist/esm/utils/gemini_schema_util.js +144 -14
  253. package/dist/esm/utils/id_provider.js +33 -0
  254. package/dist/esm/utils/logger_node.js +4 -0
  255. package/dist/esm/utils/model_name.js +14 -0
  256. package/dist/esm/utils/output_schema_utils.js +5 -2
  257. package/dist/esm/utils/simple_zod_to_json.js +13 -31
  258. package/dist/esm/utils/ssrf_guard.js +55 -15
  259. package/dist/esm/utils/task.js +1 -1
  260. package/dist/esm/version.js +1 -1
  261. package/dist/esm/workflow/index.js +2 -1
  262. package/dist/esm/workflow/node_runner.js +26 -80
  263. package/dist/esm/workflow/nodes/parallel_worker.js +16 -6
  264. package/dist/esm/workflow/run_llm_agent_as_node.js +19 -14
  265. package/dist/esm/workflow/utils/retry_utils.js +2 -2
  266. package/dist/esm/workflow/workflow.js +12 -12
  267. package/dist/types/a2a/a2a_remote_agent.d.ts +6 -0
  268. package/dist/types/a2a/a2a_remote_agent_utils.d.ts +3 -2
  269. package/dist/types/agents/agent_engine_client.d.ts +155 -0
  270. package/dist/types/agents/base_agent.d.ts +14 -0
  271. package/dist/types/agents/llm_agent.d.ts +5 -1
  272. package/dist/types/agents/processors/content_processor_utils.d.ts +12 -10
  273. package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
  274. package/dist/types/agents/run_config.d.ts +14 -0
  275. package/dist/types/cli/cli_eval.d.ts +172 -9
  276. package/dist/types/cli/utils/cleanup.d.ts +18 -0
  277. package/dist/types/cli/utils/envs.d.ts +13 -3
  278. package/dist/types/cli/utils/evals.d.ts +64 -1
  279. package/dist/types/cli/utils/logs.d.ts +20 -3
  280. package/dist/types/cli/utils/path_validation.d.ts +30 -0
  281. package/dist/types/code_executors/container_code_executor.d.ts +62 -9
  282. package/dist/types/common.d.ts +21 -18
  283. package/dist/types/context/compaction_utils.d.ts +13 -1
  284. package/dist/types/errors/input_validation_error.d.ts +2 -1
  285. package/dist/types/events/event.d.ts +3 -0
  286. package/dist/types/features/feature_registry.d.ts +1 -0
  287. package/dist/types/index.d.ts +11 -6
  288. package/dist/types/plugins/base_plugin.d.ts +50 -31
  289. package/dist/types/plugins/plugin_manager.d.ts +13 -0
  290. package/dist/types/runner/runner.d.ts +11 -0
  291. package/dist/types/sessions/base_session_service.d.ts +5 -2
  292. package/dist/types/sessions/database_session_service.d.ts +17 -1
  293. package/dist/types/sessions/db/operations.d.ts +2 -1
  294. package/dist/types/sessions/db/schema.d.ts +5 -3
  295. package/dist/types/sessions/stale_session_error.d.ts +21 -0
  296. package/dist/types/skills/loader.d.ts +3 -2
  297. package/dist/types/telemetry/api/instrumentation.d.ts +259 -0
  298. package/dist/types/telemetry/api/internal/common/accumulators.d.ts +91 -0
  299. package/dist/types/telemetry/api/internal/common/attributes.d.ts +90 -0
  300. package/dist/types/telemetry/api/internal/common/config.d.ts +61 -0
  301. package/dist/types/telemetry/api/internal/common/error.d.ts +29 -0
  302. package/dist/types/telemetry/api/internal/common/finish_reason.d.ts +18 -0
  303. package/dist/types/telemetry/api/internal/common/genai_messages.d.ts +26 -0
  304. package/dist/types/telemetry/api/internal/common/http_exchange.d.ts +50 -0
  305. package/dist/types/telemetry/api/internal/common/provider_name.d.ts +16 -0
  306. package/dist/types/telemetry/api/internal/common/redaction.d.ts +14 -0
  307. package/dist/types/telemetry/api/internal/common/serialization.d.ts +18 -0
  308. package/dist/types/telemetry/api/internal/common/token_usage.d.ts +47 -0
  309. package/dist/types/telemetry/api/internal/logs/inference.d.ts +15 -0
  310. package/dist/types/telemetry/api/internal/logs/logger.d.ts +13 -0
  311. package/dist/types/telemetry/api/internal/logs/mcp.d.ts +31 -0
  312. package/dist/types/telemetry/api/internal/metrics/agent.d.ts +28 -0
  313. package/dist/types/telemetry/api/internal/metrics/inference_start_hook.d.ts +12 -0
  314. package/dist/types/telemetry/api/internal/metrics/meters.d.ts +57 -0
  315. package/dist/types/telemetry/api/internal/metrics/tool.d.ts +44 -0
  316. package/dist/types/telemetry/api/internal/metrics/workflow.d.ts +32 -0
  317. package/dist/types/telemetry/api/internal/trace/agent.d.ts +14 -0
  318. package/dist/types/telemetry/api/internal/trace/compaction.d.ts +20 -0
  319. package/dist/types/telemetry/api/internal/trace/inference.d.ts +31 -0
  320. package/dist/types/telemetry/api/internal/trace/live.d.ts +21 -0
  321. package/dist/types/telemetry/api/internal/trace/node.d.ts +22 -0
  322. package/dist/types/telemetry/api/internal/trace/propagation.d.ts +22 -0
  323. package/dist/types/telemetry/api/internal/trace/tool.d.ts +57 -0
  324. package/dist/types/telemetry/api/internal/trace/tracer.d.ts +31 -0
  325. package/dist/types/telemetry/api/internal/trace/workflow.d.ts +21 -0
  326. package/dist/types/telemetry/export/agent_engine.d.ts +23 -0
  327. package/dist/types/telemetry/export/agent_runtime.d.ts +40 -0
  328. package/dist/types/telemetry/export/google_cloud.d.ts +189 -0
  329. package/dist/types/telemetry/export/request_driven_metric_reader.d.ts +144 -0
  330. package/dist/types/telemetry/{setup.d.ts → export/setup.d.ts} +3 -0
  331. package/dist/types/tools/agent_tool.d.ts +1 -1
  332. package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +14 -21
  333. package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +32 -9
  334. package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +35 -12
  335. package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +3 -3
  336. package/dist/types/tools/application_integration_tool/integration_connector_tool.d.ts +70 -0
  337. package/dist/types/tools/base_toolset.d.ts +7 -6
  338. package/dist/types/tools/computer_use/base_computer.d.ts +281 -0
  339. package/dist/types/tools/computer_use/computer_use_actions.d.ts +53 -0
  340. package/dist/types/tools/computer_use/computer_use_tool.d.ts +108 -0
  341. package/dist/types/tools/computer_use/computer_use_toolset.d.ts +132 -0
  342. package/dist/types/tools/google_api_tool/google_api_tool.d.ts +10 -3
  343. package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +57 -0
  344. package/dist/types/tools/google_api_tool/google_api_toolsets.d.ts +48 -0
  345. package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +5 -4
  346. package/dist/types/tools/google_api_tool/index.d.ts +4 -5
  347. package/dist/types/tools/load_artifacts_tool.d.ts +18 -1
  348. package/dist/types/tools/load_memory_tool.d.ts +32 -4
  349. package/dist/types/tools/mcp/mcp_session_manager.d.ts +16 -0
  350. package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +8 -8
  351. package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +12 -0
  352. package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +15 -3
  353. package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +5 -0
  354. package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +10 -0
  355. package/dist/types/tools/toolbox_toolset.d.ts +154 -0
  356. package/dist/types/utils/async_queue.d.ts +14 -0
  357. package/dist/types/utils/client_labels.d.ts +2 -1
  358. package/dist/types/utils/env_aware_utils.d.ts +11 -0
  359. package/dist/types/utils/error_utils.d.ts +4 -0
  360. package/dist/types/utils/gemini_schema_util.d.ts +29 -0
  361. package/dist/types/utils/id_provider.d.ts +43 -0
  362. package/dist/types/utils/model_name.d.ts +8 -0
  363. package/dist/types/utils/output_schema_utils.d.ts +3 -2
  364. package/dist/types/utils/simple_zod_to_json.d.ts +1 -2
  365. package/dist/types/utils/ssrf_guard.d.ts +2 -0
  366. package/dist/types/version.d.ts +1 -1
  367. package/dist/types/workflow/index.d.ts +1 -1
  368. package/dist/types/workflow/nodes/parallel_worker.d.ts +8 -1
  369. package/dist/web/index_web.js +94 -88
  370. package/dist/web/index_web.js.map +4 -4
  371. package/package.json +43 -38
  372. package/dist/cjs/agents/remote_agent.js +0 -187
  373. package/dist/cjs/telemetry/google_cloud.js +0 -116
  374. package/dist/cjs/telemetry/tracing.js +0 -350
  375. package/dist/cjs/tools/crewai_tool.js +0 -132
  376. package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +0 -226
  377. package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +0 -58
  378. package/dist/cjs/tools/langchain_tool.js +0 -172
  379. package/dist/cjs/tools/toolbox_tool.js +0 -108
  380. package/dist/esm/agents/remote_agent.js +0 -164
  381. package/dist/esm/telemetry/google_cloud.js +0 -99
  382. package/dist/esm/telemetry/setup.js +0 -89
  383. package/dist/esm/telemetry/tracing.js +0 -315
  384. package/dist/esm/tools/crewai_tool.js +0 -107
  385. package/dist/esm/tools/google_api_tool/google_api_tool_set.js +0 -188
  386. package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +0 -24
  387. package/dist/esm/tools/langchain_tool.js +0 -148
  388. package/dist/esm/tools/toolbox_tool.js +0 -80
  389. package/dist/types/agents/remote_agent.d.ts +0 -68
  390. package/dist/types/telemetry/google_cloud.d.ts +0 -9
  391. package/dist/types/telemetry/tracing.d.ts +0 -129
  392. package/dist/types/tools/crewai_tool.d.ts +0 -85
  393. package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +0 -78
  394. package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +0 -33
  395. package/dist/types/tools/langchain_tool.d.ts +0 -103
  396. package/dist/types/tools/toolbox_tool.d.ts +0 -73
@@ -17,10 +17,14 @@ var __decorateClass = (decorators, target, key, kind) => {
17
17
  * SPDX-License-Identifier: Apache-2.0
18
18
  */
19
19
  import { experimental } from "../../../utils/experimental.js";
20
- import { toJsonObject } from "../../../utils/json_utils.js";
20
+ import {
21
+ isJsonObject,
22
+ toJsonObject
23
+ } from "../../../utils/json_utils.js";
21
24
  import { CloudPlatformTokenSource, sendCloudRequest } from "./cloud_request.js";
22
25
  const CONNECTOR_URL = "https://connectors.googleapis.com";
23
26
  const OPERATION_POLL_INTERVAL_MS = 1e3;
27
+ const MAX_OPERATION_POLL_ATTEMPTS = 60;
24
28
  function toStringValue(value) {
25
29
  return typeof value === "string" ? value : "";
26
30
  }
@@ -29,6 +33,16 @@ function sleep(ms) {
29
33
  return new Promise((resolve) => setTimeout(resolve, ms));
30
34
  }
31
35
  __name(sleep, "sleep");
36
+ function formatOperationError(error) {
37
+ if (typeof error === "string" && error.length > 0) {
38
+ return error;
39
+ }
40
+ if (isJsonObject(error) && typeof error["message"] === "string" && error["message"].length > 0) {
41
+ return error["message"];
42
+ }
43
+ return JSON.stringify(error);
44
+ }
45
+ __name(formatOperationError, "formatOperationError");
32
46
  function schemaRef(name) {
33
47
  return { $ref: `#/components/schemas/${name}` };
34
48
  }
@@ -110,6 +124,12 @@ const CONNECTOR_BASE_SPEC = {
110
124
  default: 120,
111
125
  description: "Timeout in seconds for execution of custom query"
112
126
  },
127
+ sortByColumns: {
128
+ type: "array",
129
+ items: { type: "string" },
130
+ default: [],
131
+ description: "Column to sort the results by"
132
+ },
113
133
  connectorOutputPayload: { type: "object" },
114
134
  nextPageToken: { type: "string" },
115
135
  "execute-connector_Response": {
@@ -173,55 +193,48 @@ function connectorPayload(jsonSchema) {
173
193
  }
174
194
  __name(connectorPayload, "connectorPayload");
175
195
  function postOperation(options) {
176
- const { summary, description, operationId, requestSchemaRef, responseSchema } = options;
177
- return {
178
- post: {
179
- summary,
180
- description,
181
- operationId,
182
- requestBody: {
196
+ const {
197
+ summary,
198
+ description,
199
+ operationId,
200
+ xOperation,
201
+ xEntity,
202
+ xAction,
203
+ requestSchemaRef,
204
+ responseSchema
205
+ } = options;
206
+ const post = {
207
+ summary,
208
+ description,
209
+ operationId,
210
+ "x-operation": xOperation,
211
+ requestBody: {
212
+ content: {
213
+ "application/json": {
214
+ schema: { $ref: requestSchemaRef }
215
+ }
216
+ }
217
+ },
218
+ responses: {
219
+ "200": {
220
+ description: "Success response",
183
221
  content: {
184
222
  "application/json": {
185
- schema: { $ref: requestSchemaRef }
186
- }
187
- }
188
- },
189
- responses: {
190
- "200": {
191
- description: "Success response",
192
- content: {
193
- "application/json": {
194
- schema: responseSchema
195
- }
223
+ schema: responseSchema
196
224
  }
197
225
  }
198
226
  }
199
227
  }
200
228
  };
229
+ if (xEntity !== void 0) {
230
+ post["x-entity"] = xEntity;
231
+ }
232
+ if (xAction !== void 0) {
233
+ post["x-action"] = xAction;
234
+ }
235
+ return { post };
201
236
  }
202
237
  __name(postOperation, "postOperation");
203
- function entityIdRequest() {
204
- return {
205
- type: "object",
206
- required: [
207
- "entityId",
208
- "operation",
209
- "connectionName",
210
- "serviceName",
211
- "host",
212
- "entity"
213
- ],
214
- properties: {
215
- entityId: schemaRef("entityId"),
216
- operation: schemaRef("operation"),
217
- connectionName: schemaRef("connectionName"),
218
- serviceName: schemaRef("serviceName"),
219
- host: schemaRef("host"),
220
- entity: schemaRef("entity")
221
- }
222
- };
223
- }
224
- __name(entityIdRequest, "entityIdRequest");
225
238
  function getActionOperation(options) {
226
239
  const {
227
240
  action,
@@ -230,7 +243,7 @@ function getActionOperation(options) {
230
243
  toolName = "",
231
244
  toolInstructions = ""
232
245
  } = options;
233
- let description = `Use this tool with action = "${action}" and operation = "${operation}" only. Don't ask these values from user.`;
246
+ let description = `Use this tool to execute ${action}`;
234
247
  if (operation === "EXECUTE_QUERY") {
235
248
  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.";
236
249
  }
@@ -238,6 +251,8 @@ function getActionOperation(options) {
238
251
  summary: actionDisplayName,
239
252
  description: `${description} ${toolInstructions}`,
240
253
  operationId: `${toolName}_${actionDisplayName}`,
254
+ xOperation: operation,
255
+ xAction: action,
241
256
  requestSchemaRef: `#/components/schemas/${actionDisplayName}_Request`,
242
257
  responseSchema: schemaRef(`${actionDisplayName}_Response`)
243
258
  });
@@ -252,8 +267,10 @@ function listOperation(options) {
252
267
  } = options;
253
268
  return postOperation({
254
269
  summary: `List ${entity}`,
255
- description: `Returns all entities of type ${entity}. Use this tool with entity = "${entity}" and operation = "LIST_ENTITIES" only. Don't ask these values from user. Always use "" as filter clause and "" as page token and 50 as page size until user specifies a different value otherwise. Use single quotes for strings in filter clause. ${toolInstructions}`,
270
+ 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}`,
256
271
  operationId: `${toolName}_list_${entity}`,
272
+ xOperation: "LIST_ENTITIES",
273
+ xEntity: entity,
257
274
  requestSchemaRef: `#/components/schemas/list_${entity}_Request`,
258
275
  responseSchema: {
259
276
  description: `Returns a list of ${entity} of json schema: ${schemaAsString}`,
@@ -271,8 +288,10 @@ function getOperation(options) {
271
288
  } = options;
272
289
  return postOperation({
273
290
  summary: `Get ${entity}`,
274
- description: `Returns the details of the ${entity}. Use this tool with entity = "${entity}" and operation = "GET_ENTITY" only. Don't ask these values from user. ${toolInstructions}`,
291
+ description: `Returns the details of the ${entity}. ${toolInstructions}`,
275
292
  operationId: `${toolName}_get_${entity}`,
293
+ xOperation: "GET_ENTITY",
294
+ xEntity: entity,
276
295
  requestSchemaRef: `#/components/schemas/get_${entity}_Request`,
277
296
  responseSchema: {
278
297
  description: `Returns ${entity} of json schema: ${schemaAsString}`,
@@ -284,9 +303,11 @@ __name(getOperation, "getOperation");
284
303
  function createOperation(options) {
285
304
  const { entity, toolName = "", toolInstructions = "" } = options;
286
305
  return postOperation({
287
- summary: `Create ${entity}`,
288
- description: `Creates a new entity of type ${entity}. Use this tool with entity = "${entity}" and operation = "CREATE_ENTITY" only. Don't ask these values from user. Follow the schema of the entity provided in the instructions to create ${entity}. ${toolInstructions}`,
306
+ summary: `Creates a new ${entity}`,
307
+ description: `Creates a new ${entity}. ${toolInstructions}`,
289
308
  operationId: `${toolName}_create_${entity}`,
309
+ xOperation: "CREATE_ENTITY",
310
+ xEntity: entity,
290
311
  requestSchemaRef: `#/components/schemas/create_${entity}_Request`,
291
312
  responseSchema: schemaRef("execute-connector_Response")
292
313
  });
@@ -295,9 +316,11 @@ __name(createOperation, "createOperation");
295
316
  function updateOperation(options) {
296
317
  const { entity, toolName = "", toolInstructions = "" } = options;
297
318
  return postOperation({
298
- summary: `Update ${entity}`,
299
- description: `Updates an entity of type ${entity}. Use this tool with entity = "${entity}" and operation = "UPDATE_ENTITY" only. Don't ask these values from user. Use entityId to uniquely identify the entity to update. Follow the schema of the entity provided in the instructions to update ${entity}. ${toolInstructions}`,
319
+ summary: `Updates the ${entity}`,
320
+ description: `Updates the ${entity}. ${toolInstructions}`,
300
321
  operationId: `${toolName}_update_${entity}`,
322
+ xOperation: "UPDATE_ENTITY",
323
+ xEntity: entity,
301
324
  requestSchemaRef: `#/components/schemas/update_${entity}_Request`,
302
325
  responseSchema: schemaRef("execute-connector_Response")
303
326
  });
@@ -306,15 +329,28 @@ __name(updateOperation, "updateOperation");
306
329
  function deleteOperation(options) {
307
330
  const { entity, toolName = "", toolInstructions = "" } = options;
308
331
  return postOperation({
309
- summary: `Delete ${entity}`,
310
- description: `Deletes an entity of type ${entity}. Use this tool with entity = "${entity}" and operation = "DELETE_ENTITY" only. Don't ask these values from user. ${toolInstructions}`,
332
+ summary: `Delete the ${entity}`,
333
+ description: `Deletes the ${entity}. ${toolInstructions}`,
311
334
  operationId: `${toolName}_delete_${entity}`,
335
+ xOperation: "DELETE_ENTITY",
336
+ xEntity: entity,
312
337
  requestSchemaRef: `#/components/schemas/delete_${entity}_Request`,
313
338
  responseSchema: schemaRef("execute-connector_Response")
314
339
  });
315
340
  }
316
341
  __name(deleteOperation, "deleteOperation");
317
- function createOperationRequest(entity) {
342
+ function createOperationRequest(entity, options) {
343
+ const properties = {
344
+ connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
345
+ operation: schemaRef("operation"),
346
+ connectionName: schemaRef("connectionName"),
347
+ serviceName: schemaRef("serviceName"),
348
+ host: schemaRef("host"),
349
+ entity: schemaRef("entity")
350
+ };
351
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
352
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
353
+ }
318
354
  return {
319
355
  type: "object",
320
356
  required: [
@@ -325,18 +361,24 @@ function createOperationRequest(entity) {
325
361
  "host",
326
362
  "entity"
327
363
  ],
328
- properties: {
329
- connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
330
- operation: schemaRef("operation"),
331
- connectionName: schemaRef("connectionName"),
332
- serviceName: schemaRef("serviceName"),
333
- host: schemaRef("host"),
334
- entity: schemaRef("entity")
335
- }
364
+ properties
336
365
  };
337
366
  }
338
367
  __name(createOperationRequest, "createOperationRequest");
339
- function updateOperationRequest(entity) {
368
+ function updateOperationRequest(entity, options) {
369
+ const properties = {
370
+ connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
371
+ entityId: schemaRef("entityId"),
372
+ operation: schemaRef("operation"),
373
+ connectionName: schemaRef("connectionName"),
374
+ serviceName: schemaRef("serviceName"),
375
+ host: schemaRef("host"),
376
+ entity: schemaRef("entity"),
377
+ filterClause: schemaRef("filterClause")
378
+ };
379
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
380
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
381
+ }
340
382
  return {
341
383
  type: "object",
342
384
  required: [
@@ -348,44 +390,97 @@ function updateOperationRequest(entity) {
348
390
  "host",
349
391
  "entity"
350
392
  ],
351
- properties: {
352
- connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
353
- entityId: schemaRef("entityId"),
354
- operation: schemaRef("operation"),
355
- connectionName: schemaRef("connectionName"),
356
- serviceName: schemaRef("serviceName"),
357
- host: schemaRef("host"),
358
- entity: schemaRef("entity")
359
- }
393
+ properties
360
394
  };
361
395
  }
362
396
  __name(updateOperationRequest, "updateOperationRequest");
363
- function getOperationRequest() {
364
- return entityIdRequest();
397
+ function getOperationRequest(options) {
398
+ const properties = {
399
+ entityId: schemaRef("entityId"),
400
+ operation: schemaRef("operation"),
401
+ connectionName: schemaRef("connectionName"),
402
+ serviceName: schemaRef("serviceName"),
403
+ host: schemaRef("host"),
404
+ entity: schemaRef("entity")
405
+ };
406
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
407
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
408
+ }
409
+ return {
410
+ type: "object",
411
+ required: [
412
+ "entityId",
413
+ "operation",
414
+ "connectionName",
415
+ "serviceName",
416
+ "host",
417
+ "entity"
418
+ ],
419
+ properties
420
+ };
365
421
  }
366
422
  __name(getOperationRequest, "getOperationRequest");
367
- function deleteOperationRequest() {
368
- return entityIdRequest();
423
+ function deleteOperationRequest(options) {
424
+ const properties = {
425
+ entityId: schemaRef("entityId"),
426
+ operation: schemaRef("operation"),
427
+ connectionName: schemaRef("connectionName"),
428
+ serviceName: schemaRef("serviceName"),
429
+ host: schemaRef("host"),
430
+ entity: schemaRef("entity"),
431
+ filterClause: schemaRef("filterClause")
432
+ };
433
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
434
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
435
+ }
436
+ return {
437
+ type: "object",
438
+ required: [
439
+ "entityId",
440
+ "operation",
441
+ "connectionName",
442
+ "serviceName",
443
+ "host",
444
+ "entity"
445
+ ],
446
+ properties
447
+ };
369
448
  }
370
449
  __name(deleteOperationRequest, "deleteOperationRequest");
371
- function listOperationRequest() {
450
+ function listOperationRequest(options) {
451
+ const properties = {
452
+ filterClause: schemaRef("filterClause"),
453
+ pageSize: schemaRef("pageSize"),
454
+ pageToken: schemaRef("pageToken"),
455
+ operation: schemaRef("operation"),
456
+ connectionName: schemaRef("connectionName"),
457
+ serviceName: schemaRef("serviceName"),
458
+ host: schemaRef("host"),
459
+ entity: schemaRef("entity"),
460
+ sortByColumns: schemaRef("sortByColumns")
461
+ };
462
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
463
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
464
+ }
372
465
  return {
373
466
  type: "object",
374
467
  required: ["operation", "connectionName", "serviceName", "host", "entity"],
375
- properties: {
376
- filterClause: schemaRef("filterClause"),
377
- pageSize: schemaRef("pageSize"),
378
- pageToken: schemaRef("pageToken"),
379
- operation: schemaRef("operation"),
380
- connectionName: schemaRef("connectionName"),
381
- serviceName: schemaRef("serviceName"),
382
- host: schemaRef("host"),
383
- entity: schemaRef("entity")
384
- }
468
+ properties
385
469
  };
386
470
  }
387
471
  __name(listOperationRequest, "listOperationRequest");
388
- function actionRequest(action) {
472
+ function actionRequest(action, options) {
473
+ const properties = {
474
+ operation: schemaRef("operation"),
475
+ connectionName: schemaRef("connectionName"),
476
+ serviceName: schemaRef("serviceName"),
477
+ host: schemaRef("host"),
478
+ action: schemaRef("action"),
479
+ connectorInputPayload: schemaRef(`connectorInputPayload_${action}`)
480
+ };
481
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
482
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
483
+ }
389
484
  return {
390
485
  type: "object",
391
486
  required: [
@@ -396,14 +491,7 @@ function actionRequest(action) {
396
491
  "action",
397
492
  "connectorInputPayload"
398
493
  ],
399
- properties: {
400
- operation: schemaRef("operation"),
401
- connectionName: schemaRef("connectionName"),
402
- serviceName: schemaRef("serviceName"),
403
- host: schemaRef("host"),
404
- action: schemaRef("action"),
405
- connectorInputPayload: schemaRef(`connectorInputPayload_${action}`)
406
- }
494
+ properties
407
495
  };
408
496
  }
409
497
  __name(actionRequest, "actionRequest");
@@ -416,7 +504,20 @@ function actionResponse(action) {
416
504
  };
417
505
  }
418
506
  __name(actionResponse, "actionResponse");
419
- function executeCustomQueryRequest() {
507
+ function executeCustomQueryRequest(options) {
508
+ const properties = {
509
+ operation: schemaRef("operation"),
510
+ connectionName: schemaRef("connectionName"),
511
+ serviceName: schemaRef("serviceName"),
512
+ host: schemaRef("host"),
513
+ action: schemaRef("action"),
514
+ query: schemaRef("query"),
515
+ timeout: schemaRef("timeout"),
516
+ pageSize: schemaRef("pageSize")
517
+ };
518
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
519
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
520
+ }
420
521
  return {
421
522
  type: "object",
422
523
  required: [
@@ -429,16 +530,7 @@ function executeCustomQueryRequest() {
429
530
  "timeout",
430
531
  "pageSize"
431
532
  ],
432
- properties: {
433
- operation: schemaRef("operation"),
434
- connectionName: schemaRef("connectionName"),
435
- serviceName: schemaRef("serviceName"),
436
- host: schemaRef("host"),
437
- action: schemaRef("action"),
438
- query: schemaRef("query"),
439
- timeout: schemaRef("timeout"),
440
- pageSize: schemaRef("pageSize")
441
- }
533
+ properties
442
534
  };
443
535
  }
444
536
  __name(executeCustomQueryRequest, "executeCustomQueryRequest");
@@ -450,22 +542,24 @@ let ConnectionsClient = class {
450
542
  this.tokenSource = new CloudPlatformTokenSource(options.serviceAccountJson);
451
543
  }
452
544
  /**
453
- * Reads the service name and host of the connection, and whether it allows
454
- * an authentication override.
545
+ * Reads the resource name, service name and host of the connection, and
546
+ * whether it allows an authentication override.
455
547
  */
456
548
  async getConnectionDetails() {
457
549
  const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}?view=BASIC`;
458
550
  const connectionData = toJsonObject(await this.executeApiCall(url));
551
+ const name = toStringValue(connectionData["name"]);
459
552
  const host = toStringValue(connectionData["host"]);
460
553
  const serviceName = host ? toStringValue(connectionData["tlsServiceDirectory"]) : toStringValue(connectionData["serviceDirectory"]);
461
554
  const authOverrideEnabled = connectionData["authOverrideEnabled"] === true;
462
- return { serviceName, host, authOverrideEnabled };
555
+ return { name, serviceName, host, authOverrideEnabled };
463
556
  }
464
557
  /**
465
558
  * Reads the JSON schema of an entity and the operations it supports.
466
559
  *
467
560
  * @param entity The entity name.
468
- * @throws Error When the API starts no operation for the entity.
561
+ * @throws Error When the API starts no operation for the entity, or the
562
+ * operation fails or times out.
469
563
  */
470
564
  async getEntitySchemaAndOperations(entity) {
471
565
  const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}/connectionSchemaMetadata:getEntityType?entityId=${entity}`;
@@ -490,7 +584,8 @@ let ConnectionsClient = class {
490
584
  * Reads the input and output JSON schemas of an action.
491
585
  *
492
586
  * @param action The action name.
493
- * @throws Error When the API starts no operation for the action.
587
+ * @throws Error When the API starts no operation for the action, or the
588
+ * operation fails or times out.
494
589
  */
495
590
  async getActionSchema(action) {
496
591
  const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}/connectionSchemaMetadata:getAction?actionId=${action}`;
@@ -525,15 +620,31 @@ let ConnectionsClient = class {
525
620
  invalidRequestMessage: `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), connection(${this.connection}).`
526
621
  });
527
622
  }
528
- /** Polls a long-running operation until it reports `done`. */
623
+ /**
624
+ * Polls a long-running operation until it reports `done`.
625
+ *
626
+ * @throws Error When the operation reports an `error` or does not finish
627
+ * within `MAX_OPERATION_POLL_ATTEMPTS` polls.
628
+ */
529
629
  async pollOperation(operationId) {
530
630
  const url = `${CONNECTOR_URL}/v1/${operationId}`;
531
- let operation = toJsonObject(await this.executeApiCall(url));
532
- while (operation["done"] !== true) {
533
- await sleep(OPERATION_POLL_INTERVAL_MS);
534
- operation = toJsonObject(await this.executeApiCall(url));
631
+ for (let attempt = 0; attempt < MAX_OPERATION_POLL_ATTEMPTS; attempt++) {
632
+ if (attempt > 0) {
633
+ await sleep(OPERATION_POLL_INTERVAL_MS);
634
+ }
635
+ const operation = toJsonObject(await this.executeApiCall(url));
636
+ if (operation["error"]) {
637
+ throw new Error(
638
+ `Operation ${operationId} failed: ${formatOperationError(operation["error"])}`
639
+ );
640
+ }
641
+ if (operation["done"] === true) {
642
+ return operation;
643
+ }
535
644
  }
536
- return operation;
645
+ throw new Error(
646
+ `Operation ${operationId} timed out after ${MAX_OPERATION_POLL_ATTEMPTS} poll attempts.`
647
+ );
537
648
  }
538
649
  };
539
650
  __name(ConnectionsClient, "ConnectionsClient");
@@ -44,13 +44,14 @@ import {
44
44
  } from "./connections_client.js";
45
45
  const EXECUTE_CONNECTION_INTEGRATION = "ExecuteConnection";
46
46
  const EXECUTE_CUSTOM_QUERY_ACTION = "ExecuteCustomQuery";
47
+ const REQUEST_SCHEMA_OPTIONS = Object.freeze({ includeDynamicAuthConfig: true });
47
48
  let IntegrationClient = class {
48
49
  constructor(options) {
49
50
  var _a, _b;
50
51
  this.project = options.project;
51
52
  this.location = options.location;
52
53
  this.integration = options.integration;
53
- this.trigger = options.trigger;
54
+ this.triggers = options.triggers;
54
55
  this.connection = options.connection;
55
56
  this.entityOperations = (_a = options.entityOperations) != null ? _a : {};
56
57
  this.actions = (_b = options.actions) != null ? _b : [];
@@ -66,6 +67,7 @@ let IntegrationClient = class {
66
67
  */
67
68
  async getOpenApiSpecForIntegration() {
68
69
  const url = `https://${this.location}-integrations.googleapis.com/v1/projects/${this.project}/locations/${this.location}:generateOpenApiSpec`;
70
+ const invalidRequestMessage = `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), integration(${this.integration}).`;
69
71
  const body = await sendCloudRequest({
70
72
  url,
71
73
  method: "POST",
@@ -73,13 +75,13 @@ let IntegrationClient = class {
73
75
  apiTriggerResources: [
74
76
  {
75
77
  integrationResource: this.integration,
76
- triggerId: [this.trigger]
78
+ triggerId: this.triggers
77
79
  }
78
80
  ],
79
81
  fileFormat: "JSON"
80
82
  },
81
83
  tokenSource: this.tokenSource,
82
- invalidRequestMessage: `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), integration(${this.integration}) and trigger(${this.trigger}).`
84
+ invalidRequestMessage
83
85
  });
84
86
  try {
85
87
  const spec = isJsonObject(body) ? body["openApiSpec"] : void 0;
@@ -140,7 +142,10 @@ let IntegrationClient = class {
140
142
  toolName,
141
143
  toolInstructions
142
144
  });
143
- schemas[`create_${entity}_Request`] = createOperationRequest(entity);
145
+ schemas[`create_${entity}_Request`] = createOperationRequest(
146
+ entity,
147
+ REQUEST_SCHEMA_OPTIONS
148
+ );
144
149
  break;
145
150
  case "update":
146
151
  connectorSpec.paths[path] = updateOperation({
@@ -148,7 +153,10 @@ let IntegrationClient = class {
148
153
  toolName,
149
154
  toolInstructions
150
155
  });
151
- schemas[`update_${entity}_Request`] = updateOperationRequest(entity);
156
+ schemas[`update_${entity}_Request`] = updateOperationRequest(
157
+ entity,
158
+ REQUEST_SCHEMA_OPTIONS
159
+ );
152
160
  break;
153
161
  case "delete":
154
162
  connectorSpec.paths[path] = deleteOperation({
@@ -156,7 +164,9 @@ let IntegrationClient = class {
156
164
  toolName,
157
165
  toolInstructions
158
166
  });
159
- schemas[`delete_${entity}_Request`] = deleteOperationRequest();
167
+ schemas[`delete_${entity}_Request`] = deleteOperationRequest(
168
+ REQUEST_SCHEMA_OPTIONS
169
+ );
160
170
  break;
161
171
  case "list":
162
172
  connectorSpec.paths[path] = listOperation({
@@ -165,7 +175,9 @@ let IntegrationClient = class {
165
175
  toolName,
166
176
  toolInstructions
167
177
  });
168
- schemas[`list_${entity}_Request`] = listOperationRequest();
178
+ schemas[`list_${entity}_Request`] = listOperationRequest(
179
+ REQUEST_SCHEMA_OPTIONS
180
+ );
169
181
  break;
170
182
  case "get":
171
183
  connectorSpec.paths[path] = getOperation({
@@ -174,7 +186,9 @@ let IntegrationClient = class {
174
186
  toolName,
175
187
  toolInstructions
176
188
  });
177
- schemas[`get_${entity}_Request`] = getOperationRequest();
189
+ schemas[`get_${entity}_Request`] = getOperationRequest(
190
+ REQUEST_SCHEMA_OPTIONS
191
+ );
178
192
  break;
179
193
  default:
180
194
  throw new Error(
@@ -185,20 +199,26 @@ let IntegrationClient = class {
185
199
  }
186
200
  for (const action of this.actions) {
187
201
  const { inputSchema, outputSchema, displayName } = await connectionsClient.getActionSchema(action);
202
+ const actionDisplayName = displayName.replace(/ /g, "");
188
203
  let operation = "EXECUTE_ACTION";
189
204
  if (action === EXECUTE_CUSTOM_QUERY_ACTION) {
190
- schemas[`${action}_Request`] = executeCustomQueryRequest();
205
+ schemas[`${actionDisplayName}_Request`] = executeCustomQueryRequest(
206
+ REQUEST_SCHEMA_OPTIONS
207
+ );
191
208
  operation = "EXECUTE_QUERY";
192
209
  } else {
193
- schemas[`${displayName}_Request`] = actionRequest(displayName);
194
- schemas[`connectorInputPayload_${displayName}`] = connectorPayload(inputSchema);
210
+ schemas[`${actionDisplayName}_Request`] = actionRequest(
211
+ actionDisplayName,
212
+ REQUEST_SCHEMA_OPTIONS
213
+ );
214
+ schemas[`connectorInputPayload_${actionDisplayName}`] = connectorPayload(inputSchema);
195
215
  }
196
- schemas[`connectorOutputPayload_${displayName}`] = connectorPayload(outputSchema);
197
- schemas[`${displayName}_Response`] = actionResponse(displayName);
216
+ schemas[`connectorOutputPayload_${actionDisplayName}`] = connectorPayload(outputSchema);
217
+ schemas[`${actionDisplayName}_Response`] = actionResponse(actionDisplayName);
198
218
  connectorSpec.paths[`${pathPrefix}#${action}`] = getActionOperation({
199
219
  action,
200
220
  operation,
201
- actionDisplayName: displayName,
221
+ actionDisplayName,
202
222
  toolName,
203
223
  toolInstructions
204
224
  });