@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
|
@@ -30,10 +30,10 @@ __export(auth_helpers_exports, {
|
|
|
30
30
|
createApiKeyScheme: () => createApiKeyScheme,
|
|
31
31
|
createBearerScheme: () => createBearerScheme,
|
|
32
32
|
credentialToParam: () => credentialToParam,
|
|
33
|
-
|
|
34
|
-
openidDictToSchemeCredential: () => openidDictToSchemeCredential,
|
|
33
|
+
openidRecordToSchemeCredential: () => openidRecordToSchemeCredential,
|
|
35
34
|
openidUrlToSchemeCredential: () => openidUrlToSchemeCredential,
|
|
36
|
-
|
|
35
|
+
recordToAuthScheme: () => recordToAuthScheme,
|
|
36
|
+
serviceAccountRecordToSchemeCredential: () => serviceAccountRecordToSchemeCredential,
|
|
37
37
|
serviceAccountSchemeCredential: () => serviceAccountSchemeCredential,
|
|
38
38
|
tokenToSchemeCredential: () => tokenToSchemeCredential
|
|
39
39
|
});
|
|
@@ -41,6 +41,7 @@ module.exports = __toCommonJS(auth_helpers_exports);
|
|
|
41
41
|
var import_zod = require("zod");
|
|
42
42
|
var import_auth_credential = require("../../../auth/auth_credential.js");
|
|
43
43
|
var import_case_utils = require("../../../utils/case_utils.js");
|
|
44
|
+
var import_error_utils = require("../../../utils/error_utils.js");
|
|
44
45
|
/**
|
|
45
46
|
* @license
|
|
46
47
|
* Copyright 2026 Google LLC
|
|
@@ -199,7 +200,7 @@ function tokenToSchemeCredential(tokenType, location, name, credentialValue) {
|
|
|
199
200
|
throw new Error(`Invalid security scheme type: ${tokenType}`);
|
|
200
201
|
}
|
|
201
202
|
__name(tokenToSchemeCredential, "tokenToSchemeCredential");
|
|
202
|
-
function
|
|
203
|
+
function serviceAccountRecordToSchemeCredential(config, scopes) {
|
|
203
204
|
const authCredential = {
|
|
204
205
|
authType: import_auth_credential.AuthCredentialTypes.SERVICE_ACCOUNT,
|
|
205
206
|
serviceAccount: {
|
|
@@ -213,7 +214,7 @@ function serviceAccountDictToSchemeCredential(config, scopes) {
|
|
|
213
214
|
};
|
|
214
215
|
return [bearerJwtScheme(), authCredential];
|
|
215
216
|
}
|
|
216
|
-
__name(
|
|
217
|
+
__name(serviceAccountRecordToSchemeCredential, "serviceAccountRecordToSchemeCredential");
|
|
217
218
|
function serviceAccountSchemeCredential(config) {
|
|
218
219
|
const authCredential = {
|
|
219
220
|
authType: import_auth_credential.AuthCredentialTypes.SERVICE_ACCOUNT,
|
|
@@ -222,9 +223,9 @@ function serviceAccountSchemeCredential(config) {
|
|
|
222
223
|
return [bearerJwtScheme(), authCredential];
|
|
223
224
|
}
|
|
224
225
|
__name(serviceAccountSchemeCredential, "serviceAccountSchemeCredential");
|
|
225
|
-
function
|
|
226
|
+
function openidRecordToSchemeCredential(configRecord, scopes, credentialRecord) {
|
|
226
227
|
const parsedConfig = OpenIdConnectConfigSchema.safeParse(
|
|
227
|
-
(0, import_case_utils.camelCaseKeys)(
|
|
228
|
+
(0, import_case_utils.camelCaseKeys)(configRecord)
|
|
228
229
|
);
|
|
229
230
|
if (!parsedConfig.success) {
|
|
230
231
|
throw new Error(
|
|
@@ -232,33 +233,33 @@ function openidDictToSchemeCredential(configDict, scopes, credentialDict) {
|
|
|
232
233
|
);
|
|
233
234
|
}
|
|
234
235
|
const openidScheme = { ...parsedConfig.data, scopes };
|
|
235
|
-
const values = Object.values(
|
|
236
|
+
const values = Object.values(credentialRecord);
|
|
236
237
|
if (values.length === 1) {
|
|
237
238
|
const wrapped = JsonObjectSchema.safeParse(values[0]);
|
|
238
239
|
if (wrapped.success && "client_id" in wrapped.data && "client_secret" in wrapped.data) {
|
|
239
|
-
|
|
240
|
+
credentialRecord = wrapped.data;
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
243
|
const missingFields = REQUIRED_CREDENTIAL_FIELDS.filter(
|
|
243
|
-
(field) => !(field in
|
|
244
|
+
(field) => !(field in credentialRecord)
|
|
244
245
|
);
|
|
245
246
|
if (missingFields.length > 0) {
|
|
246
247
|
throw new Error(
|
|
247
|
-
`Missing required fields in
|
|
248
|
+
`Missing required fields in credentialRecord: ${missingFields.join(", ")}`
|
|
248
249
|
);
|
|
249
250
|
}
|
|
250
251
|
const authCredential = {
|
|
251
252
|
authType: import_auth_credential.AuthCredentialTypes.OPEN_ID_CONNECT,
|
|
252
253
|
oauth2: {
|
|
253
|
-
clientId: String(
|
|
254
|
-
clientSecret: String(
|
|
255
|
-
redirectUri: "redirect_uri" in
|
|
254
|
+
clientId: String(credentialRecord["client_id"]),
|
|
255
|
+
clientSecret: String(credentialRecord["client_secret"]),
|
|
256
|
+
redirectUri: "redirect_uri" in credentialRecord ? String(credentialRecord["redirect_uri"]) : void 0
|
|
256
257
|
}
|
|
257
258
|
};
|
|
258
259
|
return [openidScheme, authCredential];
|
|
259
260
|
}
|
|
260
|
-
__name(
|
|
261
|
-
async function openidUrlToSchemeCredential(openidUrl, scopes,
|
|
261
|
+
__name(openidRecordToSchemeCredential, "openidRecordToSchemeCredential");
|
|
262
|
+
async function openidUrlToSchemeCredential(openidUrl, scopes, credentialRecord) {
|
|
262
263
|
let response;
|
|
263
264
|
try {
|
|
264
265
|
response = await fetch(openidUrl, {
|
|
@@ -269,21 +270,21 @@ async function openidUrlToSchemeCredential(openidUrl, scopes, credentialDict) {
|
|
|
269
270
|
}
|
|
270
271
|
} catch (e) {
|
|
271
272
|
throw new Error(
|
|
272
|
-
`Failed to fetch OpenID configuration from ${openidUrl}: ${
|
|
273
|
+
`Failed to fetch OpenID configuration from ${openidUrl}: ${(0, import_error_utils.formatError)(e)}`
|
|
273
274
|
);
|
|
274
275
|
}
|
|
275
|
-
let
|
|
276
|
+
let configRecord;
|
|
276
277
|
try {
|
|
277
|
-
|
|
278
|
+
configRecord = JsonObjectSchema.parse(await response.json());
|
|
278
279
|
} catch (e) {
|
|
279
280
|
throw new Error(
|
|
280
|
-
`Invalid JSON response from OpenID configuration endpoint ${openidUrl}: ${
|
|
281
|
+
`Invalid JSON response from OpenID configuration endpoint ${openidUrl}: ${(0, import_error_utils.formatError)(e)}`
|
|
281
282
|
);
|
|
282
283
|
}
|
|
283
|
-
return
|
|
284
|
-
{ ...
|
|
284
|
+
return openidRecordToSchemeCredential(
|
|
285
|
+
{ ...configRecord, openIdConnectUrl: openidUrl },
|
|
285
286
|
scopes,
|
|
286
|
-
|
|
287
|
+
credentialRecord
|
|
287
288
|
);
|
|
288
289
|
}
|
|
289
290
|
__name(openidUrlToSchemeCredential, "openidUrlToSchemeCredential");
|
|
@@ -334,9 +335,9 @@ function parseSecurityScheme(schema, data) {
|
|
|
334
335
|
return result.data;
|
|
335
336
|
}
|
|
336
337
|
__name(parseSecurityScheme, "parseSecurityScheme");
|
|
337
|
-
function
|
|
338
|
+
function recordToAuthScheme(data) {
|
|
338
339
|
if (!("type" in data)) {
|
|
339
|
-
throw new Error("Missing 'type' field in security scheme
|
|
340
|
+
throw new Error("Missing 'type' field in security scheme object.");
|
|
340
341
|
}
|
|
341
342
|
const securityType = data["type"];
|
|
342
343
|
switch (securityType) {
|
|
@@ -352,7 +353,7 @@ function dictToAuthScheme(data) {
|
|
|
352
353
|
throw new Error(`Invalid security scheme type: ${securityType}`);
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
|
-
__name(
|
|
356
|
+
__name(recordToAuthScheme, "recordToAuthScheme");
|
|
356
357
|
// Annotate the CommonJS export names for ESM import in node:
|
|
357
358
|
0 && (module.exports = {
|
|
358
359
|
INTERNAL_AUTH_PREFIX,
|
|
@@ -360,10 +361,10 @@ __name(dictToAuthScheme, "dictToAuthScheme");
|
|
|
360
361
|
createApiKeyScheme,
|
|
361
362
|
createBearerScheme,
|
|
362
363
|
credentialToParam,
|
|
363
|
-
|
|
364
|
-
openidDictToSchemeCredential,
|
|
364
|
+
openidRecordToSchemeCredential,
|
|
365
365
|
openidUrlToSchemeCredential,
|
|
366
|
-
|
|
366
|
+
recordToAuthScheme,
|
|
367
|
+
serviceAccountRecordToSchemeCredential,
|
|
367
368
|
serviceAccountSchemeCredential,
|
|
368
369
|
tokenToSchemeCredential
|
|
369
370
|
});
|
|
@@ -50,7 +50,7 @@ var import_experimental = require("../../../../utils/experimental.js");
|
|
|
50
50
|
function checkSchemeCredentialType(authScheme, authCredential) {
|
|
51
51
|
if (!authCredential) {
|
|
52
52
|
throw new Error(
|
|
53
|
-
"
|
|
53
|
+
"authCredential is empty. Please create AuthCredential using OAuth2Auth."
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
if (authScheme.type !== import_auth_schemes.AuthSchemeType.OPEN_ID_CONNECT && authScheme.type !== import_auth_schemes.AuthSchemeType.OAUTH2) {
|
|
@@ -60,7 +60,7 @@ function checkSchemeCredentialType(authScheme, authCredential) {
|
|
|
60
60
|
}
|
|
61
61
|
if (!authCredential.oauth2 && !authCredential.http) {
|
|
62
62
|
throw new Error(
|
|
63
|
-
"
|
|
63
|
+
"authCredential is not configured with oauth2. Please create AuthCredential and set OAuth2Auth."
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -81,12 +81,12 @@ function generateAuthToken(authCredential) {
|
|
|
81
81
|
}
|
|
82
82
|
__name(generateAuthToken, "generateAuthToken");
|
|
83
83
|
function exchangeCredential(authScheme, authCredential) {
|
|
84
|
-
var _a
|
|
84
|
+
var _a;
|
|
85
85
|
checkSchemeCredentialType(authScheme, authCredential);
|
|
86
86
|
if (authCredential.http) {
|
|
87
87
|
return authCredential;
|
|
88
88
|
}
|
|
89
|
-
if ((
|
|
89
|
+
if ((_a = authCredential.oauth2) == null ? void 0 : _a.accessToken) {
|
|
90
90
|
return generateAuthToken(authCredential);
|
|
91
91
|
}
|
|
92
92
|
return null;
|
|
@@ -54,15 +54,27 @@ const VALID_SCHEMA_TYPES = /* @__PURE__ */ new Set([
|
|
|
54
54
|
"string"
|
|
55
55
|
]);
|
|
56
56
|
let OpenApiSpecParser = class {
|
|
57
|
+
/**
|
|
58
|
+
* @param options.preservePropertyNames Keeps the original parameter and
|
|
59
|
+
* function names instead of converting them to snake_case.
|
|
60
|
+
* @param options.unconstrainedObjectBodyAsParameter Emits a whole-body
|
|
61
|
+
* parameter named `body` when an object request body schema has no
|
|
62
|
+
* properties. Defaults to `false`.
|
|
63
|
+
* @deprecated Retained for backwards compatibility; empty object schemas
|
|
64
|
+
* produce no parameters by default. This option will be removed in a
|
|
65
|
+
* future release.
|
|
66
|
+
*/
|
|
57
67
|
constructor(options = {}) {
|
|
58
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
59
69
|
this.preservePropertyNames = (_a = options.preservePropertyNames) != null ? _a : false;
|
|
70
|
+
this.unconstrainedObjectBodyAsParameter = (_b = options.unconstrainedObjectBodyAsParameter) != null ? _b : false;
|
|
60
71
|
}
|
|
61
72
|
parse(openapiSpec) {
|
|
62
73
|
const resolvedSpec = resolveReferences(openapiSpec);
|
|
63
74
|
const sanitizedSpec = sanitizeSchemaTypes(resolvedSpec);
|
|
64
75
|
return collectOperations(sanitizedSpec, {
|
|
65
|
-
preservePropertyNames: this.preservePropertyNames
|
|
76
|
+
preservePropertyNames: this.preservePropertyNames,
|
|
77
|
+
unconstrainedObjectBodyAsParameter: this.unconstrainedObjectBodyAsParameter
|
|
66
78
|
});
|
|
67
79
|
}
|
|
68
80
|
};
|
|
@@ -197,17 +209,18 @@ function resolveServerUrl(server) {
|
|
|
197
209
|
}
|
|
198
210
|
__name(resolveServerUrl, "resolveServerUrl");
|
|
199
211
|
function collectOperations(spec, options = {}) {
|
|
200
|
-
var _a, _b, _c;
|
|
212
|
+
var _a, _b, _c, _d;
|
|
201
213
|
const preservePropertyNames = (_a = options.preservePropertyNames) != null ? _a : false;
|
|
214
|
+
const unconstrainedObjectBodyAsParameter = (_b = options.unconstrainedObjectBodyAsParameter) != null ? _b : false;
|
|
202
215
|
const operations = [];
|
|
203
|
-
const server = (
|
|
216
|
+
const server = (_c = spec.servers) == null ? void 0 : _c[0];
|
|
204
217
|
const baseUrl = server ? resolveServerUrl(server) : "";
|
|
205
218
|
const globalSecurity = spec.security || [];
|
|
206
219
|
let globalSchemeName;
|
|
207
220
|
if (globalSecurity.length > 0) {
|
|
208
221
|
globalSchemeName = Object.keys(globalSecurity[0])[0];
|
|
209
222
|
}
|
|
210
|
-
const authSchemes = ((
|
|
223
|
+
const authSchemes = ((_d = spec.components) == null ? void 0 : _d.securitySchemes) || {};
|
|
211
224
|
for (const [path, pathItem] of Object.entries(spec.paths || {})) {
|
|
212
225
|
if (!pathItem) continue;
|
|
213
226
|
const methods = [
|
|
@@ -230,7 +243,8 @@ function collectOperations(spec, options = {}) {
|
|
|
230
243
|
operation.operationId = (0, import_case_utils.toSnakeCaseName)(`${path}_${method}`);
|
|
231
244
|
}
|
|
232
245
|
const parser = new import_operation_parser.OperationParser(operation, {
|
|
233
|
-
preservePropertyNames
|
|
246
|
+
preservePropertyNames,
|
|
247
|
+
unconstrainedObjectBodyAsParameter
|
|
234
248
|
});
|
|
235
249
|
let authSchemeName;
|
|
236
250
|
if (operation.security && operation.security.length > 0) {
|
|
@@ -52,13 +52,20 @@ let OperationParser = class {
|
|
|
52
52
|
* function names instead of converting them to snake_case.
|
|
53
53
|
* @param options.shouldParse Whether to parse the operation during
|
|
54
54
|
* construction. Defaults to `true`.
|
|
55
|
+
* @param options.unconstrainedObjectBodyAsParameter Emits a whole-body
|
|
56
|
+
* parameter named `body` when an object request body schema has no
|
|
57
|
+
* properties. Defaults to `false`.
|
|
58
|
+
* @deprecated Retained for backwards compatibility; empty object schemas
|
|
59
|
+
* produce no parameters by default. This option will be removed in a
|
|
60
|
+
* future release.
|
|
55
61
|
*/
|
|
56
62
|
constructor(operation, options = {}) {
|
|
57
63
|
this.params = [];
|
|
58
|
-
var _a, _b;
|
|
64
|
+
var _a, _b, _c;
|
|
59
65
|
this.operation = typeof operation === "string" ? JSON.parse(operation) : operation;
|
|
60
66
|
this.preservePropertyNames = (_a = options.preservePropertyNames) != null ? _a : false;
|
|
61
|
-
|
|
67
|
+
this.unconstrainedObjectBodyAsParameter = (_b = options.unconstrainedObjectBodyAsParameter) != null ? _b : false;
|
|
68
|
+
if ((_c = options.shouldParse) != null ? _c : true) {
|
|
62
69
|
this.processOperationParameters();
|
|
63
70
|
this.processRequestBody();
|
|
64
71
|
this.returnValue = this.processReturnValue();
|
|
@@ -78,6 +85,7 @@ let OperationParser = class {
|
|
|
78
85
|
return (0, import_case_utils.renameReservedKeywords)((0, import_case_utils.toSnakeCaseName)(originalName));
|
|
79
86
|
}
|
|
80
87
|
processOperationParameters() {
|
|
88
|
+
var _a;
|
|
81
89
|
const parameters = this.operation.parameters || [];
|
|
82
90
|
for (const param of parameters) {
|
|
83
91
|
if ("name" in param) {
|
|
@@ -88,9 +96,12 @@ let OperationParser = class {
|
|
|
88
96
|
this.params.push({
|
|
89
97
|
originalName,
|
|
90
98
|
paramLocation: location,
|
|
91
|
-
paramSchema:
|
|
99
|
+
paramSchema: {
|
|
100
|
+
...schema,
|
|
101
|
+
description: schema.description || description || void 0
|
|
102
|
+
},
|
|
92
103
|
description,
|
|
93
|
-
required: param.required
|
|
104
|
+
required: (_a = param.required) != null ? _a : false,
|
|
94
105
|
name: this.getParamName(originalName)
|
|
95
106
|
});
|
|
96
107
|
}
|
|
@@ -126,7 +137,7 @@ let OperationParser = class {
|
|
|
126
137
|
});
|
|
127
138
|
}
|
|
128
139
|
}
|
|
129
|
-
} else {
|
|
140
|
+
} else if (this.unconstrainedObjectBodyAsParameter) {
|
|
130
141
|
this.params.push({
|
|
131
142
|
originalName: "",
|
|
132
143
|
paramLocation: "body",
|
|
@@ -147,7 +158,7 @@ let OperationParser = class {
|
|
|
147
158
|
});
|
|
148
159
|
} else {
|
|
149
160
|
this.params.push({
|
|
150
|
-
originalName: "
|
|
161
|
+
originalName: "",
|
|
151
162
|
paramLocation: "body",
|
|
152
163
|
paramSchema: schema,
|
|
153
164
|
description,
|
|
@@ -46,7 +46,7 @@ __export(openapi_toolset_exports, {
|
|
|
46
46
|
OpenAPIToolset: () => OpenAPIToolset
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(openapi_toolset_exports);
|
|
49
|
-
var
|
|
49
|
+
var yaml = __toESM(require("js-yaml"), 1);
|
|
50
50
|
var import_experimental = require("../../utils/experimental.js");
|
|
51
51
|
var import_logger = require("../../utils/logger.js");
|
|
52
52
|
var import_base_toolset = require("../base_toolset.js");
|
|
@@ -64,7 +64,7 @@ let OpenAPIToolset = class extends import_base_toolset.BaseToolset {
|
|
|
64
64
|
let spec = options.specDict;
|
|
65
65
|
if (!spec && options.specStr) {
|
|
66
66
|
if (options.specType === "yaml" || !options.specType && options.specStr.trim().startsWith("---")) {
|
|
67
|
-
spec =
|
|
67
|
+
spec = yaml.load(options.specStr);
|
|
68
68
|
} else if (options.specType === "json" || !options.specType) {
|
|
69
69
|
spec = JSON.parse(options.specStr);
|
|
70
70
|
} else {
|
|
@@ -75,7 +75,8 @@ let OpenAPIToolset = class extends import_base_toolset.BaseToolset {
|
|
|
75
75
|
throw new Error("Either specDict or specStr must be provided.");
|
|
76
76
|
}
|
|
77
77
|
const parser = new import_openapi_spec_parser.OpenApiSpecParser({
|
|
78
|
-
preservePropertyNames: options.preservePropertyNames
|
|
78
|
+
preservePropertyNames: options.preservePropertyNames,
|
|
79
|
+
unconstrainedObjectBodyAsParameter: options.unconstrainedObjectBodyAsParameter
|
|
79
80
|
});
|
|
80
81
|
const parsedOperations = parser.parse(spec);
|
|
81
82
|
for (const op of parsedOperations) {
|
|
@@ -96,7 +97,8 @@ let OpenAPIToolset = class extends import_base_toolset.BaseToolset {
|
|
|
96
97
|
{
|
|
97
98
|
preservePropertyNames: options.preservePropertyNames,
|
|
98
99
|
headerProvider: options.headerProvider,
|
|
99
|
-
credentialKey: options.credentialKey
|
|
100
|
+
credentialKey: options.credentialKey,
|
|
101
|
+
unconstrainedObjectBodyAsParameter: options.unconstrainedObjectBodyAsParameter
|
|
100
102
|
}
|
|
101
103
|
);
|
|
102
104
|
this.tools.push(tool);
|
|
@@ -111,15 +113,7 @@ let OpenAPIToolset = class extends import_base_toolset.BaseToolset {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
async getTools(context) {
|
|
114
|
-
return this.tools.filter((tool) =>
|
|
115
|
-
if (Array.isArray(this.toolFilter) && this.toolFilter.length > 0) {
|
|
116
|
-
return this.toolFilter.includes(tool.name);
|
|
117
|
-
}
|
|
118
|
-
if (context) {
|
|
119
|
-
return this.isToolSelected(tool, context);
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
});
|
|
116
|
+
return this.tools.filter((tool) => this.isToolSelected(tool, context));
|
|
123
117
|
}
|
|
124
118
|
getTool(toolName) {
|
|
125
119
|
return this.tools.find((tool) => tool.name === toolName);
|
|
@@ -203,6 +203,32 @@ function encodePathParamValue(name, value) {
|
|
|
203
203
|
return encodeURIComponent(value);
|
|
204
204
|
}
|
|
205
205
|
__name(encodePathParamValue, "encodePathParamValue");
|
|
206
|
+
function toParamString(value) {
|
|
207
|
+
if (Array.isArray(value)) {
|
|
208
|
+
return value.filter((item) => item !== void 0 && item !== null).map(toParamString).join(",");
|
|
209
|
+
}
|
|
210
|
+
if (typeof value === "object" && value !== null) {
|
|
211
|
+
return Object.entries(value).filter(([, v]) => v !== void 0 && v !== null).map(([k, v]) => `${k},${toParamString(v)}`).join(",");
|
|
212
|
+
}
|
|
213
|
+
return String(value);
|
|
214
|
+
}
|
|
215
|
+
__name(toParamString, "toParamString");
|
|
216
|
+
function serializeQueryValue(value) {
|
|
217
|
+
return typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
|
|
218
|
+
}
|
|
219
|
+
__name(serializeQueryValue, "serializeQueryValue");
|
|
220
|
+
function appendParamValue(target, name, value) {
|
|
221
|
+
if (!Array.isArray(value)) {
|
|
222
|
+
target.append(name, serializeQueryValue(value));
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
for (const item of value) {
|
|
226
|
+
if (item !== void 0 && item !== null) {
|
|
227
|
+
target.append(name, serializeQueryValue(item));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
__name(appendParamValue, "appendParamValue");
|
|
206
232
|
function prepareRequestParams(endpoint, parameters, args) {
|
|
207
233
|
const headers = {};
|
|
208
234
|
const queryParams = new URLSearchParams();
|
|
@@ -217,18 +243,24 @@ function prepareRequestParams(endpoint, parameters, args) {
|
|
|
217
243
|
const originalName = param.originalName;
|
|
218
244
|
const location = param.paramLocation;
|
|
219
245
|
if (location === "path") {
|
|
220
|
-
|
|
221
|
-
originalName
|
|
222
|
-
|
|
223
|
-
|
|
246
|
+
if (argValue !== void 0 && argValue !== null) {
|
|
247
|
+
pathParams[originalName] = encodePathParamValue(
|
|
248
|
+
originalName,
|
|
249
|
+
toParamString(argValue)
|
|
250
|
+
);
|
|
251
|
+
}
|
|
224
252
|
} else if (location === "query") {
|
|
225
253
|
if (argValue !== void 0 && argValue !== null && argValue !== "") {
|
|
226
|
-
queryParams
|
|
254
|
+
appendParamValue(queryParams, originalName, argValue);
|
|
227
255
|
}
|
|
228
256
|
} else if (location === "header") {
|
|
229
|
-
|
|
257
|
+
if (argValue !== void 0 && argValue !== null) {
|
|
258
|
+
headers[originalName] = toParamString(argValue);
|
|
259
|
+
}
|
|
230
260
|
} else if (location === "cookie") {
|
|
231
|
-
|
|
261
|
+
if (argValue !== void 0 && argValue !== null) {
|
|
262
|
+
cookies[originalName] = toParamString(argValue);
|
|
263
|
+
}
|
|
232
264
|
} else if (location === "body") {
|
|
233
265
|
if (originalName === "body" || originalName === "array" || originalName === "") {
|
|
234
266
|
body = argValue;
|
|
@@ -262,6 +294,18 @@ function isRawBody(value) {
|
|
|
262
294
|
return typeof value === "string" || ArrayBuffer.isView(value) || value instanceof ArrayBuffer || value instanceof Blob;
|
|
263
295
|
}
|
|
264
296
|
__name(isRawBody, "isRawBody");
|
|
297
|
+
function isFormFields(value) {
|
|
298
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
299
|
+
}
|
|
300
|
+
__name(isFormFields, "isFormFields");
|
|
301
|
+
function appendFormFields(target, fields) {
|
|
302
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
303
|
+
if (value !== void 0 && value !== null) {
|
|
304
|
+
appendParamValue(target, name, value);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
__name(appendFormFields, "appendFormFields");
|
|
265
309
|
function prepareRequestBody(requestBody, body, bodyData, headers) {
|
|
266
310
|
const finalData = body !== void 0 ? body : Object.keys(bodyData).length > 0 ? bodyData : void 0;
|
|
267
311
|
if (requestBody && "content" in requestBody) {
|
|
@@ -272,13 +316,16 @@ function prepareRequestBody(requestBody, body, bodyData, headers) {
|
|
|
272
316
|
headers["Content-Type"] = mimeType;
|
|
273
317
|
return typeof finalData === "string" ? finalData : JSON.stringify(finalData);
|
|
274
318
|
} else if (mimeType === "application/x-www-form-urlencoded") {
|
|
319
|
+
if (isFormFields(finalData)) {
|
|
320
|
+
const formParams = new URLSearchParams();
|
|
321
|
+
appendFormFields(formParams, finalData);
|
|
322
|
+
return formParams;
|
|
323
|
+
}
|
|
275
324
|
return new URLSearchParams(finalData);
|
|
276
325
|
} else if (mimeType === "multipart/form-data") {
|
|
277
326
|
const formData = new FormData();
|
|
278
327
|
if (typeof finalData === "object" && finalData !== null) {
|
|
279
|
-
|
|
280
|
-
formData.append(key, String(value));
|
|
281
|
-
}
|
|
328
|
+
appendFormFields(formData, finalData);
|
|
282
329
|
}
|
|
283
330
|
return formData;
|
|
284
331
|
} else if (mimeType === "application/octet-stream") {
|
|
@@ -48,6 +48,7 @@ __export(load_skill_resource_tool_exports, {
|
|
|
48
48
|
module.exports = __toCommonJS(load_skill_resource_tool_exports);
|
|
49
49
|
var import_genai = require("@google/genai");
|
|
50
50
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
51
|
+
var import_instrumentation = require("../../telemetry/api/instrumentation.js");
|
|
51
52
|
var import_experimental = require("../../utils/experimental.js");
|
|
52
53
|
var import_file_utils = require("../../utils/file_utils.js");
|
|
53
54
|
var import_base_tool = require("../base_tool.js");
|
|
@@ -105,6 +106,11 @@ let LoadSkillResourceTool = class extends import_base_tool.BaseTool {
|
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
resourcePath = import_node_path.default.posix.normalize(resourcePath);
|
|
109
|
+
const skillActivity = (0, import_instrumentation.recordSkillActivity)({
|
|
110
|
+
kind: "resource",
|
|
111
|
+
skillName,
|
|
112
|
+
resourcePath
|
|
113
|
+
});
|
|
108
114
|
let skill;
|
|
109
115
|
try {
|
|
110
116
|
skill = await this.toolset.getOrFetchSkill(
|
|
@@ -123,6 +129,7 @@ let LoadSkillResourceTool = class extends import_base_tool.BaseTool {
|
|
|
123
129
|
error_code: "SKILL_NOT_FOUND"
|
|
124
130
|
};
|
|
125
131
|
}
|
|
132
|
+
skillActivity.recordSkill(skill);
|
|
126
133
|
let content;
|
|
127
134
|
const skillResources = skill.resources || {};
|
|
128
135
|
if (resourcePath.startsWith("references/")) {
|
|
@@ -38,6 +38,7 @@ __export(load_skill_tool_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(load_skill_tool_exports);
|
|
39
39
|
var import_genai = require("@google/genai");
|
|
40
40
|
var import_invocation_context = require("../../agents/invocation_context.js");
|
|
41
|
+
var import_instrumentation = require("../../telemetry/api/instrumentation.js");
|
|
41
42
|
var import_experimental = require("../../utils/experimental.js");
|
|
42
43
|
var import_base_tool = require("../base_tool.js");
|
|
43
44
|
/**
|
|
@@ -80,6 +81,7 @@ let LoadSkillTool = class extends import_base_tool.BaseTool {
|
|
|
80
81
|
error_code: "MISSING_SKILL_NAME"
|
|
81
82
|
};
|
|
82
83
|
}
|
|
84
|
+
const skillActivity = (0, import_instrumentation.recordSkillActivity)({ kind: "load", skillName });
|
|
83
85
|
let skill;
|
|
84
86
|
try {
|
|
85
87
|
skill = await this.toolset.getOrFetchSkill(
|
|
@@ -98,6 +100,7 @@ let LoadSkillTool = class extends import_base_tool.BaseTool {
|
|
|
98
100
|
error_code: "SKILL_NOT_FOUND"
|
|
99
101
|
};
|
|
100
102
|
}
|
|
103
|
+
skillActivity.recordSkill(skill);
|
|
101
104
|
const agentName = (0, import_invocation_context.requireAgent)(toolContext.invocationContext).name;
|
|
102
105
|
const stateKey = `_adk_activated_skill_${agentName}`;
|
|
103
106
|
const currentActivated = toolContext.state.get(stateKey) || [];
|
|
@@ -51,6 +51,7 @@ var import_genai = require("@google/genai");
|
|
|
51
51
|
var path = __toESM(require("node:path"), 1);
|
|
52
52
|
var import_llm_agent = require("../../agents/llm_agent.js");
|
|
53
53
|
var import_code_execution_utils = require("../../code_executors/code_execution_utils.js");
|
|
54
|
+
var import_instrumentation = require("../../telemetry/api/instrumentation.js");
|
|
54
55
|
var import_experimental = require("../../utils/experimental.js");
|
|
55
56
|
var import_file_extension_utils = require("../../utils/file_extension_utils.js");
|
|
56
57
|
var import_file_utils = require("../../utils/file_utils.js");
|
|
@@ -112,6 +113,11 @@ let RunSkillScriptTool = class extends import_base_tool.BaseTool {
|
|
|
112
113
|
errorCode: "MISSING_SCRIPT_PATH"
|
|
113
114
|
};
|
|
114
115
|
}
|
|
116
|
+
const skillActivity = (0, import_instrumentation.recordSkillActivity)({
|
|
117
|
+
kind: "script",
|
|
118
|
+
skillName,
|
|
119
|
+
scriptPath
|
|
120
|
+
});
|
|
115
121
|
let skill;
|
|
116
122
|
try {
|
|
117
123
|
skill = await this.toolset.getOrFetchSkill(
|
|
@@ -130,9 +136,11 @@ let RunSkillScriptTool = class extends import_base_tool.BaseTool {
|
|
|
130
136
|
errorCode: "SKILL_NOT_FOUND"
|
|
131
137
|
};
|
|
132
138
|
}
|
|
133
|
-
|
|
139
|
+
skillActivity.recordSkill(skill);
|
|
140
|
+
let relScriptPath = scriptPath.startsWith("scripts/") ? scriptPath.substring("scripts/".length) : scriptPath;
|
|
134
141
|
let script = (_b = (_a = skill.resources) == null ? void 0 : _a.scripts) == null ? void 0 : _b[relScriptPath];
|
|
135
142
|
if (!script) {
|
|
143
|
+
relScriptPath = scriptPath;
|
|
136
144
|
script = (_d = (_c = skill.resources) == null ? void 0 : _c.scripts) == null ? void 0 : _d[scriptPath];
|
|
137
145
|
}
|
|
138
146
|
if (!script) {
|
|
@@ -159,7 +167,9 @@ let RunSkillScriptTool = class extends import_base_tool.BaseTool {
|
|
|
159
167
|
const result = await codeExecutor.executeCode({
|
|
160
168
|
invocationContext: toolContext.invocationContext,
|
|
161
169
|
codeExecutionInput: {
|
|
162
|
-
|
|
170
|
+
// Scripts are always written under scripts/ (see
|
|
171
|
+
// getSkillResourceFiles), with or without the prefix in script_path.
|
|
172
|
+
code: buildWrapperCode(`scripts/${relScriptPath}`, language),
|
|
163
173
|
inputFiles: getSkillResourceFiles(skill),
|
|
164
174
|
language,
|
|
165
175
|
args: scriptArgs
|