@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,217 @@
|
|
|
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 genai_messages_exports = {};
|
|
27
|
+
__export(genai_messages_exports, {
|
|
28
|
+
buildOutputMessage: () => buildOutputMessage,
|
|
29
|
+
buildRequestOperationDetails: () => buildRequestOperationDetails,
|
|
30
|
+
withoutContent: () => withoutContent
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(genai_messages_exports);
|
|
33
|
+
var import_case_utils = require("../../../../utils/case_utils.js");
|
|
34
|
+
var import_attributes = require("./attributes.js");
|
|
35
|
+
var import_finish_reason = require("./finish_reason.js");
|
|
36
|
+
/**
|
|
37
|
+
* @license
|
|
38
|
+
* Copyright 2026 Google LLC
|
|
39
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
40
|
+
*/
|
|
41
|
+
const FUNCTION_TOOL_DEFINITION_TYPE = "function";
|
|
42
|
+
function toAnyValue(value, seen) {
|
|
43
|
+
if (value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
if (typeof value !== "object" || seen.has(value)) {
|
|
47
|
+
return "<not serializable>";
|
|
48
|
+
}
|
|
49
|
+
const nextSeen = new Set(seen).add(value);
|
|
50
|
+
if (Array.isArray(value)) {
|
|
51
|
+
return value.map((item) => toAnyValue(item, nextSeen));
|
|
52
|
+
}
|
|
53
|
+
const result = {};
|
|
54
|
+
for (const [key, item] of Object.entries(value)) {
|
|
55
|
+
if (item !== void 0) {
|
|
56
|
+
result[key] = toAnyValue(item, nextSeen);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
__name(toAnyValue, "toAnyValue");
|
|
62
|
+
function toOptionalMapping(value) {
|
|
63
|
+
if (value === void 0 || value === null) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const normalized = toAnyValue(value, /* @__PURE__ */ new Set());
|
|
67
|
+
return typeof normalized === "object" && normalized !== null && !Array.isArray(normalized) && !(normalized instanceof Uint8Array) ? normalized : { value: normalized };
|
|
68
|
+
}
|
|
69
|
+
__name(toOptionalMapping, "toOptionalMapping");
|
|
70
|
+
function toRole(role) {
|
|
71
|
+
if (role === "user") {
|
|
72
|
+
return "user";
|
|
73
|
+
}
|
|
74
|
+
if (role === "model") {
|
|
75
|
+
return "assistant";
|
|
76
|
+
}
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
__name(toRole, "toRole");
|
|
80
|
+
function toMessagePart(part, index) {
|
|
81
|
+
var _a, _b, _c, _d, _e, _f;
|
|
82
|
+
const fallbackId = /* @__PURE__ */ __name((name) => name ? `${name}_${index}` : `${index}`, "fallbackId");
|
|
83
|
+
if (part.text !== void 0) {
|
|
84
|
+
return { content: part.text, type: "text" };
|
|
85
|
+
}
|
|
86
|
+
if (part.inlineData) {
|
|
87
|
+
return { mime_type: (_a = part.inlineData.mimeType) != null ? _a : "", type: "blob" };
|
|
88
|
+
}
|
|
89
|
+
if (part.fileData) {
|
|
90
|
+
return {
|
|
91
|
+
mime_type: (_b = part.fileData.mimeType) != null ? _b : "",
|
|
92
|
+
uri: (_c = part.fileData.fileUri) != null ? _c : "",
|
|
93
|
+
type: "file_data"
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (part.functionCall) {
|
|
97
|
+
const call = part.functionCall;
|
|
98
|
+
return {
|
|
99
|
+
id: (_d = call.id) != null ? _d : fallbackId(call.name),
|
|
100
|
+
name: (_e = call.name) != null ? _e : "",
|
|
101
|
+
arguments: toOptionalMapping(call.args),
|
|
102
|
+
type: "tool_call"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (part.functionResponse) {
|
|
106
|
+
const response = part.functionResponse;
|
|
107
|
+
return {
|
|
108
|
+
id: (_f = response.id) != null ? _f : fallbackId(response.name),
|
|
109
|
+
response: toOptionalMapping(response.response),
|
|
110
|
+
type: "tool_call_response"
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return void 0;
|
|
114
|
+
}
|
|
115
|
+
__name(toMessagePart, "toMessagePart");
|
|
116
|
+
function toMessageParts(parts) {
|
|
117
|
+
return (parts != null ? parts : []).flatMap((part, index) => {
|
|
118
|
+
const converted = toMessagePart(part, index);
|
|
119
|
+
return converted ? [converted] : [];
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
__name(toMessageParts, "toMessageParts");
|
|
123
|
+
function toInputMessage(content) {
|
|
124
|
+
return { role: toRole(content.role), parts: toMessageParts(content.parts) };
|
|
125
|
+
}
|
|
126
|
+
__name(toInputMessage, "toInputMessage");
|
|
127
|
+
function isContent(value) {
|
|
128
|
+
return "parts" in value || "role" in value;
|
|
129
|
+
}
|
|
130
|
+
__name(isContent, "isContent");
|
|
131
|
+
function toParts(instruction) {
|
|
132
|
+
var _a;
|
|
133
|
+
if (typeof instruction === "string") {
|
|
134
|
+
return [{ text: instruction }];
|
|
135
|
+
}
|
|
136
|
+
if (Array.isArray(instruction)) {
|
|
137
|
+
return instruction.map(
|
|
138
|
+
(part) => typeof part === "string" ? { text: part } : part
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
return isContent(instruction) ? (_a = instruction.parts) != null ? _a : [] : [instruction];
|
|
142
|
+
}
|
|
143
|
+
__name(toParts, "toParts");
|
|
144
|
+
function toSystemInstructions(config) {
|
|
145
|
+
if (!(config == null ? void 0 : config.systemInstruction)) {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
return toMessageParts(toParts(config.systemInstruction));
|
|
149
|
+
}
|
|
150
|
+
__name(toSystemInstructions, "toSystemInstructions");
|
|
151
|
+
function toToolDefinitions(tool) {
|
|
152
|
+
var _a, _b, _c;
|
|
153
|
+
if (!("functionDeclarations" in tool) && "callTool" in tool) {
|
|
154
|
+
return [{ name: "UnserializableTool", type: "CallableTool" }];
|
|
155
|
+
}
|
|
156
|
+
const definitions = [];
|
|
157
|
+
for (const declaration of (_a = tool.functionDeclarations) != null ? _a : []) {
|
|
158
|
+
const parameters = (_b = declaration.parameters) != null ? _b : declaration.parametersJsonSchema;
|
|
159
|
+
definitions.push({
|
|
160
|
+
name: (_c = declaration.name) != null ? _c : "FunctionDeclaration",
|
|
161
|
+
description: declaration.description,
|
|
162
|
+
parameters: parameters === void 0 ? null : toOptionalMapping(parameters),
|
|
163
|
+
type: FUNCTION_TOOL_DEFINITION_TYPE
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
for (const [key, value] of Object.entries(tool)) {
|
|
167
|
+
if (key !== "functionDeclarations" && value !== void 0) {
|
|
168
|
+
const toolType = (0, import_case_utils.toSnakeCaseName)(key);
|
|
169
|
+
definitions.push({ name: toolType, type: toolType });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return definitions;
|
|
173
|
+
}
|
|
174
|
+
__name(toToolDefinitions, "toToolDefinitions");
|
|
175
|
+
function buildRequestOperationDetails(llmRequest) {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
return {
|
|
178
|
+
[import_attributes.GenAiAttr.INPUT_MESSAGES]: llmRequest.contents.map(toInputMessage),
|
|
179
|
+
[import_attributes.GenAiAttr.SYSTEM_INSTRUCTIONS]: toSystemInstructions(llmRequest.config),
|
|
180
|
+
[import_attributes.GenAiAttr.TOOL_DEFINITIONS]: ((_b = (_a = llmRequest.config) == null ? void 0 : _a.tools) != null ? _b : []).flatMap(
|
|
181
|
+
toToolDefinitions
|
|
182
|
+
)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
__name(buildRequestOperationDetails, "buildRequestOperationDetails");
|
|
186
|
+
function buildOutputMessage(llmResponse) {
|
|
187
|
+
if (!llmResponse.content) {
|
|
188
|
+
return void 0;
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
...toInputMessage(llmResponse.content),
|
|
192
|
+
finish_reason: (0, import_finish_reason.toOutputMessageFinishReason)(llmResponse.finishReason)
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
__name(buildOutputMessage, "buildOutputMessage");
|
|
196
|
+
function withoutContent(details) {
|
|
197
|
+
const toolDefinitions = details[import_attributes.GenAiAttr.TOOL_DEFINITIONS];
|
|
198
|
+
if (!(toolDefinitions == null ? void 0 : toolDefinitions.length)) {
|
|
199
|
+
return {};
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
[import_attributes.GenAiAttr.TOOL_DEFINITIONS]: toolDefinitions.map((definition) => {
|
|
203
|
+
if (typeof definition !== "object" || definition === null || Array.isArray(definition) || definition instanceof Uint8Array || !("parameters" in definition)) {
|
|
204
|
+
return definition;
|
|
205
|
+
}
|
|
206
|
+
const { parameters: _parameters, ...rest } = definition;
|
|
207
|
+
return rest;
|
|
208
|
+
})
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
__name(withoutContent, "withoutContent");
|
|
212
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
213
|
+
0 && (module.exports = {
|
|
214
|
+
buildOutputMessage,
|
|
215
|
+
buildRequestOperationDetails,
|
|
216
|
+
withoutContent
|
|
217
|
+
});
|
|
@@ -0,0 +1,169 @@
|
|
|
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 http_exchange_exports = {};
|
|
27
|
+
__export(http_exchange_exports, {
|
|
28
|
+
captureHttpExchange: () => captureHttpExchange
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(http_exchange_exports);
|
|
31
|
+
var import_error = require("./error.js");
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2026 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
36
|
+
*/
|
|
37
|
+
const MAX_BODY_LENGTH = 1e3;
|
|
38
|
+
const TRUNCATED_SUFFIX = "... [truncated]";
|
|
39
|
+
const SSE_BODY = "<SSE stream>";
|
|
40
|
+
const REDACTED_HEADER_VALUE = "<redacted>";
|
|
41
|
+
const REDACTED_QUERY_VALUE = "REDACTED";
|
|
42
|
+
const CREDENTIAL_HEADERS = /* @__PURE__ */ new Set([
|
|
43
|
+
"api-key",
|
|
44
|
+
"authorization",
|
|
45
|
+
"cookie",
|
|
46
|
+
"proxy-authorization",
|
|
47
|
+
"set-cookie",
|
|
48
|
+
"x-api-key",
|
|
49
|
+
"x-goog-api-key"
|
|
50
|
+
]);
|
|
51
|
+
function captureHttpExchange({
|
|
52
|
+
url,
|
|
53
|
+
init,
|
|
54
|
+
response,
|
|
55
|
+
captureBodies
|
|
56
|
+
}) {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const requestUrl = new URL(url);
|
|
59
|
+
const isEventStream = ((_a = response.headers.get("content-type")) != null ? _a : "").toLowerCase().includes("text/event-stream");
|
|
60
|
+
const responseCopy = captureBodies && !isEventStream ? response.clone() : void 0;
|
|
61
|
+
const requestBody = captureBodies ? readRequestBody(init == null ? void 0 : init.body) : void 0;
|
|
62
|
+
const exchange = {
|
|
63
|
+
method: ((_b = init == null ? void 0 : init.method) != null ? _b : "GET").toUpperCase(),
|
|
64
|
+
url: sanitizeUrl(requestUrl),
|
|
65
|
+
serverAddress: requestUrl.hostname.replace(/^\[(.*)\]$/, "$1"),
|
|
66
|
+
...requestUrl.port ? { serverPort: Number(requestUrl.port) } : {},
|
|
67
|
+
querySessionId: firstNonEmpty(
|
|
68
|
+
requestUrl.searchParams.getAll("sessionId"),
|
|
69
|
+
requestUrl.searchParams.getAll("session_id")
|
|
70
|
+
),
|
|
71
|
+
statusCode: response.status,
|
|
72
|
+
requestHeaders: redactHeaders(new Headers(init == null ? void 0 : init.headers)),
|
|
73
|
+
responseHeaders: redactHeaders(response.headers),
|
|
74
|
+
...requestBody === void 0 ? {} : { requestBody }
|
|
75
|
+
};
|
|
76
|
+
return withResponseBody(exchange, {
|
|
77
|
+
captureBodies,
|
|
78
|
+
isEventStream,
|
|
79
|
+
responseCopy
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
__name(captureHttpExchange, "captureHttpExchange");
|
|
83
|
+
async function withResponseBody(exchange, {
|
|
84
|
+
captureBodies,
|
|
85
|
+
isEventStream,
|
|
86
|
+
responseCopy
|
|
87
|
+
}) {
|
|
88
|
+
if (isEventStream) {
|
|
89
|
+
return { ...exchange, responseBody: SSE_BODY };
|
|
90
|
+
}
|
|
91
|
+
if (!captureBodies || responseCopy === void 0) {
|
|
92
|
+
return exchange;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
return { ...exchange, responseBody: truncate(await responseCopy.text()) };
|
|
96
|
+
} catch (error) {
|
|
97
|
+
return {
|
|
98
|
+
...exchange,
|
|
99
|
+
responseBody: `<failed to read body: ${(0, import_error.resolveErrorType)(error)}>`
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
__name(withResponseBody, "withResponseBody");
|
|
104
|
+
function readRequestBody(body) {
|
|
105
|
+
if (typeof body === "string") {
|
|
106
|
+
return truncate(body);
|
|
107
|
+
}
|
|
108
|
+
if (body instanceof URLSearchParams) {
|
|
109
|
+
return truncate(body.toString());
|
|
110
|
+
}
|
|
111
|
+
if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) {
|
|
112
|
+
return truncate(new TextDecoder().decode(body));
|
|
113
|
+
}
|
|
114
|
+
return void 0;
|
|
115
|
+
}
|
|
116
|
+
__name(readRequestBody, "readRequestBody");
|
|
117
|
+
function truncate(text) {
|
|
118
|
+
if (text.length <= MAX_BODY_LENGTH) {
|
|
119
|
+
return text;
|
|
120
|
+
}
|
|
121
|
+
let end = 0;
|
|
122
|
+
let count = 0;
|
|
123
|
+
for (const character of text) {
|
|
124
|
+
if (count === MAX_BODY_LENGTH) {
|
|
125
|
+
return text.slice(0, end) + TRUNCATED_SUFFIX;
|
|
126
|
+
}
|
|
127
|
+
end += character.length;
|
|
128
|
+
count++;
|
|
129
|
+
}
|
|
130
|
+
return text;
|
|
131
|
+
}
|
|
132
|
+
__name(truncate, "truncate");
|
|
133
|
+
function sanitizeUrl(url) {
|
|
134
|
+
const sanitized = new URL(url);
|
|
135
|
+
sanitized.username = "";
|
|
136
|
+
sanitized.password = "";
|
|
137
|
+
if (sanitized.search) {
|
|
138
|
+
const keys = /* @__PURE__ */ new Set();
|
|
139
|
+
for (const [key, value] of sanitized.searchParams) {
|
|
140
|
+
if (value) {
|
|
141
|
+
keys.add(key);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
sanitized.search = new URLSearchParams(
|
|
145
|
+
Array.from(keys, (key) => [key, REDACTED_QUERY_VALUE])
|
|
146
|
+
).toString();
|
|
147
|
+
}
|
|
148
|
+
return sanitized.href;
|
|
149
|
+
}
|
|
150
|
+
__name(sanitizeUrl, "sanitizeUrl");
|
|
151
|
+
function redactHeaders(headers) {
|
|
152
|
+
const redacted = /* @__PURE__ */ new Map();
|
|
153
|
+
headers.forEach((value, name) => {
|
|
154
|
+
redacted.set(
|
|
155
|
+
name,
|
|
156
|
+
CREDENTIAL_HEADERS.has(name) ? REDACTED_HEADER_VALUE : value
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
return redacted;
|
|
160
|
+
}
|
|
161
|
+
__name(redactHeaders, "redactHeaders");
|
|
162
|
+
function firstNonEmpty(...candidates) {
|
|
163
|
+
return candidates.flat().find((value) => value !== "");
|
|
164
|
+
}
|
|
165
|
+
__name(firstNonEmpty, "firstNonEmpty");
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
captureHttpExchange
|
|
169
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
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 provider_name_exports = {};
|
|
27
|
+
__export(provider_name_exports, {
|
|
28
|
+
guessGeminiSystemName: () => guessGeminiSystemName,
|
|
29
|
+
resolveProviderName: () => resolveProviderName
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(provider_name_exports);
|
|
32
|
+
var import_env_aware_utils = require("../../../../utils/env_aware_utils.js");
|
|
33
|
+
var import_model_name = require("../../../../utils/model_name.js");
|
|
34
|
+
/**
|
|
35
|
+
* @license
|
|
36
|
+
* Copyright 2026 Google LLC
|
|
37
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
38
|
+
*/
|
|
39
|
+
const ANTHROPIC_MODEL_PATTERN = /^claude[-.]/i;
|
|
40
|
+
const RESOURCE_COLLECTION_SEGMENTS = /* @__PURE__ */ new Set([
|
|
41
|
+
"endpoints",
|
|
42
|
+
"locations",
|
|
43
|
+
"models",
|
|
44
|
+
"projects",
|
|
45
|
+
"publishers",
|
|
46
|
+
"tunedmodels"
|
|
47
|
+
]);
|
|
48
|
+
const PROVIDER_NAME_BY_SYSTEM_NAME = {
|
|
49
|
+
gemini: "gcp.gemini",
|
|
50
|
+
vertex_ai: "gcp.vertex_ai"
|
|
51
|
+
};
|
|
52
|
+
function guessGeminiSystemName() {
|
|
53
|
+
return (0, import_env_aware_utils.isEnterpriseModeEnabled)() ? "vertex_ai" : "gemini";
|
|
54
|
+
}
|
|
55
|
+
__name(guessGeminiSystemName, "guessGeminiSystemName");
|
|
56
|
+
function systemNameFromModel(model) {
|
|
57
|
+
if (!model) {
|
|
58
|
+
return void 0;
|
|
59
|
+
}
|
|
60
|
+
if ((0, import_model_name.isGeminiModel)(model)) {
|
|
61
|
+
return guessGeminiSystemName();
|
|
62
|
+
}
|
|
63
|
+
const modelName = (0, import_model_name.extractModelName)(model);
|
|
64
|
+
if (ANTHROPIC_MODEL_PATTERN.test(modelName)) {
|
|
65
|
+
return "anthropic";
|
|
66
|
+
}
|
|
67
|
+
const separator = modelName.indexOf("/");
|
|
68
|
+
if (separator > 0) {
|
|
69
|
+
const provider = modelName.slice(0, separator).toLowerCase();
|
|
70
|
+
if (!RESOURCE_COLLECTION_SEGMENTS.has(provider)) {
|
|
71
|
+
return provider;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
__name(systemNameFromModel, "systemNameFromModel");
|
|
77
|
+
function resolveProviderName(model) {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
const systemName = (_a = systemNameFromModel(model)) != null ? _a : guessGeminiSystemName();
|
|
80
|
+
return (_b = PROVIDER_NAME_BY_SYSTEM_NAME[systemName]) != null ? _b : systemName;
|
|
81
|
+
}
|
|
82
|
+
__name(resolveProviderName, "resolveProviderName");
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
guessGeminiSystemName,
|
|
86
|
+
resolveProviderName
|
|
87
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
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 redaction_exports = {};
|
|
27
|
+
__export(redaction_exports, {
|
|
28
|
+
redactCredentialSecrets: () => redactCredentialSecrets
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(redaction_exports);
|
|
31
|
+
var import_framework_function_calls = require("../../../../agents/framework_function_calls.js");
|
|
32
|
+
var import_auth_credential = require("../../../../auth/auth_credential.js");
|
|
33
|
+
/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2026 Google LLC
|
|
36
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
37
|
+
*/
|
|
38
|
+
const CREDENTIAL_SECRET_KEYS = /* @__PURE__ */ new Set([
|
|
39
|
+
"password",
|
|
40
|
+
"token",
|
|
41
|
+
"additionalHeaders",
|
|
42
|
+
"additional_headers",
|
|
43
|
+
"clientSecret",
|
|
44
|
+
"client_secret",
|
|
45
|
+
"authResponseUri",
|
|
46
|
+
"auth_response_uri",
|
|
47
|
+
"authCode",
|
|
48
|
+
"auth_code",
|
|
49
|
+
"accessToken",
|
|
50
|
+
"access_token",
|
|
51
|
+
"refreshToken",
|
|
52
|
+
"refresh_token",
|
|
53
|
+
"idToken",
|
|
54
|
+
"id_token",
|
|
55
|
+
"codeVerifier",
|
|
56
|
+
"code_verifier",
|
|
57
|
+
"privateKeyId",
|
|
58
|
+
"private_key_id",
|
|
59
|
+
"privateKey",
|
|
60
|
+
"private_key",
|
|
61
|
+
"apiKey",
|
|
62
|
+
"api_key"
|
|
63
|
+
]);
|
|
64
|
+
const CREDENTIAL_CARRIER_KEYS = /* @__PURE__ */ new Set([
|
|
65
|
+
"requestedAuthConfigs",
|
|
66
|
+
"requested_auth_configs",
|
|
67
|
+
"rawAuthCredential",
|
|
68
|
+
"raw_auth_credential",
|
|
69
|
+
"exchangedAuthCredential",
|
|
70
|
+
"exchanged_auth_credential"
|
|
71
|
+
]);
|
|
72
|
+
const AUTH_TYPE_VALUES = new Set(
|
|
73
|
+
Object.entries(import_auth_credential.AuthCredentialTypes).flatMap(([name, value]) => [
|
|
74
|
+
value,
|
|
75
|
+
name,
|
|
76
|
+
name.toLowerCase()
|
|
77
|
+
])
|
|
78
|
+
);
|
|
79
|
+
function isRecord(value) {
|
|
80
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
81
|
+
}
|
|
82
|
+
__name(isRecord, "isRecord");
|
|
83
|
+
function redactAuthConfigSecrets(value) {
|
|
84
|
+
if (Array.isArray(value)) {
|
|
85
|
+
return value.map(redactAuthConfigSecrets);
|
|
86
|
+
}
|
|
87
|
+
if (!isRecord(value)) {
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
return Object.fromEntries(
|
|
91
|
+
Object.entries(value).filter(([key]) => !CREDENTIAL_SECRET_KEYS.has(key)).map(([key, item]) => [key, redactAuthConfigSecrets(item)])
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
__name(redactAuthConfigSecrets, "redactAuthConfigSecrets");
|
|
95
|
+
function isAuthCredential(value) {
|
|
96
|
+
return ["authType", "auth_type"].some((key) => {
|
|
97
|
+
const authType = value[key];
|
|
98
|
+
return typeof authType === "string" && AUTH_TYPE_VALUES.has(authType);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
__name(isAuthCredential, "isAuthCredential");
|
|
102
|
+
function redactCredentialRequest(value) {
|
|
103
|
+
return Object.fromEntries(
|
|
104
|
+
Object.entries(value).map(([key, item]) => {
|
|
105
|
+
if (key === "args" && isRecord(item)) {
|
|
106
|
+
return [
|
|
107
|
+
key,
|
|
108
|
+
Object.fromEntries(
|
|
109
|
+
Object.entries(item).map(([argKey, arg]) => [
|
|
110
|
+
argKey,
|
|
111
|
+
argKey === "authConfig" || argKey === "auth_config" ? redactAuthConfigSecrets(arg) : arg
|
|
112
|
+
])
|
|
113
|
+
)
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
if (key === "response") {
|
|
117
|
+
return [key, redactAuthConfigSecrets(item)];
|
|
118
|
+
}
|
|
119
|
+
return [key, redactCredentialSecrets(item)];
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
__name(redactCredentialRequest, "redactCredentialRequest");
|
|
124
|
+
function redactCredentialSecrets(value) {
|
|
125
|
+
if (Array.isArray(value)) {
|
|
126
|
+
return value.map(redactCredentialSecrets);
|
|
127
|
+
}
|
|
128
|
+
if (!isRecord(value)) {
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
if (isAuthCredential(value)) {
|
|
132
|
+
return redactAuthConfigSecrets(value);
|
|
133
|
+
}
|
|
134
|
+
if (value["name"] === import_framework_function_calls.REQUEST_CREDENTIAL_FUNCTION_CALL_NAME) {
|
|
135
|
+
return redactCredentialRequest(value);
|
|
136
|
+
}
|
|
137
|
+
return Object.fromEntries(
|
|
138
|
+
Object.entries(value).map(([key, item]) => [
|
|
139
|
+
key,
|
|
140
|
+
CREDENTIAL_CARRIER_KEYS.has(key) ? redactAuthConfigSecrets(item) : redactCredentialSecrets(item)
|
|
141
|
+
])
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
__name(redactCredentialSecrets, "redactCredentialSecrets");
|
|
145
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
146
|
+
0 && (module.exports = {
|
|
147
|
+
redactCredentialSecrets
|
|
148
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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 serialization_exports = {};
|
|
27
|
+
__export(serialization_exports, {
|
|
28
|
+
safeJsonSerialize: () => safeJsonSerialize,
|
|
29
|
+
shouldAddRequestResponseToSpans: () => shouldAddRequestResponseToSpans
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(serialization_exports);
|
|
32
|
+
var import_env_aware_utils = require("../../../../utils/env_aware_utils.js");
|
|
33
|
+
/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2026 Google LLC
|
|
36
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
37
|
+
*/
|
|
38
|
+
function safeJsonSerialize(obj) {
|
|
39
|
+
try {
|
|
40
|
+
return JSON.stringify(
|
|
41
|
+
obj,
|
|
42
|
+
(_key, value) => typeof value === "bigint" ? "<not serializable>" : value
|
|
43
|
+
);
|
|
44
|
+
} catch (_e) {
|
|
45
|
+
return "<not serializable>";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
__name(safeJsonSerialize, "safeJsonSerialize");
|
|
49
|
+
function shouldAddRequestResponseToSpans() {
|
|
50
|
+
const envValue = (0, import_env_aware_utils.getEnvVar)("ADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS") || "true";
|
|
51
|
+
return envValue === "true" || envValue === "1";
|
|
52
|
+
}
|
|
53
|
+
__name(shouldAddRequestResponseToSpans, "shouldAddRequestResponseToSpans");
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
safeJsonSerialize,
|
|
57
|
+
shouldAddRequestResponseToSpans
|
|
58
|
+
});
|