@google/adk 2.4.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 +282 -55
- package/dist/cjs/agents/base_agent.js +111 -68
- package/dist/cjs/agents/functions.js +62 -85
- package/dist/cjs/agents/instructions.js +7 -6
- package/dist/cjs/agents/invocation_context.js +2 -2
- package/dist/cjs/agents/llm_agent.js +105 -95
- package/dist/cjs/agents/processors/content_processor_utils.js +42 -15
- package/dist/cjs/agents/processors/content_request_processor.js +28 -11
- 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 +2 -1
- 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 +128 -9
- package/dist/cjs/cli/utils/path_validation.js +83 -0
- package/dist/cjs/code_executors/container_code_executor.js +158 -36
- package/dist/cjs/common.js +50 -12
- package/dist/cjs/context/compaction_utils.js +19 -0
- package/dist/cjs/events/event.js +7 -3
- package/dist/cjs/features/feature_registry.js +5 -0
- package/dist/cjs/index.js +29 -14
- 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 +45 -21
- 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 +1 -4
- package/dist/cjs/sessions/database_session_service.js +191 -19
- 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/vertex_ai_session_service.js +11 -3
- package/dist/cjs/skills/loader.js +29 -28
- 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 -5
- package/dist/cjs/tools/agent_tool.js +9 -1
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +22 -34
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +60 -20
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +26 -10
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +14 -23
- 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_toolset.js +3 -2
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +3 -1
- package/dist/cjs/tools/load_artifacts_tool.js +15 -5
- package/dist/cjs/tools/load_memory_tool.js +2 -5
- 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 +18 -6
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +30 -29
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +45 -14
- 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 +47 -28
- package/dist/cjs/utils/async_queue.js +37 -3
- package/dist/cjs/utils/client_labels.js +9 -11
- 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 +10 -9
- package/dist/cjs/utils/gemini_schema_util.js +125 -12
- package/dist/cjs/utils/id_provider.js +63 -0
- package/dist/cjs/utils/model_name.js +15 -0
- package/dist/cjs/utils/simple_zod_to_json.js +13 -31
- package/dist/cjs/utils/ssrf_guard.js +46 -16
- 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 +293 -55
- package/dist/esm/agents/base_agent.js +111 -72
- package/dist/esm/agents/functions.js +67 -89
- package/dist/esm/agents/instructions.js +7 -6
- package/dist/esm/agents/invocation_context.js +2 -2
- package/dist/esm/agents/llm_agent.js +111 -100
- package/dist/esm/agents/processors/content_processor_utils.js +42 -15
- package/dist/esm/agents/processors/content_request_processor.js +28 -11
- 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 +2 -1
- 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 +128 -9
- package/dist/esm/cli/utils/path_validation.js +45 -0
- package/dist/esm/code_executors/container_code_executor.js +158 -36
- package/dist/esm/common.js +49 -6
- package/dist/esm/context/compaction_utils.js +19 -0
- package/dist/esm/events/event.js +7 -3
- package/dist/esm/features/feature_registry.js +5 -0
- package/dist/esm/index.js +27 -15
- 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 +45 -21
- 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 +1 -4
- package/dist/esm/sessions/database_session_service.js +191 -19
- 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/vertex_ai_session_service.js +11 -3
- package/dist/esm/skills/loader.js +29 -28
- 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/application_integration_tool/application_integration_toolset.js +23 -35
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +64 -21
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +26 -10
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +14 -23
- 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_toolset.js +3 -2
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +3 -1
- package/dist/esm/tools/load_artifacts_tool.js +15 -5
- package/dist/esm/tools/load_memory_tool.js +2 -5
- 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 +18 -6
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +27 -26
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +45 -14
- 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 +47 -28
- package/dist/esm/utils/async_queue.js +37 -3
- package/dist/esm/utils/client_labels.js +9 -11
- 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 +10 -9
- package/dist/esm/utils/gemini_schema_util.js +124 -11
- package/dist/esm/utils/id_provider.js +33 -0
- package/dist/esm/utils/model_name.js +14 -0
- package/dist/esm/utils/simple_zod_to_json.js +13 -31
- package/dist/esm/utils/ssrf_guard.js +55 -15
- 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 +121 -3
- package/dist/types/agents/base_agent.d.ts +2 -0
- package/dist/types/agents/processors/content_processor_utils.d.ts +9 -9
- 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 +19 -2
- package/dist/types/cli/utils/path_validation.d.ts +30 -0
- package/dist/types/code_executors/container_code_executor.d.ts +49 -8
- package/dist/types/common.d.ts +16 -9
- package/dist/types/context/compaction_utils.d.ts +13 -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 +9 -6
- package/dist/types/plugins/base_plugin.d.ts +50 -21
- 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 +0 -2
- package/dist/types/sessions/db/operations.d.ts +2 -1
- package/dist/types/sessions/db/schema.d.ts +5 -3
- 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/application_integration_tool/clients/connections_client.d.ts +13 -4
- package/dist/types/tools/base_toolset.d.ts +1 -1
- 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_toolset.d.ts +2 -0
- package/dist/types/tools/load_artifacts_tool.d.ts +5 -1
- package/dist/types/tools/load_memory_tool.d.ts +13 -7
- 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/operation_parser.d.ts +7 -3
- package/dist/types/tools/toolbox_toolset.d.ts +15 -20
- package/dist/types/utils/async_queue.d.ts +14 -0
- 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 +27 -6
- package/dist/types/utils/id_provider.d.ts +43 -0
- package/dist/types/utils/model_name.d.ts +8 -0
- 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 +86 -88
- package/dist/web/index_web.js.map +4 -4
- package/package.json +13 -15
- package/dist/cjs/telemetry/google_cloud.js +0 -116
- package/dist/cjs/telemetry/tracing.js +0 -393
- package/dist/esm/telemetry/google_cloud.js +0 -99
- package/dist/esm/telemetry/setup.js +0 -88
- package/dist/esm/telemetry/tracing.js +0 -361
- package/dist/types/telemetry/google_cloud.d.ts +0 -9
- package/dist/types/telemetry/tracing.d.ts +0 -143
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var inference_exports = {};
|
|
27
|
+
__export(inference_exports, {
|
|
28
|
+
buildResponseAttributes: () => buildResponseAttributes,
|
|
29
|
+
setInferenceOperationDetails: () => setInferenceOperationDetails,
|
|
30
|
+
setInferenceResponseAttributes: () => setInferenceResponseAttributes,
|
|
31
|
+
startInferenceSpan: () => startInferenceSpan
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(inference_exports);
|
|
34
|
+
var import_attributes = require("../common/attributes.js");
|
|
35
|
+
var import_config = require("../common/config.js");
|
|
36
|
+
var import_finish_reason = require("../common/finish_reason.js");
|
|
37
|
+
var import_genai_messages = require("../common/genai_messages.js");
|
|
38
|
+
var import_serialization = require("../common/serialization.js");
|
|
39
|
+
var import_token_usage = require("../common/token_usage.js");
|
|
40
|
+
var import_tracer = require("./tracer.js");
|
|
41
|
+
/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2026 Google LLC
|
|
44
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
45
|
+
*/
|
|
46
|
+
function startInferenceSpan({
|
|
47
|
+
llmRequest,
|
|
48
|
+
commonAttributes
|
|
49
|
+
}) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const config = llmRequest.config;
|
|
52
|
+
return (0, import_tracer.getTracer)().startSpan(
|
|
53
|
+
`generate_content ${(_a = llmRequest.model) != null ? _a : ""}`.trim(),
|
|
54
|
+
{
|
|
55
|
+
attributes: {
|
|
56
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "generate_content",
|
|
57
|
+
[import_attributes.GenAiAttr.REQUEST_MODEL]: (_b = llmRequest.model) != null ? _b : "",
|
|
58
|
+
...(config == null ? void 0 : config.topP) === void 0 ? {} : { [import_attributes.GenAiAttr.REQUEST_TOP_P]: config.topP },
|
|
59
|
+
...(config == null ? void 0 : config.maxOutputTokens) === void 0 ? {} : { [import_attributes.GenAiAttr.REQUEST_MAX_TOKENS]: config.maxOutputTokens },
|
|
60
|
+
...commonAttributes
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
__name(startInferenceSpan, "startInferenceSpan");
|
|
66
|
+
function buildResponseAttributes(llmResponse) {
|
|
67
|
+
return {
|
|
68
|
+
...(0, import_finish_reason.isReportedFinishReason)(llmResponse.finishReason) ? {
|
|
69
|
+
[import_attributes.GenAiAttr.RESPONSE_FINISH_REASONS]: [
|
|
70
|
+
String(llmResponse.finishReason).toLowerCase()
|
|
71
|
+
]
|
|
72
|
+
} : {},
|
|
73
|
+
...llmResponse.usageMetadata ? new import_token_usage.TokenUsage(llmResponse.usageMetadata).asAttributes() : {}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
__name(buildResponseAttributes, "buildResponseAttributes");
|
|
77
|
+
function groundingSourceUris(chunks) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const uris = /* @__PURE__ */ new Set();
|
|
80
|
+
for (const chunk of chunks) {
|
|
81
|
+
for (const uri of [
|
|
82
|
+
(_a = chunk.web) == null ? void 0 : _a.uri,
|
|
83
|
+
(_b = chunk.retrievedContext) == null ? void 0 : _b.uri,
|
|
84
|
+
(_c = chunk.maps) == null ? void 0 : _c.uri
|
|
85
|
+
]) {
|
|
86
|
+
if (uri) {
|
|
87
|
+
uris.add(uri);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return [...uris];
|
|
92
|
+
}
|
|
93
|
+
__name(groundingSourceUris, "groundingSourceUris");
|
|
94
|
+
function buildGroundingAttributes(groundingMetadata, captureContent) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
const queries = ((_a = groundingMetadata.webSearchQueries) != null ? _a : []).filter(Boolean);
|
|
97
|
+
const chunks = (_b = groundingMetadata.groundingChunks) != null ? _b : [];
|
|
98
|
+
const sourceUris = groundingSourceUris(chunks);
|
|
99
|
+
return {
|
|
100
|
+
[import_attributes.AdkAttr.EXPERIMENTAL_GROUNDING_QUERY_COUNT]: new Set(queries).size,
|
|
101
|
+
[import_attributes.AdkAttr.EXPERIMENTAL_GROUNDING_CHUNK_COUNT]: chunks.length,
|
|
102
|
+
...captureContent && queries.length > 0 ? { [import_attributes.AdkAttr.EXPERIMENTAL_GROUNDING_WEB_SEARCH_QUERIES]: queries } : {},
|
|
103
|
+
...captureContent && sourceUris.length > 0 ? { [import_attributes.AdkAttr.EXPERIMENTAL_GROUNDING_SOURCE_URIS]: sourceUris } : {}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
__name(buildGroundingAttributes, "buildGroundingAttributes");
|
|
107
|
+
function setInferenceResponseAttributes(span, llmResponse, config) {
|
|
108
|
+
span.setAttributes(buildResponseAttributes(llmResponse));
|
|
109
|
+
if (llmResponse.groundingMetadata && (0, import_config.isExperimentalFeatureEnabled)(config, "grounding")) {
|
|
110
|
+
span.setAttributes(
|
|
111
|
+
buildGroundingAttributes(
|
|
112
|
+
llmResponse.groundingMetadata,
|
|
113
|
+
(0, import_config.shouldAddContentToSpans)(config)
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
__name(setInferenceResponseAttributes, "setInferenceResponseAttributes");
|
|
119
|
+
function setInferenceOperationDetails(span, details, config) {
|
|
120
|
+
const recorded = (0, import_config.shouldAddContentToSpans)(config) ? details : (0, import_genai_messages.withoutContent)(details);
|
|
121
|
+
for (const [key, value] of Object.entries(recorded)) {
|
|
122
|
+
span.setAttribute(key, (0, import_serialization.safeJsonSerialize)(value));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
__name(setInferenceOperationDetails, "setInferenceOperationDetails");
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
buildResponseAttributes,
|
|
129
|
+
setInferenceOperationDetails,
|
|
130
|
+
setInferenceResponseAttributes,
|
|
131
|
+
startInferenceSpan
|
|
132
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var live_exports = {};
|
|
27
|
+
__export(live_exports, {
|
|
28
|
+
setSendDataAttributes: () => setSendDataAttributes
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(live_exports);
|
|
31
|
+
var import_attributes = require("../common/attributes.js");
|
|
32
|
+
var import_serialization = require("../common/serialization.js");
|
|
33
|
+
/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2026 Google LLC
|
|
36
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
37
|
+
*/
|
|
38
|
+
function setSendDataAttributes(span, { invocationContext, eventId, data }) {
|
|
39
|
+
span.setAttributes({
|
|
40
|
+
[import_attributes.GcpAttr.INVOCATION_ID]: invocationContext.invocationId,
|
|
41
|
+
[import_attributes.GcpAttr.EVENT_ID]: eventId
|
|
42
|
+
});
|
|
43
|
+
span.setAttribute(
|
|
44
|
+
import_attributes.GcpAttr.DATA,
|
|
45
|
+
(0, import_serialization.shouldAddRequestResponseToSpans)() ? (0, import_serialization.safeJsonSerialize)(data) : "{}"
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
__name(setSendDataAttributes, "setSendDataAttributes");
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
setSendDataAttributes
|
|
52
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var node_exports = {};
|
|
27
|
+
__export(node_exports, {
|
|
28
|
+
hasOwnInvocationSpan: () => hasOwnInvocationSpan,
|
|
29
|
+
setAssociatedEventIds: () => setAssociatedEventIds,
|
|
30
|
+
startNodeSpan: () => startNodeSpan
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(node_exports);
|
|
33
|
+
var import_attributes = require("../common/attributes.js");
|
|
34
|
+
var import_tracer = require("./tracer.js");
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2026 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
39
|
+
*/
|
|
40
|
+
const SELF_TRACED_NODE_BRANDS = [
|
|
41
|
+
/* @__PURE__ */ Symbol.for("google.adk.baseAgent"),
|
|
42
|
+
/* @__PURE__ */ Symbol.for("google.adk.workflow.workflow")
|
|
43
|
+
];
|
|
44
|
+
function hasOwnInvocationSpan(node) {
|
|
45
|
+
return SELF_TRACED_NODE_BRANDS.some(
|
|
46
|
+
(brand) => brand in node && Reflect.get(node, brand) === true
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
__name(hasOwnInvocationSpan, "hasOwnInvocationSpan");
|
|
50
|
+
function startNodeSpan({
|
|
51
|
+
nodeName,
|
|
52
|
+
sessionId
|
|
53
|
+
}) {
|
|
54
|
+
return (0, import_tracer.getTracer)().startSpan(`invoke_node ${nodeName}`, {
|
|
55
|
+
attributes: {
|
|
56
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "invoke_node",
|
|
57
|
+
[import_attributes.GenAiAttr.CONVERSATION_ID]: sessionId
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
__name(startNodeSpan, "startNodeSpan");
|
|
62
|
+
function setAssociatedEventIds(span, eventIds) {
|
|
63
|
+
if (eventIds.length > 0) {
|
|
64
|
+
span.setAttribute(import_attributes.GcpAttr.ASSOCIATED_EVENT_IDS, [...eventIds]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
__name(setAssociatedEventIds, "setAssociatedEventIds");
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
hasOwnInvocationSpan,
|
|
71
|
+
setAssociatedEventIds,
|
|
72
|
+
startNodeSpan
|
|
73
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var propagation_exports = {};
|
|
27
|
+
__export(propagation_exports, {
|
|
28
|
+
INCOMING_HEADERS_GETTER: () => INCOMING_HEADERS_GETTER,
|
|
29
|
+
addMissingHeaders: () => addMissingHeaders
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(propagation_exports);
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2026 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
36
|
+
*/
|
|
37
|
+
const INCOMING_HEADERS_GETTER = Object.freeze({
|
|
38
|
+
keys: /* @__PURE__ */ __name((carrier) => Object.keys(carrier), "keys"),
|
|
39
|
+
get(carrier, key) {
|
|
40
|
+
const name = key.toLowerCase();
|
|
41
|
+
for (const [headerName, value] of Object.entries(carrier)) {
|
|
42
|
+
if (headerName.toLowerCase() === name) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
function addMissingHeaders(input, init, injected) {
|
|
50
|
+
var _a;
|
|
51
|
+
const isRequest = typeof Request !== "undefined" && input instanceof Request;
|
|
52
|
+
const headers = new Headers(
|
|
53
|
+
(_a = init == null ? void 0 : init.headers) != null ? _a : isRequest ? input.headers : void 0
|
|
54
|
+
);
|
|
55
|
+
for (const [name, value] of Object.entries(injected)) {
|
|
56
|
+
if (!headers.has(name)) {
|
|
57
|
+
headers.set(name, value);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return headers;
|
|
61
|
+
}
|
|
62
|
+
__name(addMissingHeaders, "addMissingHeaders");
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
INCOMING_HEADERS_GETTER,
|
|
66
|
+
addMissingHeaders
|
|
67
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var tool_exports = {};
|
|
27
|
+
__export(tool_exports, {
|
|
28
|
+
buildMergedToolCallsAttributes: () => buildMergedToolCallsAttributes,
|
|
29
|
+
buildSkillAttributes: () => buildSkillAttributes,
|
|
30
|
+
buildSkillSpanName: () => buildSkillSpanName,
|
|
31
|
+
buildToolCallAttributes: () => buildToolCallAttributes,
|
|
32
|
+
setSkillSpanAttributes: () => setSkillSpanAttributes
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(tool_exports);
|
|
35
|
+
var import_attributes = require("../common/attributes.js");
|
|
36
|
+
var import_config = require("../common/config.js");
|
|
37
|
+
var import_redaction = require("../common/redaction.js");
|
|
38
|
+
var import_serialization = require("../common/serialization.js");
|
|
39
|
+
/**
|
|
40
|
+
* @license
|
|
41
|
+
* Copyright 2026 Google LLC
|
|
42
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
43
|
+
*/
|
|
44
|
+
const UNSPECIFIED = "<not specified>";
|
|
45
|
+
function serializeToolResult(result) {
|
|
46
|
+
try {
|
|
47
|
+
return (0, import_serialization.safeJsonSerialize)((0, import_redaction.redactCredentialSecrets)(result));
|
|
48
|
+
} catch {
|
|
49
|
+
return "<not serializable>";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
__name(serializeToolResult, "serializeToolResult");
|
|
53
|
+
function buildToolCallAttributes({
|
|
54
|
+
tool,
|
|
55
|
+
args,
|
|
56
|
+
agentName,
|
|
57
|
+
outcome,
|
|
58
|
+
config
|
|
59
|
+
}) {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
const functionResponseEvent = outcome.kind === "response" ? outcome.functionResponseEvent : void 0;
|
|
62
|
+
const functionResponse = (_c = (_b = (_a = functionResponseEvent == null ? void 0 : functionResponseEvent.content) == null ? void 0 : _a.parts) == null ? void 0 : _b[0]) == null ? void 0 : _c.functionResponse;
|
|
63
|
+
const errorType = outcome.errorType;
|
|
64
|
+
const captureContent = (0, import_config.shouldAddContentToSpans)(config);
|
|
65
|
+
const result = functionResponse == null ? void 0 : functionResponse.response;
|
|
66
|
+
return {
|
|
67
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "execute_tool",
|
|
68
|
+
[import_attributes.GenAiAttr.TOOL_DESCRIPTION]: tool.description,
|
|
69
|
+
[import_attributes.GenAiAttr.TOOL_NAME]: tool.name,
|
|
70
|
+
[import_attributes.GenAiAttr.TOOL_TYPE]: tool.constructor.name,
|
|
71
|
+
...agentName ? { [import_attributes.GenAiAttr.AGENT_NAME]: agentName } : {},
|
|
72
|
+
...errorType === void 0 ? {} : { [import_attributes.ERROR_TYPE_ATTR]: errorType },
|
|
73
|
+
[import_attributes.GenAiAttr.TOOL_CALL_ID]: (_d = functionResponse == null ? void 0 : functionResponse.id) != null ? _d : UNSPECIFIED,
|
|
74
|
+
...functionResponseEvent ? { [import_attributes.GcpAttr.EVENT_ID]: functionResponseEvent.id } : {},
|
|
75
|
+
...captureContent ? { [import_attributes.GenAiAttr.TOOL_CALL_ARGUMENTS]: (0, import_serialization.safeJsonSerialize)(args) } : {},
|
|
76
|
+
...captureContent && result !== void 0 && result !== null ? { [import_attributes.GenAiAttr.TOOL_CALL_RESULT]: serializeToolResult(result) } : {}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
__name(buildToolCallAttributes, "buildToolCallAttributes");
|
|
80
|
+
function buildMergedToolCallsAttributes(responseEventId) {
|
|
81
|
+
return {
|
|
82
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "execute_tool",
|
|
83
|
+
[import_attributes.GenAiAttr.TOOL_NAME]: "(merged tools)",
|
|
84
|
+
[import_attributes.GenAiAttr.TOOL_DESCRIPTION]: "(merged tools)",
|
|
85
|
+
[import_attributes.GenAiAttr.TOOL_CALL_ID]: responseEventId,
|
|
86
|
+
[import_attributes.GcpAttr.EVENT_ID]: responseEventId
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
__name(buildMergedToolCallsAttributes, "buildMergedToolCallsAttributes");
|
|
90
|
+
function buildSkillSpanName(toolName, report) {
|
|
91
|
+
return report.resourceName === void 0 ? `execute_tool ${toolName} ${report.skillName}` : `execute_tool ${toolName} ${report.skillName} ${report.resourceName}`;
|
|
92
|
+
}
|
|
93
|
+
__name(buildSkillSpanName, "buildSkillSpanName");
|
|
94
|
+
function buildSkillAttributes(report) {
|
|
95
|
+
var _a;
|
|
96
|
+
const { skill } = report;
|
|
97
|
+
const additionalTools = (_a = skill == null ? void 0 : skill.frontmatter.metadata) == null ? void 0 : _a["adk_additional_tools"];
|
|
98
|
+
return {
|
|
99
|
+
[import_attributes.GenAiAttr.SKILL_NAME]: report.skillName,
|
|
100
|
+
...skill ? { [import_attributes.GenAiAttr.SKILL_DESCRIPTION]: skill.frontmatter.description } : {},
|
|
101
|
+
...report.resourceName === void 0 ? {} : { [import_attributes.GenAiAttr.SKILL_RESOURCE_NAME]: report.resourceName },
|
|
102
|
+
...report.isSkillLoad && skill && Array.isArray(additionalTools) ? {
|
|
103
|
+
[import_attributes.AdkAttr.SKILL_ADDITIONAL_TOOLS]: additionalTools.filter(
|
|
104
|
+
(name) => typeof name === "string"
|
|
105
|
+
)
|
|
106
|
+
} : {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
__name(buildSkillAttributes, "buildSkillAttributes");
|
|
110
|
+
function setSkillSpanAttributes(span, toolName, report) {
|
|
111
|
+
span.updateName(buildSkillSpanName(toolName, report));
|
|
112
|
+
span.setAttributes(buildSkillAttributes(report));
|
|
113
|
+
}
|
|
114
|
+
__name(setSkillSpanAttributes, "setSkillSpanAttributes");
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
buildMergedToolCallsAttributes,
|
|
118
|
+
buildSkillAttributes,
|
|
119
|
+
buildSkillSpanName,
|
|
120
|
+
buildToolCallAttributes,
|
|
121
|
+
setSkillSpanAttributes
|
|
122
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var tracer_exports = {};
|
|
27
|
+
__export(tracer_exports, {
|
|
28
|
+
bindOtelContextToAsyncGenerator: () => bindOtelContextToAsyncGenerator,
|
|
29
|
+
getTracer: () => getTracer,
|
|
30
|
+
setSpanError: () => setSpanError
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(tracer_exports);
|
|
33
|
+
var import_api = require("@opentelemetry/api");
|
|
34
|
+
var import_version = require("../../../../version.js");
|
|
35
|
+
var import_attributes = require("../common/attributes.js");
|
|
36
|
+
var import_error = require("../common/error.js");
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2026 Google LLC
|
|
40
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
41
|
+
*/
|
|
42
|
+
function getTracer() {
|
|
43
|
+
return import_api.trace.getTracerProvider().getTracer(import_attributes.GEN_AI_SYSTEM_VALUE, import_version.version, { schemaUrl: import_attributes.SCHEMA_URL });
|
|
44
|
+
}
|
|
45
|
+
__name(getTracer, "getTracer");
|
|
46
|
+
function bindOtelContextToAsyncGenerator(ctx, generator) {
|
|
47
|
+
return {
|
|
48
|
+
next: import_api.context.bind(ctx, generator.next.bind(generator)),
|
|
49
|
+
return: import_api.context.bind(ctx, generator.return.bind(generator)),
|
|
50
|
+
throw: import_api.context.bind(ctx, generator.throw.bind(generator)),
|
|
51
|
+
[Symbol.asyncIterator]() {
|
|
52
|
+
return bindOtelContextToAsyncGenerator(
|
|
53
|
+
ctx,
|
|
54
|
+
generator[Symbol.asyncIterator]()
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
__name(bindOtelContextToAsyncGenerator, "bindOtelContextToAsyncGenerator");
|
|
60
|
+
function setSpanError(span, error) {
|
|
61
|
+
const errorType = (0, import_error.resolveErrorType)(error);
|
|
62
|
+
let exception;
|
|
63
|
+
try {
|
|
64
|
+
exception = error instanceof Error ? error : errorType;
|
|
65
|
+
} catch {
|
|
66
|
+
exception = errorType;
|
|
67
|
+
}
|
|
68
|
+
span.recordException(exception);
|
|
69
|
+
span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: errorType });
|
|
70
|
+
}
|
|
71
|
+
__name(setSpanError, "setSpanError");
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
bindOtelContextToAsyncGenerator,
|
|
75
|
+
getTracer,
|
|
76
|
+
setSpanError
|
|
77
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var workflow_exports = {};
|
|
27
|
+
__export(workflow_exports, {
|
|
28
|
+
startWorkflowSpan: () => startWorkflowSpan
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(workflow_exports);
|
|
31
|
+
var import_api = require("@opentelemetry/api");
|
|
32
|
+
var import_attributes = require("../common/attributes.js");
|
|
33
|
+
var import_tracer = require("./tracer.js");
|
|
34
|
+
/**
|
|
35
|
+
* @license
|
|
36
|
+
* Copyright 2026 Google LLC
|
|
37
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
38
|
+
*/
|
|
39
|
+
const SUPPORT_ID_KEY = (0, import_api.createContextKey)("google.adk.agent_engine.support_id");
|
|
40
|
+
function getSupportId(parentContext, nested) {
|
|
41
|
+
if (nested) {
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
const parentSpanContext = import_api.trace.getSpanContext(parentContext);
|
|
45
|
+
if (parentSpanContext && !parentSpanContext.isRemote) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
const supportId = parentContext.getValue(SUPPORT_ID_KEY);
|
|
49
|
+
return typeof supportId === "string" ? supportId : void 0;
|
|
50
|
+
}
|
|
51
|
+
__name(getSupportId, "getSupportId");
|
|
52
|
+
function startWorkflowSpan({
|
|
53
|
+
workflowName,
|
|
54
|
+
sessionId,
|
|
55
|
+
nested,
|
|
56
|
+
parentContext = import_api.context.active()
|
|
57
|
+
}) {
|
|
58
|
+
const supportId = getSupportId(parentContext, nested);
|
|
59
|
+
return (0, import_tracer.getTracer)().startSpan(
|
|
60
|
+
workflowName ? `invoke_workflow ${workflowName}` : "invoke_workflow",
|
|
61
|
+
{
|
|
62
|
+
attributes: {
|
|
63
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "invoke_workflow",
|
|
64
|
+
[import_attributes.GenAiAttr.CONVERSATION_ID]: sessionId,
|
|
65
|
+
...nested ? { [import_attributes.GenAiAttr.WORKFLOW_NESTED]: true } : {},
|
|
66
|
+
...workflowName ? { [import_attributes.GenAiAttr.WORKFLOW_NAME]: workflowName } : {},
|
|
67
|
+
...supportId ? { [import_attributes.SUPPORT_ID_ATTR]: supportId } : {}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
parentContext
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
__name(startWorkflowSpan, "startWorkflowSpan");
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
startWorkflowSpan
|
|
77
|
+
});
|