@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
|
@@ -7,6 +7,13 @@ import { FunctionDeclaration } from '@google/genai';
|
|
|
7
7
|
import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
|
|
8
8
|
import { RestApiTool } from '../openapi_tool/rest_api_tool.js';
|
|
9
9
|
declare const GOOGLE_API_TOOL_SIGNATURE_SYMBOL: unique symbol;
|
|
10
|
+
/**
|
|
11
|
+
* Options for constructing a {@link GoogleApiTool}.
|
|
12
|
+
*/
|
|
13
|
+
export interface GoogleApiToolOptions {
|
|
14
|
+
clientId?: string;
|
|
15
|
+
clientSecret?: string;
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* Type guard to check if an object is an instance of {@link GoogleApiTool}.
|
|
12
19
|
*/
|
|
@@ -17,14 +24,14 @@ export declare function isGoogleApiTool(obj: unknown): obj is GoogleApiTool;
|
|
|
17
24
|
*/
|
|
18
25
|
export declare class GoogleApiTool extends BaseTool {
|
|
19
26
|
readonly [GOOGLE_API_TOOL_SIGNATURE_SYMBOL] = true;
|
|
20
|
-
readonly restApiTool
|
|
21
|
-
constructor(restApiTool: RestApiTool);
|
|
27
|
+
private readonly restApiTool;
|
|
28
|
+
constructor(restApiTool: RestApiTool, options?: GoogleApiToolOptions);
|
|
22
29
|
_getDeclaration(): FunctionDeclaration;
|
|
23
30
|
runAsync(request: RunAsyncToolRequest): Promise<unknown>;
|
|
24
31
|
/**
|
|
25
32
|
* Configures OpenID Connect OAuth2 client credentials on the underlying
|
|
26
33
|
* {@link RestApiTool}.
|
|
27
34
|
*/
|
|
28
|
-
configureAuth(clientId
|
|
35
|
+
configureAuth(clientId?: string, clientSecret?: string): void;
|
|
29
36
|
}
|
|
30
37
|
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
7
|
+
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
8
|
+
import { GoogleApiTool } from './google_api_tool.js';
|
|
9
|
+
declare const GOOGLE_API_TOOLSET_SIGNATURE_SYMBOL: unique symbol;
|
|
10
|
+
/**
|
|
11
|
+
* Options for constructing a {@link GoogleApiToolset}.
|
|
12
|
+
*/
|
|
13
|
+
export interface GoogleApiToolsetOptions {
|
|
14
|
+
apiName?: string;
|
|
15
|
+
apiVersion?: string;
|
|
16
|
+
clientId?: string;
|
|
17
|
+
clientSecret?: string;
|
|
18
|
+
toolFilter?: ToolPredicate | string[];
|
|
19
|
+
scopes?: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Type guard to check if an object is an instance of {@link GoogleApiToolset}.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isGoogleApiToolset(obj: unknown): obj is GoogleApiToolset;
|
|
25
|
+
/**
|
|
26
|
+
* Toolset that wraps Google Discovery API operations as {@link GoogleApiTool}
|
|
27
|
+
* instances configured for Google OpenID Connect authentication.
|
|
28
|
+
*/
|
|
29
|
+
export declare class GoogleApiToolset extends BaseToolset {
|
|
30
|
+
readonly [GOOGLE_API_TOOLSET_SIGNATURE_SYMBOL] = true;
|
|
31
|
+
toolFilter: ToolPredicate | string[];
|
|
32
|
+
readonly apiName?: string;
|
|
33
|
+
readonly apiVersion?: string;
|
|
34
|
+
readonly scopes?: string[];
|
|
35
|
+
private clientId?;
|
|
36
|
+
private clientSecret?;
|
|
37
|
+
private openapiToolset?;
|
|
38
|
+
private loadingPromise?;
|
|
39
|
+
private tools;
|
|
40
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
41
|
+
private loadToolsetWithOidcAuth;
|
|
42
|
+
private ensureToolsLoaded;
|
|
43
|
+
/**
|
|
44
|
+
* Returns all tools in the toolset matching the active `toolFilter`.
|
|
45
|
+
*/
|
|
46
|
+
getTools(context?: ReadonlyContext): Promise<GoogleApiTool[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Updates the tool filter used by {@link getTools}.
|
|
49
|
+
*/
|
|
50
|
+
setToolFilter(toolFilter: ToolPredicate | string[]): void;
|
|
51
|
+
/**
|
|
52
|
+
* Configures OAuth2 client ID and secret across all tools in the toolset.
|
|
53
|
+
*/
|
|
54
|
+
configureAuth(clientId?: string, clientSecret?: string): void;
|
|
55
|
+
close(): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { GoogleApiToolset, type GoogleApiToolsetOptions } from './google_api_toolset.js';
|
|
7
|
+
/**
|
|
8
|
+
* Toolset for the Google BigQuery v2 API.
|
|
9
|
+
*/
|
|
10
|
+
export declare class BigQueryToolset extends GoogleApiToolset {
|
|
11
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Toolset for the Google Calendar v3 API.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CalendarToolset extends GoogleApiToolset {
|
|
17
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Toolset for the Gmail v1 API.
|
|
21
|
+
*/
|
|
22
|
+
export declare class GmailToolset extends GoogleApiToolset {
|
|
23
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Toolset for the YouTube Data v3 API.
|
|
27
|
+
*/
|
|
28
|
+
export declare class YoutubeToolset extends GoogleApiToolset {
|
|
29
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Toolset for the Google Slides v1 API.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SlidesToolset extends GoogleApiToolset {
|
|
35
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Toolset for the Google Sheets v4 API.
|
|
39
|
+
*/
|
|
40
|
+
export declare class SheetsToolset extends GoogleApiToolset {
|
|
41
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Toolset for the Google Docs v1 API.
|
|
45
|
+
*/
|
|
46
|
+
export declare class DocsToolset extends GoogleApiToolset {
|
|
47
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
48
|
+
}
|
|
@@ -49,6 +49,7 @@ export interface GoogleApiSchema {
|
|
|
49
49
|
export interface GoogleApiMethod {
|
|
50
50
|
id?: string;
|
|
51
51
|
path?: string;
|
|
52
|
+
flatPath?: string;
|
|
52
53
|
httpMethod?: string;
|
|
53
54
|
description?: string;
|
|
54
55
|
parameters?: Record<string, GoogleApiParameter>;
|
|
@@ -144,10 +145,10 @@ export declare function convertResources(resources: Record<string, GoogleApiReso
|
|
|
144
145
|
* Converts Google API Discovery documents into OpenAPI v3.0.0 specifications.
|
|
145
146
|
*/
|
|
146
147
|
export declare class GoogleApiToOpenApiConverter {
|
|
147
|
-
readonly apiName
|
|
148
|
-
readonly apiVersion
|
|
149
|
-
googleApiSpec
|
|
150
|
-
openapiSpec
|
|
148
|
+
private readonly apiName;
|
|
149
|
+
private readonly apiVersion;
|
|
150
|
+
private googleApiSpec;
|
|
151
|
+
private openapiSpec;
|
|
151
152
|
constructor(apiName: string, apiVersion: string);
|
|
152
153
|
/**
|
|
153
154
|
* Fetches the Google API specification from the Google Discovery service.
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
export { GoogleApiTool, isGoogleApiTool } from './google_api_tool.js';
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export type { GoogleApiMethod, GoogleApiOAuth2Scope, GoogleApiParameter, GoogleApiResource, GoogleApiSchema, GoogleApiSpec, } from './googleapi_to_openapi_converter.js';
|
|
7
|
+
export type { GoogleApiToolOptions } from './google_api_tool.js';
|
|
8
|
+
export { GoogleApiToolset, isGoogleApiToolset } from './google_api_toolset.js';
|
|
9
|
+
export type { GoogleApiToolsetOptions } from './google_api_toolset.js';
|
|
10
|
+
export { BigQueryToolset, CalendarToolset, DocsToolset, GmailToolset, SheetsToolset, SlidesToolset, YoutubeToolset, } from './google_api_toolsets.js';
|
|
@@ -3,8 +3,25 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { FunctionDeclaration } from '@google/genai';
|
|
6
|
+
import { FunctionDeclaration, Part } from '@google/genai';
|
|
7
7
|
import { BaseTool, RunAsyncToolRequest, ToolProcessLlmRequest } from './base_tool.js';
|
|
8
|
+
/**
|
|
9
|
+
* Returns a part that the model can read for the given artifact.
|
|
10
|
+
*
|
|
11
|
+
* Parts without inline data, and inline data that Gemini accepts (images,
|
|
12
|
+
* audio, video and PDF), are returned as they are. Other inline data becomes a
|
|
13
|
+
* text part: the decoded content for text-like types, and a placeholder for
|
|
14
|
+
* binary or missing data.
|
|
15
|
+
*
|
|
16
|
+
* @param artifact The artifact to convert.
|
|
17
|
+
* @param artifactName The artifact name used in the placeholder text.
|
|
18
|
+
* @param options Optional settings controlling how inline media and file
|
|
19
|
+
* references are formatted.
|
|
20
|
+
* @return The artifact itself, or a text part that replaces it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function asSafePartForLlm(artifact: Part, artifactName: string, options?: {
|
|
23
|
+
inlineMediaAsPlaceholder?: boolean;
|
|
24
|
+
}): Part;
|
|
8
25
|
/**
|
|
9
26
|
* A tool that loads the artifacts and adds them to the session.
|
|
10
27
|
*/
|
|
@@ -4,16 +4,44 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
+
import type { MemoryEntry } from '../memory/memory_entry.js';
|
|
7
8
|
import { BaseTool, RunAsyncToolRequest, ToolProcessLlmRequest } from './base_tool.js';
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Configuration options for {@link LoadMemoryTool}.
|
|
11
|
+
*/
|
|
12
|
+
export interface LoadMemoryToolOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Whether to flatten memory content into space-separated text strings.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated Set `textOnlyContent: true` only to retain legacy string content. The default is `false`, returning complete {@link MemoryEntry} objects. This option will be removed in a future release.
|
|
17
|
+
*/
|
|
18
|
+
readonly textOnlyContent?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Response returned by {@link LoadMemoryTool}.
|
|
22
|
+
*
|
|
23
|
+
* By default, `memories` contains complete {@link MemoryEntry} objects.
|
|
24
|
+
* When {@link LoadMemoryToolOptions.textOnlyContent} is `true`, each entry
|
|
25
|
+
* contains a flattened `string` in `content` alongside `author` and
|
|
26
|
+
* `timestamp`.
|
|
27
|
+
*/
|
|
28
|
+
export interface LoadMemoryResponse<T = MemoryEntry> {
|
|
29
|
+
memories: T[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A tool that loads memory entries for the current user.
|
|
10
33
|
*
|
|
11
|
-
*
|
|
34
|
+
* By default, returns complete {@link MemoryEntry} objects.
|
|
12
35
|
*/
|
|
13
36
|
export declare class LoadMemoryTool extends BaseTool {
|
|
14
|
-
|
|
37
|
+
private readonly textOnlyContent;
|
|
38
|
+
constructor(options?: LoadMemoryToolOptions);
|
|
15
39
|
_getDeclaration(): FunctionDeclaration | undefined;
|
|
16
|
-
runAsync({ args, toolContext
|
|
40
|
+
runAsync({ args, toolContext }: RunAsyncToolRequest): Promise<LoadMemoryResponse<MemoryEntry | {
|
|
41
|
+
content: string;
|
|
42
|
+
author?: string;
|
|
43
|
+
timestamp?: string;
|
|
44
|
+
}>>;
|
|
17
45
|
processLlmRequest(request: ToolProcessLlmRequest): Promise<void>;
|
|
18
46
|
}
|
|
19
47
|
/**
|
|
@@ -7,6 +7,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
|
7
7
|
import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
8
8
|
import type { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
9
9
|
import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
10
|
+
import type { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
10
11
|
/**
|
|
11
12
|
* Defines the parameters for establishing a connection to an MCP server using
|
|
12
13
|
* standard input/output (stdio). This is typically used for running MCP servers
|
|
@@ -15,6 +16,10 @@ import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol
|
|
|
15
16
|
export interface StdioConnectionParams {
|
|
16
17
|
type: 'StdioConnectionParams';
|
|
17
18
|
serverParams: StdioServerParameters;
|
|
19
|
+
/**
|
|
20
|
+
* Request timeout in seconds for stdio MCP operations. When unset, the MCP
|
|
21
|
+
* SDK applies its own default request timeout.
|
|
22
|
+
*/
|
|
18
23
|
timeout?: number;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
@@ -94,6 +99,17 @@ export declare class MCPSessionManager {
|
|
|
94
99
|
private readonly connectionParams;
|
|
95
100
|
private readonly activeSessions;
|
|
96
101
|
constructor(connectionParams: MCPConnectionParams);
|
|
102
|
+
/**
|
|
103
|
+
* Builds per-request options for MCP client operations.
|
|
104
|
+
*
|
|
105
|
+
* For a stdio connection with a configured `timeout`, the timeout is
|
|
106
|
+
* converted from seconds to milliseconds. Otherwise the MCP SDK applies its
|
|
107
|
+
* own default request timeout.
|
|
108
|
+
*
|
|
109
|
+
* @param signal Optional abort signal to attach to the request.
|
|
110
|
+
* @return The request options for the MCP SDK client.
|
|
111
|
+
*/
|
|
112
|
+
getRequestOptions(signal?: AbortSignal): RequestOptions;
|
|
97
113
|
createSession(): Promise<Client>;
|
|
98
114
|
closeSession(client: Client): Promise<void>;
|
|
99
115
|
getActiveSessions(): Client[];
|
|
@@ -86,7 +86,7 @@ export declare function tokenToSchemeCredential(tokenType: 'apikey' | 'oauth2Tok
|
|
|
86
86
|
* @param scopes The scopes to request.
|
|
87
87
|
* @returns A `[scheme, credential]` pair.
|
|
88
88
|
*/
|
|
89
|
-
export declare function
|
|
89
|
+
export declare function serviceAccountRecordToSchemeCredential(config: Record<string, unknown>, scopes: string[]): [AuthScheme, AuthCredential];
|
|
90
90
|
/**
|
|
91
91
|
* Creates a bearer scheme and a service-account credential from an already
|
|
92
92
|
* built `ServiceAccount`.
|
|
@@ -99,16 +99,16 @@ export declare function serviceAccountSchemeCredential(config: ServiceAccount):
|
|
|
99
99
|
* Builds an OpenID Connect scheme and credential from a configuration object
|
|
100
100
|
* and a client-secret object.
|
|
101
101
|
*
|
|
102
|
-
* @param
|
|
102
|
+
* @param configRecord An OpenID Connect configuration. Snake_case keys, as a
|
|
103
103
|
* discovery document delivers them, are accepted and normalized.
|
|
104
104
|
* @param scopes The scopes to request.
|
|
105
|
-
* @param
|
|
105
|
+
* @param credentialRecord The Google OAuth client secret. Its keys stay
|
|
106
106
|
* snake_case, because it is an on-disk wire format. A `{web: {…}}` or
|
|
107
107
|
* `{installed: {…}}` wrapper is unwrapped.
|
|
108
108
|
* @returns A `[scheme, credential]` pair.
|
|
109
109
|
* @throws Error When the configuration or the client secret is incomplete.
|
|
110
110
|
*/
|
|
111
|
-
export declare function
|
|
111
|
+
export declare function openidRecordToSchemeCredential(configRecord: Record<string, unknown>, scopes: string[], credentialRecord: Record<string, unknown>): [OpenIdConnectWithConfig, AuthCredential];
|
|
112
112
|
/**
|
|
113
113
|
* Fetches an OpenID Connect discovery document and pairs it with a client
|
|
114
114
|
* secret.
|
|
@@ -118,12 +118,12 @@ export declare function openidDictToSchemeCredential(configDict: Record<string,
|
|
|
118
118
|
*
|
|
119
119
|
* @param openidUrl The OpenID Connect discovery URL.
|
|
120
120
|
* @param scopes The scopes to request.
|
|
121
|
-
* @param
|
|
121
|
+
* @param credentialRecord The Google OAuth client secret, keyed snake_case.
|
|
122
122
|
* @returns A `[scheme, credential]` pair.
|
|
123
123
|
* @throws Error When the request fails, the body is not a JSON object, or the
|
|
124
124
|
* configuration is incomplete.
|
|
125
125
|
*/
|
|
126
|
-
export declare function openidUrlToSchemeCredential(openidUrl: string, scopes: string[],
|
|
126
|
+
export declare function openidUrlToSchemeCredential(openidUrl: string, scopes: string[], credentialRecord: Record<string, unknown>): Promise<[OpenIdConnectWithConfig, AuthCredential]>;
|
|
127
127
|
/**
|
|
128
128
|
* Converts a scheme and credential into the tool parameter that carries the
|
|
129
129
|
* credential, plus the value to send for it.
|
|
@@ -144,7 +144,7 @@ export declare function credentialToParam(authScheme: AuthScheme, authCredential
|
|
|
144
144
|
* `AuthScheme`.
|
|
145
145
|
*
|
|
146
146
|
* @example
|
|
147
|
-
* const scheme =
|
|
147
|
+
* const scheme = recordToAuthScheme({
|
|
148
148
|
* type: 'apiKey',
|
|
149
149
|
* in: 'header',
|
|
150
150
|
* name: 'X-API-Key',
|
|
@@ -155,4 +155,4 @@ export declare function credentialToParam(authScheme: AuthScheme, authCredential
|
|
|
155
155
|
* @throws Error When `type` is missing or unrecognised, or the rest of the
|
|
156
156
|
* object does not match the shape that type requires.
|
|
157
157
|
*/
|
|
158
|
-
export declare function
|
|
158
|
+
export declare function recordToAuthScheme(data: Record<string, unknown>): AuthScheme;
|
|
@@ -28,8 +28,20 @@ export interface ParsedOperation {
|
|
|
28
28
|
}
|
|
29
29
|
export declare class OpenApiSpecParser {
|
|
30
30
|
private preservePropertyNames;
|
|
31
|
+
private unconstrainedObjectBodyAsParameter;
|
|
32
|
+
/**
|
|
33
|
+
* @param options.preservePropertyNames Keeps the original parameter and
|
|
34
|
+
* function names instead of converting them to snake_case.
|
|
35
|
+
* @param options.unconstrainedObjectBodyAsParameter Emits a whole-body
|
|
36
|
+
* parameter named `body` when an object request body schema has no
|
|
37
|
+
* properties. Defaults to `false`.
|
|
38
|
+
* @deprecated Retained for backwards compatibility; empty object schemas
|
|
39
|
+
* produce no parameters by default. This option will be removed in a
|
|
40
|
+
* future release.
|
|
41
|
+
*/
|
|
31
42
|
constructor(options?: {
|
|
32
43
|
preservePropertyNames?: boolean;
|
|
44
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
33
45
|
});
|
|
34
46
|
/**
|
|
35
47
|
* Parses an OpenAPI specification document and extracts a list of operations.
|
|
@@ -22,6 +22,7 @@ export declare class OperationParser {
|
|
|
22
22
|
private params;
|
|
23
23
|
private returnValue?;
|
|
24
24
|
private preservePropertyNames;
|
|
25
|
+
private unconstrainedObjectBodyAsParameter;
|
|
25
26
|
private readonly operation;
|
|
26
27
|
/**
|
|
27
28
|
* @param operation The operation to parse. A string is parsed as JSON, and a
|
|
@@ -30,10 +31,17 @@ export declare class OperationParser {
|
|
|
30
31
|
* function names instead of converting them to snake_case.
|
|
31
32
|
* @param options.shouldParse Whether to parse the operation during
|
|
32
33
|
* construction. Defaults to `true`.
|
|
34
|
+
* @param options.unconstrainedObjectBodyAsParameter Emits a whole-body
|
|
35
|
+
* parameter named `body` when an object request body schema has no
|
|
36
|
+
* properties. Defaults to `false`.
|
|
37
|
+
* @deprecated Retained for backwards compatibility; empty object schemas
|
|
38
|
+
* produce no parameters by default. This option will be removed in a
|
|
39
|
+
* future release.
|
|
33
40
|
*/
|
|
34
41
|
constructor(operation: OpenAPIV3.OperationObject | Record<string, unknown> | string, options?: {
|
|
35
42
|
preservePropertyNames?: boolean;
|
|
36
43
|
shouldParse?: boolean;
|
|
44
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
37
45
|
});
|
|
38
46
|
/**
|
|
39
47
|
* Builds a parser from parameters that were already parsed, without walking
|
|
@@ -96,6 +104,9 @@ export declare class OperationParser {
|
|
|
96
104
|
/**
|
|
97
105
|
* Gets the Python-style type hint of the return value.
|
|
98
106
|
*
|
|
107
|
+
* @deprecated Legacy Python type-hint helper retained for compatibility. In
|
|
108
|
+
* `adk-js`, tool declarations pass the JSON schema from
|
|
109
|
+
* {@link OperationParser.getJsonSchema} directly to the model.
|
|
99
110
|
* @returns A type name such as `str`, or `Any` when the operation declares
|
|
100
111
|
* no typed 2xx response.
|
|
101
112
|
*/
|
|
@@ -104,9 +115,10 @@ export declare class OperationParser {
|
|
|
104
115
|
* Generates a Python-style docstring describing the operation, every
|
|
105
116
|
* parameter and the return value.
|
|
106
117
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
118
|
+
* @deprecated Legacy Python docstring helper retained for compatibility. In
|
|
119
|
+
* `adk-js`, tool declarations use {@link OperationParser.getDescription}
|
|
120
|
+
* and {@link OperationParser.getJsonSchema} rather than sending a Python
|
|
121
|
+
* docstring to the model.
|
|
110
122
|
* @returns The generated docstring.
|
|
111
123
|
*/
|
|
112
124
|
getPydocString(): string;
|
|
@@ -22,6 +22,11 @@ export declare class OpenAPIToolset extends BaseToolset {
|
|
|
22
22
|
authCredential?: AuthCredential;
|
|
23
23
|
credentialKey?: string;
|
|
24
24
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Emits a whole-body parameter for unconstrained object schemas.
|
|
27
|
+
* Will be removed in a future release.
|
|
28
|
+
*/
|
|
29
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
25
30
|
});
|
|
26
31
|
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
27
32
|
/**
|
|
@@ -41,6 +41,11 @@ export declare class RestApiTool extends BaseTool {
|
|
|
41
41
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
42
42
|
credentialKey?: string;
|
|
43
43
|
operationParser?: OperationParser;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Emits a whole-body parameter for unconstrained object schemas.
|
|
46
|
+
* Will be removed in a future release.
|
|
47
|
+
*/
|
|
48
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
44
49
|
});
|
|
45
50
|
configureAuthScheme(authScheme: OpenAPIV3.SecuritySchemeObject): void;
|
|
46
51
|
configureAuthCredential(authCredential: AuthCredential): void;
|
|
@@ -69,6 +74,11 @@ export declare function createRestApiTool(parsed: ParsedOperationInput, options?
|
|
|
69
74
|
preservePropertyNames?: boolean;
|
|
70
75
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
71
76
|
credentialKey?: string;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated Emits a whole-body parameter for unconstrained object schemas.
|
|
79
|
+
* Will be removed in a future release.
|
|
80
|
+
*/
|
|
81
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
72
82
|
}): RestApiTool;
|
|
73
83
|
/**
|
|
74
84
|
* Builds a `RestApiTool` from the JSON string form of a parsed operation.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ReadonlyContext } from '../agents/readonly_context.js';
|
|
7
|
+
import { BaseTool } from './base_tool.js';
|
|
8
|
+
import { BaseToolset, ToolPredicate } from './base_toolset.js';
|
|
9
|
+
import { ToolInputParameters } from './function_tool.js';
|
|
10
|
+
/**
|
|
11
|
+
* Structural interface for a tool loaded from a Toolbox client.
|
|
12
|
+
*/
|
|
13
|
+
export interface ToolboxToolLike {
|
|
14
|
+
/**
|
|
15
|
+
* The name of the tool.
|
|
16
|
+
*/
|
|
17
|
+
name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The description of the tool.
|
|
20
|
+
*/
|
|
21
|
+
description?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional parameter schema for the tool.
|
|
24
|
+
*/
|
|
25
|
+
parameters?: ToolInputParameters;
|
|
26
|
+
/**
|
|
27
|
+
* Executes the tool with the given arguments.
|
|
28
|
+
*/
|
|
29
|
+
execute?(...args: never[]): unknown | Promise<unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options forwarded to a Toolbox client when loading a tool or toolset.
|
|
33
|
+
*/
|
|
34
|
+
export interface ToolboxLoadOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Mapping of authentication service names to functions that return the
|
|
37
|
+
* corresponding authentication token.
|
|
38
|
+
*/
|
|
39
|
+
authTokenGetters?: Record<string, () => string | Promise<string>>;
|
|
40
|
+
/**
|
|
41
|
+
* Mapping of parameter names to bind to fixed values or functions that
|
|
42
|
+
* produce values as needed.
|
|
43
|
+
*/
|
|
44
|
+
boundParams?: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Structural interface for an asynchronous or synchronous Toolbox client
|
|
48
|
+
* instance used by {@link ToolboxToolset}.
|
|
49
|
+
*/
|
|
50
|
+
export interface ToolboxToolsetClientLike {
|
|
51
|
+
/**
|
|
52
|
+
* Loads a single tool by name.
|
|
53
|
+
*/
|
|
54
|
+
loadTool?: (toolName: string, authTokenGetters?: Record<string, () => string | Promise<string>>, boundParams?: Record<string, unknown>) => BaseTool | ToolboxToolLike | ((...args: never[]) => unknown) | Promise<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>;
|
|
55
|
+
/**
|
|
56
|
+
* Loads a toolset by name.
|
|
57
|
+
*/
|
|
58
|
+
loadToolset?: (toolsetName: string, authTokenGetters?: Record<string, () => string | Promise<string>>, boundParams?: Record<string, unknown>) => Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)> | Promise<Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>>;
|
|
59
|
+
/**
|
|
60
|
+
* Closes the underlying client resources.
|
|
61
|
+
*/
|
|
62
|
+
close?: () => void | Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Configuration options for {@link ToolboxToolset}.
|
|
66
|
+
*/
|
|
67
|
+
export interface ToolboxToolsetOptions {
|
|
68
|
+
/**
|
|
69
|
+
* The URL of the Toolbox server. Required when `client` is not provided.
|
|
70
|
+
*/
|
|
71
|
+
serverUrl?: string;
|
|
72
|
+
/**
|
|
73
|
+
* The name of the Toolbox toolset to load.
|
|
74
|
+
*/
|
|
75
|
+
toolsetName?: string;
|
|
76
|
+
/**
|
|
77
|
+
* The names of the individual tools to load.
|
|
78
|
+
*/
|
|
79
|
+
toolNames?: readonly string[];
|
|
80
|
+
/**
|
|
81
|
+
* Mapping of authentication service names to functions that return the
|
|
82
|
+
* corresponding authentication token.
|
|
83
|
+
*/
|
|
84
|
+
authTokenGetters?: Record<string, () => string | Promise<string>>;
|
|
85
|
+
/**
|
|
86
|
+
* Mapping of parameter names to bind to fixed values or functions that
|
|
87
|
+
* produce values as needed.
|
|
88
|
+
*/
|
|
89
|
+
boundParams?: Record<string, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* Optional pre-configured Toolbox client instance.
|
|
92
|
+
*/
|
|
93
|
+
client?: ToolboxToolsetClientLike;
|
|
94
|
+
/**
|
|
95
|
+
* Optional filter to select which tools are exposed to the LLM.
|
|
96
|
+
*/
|
|
97
|
+
toolFilter?: ToolPredicate | string[];
|
|
98
|
+
/**
|
|
99
|
+
* Optional prefix prepended (`${prefix}_`) to loaded tool names.
|
|
100
|
+
*/
|
|
101
|
+
prefix?: string;
|
|
102
|
+
}
|
|
103
|
+
declare const TOOLBOX_TOOLSET_SIGNATURE_SYMBOL: unique symbol;
|
|
104
|
+
/**
|
|
105
|
+
* Type guard to check if an object is an instance of {@link ToolboxToolset}.
|
|
106
|
+
*/
|
|
107
|
+
export declare function isToolboxToolset(obj: unknown): obj is ToolboxToolset;
|
|
108
|
+
/**
|
|
109
|
+
* Provides asynchronous access to Toolbox tools and toolsets as a
|
|
110
|
+
* {@link BaseToolset}.
|
|
111
|
+
*/
|
|
112
|
+
export declare class ToolboxToolset extends BaseToolset {
|
|
113
|
+
/** A unique symbol to identify ADK ToolboxToolset class. */
|
|
114
|
+
readonly [TOOLBOX_TOOLSET_SIGNATURE_SYMBOL] = true;
|
|
115
|
+
/**
|
|
116
|
+
* The URL of the Toolbox server, if configured.
|
|
117
|
+
*/
|
|
118
|
+
readonly serverUrl?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The name of the Toolbox toolset to load, if configured.
|
|
121
|
+
*/
|
|
122
|
+
readonly toolsetName?: string;
|
|
123
|
+
/**
|
|
124
|
+
* The names of the individual tools to load, if configured.
|
|
125
|
+
*/
|
|
126
|
+
readonly toolNames?: readonly string[];
|
|
127
|
+
/**
|
|
128
|
+
* Mapping of authentication service names to token getters.
|
|
129
|
+
*/
|
|
130
|
+
readonly authTokenGetters: Record<string, () => string | Promise<string>>;
|
|
131
|
+
/**
|
|
132
|
+
* Mapping of parameter names to bound values or value getters.
|
|
133
|
+
*/
|
|
134
|
+
readonly boundParams: Record<string, unknown>;
|
|
135
|
+
/**
|
|
136
|
+
* The underlying Toolbox client instance.
|
|
137
|
+
*/
|
|
138
|
+
readonly toolboxClient: ToolboxToolsetClientLike;
|
|
139
|
+
constructor(options: ToolboxToolsetOptions);
|
|
140
|
+
/**
|
|
141
|
+
* @deprecated Use `new ToolboxToolset({serverUrl, ...options})` instead.
|
|
142
|
+
*/
|
|
143
|
+
constructor(serverUrl: string, options: Omit<ToolboxToolsetOptions, 'serverUrl'>);
|
|
144
|
+
/**
|
|
145
|
+
* Loads the configured toolset and/or individual tools from the Toolbox
|
|
146
|
+
* client and returns the selected {@link BaseTool} instances.
|
|
147
|
+
*/
|
|
148
|
+
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Closes the underlying Toolbox client.
|
|
151
|
+
*/
|
|
152
|
+
close(): Promise<void>;
|
|
153
|
+
}
|
|
154
|
+
export {};
|
|
@@ -18,12 +18,16 @@
|
|
|
18
18
|
* queue, so a later `close()` can't discard the error.
|
|
19
19
|
* - {@link push} after close/fail is ignored (the producer has already
|
|
20
20
|
* signalled completion).
|
|
21
|
+
* - {@link pushAndWait} resolves once the consumer has finished with the item:
|
|
22
|
+
* when it asks for the next one, or when the queue closes or fails.
|
|
21
23
|
*/
|
|
22
24
|
export declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
23
25
|
private queue;
|
|
24
26
|
private resolvers;
|
|
25
27
|
private closed;
|
|
26
28
|
private failure?;
|
|
29
|
+
/** Releases the producer of the item the consumer currently holds. */
|
|
30
|
+
private deliveredAck?;
|
|
27
31
|
/** Whether the queue has been closed or failed. */
|
|
28
32
|
get isClosed(): boolean;
|
|
29
33
|
/** Number of items buffered and not yet consumed. */
|
|
@@ -33,6 +37,16 @@ export declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
|
33
37
|
* immediately; otherwise the value is buffered. No-op once closed/failed.
|
|
34
38
|
*/
|
|
35
39
|
push(value: T): void;
|
|
40
|
+
/**
|
|
41
|
+
* Enqueues a value like {@link push}, and resolves once the consumer has
|
|
42
|
+
* finished with it: when it asks for the next item, or when the queue closes
|
|
43
|
+
* or fails. Resolves at once if the queue is already closed.
|
|
44
|
+
*/
|
|
45
|
+
pushAndWait(value: T): Promise<void>;
|
|
46
|
+
private enqueue;
|
|
47
|
+
/** Releases every producer still waiting in {@link pushAndWait}. */
|
|
48
|
+
private releaseAll;
|
|
49
|
+
private releaseDelivered;
|
|
36
50
|
/**
|
|
37
51
|
* Signals that production failed. Buffered items are still delivered first;
|
|
38
52
|
* once the buffer drains, the consumer's next `next()` rejects with `error`.
|
|
@@ -41,7 +41,8 @@ export declare function getTrackingHeaders(): Record<string, string>;
|
|
|
41
41
|
* single space, so the two differ only for values with repeated or non-space
|
|
42
42
|
* whitespace. Commas are not treated as separators, so a `Headers` object that
|
|
43
43
|
* joined two values of one header with `, ` keeps the comma on the first
|
|
44
|
-
* token.
|
|
44
|
+
* token. Other repeated header names use the platform `Headers` semantics;
|
|
45
|
+
* for example, repeated `Cookie` values are joined with `; `.
|
|
45
46
|
*
|
|
46
47
|
* The input is never mutated.
|
|
47
48
|
*
|