@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import { context, createContextKey } from "@opentelemetry/api";
|
|
11
|
+
import { TokenUsage } from "./token_usage.js";
|
|
12
|
+
const AGENT_FRAME_KEY = createContextKey("adk_agent_frame");
|
|
13
|
+
const WORKFLOW_FRAME_KEY = createContextKey("adk_workflow_frame");
|
|
14
|
+
const AGENT_FRAME_SYMBOL = /* @__PURE__ */ Symbol("adk.telemetry.agentFrame");
|
|
15
|
+
const WORKFLOW_FRAME_SYMBOL = /* @__PURE__ */ Symbol("adk.telemetry.workflowFrame");
|
|
16
|
+
function isAgentFrame(value) {
|
|
17
|
+
return typeof value === "object" && value !== null && AGENT_FRAME_SYMBOL in value;
|
|
18
|
+
}
|
|
19
|
+
__name(isAgentFrame, "isAgentFrame");
|
|
20
|
+
function isWorkflowFrame(value) {
|
|
21
|
+
return typeof value === "object" && value !== null && WORKFLOW_FRAME_SYMBOL in value;
|
|
22
|
+
}
|
|
23
|
+
__name(isWorkflowFrame, "isWorkflowFrame");
|
|
24
|
+
function getAgentFrame(ctx) {
|
|
25
|
+
const value = ctx.getValue(AGENT_FRAME_KEY);
|
|
26
|
+
return isAgentFrame(value) ? value : void 0;
|
|
27
|
+
}
|
|
28
|
+
__name(getAgentFrame, "getAgentFrame");
|
|
29
|
+
function getWorkflowFrame(ctx) {
|
|
30
|
+
const value = ctx.getValue(WORKFLOW_FRAME_KEY);
|
|
31
|
+
return isWorkflowFrame(value) ? value : void 0;
|
|
32
|
+
}
|
|
33
|
+
__name(getWorkflowFrame, "getWorkflowFrame");
|
|
34
|
+
function createTotals() {
|
|
35
|
+
return {
|
|
36
|
+
tokens: void 0,
|
|
37
|
+
inferenceCalls: 0,
|
|
38
|
+
toolCalls: 0,
|
|
39
|
+
skillLoads: 0,
|
|
40
|
+
compactions: 0
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
__name(createTotals, "createTotals");
|
|
44
|
+
function openAgentFrame(parentContext = context.active()) {
|
|
45
|
+
const frame = {
|
|
46
|
+
[AGENT_FRAME_SYMBOL]: true,
|
|
47
|
+
totals: createTotals()
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
frame,
|
|
51
|
+
context: parentContext.setValue(AGENT_FRAME_KEY, frame)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
__name(openAgentFrame, "openAgentFrame");
|
|
55
|
+
function openWorkflowFrame({
|
|
56
|
+
workflowName,
|
|
57
|
+
config,
|
|
58
|
+
entrypoint,
|
|
59
|
+
parentContext = context.active()
|
|
60
|
+
}) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
const enclosing = getWorkflowFrame(parentContext);
|
|
63
|
+
const frame = {
|
|
64
|
+
[WORKFLOW_FRAME_SYMBOL]: true,
|
|
65
|
+
totals: createTotals(),
|
|
66
|
+
parent: enclosing,
|
|
67
|
+
rootAgentName: (_a = enclosing == null ? void 0 : enclosing.rootAgentName) != null ? _a : workflowName,
|
|
68
|
+
workflowName,
|
|
69
|
+
config: (_b = enclosing == null ? void 0 : enclosing.config) != null ? _b : config,
|
|
70
|
+
entrypoint
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
frame,
|
|
74
|
+
context: parentContext.setValue(WORKFLOW_FRAME_KEY, frame)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
__name(openWorkflowFrame, "openWorkflowFrame");
|
|
78
|
+
function claimEntrypointWorkflowFrame(workflow, ctx = context.active()) {
|
|
79
|
+
const frame = getWorkflowFrame(ctx);
|
|
80
|
+
if (frame === void 0 || frame.entrypoint !== workflow) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
frame.entrypoint = void 0;
|
|
84
|
+
return ctx;
|
|
85
|
+
}
|
|
86
|
+
__name(claimEntrypointWorkflowFrame, "claimEntrypointWorkflowFrame");
|
|
87
|
+
function captureAccumulators(ctx = context.active()) {
|
|
88
|
+
const agent = getAgentFrame(ctx);
|
|
89
|
+
const workflow = getWorkflowFrame(ctx);
|
|
90
|
+
const each = /* @__PURE__ */ __name((fn) => {
|
|
91
|
+
if (agent) {
|
|
92
|
+
fn(agent.totals);
|
|
93
|
+
}
|
|
94
|
+
let current = workflow;
|
|
95
|
+
while (current) {
|
|
96
|
+
fn(current.totals);
|
|
97
|
+
current = current.parent;
|
|
98
|
+
}
|
|
99
|
+
}, "each");
|
|
100
|
+
return {
|
|
101
|
+
addInferenceCall() {
|
|
102
|
+
each((t) => {
|
|
103
|
+
t.inferenceCalls += 1;
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
addToolCall() {
|
|
107
|
+
each((t) => {
|
|
108
|
+
t.toolCalls += 1;
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
addSkillLoad() {
|
|
112
|
+
each((t) => {
|
|
113
|
+
t.skillLoads += 1;
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
addCompaction() {
|
|
117
|
+
let current = workflow;
|
|
118
|
+
while (current) {
|
|
119
|
+
current.totals.compactions += 1;
|
|
120
|
+
current = current.parent;
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
addTokens(usage) {
|
|
124
|
+
each((t) => {
|
|
125
|
+
if (t.tokens === void 0) {
|
|
126
|
+
t.tokens = new TokenUsage();
|
|
127
|
+
}
|
|
128
|
+
t.tokens.add(usage);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
__name(captureAccumulators, "captureAccumulators");
|
|
134
|
+
export {
|
|
135
|
+
captureAccumulators,
|
|
136
|
+
claimEntrypointWorkflowFrame,
|
|
137
|
+
openAgentFrame,
|
|
138
|
+
openWorkflowFrame
|
|
139
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2026 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
var GenAiAttr = /* @__PURE__ */ ((GenAiAttr2) => {
|
|
9
|
+
GenAiAttr2["AGENT_DESCRIPTION"] = "gen_ai.agent.description";
|
|
10
|
+
GenAiAttr2["AGENT_NAME"] = "gen_ai.agent.name";
|
|
11
|
+
GenAiAttr2["CONVERSATION_ID"] = "gen_ai.conversation.id";
|
|
12
|
+
GenAiAttr2["OPERATION_NAME"] = "gen_ai.operation.name";
|
|
13
|
+
GenAiAttr2["PROVIDER_NAME"] = "gen_ai.provider.name";
|
|
14
|
+
GenAiAttr2["SYSTEM"] = "gen_ai.system";
|
|
15
|
+
GenAiAttr2["WORKFLOW_NAME"] = "gen_ai.workflow.name";
|
|
16
|
+
GenAiAttr2["WORKFLOW_NESTED"] = "gen_ai.workflow.nested";
|
|
17
|
+
GenAiAttr2["TOOL_CALL_ID"] = "gen_ai.tool.call.id";
|
|
18
|
+
GenAiAttr2["TOOL_CALL_ARGUMENTS"] = "gen_ai.tool.call.arguments";
|
|
19
|
+
GenAiAttr2["TOOL_CALL_RESULT"] = "gen_ai.tool.call.result";
|
|
20
|
+
GenAiAttr2["TOOL_DEFINITIONS"] = "gen_ai.tool.definitions";
|
|
21
|
+
GenAiAttr2["TOOL_DESCRIPTION"] = "gen_ai.tool.description";
|
|
22
|
+
GenAiAttr2["TOOL_NAME"] = "gen_ai.tool.name";
|
|
23
|
+
GenAiAttr2["TOOL_TYPE"] = "gen_ai.tool.type";
|
|
24
|
+
GenAiAttr2["REQUEST_MODEL"] = "gen_ai.request.model";
|
|
25
|
+
GenAiAttr2["REQUEST_TOP_P"] = "gen_ai.request.top_p";
|
|
26
|
+
GenAiAttr2["REQUEST_MAX_TOKENS"] = "gen_ai.request.max_tokens";
|
|
27
|
+
GenAiAttr2["RESPONSE_FINISH_REASONS"] = "gen_ai.response.finish_reasons";
|
|
28
|
+
GenAiAttr2["INPUT_MESSAGES"] = "gen_ai.input.messages";
|
|
29
|
+
GenAiAttr2["OUTPUT_MESSAGES"] = "gen_ai.output.messages";
|
|
30
|
+
GenAiAttr2["SYSTEM_INSTRUCTIONS"] = "gen_ai.system_instructions";
|
|
31
|
+
GenAiAttr2["USAGE_INPUT_TOKENS"] = "gen_ai.usage.input_tokens";
|
|
32
|
+
GenAiAttr2["USAGE_OUTPUT_TOKENS"] = "gen_ai.usage.output_tokens";
|
|
33
|
+
GenAiAttr2["USAGE_CACHE_READ_INPUT_TOKENS"] = "gen_ai.usage.cache_read.input_tokens";
|
|
34
|
+
GenAiAttr2["USAGE_REASONING_OUTPUT_TOKENS"] = "gen_ai.usage.reasoning.output_tokens";
|
|
35
|
+
GenAiAttr2["SKILL_NAME"] = "gen_ai.skill.name";
|
|
36
|
+
GenAiAttr2["SKILL_DESCRIPTION"] = "gen_ai.skill.description";
|
|
37
|
+
GenAiAttr2["SKILL_RESOURCE_NAME"] = "gen_ai.skill.resource.name";
|
|
38
|
+
GenAiAttr2["COMPACTION_TRIGGER"] = "gen_ai.compaction.trigger";
|
|
39
|
+
GenAiAttr2["COMPACTION_EVENT_COUNT"] = "gen_ai.compaction.event_count";
|
|
40
|
+
GenAiAttr2["COMPACTION_RESULT_EVENT_ID"] = "gen_ai.compaction.result_event_id";
|
|
41
|
+
GenAiAttr2["COMPACTION_START_TIMESTAMP"] = "gen_ai.compaction.start_timestamp";
|
|
42
|
+
GenAiAttr2["COMPACTION_END_TIMESTAMP"] = "gen_ai.compaction.end_timestamp";
|
|
43
|
+
return GenAiAttr2;
|
|
44
|
+
})(GenAiAttr || {});
|
|
45
|
+
var AdkAttr = /* @__PURE__ */ ((AdkAttr2) => {
|
|
46
|
+
AdkAttr2["SKILL_ADDITIONAL_TOOLS"] = "adk.skill.additional_tools";
|
|
47
|
+
AdkAttr2["EXPERIMENTAL_ROOT_AGENT_NAME"] = "adk.experimental.root_agent.name";
|
|
48
|
+
AdkAttr2["EXPERIMENTAL_GROUNDING_QUERY_COUNT"] = "adk.experimental.grounding.query_count";
|
|
49
|
+
AdkAttr2["EXPERIMENTAL_GROUNDING_CHUNK_COUNT"] = "adk.experimental.grounding.chunk_count";
|
|
50
|
+
AdkAttr2["EXPERIMENTAL_GROUNDING_WEB_SEARCH_QUERIES"] = "adk.experimental.grounding.web_search_queries";
|
|
51
|
+
AdkAttr2["EXPERIMENTAL_GROUNDING_SOURCE_URIS"] = "adk.experimental.grounding.source_uris";
|
|
52
|
+
return AdkAttr2;
|
|
53
|
+
})(AdkAttr || {});
|
|
54
|
+
var GcpAttr = /* @__PURE__ */ ((GcpAttr2) => {
|
|
55
|
+
GcpAttr2["INVOCATION_ID"] = "gcp.vertex.agent.invocation_id";
|
|
56
|
+
GcpAttr2["EVENT_ID"] = "gcp.vertex.agent.event_id";
|
|
57
|
+
GcpAttr2["ASSOCIATED_EVENT_IDS"] = "gcp.vertex.agent.associated_event_ids";
|
|
58
|
+
GcpAttr2["DATA"] = "gcp.vertex.agent.data";
|
|
59
|
+
return GcpAttr2;
|
|
60
|
+
})(GcpAttr || {});
|
|
61
|
+
var HttpAttr = /* @__PURE__ */ ((HttpAttr2) => {
|
|
62
|
+
HttpAttr2["REQUEST_METHOD"] = "http.request.method";
|
|
63
|
+
HttpAttr2["RESPONSE_STATUS_CODE"] = "http.response.status_code";
|
|
64
|
+
HttpAttr2["REQUEST_BODY_CONTENT"] = "http.request.body.content";
|
|
65
|
+
HttpAttr2["RESPONSE_BODY_CONTENT"] = "http.response.body.content";
|
|
66
|
+
HttpAttr2["REQUEST_HEADER_PREFIX"] = "http.request.header.";
|
|
67
|
+
HttpAttr2["RESPONSE_HEADER_PREFIX"] = "http.response.header.";
|
|
68
|
+
HttpAttr2["URL_FULL"] = "url.full";
|
|
69
|
+
HttpAttr2["SERVER_ADDRESS"] = "server.address";
|
|
70
|
+
HttpAttr2["SERVER_PORT"] = "server.port";
|
|
71
|
+
return HttpAttr2;
|
|
72
|
+
})(HttpAttr || {});
|
|
73
|
+
var McpAttr = /* @__PURE__ */ ((McpAttr2) => {
|
|
74
|
+
McpAttr2["SESSION_ID"] = "mcp.session.id";
|
|
75
|
+
McpAttr2["PROTOCOL_VERSION"] = "mcp.protocol.version";
|
|
76
|
+
return McpAttr2;
|
|
77
|
+
})(McpAttr || {});
|
|
78
|
+
const ERROR_TYPE_ATTR = "error.type";
|
|
79
|
+
const USER_ID_ATTR = "user.id";
|
|
80
|
+
const SUPPORT_ID_ATTR = "supportID";
|
|
81
|
+
const GEN_AI_SYSTEM_VALUE = "gcp.vertex.agent";
|
|
82
|
+
const SCHEMA_URL = "https://opentelemetry.io/schemas/1.44.0";
|
|
83
|
+
export {
|
|
84
|
+
AdkAttr,
|
|
85
|
+
ERROR_TYPE_ATTR,
|
|
86
|
+
GEN_AI_SYSTEM_VALUE,
|
|
87
|
+
GcpAttr,
|
|
88
|
+
GenAiAttr,
|
|
89
|
+
HttpAttr,
|
|
90
|
+
McpAttr,
|
|
91
|
+
SCHEMA_URL,
|
|
92
|
+
SUPPORT_ID_ATTR,
|
|
93
|
+
USER_ID_ATTR
|
|
94
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import { getEnvVar } from "../../../../utils/env_aware_utils.js";
|
|
11
|
+
import { logger } from "../../../../utils/logger.js";
|
|
12
|
+
const CAPTURE_MESSAGE_CONTENT_ENV = "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT";
|
|
13
|
+
const EXPERIMENTAL_TELEMETRY_ENV = "ADK_EXPERIMENTAL_TELEMETRY";
|
|
14
|
+
const EXPERIMENTAL_TELEMETRY_FEATURES_ENV = "ADK_EXPERIMENTAL_TELEMETRY_FEATURES";
|
|
15
|
+
const IGNORE_RUN_CONFIG_ENV = "ADK_TELEMETRY_IGNORE_RUN_CONFIG";
|
|
16
|
+
const TRUTHY_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true"]);
|
|
17
|
+
const CONTENT_CAPTURING_MODES = /* @__PURE__ */ new Set([
|
|
18
|
+
"NO_CONTENT",
|
|
19
|
+
"EVENT_ONLY",
|
|
20
|
+
"SPAN_ONLY",
|
|
21
|
+
"SPAN_AND_EVENT"
|
|
22
|
+
]);
|
|
23
|
+
const EXPERIMENTAL_FEATURES = /* @__PURE__ */ new Set(
|
|
24
|
+
[
|
|
25
|
+
"skills",
|
|
26
|
+
"workflow",
|
|
27
|
+
"context_cache",
|
|
28
|
+
"grounding",
|
|
29
|
+
"mcp",
|
|
30
|
+
"token_usage",
|
|
31
|
+
"compaction"
|
|
32
|
+
]
|
|
33
|
+
);
|
|
34
|
+
const warnedFeatures = /* @__PURE__ */ new Set();
|
|
35
|
+
function isExperimentalFeature(value) {
|
|
36
|
+
return EXPERIMENTAL_FEATURES.has(value);
|
|
37
|
+
}
|
|
38
|
+
__name(isExperimentalFeature, "isExperimentalFeature");
|
|
39
|
+
function isContentCapturingMode(value) {
|
|
40
|
+
return CONTENT_CAPTURING_MODES.has(value);
|
|
41
|
+
}
|
|
42
|
+
__name(isContentCapturingMode, "isContentCapturingMode");
|
|
43
|
+
function readContentCapturingMode() {
|
|
44
|
+
var _a;
|
|
45
|
+
const value = ((_a = getEnvVar(CAPTURE_MESSAGE_CONTENT_ENV)) != null ? _a : "").trim();
|
|
46
|
+
if (TRUTHY_ENV_VALUES.has(value.toLowerCase())) {
|
|
47
|
+
return "EVENT_ONLY";
|
|
48
|
+
}
|
|
49
|
+
const mode = value.toUpperCase();
|
|
50
|
+
return isContentCapturingMode(mode) ? mode : "NO_CONTENT";
|
|
51
|
+
}
|
|
52
|
+
__name(readContentCapturingMode, "readContentCapturingMode");
|
|
53
|
+
function isTruthyEnv(name) {
|
|
54
|
+
var _a;
|
|
55
|
+
return TRUTHY_ENV_VALUES.has(((_a = getEnvVar(name)) != null ? _a : "").trim().toLowerCase());
|
|
56
|
+
}
|
|
57
|
+
__name(isTruthyEnv, "isTruthyEnv");
|
|
58
|
+
function normalizeExperimentalFeatures(names) {
|
|
59
|
+
const features = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const name of names) {
|
|
61
|
+
const feature = name.trim().toLowerCase();
|
|
62
|
+
if (!feature) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (isExperimentalFeature(feature)) {
|
|
66
|
+
features.add(feature);
|
|
67
|
+
} else if (!warnedFeatures.has(feature)) {
|
|
68
|
+
warnedFeatures.add(feature);
|
|
69
|
+
logger.warn(
|
|
70
|
+
`Ignoring unrecognized experimental telemetry feature: ${feature}`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return features;
|
|
75
|
+
}
|
|
76
|
+
__name(normalizeExperimentalFeatures, "normalizeExperimentalFeatures");
|
|
77
|
+
function resolveTelemetryConfig(overrides) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const env = {
|
|
80
|
+
contentCapturingMode: readContentCapturingMode(),
|
|
81
|
+
experimentalTelemetry: isTruthyEnv(EXPERIMENTAL_TELEMETRY_ENV),
|
|
82
|
+
experimentalFeatures: normalizeExperimentalFeatures(
|
|
83
|
+
((_a = getEnvVar(EXPERIMENTAL_TELEMETRY_FEATURES_ENV)) != null ? _a : "").split(",")
|
|
84
|
+
)
|
|
85
|
+
};
|
|
86
|
+
if (overrides === void 0 || isTruthyEnv(IGNORE_RUN_CONFIG_ENV)) {
|
|
87
|
+
return env;
|
|
88
|
+
}
|
|
89
|
+
const contentCapturingMode = (_b = overrides.captureMessageContent) != null ? _b : env.contentCapturingMode;
|
|
90
|
+
if (overrides.adkExperimentalTelemetryOptIn !== void 0) {
|
|
91
|
+
return {
|
|
92
|
+
contentCapturingMode,
|
|
93
|
+
experimentalTelemetry: overrides.adkExperimentalTelemetryOptIn,
|
|
94
|
+
experimentalFeatures: /* @__PURE__ */ new Set()
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const features = normalizeExperimentalFeatures(
|
|
98
|
+
(_c = overrides.experimentalFeaturesOptIn) != null ? _c : []
|
|
99
|
+
);
|
|
100
|
+
if (features.size > 0) {
|
|
101
|
+
return {
|
|
102
|
+
contentCapturingMode,
|
|
103
|
+
experimentalTelemetry: false,
|
|
104
|
+
experimentalFeatures: features
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return { ...env, contentCapturingMode };
|
|
108
|
+
}
|
|
109
|
+
__name(resolveTelemetryConfig, "resolveTelemetryConfig");
|
|
110
|
+
function shouldAddContentToLogs(config) {
|
|
111
|
+
return config.contentCapturingMode === "EVENT_ONLY" || config.contentCapturingMode === "SPAN_AND_EVENT";
|
|
112
|
+
}
|
|
113
|
+
__name(shouldAddContentToLogs, "shouldAddContentToLogs");
|
|
114
|
+
function shouldAddContentToSpans(config) {
|
|
115
|
+
return config.contentCapturingMode === "SPAN_ONLY" || config.contentCapturingMode === "SPAN_AND_EVENT";
|
|
116
|
+
}
|
|
117
|
+
__name(shouldAddContentToSpans, "shouldAddContentToSpans");
|
|
118
|
+
function isExperimentalFeatureEnabled(config, feature) {
|
|
119
|
+
return config.experimentalTelemetry || config.experimentalFeatures.has(feature);
|
|
120
|
+
}
|
|
121
|
+
__name(isExperimentalFeatureEnabled, "isExperimentalFeatureEnabled");
|
|
122
|
+
export {
|
|
123
|
+
isExperimentalFeatureEnabled,
|
|
124
|
+
isTruthyEnv,
|
|
125
|
+
resolveTelemetryConfig,
|
|
126
|
+
shouldAddContentToLogs,
|
|
127
|
+
shouldAddContentToSpans
|
|
128
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import { ApiError } from "@google/genai";
|
|
11
|
+
function normalizeErrorClassification(value) {
|
|
12
|
+
if (typeof value === "string") {
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
15
|
+
}
|
|
16
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
17
|
+
return String(value);
|
|
18
|
+
}
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
__name(normalizeErrorClassification, "normalizeErrorClassification");
|
|
22
|
+
function resolveErrorType(error) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
if (error !== null && (typeof error === "object" || typeof error === "function")) {
|
|
25
|
+
try {
|
|
26
|
+
const errorObject = error;
|
|
27
|
+
const customErrorType = (_a = normalizeErrorClassification(errorObject.errorType)) != null ? _a : normalizeErrorClassification(errorObject.error_type);
|
|
28
|
+
if (customErrorType !== void 0) {
|
|
29
|
+
return customErrorType;
|
|
30
|
+
}
|
|
31
|
+
if (error instanceof ApiError) {
|
|
32
|
+
const apiStatus = normalizeErrorClassification(error.status);
|
|
33
|
+
if (apiStatus !== void 0) {
|
|
34
|
+
return apiStatus;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const constructorName = normalizeErrorClassification(
|
|
38
|
+
(_b = errorObject.constructor) == null ? void 0 : _b.name
|
|
39
|
+
);
|
|
40
|
+
if (constructorName !== void 0) {
|
|
41
|
+
return constructorName;
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return typeof error;
|
|
47
|
+
}
|
|
48
|
+
__name(resolveErrorType, "resolveErrorType");
|
|
49
|
+
function getToolResponseErrorType(result) {
|
|
50
|
+
var _a, _b, _c;
|
|
51
|
+
if (result === null || typeof result !== "object" || Array.isArray(result)) {
|
|
52
|
+
return void 0;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
if (!Object.hasOwn(result, "error")) {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
const response = result;
|
|
59
|
+
return (_c = (_b = (_a = normalizeErrorClassification(response.errorType)) != null ? _a : normalizeErrorClassification(response.error_type)) != null ? _b : normalizeErrorClassification(response.errorCode)) != null ? _c : normalizeErrorClassification(response.error_code);
|
|
60
|
+
} catch {
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__name(getToolResponseErrorType, "getToolResponseErrorType");
|
|
65
|
+
export {
|
|
66
|
+
getToolResponseErrorType,
|
|
67
|
+
normalizeErrorClassification,
|
|
68
|
+
resolveErrorType
|
|
69
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import { FinishReason } from "@google/genai";
|
|
11
|
+
function isReportedFinishReason(finishReason) {
|
|
12
|
+
return finishReason !== void 0 && finishReason !== FinishReason.FINISH_REASON_UNSPECIFIED;
|
|
13
|
+
}
|
|
14
|
+
__name(isReportedFinishReason, "isReportedFinishReason");
|
|
15
|
+
function toOutputMessageFinishReason(finishReason) {
|
|
16
|
+
if (!isReportedFinishReason(finishReason)) {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
switch (finishReason) {
|
|
20
|
+
// The output message schema has no value for OTHER.
|
|
21
|
+
case FinishReason.OTHER:
|
|
22
|
+
return "error";
|
|
23
|
+
case FinishReason.STOP:
|
|
24
|
+
return "stop";
|
|
25
|
+
case FinishReason.MAX_TOKENS:
|
|
26
|
+
return "length";
|
|
27
|
+
default:
|
|
28
|
+
return String(finishReason).toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
__name(toOutputMessageFinishReason, "toOutputMessageFinishReason");
|
|
32
|
+
export {
|
|
33
|
+
isReportedFinishReason,
|
|
34
|
+
toOutputMessageFinishReason
|
|
35
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import { toSnakeCaseName } from "../../../../utils/case_utils.js";
|
|
11
|
+
import { GenAiAttr } from "./attributes.js";
|
|
12
|
+
import { toOutputMessageFinishReason } from "./finish_reason.js";
|
|
13
|
+
const FUNCTION_TOOL_DEFINITION_TYPE = "function";
|
|
14
|
+
function toAnyValue(value, seen) {
|
|
15
|
+
if (value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
if (typeof value !== "object" || seen.has(value)) {
|
|
19
|
+
return "<not serializable>";
|
|
20
|
+
}
|
|
21
|
+
const nextSeen = new Set(seen).add(value);
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
return value.map((item) => toAnyValue(item, nextSeen));
|
|
24
|
+
}
|
|
25
|
+
const result = {};
|
|
26
|
+
for (const [key, item] of Object.entries(value)) {
|
|
27
|
+
if (item !== void 0) {
|
|
28
|
+
result[key] = toAnyValue(item, nextSeen);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
__name(toAnyValue, "toAnyValue");
|
|
34
|
+
function toOptionalMapping(value) {
|
|
35
|
+
if (value === void 0 || value === null) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const normalized = toAnyValue(value, /* @__PURE__ */ new Set());
|
|
39
|
+
return typeof normalized === "object" && normalized !== null && !Array.isArray(normalized) && !(normalized instanceof Uint8Array) ? normalized : { value: normalized };
|
|
40
|
+
}
|
|
41
|
+
__name(toOptionalMapping, "toOptionalMapping");
|
|
42
|
+
function toRole(role) {
|
|
43
|
+
if (role === "user") {
|
|
44
|
+
return "user";
|
|
45
|
+
}
|
|
46
|
+
if (role === "model") {
|
|
47
|
+
return "assistant";
|
|
48
|
+
}
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
__name(toRole, "toRole");
|
|
52
|
+
function toMessagePart(part, index) {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f;
|
|
54
|
+
const fallbackId = /* @__PURE__ */ __name((name) => name ? `${name}_${index}` : `${index}`, "fallbackId");
|
|
55
|
+
if (part.text !== void 0) {
|
|
56
|
+
return { content: part.text, type: "text" };
|
|
57
|
+
}
|
|
58
|
+
if (part.inlineData) {
|
|
59
|
+
return { mime_type: (_a = part.inlineData.mimeType) != null ? _a : "", type: "blob" };
|
|
60
|
+
}
|
|
61
|
+
if (part.fileData) {
|
|
62
|
+
return {
|
|
63
|
+
mime_type: (_b = part.fileData.mimeType) != null ? _b : "",
|
|
64
|
+
uri: (_c = part.fileData.fileUri) != null ? _c : "",
|
|
65
|
+
type: "file_data"
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (part.functionCall) {
|
|
69
|
+
const call = part.functionCall;
|
|
70
|
+
return {
|
|
71
|
+
id: (_d = call.id) != null ? _d : fallbackId(call.name),
|
|
72
|
+
name: (_e = call.name) != null ? _e : "",
|
|
73
|
+
arguments: toOptionalMapping(call.args),
|
|
74
|
+
type: "tool_call"
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (part.functionResponse) {
|
|
78
|
+
const response = part.functionResponse;
|
|
79
|
+
return {
|
|
80
|
+
id: (_f = response.id) != null ? _f : fallbackId(response.name),
|
|
81
|
+
response: toOptionalMapping(response.response),
|
|
82
|
+
type: "tool_call_response"
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
__name(toMessagePart, "toMessagePart");
|
|
88
|
+
function toMessageParts(parts) {
|
|
89
|
+
return (parts != null ? parts : []).flatMap((part, index) => {
|
|
90
|
+
const converted = toMessagePart(part, index);
|
|
91
|
+
return converted ? [converted] : [];
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
__name(toMessageParts, "toMessageParts");
|
|
95
|
+
function toInputMessage(content) {
|
|
96
|
+
return { role: toRole(content.role), parts: toMessageParts(content.parts) };
|
|
97
|
+
}
|
|
98
|
+
__name(toInputMessage, "toInputMessage");
|
|
99
|
+
function isContent(value) {
|
|
100
|
+
return "parts" in value || "role" in value;
|
|
101
|
+
}
|
|
102
|
+
__name(isContent, "isContent");
|
|
103
|
+
function toParts(instruction) {
|
|
104
|
+
var _a;
|
|
105
|
+
if (typeof instruction === "string") {
|
|
106
|
+
return [{ text: instruction }];
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(instruction)) {
|
|
109
|
+
return instruction.map(
|
|
110
|
+
(part) => typeof part === "string" ? { text: part } : part
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return isContent(instruction) ? (_a = instruction.parts) != null ? _a : [] : [instruction];
|
|
114
|
+
}
|
|
115
|
+
__name(toParts, "toParts");
|
|
116
|
+
function toSystemInstructions(config) {
|
|
117
|
+
if (!(config == null ? void 0 : config.systemInstruction)) {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
return toMessageParts(toParts(config.systemInstruction));
|
|
121
|
+
}
|
|
122
|
+
__name(toSystemInstructions, "toSystemInstructions");
|
|
123
|
+
function toToolDefinitions(tool) {
|
|
124
|
+
var _a, _b, _c;
|
|
125
|
+
if (!("functionDeclarations" in tool) && "callTool" in tool) {
|
|
126
|
+
return [{ name: "UnserializableTool", type: "CallableTool" }];
|
|
127
|
+
}
|
|
128
|
+
const definitions = [];
|
|
129
|
+
for (const declaration of (_a = tool.functionDeclarations) != null ? _a : []) {
|
|
130
|
+
const parameters = (_b = declaration.parameters) != null ? _b : declaration.parametersJsonSchema;
|
|
131
|
+
definitions.push({
|
|
132
|
+
name: (_c = declaration.name) != null ? _c : "FunctionDeclaration",
|
|
133
|
+
description: declaration.description,
|
|
134
|
+
parameters: parameters === void 0 ? null : toOptionalMapping(parameters),
|
|
135
|
+
type: FUNCTION_TOOL_DEFINITION_TYPE
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
for (const [key, value] of Object.entries(tool)) {
|
|
139
|
+
if (key !== "functionDeclarations" && value !== void 0) {
|
|
140
|
+
const toolType = toSnakeCaseName(key);
|
|
141
|
+
definitions.push({ name: toolType, type: toolType });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return definitions;
|
|
145
|
+
}
|
|
146
|
+
__name(toToolDefinitions, "toToolDefinitions");
|
|
147
|
+
function buildRequestOperationDetails(llmRequest) {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
return {
|
|
150
|
+
[GenAiAttr.INPUT_MESSAGES]: llmRequest.contents.map(toInputMessage),
|
|
151
|
+
[GenAiAttr.SYSTEM_INSTRUCTIONS]: toSystemInstructions(llmRequest.config),
|
|
152
|
+
[GenAiAttr.TOOL_DEFINITIONS]: ((_b = (_a = llmRequest.config) == null ? void 0 : _a.tools) != null ? _b : []).flatMap(
|
|
153
|
+
toToolDefinitions
|
|
154
|
+
)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
__name(buildRequestOperationDetails, "buildRequestOperationDetails");
|
|
158
|
+
function buildOutputMessage(llmResponse) {
|
|
159
|
+
if (!llmResponse.content) {
|
|
160
|
+
return void 0;
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
...toInputMessage(llmResponse.content),
|
|
164
|
+
finish_reason: toOutputMessageFinishReason(llmResponse.finishReason)
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
__name(buildOutputMessage, "buildOutputMessage");
|
|
168
|
+
function withoutContent(details) {
|
|
169
|
+
const toolDefinitions = details[GenAiAttr.TOOL_DEFINITIONS];
|
|
170
|
+
if (!(toolDefinitions == null ? void 0 : toolDefinitions.length)) {
|
|
171
|
+
return {};
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
[GenAiAttr.TOOL_DEFINITIONS]: toolDefinitions.map((definition) => {
|
|
175
|
+
if (typeof definition !== "object" || definition === null || Array.isArray(definition) || definition instanceof Uint8Array || !("parameters" in definition)) {
|
|
176
|
+
return definition;
|
|
177
|
+
}
|
|
178
|
+
const { parameters: _parameters, ...rest } = definition;
|
|
179
|
+
return rest;
|
|
180
|
+
})
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
__name(withoutContent, "withoutContent");
|
|
184
|
+
export {
|
|
185
|
+
buildOutputMessage,
|
|
186
|
+
buildRequestOperationDetails,
|
|
187
|
+
withoutContent
|
|
188
|
+
};
|