@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
|
@@ -40,8 +40,16 @@ let ContainerCodeExecutor = class extends BaseCodeExecutor {
|
|
|
40
40
|
constructor(options = {}) {
|
|
41
41
|
var _a, _b, _c;
|
|
42
42
|
super();
|
|
43
|
+
/** Started session containers, ordered from least to most recently used. */
|
|
43
44
|
this.containers = /* @__PURE__ */ new Map();
|
|
45
|
+
/** Container starts that are still in flight, keyed by session. */
|
|
44
46
|
this.initPromises = /* @__PURE__ */ new Map();
|
|
47
|
+
/**
|
|
48
|
+
* Number of `executeCode` calls in progress per session. A session with a
|
|
49
|
+
* call in progress is never evicted, so a run is not stopped midway.
|
|
50
|
+
*/
|
|
51
|
+
this.activeExecutions = /* @__PURE__ */ new Map();
|
|
52
|
+
this.closing = false;
|
|
45
53
|
if (!options.image && !options.dockerPath) {
|
|
46
54
|
throw new Error(
|
|
47
55
|
"Either image or dockerPath must be set for ContainerCodeExecutor."
|
|
@@ -53,6 +61,12 @@ let ContainerCodeExecutor = class extends BaseCodeExecutor {
|
|
|
53
61
|
"timeoutSeconds must be greater than 0 for ContainerCodeExecutor."
|
|
54
62
|
);
|
|
55
63
|
}
|
|
64
|
+
this.maxContainers = options.maxContainers;
|
|
65
|
+
if (this.maxContainers !== void 0 && (!Number.isInteger(this.maxContainers) || this.maxContainers < 1)) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
"maxContainers must be a positive integer for ContainerCodeExecutor."
|
|
68
|
+
);
|
|
69
|
+
}
|
|
56
70
|
this.dockerPath = options.dockerPath ? path.resolve(options.dockerPath) : void 0;
|
|
57
71
|
this.containerOptions = {
|
|
58
72
|
image: (_b = options.image) != null ? _b : DEFAULT_IMAGE_TAG,
|
|
@@ -64,6 +78,7 @@ let ContainerCodeExecutor = class extends BaseCodeExecutor {
|
|
|
64
78
|
defineFrozenFalse(this, "optimizeDataFile");
|
|
65
79
|
}
|
|
66
80
|
async executeCode(params) {
|
|
81
|
+
var _a, _b;
|
|
67
82
|
const { code, language } = params.codeExecutionInput;
|
|
68
83
|
const command = LANGUAGE_RUNTIME_COMMAND_MAP[language];
|
|
69
84
|
if (!command) {
|
|
@@ -72,20 +87,31 @@ let ContainerCodeExecutor = class extends BaseCodeExecutor {
|
|
|
72
87
|
);
|
|
73
88
|
}
|
|
74
89
|
const key = sessionKey(params.invocationContext);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
this.activeExecutions.set(key, ((_a = this.activeExecutions.get(key)) != null ? _a : 0) + 1);
|
|
91
|
+
try {
|
|
92
|
+
const container = await this.ensureContainer(key);
|
|
93
|
+
const { stdout, stderr, exitCode } = await container.execute(
|
|
94
|
+
[...TIMEOUT_COMMAND, String(this.timeoutSeconds), ...command, code],
|
|
95
|
+
this.timeoutSeconds
|
|
96
|
+
);
|
|
97
|
+
logger.debug(`Executed ${language} code:
|
|
81
98
|
\`\`\`
|
|
82
99
|
${code}
|
|
83
100
|
\`\`\``);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
return {
|
|
102
|
+
stdout,
|
|
103
|
+
stderr: this.describeExit(stderr, exitCode),
|
|
104
|
+
outputFiles: []
|
|
105
|
+
};
|
|
106
|
+
} finally {
|
|
107
|
+
const remaining = ((_b = this.activeExecutions.get(key)) != null ? _b : 1) - 1;
|
|
108
|
+
if (remaining > 0) {
|
|
109
|
+
this.activeExecutions.set(key, remaining);
|
|
110
|
+
} else {
|
|
111
|
+
this.activeExecutions.delete(key);
|
|
112
|
+
}
|
|
113
|
+
this.evictLeastRecentlyUsed();
|
|
114
|
+
}
|
|
89
115
|
}
|
|
90
116
|
/**
|
|
91
117
|
* Turns a non-zero exit into stderr the model can see. An empty stderr maps
|
|
@@ -105,41 +131,134 @@ ${message}` : message;
|
|
|
105
131
|
return stderr;
|
|
106
132
|
}
|
|
107
133
|
/**
|
|
108
|
-
* Stops and removes every session's container.
|
|
109
|
-
*
|
|
134
|
+
* Stops and removes every session's container. Waits for container starts
|
|
135
|
+
* that are still in flight, so no container is left running after it
|
|
136
|
+
* resolves. Safe to call when none has been started, and concurrent calls
|
|
137
|
+
* share one teardown. Provided for deterministic teardown in tests and app
|
|
110
138
|
* shutdown.
|
|
111
139
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.
|
|
115
|
-
|
|
116
|
-
|
|
140
|
+
close() {
|
|
141
|
+
var _a;
|
|
142
|
+
(_a = this.closePromise) != null ? _a : this.closePromise = this.stopAll().finally(() => {
|
|
143
|
+
this.closePromise = void 0;
|
|
144
|
+
});
|
|
145
|
+
return this.closePromise;
|
|
146
|
+
}
|
|
147
|
+
async stopAll() {
|
|
148
|
+
this.closing = true;
|
|
149
|
+
try {
|
|
150
|
+
while (this.initPromises.size > 0) {
|
|
151
|
+
await Promise.allSettled([...this.initPromises.values()]);
|
|
152
|
+
}
|
|
153
|
+
const containers = [...this.containers.values()];
|
|
154
|
+
this.containers.clear();
|
|
155
|
+
this.initPromises.clear();
|
|
156
|
+
await Promise.allSettled(containers.map((container) => container.stop()));
|
|
157
|
+
} finally {
|
|
158
|
+
this.closing = false;
|
|
159
|
+
}
|
|
117
160
|
}
|
|
118
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* Returns the given session's container, starting it if needed. Concurrent
|
|
163
|
+
* calls for one session share a single in-flight start, and reuse marks the
|
|
164
|
+
* container as the most recently used.
|
|
165
|
+
*/
|
|
119
166
|
ensureContainer(key) {
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
167
|
+
const existing = this.containers.get(key);
|
|
168
|
+
if (existing) {
|
|
169
|
+
this.containers.delete(key);
|
|
170
|
+
this.containers.set(key, existing);
|
|
171
|
+
return Promise.resolve(existing);
|
|
172
|
+
}
|
|
173
|
+
const inFlight = this.initPromises.get(key);
|
|
174
|
+
if (inFlight) {
|
|
175
|
+
return inFlight;
|
|
176
|
+
}
|
|
177
|
+
const initPromise = this.initContainer(
|
|
178
|
+
key
|
|
179
|
+
).finally(() => {
|
|
180
|
+
if (this.initPromises.get(key) === initPromise) {
|
|
123
181
|
this.initPromises.delete(key);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
this.initPromises.set(key, initPromise);
|
|
185
|
+
return initPromise;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Builds the image from `dockerPath` once and shares the build across every
|
|
189
|
+
* session. A failed build is cleared so the next call retries it.
|
|
190
|
+
*/
|
|
191
|
+
ensureImageBuilt() {
|
|
192
|
+
var _a;
|
|
193
|
+
const dockerPath = this.dockerPath;
|
|
194
|
+
if (!dockerPath) {
|
|
195
|
+
return Promise.resolve();
|
|
127
196
|
}
|
|
128
|
-
|
|
197
|
+
(_a = this.buildPromise) != null ? _a : this.buildPromise = new DockerContainer(this.containerOptions).build(dockerPath).catch((error) => {
|
|
198
|
+
this.buildPromise = void 0;
|
|
199
|
+
throw error;
|
|
200
|
+
});
|
|
201
|
+
return this.buildPromise;
|
|
129
202
|
}
|
|
130
203
|
async initContainer(key) {
|
|
204
|
+
await this.ensureImageBuilt();
|
|
205
|
+
if (this.closing) {
|
|
206
|
+
throw new Error(
|
|
207
|
+
"ContainerCodeExecutor closed during container initialization."
|
|
208
|
+
);
|
|
209
|
+
}
|
|
131
210
|
const container = new DockerContainer(this.containerOptions);
|
|
132
|
-
|
|
133
|
-
await container.
|
|
211
|
+
try {
|
|
212
|
+
await container.start();
|
|
213
|
+
const { exitCode } = await container.execute(
|
|
214
|
+
["which", "python3"],
|
|
215
|
+
this.timeoutSeconds
|
|
216
|
+
);
|
|
217
|
+
if (exitCode !== 0) {
|
|
218
|
+
throw new Error("python3 is not installed in the container.");
|
|
219
|
+
}
|
|
220
|
+
} catch (error) {
|
|
221
|
+
await container.stop().catch((stopError) => {
|
|
222
|
+
logger.debug(
|
|
223
|
+
`Failed to stop container after failed start: ${stopError}`
|
|
224
|
+
);
|
|
225
|
+
});
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
if (this.closing) {
|
|
229
|
+
await container.stop().catch((stopError) => {
|
|
230
|
+
logger.debug(`Failed to stop container during close: ${stopError}`);
|
|
231
|
+
});
|
|
232
|
+
throw new Error(
|
|
233
|
+
"ContainerCodeExecutor closed during container initialization."
|
|
234
|
+
);
|
|
134
235
|
}
|
|
135
|
-
await container.start();
|
|
136
236
|
this.containers.set(key, container);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
237
|
+
this.evictLeastRecentlyUsed();
|
|
238
|
+
return container;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Stops the least recently used idle session containers until the count is
|
|
242
|
+
* within `maxContainers`. A session with a call in progress is skipped, which
|
|
243
|
+
* includes the caller that just registered its container; if every session
|
|
244
|
+
* is busy, the overshoot stays until a call ends. The stop is not awaited so
|
|
245
|
+
* the caller is not delayed by another session's teardown.
|
|
246
|
+
*/
|
|
247
|
+
evictLeastRecentlyUsed() {
|
|
248
|
+
if (this.maxContainers === void 0) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
for (const [key, container] of this.containers) {
|
|
252
|
+
if (this.containers.size <= this.maxContainers) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (this.activeExecutions.has(key)) {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
this.containers.delete(key);
|
|
259
|
+
void container.stop().catch((error) => {
|
|
260
|
+
logger.debug(`Failed to stop evicted container: ${error}`);
|
|
261
|
+
});
|
|
143
262
|
}
|
|
144
263
|
}
|
|
145
264
|
};
|
|
@@ -148,7 +267,10 @@ ContainerCodeExecutor = __decorateClass([
|
|
|
148
267
|
experimental
|
|
149
268
|
], ContainerCodeExecutor);
|
|
150
269
|
function sessionKey(invocationContext) {
|
|
151
|
-
const session = invocationContext.session;
|
|
270
|
+
const session = invocationContext == null ? void 0 : invocationContext.session;
|
|
271
|
+
if (!session) {
|
|
272
|
+
return "default";
|
|
273
|
+
}
|
|
152
274
|
return JSON.stringify([session.appName, session.userId, session.id]);
|
|
153
275
|
}
|
|
154
276
|
__name(sessionKey, "sessionKey");
|
package/dist/esm/common.js
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
handleFunctionCallsLive,
|
|
19
19
|
isToolNotFound
|
|
20
20
|
} from "./agents/functions.js";
|
|
21
|
+
import { injectSessionState } from "./agents/instructions.js";
|
|
21
22
|
import {
|
|
22
23
|
InvocationContext,
|
|
23
24
|
LlmCallsLimitExceededError,
|
|
@@ -181,11 +182,29 @@ import {
|
|
|
181
182
|
import { BaseSessionService } from "./sessions/base_session_service.js";
|
|
182
183
|
import { InMemorySessionService } from "./sessions/in_memory_session_service.js";
|
|
183
184
|
import { createSession } from "./sessions/session.js";
|
|
185
|
+
import {
|
|
186
|
+
StaleSessionError,
|
|
187
|
+
isStaleSessionError
|
|
188
|
+
} from "./sessions/stale_session_error.js";
|
|
184
189
|
import { State, StateSchemaError, isStateSchemaError } from "./sessions/state.js";
|
|
185
190
|
import { AgentTool, isAgentTool } from "./tools/agent_tool.js";
|
|
186
191
|
import { BaseTool, isBaseTool } from "./tools/base_tool.js";
|
|
187
192
|
import { BaseToolset, isBaseToolset } from "./tools/base_toolset.js";
|
|
188
193
|
import { BuiltInTool } from "./tools/built_in_tool.js";
|
|
194
|
+
import {
|
|
195
|
+
BaseComputer,
|
|
196
|
+
ComputerEnvironment,
|
|
197
|
+
isBaseComputer
|
|
198
|
+
} from "./tools/computer_use/base_computer.js";
|
|
199
|
+
import {
|
|
200
|
+
ComputerUseTool,
|
|
201
|
+
isComputerUseTool
|
|
202
|
+
} from "./tools/computer_use/computer_use_tool.js";
|
|
203
|
+
import {
|
|
204
|
+
ComputerUseToolset,
|
|
205
|
+
adaptComputerUseTool,
|
|
206
|
+
isComputerUseToolset
|
|
207
|
+
} from "./tools/computer_use/computer_use_toolset.js";
|
|
189
208
|
import { ConsolidateContextTool } from "./tools/consolidate_context_tool.js";
|
|
190
209
|
import {
|
|
191
210
|
ENTERPRISE_WEB_SEARCH,
|
|
@@ -239,6 +258,7 @@ import { renameReservedKeywords, toSnakeCaseName } from "./utils/case_utils.js";
|
|
|
239
258
|
import { getClientLabels, runWithClientLabel } from "./utils/client_labels.js";
|
|
240
259
|
import { toGeminiSchema } from "./utils/gemini_schema_util.js";
|
|
241
260
|
import { genaiSchemaToJsonSchema } from "./utils/genai_schema_to_json.js";
|
|
261
|
+
import { newId, resetIdProvider, setIdProvider } from "./utils/id_provider.js";
|
|
242
262
|
import {
|
|
243
263
|
LogLevel,
|
|
244
264
|
getLogger,
|
|
@@ -268,7 +288,11 @@ import { SearchSkillsTool } from "./tools/skill/search_skills_tool.js";
|
|
|
268
288
|
export * from "./artifacts/base_artifact_service.js";
|
|
269
289
|
export * from "./features/feature_registry.js";
|
|
270
290
|
export * from "./memory/base_memory_service.js";
|
|
271
|
-
|
|
291
|
+
import {
|
|
292
|
+
mergeStates,
|
|
293
|
+
trimTempDeltaState,
|
|
294
|
+
trimTempState
|
|
295
|
+
} from "./sessions/base_session_service.js";
|
|
272
296
|
export * from "./tools/base_tool.js";
|
|
273
297
|
import {
|
|
274
298
|
BaseNode,
|
|
@@ -300,6 +324,7 @@ import {
|
|
|
300
324
|
isNodeSchemaValidationError,
|
|
301
325
|
isNodeState,
|
|
302
326
|
isNodeTimeoutError,
|
|
327
|
+
isParallelWorker,
|
|
303
328
|
isRequestInput,
|
|
304
329
|
isRunnableRoot,
|
|
305
330
|
isWorkflow,
|
|
@@ -308,13 +333,10 @@ import {
|
|
|
308
333
|
prepareRetryConfig
|
|
309
334
|
} from "./workflow/index.js";
|
|
310
335
|
import { App, isApp, validateAppName } from "./apps/app.js";
|
|
311
|
-
|
|
312
|
-
export * from "./features/feature_registry.js";
|
|
313
|
-
export * from "./memory/base_memory_service.js";
|
|
314
|
-
export * from "./sessions/base_session_service.js";
|
|
315
|
-
export * from "./tools/base_tool.js";
|
|
336
|
+
import { RUNNER_CLEANUP_TIMEOUT_MS, closeRunners } from "./cli/utils/cleanup.js";
|
|
316
337
|
import {
|
|
317
338
|
convertSessionToEvalFormat,
|
|
339
|
+
convertSessionToEvalInvocations,
|
|
318
340
|
createEmptyState
|
|
319
341
|
} from "./cli/utils/evals.js";
|
|
320
342
|
import {
|
|
@@ -344,6 +366,7 @@ export {
|
|
|
344
366
|
AuthSchemeType,
|
|
345
367
|
BaseAgent,
|
|
346
368
|
BaseCodeExecutor,
|
|
369
|
+
BaseComputer,
|
|
347
370
|
BaseEnvironment,
|
|
348
371
|
BaseExampleProvider,
|
|
349
372
|
BaseLlm,
|
|
@@ -366,6 +389,9 @@ export {
|
|
|
366
389
|
ChromeModelUnavailableError,
|
|
367
390
|
CodeExecutionLanguage,
|
|
368
391
|
CodeExecutionResponseProcessor,
|
|
392
|
+
ComputerEnvironment,
|
|
393
|
+
ComputerUseTool,
|
|
394
|
+
ComputerUseToolset,
|
|
369
395
|
ConsolidateContextTool,
|
|
370
396
|
ContentRequestProcessor,
|
|
371
397
|
Context,
|
|
@@ -450,6 +476,7 @@ export {
|
|
|
450
476
|
REQUEST_INPUT_FUNCTION_CALL_NAME,
|
|
451
477
|
RESERVED_TOOL_CALL_ERROR_TYPE,
|
|
452
478
|
RESTORED_EVENT_KEY,
|
|
479
|
+
RUNNER_CLEANUP_TIMEOUT_MS,
|
|
453
480
|
ReadonlyContext,
|
|
454
481
|
ReflectAndRetryModelPlugin,
|
|
455
482
|
ReflectAndRetryToolPlugin,
|
|
@@ -465,6 +492,7 @@ export {
|
|
|
465
492
|
SequentialAgent,
|
|
466
493
|
SessionNotFoundError,
|
|
467
494
|
SessionStateCredentialService,
|
|
495
|
+
StaleSessionError,
|
|
468
496
|
State,
|
|
469
497
|
StateSchemaError,
|
|
470
498
|
StreamingMode,
|
|
@@ -490,13 +518,16 @@ export {
|
|
|
490
518
|
WebMCPToolset,
|
|
491
519
|
Workflow,
|
|
492
520
|
WorkflowNode,
|
|
521
|
+
adaptComputerUseTool,
|
|
493
522
|
appendInstructions,
|
|
494
523
|
asRunnableRoot,
|
|
495
524
|
buildFunctionDeclarationForLangchain,
|
|
496
525
|
buildFunctionDeclarationForParamsForCrewai,
|
|
497
526
|
buildFunctionDeclarationUtil,
|
|
527
|
+
closeRunners,
|
|
498
528
|
commonPrefixOf,
|
|
499
529
|
convertSessionToEvalFormat,
|
|
530
|
+
convertSessionToEvalInvocations,
|
|
500
531
|
createEmptyState,
|
|
501
532
|
createEvent,
|
|
502
533
|
createEventActions,
|
|
@@ -529,10 +560,12 @@ export {
|
|
|
529
560
|
handleFunctionCallsLive,
|
|
530
561
|
hasThoughts,
|
|
531
562
|
hasTrailingCodeExecutionResult,
|
|
563
|
+
injectSessionState,
|
|
532
564
|
isAgentTool,
|
|
533
565
|
isApp,
|
|
534
566
|
isAuthCredential,
|
|
535
567
|
isBaseAgent,
|
|
568
|
+
isBaseComputer,
|
|
536
569
|
isBaseExampleProvider,
|
|
537
570
|
isBaseLlm,
|
|
538
571
|
isBasePlanner,
|
|
@@ -541,6 +574,8 @@ export {
|
|
|
541
574
|
isBaseToolset,
|
|
542
575
|
isBuiltInPlanner,
|
|
543
576
|
isCompactedEvent,
|
|
577
|
+
isComputerUseTool,
|
|
578
|
+
isComputerUseToolset,
|
|
544
579
|
isFinalResponse,
|
|
545
580
|
isFunctionTool,
|
|
546
581
|
isGemini2OrAbove,
|
|
@@ -558,6 +593,7 @@ export {
|
|
|
558
593
|
isNodeState,
|
|
559
594
|
isNodeTimeoutError,
|
|
560
595
|
isParallelAgent,
|
|
596
|
+
isParallelWorker,
|
|
561
597
|
isRequestInput,
|
|
562
598
|
isRoutableLlmAgent,
|
|
563
599
|
isRoutedAgent,
|
|
@@ -566,6 +602,7 @@ export {
|
|
|
566
602
|
isScratchpadEvent,
|
|
567
603
|
isSequentialAgent,
|
|
568
604
|
isSessionArtifactService,
|
|
605
|
+
isStaleSessionError,
|
|
569
606
|
isStateSchemaError,
|
|
570
607
|
isToolNotFound,
|
|
571
608
|
isToolboxToolset,
|
|
@@ -575,6 +612,8 @@ export {
|
|
|
575
612
|
isZodSchema,
|
|
576
613
|
logger,
|
|
577
614
|
markRestored,
|
|
615
|
+
mergeStates,
|
|
616
|
+
newId,
|
|
578
617
|
node,
|
|
579
618
|
normalizeRetryExceptions,
|
|
580
619
|
populateClientFunctionCallId,
|
|
@@ -587,9 +626,11 @@ export {
|
|
|
587
626
|
requestInputTool,
|
|
588
627
|
requireAgent,
|
|
589
628
|
requiresUserInput,
|
|
629
|
+
resetIdProvider,
|
|
590
630
|
resetLogger,
|
|
591
631
|
resolveScopeKey,
|
|
592
632
|
runWithClientLabel,
|
|
633
|
+
setIdProvider,
|
|
593
634
|
setLogLevel,
|
|
594
635
|
setLogger,
|
|
595
636
|
stringifyContent,
|
|
@@ -598,6 +639,8 @@ export {
|
|
|
598
639
|
toJsonSchema,
|
|
599
640
|
toSnakeCaseName,
|
|
600
641
|
toStructuredEvents,
|
|
642
|
+
trimTempDeltaState,
|
|
643
|
+
trimTempState,
|
|
601
644
|
validateAppName,
|
|
602
645
|
version,
|
|
603
646
|
zodObjectToSchema
|
|
@@ -40,6 +40,25 @@ function calculateRetainStartIndex(rawEvents, eventRetentionSize) {
|
|
|
40
40
|
break;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
const latestCalls = /* @__PURE__ */ new Map();
|
|
44
|
+
const callDependencies = rawEvents.map((event, index) => {
|
|
45
|
+
let earliestCall = index;
|
|
46
|
+
for (const response of getFunctionResponses(event)) {
|
|
47
|
+
if (response.id === void 0) continue;
|
|
48
|
+
const callIndex = latestCalls.get(response.id);
|
|
49
|
+
if (callIndex !== void 0) {
|
|
50
|
+
earliestCall = Math.min(earliestCall, callIndex);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
for (const call of getFunctionCalls(event)) {
|
|
54
|
+
if (call.id === void 0) continue;
|
|
55
|
+
latestCalls.set(call.id, index);
|
|
56
|
+
}
|
|
57
|
+
return earliestCall;
|
|
58
|
+
});
|
|
59
|
+
for (let index = rawEvents.length - 1; index >= retainStartIndex; index--) {
|
|
60
|
+
retainStartIndex = Math.min(retainStartIndex, callDependencies[index]);
|
|
61
|
+
}
|
|
43
62
|
return retainStartIndex;
|
|
44
63
|
}
|
|
45
64
|
__name(calculateRetainStartIndex, "calculateRetainStartIndex");
|
package/dist/esm/events/event.js
CHANGED
|
@@ -7,7 +7,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7
7
|
* Copyright 2026 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { newId, newIdOr } from "../utils/id_provider.js";
|
|
11
11
|
import { toCamelCase, toSnakeCase } from "../utils/object_notation_utils.js";
|
|
12
12
|
import { createEventActions } from "./event_actions.js";
|
|
13
13
|
const EVENT_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for("google.adk.event");
|
|
@@ -46,7 +46,7 @@ function getFunctionCalls(event) {
|
|
|
46
46
|
__name(getFunctionCalls, "getFunctionCalls");
|
|
47
47
|
const AF_FUNCTION_CALL_ID_PREFIX = "adk-";
|
|
48
48
|
function generateClientFunctionCallId() {
|
|
49
|
-
return `${AF_FUNCTION_CALL_ID_PREFIX}${
|
|
49
|
+
return `${AF_FUNCTION_CALL_ID_PREFIX}${newId()}`;
|
|
50
50
|
}
|
|
51
51
|
__name(generateClientFunctionCallId, "generateClientFunctionCallId");
|
|
52
52
|
function populateClientFunctionCallId(modelResponseEvent) {
|
|
@@ -128,13 +128,17 @@ function isEvent(obj) {
|
|
|
128
128
|
}
|
|
129
129
|
__name(isEvent, "isEvent");
|
|
130
130
|
function createNewEventId() {
|
|
131
|
+
return newIdOr(createRandomEventId);
|
|
132
|
+
}
|
|
133
|
+
__name(createNewEventId, "createNewEventId");
|
|
134
|
+
function createRandomEventId() {
|
|
131
135
|
let id = "";
|
|
132
136
|
for (let i = 0; i < 8; i++) {
|
|
133
137
|
id += ASCII_LETTERS_AND_NUMBERS[Math.floor(Math.random() * ASCII_LETTERS_AND_NUMBERS.length)];
|
|
134
138
|
}
|
|
135
139
|
return id;
|
|
136
140
|
}
|
|
137
|
-
__name(
|
|
141
|
+
__name(createRandomEventId, "createRandomEventId");
|
|
138
142
|
const PRESERVE_KEYS_CAMEL_CASE = [
|
|
139
143
|
"actions.stateDelta",
|
|
140
144
|
"actions.artifactDelta",
|
|
@@ -10,6 +10,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
10
10
|
import { getBooleanEnvVar } from "../utils/env_aware_utils.js";
|
|
11
11
|
import { logger } from "../utils/logger.js";
|
|
12
12
|
var FeatureName = /* @__PURE__ */ ((FeatureName2) => {
|
|
13
|
+
FeatureName2["COMPUTER_USE"] = "COMPUTER_USE";
|
|
13
14
|
FeatureName2["PROGRESSIVE_SSE_STREAMING"] = "PROGRESSIVE_SSE_STREAMING";
|
|
14
15
|
return FeatureName2;
|
|
15
16
|
})(FeatureName || {});
|
|
@@ -20,6 +21,10 @@ var FeatureStage = /* @__PURE__ */ ((FeatureStage2) => {
|
|
|
20
21
|
return FeatureStage2;
|
|
21
22
|
})(FeatureStage || {});
|
|
22
23
|
const FEATURE_REGISTRY = {
|
|
24
|
+
["COMPUTER_USE" /* COMPUTER_USE */]: {
|
|
25
|
+
stage: "experimental" /* EXPERIMENTAL */,
|
|
26
|
+
defaultOn: true
|
|
27
|
+
},
|
|
23
28
|
["PROGRESSIVE_SSE_STREAMING" /* PROGRESSIVE_SSE_STREAMING */]: {
|
|
24
29
|
stage: "experimental" /* EXPERIMENTAL */,
|
|
25
30
|
defaultOn: false
|
package/dist/esm/index.js
CHANGED
|
@@ -30,11 +30,7 @@ import {
|
|
|
30
30
|
DebugLoggingPlugin,
|
|
31
31
|
isDebugLoggingPlugin
|
|
32
32
|
} from "./plugins/debug_logging_plugin.js";
|
|
33
|
-
import {
|
|
34
|
-
DatabaseSessionService,
|
|
35
|
-
isStaleSessionError,
|
|
36
|
-
StaleSessionError
|
|
37
|
-
} from "./sessions/database_session_service.js";
|
|
33
|
+
import { DatabaseSessionService } from "./sessions/database_session_service.js";
|
|
38
34
|
import { getSessionServiceFromUri } from "./sessions/registry.js";
|
|
39
35
|
import { VertexAiSessionService } from "./sessions/vertex_ai_session_service.js";
|
|
40
36
|
import { GCPSkillRegistry } from "./skills/gcp_skill_registry.js";
|
|
@@ -84,11 +80,11 @@ import {
|
|
|
84
80
|
import { LOAD_WEB_PAGE, loadWebPage } from "./tools/load_web_page.js";
|
|
85
81
|
import {
|
|
86
82
|
credentialToParam,
|
|
87
|
-
dictToAuthScheme,
|
|
88
83
|
INTERNAL_AUTH_PREFIX,
|
|
89
|
-
|
|
84
|
+
openidRecordToSchemeCredential,
|
|
90
85
|
openidUrlToSchemeCredential,
|
|
91
|
-
|
|
86
|
+
recordToAuthScheme,
|
|
87
|
+
serviceAccountRecordToSchemeCredential,
|
|
92
88
|
serviceAccountSchemeCredential,
|
|
93
89
|
tokenToSchemeCredential
|
|
94
90
|
} from "./tools/openapi_tool/auth/auth_helpers.js";
|
|
@@ -130,16 +126,25 @@ import {
|
|
|
130
126
|
import { RunSkillScriptTool } from "./tools/skill/run_skill_script_tool.js";
|
|
131
127
|
import { SkillToolset } from "./tools/skill/skill_toolset.js";
|
|
132
128
|
export * from "./integrations/agent_registry/agent_registry.js";
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
import { runWithAgentEngineContext } from "./telemetry/export/agent_engine.js";
|
|
130
|
+
import {
|
|
131
|
+
agentRuntimeRequestHooks
|
|
132
|
+
} from "./telemetry/export/agent_runtime.js";
|
|
133
|
+
export * from "./telemetry/export/google_cloud.js";
|
|
134
|
+
export * from "./telemetry/export/setup.js";
|
|
135
135
|
export * from "./tools/google_api_tool/index.js";
|
|
136
136
|
import {
|
|
137
|
+
convertEvalSetToSchema,
|
|
137
138
|
DEFAULT_CRITERIA,
|
|
138
139
|
EVAL_SESSION_ID_PREFIX,
|
|
139
140
|
EvalStatus,
|
|
140
141
|
getEvaluationCriteriaOrDefault,
|
|
141
142
|
getRootAgent,
|
|
143
|
+
loadEvalSetFromFile,
|
|
144
|
+
LocalEvalSetResultsManager,
|
|
145
|
+
LocalEvalSetsManager,
|
|
142
146
|
MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
147
|
+
normalizeEvalCase,
|
|
143
148
|
parseAndGetEvalsToRun,
|
|
144
149
|
RESPONSE_EVALUATION_SCORE_KEY,
|
|
145
150
|
RESPONSE_MATCH_SCORE_KEY,
|
|
@@ -153,6 +158,7 @@ import {
|
|
|
153
158
|
logToTmpFolder,
|
|
154
159
|
setupAdkLogger
|
|
155
160
|
} from "./cli/utils/logs.js";
|
|
161
|
+
import { validatePathSegment } from "./cli/utils/path_validation.js";
|
|
156
162
|
export * from "./tools/mcp/index.js";
|
|
157
163
|
export {
|
|
158
164
|
APIHubClient,
|
|
@@ -183,6 +189,8 @@ export {
|
|
|
183
189
|
LOGGING_FORMAT,
|
|
184
190
|
LoadSkillResourceTool,
|
|
185
191
|
LocalEnvironment,
|
|
192
|
+
LocalEvalSetResultsManager,
|
|
193
|
+
LocalEvalSetsManager,
|
|
186
194
|
MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
187
195
|
OAuth2BearerExchanger,
|
|
188
196
|
OpenAPIToolset,
|
|
@@ -197,7 +205,6 @@ export {
|
|
|
197
205
|
SecretManagerClient,
|
|
198
206
|
ServiceAccountCredentialExchanger,
|
|
199
207
|
SkillToolset,
|
|
200
|
-
StaleSessionError,
|
|
201
208
|
TOOL_TRAJECTORY_SCORE_KEY,
|
|
202
209
|
ToolAuthHandler,
|
|
203
210
|
ToolContextCredentialStore,
|
|
@@ -207,7 +214,9 @@ export {
|
|
|
207
214
|
VertexAiSessionService,
|
|
208
215
|
actionRequest,
|
|
209
216
|
actionResponse,
|
|
217
|
+
agentRuntimeRequestHooks,
|
|
210
218
|
connectorPayload,
|
|
219
|
+
convertEvalSetToSchema,
|
|
211
220
|
createApiParameter,
|
|
212
221
|
createOperation,
|
|
213
222
|
createOperationRequest,
|
|
@@ -216,7 +225,6 @@ export {
|
|
|
216
225
|
credentialToParam,
|
|
217
226
|
deleteOperation,
|
|
218
227
|
deleteOperationRequest,
|
|
219
|
-
dictToAuthScheme,
|
|
220
228
|
exchangeCredential,
|
|
221
229
|
executeCustomQueryRequest,
|
|
222
230
|
generateAuthToken,
|
|
@@ -231,26 +239,30 @@ export {
|
|
|
231
239
|
getSessionServiceFromUri,
|
|
232
240
|
getTypeHint,
|
|
233
241
|
isDebugLoggingPlugin,
|
|
234
|
-
isStaleSessionError,
|
|
235
242
|
listOperation,
|
|
236
243
|
listOperationRequest,
|
|
237
244
|
loadAllSkillsInDir,
|
|
238
245
|
loadDotenvForAgent,
|
|
246
|
+
loadEvalSetFromFile,
|
|
239
247
|
loadSkillFromDir,
|
|
240
248
|
loadSkillFromZipBuffer,
|
|
241
249
|
loadWebPage,
|
|
242
250
|
logToTmpFolder,
|
|
243
|
-
|
|
251
|
+
normalizeEvalCase,
|
|
252
|
+
openidRecordToSchemeCredential,
|
|
244
253
|
openidUrlToSchemeCredential,
|
|
245
254
|
parseAndGetEvalsToRun,
|
|
255
|
+
recordToAuthScheme,
|
|
246
256
|
runEvals,
|
|
247
|
-
|
|
257
|
+
runWithAgentEngineContext,
|
|
258
|
+
serviceAccountRecordToSchemeCredential,
|
|
248
259
|
serviceAccountSchemeCredential,
|
|
249
260
|
setupAdkLogger,
|
|
250
261
|
tokenToSchemeCredential,
|
|
251
262
|
tryGetResetFunc,
|
|
252
263
|
updateOperation,
|
|
253
264
|
updateOperationRequest,
|
|
265
|
+
validatePathSegment,
|
|
254
266
|
validateSkillDir,
|
|
255
267
|
walkToRootUntilFound
|
|
256
268
|
};
|