@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
@@ -62,6 +62,7 @@ var import_cloud_request = require("./cloud_request.js");
62
62
  */
63
63
  const CONNECTOR_URL = "https://connectors.googleapis.com";
64
64
  const OPERATION_POLL_INTERVAL_MS = 1e3;
65
+ const MAX_OPERATION_POLL_ATTEMPTS = 60;
65
66
  function toStringValue(value) {
66
67
  return typeof value === "string" ? value : "";
67
68
  }
@@ -70,6 +71,16 @@ function sleep(ms) {
70
71
  return new Promise((resolve) => setTimeout(resolve, ms));
71
72
  }
72
73
  __name(sleep, "sleep");
74
+ function formatOperationError(error) {
75
+ if (typeof error === "string" && error.length > 0) {
76
+ return error;
77
+ }
78
+ if ((0, import_json_utils.isJsonObject)(error) && typeof error["message"] === "string" && error["message"].length > 0) {
79
+ return error["message"];
80
+ }
81
+ return JSON.stringify(error);
82
+ }
83
+ __name(formatOperationError, "formatOperationError");
73
84
  function schemaRef(name) {
74
85
  return { $ref: `#/components/schemas/${name}` };
75
86
  }
@@ -151,6 +162,12 @@ const CONNECTOR_BASE_SPEC = {
151
162
  default: 120,
152
163
  description: "Timeout in seconds for execution of custom query"
153
164
  },
165
+ sortByColumns: {
166
+ type: "array",
167
+ items: { type: "string" },
168
+ default: [],
169
+ description: "Column to sort the results by"
170
+ },
154
171
  connectorOutputPayload: { type: "object" },
155
172
  nextPageToken: { type: "string" },
156
173
  "execute-connector_Response": {
@@ -214,55 +231,48 @@ function connectorPayload(jsonSchema) {
214
231
  }
215
232
  __name(connectorPayload, "connectorPayload");
216
233
  function postOperation(options) {
217
- const { summary, description, operationId, requestSchemaRef, responseSchema } = options;
218
- return {
219
- post: {
220
- summary,
221
- description,
222
- operationId,
223
- requestBody: {
234
+ const {
235
+ summary,
236
+ description,
237
+ operationId,
238
+ xOperation,
239
+ xEntity,
240
+ xAction,
241
+ requestSchemaRef,
242
+ responseSchema
243
+ } = options;
244
+ const post = {
245
+ summary,
246
+ description,
247
+ operationId,
248
+ "x-operation": xOperation,
249
+ requestBody: {
250
+ content: {
251
+ "application/json": {
252
+ schema: { $ref: requestSchemaRef }
253
+ }
254
+ }
255
+ },
256
+ responses: {
257
+ "200": {
258
+ description: "Success response",
224
259
  content: {
225
260
  "application/json": {
226
- schema: { $ref: requestSchemaRef }
227
- }
228
- }
229
- },
230
- responses: {
231
- "200": {
232
- description: "Success response",
233
- content: {
234
- "application/json": {
235
- schema: responseSchema
236
- }
261
+ schema: responseSchema
237
262
  }
238
263
  }
239
264
  }
240
265
  }
241
266
  };
267
+ if (xEntity !== void 0) {
268
+ post["x-entity"] = xEntity;
269
+ }
270
+ if (xAction !== void 0) {
271
+ post["x-action"] = xAction;
272
+ }
273
+ return { post };
242
274
  }
243
275
  __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
276
  function getActionOperation(options) {
267
277
  const {
268
278
  action,
@@ -271,7 +281,7 @@ function getActionOperation(options) {
271
281
  toolName = "",
272
282
  toolInstructions = ""
273
283
  } = options;
274
- let description = `Use this tool with action = "${action}" and operation = "${operation}" only. Don't ask these values from user.`;
284
+ let description = `Use this tool to execute ${action}`;
275
285
  if (operation === "EXECUTE_QUERY") {
276
286
  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
287
  }
@@ -279,6 +289,8 @@ function getActionOperation(options) {
279
289
  summary: actionDisplayName,
280
290
  description: `${description} ${toolInstructions}`,
281
291
  operationId: `${toolName}_${actionDisplayName}`,
292
+ xOperation: operation,
293
+ xAction: action,
282
294
  requestSchemaRef: `#/components/schemas/${actionDisplayName}_Request`,
283
295
  responseSchema: schemaRef(`${actionDisplayName}_Response`)
284
296
  });
@@ -293,8 +305,10 @@ function listOperation(options) {
293
305
  } = options;
294
306
  return postOperation({
295
307
  summary: `List ${entity}`,
296
- 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}`,
308
+ 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
309
  operationId: `${toolName}_list_${entity}`,
310
+ xOperation: "LIST_ENTITIES",
311
+ xEntity: entity,
298
312
  requestSchemaRef: `#/components/schemas/list_${entity}_Request`,
299
313
  responseSchema: {
300
314
  description: `Returns a list of ${entity} of json schema: ${schemaAsString}`,
@@ -312,8 +326,10 @@ function getOperation(options) {
312
326
  } = options;
313
327
  return postOperation({
314
328
  summary: `Get ${entity}`,
315
- 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}`,
329
+ description: `Returns the details of the ${entity}. ${toolInstructions}`,
316
330
  operationId: `${toolName}_get_${entity}`,
331
+ xOperation: "GET_ENTITY",
332
+ xEntity: entity,
317
333
  requestSchemaRef: `#/components/schemas/get_${entity}_Request`,
318
334
  responseSchema: {
319
335
  description: `Returns ${entity} of json schema: ${schemaAsString}`,
@@ -325,9 +341,11 @@ __name(getOperation, "getOperation");
325
341
  function createOperation(options) {
326
342
  const { entity, toolName = "", toolInstructions = "" } = options;
327
343
  return postOperation({
328
- summary: `Create ${entity}`,
329
- 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}`,
344
+ summary: `Creates a new ${entity}`,
345
+ description: `Creates a new ${entity}. ${toolInstructions}`,
330
346
  operationId: `${toolName}_create_${entity}`,
347
+ xOperation: "CREATE_ENTITY",
348
+ xEntity: entity,
331
349
  requestSchemaRef: `#/components/schemas/create_${entity}_Request`,
332
350
  responseSchema: schemaRef("execute-connector_Response")
333
351
  });
@@ -336,9 +354,11 @@ __name(createOperation, "createOperation");
336
354
  function updateOperation(options) {
337
355
  const { entity, toolName = "", toolInstructions = "" } = options;
338
356
  return postOperation({
339
- summary: `Update ${entity}`,
340
- 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}`,
357
+ summary: `Updates the ${entity}`,
358
+ description: `Updates the ${entity}. ${toolInstructions}`,
341
359
  operationId: `${toolName}_update_${entity}`,
360
+ xOperation: "UPDATE_ENTITY",
361
+ xEntity: entity,
342
362
  requestSchemaRef: `#/components/schemas/update_${entity}_Request`,
343
363
  responseSchema: schemaRef("execute-connector_Response")
344
364
  });
@@ -347,15 +367,28 @@ __name(updateOperation, "updateOperation");
347
367
  function deleteOperation(options) {
348
368
  const { entity, toolName = "", toolInstructions = "" } = options;
349
369
  return postOperation({
350
- summary: `Delete ${entity}`,
351
- 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}`,
370
+ summary: `Delete the ${entity}`,
371
+ description: `Deletes the ${entity}. ${toolInstructions}`,
352
372
  operationId: `${toolName}_delete_${entity}`,
373
+ xOperation: "DELETE_ENTITY",
374
+ xEntity: entity,
353
375
  requestSchemaRef: `#/components/schemas/delete_${entity}_Request`,
354
376
  responseSchema: schemaRef("execute-connector_Response")
355
377
  });
356
378
  }
357
379
  __name(deleteOperation, "deleteOperation");
358
- function createOperationRequest(entity) {
380
+ function createOperationRequest(entity, options) {
381
+ const properties = {
382
+ connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
383
+ operation: schemaRef("operation"),
384
+ connectionName: schemaRef("connectionName"),
385
+ serviceName: schemaRef("serviceName"),
386
+ host: schemaRef("host"),
387
+ entity: schemaRef("entity")
388
+ };
389
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
390
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
391
+ }
359
392
  return {
360
393
  type: "object",
361
394
  required: [
@@ -366,18 +399,24 @@ function createOperationRequest(entity) {
366
399
  "host",
367
400
  "entity"
368
401
  ],
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
- }
402
+ properties
377
403
  };
378
404
  }
379
405
  __name(createOperationRequest, "createOperationRequest");
380
- function updateOperationRequest(entity) {
406
+ function updateOperationRequest(entity, options) {
407
+ const properties = {
408
+ connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
409
+ entityId: schemaRef("entityId"),
410
+ operation: schemaRef("operation"),
411
+ connectionName: schemaRef("connectionName"),
412
+ serviceName: schemaRef("serviceName"),
413
+ host: schemaRef("host"),
414
+ entity: schemaRef("entity"),
415
+ filterClause: schemaRef("filterClause")
416
+ };
417
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
418
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
419
+ }
381
420
  return {
382
421
  type: "object",
383
422
  required: [
@@ -389,44 +428,97 @@ function updateOperationRequest(entity) {
389
428
  "host",
390
429
  "entity"
391
430
  ],
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
- }
431
+ properties
401
432
  };
402
433
  }
403
434
  __name(updateOperationRequest, "updateOperationRequest");
404
- function getOperationRequest() {
405
- return entityIdRequest();
435
+ function getOperationRequest(options) {
436
+ const properties = {
437
+ entityId: schemaRef("entityId"),
438
+ operation: schemaRef("operation"),
439
+ connectionName: schemaRef("connectionName"),
440
+ serviceName: schemaRef("serviceName"),
441
+ host: schemaRef("host"),
442
+ entity: schemaRef("entity")
443
+ };
444
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
445
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
446
+ }
447
+ return {
448
+ type: "object",
449
+ required: [
450
+ "entityId",
451
+ "operation",
452
+ "connectionName",
453
+ "serviceName",
454
+ "host",
455
+ "entity"
456
+ ],
457
+ properties
458
+ };
406
459
  }
407
460
  __name(getOperationRequest, "getOperationRequest");
408
- function deleteOperationRequest() {
409
- return entityIdRequest();
461
+ function deleteOperationRequest(options) {
462
+ const properties = {
463
+ entityId: schemaRef("entityId"),
464
+ operation: schemaRef("operation"),
465
+ connectionName: schemaRef("connectionName"),
466
+ serviceName: schemaRef("serviceName"),
467
+ host: schemaRef("host"),
468
+ entity: schemaRef("entity"),
469
+ filterClause: schemaRef("filterClause")
470
+ };
471
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
472
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
473
+ }
474
+ return {
475
+ type: "object",
476
+ required: [
477
+ "entityId",
478
+ "operation",
479
+ "connectionName",
480
+ "serviceName",
481
+ "host",
482
+ "entity"
483
+ ],
484
+ properties
485
+ };
410
486
  }
411
487
  __name(deleteOperationRequest, "deleteOperationRequest");
412
- function listOperationRequest() {
488
+ function listOperationRequest(options) {
489
+ const properties = {
490
+ filterClause: schemaRef("filterClause"),
491
+ pageSize: schemaRef("pageSize"),
492
+ pageToken: schemaRef("pageToken"),
493
+ operation: schemaRef("operation"),
494
+ connectionName: schemaRef("connectionName"),
495
+ serviceName: schemaRef("serviceName"),
496
+ host: schemaRef("host"),
497
+ entity: schemaRef("entity"),
498
+ sortByColumns: schemaRef("sortByColumns")
499
+ };
500
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
501
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
502
+ }
413
503
  return {
414
504
  type: "object",
415
505
  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
- }
506
+ properties
426
507
  };
427
508
  }
428
509
  __name(listOperationRequest, "listOperationRequest");
429
- function actionRequest(action) {
510
+ function actionRequest(action, options) {
511
+ const properties = {
512
+ operation: schemaRef("operation"),
513
+ connectionName: schemaRef("connectionName"),
514
+ serviceName: schemaRef("serviceName"),
515
+ host: schemaRef("host"),
516
+ action: schemaRef("action"),
517
+ connectorInputPayload: schemaRef(`connectorInputPayload_${action}`)
518
+ };
519
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
520
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
521
+ }
430
522
  return {
431
523
  type: "object",
432
524
  required: [
@@ -437,14 +529,7 @@ function actionRequest(action) {
437
529
  "action",
438
530
  "connectorInputPayload"
439
531
  ],
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
- }
532
+ properties
448
533
  };
449
534
  }
450
535
  __name(actionRequest, "actionRequest");
@@ -457,7 +542,20 @@ function actionResponse(action) {
457
542
  };
458
543
  }
459
544
  __name(actionResponse, "actionResponse");
460
- function executeCustomQueryRequest() {
545
+ function executeCustomQueryRequest(options) {
546
+ const properties = {
547
+ operation: schemaRef("operation"),
548
+ connectionName: schemaRef("connectionName"),
549
+ serviceName: schemaRef("serviceName"),
550
+ host: schemaRef("host"),
551
+ action: schemaRef("action"),
552
+ query: schemaRef("query"),
553
+ timeout: schemaRef("timeout"),
554
+ pageSize: schemaRef("pageSize")
555
+ };
556
+ if (options == null ? void 0 : options.includeDynamicAuthConfig) {
557
+ properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
558
+ }
461
559
  return {
462
560
  type: "object",
463
561
  required: [
@@ -470,16 +568,7 @@ function executeCustomQueryRequest() {
470
568
  "timeout",
471
569
  "pageSize"
472
570
  ],
473
- properties: {
474
- operation: schemaRef("operation"),
475
- connectionName: schemaRef("connectionName"),
476
- serviceName: schemaRef("serviceName"),
477
- host: schemaRef("host"),
478
- action: schemaRef("action"),
479
- query: schemaRef("query"),
480
- timeout: schemaRef("timeout"),
481
- pageSize: schemaRef("pageSize")
482
- }
571
+ properties
483
572
  };
484
573
  }
485
574
  __name(executeCustomQueryRequest, "executeCustomQueryRequest");
@@ -491,22 +580,24 @@ let ConnectionsClient = class {
491
580
  this.tokenSource = new import_cloud_request.CloudPlatformTokenSource(options.serviceAccountJson);
492
581
  }
493
582
  /**
494
- * Reads the service name and host of the connection, and whether it allows
495
- * an authentication override.
583
+ * Reads the resource name, service name and host of the connection, and
584
+ * whether it allows an authentication override.
496
585
  */
497
586
  async getConnectionDetails() {
498
587
  const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}?view=BASIC`;
499
588
  const connectionData = (0, import_json_utils.toJsonObject)(await this.executeApiCall(url));
589
+ const name = toStringValue(connectionData["name"]);
500
590
  const host = toStringValue(connectionData["host"]);
501
591
  const serviceName = host ? toStringValue(connectionData["tlsServiceDirectory"]) : toStringValue(connectionData["serviceDirectory"]);
502
592
  const authOverrideEnabled = connectionData["authOverrideEnabled"] === true;
503
- return { serviceName, host, authOverrideEnabled };
593
+ return { name, serviceName, host, authOverrideEnabled };
504
594
  }
505
595
  /**
506
596
  * Reads the JSON schema of an entity and the operations it supports.
507
597
  *
508
598
  * @param entity The entity name.
509
- * @throws Error When the API starts no operation for the entity.
599
+ * @throws Error When the API starts no operation for the entity, or the
600
+ * operation fails or times out.
510
601
  */
511
602
  async getEntitySchemaAndOperations(entity) {
512
603
  const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}/connectionSchemaMetadata:getEntityType?entityId=${entity}`;
@@ -531,7 +622,8 @@ let ConnectionsClient = class {
531
622
  * Reads the input and output JSON schemas of an action.
532
623
  *
533
624
  * @param action The action name.
534
- * @throws Error When the API starts no operation for the action.
625
+ * @throws Error When the API starts no operation for the action, or the
626
+ * operation fails or times out.
535
627
  */
536
628
  async getActionSchema(action) {
537
629
  const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}/connectionSchemaMetadata:getAction?actionId=${action}`;
@@ -566,15 +658,31 @@ let ConnectionsClient = class {
566
658
  invalidRequestMessage: `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), connection(${this.connection}).`
567
659
  });
568
660
  }
569
- /** Polls a long-running operation until it reports `done`. */
661
+ /**
662
+ * Polls a long-running operation until it reports `done`.
663
+ *
664
+ * @throws Error When the operation reports an `error` or does not finish
665
+ * within `MAX_OPERATION_POLL_ATTEMPTS` polls.
666
+ */
570
667
  async pollOperation(operationId) {
571
668
  const url = `${CONNECTOR_URL}/v1/${operationId}`;
572
- let operation = (0, import_json_utils.toJsonObject)(await this.executeApiCall(url));
573
- while (operation["done"] !== true) {
574
- await sleep(OPERATION_POLL_INTERVAL_MS);
575
- operation = (0, import_json_utils.toJsonObject)(await this.executeApiCall(url));
669
+ for (let attempt = 0; attempt < MAX_OPERATION_POLL_ATTEMPTS; attempt++) {
670
+ if (attempt > 0) {
671
+ await sleep(OPERATION_POLL_INTERVAL_MS);
672
+ }
673
+ const operation = (0, import_json_utils.toJsonObject)(await this.executeApiCall(url));
674
+ if (operation["error"]) {
675
+ throw new Error(
676
+ `Operation ${operationId} failed: ${formatOperationError(operation["error"])}`
677
+ );
678
+ }
679
+ if (operation["done"] === true) {
680
+ return operation;
681
+ }
576
682
  }
577
- return operation;
683
+ throw new Error(
684
+ `Operation ${operationId} timed out after ${MAX_OPERATION_POLL_ATTEMPTS} poll attempts.`
685
+ );
578
686
  }
579
687
  };
580
688
  __name(ConnectionsClient, "ConnectionsClient");
@@ -47,13 +47,14 @@ var import_connections_client = require("./connections_client.js");
47
47
  */
48
48
  const EXECUTE_CONNECTION_INTEGRATION = "ExecuteConnection";
49
49
  const EXECUTE_CUSTOM_QUERY_ACTION = "ExecuteCustomQuery";
50
+ const REQUEST_SCHEMA_OPTIONS = Object.freeze({ includeDynamicAuthConfig: true });
50
51
  let IntegrationClient = class {
51
52
  constructor(options) {
52
53
  var _a, _b;
53
54
  this.project = options.project;
54
55
  this.location = options.location;
55
56
  this.integration = options.integration;
56
- this.trigger = options.trigger;
57
+ this.triggers = options.triggers;
57
58
  this.connection = options.connection;
58
59
  this.entityOperations = (_a = options.entityOperations) != null ? _a : {};
59
60
  this.actions = (_b = options.actions) != null ? _b : [];
@@ -69,6 +70,7 @@ let IntegrationClient = class {
69
70
  */
70
71
  async getOpenApiSpecForIntegration() {
71
72
  const url = `https://${this.location}-integrations.googleapis.com/v1/projects/${this.project}/locations/${this.location}:generateOpenApiSpec`;
73
+ const invalidRequestMessage = `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), integration(${this.integration}).`;
72
74
  const body = await (0, import_cloud_request.sendCloudRequest)({
73
75
  url,
74
76
  method: "POST",
@@ -76,13 +78,13 @@ let IntegrationClient = class {
76
78
  apiTriggerResources: [
77
79
  {
78
80
  integrationResource: this.integration,
79
- triggerId: [this.trigger]
81
+ triggerId: this.triggers
80
82
  }
81
83
  ],
82
84
  fileFormat: "JSON"
83
85
  },
84
86
  tokenSource: this.tokenSource,
85
- invalidRequestMessage: `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), integration(${this.integration}) and trigger(${this.trigger}).`
87
+ invalidRequestMessage
86
88
  });
87
89
  try {
88
90
  const spec = (0, import_json_utils.isJsonObject)(body) ? body["openApiSpec"] : void 0;
@@ -143,7 +145,10 @@ let IntegrationClient = class {
143
145
  toolName,
144
146
  toolInstructions
145
147
  });
146
- schemas[`create_${entity}_Request`] = (0, import_connections_client.createOperationRequest)(entity);
148
+ schemas[`create_${entity}_Request`] = (0, import_connections_client.createOperationRequest)(
149
+ entity,
150
+ REQUEST_SCHEMA_OPTIONS
151
+ );
147
152
  break;
148
153
  case "update":
149
154
  connectorSpec.paths[path] = (0, import_connections_client.updateOperation)({
@@ -151,7 +156,10 @@ let IntegrationClient = class {
151
156
  toolName,
152
157
  toolInstructions
153
158
  });
154
- schemas[`update_${entity}_Request`] = (0, import_connections_client.updateOperationRequest)(entity);
159
+ schemas[`update_${entity}_Request`] = (0, import_connections_client.updateOperationRequest)(
160
+ entity,
161
+ REQUEST_SCHEMA_OPTIONS
162
+ );
155
163
  break;
156
164
  case "delete":
157
165
  connectorSpec.paths[path] = (0, import_connections_client.deleteOperation)({
@@ -159,7 +167,9 @@ let IntegrationClient = class {
159
167
  toolName,
160
168
  toolInstructions
161
169
  });
162
- schemas[`delete_${entity}_Request`] = (0, import_connections_client.deleteOperationRequest)();
170
+ schemas[`delete_${entity}_Request`] = (0, import_connections_client.deleteOperationRequest)(
171
+ REQUEST_SCHEMA_OPTIONS
172
+ );
163
173
  break;
164
174
  case "list":
165
175
  connectorSpec.paths[path] = (0, import_connections_client.listOperation)({
@@ -168,7 +178,9 @@ let IntegrationClient = class {
168
178
  toolName,
169
179
  toolInstructions
170
180
  });
171
- schemas[`list_${entity}_Request`] = (0, import_connections_client.listOperationRequest)();
181
+ schemas[`list_${entity}_Request`] = (0, import_connections_client.listOperationRequest)(
182
+ REQUEST_SCHEMA_OPTIONS
183
+ );
172
184
  break;
173
185
  case "get":
174
186
  connectorSpec.paths[path] = (0, import_connections_client.getOperation)({
@@ -177,7 +189,9 @@ let IntegrationClient = class {
177
189
  toolName,
178
190
  toolInstructions
179
191
  });
180
- schemas[`get_${entity}_Request`] = (0, import_connections_client.getOperationRequest)();
192
+ schemas[`get_${entity}_Request`] = (0, import_connections_client.getOperationRequest)(
193
+ REQUEST_SCHEMA_OPTIONS
194
+ );
181
195
  break;
182
196
  default:
183
197
  throw new Error(
@@ -188,20 +202,26 @@ let IntegrationClient = class {
188
202
  }
189
203
  for (const action of this.actions) {
190
204
  const { inputSchema, outputSchema, displayName } = await connectionsClient.getActionSchema(action);
205
+ const actionDisplayName = displayName.replace(/ /g, "");
191
206
  let operation = "EXECUTE_ACTION";
192
207
  if (action === EXECUTE_CUSTOM_QUERY_ACTION) {
193
- schemas[`${action}_Request`] = (0, import_connections_client.executeCustomQueryRequest)();
208
+ schemas[`${actionDisplayName}_Request`] = (0, import_connections_client.executeCustomQueryRequest)(
209
+ REQUEST_SCHEMA_OPTIONS
210
+ );
194
211
  operation = "EXECUTE_QUERY";
195
212
  } else {
196
- schemas[`${displayName}_Request`] = (0, import_connections_client.actionRequest)(displayName);
197
- schemas[`connectorInputPayload_${displayName}`] = (0, import_connections_client.connectorPayload)(inputSchema);
213
+ schemas[`${actionDisplayName}_Request`] = (0, import_connections_client.actionRequest)(
214
+ actionDisplayName,
215
+ REQUEST_SCHEMA_OPTIONS
216
+ );
217
+ schemas[`connectorInputPayload_${actionDisplayName}`] = (0, import_connections_client.connectorPayload)(inputSchema);
198
218
  }
199
- schemas[`connectorOutputPayload_${displayName}`] = (0, import_connections_client.connectorPayload)(outputSchema);
200
- schemas[`${displayName}_Response`] = (0, import_connections_client.actionResponse)(displayName);
219
+ schemas[`connectorOutputPayload_${actionDisplayName}`] = (0, import_connections_client.connectorPayload)(outputSchema);
220
+ schemas[`${actionDisplayName}_Response`] = (0, import_connections_client.actionResponse)(actionDisplayName);
201
221
  connectorSpec.paths[`${pathPrefix}#${action}`] = (0, import_connections_client.getActionOperation)({
202
222
  action,
203
223
  operation,
204
- actionDisplayName: displayName,
224
+ actionDisplayName,
205
225
  toolName,
206
226
  toolInstructions
207
227
  });