@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.
- package/dist/cjs/a2a/a2a_remote_agent.js +17 -2
- package/dist/cjs/a2a/a2a_remote_agent_utils.js +8 -4
- package/dist/cjs/a2a/agent_card.js +5 -81
- package/dist/cjs/a2a/agent_to_a2a.js +7 -0
- package/dist/cjs/a2a/event_converter_utils.js +10 -3
- package/dist/cjs/agents/agent_engine_client.js +399 -0
- package/dist/cjs/agents/base_agent.js +127 -68
- package/dist/cjs/agents/functions.js +64 -59
- package/dist/cjs/agents/instructions.js +8 -6
- package/dist/cjs/agents/invocation_context.js +2 -2
- package/dist/cjs/agents/llm_agent.js +124 -101
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/cjs/agents/processors/content_processor_utils.js +72 -17
- package/dist/cjs/agents/processors/content_request_processor.js +51 -2
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +5 -1
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/nl_planning_processor.js +13 -3
- package/dist/cjs/artifacts/file_artifact_service.js +1 -1
- package/dist/cjs/cli/cli_eval.js +884 -17
- package/dist/cjs/cli/utils/cleanup.js +84 -0
- package/dist/cjs/cli/utils/envs.js +33 -2
- package/dist/cjs/cli/utils/evals.js +75 -8
- package/dist/cjs/cli/utils/logs.js +134 -15
- package/dist/cjs/cli/utils/path_validation.js +83 -0
- package/dist/cjs/code_executors/container_code_executor.js +171 -38
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/cjs/common.js +59 -32
- package/dist/cjs/context/compaction_utils.js +19 -0
- package/dist/cjs/errors/input_validation_error.js +3 -2
- package/dist/cjs/events/event.js +7 -3
- package/dist/cjs/features/feature_registry.js +5 -0
- package/dist/cjs/index.js +34 -12
- package/dist/cjs/models/google_llm.js +33 -2
- package/dist/cjs/models/interactions_utils.js +3 -0
- package/dist/cjs/plugins/base_plugin.js +54 -40
- package/dist/cjs/plugins/plugin_manager.js +27 -0
- package/dist/cjs/runner/runner.js +306 -189
- package/dist/cjs/sessions/base_session_service.js +15 -12
- package/dist/cjs/sessions/database_session_service.js +232 -38
- package/dist/cjs/sessions/db/operations.js +70 -1
- package/dist/cjs/sessions/db/schema.js +4 -0
- package/dist/cjs/sessions/in_memory_session_service.js +2 -2
- package/dist/cjs/sessions/stale_session_error.js +59 -0
- package/dist/cjs/sessions/vertex_ai_session_service.js +11 -3
- package/dist/cjs/skills/loader.js +76 -41
- package/dist/cjs/telemetry/api/instrumentation.js +632 -0
- package/dist/cjs/telemetry/api/internal/common/accumulators.js +169 -0
- package/dist/cjs/telemetry/api/internal/common/attributes.js +131 -0
- package/dist/cjs/telemetry/api/internal/common/config.js +159 -0
- package/dist/cjs/telemetry/api/internal/common/error.js +98 -0
- package/dist/cjs/telemetry/api/internal/common/finish_reason.js +63 -0
- package/dist/cjs/telemetry/api/internal/common/genai_messages.js +217 -0
- package/dist/cjs/telemetry/api/internal/common/http_exchange.js +169 -0
- package/dist/cjs/telemetry/api/internal/common/provider_name.js +87 -0
- package/dist/cjs/telemetry/api/internal/common/redaction.js +148 -0
- package/dist/cjs/telemetry/api/internal/common/serialization.js +58 -0
- package/dist/cjs/telemetry/api/internal/common/token_usage.js +118 -0
- package/dist/cjs/telemetry/api/internal/logs/inference.js +50 -0
- package/dist/cjs/telemetry/api/internal/logs/logger.js +46 -0
- package/dist/cjs/telemetry/api/internal/logs/mcp.js +141 -0
- package/dist/cjs/telemetry/api/internal/metrics/agent.js +128 -0
- package/dist/cjs/telemetry/api/internal/metrics/inference_start_hook.js +56 -0
- package/dist/cjs/telemetry/api/internal/metrics/meters.js +189 -0
- package/dist/cjs/telemetry/api/internal/metrics/tool.js +147 -0
- package/dist/cjs/telemetry/api/internal/metrics/workflow.js +132 -0
- package/dist/cjs/telemetry/api/internal/trace/agent.js +52 -0
- package/dist/cjs/telemetry/api/internal/trace/compaction.js +78 -0
- package/dist/cjs/telemetry/api/internal/trace/inference.js +132 -0
- package/dist/cjs/telemetry/api/internal/trace/live.js +52 -0
- package/dist/cjs/telemetry/api/internal/trace/node.js +73 -0
- package/dist/cjs/telemetry/api/internal/trace/propagation.js +67 -0
- package/dist/cjs/telemetry/api/internal/trace/tool.js +122 -0
- package/dist/cjs/telemetry/api/internal/trace/tracer.js +77 -0
- package/dist/cjs/telemetry/api/internal/trace/workflow.js +77 -0
- package/dist/cjs/telemetry/export/agent_engine.js +90 -0
- package/dist/cjs/telemetry/export/agent_runtime.js +73 -0
- package/dist/cjs/telemetry/export/google_cloud.js +763 -0
- package/dist/cjs/telemetry/export/request_driven_metric_reader.js +303 -0
- package/dist/cjs/telemetry/{setup.js → export/setup.js} +72 -6
- package/dist/cjs/tools/agent_tool.js +9 -1
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +18 -23
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +109 -43
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +222 -114
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +34 -14
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +175 -0
- package/dist/cjs/tools/base_toolset.js +1 -1
- package/dist/cjs/tools/computer_use/base_computer.js +125 -0
- package/dist/cjs/tools/computer_use/computer_use_actions.js +502 -0
- package/dist/cjs/tools/computer_use/computer_use_tool.js +244 -0
- package/dist/cjs/tools/computer_use/computer_use_toolset.js +360 -0
- package/dist/cjs/tools/function_tool.js +15 -5
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +174 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolsets.js +124 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +5 -3
- package/dist/cjs/tools/google_api_tool/index.js +20 -23
- package/dist/cjs/tools/load_artifacts_tool.js +27 -11
- package/dist/cjs/tools/load_memory_tool.js +14 -15
- package/dist/cjs/tools/mcp/mcp_session_manager.js +23 -3
- package/dist/cjs/tools/mcp/mcp_tool.js +7 -3
- package/dist/cjs/tools/mcp/mcp_toolset.js +19 -20
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +30 -29
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -4
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +7 -13
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +57 -10
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +7 -0
- package/dist/cjs/tools/skill/load_skill_tool.js +3 -0
- package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -2
- package/dist/cjs/tools/toolbox_toolset.js +193 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/cjs/utils/async_queue.js +37 -3
- package/dist/cjs/utils/client_labels.js +17 -2
- package/dist/cjs/utils/env_aware_utils.js +13 -7
- package/dist/cjs/utils/error_utils.js +40 -2
- package/dist/cjs/utils/failover_utils.js +11 -10
- package/dist/cjs/utils/gemini_schema_util.js +145 -14
- package/dist/cjs/utils/id_provider.js +63 -0
- package/dist/cjs/utils/logger_node.js +4 -0
- package/dist/cjs/utils/model_name.js +15 -0
- package/dist/cjs/utils/output_schema_utils.js +5 -2
- package/dist/cjs/utils/simple_zod_to_json.js +13 -31
- package/dist/cjs/utils/ssrf_guard.js +46 -16
- package/dist/cjs/utils/task.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/workflow/index.js +2 -0
- package/dist/cjs/workflow/node_runner.js +24 -80
- package/dist/cjs/workflow/nodes/parallel_worker.js +18 -7
- package/dist/cjs/workflow/run_llm_agent_as_node.js +19 -14
- package/dist/cjs/workflow/utils/retry_utils.js +2 -2
- package/dist/cjs/workflow/workflow.js +12 -12
- package/dist/esm/a2a/a2a_remote_agent.js +23 -3
- package/dist/esm/a2a/a2a_remote_agent_utils.js +8 -4
- package/dist/esm/a2a/agent_card.js +5 -83
- package/dist/esm/a2a/agent_to_a2a.js +7 -0
- package/dist/esm/a2a/event_converter_utils.js +10 -3
- package/dist/esm/agents/agent_engine_client.js +382 -0
- package/dist/esm/agents/base_agent.js +127 -72
- package/dist/esm/agents/functions.js +69 -63
- package/dist/esm/agents/instructions.js +8 -6
- package/dist/esm/agents/invocation_context.js +2 -2
- package/dist/esm/agents/llm_agent.js +130 -106
- package/dist/esm/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/esm/agents/processors/content_processor_utils.js +72 -17
- package/dist/esm/agents/processors/content_request_processor.js +51 -2
- package/dist/esm/agents/processors/context_compactor_request_processor.js +5 -1
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/nl_planning_processor.js +13 -3
- package/dist/esm/artifacts/file_artifact_service.js +1 -1
- package/dist/esm/cli/cli_eval.js +880 -17
- package/dist/esm/cli/utils/cleanup.js +56 -0
- package/dist/esm/cli/utils/envs.js +33 -2
- package/dist/esm/cli/utils/evals.js +74 -8
- package/dist/esm/cli/utils/logs.js +132 -13
- package/dist/esm/cli/utils/path_validation.js +45 -0
- package/dist/esm/code_executors/container_code_executor.js +171 -38
- package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/esm/common.js +59 -19
- package/dist/esm/context/compaction_utils.js +19 -0
- package/dist/esm/errors/input_validation_error.js +3 -2
- package/dist/esm/events/event.js +7 -3
- package/dist/esm/features/feature_registry.js +5 -0
- package/dist/esm/index.js +36 -10
- package/dist/esm/models/google_llm.js +33 -2
- package/dist/esm/models/interactions_utils.js +3 -0
- package/dist/esm/plugins/base_plugin.js +54 -40
- package/dist/esm/plugins/plugin_manager.js +27 -0
- package/dist/esm/runner/runner.js +310 -192
- package/dist/esm/sessions/base_session_service.js +13 -11
- package/dist/esm/sessions/database_session_service.js +231 -38
- package/dist/esm/sessions/db/operations.js +70 -1
- package/dist/esm/sessions/db/schema.js +4 -0
- package/dist/esm/sessions/in_memory_session_service.js +2 -2
- package/dist/esm/sessions/stale_session_error.js +31 -0
- package/dist/esm/sessions/vertex_ai_session_service.js +11 -3
- package/dist/esm/skills/loader.js +76 -41
- package/dist/esm/telemetry/api/instrumentation.js +655 -0
- package/dist/esm/telemetry/api/internal/common/accumulators.js +139 -0
- package/dist/esm/telemetry/api/internal/common/attributes.js +94 -0
- package/dist/esm/telemetry/api/internal/common/config.js +128 -0
- package/dist/esm/telemetry/api/internal/common/error.js +69 -0
- package/dist/esm/telemetry/api/internal/common/finish_reason.js +35 -0
- package/dist/esm/telemetry/api/internal/common/genai_messages.js +188 -0
- package/dist/esm/telemetry/api/internal/common/http_exchange.js +142 -0
- package/dist/esm/telemetry/api/internal/common/provider_name.js +59 -0
- package/dist/esm/telemetry/api/internal/common/redaction.js +121 -0
- package/dist/esm/telemetry/api/internal/common/serialization.js +30 -0
- package/dist/esm/telemetry/api/internal/common/token_usage.js +85 -0
- package/dist/esm/telemetry/api/internal/logs/inference.js +23 -0
- package/dist/esm/telemetry/api/internal/logs/logger.js +19 -0
- package/dist/esm/telemetry/api/internal/logs/mcp.js +113 -0
- package/dist/esm/telemetry/api/internal/metrics/agent.js +107 -0
- package/dist/esm/telemetry/api/internal/metrics/inference_start_hook.js +29 -0
- package/dist/esm/telemetry/api/internal/metrics/meters.js +165 -0
- package/dist/esm/telemetry/api/internal/metrics/tool.js +119 -0
- package/dist/esm/telemetry/api/internal/metrics/workflow.js +112 -0
- package/dist/esm/telemetry/api/internal/trace/agent.js +25 -0
- package/dist/esm/telemetry/api/internal/trace/compaction.js +50 -0
- package/dist/esm/telemetry/api/internal/trace/inference.js +107 -0
- package/dist/esm/telemetry/api/internal/trace/live.js +28 -0
- package/dist/esm/telemetry/api/internal/trace/node.js +44 -0
- package/dist/esm/telemetry/api/internal/trace/propagation.js +39 -0
- package/dist/esm/telemetry/api/internal/trace/tool.js +96 -0
- package/dist/esm/telemetry/api/internal/trace/tracer.js +52 -0
- package/dist/esm/telemetry/api/internal/trace/workflow.js +54 -0
- package/dist/esm/telemetry/export/agent_engine.js +67 -0
- package/dist/esm/telemetry/export/agent_runtime.js +46 -0
- package/dist/esm/telemetry/export/google_cloud.js +733 -0
- package/dist/esm/telemetry/export/request_driven_metric_reader.js +276 -0
- package/dist/esm/telemetry/export/setup.js +160 -0
- package/dist/esm/tools/agent_tool.js +9 -1
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +17 -22
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +114 -44
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +226 -115
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +34 -14
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +149 -0
- package/dist/esm/tools/base_toolset.js +1 -1
- package/dist/esm/tools/computer_use/base_computer.js +99 -0
- package/dist/esm/tools/computer_use/computer_use_actions.js +477 -0
- package/dist/esm/tools/computer_use/computer_use_tool.js +217 -0
- package/dist/esm/tools/computer_use/computer_use_toolset.js +344 -0
- package/dist/esm/tools/function_tool.js +15 -5
- package/dist/esm/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +147 -0
- package/dist/esm/tools/google_api_tool/google_api_toolsets.js +94 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +5 -3
- package/dist/esm/tools/google_api_tool/index.js +18 -20
- package/dist/esm/tools/load_artifacts_tool.js +25 -10
- package/dist/esm/tools/load_memory_tool.js +14 -15
- package/dist/esm/tools/mcp/mcp_session_manager.js +23 -3
- package/dist/esm/tools/mcp/mcp_tool.js +7 -3
- package/dist/esm/tools/mcp/mcp_toolset.js +19 -20
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +27 -26
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -4
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +6 -12
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +57 -10
- package/dist/esm/tools/skill/load_skill_resource_tool.js +7 -0
- package/dist/esm/tools/skill/load_skill_tool.js +3 -0
- package/dist/esm/tools/skill/run_skill_script_tool.js +12 -2
- package/dist/esm/tools/toolbox_toolset.js +167 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/esm/utils/async_queue.js +37 -3
- package/dist/esm/utils/client_labels.js +17 -2
- package/dist/esm/utils/env_aware_utils.js +12 -7
- package/dist/esm/utils/error_utils.js +37 -1
- package/dist/esm/utils/failover_utils.js +11 -10
- package/dist/esm/utils/gemini_schema_util.js +144 -14
- package/dist/esm/utils/id_provider.js +33 -0
- package/dist/esm/utils/logger_node.js +4 -0
- package/dist/esm/utils/model_name.js +14 -0
- package/dist/esm/utils/output_schema_utils.js +5 -2
- package/dist/esm/utils/simple_zod_to_json.js +13 -31
- package/dist/esm/utils/ssrf_guard.js +55 -15
- package/dist/esm/utils/task.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/workflow/index.js +2 -1
- package/dist/esm/workflow/node_runner.js +26 -80
- package/dist/esm/workflow/nodes/parallel_worker.js +16 -6
- package/dist/esm/workflow/run_llm_agent_as_node.js +19 -14
- package/dist/esm/workflow/utils/retry_utils.js +2 -2
- package/dist/esm/workflow/workflow.js +12 -12
- package/dist/types/a2a/a2a_remote_agent.d.ts +6 -0
- package/dist/types/a2a/a2a_remote_agent_utils.d.ts +3 -2
- package/dist/types/agents/agent_engine_client.d.ts +155 -0
- package/dist/types/agents/base_agent.d.ts +14 -0
- package/dist/types/agents/llm_agent.d.ts +5 -1
- package/dist/types/agents/processors/content_processor_utils.d.ts +12 -10
- package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
- package/dist/types/agents/run_config.d.ts +14 -0
- package/dist/types/cli/cli_eval.d.ts +172 -9
- package/dist/types/cli/utils/cleanup.d.ts +18 -0
- package/dist/types/cli/utils/envs.d.ts +13 -3
- package/dist/types/cli/utils/evals.d.ts +64 -1
- package/dist/types/cli/utils/logs.d.ts +20 -3
- package/dist/types/cli/utils/path_validation.d.ts +30 -0
- package/dist/types/code_executors/container_code_executor.d.ts +62 -9
- package/dist/types/common.d.ts +21 -18
- package/dist/types/context/compaction_utils.d.ts +13 -1
- package/dist/types/errors/input_validation_error.d.ts +2 -1
- package/dist/types/events/event.d.ts +3 -0
- package/dist/types/features/feature_registry.d.ts +1 -0
- package/dist/types/index.d.ts +11 -6
- package/dist/types/plugins/base_plugin.d.ts +50 -31
- package/dist/types/plugins/plugin_manager.d.ts +13 -0
- package/dist/types/runner/runner.d.ts +11 -0
- package/dist/types/sessions/base_session_service.d.ts +5 -2
- package/dist/types/sessions/database_session_service.d.ts +17 -1
- package/dist/types/sessions/db/operations.d.ts +2 -1
- package/dist/types/sessions/db/schema.d.ts +5 -3
- package/dist/types/sessions/stale_session_error.d.ts +21 -0
- package/dist/types/skills/loader.d.ts +3 -2
- package/dist/types/telemetry/api/instrumentation.d.ts +259 -0
- package/dist/types/telemetry/api/internal/common/accumulators.d.ts +91 -0
- package/dist/types/telemetry/api/internal/common/attributes.d.ts +90 -0
- package/dist/types/telemetry/api/internal/common/config.d.ts +61 -0
- package/dist/types/telemetry/api/internal/common/error.d.ts +29 -0
- package/dist/types/telemetry/api/internal/common/finish_reason.d.ts +18 -0
- package/dist/types/telemetry/api/internal/common/genai_messages.d.ts +26 -0
- package/dist/types/telemetry/api/internal/common/http_exchange.d.ts +50 -0
- package/dist/types/telemetry/api/internal/common/provider_name.d.ts +16 -0
- package/dist/types/telemetry/api/internal/common/redaction.d.ts +14 -0
- package/dist/types/telemetry/api/internal/common/serialization.d.ts +18 -0
- package/dist/types/telemetry/api/internal/common/token_usage.d.ts +47 -0
- package/dist/types/telemetry/api/internal/logs/inference.d.ts +15 -0
- package/dist/types/telemetry/api/internal/logs/logger.d.ts +13 -0
- package/dist/types/telemetry/api/internal/logs/mcp.d.ts +31 -0
- package/dist/types/telemetry/api/internal/metrics/agent.d.ts +28 -0
- package/dist/types/telemetry/api/internal/metrics/inference_start_hook.d.ts +12 -0
- package/dist/types/telemetry/api/internal/metrics/meters.d.ts +57 -0
- package/dist/types/telemetry/api/internal/metrics/tool.d.ts +44 -0
- package/dist/types/telemetry/api/internal/metrics/workflow.d.ts +32 -0
- package/dist/types/telemetry/api/internal/trace/agent.d.ts +14 -0
- package/dist/types/telemetry/api/internal/trace/compaction.d.ts +20 -0
- package/dist/types/telemetry/api/internal/trace/inference.d.ts +31 -0
- package/dist/types/telemetry/api/internal/trace/live.d.ts +21 -0
- package/dist/types/telemetry/api/internal/trace/node.d.ts +22 -0
- package/dist/types/telemetry/api/internal/trace/propagation.d.ts +22 -0
- package/dist/types/telemetry/api/internal/trace/tool.d.ts +57 -0
- package/dist/types/telemetry/api/internal/trace/tracer.d.ts +31 -0
- package/dist/types/telemetry/api/internal/trace/workflow.d.ts +21 -0
- package/dist/types/telemetry/export/agent_engine.d.ts +23 -0
- package/dist/types/telemetry/export/agent_runtime.d.ts +40 -0
- package/dist/types/telemetry/export/google_cloud.d.ts +189 -0
- package/dist/types/telemetry/export/request_driven_metric_reader.d.ts +144 -0
- package/dist/types/telemetry/{setup.d.ts → export/setup.d.ts} +3 -0
- package/dist/types/tools/agent_tool.d.ts +1 -1
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +14 -21
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +32 -9
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +35 -12
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +3 -3
- package/dist/types/tools/application_integration_tool/integration_connector_tool.d.ts +70 -0
- package/dist/types/tools/base_toolset.d.ts +7 -6
- package/dist/types/tools/computer_use/base_computer.d.ts +281 -0
- package/dist/types/tools/computer_use/computer_use_actions.d.ts +53 -0
- package/dist/types/tools/computer_use/computer_use_tool.d.ts +108 -0
- package/dist/types/tools/computer_use/computer_use_toolset.d.ts +132 -0
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +10 -3
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +57 -0
- package/dist/types/tools/google_api_tool/google_api_toolsets.d.ts +48 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +5 -4
- package/dist/types/tools/google_api_tool/index.d.ts +4 -5
- package/dist/types/tools/load_artifacts_tool.d.ts +18 -1
- package/dist/types/tools/load_memory_tool.d.ts +32 -4
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +16 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +8 -8
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +12 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +15 -3
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +5 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +10 -0
- package/dist/types/tools/toolbox_toolset.d.ts +154 -0
- package/dist/types/utils/async_queue.d.ts +14 -0
- package/dist/types/utils/client_labels.d.ts +2 -1
- package/dist/types/utils/env_aware_utils.d.ts +11 -0
- package/dist/types/utils/error_utils.d.ts +4 -0
- package/dist/types/utils/gemini_schema_util.d.ts +29 -0
- package/dist/types/utils/id_provider.d.ts +43 -0
- package/dist/types/utils/model_name.d.ts +8 -0
- package/dist/types/utils/output_schema_utils.d.ts +3 -2
- package/dist/types/utils/simple_zod_to_json.d.ts +1 -2
- package/dist/types/utils/ssrf_guard.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/workflow/index.d.ts +1 -1
- package/dist/types/workflow/nodes/parallel_worker.d.ts +8 -1
- package/dist/web/index_web.js +94 -88
- package/dist/web/index_web.js.map +4 -4
- package/package.json +43 -38
- package/dist/cjs/agents/remote_agent.js +0 -187
- package/dist/cjs/telemetry/google_cloud.js +0 -116
- package/dist/cjs/telemetry/tracing.js +0 -350
- package/dist/cjs/tools/crewai_tool.js +0 -132
- package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +0 -226
- package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +0 -58
- package/dist/cjs/tools/langchain_tool.js +0 -172
- package/dist/cjs/tools/toolbox_tool.js +0 -108
- package/dist/esm/agents/remote_agent.js +0 -164
- package/dist/esm/telemetry/google_cloud.js +0 -99
- package/dist/esm/telemetry/setup.js +0 -89
- package/dist/esm/telemetry/tracing.js +0 -315
- package/dist/esm/tools/crewai_tool.js +0 -107
- package/dist/esm/tools/google_api_tool/google_api_tool_set.js +0 -188
- package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +0 -24
- package/dist/esm/tools/langchain_tool.js +0 -148
- package/dist/esm/tools/toolbox_tool.js +0 -80
- package/dist/types/agents/remote_agent.d.ts +0 -68
- package/dist/types/telemetry/google_cloud.d.ts +0 -9
- package/dist/types/telemetry/tracing.d.ts +0 -129
- package/dist/types/tools/crewai_tool.d.ts +0 -85
- package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +0 -78
- package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +0 -33
- package/dist/types/tools/langchain_tool.d.ts +0 -103
- package/dist/types/tools/toolbox_tool.d.ts +0 -73
|
@@ -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 {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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:
|
|
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
|
|
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
|
|
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}.
|
|
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: `
|
|
329
|
-
description: `Creates a new
|
|
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: `
|
|
340
|
-
description: `Updates
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
/**
|
|
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
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
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
|
-
|
|
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.
|
|
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:
|
|
81
|
+
triggerId: this.triggers
|
|
80
82
|
}
|
|
81
83
|
],
|
|
82
84
|
fileFormat: "JSON"
|
|
83
85
|
},
|
|
84
86
|
tokenSource: this.tokenSource,
|
|
85
|
-
invalidRequestMessage
|
|
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)(
|
|
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)(
|
|
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[`${
|
|
208
|
+
schemas[`${actionDisplayName}_Request`] = (0, import_connections_client.executeCustomQueryRequest)(
|
|
209
|
+
REQUEST_SCHEMA_OPTIONS
|
|
210
|
+
);
|
|
194
211
|
operation = "EXECUTE_QUERY";
|
|
195
212
|
} else {
|
|
196
|
-
schemas[`${
|
|
197
|
-
|
|
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_${
|
|
200
|
-
schemas[`${
|
|
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
|
|
224
|
+
actionDisplayName,
|
|
205
225
|
toolName,
|
|
206
226
|
toolInstructions
|
|
207
227
|
});
|