@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
|
@@ -17,10 +17,14 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
17
|
* SPDX-License-Identifier: Apache-2.0
|
|
18
18
|
*/
|
|
19
19
|
import { experimental } from "../../../utils/experimental.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
isJsonObject,
|
|
22
|
+
toJsonObject
|
|
23
|
+
} from "../../../utils/json_utils.js";
|
|
21
24
|
import { CloudPlatformTokenSource, sendCloudRequest } from "./cloud_request.js";
|
|
22
25
|
const CONNECTOR_URL = "https://connectors.googleapis.com";
|
|
23
26
|
const OPERATION_POLL_INTERVAL_MS = 1e3;
|
|
27
|
+
const MAX_OPERATION_POLL_ATTEMPTS = 60;
|
|
24
28
|
function toStringValue(value) {
|
|
25
29
|
return typeof value === "string" ? value : "";
|
|
26
30
|
}
|
|
@@ -29,6 +33,16 @@ function sleep(ms) {
|
|
|
29
33
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
30
34
|
}
|
|
31
35
|
__name(sleep, "sleep");
|
|
36
|
+
function formatOperationError(error) {
|
|
37
|
+
if (typeof error === "string" && error.length > 0) {
|
|
38
|
+
return error;
|
|
39
|
+
}
|
|
40
|
+
if (isJsonObject(error) && typeof error["message"] === "string" && error["message"].length > 0) {
|
|
41
|
+
return error["message"];
|
|
42
|
+
}
|
|
43
|
+
return JSON.stringify(error);
|
|
44
|
+
}
|
|
45
|
+
__name(formatOperationError, "formatOperationError");
|
|
32
46
|
function schemaRef(name) {
|
|
33
47
|
return { $ref: `#/components/schemas/${name}` };
|
|
34
48
|
}
|
|
@@ -110,6 +124,12 @@ const CONNECTOR_BASE_SPEC = {
|
|
|
110
124
|
default: 120,
|
|
111
125
|
description: "Timeout in seconds for execution of custom query"
|
|
112
126
|
},
|
|
127
|
+
sortByColumns: {
|
|
128
|
+
type: "array",
|
|
129
|
+
items: { type: "string" },
|
|
130
|
+
default: [],
|
|
131
|
+
description: "Column to sort the results by"
|
|
132
|
+
},
|
|
113
133
|
connectorOutputPayload: { type: "object" },
|
|
114
134
|
nextPageToken: { type: "string" },
|
|
115
135
|
"execute-connector_Response": {
|
|
@@ -173,55 +193,48 @@ function connectorPayload(jsonSchema) {
|
|
|
173
193
|
}
|
|
174
194
|
__name(connectorPayload, "connectorPayload");
|
|
175
195
|
function postOperation(options) {
|
|
176
|
-
const {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
196
|
+
const {
|
|
197
|
+
summary,
|
|
198
|
+
description,
|
|
199
|
+
operationId,
|
|
200
|
+
xOperation,
|
|
201
|
+
xEntity,
|
|
202
|
+
xAction,
|
|
203
|
+
requestSchemaRef,
|
|
204
|
+
responseSchema
|
|
205
|
+
} = options;
|
|
206
|
+
const post = {
|
|
207
|
+
summary,
|
|
208
|
+
description,
|
|
209
|
+
operationId,
|
|
210
|
+
"x-operation": xOperation,
|
|
211
|
+
requestBody: {
|
|
212
|
+
content: {
|
|
213
|
+
"application/json": {
|
|
214
|
+
schema: { $ref: requestSchemaRef }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
responses: {
|
|
219
|
+
"200": {
|
|
220
|
+
description: "Success response",
|
|
183
221
|
content: {
|
|
184
222
|
"application/json": {
|
|
185
|
-
schema:
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
responses: {
|
|
190
|
-
"200": {
|
|
191
|
-
description: "Success response",
|
|
192
|
-
content: {
|
|
193
|
-
"application/json": {
|
|
194
|
-
schema: responseSchema
|
|
195
|
-
}
|
|
223
|
+
schema: responseSchema
|
|
196
224
|
}
|
|
197
225
|
}
|
|
198
226
|
}
|
|
199
227
|
}
|
|
200
228
|
};
|
|
229
|
+
if (xEntity !== void 0) {
|
|
230
|
+
post["x-entity"] = xEntity;
|
|
231
|
+
}
|
|
232
|
+
if (xAction !== void 0) {
|
|
233
|
+
post["x-action"] = xAction;
|
|
234
|
+
}
|
|
235
|
+
return { post };
|
|
201
236
|
}
|
|
202
237
|
__name(postOperation, "postOperation");
|
|
203
|
-
function entityIdRequest() {
|
|
204
|
-
return {
|
|
205
|
-
type: "object",
|
|
206
|
-
required: [
|
|
207
|
-
"entityId",
|
|
208
|
-
"operation",
|
|
209
|
-
"connectionName",
|
|
210
|
-
"serviceName",
|
|
211
|
-
"host",
|
|
212
|
-
"entity"
|
|
213
|
-
],
|
|
214
|
-
properties: {
|
|
215
|
-
entityId: schemaRef("entityId"),
|
|
216
|
-
operation: schemaRef("operation"),
|
|
217
|
-
connectionName: schemaRef("connectionName"),
|
|
218
|
-
serviceName: schemaRef("serviceName"),
|
|
219
|
-
host: schemaRef("host"),
|
|
220
|
-
entity: schemaRef("entity")
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
__name(entityIdRequest, "entityIdRequest");
|
|
225
238
|
function getActionOperation(options) {
|
|
226
239
|
const {
|
|
227
240
|
action,
|
|
@@ -230,7 +243,7 @@ function getActionOperation(options) {
|
|
|
230
243
|
toolName = "",
|
|
231
244
|
toolInstructions = ""
|
|
232
245
|
} = options;
|
|
233
|
-
let description = `Use this tool
|
|
246
|
+
let description = `Use this tool to execute ${action}`;
|
|
234
247
|
if (operation === "EXECUTE_QUERY") {
|
|
235
248
|
description += " Use pageSize = 50 and timeout = 120 until user specifies a different value otherwise. If user provides a query in natural language, convert it to SQL query and then execute it using the tool.";
|
|
236
249
|
}
|
|
@@ -238,6 +251,8 @@ function getActionOperation(options) {
|
|
|
238
251
|
summary: actionDisplayName,
|
|
239
252
|
description: `${description} ${toolInstructions}`,
|
|
240
253
|
operationId: `${toolName}_${actionDisplayName}`,
|
|
254
|
+
xOperation: operation,
|
|
255
|
+
xAction: action,
|
|
241
256
|
requestSchemaRef: `#/components/schemas/${actionDisplayName}_Request`,
|
|
242
257
|
responseSchema: schemaRef(`${actionDisplayName}_Response`)
|
|
243
258
|
});
|
|
@@ -252,8 +267,10 @@ function listOperation(options) {
|
|
|
252
267
|
} = options;
|
|
253
268
|
return postOperation({
|
|
254
269
|
summary: `List ${entity}`,
|
|
255
|
-
description: `Returns
|
|
270
|
+
description: `Returns the list of ${entity} data. If the page token was available in the response, let users know there are more records available. Ask if the user wants to fetch the next page of results. When passing filter use the following format: \`field_name1='value1' AND field_name2='value2'\`. ${toolInstructions}`,
|
|
256
271
|
operationId: `${toolName}_list_${entity}`,
|
|
272
|
+
xOperation: "LIST_ENTITIES",
|
|
273
|
+
xEntity: entity,
|
|
257
274
|
requestSchemaRef: `#/components/schemas/list_${entity}_Request`,
|
|
258
275
|
responseSchema: {
|
|
259
276
|
description: `Returns a list of ${entity} of json schema: ${schemaAsString}`,
|
|
@@ -271,8 +288,10 @@ function getOperation(options) {
|
|
|
271
288
|
} = options;
|
|
272
289
|
return postOperation({
|
|
273
290
|
summary: `Get ${entity}`,
|
|
274
|
-
description: `Returns the details of the ${entity}.
|
|
291
|
+
description: `Returns the details of the ${entity}. ${toolInstructions}`,
|
|
275
292
|
operationId: `${toolName}_get_${entity}`,
|
|
293
|
+
xOperation: "GET_ENTITY",
|
|
294
|
+
xEntity: entity,
|
|
276
295
|
requestSchemaRef: `#/components/schemas/get_${entity}_Request`,
|
|
277
296
|
responseSchema: {
|
|
278
297
|
description: `Returns ${entity} of json schema: ${schemaAsString}`,
|
|
@@ -284,9 +303,11 @@ __name(getOperation, "getOperation");
|
|
|
284
303
|
function createOperation(options) {
|
|
285
304
|
const { entity, toolName = "", toolInstructions = "" } = options;
|
|
286
305
|
return postOperation({
|
|
287
|
-
summary: `
|
|
288
|
-
description: `Creates a new
|
|
306
|
+
summary: `Creates a new ${entity}`,
|
|
307
|
+
description: `Creates a new ${entity}. ${toolInstructions}`,
|
|
289
308
|
operationId: `${toolName}_create_${entity}`,
|
|
309
|
+
xOperation: "CREATE_ENTITY",
|
|
310
|
+
xEntity: entity,
|
|
290
311
|
requestSchemaRef: `#/components/schemas/create_${entity}_Request`,
|
|
291
312
|
responseSchema: schemaRef("execute-connector_Response")
|
|
292
313
|
});
|
|
@@ -295,9 +316,11 @@ __name(createOperation, "createOperation");
|
|
|
295
316
|
function updateOperation(options) {
|
|
296
317
|
const { entity, toolName = "", toolInstructions = "" } = options;
|
|
297
318
|
return postOperation({
|
|
298
|
-
summary: `
|
|
299
|
-
description: `Updates
|
|
319
|
+
summary: `Updates the ${entity}`,
|
|
320
|
+
description: `Updates the ${entity}. ${toolInstructions}`,
|
|
300
321
|
operationId: `${toolName}_update_${entity}`,
|
|
322
|
+
xOperation: "UPDATE_ENTITY",
|
|
323
|
+
xEntity: entity,
|
|
301
324
|
requestSchemaRef: `#/components/schemas/update_${entity}_Request`,
|
|
302
325
|
responseSchema: schemaRef("execute-connector_Response")
|
|
303
326
|
});
|
|
@@ -306,15 +329,28 @@ __name(updateOperation, "updateOperation");
|
|
|
306
329
|
function deleteOperation(options) {
|
|
307
330
|
const { entity, toolName = "", toolInstructions = "" } = options;
|
|
308
331
|
return postOperation({
|
|
309
|
-
summary: `Delete ${entity}`,
|
|
310
|
-
description: `Deletes
|
|
332
|
+
summary: `Delete the ${entity}`,
|
|
333
|
+
description: `Deletes the ${entity}. ${toolInstructions}`,
|
|
311
334
|
operationId: `${toolName}_delete_${entity}`,
|
|
335
|
+
xOperation: "DELETE_ENTITY",
|
|
336
|
+
xEntity: entity,
|
|
312
337
|
requestSchemaRef: `#/components/schemas/delete_${entity}_Request`,
|
|
313
338
|
responseSchema: schemaRef("execute-connector_Response")
|
|
314
339
|
});
|
|
315
340
|
}
|
|
316
341
|
__name(deleteOperation, "deleteOperation");
|
|
317
|
-
function createOperationRequest(entity) {
|
|
342
|
+
function createOperationRequest(entity, options) {
|
|
343
|
+
const properties = {
|
|
344
|
+
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
345
|
+
operation: schemaRef("operation"),
|
|
346
|
+
connectionName: schemaRef("connectionName"),
|
|
347
|
+
serviceName: schemaRef("serviceName"),
|
|
348
|
+
host: schemaRef("host"),
|
|
349
|
+
entity: schemaRef("entity")
|
|
350
|
+
};
|
|
351
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
352
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
353
|
+
}
|
|
318
354
|
return {
|
|
319
355
|
type: "object",
|
|
320
356
|
required: [
|
|
@@ -325,18 +361,24 @@ function createOperationRequest(entity) {
|
|
|
325
361
|
"host",
|
|
326
362
|
"entity"
|
|
327
363
|
],
|
|
328
|
-
properties
|
|
329
|
-
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
330
|
-
operation: schemaRef("operation"),
|
|
331
|
-
connectionName: schemaRef("connectionName"),
|
|
332
|
-
serviceName: schemaRef("serviceName"),
|
|
333
|
-
host: schemaRef("host"),
|
|
334
|
-
entity: schemaRef("entity")
|
|
335
|
-
}
|
|
364
|
+
properties
|
|
336
365
|
};
|
|
337
366
|
}
|
|
338
367
|
__name(createOperationRequest, "createOperationRequest");
|
|
339
|
-
function updateOperationRequest(entity) {
|
|
368
|
+
function updateOperationRequest(entity, options) {
|
|
369
|
+
const properties = {
|
|
370
|
+
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
371
|
+
entityId: schemaRef("entityId"),
|
|
372
|
+
operation: schemaRef("operation"),
|
|
373
|
+
connectionName: schemaRef("connectionName"),
|
|
374
|
+
serviceName: schemaRef("serviceName"),
|
|
375
|
+
host: schemaRef("host"),
|
|
376
|
+
entity: schemaRef("entity"),
|
|
377
|
+
filterClause: schemaRef("filterClause")
|
|
378
|
+
};
|
|
379
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
380
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
381
|
+
}
|
|
340
382
|
return {
|
|
341
383
|
type: "object",
|
|
342
384
|
required: [
|
|
@@ -348,44 +390,97 @@ function updateOperationRequest(entity) {
|
|
|
348
390
|
"host",
|
|
349
391
|
"entity"
|
|
350
392
|
],
|
|
351
|
-
properties
|
|
352
|
-
connectorInputPayload: schemaRef(`connectorInputPayload_${entity}`),
|
|
353
|
-
entityId: schemaRef("entityId"),
|
|
354
|
-
operation: schemaRef("operation"),
|
|
355
|
-
connectionName: schemaRef("connectionName"),
|
|
356
|
-
serviceName: schemaRef("serviceName"),
|
|
357
|
-
host: schemaRef("host"),
|
|
358
|
-
entity: schemaRef("entity")
|
|
359
|
-
}
|
|
393
|
+
properties
|
|
360
394
|
};
|
|
361
395
|
}
|
|
362
396
|
__name(updateOperationRequest, "updateOperationRequest");
|
|
363
|
-
function getOperationRequest() {
|
|
364
|
-
|
|
397
|
+
function getOperationRequest(options) {
|
|
398
|
+
const properties = {
|
|
399
|
+
entityId: schemaRef("entityId"),
|
|
400
|
+
operation: schemaRef("operation"),
|
|
401
|
+
connectionName: schemaRef("connectionName"),
|
|
402
|
+
serviceName: schemaRef("serviceName"),
|
|
403
|
+
host: schemaRef("host"),
|
|
404
|
+
entity: schemaRef("entity")
|
|
405
|
+
};
|
|
406
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
407
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
type: "object",
|
|
411
|
+
required: [
|
|
412
|
+
"entityId",
|
|
413
|
+
"operation",
|
|
414
|
+
"connectionName",
|
|
415
|
+
"serviceName",
|
|
416
|
+
"host",
|
|
417
|
+
"entity"
|
|
418
|
+
],
|
|
419
|
+
properties
|
|
420
|
+
};
|
|
365
421
|
}
|
|
366
422
|
__name(getOperationRequest, "getOperationRequest");
|
|
367
|
-
function deleteOperationRequest() {
|
|
368
|
-
|
|
423
|
+
function deleteOperationRequest(options) {
|
|
424
|
+
const properties = {
|
|
425
|
+
entityId: schemaRef("entityId"),
|
|
426
|
+
operation: schemaRef("operation"),
|
|
427
|
+
connectionName: schemaRef("connectionName"),
|
|
428
|
+
serviceName: schemaRef("serviceName"),
|
|
429
|
+
host: schemaRef("host"),
|
|
430
|
+
entity: schemaRef("entity"),
|
|
431
|
+
filterClause: schemaRef("filterClause")
|
|
432
|
+
};
|
|
433
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
434
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
435
|
+
}
|
|
436
|
+
return {
|
|
437
|
+
type: "object",
|
|
438
|
+
required: [
|
|
439
|
+
"entityId",
|
|
440
|
+
"operation",
|
|
441
|
+
"connectionName",
|
|
442
|
+
"serviceName",
|
|
443
|
+
"host",
|
|
444
|
+
"entity"
|
|
445
|
+
],
|
|
446
|
+
properties
|
|
447
|
+
};
|
|
369
448
|
}
|
|
370
449
|
__name(deleteOperationRequest, "deleteOperationRequest");
|
|
371
|
-
function listOperationRequest() {
|
|
450
|
+
function listOperationRequest(options) {
|
|
451
|
+
const properties = {
|
|
452
|
+
filterClause: schemaRef("filterClause"),
|
|
453
|
+
pageSize: schemaRef("pageSize"),
|
|
454
|
+
pageToken: schemaRef("pageToken"),
|
|
455
|
+
operation: schemaRef("operation"),
|
|
456
|
+
connectionName: schemaRef("connectionName"),
|
|
457
|
+
serviceName: schemaRef("serviceName"),
|
|
458
|
+
host: schemaRef("host"),
|
|
459
|
+
entity: schemaRef("entity"),
|
|
460
|
+
sortByColumns: schemaRef("sortByColumns")
|
|
461
|
+
};
|
|
462
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
463
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
464
|
+
}
|
|
372
465
|
return {
|
|
373
466
|
type: "object",
|
|
374
467
|
required: ["operation", "connectionName", "serviceName", "host", "entity"],
|
|
375
|
-
properties
|
|
376
|
-
filterClause: schemaRef("filterClause"),
|
|
377
|
-
pageSize: schemaRef("pageSize"),
|
|
378
|
-
pageToken: schemaRef("pageToken"),
|
|
379
|
-
operation: schemaRef("operation"),
|
|
380
|
-
connectionName: schemaRef("connectionName"),
|
|
381
|
-
serviceName: schemaRef("serviceName"),
|
|
382
|
-
host: schemaRef("host"),
|
|
383
|
-
entity: schemaRef("entity")
|
|
384
|
-
}
|
|
468
|
+
properties
|
|
385
469
|
};
|
|
386
470
|
}
|
|
387
471
|
__name(listOperationRequest, "listOperationRequest");
|
|
388
|
-
function actionRequest(action) {
|
|
472
|
+
function actionRequest(action, options) {
|
|
473
|
+
const properties = {
|
|
474
|
+
operation: schemaRef("operation"),
|
|
475
|
+
connectionName: schemaRef("connectionName"),
|
|
476
|
+
serviceName: schemaRef("serviceName"),
|
|
477
|
+
host: schemaRef("host"),
|
|
478
|
+
action: schemaRef("action"),
|
|
479
|
+
connectorInputPayload: schemaRef(`connectorInputPayload_${action}`)
|
|
480
|
+
};
|
|
481
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
482
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
483
|
+
}
|
|
389
484
|
return {
|
|
390
485
|
type: "object",
|
|
391
486
|
required: [
|
|
@@ -396,14 +491,7 @@ function actionRequest(action) {
|
|
|
396
491
|
"action",
|
|
397
492
|
"connectorInputPayload"
|
|
398
493
|
],
|
|
399
|
-
properties
|
|
400
|
-
operation: schemaRef("operation"),
|
|
401
|
-
connectionName: schemaRef("connectionName"),
|
|
402
|
-
serviceName: schemaRef("serviceName"),
|
|
403
|
-
host: schemaRef("host"),
|
|
404
|
-
action: schemaRef("action"),
|
|
405
|
-
connectorInputPayload: schemaRef(`connectorInputPayload_${action}`)
|
|
406
|
-
}
|
|
494
|
+
properties
|
|
407
495
|
};
|
|
408
496
|
}
|
|
409
497
|
__name(actionRequest, "actionRequest");
|
|
@@ -416,7 +504,20 @@ function actionResponse(action) {
|
|
|
416
504
|
};
|
|
417
505
|
}
|
|
418
506
|
__name(actionResponse, "actionResponse");
|
|
419
|
-
function executeCustomQueryRequest() {
|
|
507
|
+
function executeCustomQueryRequest(options) {
|
|
508
|
+
const properties = {
|
|
509
|
+
operation: schemaRef("operation"),
|
|
510
|
+
connectionName: schemaRef("connectionName"),
|
|
511
|
+
serviceName: schemaRef("serviceName"),
|
|
512
|
+
host: schemaRef("host"),
|
|
513
|
+
action: schemaRef("action"),
|
|
514
|
+
query: schemaRef("query"),
|
|
515
|
+
timeout: schemaRef("timeout"),
|
|
516
|
+
pageSize: schemaRef("pageSize")
|
|
517
|
+
};
|
|
518
|
+
if (options == null ? void 0 : options.includeDynamicAuthConfig) {
|
|
519
|
+
properties["dynamicAuthConfig"] = schemaRef("dynamicAuthConfig");
|
|
520
|
+
}
|
|
420
521
|
return {
|
|
421
522
|
type: "object",
|
|
422
523
|
required: [
|
|
@@ -429,16 +530,7 @@ function executeCustomQueryRequest() {
|
|
|
429
530
|
"timeout",
|
|
430
531
|
"pageSize"
|
|
431
532
|
],
|
|
432
|
-
properties
|
|
433
|
-
operation: schemaRef("operation"),
|
|
434
|
-
connectionName: schemaRef("connectionName"),
|
|
435
|
-
serviceName: schemaRef("serviceName"),
|
|
436
|
-
host: schemaRef("host"),
|
|
437
|
-
action: schemaRef("action"),
|
|
438
|
-
query: schemaRef("query"),
|
|
439
|
-
timeout: schemaRef("timeout"),
|
|
440
|
-
pageSize: schemaRef("pageSize")
|
|
441
|
-
}
|
|
533
|
+
properties
|
|
442
534
|
};
|
|
443
535
|
}
|
|
444
536
|
__name(executeCustomQueryRequest, "executeCustomQueryRequest");
|
|
@@ -450,22 +542,24 @@ let ConnectionsClient = class {
|
|
|
450
542
|
this.tokenSource = new CloudPlatformTokenSource(options.serviceAccountJson);
|
|
451
543
|
}
|
|
452
544
|
/**
|
|
453
|
-
* Reads the service name and host of the connection, and
|
|
454
|
-
* an authentication override.
|
|
545
|
+
* Reads the resource name, service name and host of the connection, and
|
|
546
|
+
* whether it allows an authentication override.
|
|
455
547
|
*/
|
|
456
548
|
async getConnectionDetails() {
|
|
457
549
|
const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}?view=BASIC`;
|
|
458
550
|
const connectionData = toJsonObject(await this.executeApiCall(url));
|
|
551
|
+
const name = toStringValue(connectionData["name"]);
|
|
459
552
|
const host = toStringValue(connectionData["host"]);
|
|
460
553
|
const serviceName = host ? toStringValue(connectionData["tlsServiceDirectory"]) : toStringValue(connectionData["serviceDirectory"]);
|
|
461
554
|
const authOverrideEnabled = connectionData["authOverrideEnabled"] === true;
|
|
462
|
-
return { serviceName, host, authOverrideEnabled };
|
|
555
|
+
return { name, serviceName, host, authOverrideEnabled };
|
|
463
556
|
}
|
|
464
557
|
/**
|
|
465
558
|
* Reads the JSON schema of an entity and the operations it supports.
|
|
466
559
|
*
|
|
467
560
|
* @param entity The entity name.
|
|
468
|
-
* @throws Error When the API starts no operation for the entity
|
|
561
|
+
* @throws Error When the API starts no operation for the entity, or the
|
|
562
|
+
* operation fails or times out.
|
|
469
563
|
*/
|
|
470
564
|
async getEntitySchemaAndOperations(entity) {
|
|
471
565
|
const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}/connectionSchemaMetadata:getEntityType?entityId=${entity}`;
|
|
@@ -490,7 +584,8 @@ let ConnectionsClient = class {
|
|
|
490
584
|
* Reads the input and output JSON schemas of an action.
|
|
491
585
|
*
|
|
492
586
|
* @param action The action name.
|
|
493
|
-
* @throws Error When the API starts no operation for the action
|
|
587
|
+
* @throws Error When the API starts no operation for the action, or the
|
|
588
|
+
* operation fails or times out.
|
|
494
589
|
*/
|
|
495
590
|
async getActionSchema(action) {
|
|
496
591
|
const url = `${CONNECTOR_URL}/v1/projects/${this.project}/locations/${this.location}/connections/${this.connection}/connectionSchemaMetadata:getAction?actionId=${action}`;
|
|
@@ -525,15 +620,31 @@ let ConnectionsClient = class {
|
|
|
525
620
|
invalidRequestMessage: `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), connection(${this.connection}).`
|
|
526
621
|
});
|
|
527
622
|
}
|
|
528
|
-
/**
|
|
623
|
+
/**
|
|
624
|
+
* Polls a long-running operation until it reports `done`.
|
|
625
|
+
*
|
|
626
|
+
* @throws Error When the operation reports an `error` or does not finish
|
|
627
|
+
* within `MAX_OPERATION_POLL_ATTEMPTS` polls.
|
|
628
|
+
*/
|
|
529
629
|
async pollOperation(operationId) {
|
|
530
630
|
const url = `${CONNECTOR_URL}/v1/${operationId}`;
|
|
531
|
-
let
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
631
|
+
for (let attempt = 0; attempt < MAX_OPERATION_POLL_ATTEMPTS; attempt++) {
|
|
632
|
+
if (attempt > 0) {
|
|
633
|
+
await sleep(OPERATION_POLL_INTERVAL_MS);
|
|
634
|
+
}
|
|
635
|
+
const operation = toJsonObject(await this.executeApiCall(url));
|
|
636
|
+
if (operation["error"]) {
|
|
637
|
+
throw new Error(
|
|
638
|
+
`Operation ${operationId} failed: ${formatOperationError(operation["error"])}`
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
if (operation["done"] === true) {
|
|
642
|
+
return operation;
|
|
643
|
+
}
|
|
535
644
|
}
|
|
536
|
-
|
|
645
|
+
throw new Error(
|
|
646
|
+
`Operation ${operationId} timed out after ${MAX_OPERATION_POLL_ATTEMPTS} poll attempts.`
|
|
647
|
+
);
|
|
537
648
|
}
|
|
538
649
|
};
|
|
539
650
|
__name(ConnectionsClient, "ConnectionsClient");
|
|
@@ -44,13 +44,14 @@ import {
|
|
|
44
44
|
} from "./connections_client.js";
|
|
45
45
|
const EXECUTE_CONNECTION_INTEGRATION = "ExecuteConnection";
|
|
46
46
|
const EXECUTE_CUSTOM_QUERY_ACTION = "ExecuteCustomQuery";
|
|
47
|
+
const REQUEST_SCHEMA_OPTIONS = Object.freeze({ includeDynamicAuthConfig: true });
|
|
47
48
|
let IntegrationClient = class {
|
|
48
49
|
constructor(options) {
|
|
49
50
|
var _a, _b;
|
|
50
51
|
this.project = options.project;
|
|
51
52
|
this.location = options.location;
|
|
52
53
|
this.integration = options.integration;
|
|
53
|
-
this.
|
|
54
|
+
this.triggers = options.triggers;
|
|
54
55
|
this.connection = options.connection;
|
|
55
56
|
this.entityOperations = (_a = options.entityOperations) != null ? _a : {};
|
|
56
57
|
this.actions = (_b = options.actions) != null ? _b : [];
|
|
@@ -66,6 +67,7 @@ let IntegrationClient = class {
|
|
|
66
67
|
*/
|
|
67
68
|
async getOpenApiSpecForIntegration() {
|
|
68
69
|
const url = `https://${this.location}-integrations.googleapis.com/v1/projects/${this.project}/locations/${this.location}:generateOpenApiSpec`;
|
|
70
|
+
const invalidRequestMessage = `Invalid request. Please check the provided values of project(${this.project}), location(${this.location}), integration(${this.integration}).`;
|
|
69
71
|
const body = await sendCloudRequest({
|
|
70
72
|
url,
|
|
71
73
|
method: "POST",
|
|
@@ -73,13 +75,13 @@ let IntegrationClient = class {
|
|
|
73
75
|
apiTriggerResources: [
|
|
74
76
|
{
|
|
75
77
|
integrationResource: this.integration,
|
|
76
|
-
triggerId:
|
|
78
|
+
triggerId: this.triggers
|
|
77
79
|
}
|
|
78
80
|
],
|
|
79
81
|
fileFormat: "JSON"
|
|
80
82
|
},
|
|
81
83
|
tokenSource: this.tokenSource,
|
|
82
|
-
invalidRequestMessage
|
|
84
|
+
invalidRequestMessage
|
|
83
85
|
});
|
|
84
86
|
try {
|
|
85
87
|
const spec = isJsonObject(body) ? body["openApiSpec"] : void 0;
|
|
@@ -140,7 +142,10 @@ let IntegrationClient = class {
|
|
|
140
142
|
toolName,
|
|
141
143
|
toolInstructions
|
|
142
144
|
});
|
|
143
|
-
schemas[`create_${entity}_Request`] = createOperationRequest(
|
|
145
|
+
schemas[`create_${entity}_Request`] = createOperationRequest(
|
|
146
|
+
entity,
|
|
147
|
+
REQUEST_SCHEMA_OPTIONS
|
|
148
|
+
);
|
|
144
149
|
break;
|
|
145
150
|
case "update":
|
|
146
151
|
connectorSpec.paths[path] = updateOperation({
|
|
@@ -148,7 +153,10 @@ let IntegrationClient = class {
|
|
|
148
153
|
toolName,
|
|
149
154
|
toolInstructions
|
|
150
155
|
});
|
|
151
|
-
schemas[`update_${entity}_Request`] = updateOperationRequest(
|
|
156
|
+
schemas[`update_${entity}_Request`] = updateOperationRequest(
|
|
157
|
+
entity,
|
|
158
|
+
REQUEST_SCHEMA_OPTIONS
|
|
159
|
+
);
|
|
152
160
|
break;
|
|
153
161
|
case "delete":
|
|
154
162
|
connectorSpec.paths[path] = deleteOperation({
|
|
@@ -156,7 +164,9 @@ let IntegrationClient = class {
|
|
|
156
164
|
toolName,
|
|
157
165
|
toolInstructions
|
|
158
166
|
});
|
|
159
|
-
schemas[`delete_${entity}_Request`] = deleteOperationRequest(
|
|
167
|
+
schemas[`delete_${entity}_Request`] = deleteOperationRequest(
|
|
168
|
+
REQUEST_SCHEMA_OPTIONS
|
|
169
|
+
);
|
|
160
170
|
break;
|
|
161
171
|
case "list":
|
|
162
172
|
connectorSpec.paths[path] = listOperation({
|
|
@@ -165,7 +175,9 @@ let IntegrationClient = class {
|
|
|
165
175
|
toolName,
|
|
166
176
|
toolInstructions
|
|
167
177
|
});
|
|
168
|
-
schemas[`list_${entity}_Request`] = listOperationRequest(
|
|
178
|
+
schemas[`list_${entity}_Request`] = listOperationRequest(
|
|
179
|
+
REQUEST_SCHEMA_OPTIONS
|
|
180
|
+
);
|
|
169
181
|
break;
|
|
170
182
|
case "get":
|
|
171
183
|
connectorSpec.paths[path] = getOperation({
|
|
@@ -174,7 +186,9 @@ let IntegrationClient = class {
|
|
|
174
186
|
toolName,
|
|
175
187
|
toolInstructions
|
|
176
188
|
});
|
|
177
|
-
schemas[`get_${entity}_Request`] = getOperationRequest(
|
|
189
|
+
schemas[`get_${entity}_Request`] = getOperationRequest(
|
|
190
|
+
REQUEST_SCHEMA_OPTIONS
|
|
191
|
+
);
|
|
178
192
|
break;
|
|
179
193
|
default:
|
|
180
194
|
throw new Error(
|
|
@@ -185,20 +199,26 @@ let IntegrationClient = class {
|
|
|
185
199
|
}
|
|
186
200
|
for (const action of this.actions) {
|
|
187
201
|
const { inputSchema, outputSchema, displayName } = await connectionsClient.getActionSchema(action);
|
|
202
|
+
const actionDisplayName = displayName.replace(/ /g, "");
|
|
188
203
|
let operation = "EXECUTE_ACTION";
|
|
189
204
|
if (action === EXECUTE_CUSTOM_QUERY_ACTION) {
|
|
190
|
-
schemas[`${
|
|
205
|
+
schemas[`${actionDisplayName}_Request`] = executeCustomQueryRequest(
|
|
206
|
+
REQUEST_SCHEMA_OPTIONS
|
|
207
|
+
);
|
|
191
208
|
operation = "EXECUTE_QUERY";
|
|
192
209
|
} else {
|
|
193
|
-
schemas[`${
|
|
194
|
-
|
|
210
|
+
schemas[`${actionDisplayName}_Request`] = actionRequest(
|
|
211
|
+
actionDisplayName,
|
|
212
|
+
REQUEST_SCHEMA_OPTIONS
|
|
213
|
+
);
|
|
214
|
+
schemas[`connectorInputPayload_${actionDisplayName}`] = connectorPayload(inputSchema);
|
|
195
215
|
}
|
|
196
|
-
schemas[`connectorOutputPayload_${
|
|
197
|
-
schemas[`${
|
|
216
|
+
schemas[`connectorOutputPayload_${actionDisplayName}`] = connectorPayload(outputSchema);
|
|
217
|
+
schemas[`${actionDisplayName}_Response`] = actionResponse(actionDisplayName);
|
|
198
218
|
connectorSpec.paths[`${pathPrefix}#${action}`] = getActionOperation({
|
|
199
219
|
action,
|
|
200
220
|
operation,
|
|
201
|
-
actionDisplayName
|
|
221
|
+
actionDisplayName,
|
|
202
222
|
toolName,
|
|
203
223
|
toolInstructions
|
|
204
224
|
});
|