@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,189 @@
|
|
|
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 meters_exports = {};
|
|
27
|
+
__export(meters_exports, {
|
|
28
|
+
CALL_COUNT_BUCKETS: () => CALL_COUNT_BUCKETS,
|
|
29
|
+
INPUT_TOKEN_BUCKETS: () => INPUT_TOKEN_BUCKETS,
|
|
30
|
+
OUTPUT_TOKEN_BUCKETS: () => OUTPUT_TOKEN_BUCKETS,
|
|
31
|
+
cachedInstruments: () => cachedInstruments,
|
|
32
|
+
createHistogram: () => createHistogram,
|
|
33
|
+
createTokenHistograms: () => createTokenHistograms,
|
|
34
|
+
recordTokenHistograms: () => recordTokenHistograms
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(meters_exports);
|
|
37
|
+
var import_api = require("@opentelemetry/api");
|
|
38
|
+
var import_version = require("../../../../version.js");
|
|
39
|
+
var import_attributes = require("../common/attributes.js");
|
|
40
|
+
var import_token_usage = require("../common/token_usage.js");
|
|
41
|
+
/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2026 Google LLC
|
|
44
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
45
|
+
*/
|
|
46
|
+
const CALL_COUNT_BUCKETS = Object.freeze([
|
|
47
|
+
0,
|
|
48
|
+
1,
|
|
49
|
+
2,
|
|
50
|
+
3,
|
|
51
|
+
4,
|
|
52
|
+
5,
|
|
53
|
+
6,
|
|
54
|
+
8,
|
|
55
|
+
12,
|
|
56
|
+
16,
|
|
57
|
+
24,
|
|
58
|
+
32,
|
|
59
|
+
64,
|
|
60
|
+
128,
|
|
61
|
+
256,
|
|
62
|
+
512
|
|
63
|
+
]);
|
|
64
|
+
const INPUT_TOKEN_BUCKETS = Object.freeze([
|
|
65
|
+
0,
|
|
66
|
+
128,
|
|
67
|
+
256,
|
|
68
|
+
512,
|
|
69
|
+
1024,
|
|
70
|
+
2048,
|
|
71
|
+
4096,
|
|
72
|
+
8192,
|
|
73
|
+
16384,
|
|
74
|
+
32768,
|
|
75
|
+
65536,
|
|
76
|
+
131072,
|
|
77
|
+
262144,
|
|
78
|
+
524288,
|
|
79
|
+
1048576
|
|
80
|
+
]);
|
|
81
|
+
const OUTPUT_TOKEN_BUCKETS = Object.freeze([
|
|
82
|
+
0,
|
|
83
|
+
32,
|
|
84
|
+
64,
|
|
85
|
+
128,
|
|
86
|
+
256,
|
|
87
|
+
512,
|
|
88
|
+
1024,
|
|
89
|
+
2048,
|
|
90
|
+
4096,
|
|
91
|
+
8192,
|
|
92
|
+
16384,
|
|
93
|
+
32768,
|
|
94
|
+
65536,
|
|
95
|
+
131072
|
|
96
|
+
]);
|
|
97
|
+
function cachedInstruments(create) {
|
|
98
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
99
|
+
return () => {
|
|
100
|
+
const provider = import_api.metrics.getMeterProvider();
|
|
101
|
+
let instruments = cache.get(provider);
|
|
102
|
+
if (instruments === void 0) {
|
|
103
|
+
instruments = create(
|
|
104
|
+
provider.getMeter(import_attributes.GEN_AI_SYSTEM_VALUE, import_version.version, {
|
|
105
|
+
schemaUrl: import_attributes.SCHEMA_URL
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
cache.set(provider, instruments);
|
|
109
|
+
}
|
|
110
|
+
return instruments;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
__name(cachedInstruments, "cachedInstruments");
|
|
114
|
+
function createHistogram({
|
|
115
|
+
meter,
|
|
116
|
+
name,
|
|
117
|
+
unit,
|
|
118
|
+
description,
|
|
119
|
+
buckets
|
|
120
|
+
}) {
|
|
121
|
+
return meter.createHistogram(name, {
|
|
122
|
+
unit,
|
|
123
|
+
description,
|
|
124
|
+
...buckets === void 0 ? {} : { advice: { explicitBucketBoundaries: [...buckets] } }
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
__name(createHistogram, "createHistogram");
|
|
128
|
+
function createTokenHistograms(meter, prefix, scopeDescription) {
|
|
129
|
+
const tokenHistogram = /* @__PURE__ */ __name((suffix, meaning, buckets) => createHistogram({
|
|
130
|
+
meter,
|
|
131
|
+
name: `${prefix}.${suffix}`,
|
|
132
|
+
unit: "{token}",
|
|
133
|
+
description: `${meaning} Summed over ${scopeDescription}.`,
|
|
134
|
+
buckets
|
|
135
|
+
}), "tokenHistogram");
|
|
136
|
+
return {
|
|
137
|
+
input: tokenHistogram(
|
|
138
|
+
"input_tokens",
|
|
139
|
+
import_token_usage.INPUT_TOKENS_MEANING,
|
|
140
|
+
INPUT_TOKEN_BUCKETS
|
|
141
|
+
),
|
|
142
|
+
output: tokenHistogram(
|
|
143
|
+
"output_tokens",
|
|
144
|
+
import_token_usage.OUTPUT_TOKENS_MEANING,
|
|
145
|
+
OUTPUT_TOKEN_BUCKETS
|
|
146
|
+
),
|
|
147
|
+
total: tokenHistogram(
|
|
148
|
+
"total_tokens",
|
|
149
|
+
import_token_usage.TOTAL_TOKENS_MEANING,
|
|
150
|
+
INPUT_TOKEN_BUCKETS
|
|
151
|
+
),
|
|
152
|
+
cacheRead: tokenHistogram(
|
|
153
|
+
"cache_read.input_tokens",
|
|
154
|
+
import_token_usage.CACHE_READ_INPUT_TOKENS_MEANING,
|
|
155
|
+
INPUT_TOKEN_BUCKETS
|
|
156
|
+
),
|
|
157
|
+
reasoning: tokenHistogram(
|
|
158
|
+
"reasoning.output_tokens",
|
|
159
|
+
import_token_usage.REASONING_OUTPUT_TOKENS_MEANING,
|
|
160
|
+
OUTPUT_TOKEN_BUCKETS
|
|
161
|
+
),
|
|
162
|
+
toolInput: tokenHistogram(
|
|
163
|
+
"tool.input_tokens",
|
|
164
|
+
import_token_usage.TOOL_INPUT_TOKENS_MEANING,
|
|
165
|
+
INPUT_TOKEN_BUCKETS
|
|
166
|
+
)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
__name(createTokenHistograms, "createTokenHistograms");
|
|
170
|
+
function recordTokenHistograms(histograms, usage, attributes) {
|
|
171
|
+
var _a, _b, _c, _d, _e;
|
|
172
|
+
histograms.input.record((_a = usage.input) != null ? _a : 0, attributes);
|
|
173
|
+
histograms.output.record((_b = usage.output) != null ? _b : 0, attributes);
|
|
174
|
+
histograms.total.record(usage.totalTokenUsage(), attributes);
|
|
175
|
+
histograms.cacheRead.record((_c = usage.cacheRead) != null ? _c : 0, attributes);
|
|
176
|
+
histograms.reasoning.record((_d = usage.reasoning) != null ? _d : 0, attributes);
|
|
177
|
+
histograms.toolInput.record((_e = usage.toolInput) != null ? _e : 0, attributes);
|
|
178
|
+
}
|
|
179
|
+
__name(recordTokenHistograms, "recordTokenHistograms");
|
|
180
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
+
0 && (module.exports = {
|
|
182
|
+
CALL_COUNT_BUCKETS,
|
|
183
|
+
INPUT_TOKEN_BUCKETS,
|
|
184
|
+
OUTPUT_TOKEN_BUCKETS,
|
|
185
|
+
cachedInstruments,
|
|
186
|
+
createHistogram,
|
|
187
|
+
createTokenHistograms,
|
|
188
|
+
recordTokenHistograms
|
|
189
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
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
|
+
TOOL_DURATION_BUCKETS: () => TOOL_DURATION_BUCKETS,
|
|
29
|
+
recordSkillLoad: () => recordSkillLoad,
|
|
30
|
+
recordSkillScriptExecution: () => recordSkillScriptExecution,
|
|
31
|
+
recordToolDuration: () => recordToolDuration
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(tool_exports);
|
|
34
|
+
var import_attributes = require("../common/attributes.js");
|
|
35
|
+
var import_config = require("../common/config.js");
|
|
36
|
+
var import_meters = require("./meters.js");
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2026 Google LLC
|
|
40
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
41
|
+
*/
|
|
42
|
+
const HALLUCINATED = "<hallucinated>";
|
|
43
|
+
const TOOL_DURATION_BUCKETS = Object.freeze([
|
|
44
|
+
0.01,
|
|
45
|
+
0.02,
|
|
46
|
+
0.04,
|
|
47
|
+
0.08,
|
|
48
|
+
0.16,
|
|
49
|
+
0.32,
|
|
50
|
+
0.64,
|
|
51
|
+
1.28,
|
|
52
|
+
2.56,
|
|
53
|
+
5.12,
|
|
54
|
+
10.24,
|
|
55
|
+
20.48,
|
|
56
|
+
40.96,
|
|
57
|
+
81.92
|
|
58
|
+
]);
|
|
59
|
+
const getToolInstruments = (0, import_meters.cachedInstruments)((meter) => ({
|
|
60
|
+
duration: (0, import_meters.createHistogram)({
|
|
61
|
+
meter,
|
|
62
|
+
name: "gen_ai.execute_tool.duration",
|
|
63
|
+
unit: "s",
|
|
64
|
+
description: "Duration of tool executions.",
|
|
65
|
+
buckets: TOOL_DURATION_BUCKETS
|
|
66
|
+
}),
|
|
67
|
+
skillLoads: meter.createCounter("adk.experimental.skill.loads", {
|
|
68
|
+
unit: "1",
|
|
69
|
+
description: "Number of times a skill was loaded. Counts the attempt, so a load that resolved no skill is counted too, under its `error.type`."
|
|
70
|
+
}),
|
|
71
|
+
skillScriptExecutions: meter.createCounter(
|
|
72
|
+
"adk.experimental.skill.script.executions",
|
|
73
|
+
{
|
|
74
|
+
unit: "1",
|
|
75
|
+
description: "Number of skill script executions."
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
}));
|
|
79
|
+
function recordToolDuration({
|
|
80
|
+
agentName,
|
|
81
|
+
toolName,
|
|
82
|
+
toolType,
|
|
83
|
+
durationSeconds,
|
|
84
|
+
errorType
|
|
85
|
+
}) {
|
|
86
|
+
const attributes = {
|
|
87
|
+
[import_attributes.GenAiAttr.AGENT_NAME]: agentName,
|
|
88
|
+
[import_attributes.GenAiAttr.TOOL_NAME]: toolName,
|
|
89
|
+
[import_attributes.GenAiAttr.TOOL_TYPE]: toolType,
|
|
90
|
+
...errorType === void 0 ? {} : { [import_attributes.ERROR_TYPE_ATTR]: errorType }
|
|
91
|
+
};
|
|
92
|
+
getToolInstruments().duration.record(durationSeconds, attributes);
|
|
93
|
+
}
|
|
94
|
+
__name(recordToolDuration, "recordToolDuration");
|
|
95
|
+
function recordSkillLoad({
|
|
96
|
+
agentName,
|
|
97
|
+
skill,
|
|
98
|
+
errorType,
|
|
99
|
+
config
|
|
100
|
+
}) {
|
|
101
|
+
var _a;
|
|
102
|
+
if (!(0, import_config.isExperimentalFeatureEnabled)(config, "skills")) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const attributes = {
|
|
106
|
+
[import_attributes.GenAiAttr.AGENT_NAME]: agentName,
|
|
107
|
+
[import_attributes.GenAiAttr.SKILL_NAME]: (_a = skill == null ? void 0 : skill.frontmatter.name) != null ? _a : HALLUCINATED,
|
|
108
|
+
...errorType === void 0 ? {} : { [import_attributes.ERROR_TYPE_ATTR]: errorType }
|
|
109
|
+
};
|
|
110
|
+
getToolInstruments().skillLoads.add(1, attributes);
|
|
111
|
+
}
|
|
112
|
+
__name(recordSkillLoad, "recordSkillLoad");
|
|
113
|
+
function hasSkillScript(skill, scriptPath) {
|
|
114
|
+
var _a;
|
|
115
|
+
const scripts = (_a = skill == null ? void 0 : skill.resources) == null ? void 0 : _a.scripts;
|
|
116
|
+
if (!scripts) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
const relativePath = scriptPath.startsWith("scripts/") ? scriptPath.slice("scripts/".length) : scriptPath;
|
|
120
|
+
return Object.prototype.hasOwnProperty.call(scripts, relativePath) || Object.prototype.hasOwnProperty.call(scripts, scriptPath);
|
|
121
|
+
}
|
|
122
|
+
__name(hasSkillScript, "hasSkillScript");
|
|
123
|
+
function recordSkillScriptExecution({
|
|
124
|
+
agentName,
|
|
125
|
+
skill,
|
|
126
|
+
scriptPath,
|
|
127
|
+
config
|
|
128
|
+
}) {
|
|
129
|
+
var _a;
|
|
130
|
+
if (!(0, import_config.isExperimentalFeatureEnabled)(config, "skills")) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const attributes = {
|
|
134
|
+
[import_attributes.GenAiAttr.AGENT_NAME]: agentName,
|
|
135
|
+
[import_attributes.GenAiAttr.SKILL_NAME]: (_a = skill == null ? void 0 : skill.frontmatter.name) != null ? _a : HALLUCINATED,
|
|
136
|
+
[import_attributes.GenAiAttr.SKILL_RESOURCE_NAME]: hasSkillScript(skill, scriptPath) ? scriptPath : HALLUCINATED
|
|
137
|
+
};
|
|
138
|
+
getToolInstruments().skillScriptExecutions.add(1, attributes);
|
|
139
|
+
}
|
|
140
|
+
__name(recordSkillScriptExecution, "recordSkillScriptExecution");
|
|
141
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
142
|
+
0 && (module.exports = {
|
|
143
|
+
TOOL_DURATION_BUCKETS,
|
|
144
|
+
recordSkillLoad,
|
|
145
|
+
recordSkillScriptExecution,
|
|
146
|
+
recordToolDuration
|
|
147
|
+
});
|
|
@@ -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 workflow_exports = {};
|
|
27
|
+
__export(workflow_exports, {
|
|
28
|
+
recordWorkflowDuration: () => recordWorkflowDuration,
|
|
29
|
+
recordWorkflowTotals: () => recordWorkflowTotals
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(workflow_exports);
|
|
32
|
+
var import_attributes = require("../common/attributes.js");
|
|
33
|
+
var import_config = require("../common/config.js");
|
|
34
|
+
var import_meters = require("./meters.js");
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2026 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
39
|
+
*/
|
|
40
|
+
const PER_WORKFLOW = "one workflow invocation, across every agent that ran in it";
|
|
41
|
+
const getWorkflowInstruments = (0, import_meters.cachedInstruments)(
|
|
42
|
+
(meter) => ({
|
|
43
|
+
duration: (0, import_meters.createHistogram)({
|
|
44
|
+
meter,
|
|
45
|
+
name: "gen_ai.invoke_workflow.duration",
|
|
46
|
+
unit: "s",
|
|
47
|
+
description: "Duration of workflow invocations."
|
|
48
|
+
}),
|
|
49
|
+
inferenceCalls: (0, import_meters.createHistogram)({
|
|
50
|
+
meter,
|
|
51
|
+
name: "adk.experimental.invoke_workflow.inference_calls",
|
|
52
|
+
unit: "1",
|
|
53
|
+
description: `Number of inference (model) calls over ${PER_WORKFLOW}.`,
|
|
54
|
+
buckets: import_meters.CALL_COUNT_BUCKETS
|
|
55
|
+
}),
|
|
56
|
+
toolCalls: (0, import_meters.createHistogram)({
|
|
57
|
+
meter,
|
|
58
|
+
name: "adk.experimental.invoke_workflow.tool_calls",
|
|
59
|
+
unit: "1",
|
|
60
|
+
description: `Number of tool calls over ${PER_WORKFLOW}. Includes the \`transfer_to_agent\` calls that route between them.`,
|
|
61
|
+
buckets: import_meters.CALL_COUNT_BUCKETS
|
|
62
|
+
}),
|
|
63
|
+
skillLoads: (0, import_meters.createHistogram)({
|
|
64
|
+
meter,
|
|
65
|
+
name: "adk.experimental.invoke_workflow.skill.loads",
|
|
66
|
+
unit: "1",
|
|
67
|
+
description: `Number of skill loads over ${PER_WORKFLOW}.`,
|
|
68
|
+
buckets: import_meters.CALL_COUNT_BUCKETS
|
|
69
|
+
}),
|
|
70
|
+
compactions: (0, import_meters.createHistogram)({
|
|
71
|
+
meter,
|
|
72
|
+
name: "adk.experimental.invoke_workflow.compactions",
|
|
73
|
+
unit: "1",
|
|
74
|
+
description: `Number of conversation compactions over ${PER_WORKFLOW}. Counts every summary produced, including one the runner then discards because a newer turn changed the session meanwhile. Recorded whether or not the workflow compacted, so the share of turns that do is readable off the unnested datapoints.`,
|
|
75
|
+
buckets: import_meters.CALL_COUNT_BUCKETS
|
|
76
|
+
}),
|
|
77
|
+
tokens: (0, import_meters.createTokenHistograms)(
|
|
78
|
+
meter,
|
|
79
|
+
"adk.experimental.invoke_workflow",
|
|
80
|
+
PER_WORKFLOW
|
|
81
|
+
)
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
function recordWorkflowDuration({
|
|
85
|
+
workflowName,
|
|
86
|
+
durationSeconds,
|
|
87
|
+
nested,
|
|
88
|
+
errorType
|
|
89
|
+
}) {
|
|
90
|
+
const attributes = {
|
|
91
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "invoke_workflow",
|
|
92
|
+
...nested ? { [import_attributes.GenAiAttr.WORKFLOW_NESTED]: true } : {},
|
|
93
|
+
...errorType === void 0 ? {} : { [import_attributes.ERROR_TYPE_ATTR]: errorType },
|
|
94
|
+
...workflowName ? { [import_attributes.GenAiAttr.WORKFLOW_NAME]: workflowName } : {}
|
|
95
|
+
};
|
|
96
|
+
getWorkflowInstruments().duration.record(durationSeconds, attributes);
|
|
97
|
+
}
|
|
98
|
+
__name(recordWorkflowDuration, "recordWorkflowDuration");
|
|
99
|
+
function recordWorkflowTotals({
|
|
100
|
+
rootAgentName,
|
|
101
|
+
workflowName,
|
|
102
|
+
nested,
|
|
103
|
+
totals,
|
|
104
|
+
config
|
|
105
|
+
}) {
|
|
106
|
+
if (!(0, import_config.isExperimentalFeatureEnabled)(config, "workflow")) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const instruments = getWorkflowInstruments();
|
|
110
|
+
const attributes = {
|
|
111
|
+
[import_attributes.AdkAttr.EXPERIMENTAL_ROOT_AGENT_NAME]: rootAgentName,
|
|
112
|
+
...workflowName ? { [import_attributes.GenAiAttr.WORKFLOW_NAME]: workflowName } : {},
|
|
113
|
+
...nested ? { [import_attributes.GenAiAttr.WORKFLOW_NESTED]: true } : {}
|
|
114
|
+
};
|
|
115
|
+
if (totals.tokens !== void 0 && (0, import_config.isExperimentalFeatureEnabled)(config, "token_usage")) {
|
|
116
|
+
(0, import_meters.recordTokenHistograms)(instruments.tokens, totals.tokens, attributes);
|
|
117
|
+
}
|
|
118
|
+
instruments.inferenceCalls.record(totals.inferenceCalls, attributes);
|
|
119
|
+
instruments.toolCalls.record(totals.toolCalls, attributes);
|
|
120
|
+
if ((0, import_config.isExperimentalFeatureEnabled)(config, "skills")) {
|
|
121
|
+
instruments.skillLoads.record(totals.skillLoads, attributes);
|
|
122
|
+
}
|
|
123
|
+
if ((0, import_config.isExperimentalFeatureEnabled)(config, "compaction")) {
|
|
124
|
+
instruments.compactions.record(totals.compactions, attributes);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
__name(recordWorkflowTotals, "recordWorkflowTotals");
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
recordWorkflowDuration,
|
|
131
|
+
recordWorkflowTotals
|
|
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 agent_exports = {};
|
|
27
|
+
__export(agent_exports, {
|
|
28
|
+
buildAgentInvocationAttributes: () => buildAgentInvocationAttributes
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(agent_exports);
|
|
31
|
+
var import_attributes = require("../common/attributes.js");
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2026 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
36
|
+
*/
|
|
37
|
+
function buildAgentInvocationAttributes({
|
|
38
|
+
agent,
|
|
39
|
+
sessionId
|
|
40
|
+
}) {
|
|
41
|
+
return {
|
|
42
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "invoke_agent",
|
|
43
|
+
[import_attributes.GenAiAttr.AGENT_DESCRIPTION]: agent.description,
|
|
44
|
+
[import_attributes.GenAiAttr.AGENT_NAME]: agent.name,
|
|
45
|
+
...sessionId === void 0 ? {} : { [import_attributes.GenAiAttr.CONVERSATION_ID]: sessionId }
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
__name(buildAgentInvocationAttributes, "buildAgentInvocationAttributes");
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
buildAgentInvocationAttributes
|
|
52
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
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 compaction_exports = {};
|
|
27
|
+
__export(compaction_exports, {
|
|
28
|
+
buildCompactionResultAttributes: () => buildCompactionResultAttributes,
|
|
29
|
+
startCompactionSpan: () => startCompactionSpan
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(compaction_exports);
|
|
32
|
+
var import_compacted_event = require("../../../../events/compacted_event.js");
|
|
33
|
+
var import_case_utils = require("../../../../utils/case_utils.js");
|
|
34
|
+
var import_attributes = require("../common/attributes.js");
|
|
35
|
+
var import_provider_name = require("../common/provider_name.js");
|
|
36
|
+
var import_tracer = require("./tracer.js");
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2026 Google LLC
|
|
40
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
41
|
+
*/
|
|
42
|
+
function startCompactionSpan({
|
|
43
|
+
sessionId,
|
|
44
|
+
trigger
|
|
45
|
+
}) {
|
|
46
|
+
const triggerName = (0, import_case_utils.toSnakeCaseName)(trigger);
|
|
47
|
+
return (0, import_tracer.getTracer)().startSpan(`compact_events ${triggerName}`, {
|
|
48
|
+
attributes: {
|
|
49
|
+
[import_attributes.GenAiAttr.SYSTEM]: (0, import_provider_name.guessGeminiSystemName)(),
|
|
50
|
+
[import_attributes.GenAiAttr.OPERATION_NAME]: "compact_events",
|
|
51
|
+
[import_attributes.GenAiAttr.CONVERSATION_ID]: sessionId,
|
|
52
|
+
[import_attributes.GenAiAttr.COMPACTION_TRIGGER]: triggerName
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
__name(startCompactionSpan, "startCompactionSpan");
|
|
57
|
+
function buildCompactionResultAttributes(eventsBefore, eventsAfter) {
|
|
58
|
+
const before = new Set(eventsBefore);
|
|
59
|
+
const compactedEvent = eventsAfter.filter((event) => !before.has(event)).find(import_compacted_event.isCompactedEvent);
|
|
60
|
+
if (!compactedEvent) {
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
const { startTime, endTime } = compactedEvent;
|
|
64
|
+
return {
|
|
65
|
+
[import_attributes.GenAiAttr.COMPACTION_EVENT_COUNT]: eventsBefore.filter(
|
|
66
|
+
(event) => event.timestamp >= startTime && event.timestamp <= endTime
|
|
67
|
+
).length,
|
|
68
|
+
[import_attributes.GenAiAttr.COMPACTION_RESULT_EVENT_ID]: compactedEvent.id,
|
|
69
|
+
[import_attributes.GenAiAttr.COMPACTION_START_TIMESTAMP]: startTime,
|
|
70
|
+
[import_attributes.GenAiAttr.COMPACTION_END_TIMESTAMP]: endTime
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
__name(buildCompactionResultAttributes, "buildCompactionResultAttributes");
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
buildCompactionResultAttributes,
|
|
77
|
+
startCompactionSpan
|
|
78
|
+
});
|