@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
|
@@ -65,6 +65,25 @@ function calculateRetainStartIndex(rawEvents, eventRetentionSize) {
|
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
const latestCalls = /* @__PURE__ */ new Map();
|
|
69
|
+
const callDependencies = rawEvents.map((event, index) => {
|
|
70
|
+
let earliestCall = index;
|
|
71
|
+
for (const response of (0, import_event.getFunctionResponses)(event)) {
|
|
72
|
+
if (response.id === void 0) continue;
|
|
73
|
+
const callIndex = latestCalls.get(response.id);
|
|
74
|
+
if (callIndex !== void 0) {
|
|
75
|
+
earliestCall = Math.min(earliestCall, callIndex);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (const call of (0, import_event.getFunctionCalls)(event)) {
|
|
79
|
+
if (call.id === void 0) continue;
|
|
80
|
+
latestCalls.set(call.id, index);
|
|
81
|
+
}
|
|
82
|
+
return earliestCall;
|
|
83
|
+
});
|
|
84
|
+
for (let index = rawEvents.length - 1; index >= retainStartIndex; index--) {
|
|
85
|
+
retainStartIndex = Math.min(retainStartIndex, callDependencies[index]);
|
|
86
|
+
}
|
|
68
87
|
return retainStartIndex;
|
|
69
88
|
}
|
|
70
89
|
__name(calculateRetainStartIndex, "calculateRetainStartIndex");
|
|
@@ -36,9 +36,10 @@ module.exports = __toCommonJS(input_validation_error_exports);
|
|
|
36
36
|
const _InputValidationError = class _InputValidationError extends Error {
|
|
37
37
|
/**
|
|
38
38
|
* @param message A message describing why the input is invalid.
|
|
39
|
+
* @param options Standard error options, e.g. `{cause}`.
|
|
39
40
|
*/
|
|
40
|
-
constructor(message = "Invalid input.") {
|
|
41
|
-
super(message);
|
|
41
|
+
constructor(message = "Invalid input.", options) {
|
|
42
|
+
super(message, options);
|
|
42
43
|
this.name = "InputValidationError";
|
|
43
44
|
}
|
|
44
45
|
};
|
package/dist/cjs/events/event.js
CHANGED
|
@@ -43,7 +43,7 @@ __export(event_exports, {
|
|
|
43
43
|
transformToSnakeCaseEvent: () => transformToSnakeCaseEvent
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(event_exports);
|
|
46
|
-
var
|
|
46
|
+
var import_id_provider = require("../utils/id_provider.js");
|
|
47
47
|
var import_object_notation_utils = require("../utils/object_notation_utils.js");
|
|
48
48
|
var import_event_actions = require("./event_actions.js");
|
|
49
49
|
/**
|
|
@@ -87,7 +87,7 @@ function getFunctionCalls(event) {
|
|
|
87
87
|
__name(getFunctionCalls, "getFunctionCalls");
|
|
88
88
|
const AF_FUNCTION_CALL_ID_PREFIX = "adk-";
|
|
89
89
|
function generateClientFunctionCallId() {
|
|
90
|
-
return `${AF_FUNCTION_CALL_ID_PREFIX}${(0,
|
|
90
|
+
return `${AF_FUNCTION_CALL_ID_PREFIX}${(0, import_id_provider.newId)()}`;
|
|
91
91
|
}
|
|
92
92
|
__name(generateClientFunctionCallId, "generateClientFunctionCallId");
|
|
93
93
|
function populateClientFunctionCallId(modelResponseEvent) {
|
|
@@ -169,13 +169,17 @@ function isEvent(obj) {
|
|
|
169
169
|
}
|
|
170
170
|
__name(isEvent, "isEvent");
|
|
171
171
|
function createNewEventId() {
|
|
172
|
+
return (0, import_id_provider.newIdOr)(createRandomEventId);
|
|
173
|
+
}
|
|
174
|
+
__name(createNewEventId, "createNewEventId");
|
|
175
|
+
function createRandomEventId() {
|
|
172
176
|
let id = "";
|
|
173
177
|
for (let i = 0; i < 8; i++) {
|
|
174
178
|
id += ASCII_LETTERS_AND_NUMBERS[Math.floor(Math.random() * ASCII_LETTERS_AND_NUMBERS.length)];
|
|
175
179
|
}
|
|
176
180
|
return id;
|
|
177
181
|
}
|
|
178
|
-
__name(
|
|
182
|
+
__name(createRandomEventId, "createRandomEventId");
|
|
179
183
|
const PRESERVE_KEYS_CAMEL_CASE = [
|
|
180
184
|
"actions.stateDelta",
|
|
181
185
|
"actions.artifactDelta",
|
|
@@ -42,6 +42,7 @@ var import_logger = require("../utils/logger.js");
|
|
|
42
42
|
* SPDX-License-Identifier: Apache-2.0
|
|
43
43
|
*/
|
|
44
44
|
var FeatureName = /* @__PURE__ */ ((FeatureName2) => {
|
|
45
|
+
FeatureName2["COMPUTER_USE"] = "COMPUTER_USE";
|
|
45
46
|
FeatureName2["PROGRESSIVE_SSE_STREAMING"] = "PROGRESSIVE_SSE_STREAMING";
|
|
46
47
|
return FeatureName2;
|
|
47
48
|
})(FeatureName || {});
|
|
@@ -52,6 +53,10 @@ var FeatureStage = /* @__PURE__ */ ((FeatureStage2) => {
|
|
|
52
53
|
return FeatureStage2;
|
|
53
54
|
})(FeatureStage || {});
|
|
54
55
|
const FEATURE_REGISTRY = {
|
|
56
|
+
["COMPUTER_USE" /* COMPUTER_USE */]: {
|
|
57
|
+
stage: "experimental" /* EXPERIMENTAL */,
|
|
58
|
+
defaultOn: true
|
|
59
|
+
},
|
|
55
60
|
["PROGRESSIVE_SSE_STREAMING" /* PROGRESSIVE_SSE_STREAMING */]: {
|
|
56
61
|
stage: "experimental" /* EXPERIMENTAL */,
|
|
57
62
|
defaultOn: false
|
package/dist/cjs/index.js
CHANGED
|
@@ -47,11 +47,14 @@ __export(index_exports, {
|
|
|
47
47
|
GcsArtifactService: () => import_gcs_artifact_service.GcsArtifactService,
|
|
48
48
|
INTERNAL_AUTH_PREFIX: () => import_auth_helpers.INTERNAL_AUTH_PREFIX,
|
|
49
49
|
IntegrationClient: () => import_integration_client.IntegrationClient,
|
|
50
|
+
IntegrationConnectorTool: () => import_integration_connector_tool.IntegrationConnectorTool,
|
|
50
51
|
InvocationContext: () => import_invocation_context.InvocationContext,
|
|
51
52
|
LOAD_WEB_PAGE: () => import_load_web_page.LOAD_WEB_PAGE,
|
|
52
53
|
LOGGING_FORMAT: () => import_logs.LOGGING_FORMAT,
|
|
53
54
|
LoadSkillResourceTool: () => import_load_skill_resource_tool.LoadSkillResourceTool,
|
|
54
55
|
LocalEnvironment: () => import_local_environment.LocalEnvironment,
|
|
56
|
+
LocalEvalSetResultsManager: () => import_cli_eval.LocalEvalSetResultsManager,
|
|
57
|
+
LocalEvalSetsManager: () => import_cli_eval.LocalEvalSetsManager,
|
|
55
58
|
MISSING_EVAL_DEPENDENCIES_MESSAGE: () => import_cli_eval.MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
56
59
|
OAuth2BearerExchanger: () => import_oauth2_exchanger.OAuth2BearerExchanger,
|
|
57
60
|
OpenAPIToolset: () => import_openapi_toolset.OpenAPIToolset,
|
|
@@ -75,7 +78,9 @@ __export(index_exports, {
|
|
|
75
78
|
VertexAiSessionService: () => import_vertex_ai_session_service.VertexAiSessionService,
|
|
76
79
|
actionRequest: () => import_connections_client.actionRequest,
|
|
77
80
|
actionResponse: () => import_connections_client.actionResponse,
|
|
81
|
+
agentRuntimeRequestHooks: () => import_agent_runtime.agentRuntimeRequestHooks,
|
|
78
82
|
connectorPayload: () => import_connections_client.connectorPayload,
|
|
83
|
+
convertEvalSetToSchema: () => import_cli_eval.convertEvalSetToSchema,
|
|
79
84
|
createApiParameter: () => import_common.createApiParameter,
|
|
80
85
|
createOperation: () => import_connections_client.createOperation,
|
|
81
86
|
createOperationRequest: () => import_connections_client.createOperationRequest,
|
|
@@ -84,7 +89,6 @@ __export(index_exports, {
|
|
|
84
89
|
credentialToParam: () => import_auth_helpers.credentialToParam,
|
|
85
90
|
deleteOperation: () => import_connections_client.deleteOperation,
|
|
86
91
|
deleteOperationRequest: () => import_connections_client.deleteOperationRequest,
|
|
87
|
-
dictToAuthScheme: () => import_auth_helpers.dictToAuthScheme,
|
|
88
92
|
exchangeCredential: () => import_oauth2_exchanger.exchangeCredential,
|
|
89
93
|
executeCustomQueryRequest: () => import_connections_client.executeCustomQueryRequest,
|
|
90
94
|
generateAuthToken: () => import_oauth2_exchanger.generateAuthToken,
|
|
@@ -103,21 +107,26 @@ __export(index_exports, {
|
|
|
103
107
|
listOperationRequest: () => import_connections_client.listOperationRequest,
|
|
104
108
|
loadAllSkillsInDir: () => import_loader.loadAllSkillsInDir,
|
|
105
109
|
loadDotenvForAgent: () => import_envs.loadDotenvForAgent,
|
|
110
|
+
loadEvalSetFromFile: () => import_cli_eval.loadEvalSetFromFile,
|
|
106
111
|
loadSkillFromDir: () => import_loader.loadSkillFromDir,
|
|
107
112
|
loadSkillFromZipBuffer: () => import_loader.loadSkillFromZipBuffer,
|
|
108
113
|
loadWebPage: () => import_load_web_page.loadWebPage,
|
|
109
|
-
logToStderr: () => import_logs.logToStderr,
|
|
110
114
|
logToTmpFolder: () => import_logs.logToTmpFolder,
|
|
111
|
-
|
|
115
|
+
normalizeEvalCase: () => import_cli_eval.normalizeEvalCase,
|
|
116
|
+
openidRecordToSchemeCredential: () => import_auth_helpers.openidRecordToSchemeCredential,
|
|
112
117
|
openidUrlToSchemeCredential: () => import_auth_helpers.openidUrlToSchemeCredential,
|
|
113
118
|
parseAndGetEvalsToRun: () => import_cli_eval.parseAndGetEvalsToRun,
|
|
119
|
+
recordToAuthScheme: () => import_auth_helpers.recordToAuthScheme,
|
|
114
120
|
runEvals: () => import_cli_eval.runEvals,
|
|
115
|
-
|
|
121
|
+
runWithAgentEngineContext: () => import_agent_engine.runWithAgentEngineContext,
|
|
122
|
+
serviceAccountRecordToSchemeCredential: () => import_auth_helpers.serviceAccountRecordToSchemeCredential,
|
|
116
123
|
serviceAccountSchemeCredential: () => import_auth_helpers.serviceAccountSchemeCredential,
|
|
124
|
+
setupAdkLogger: () => import_logs.setupAdkLogger,
|
|
117
125
|
tokenToSchemeCredential: () => import_auth_helpers.tokenToSchemeCredential,
|
|
118
126
|
tryGetResetFunc: () => import_cli_eval.tryGetResetFunc,
|
|
119
127
|
updateOperation: () => import_connections_client.updateOperation,
|
|
120
128
|
updateOperationRequest: () => import_connections_client.updateOperationRequest,
|
|
129
|
+
validatePathSegment: () => import_path_validation.validatePathSegment,
|
|
121
130
|
validateSkillDir: () => import_loader.validateSkillDir,
|
|
122
131
|
walkToRootUntilFound: () => import_envs.walkToRootUntilFound
|
|
123
132
|
});
|
|
@@ -148,6 +157,7 @@ var import_secret_client = require("./tools/apihub_tool/clients/secret_client.js
|
|
|
148
157
|
var import_application_integration_toolset = require("./tools/application_integration_tool/application_integration_toolset.js");
|
|
149
158
|
var import_connections_client = require("./tools/application_integration_tool/clients/connections_client.js");
|
|
150
159
|
var import_integration_client = require("./tools/application_integration_tool/clients/integration_client.js");
|
|
160
|
+
var import_integration_connector_tool = require("./tools/application_integration_tool/integration_connector_tool.js");
|
|
151
161
|
var import_load_web_page = require("./tools/load_web_page.js");
|
|
152
162
|
var import_auth_helpers = require("./tools/openapi_tool/auth/auth_helpers.js");
|
|
153
163
|
var import_auto_auth_credential_exchanger = require("./tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js");
|
|
@@ -166,12 +176,15 @@ var import_run_skill_inline_script_tool = require("./tools/skill/run_skill_inlin
|
|
|
166
176
|
var import_run_skill_script_tool = require("./tools/skill/run_skill_script_tool.js");
|
|
167
177
|
var import_skill_toolset = require("./tools/skill/skill_toolset.js");
|
|
168
178
|
__reExport(index_exports, require("./integrations/agent_registry/agent_registry.js"), module.exports);
|
|
169
|
-
|
|
170
|
-
|
|
179
|
+
var import_agent_engine = require("./telemetry/export/agent_engine.js");
|
|
180
|
+
var import_agent_runtime = require("./telemetry/export/agent_runtime.js");
|
|
181
|
+
__reExport(index_exports, require("./telemetry/export/google_cloud.js"), module.exports);
|
|
182
|
+
__reExport(index_exports, require("./telemetry/export/setup.js"), module.exports);
|
|
171
183
|
__reExport(index_exports, require("./tools/google_api_tool/index.js"), module.exports);
|
|
172
184
|
var import_cli_eval = require("./cli/cli_eval.js");
|
|
173
185
|
var import_envs = require("./cli/utils/envs.js");
|
|
174
186
|
var import_logs = require("./cli/utils/logs.js");
|
|
187
|
+
var import_path_validation = require("./cli/utils/path_validation.js");
|
|
175
188
|
__reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
176
189
|
/**
|
|
177
190
|
* @license
|
|
@@ -203,11 +216,14 @@ __reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
|
203
216
|
GcsArtifactService,
|
|
204
217
|
INTERNAL_AUTH_PREFIX,
|
|
205
218
|
IntegrationClient,
|
|
219
|
+
IntegrationConnectorTool,
|
|
206
220
|
InvocationContext,
|
|
207
221
|
LOAD_WEB_PAGE,
|
|
208
222
|
LOGGING_FORMAT,
|
|
209
223
|
LoadSkillResourceTool,
|
|
210
224
|
LocalEnvironment,
|
|
225
|
+
LocalEvalSetResultsManager,
|
|
226
|
+
LocalEvalSetsManager,
|
|
211
227
|
MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
212
228
|
OAuth2BearerExchanger,
|
|
213
229
|
OpenAPIToolset,
|
|
@@ -231,7 +247,9 @@ __reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
|
231
247
|
VertexAiSessionService,
|
|
232
248
|
actionRequest,
|
|
233
249
|
actionResponse,
|
|
250
|
+
agentRuntimeRequestHooks,
|
|
234
251
|
connectorPayload,
|
|
252
|
+
convertEvalSetToSchema,
|
|
235
253
|
createApiParameter,
|
|
236
254
|
createOperation,
|
|
237
255
|
createOperationRequest,
|
|
@@ -240,7 +258,6 @@ __reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
|
240
258
|
credentialToParam,
|
|
241
259
|
deleteOperation,
|
|
242
260
|
deleteOperationRequest,
|
|
243
|
-
dictToAuthScheme,
|
|
244
261
|
exchangeCredential,
|
|
245
262
|
executeCustomQueryRequest,
|
|
246
263
|
generateAuthToken,
|
|
@@ -259,28 +276,33 @@ __reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
|
259
276
|
listOperationRequest,
|
|
260
277
|
loadAllSkillsInDir,
|
|
261
278
|
loadDotenvForAgent,
|
|
279
|
+
loadEvalSetFromFile,
|
|
262
280
|
loadSkillFromDir,
|
|
263
281
|
loadSkillFromZipBuffer,
|
|
264
282
|
loadWebPage,
|
|
265
|
-
logToStderr,
|
|
266
283
|
logToTmpFolder,
|
|
267
|
-
|
|
284
|
+
normalizeEvalCase,
|
|
285
|
+
openidRecordToSchemeCredential,
|
|
268
286
|
openidUrlToSchemeCredential,
|
|
269
287
|
parseAndGetEvalsToRun,
|
|
288
|
+
recordToAuthScheme,
|
|
270
289
|
runEvals,
|
|
271
|
-
|
|
290
|
+
runWithAgentEngineContext,
|
|
291
|
+
serviceAccountRecordToSchemeCredential,
|
|
272
292
|
serviceAccountSchemeCredential,
|
|
293
|
+
setupAdkLogger,
|
|
273
294
|
tokenToSchemeCredential,
|
|
274
295
|
tryGetResetFunc,
|
|
275
296
|
updateOperation,
|
|
276
297
|
updateOperationRequest,
|
|
298
|
+
validatePathSegment,
|
|
277
299
|
validateSkillDir,
|
|
278
300
|
walkToRootUntilFound,
|
|
279
301
|
...require("./a2a/index.js"),
|
|
280
302
|
...require("./common.js"),
|
|
281
303
|
...require("./integrations/agent_registry/agent_registry.js"),
|
|
282
|
-
...require("./telemetry/google_cloud.js"),
|
|
283
|
-
...require("./telemetry/setup.js"),
|
|
304
|
+
...require("./telemetry/export/google_cloud.js"),
|
|
305
|
+
...require("./telemetry/export/setup.js"),
|
|
284
306
|
...require("./tools/google_api_tool/index.js"),
|
|
285
307
|
...require("./tools/mcp/index.js")
|
|
286
308
|
});
|
|
@@ -31,6 +31,7 @@ __export(google_llm_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(google_llm_exports);
|
|
33
33
|
var import_genai = require("@google/genai");
|
|
34
|
+
var import_computer_use_toolset = require("../tools/computer_use/computer_use_toolset.js");
|
|
34
35
|
var import_env_aware_utils = require("../utils/env_aware_utils.js");
|
|
35
36
|
var import_logger = require("../utils/logger.js");
|
|
36
37
|
var import_variant_utils = require("../utils/variant_utils.js");
|
|
@@ -102,6 +103,7 @@ const _Gemini = class _Gemini extends (_b = import_base_llm.BaseLlm, _a = GEMINI
|
|
|
102
103
|
*/
|
|
103
104
|
async *generateContentAsync(llmRequest, stream = false, abortSignal) {
|
|
104
105
|
var _a2, _b2;
|
|
106
|
+
await adaptComputerUseRequest(llmRequest);
|
|
105
107
|
if (this.useInteractionsApi) {
|
|
106
108
|
yield* (0, import_interactions_utils.generateContentViaInteractions)(this.apiClient, llmRequest, stream);
|
|
107
109
|
return;
|
|
@@ -265,8 +267,14 @@ const _Gemini = class _Gemini extends (_b = import_base_llm.BaseLlm, _a = GEMINI
|
|
|
265
267
|
for (const content of llmRequest.contents) {
|
|
266
268
|
if (!content.parts) continue;
|
|
267
269
|
for (const part of content.parts) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
+
if (part.inlineData) {
|
|
271
|
+
part.inlineData = { ...part.inlineData };
|
|
272
|
+
removeDisplayNameIfPresent(part.inlineData);
|
|
273
|
+
}
|
|
274
|
+
if (part.fileData) {
|
|
275
|
+
part.fileData = { ...part.fileData };
|
|
276
|
+
removeDisplayNameIfPresent(part.fileData);
|
|
277
|
+
}
|
|
270
278
|
}
|
|
271
279
|
}
|
|
272
280
|
}
|
|
@@ -287,6 +295,29 @@ _Gemini.supportedModels = [
|
|
|
287
295
|
/projects\/.+\/locations\/.+\/publishers\/google\/models\/gemini.+/
|
|
288
296
|
];
|
|
289
297
|
let Gemini = _Gemini;
|
|
298
|
+
async function adaptComputerUseRequest(llmRequest) {
|
|
299
|
+
var _a2, _b2;
|
|
300
|
+
if (!((_b2 = (_a2 = llmRequest.config) == null ? void 0 : _a2.tools) == null ? void 0 : _b2.some(
|
|
301
|
+
(tool) => "computerUse" in tool && tool.computerUse
|
|
302
|
+
))) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
llmRequest.config.systemInstruction = void 0;
|
|
306
|
+
const waitTool = Object.hasOwn(llmRequest.toolsDict, "wait") ? llmRequest.toolsDict["wait"] : void 0;
|
|
307
|
+
await (0, import_computer_use_toolset.adaptComputerUseTool)({
|
|
308
|
+
methodName: "wait",
|
|
309
|
+
adapter: /* @__PURE__ */ __name((waitFunc) => ({
|
|
310
|
+
name: "wait_5_seconds",
|
|
311
|
+
description: "Waits for 5 seconds.",
|
|
312
|
+
execute: /* @__PURE__ */ __name((_args, toolContext) => waitFunc({ seconds: 5 }, toolContext), "execute")
|
|
313
|
+
}), "adapter"),
|
|
314
|
+
llmRequest
|
|
315
|
+
});
|
|
316
|
+
if (waitTool && Object.hasOwn(llmRequest.toolsDict, "wait_5_seconds")) {
|
|
317
|
+
llmRequest.toolsDict["wait"] = waitTool;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
__name(adaptComputerUseRequest, "adaptComputerUseRequest");
|
|
290
321
|
function removeDisplayNameIfPresent(dataObj) {
|
|
291
322
|
if (dataObj && dataObj.displayName) {
|
|
292
323
|
dataObj.displayName = void 0;
|
|
@@ -375,6 +375,9 @@ function convertToolsConfigToInteractionsFormat(config) {
|
|
|
375
375
|
if (t.urlContext) {
|
|
376
376
|
interactionTools.push({ type: "url_context" });
|
|
377
377
|
}
|
|
378
|
+
if (t.computerUse) {
|
|
379
|
+
interactionTools.push({ type: "computer_use" });
|
|
380
|
+
}
|
|
378
381
|
}
|
|
379
382
|
return interactionTools;
|
|
380
383
|
}
|
|
@@ -82,9 +82,9 @@ const _BasePlugin = class _BasePlugin {
|
|
|
82
82
|
*
|
|
83
83
|
* @param _params.invocationContext The context for the entire invocation, containing
|
|
84
84
|
* session information, the root agent, etc.
|
|
85
|
-
* @returns An optional `
|
|
86
|
-
*
|
|
87
|
-
* Return `undefined` to proceed normally.
|
|
85
|
+
* @returns An optional `Content` to be returned to the ADK. Returning a value
|
|
86
|
+
* halts execution of the runner and ends the run with an event containing
|
|
87
|
+
* that content. Return `undefined` to proceed normally.
|
|
88
88
|
*/
|
|
89
89
|
async beforeRunCallback(_params) {
|
|
90
90
|
return;
|
|
@@ -107,10 +107,12 @@ const _BasePlugin = class _BasePlugin {
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
* Callback executed after
|
|
110
|
+
* Callback executed after successful completion, abort, or early iterator close.
|
|
111
111
|
*
|
|
112
112
|
* This is the final callback in the ADK lifecycle, suitable for cleanup,
|
|
113
|
-
* final logging, or reporting tasks.
|
|
113
|
+
* final logging, or reporting tasks. It is skipped when execution fails;
|
|
114
|
+
* {@link onRunErrorCallback} is called instead. Receiving this callback does
|
|
115
|
+
* not imply success: recognized cancellation still propagates to the caller.
|
|
114
116
|
*
|
|
115
117
|
* @param _params.invocationContext The context for the entire invocation.
|
|
116
118
|
* @returns undefined
|
|
@@ -118,6 +120,23 @@ const _BasePlugin = class _BasePlugin {
|
|
|
118
120
|
async afterRunCallback(_params) {
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Observes an error escaping an agent's execution or lifecycle callbacks.
|
|
125
|
+
*
|
|
126
|
+
* Notification-only: return values are ignored and callback failures are
|
|
127
|
+
* logged. The original execution error always propagates.
|
|
128
|
+
*/
|
|
129
|
+
async onAgentErrorCallback(_params) {
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Observes an error in the run lifecycle, including before/after-run callbacks.
|
|
133
|
+
*
|
|
134
|
+
* Notification-only: return values are ignored and callback failures are
|
|
135
|
+
* logged. The original execution error always propagates. A completion-hook
|
|
136
|
+
* failure during early iterator close is reported but does not prevent closing.
|
|
137
|
+
*/
|
|
138
|
+
async onRunErrorCallback(_params) {
|
|
139
|
+
}
|
|
121
140
|
/**
|
|
122
141
|
* Callback executed before an agent's primary logic is invoked.
|
|
123
142
|
*
|
|
@@ -136,14 +155,14 @@ const _BasePlugin = class _BasePlugin {
|
|
|
136
155
|
/**
|
|
137
156
|
* Callback executed after an agent's primary logic has completed.
|
|
138
157
|
*
|
|
139
|
-
* This callback can be used to inspect, log, or
|
|
140
|
-
*
|
|
158
|
+
* This callback can be used to inspect, log, or append an additional event
|
|
159
|
+
* after the agent's execution completes.
|
|
141
160
|
*
|
|
142
161
|
* @param _params.agent The agent that has just run.
|
|
143
162
|
* @param _params.callbackContext The context for the agent invocation.
|
|
144
|
-
* @returns An optional `Content` object. If a value is returned, it will
|
|
145
|
-
*
|
|
146
|
-
*
|
|
163
|
+
* @returns An optional `Content` object. If a value is returned, it will be
|
|
164
|
+
* emitted as an additional event appended after the agent's execution.
|
|
165
|
+
* Returning `undefined` emits no additional content event.
|
|
147
166
|
*/
|
|
148
167
|
async afterAgentCallback(_params) {
|
|
149
168
|
return;
|
|
@@ -188,8 +207,8 @@ const _BasePlugin = class _BasePlugin {
|
|
|
188
207
|
*
|
|
189
208
|
* @param _params.callbackContext The context for the current agent call.
|
|
190
209
|
* @param _params.llmRequest The prepared request object to be sent to the model.
|
|
191
|
-
* @returns An optional
|
|
192
|
-
*
|
|
210
|
+
* @returns An optional `LlmResponse`. Returning a non-`undefined` value
|
|
211
|
+
* triggers an early exit and returns that response immediately. Returning
|
|
193
212
|
* `undefined` allows the LLM request to proceed normally.
|
|
194
213
|
*/
|
|
195
214
|
async beforeModelCallback(_params) {
|
|
@@ -211,7 +230,7 @@ const _BasePlugin = class _BasePlugin {
|
|
|
211
230
|
return;
|
|
212
231
|
}
|
|
213
232
|
/**
|
|
214
|
-
* Callback executed when a model call encounters an
|
|
233
|
+
* Callback executed when a model call encounters an `Error`.
|
|
215
234
|
*
|
|
216
235
|
* This callback provides an opportunity to handle model errors gracefully,
|
|
217
236
|
* potentially providing alternative responses or recovery mechanisms.
|
|
@@ -219,10 +238,11 @@ const _BasePlugin = class _BasePlugin {
|
|
|
219
238
|
* @param _params.callbackContext The context for the current agent call.
|
|
220
239
|
* @param _params.llmRequest The request that was sent to the model when the error
|
|
221
240
|
* occurred.
|
|
222
|
-
* @param _params.error The
|
|
223
|
-
* @returns An optional LlmResponse
|
|
224
|
-
* used instead of
|
|
225
|
-
*
|
|
241
|
+
* @param _params.error The `Error` instance thrown during model execution.
|
|
242
|
+
* @returns An optional `LlmResponse`. If an `LlmResponse` is returned, it
|
|
243
|
+
* will be used instead of the default error response. Returning
|
|
244
|
+
* `undefined` causes an error response/event with `errorCode` and
|
|
245
|
+
* `errorMessage` derived from `error` to be yielded.
|
|
226
246
|
*/
|
|
227
247
|
async onModelErrorCallback(_params) {
|
|
228
248
|
return;
|
|
@@ -272,29 +292,23 @@ const _BasePlugin = class _BasePlugin {
|
|
|
272
292
|
return;
|
|
273
293
|
}
|
|
274
294
|
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
* @param _params.toolContext The context specific to the tool execution.
|
|
293
|
-
* @param _params.error The exception that was raised during tool execution.
|
|
294
|
-
* @returns An optional dictionary. If a dictionary is returned, it will be
|
|
295
|
-
* used as the tool response instead of propagating the error. Returning
|
|
296
|
-
* `undefined` allows the original error to be raised.
|
|
297
|
-
*/
|
|
295
|
+
* Callback executed when a tool call encounters an `Error` or cannot be
|
|
296
|
+
* resolved.
|
|
297
|
+
*
|
|
298
|
+
* This callback provides an opportunity to handle tool errors gracefully,
|
|
299
|
+
* potentially providing alternative responses or recovery mechanisms.
|
|
300
|
+
*
|
|
301
|
+
* @param _params.tool The tool instance that encountered an error.
|
|
302
|
+
* @param _params.toolArgs The arguments that were passed to the tool.
|
|
303
|
+
* @param _params.toolContext The context specific to the tool execution.
|
|
304
|
+
* @param _params.error The `Error` that was raised during tool resolution or
|
|
305
|
+
* execution.
|
|
306
|
+
* @returns An optional dictionary. If a dictionary is returned, it will be
|
|
307
|
+
* used as the tool response instead of the default error response.
|
|
308
|
+
* Returning `undefined` causes `{error: error.message}` to be returned as
|
|
309
|
+
* the tool response (unlike adk-python, which re-raises). Non-`Error`
|
|
310
|
+
* throwables bypass this callback and become `{error: thrownValue}`.
|
|
311
|
+
*/
|
|
298
312
|
async onToolErrorCallback(_params) {
|
|
299
313
|
return;
|
|
300
314
|
}
|
|
@@ -109,6 +109,33 @@ const _PluginManager = class _PluginManager {
|
|
|
109
109
|
}
|
|
110
110
|
return void 0;
|
|
111
111
|
}
|
|
112
|
+
/** Notifies every plugin without allowing one failure to hide another. */
|
|
113
|
+
async runNotificationCallbacks(callback, callbackName) {
|
|
114
|
+
for (const plugin of this.plugins) {
|
|
115
|
+
try {
|
|
116
|
+
await callback(plugin);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
import_logger.logger.error(
|
|
119
|
+
`Error in plugin '${plugin.name}' during '${callbackName}' callback:`,
|
|
120
|
+
error
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** Runs the notification-only agent error callback for every plugin. */
|
|
126
|
+
async runOnAgentErrorCallback(params) {
|
|
127
|
+
await this.runNotificationCallbacks(
|
|
128
|
+
(plugin) => plugin.onAgentErrorCallback(params),
|
|
129
|
+
"onAgentErrorCallback"
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
/** Runs the notification-only run error callback for every plugin. */
|
|
133
|
+
async runOnRunErrorCallback(params) {
|
|
134
|
+
await this.runNotificationCallbacks(
|
|
135
|
+
(plugin) => plugin.onRunErrorCallback(params),
|
|
136
|
+
"onRunErrorCallback"
|
|
137
|
+
);
|
|
138
|
+
}
|
|
112
139
|
/**
|
|
113
140
|
* Runs the `onUserMessageCallback` for all plugins.
|
|
114
141
|
*/
|