@google/adk 2.2.1 → 2.4.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 +4 -1
- package/dist/cjs/a2a/agent_card.js +102 -26
- package/dist/cjs/a2a/agent_to_a2a.js +1 -1
- package/dist/cjs/agents/agent_engine_client.js +172 -0
- package/dist/cjs/agents/base_agent.js +20 -4
- package/dist/cjs/agents/functions.js +227 -25
- package/dist/cjs/agents/instructions.js +6 -2
- package/dist/cjs/agents/invocation_context.js +26 -4
- package/dist/cjs/agents/langgraph_agent.js +152 -0
- package/dist/cjs/agents/llm_agent.js +194 -107
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/code_execution_request_processor.js +18 -6
- package/dist/cjs/agents/processors/content_processor_utils.js +38 -10
- package/dist/cjs/agents/processors/content_request_processor.js +34 -2
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/nl_planning_processor.js +12 -3
- package/dist/cjs/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/cjs/auth/auth_handler.js +37 -5
- package/dist/cjs/auth/auth_schemes.js +9 -0
- package/dist/cjs/cli/cli_eval.js +532 -0
- package/dist/cjs/cli/utils/envs.js +116 -0
- package/dist/cjs/cli/utils/evals.js +137 -0
- package/dist/cjs/cli/utils/logs.js +150 -0
- package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/cjs/code_executors/code_execution_utils.js +48 -16
- package/dist/cjs/code_executors/code_executor_context.js +6 -2
- package/dist/cjs/code_executors/container_code_executor.js +27 -16
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/cjs/common.js +61 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +12 -10
- package/dist/cjs/context/token_based_context_compactor.js +2 -1
- package/dist/cjs/errors/input_validation_error.js +3 -2
- package/dist/cjs/events/event.js +4 -2
- package/dist/cjs/examples/example_util.js +23 -2
- package/dist/cjs/flows/llm_flows/audio_transcriber.js +170 -0
- package/dist/cjs/index.js +104 -1
- package/dist/cjs/integrations/agent_registry/helpers.js +1 -1
- package/dist/cjs/models/gemini_llm_connection.js +16 -8
- package/dist/cjs/models/google_llm.js +13 -16
- package/dist/cjs/models/llm_response.js +9 -1
- package/dist/cjs/models/registry.js +1 -1
- package/dist/cjs/models/routed_llm.js +9 -8
- package/dist/cjs/planners/plan_re_act_planner.js +1 -1
- package/dist/cjs/plugins/base_plugin.js +13 -23
- package/dist/cjs/runner/in_memory_runner.js +6 -11
- package/dist/cjs/runner/runner.js +105 -33
- package/dist/cjs/sessions/base_session_service.js +14 -8
- package/dist/cjs/sessions/database_session_service.js +50 -28
- package/dist/cjs/sessions/db/operations.js +1 -1
- package/dist/cjs/sessions/in_memory_session_service.js +3 -1
- package/dist/cjs/sessions/stale_session_error.js +59 -0
- package/dist/cjs/sessions/state.js +8 -4
- package/dist/cjs/sessions/vertex_ai_session_service.js +34 -15
- package/dist/cjs/skills/loader.js +52 -18
- package/dist/cjs/telemetry/setup.js +0 -1
- package/dist/cjs/telemetry/tracing.js +147 -73
- package/dist/cjs/tools/agent_tool.js +44 -0
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +137 -0
- package/dist/cjs/tools/apihub_tool/clients/apihub_client.js +272 -0
- package/dist/cjs/tools/apihub_tool/clients/secret_client.js +148 -0
- package/dist/cjs/tools/apihub_tool/clients/service_account.js +48 -0
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +263 -0
- package/dist/cjs/tools/application_integration_tool/clients/cloud_request.js +133 -0
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +671 -0
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +223 -0
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +184 -0
- package/dist/cjs/tools/example_tool.js +10 -0
- package/dist/cjs/tools/function_tool.js +319 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +100 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +173 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolsets.js +124 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +440 -0
- package/dist/cjs/tools/google_api_tool/index.js +61 -0
- package/dist/cjs/tools/load_artifacts_tool.js +12 -6
- package/dist/cjs/tools/load_memory_tool.js +12 -10
- package/dist/cjs/tools/mcp/index.js +12 -0
- package/dist/cjs/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/cjs/tools/mcp/mcp_toolset.js +1 -14
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +46 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -3
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +14 -2
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +7 -13
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/cjs/tools/retrieval/base_retrieval_tool.js +18 -3
- package/dist/cjs/tools/toolbox_toolset.js +174 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/cjs/utils/client_labels.js +19 -2
- package/dist/cjs/utils/env_aware_utils.js +6 -8
- package/dist/cjs/utils/error_utils.js +11 -11
- package/dist/cjs/utils/failover_utils.js +1 -1
- package/dist/cjs/utils/file_extension_utils.js +11 -0
- package/dist/cjs/utils/file_utils.js +2 -24
- package/dist/cjs/utils/gemini_schema_util.js +28 -7
- package/dist/cjs/utils/json_utils.js +49 -0
- package/dist/cjs/utils/live_connection_utils.js +4 -5
- package/dist/cjs/utils/logger_node.js +11 -1
- package/dist/cjs/utils/object_notation_utils.js +6 -3
- package/dist/cjs/utils/output_schema_utils.js +5 -2
- package/dist/cjs/utils/streaming_utils.js +12 -12
- package/dist/cjs/utils/task.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_remote_agent.js +4 -1
- package/dist/esm/a2a/agent_card.js +103 -27
- package/dist/esm/a2a/agent_to_a2a.js +5 -2
- package/dist/esm/agents/agent_engine_client.js +144 -0
- package/dist/esm/agents/base_agent.js +20 -4
- package/dist/esm/agents/functions.js +226 -25
- package/dist/esm/agents/instructions.js +6 -2
- package/dist/esm/agents/invocation_context.js +24 -4
- package/dist/esm/agents/langgraph_agent.js +123 -0
- package/dist/esm/agents/llm_agent.js +204 -110
- package/dist/esm/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/code_execution_request_processor.js +21 -8
- package/dist/esm/agents/processors/content_processor_utils.js +38 -10
- package/dist/esm/agents/processors/content_request_processor.js +34 -2
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/nl_planning_processor.js +12 -3
- package/dist/esm/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/esm/auth/auth_handler.js +37 -5
- package/dist/esm/auth/auth_schemes.js +8 -0
- package/dist/esm/cli/cli_eval.js +510 -0
- package/dist/esm/cli/utils/envs.js +78 -0
- package/dist/esm/cli/utils/evals.js +109 -0
- package/dist/esm/cli/utils/logs.js +111 -0
- package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/esm/code_executors/code_execution_utils.js +46 -16
- package/dist/esm/code_executors/code_executor_context.js +5 -2
- package/dist/esm/code_executors/container_code_executor.js +27 -16
- package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/esm/common.js +65 -4
- package/dist/esm/context/summarizers/llm_summarizer.js +12 -10
- package/dist/esm/context/token_based_context_compactor.js +2 -1
- package/dist/esm/errors/input_validation_error.js +3 -2
- package/dist/esm/events/event.js +4 -2
- package/dist/esm/examples/example_util.js +21 -1
- package/dist/esm/flows/llm_flows/audio_transcriber.js +142 -0
- package/dist/esm/index.js +114 -2
- package/dist/esm/integrations/agent_registry/helpers.js +1 -1
- package/dist/esm/models/gemini_llm_connection.js +16 -8
- package/dist/esm/models/google_llm.js +14 -17
- package/dist/esm/models/llm_response.js +9 -1
- package/dist/esm/models/registry.js +1 -1
- package/dist/esm/models/routed_llm.js +9 -8
- package/dist/esm/planners/plan_re_act_planner.js +1 -1
- package/dist/esm/plugins/base_plugin.js +13 -23
- package/dist/esm/runner/in_memory_runner.js +6 -11
- package/dist/esm/runner/runner.js +105 -33
- package/dist/esm/sessions/base_session_service.js +12 -7
- package/dist/esm/sessions/database_session_service.js +49 -28
- package/dist/esm/sessions/db/operations.js +1 -1
- package/dist/esm/sessions/in_memory_session_service.js +3 -1
- package/dist/esm/sessions/stale_session_error.js +31 -0
- package/dist/esm/sessions/state.js +8 -4
- package/dist/esm/sessions/vertex_ai_session_service.js +34 -15
- package/dist/esm/skills/loader.js +51 -17
- package/dist/esm/telemetry/setup.js +1 -2
- package/dist/esm/telemetry/tracing.js +151 -74
- package/dist/esm/tools/agent_tool.js +44 -0
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +101 -0
- package/dist/esm/tools/apihub_tool/clients/apihub_client.js +244 -0
- package/dist/esm/tools/apihub_tool/clients/secret_client.js +132 -0
- package/dist/esm/tools/apihub_tool/clients/service_account.js +21 -0
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +245 -0
- package/dist/esm/tools/application_integration_tool/clients/cloud_request.js +103 -0
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +629 -0
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +219 -0
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +158 -0
- package/dist/esm/tools/example_tool.js +13 -1
- package/dist/esm/tools/function_tool.js +316 -0
- package/dist/esm/tools/google_api_tool/google_api_tool.js +73 -0
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +146 -0
- package/dist/esm/tools/google_api_tool/google_api_toolsets.js +94 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +393 -0
- package/dist/esm/tools/google_api_tool/index.js +31 -0
- package/dist/esm/tools/load_artifacts_tool.js +10 -5
- package/dist/esm/tools/load_memory_tool.js +12 -10
- package/dist/esm/tools/mcp/index.js +6 -0
- package/dist/esm/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/esm/tools/mcp/mcp_toolset.js +1 -14
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +50 -3
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -3
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +15 -2
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +6 -12
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/esm/tools/retrieval/base_retrieval_tool.js +16 -2
- package/dist/esm/tools/toolbox_toolset.js +148 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/esm/utils/client_labels.js +19 -2
- package/dist/esm/utils/env_aware_utils.js +6 -8
- package/dist/esm/utils/error_utils.js +9 -10
- package/dist/esm/utils/failover_utils.js +1 -1
- package/dist/esm/utils/file_extension_utils.js +11 -0
- package/dist/esm/utils/file_utils.js +2 -23
- package/dist/esm/utils/gemini_schema_util.js +27 -7
- package/dist/esm/utils/json_utils.js +21 -0
- package/dist/esm/utils/live_connection_utils.js +4 -5
- package/dist/esm/utils/logger_node.js +11 -1
- package/dist/esm/utils/object_notation_utils.js +4 -2
- package/dist/esm/utils/output_schema_utils.js +5 -2
- package/dist/esm/utils/streaming_utils.js +11 -11
- package/dist/esm/utils/task.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +9 -0
- package/dist/types/a2a/agent_card.d.ts +44 -1
- package/dist/types/a2a/agent_to_a2a.d.ts +9 -0
- package/dist/types/a2a/index.d.ts +1 -0
- package/dist/types/agents/agent_engine_client.d.ts +37 -0
- package/dist/types/agents/base_agent.d.ts +12 -0
- package/dist/types/agents/functions.d.ts +33 -1
- package/dist/types/agents/invocation_context.d.ts +20 -1
- package/dist/types/agents/langgraph_agent.d.ts +153 -0
- package/dist/types/agents/llm_agent.d.ts +5 -1
- package/dist/types/agents/processors/content_processor_utils.d.ts +4 -2
- package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
- package/dist/types/auth/auth_handler.d.ts +28 -1
- package/dist/types/auth/auth_schemes.d.ts +13 -0
- package/dist/types/cli/cli_eval.d.ts +173 -0
- package/dist/types/cli/utils/envs.d.ts +23 -0
- package/dist/types/cli/utils/evals.d.ts +47 -0
- package/dist/types/cli/utils/logs.d.ts +38 -0
- package/dist/types/code_executors/code_execution_utils.d.ts +39 -0
- package/dist/types/code_executors/code_executor_context.d.ts +1 -0
- package/dist/types/code_executors/container_code_executor.d.ts +17 -5
- package/dist/types/common.d.ts +24 -5
- package/dist/types/errors/input_validation_error.d.ts +2 -1
- package/dist/types/events/event.d.ts +4 -0
- package/dist/types/examples/example_util.d.ts +17 -0
- package/dist/types/flows/llm_flows/audio_transcriber.d.ts +85 -0
- package/dist/types/index.d.ts +19 -2
- package/dist/types/models/gemini_llm_connection.d.ts +6 -7
- package/dist/types/models/routed_llm.d.ts +1 -1
- package/dist/types/plugins/base_plugin.d.ts +0 -10
- package/dist/types/runner/in_memory_runner.d.ts +2 -1
- package/dist/types/runner/runner.d.ts +34 -0
- package/dist/types/sessions/base_session_service.d.ts +5 -0
- package/dist/types/sessions/database_session_service.d.ts +17 -1
- package/dist/types/sessions/stale_session_error.d.ts +21 -0
- package/dist/types/sessions/state.d.ts +5 -1
- package/dist/types/sessions/vertex_ai_session_service.d.ts +8 -0
- package/dist/types/skills/loader.d.ts +3 -2
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/telemetry/tracing.d.ts +20 -4
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +115 -0
- package/dist/types/tools/apihub_tool/clients/apihub_client.d.ts +142 -0
- package/dist/types/tools/apihub_tool/clients/secret_client.d.ts +55 -0
- package/dist/types/tools/apihub_tool/clients/service_account.d.ts +11 -0
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +109 -0
- package/dist/types/tools/application_integration_tool/clients/cloud_request.d.ts +53 -0
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +229 -0
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +72 -0
- package/dist/types/tools/application_integration_tool/integration_connector_tool.d.ts +70 -0
- package/dist/types/tools/base_toolset.d.ts +6 -5
- package/dist/types/tools/example_tool.d.ts +10 -0
- package/dist/types/tools/function_tool.d.ts +32 -0
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +37 -0
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +55 -0
- package/dist/types/tools/google_api_tool/google_api_toolsets.d.ts +48 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +165 -0
- package/dist/types/tools/google_api_tool/index.d.ts +10 -0
- package/dist/types/tools/load_artifacts_tool.d.ts +14 -1
- package/dist/types/tools/load_memory_tool.d.ts +23 -1
- package/dist/types/tools/mcp/index.d.ts +3 -0
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +34 -1
- package/dist/types/tools/mcp/mcp_toolset.d.ts +15 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +19 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +18 -1
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +12 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +8 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +2 -1
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +5 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +10 -0
- package/dist/types/tools/retrieval/base_retrieval_tool.d.ts +15 -0
- package/dist/types/tools/toolbox_toolset.d.ts +159 -0
- package/dist/types/utils/client_labels.d.ts +2 -1
- package/dist/types/utils/env_aware_utils.d.ts +18 -2
- package/dist/types/utils/error_utils.d.ts +7 -0
- package/dist/types/utils/file_utils.d.ts +6 -1
- package/dist/types/utils/gemini_schema_util.d.ts +9 -2
- package/dist/types/utils/json_utils.d.ts +11 -0
- package/dist/types/utils/object_notation_utils.d.ts +7 -0
- package/dist/types/utils/output_schema_utils.d.ts +3 -2
- package/dist/types/utils/simple_zod_to_json.d.ts +1 -2
- package/dist/types/utils/streaming_utils.d.ts +11 -4
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +117 -110
- package/dist/web/index_web.js.map +4 -4
- package/package.json +38 -26
- package/dist/cjs/models/gemini_continuation.js +0 -232
- package/dist/esm/models/gemini_continuation.js +0 -205
- package/dist/types/models/gemini_continuation.d.ts +0 -59
|
@@ -28,6 +28,7 @@ __export(output_schema_utils_exports, {
|
|
|
28
28
|
canUseOutputSchemaWithTools: () => canUseOutputSchemaWithTools
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(output_schema_utils_exports);
|
|
31
|
+
var import_google_llm = require("../models/google_llm.js");
|
|
31
32
|
var import_model_name = require("./model_name.js");
|
|
32
33
|
var import_variant_utils = require("./variant_utils.js");
|
|
33
34
|
/**
|
|
@@ -35,8 +36,10 @@ var import_variant_utils = require("./variant_utils.js");
|
|
|
35
36
|
* Copyright 2026 Google LLC
|
|
36
37
|
* SPDX-License-Identifier: Apache-2.0
|
|
37
38
|
*/
|
|
38
|
-
function canUseOutputSchemaWithTools(
|
|
39
|
-
|
|
39
|
+
function canUseOutputSchemaWithTools(model) {
|
|
40
|
+
const modelString = typeof model === "string" ? model : model.model;
|
|
41
|
+
const variant = (0, import_google_llm.isGemini)(model) ? model.apiBackend : (0, import_variant_utils.getGoogleLlmVariant)();
|
|
42
|
+
return variant === import_variant_utils.GoogleLLMVariant.VERTEX_AI && (0, import_model_name.isGemini2OrAbove)(modelString);
|
|
40
43
|
}
|
|
41
44
|
__name(canUseOutputSchemaWithTools, "canUseOutputSchemaWithTools");
|
|
42
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -25,7 +25,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var streaming_utils_exports = {};
|
|
27
27
|
__export(streaming_utils_exports, {
|
|
28
|
-
|
|
28
|
+
GeminiStreamingResponseAggregator: () => GeminiStreamingResponseAggregator,
|
|
29
29
|
isEmptyContentPart: () => isEmptyContentPart
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(streaming_utils_exports);
|
|
@@ -231,7 +231,7 @@ const _NonProgressiveStrategy = class _NonProgressiveStrategy {
|
|
|
231
231
|
this.thoughtText = "";
|
|
232
232
|
}
|
|
233
233
|
async *processResponse(llmResponse) {
|
|
234
|
-
var _a;
|
|
234
|
+
var _a, _b;
|
|
235
235
|
if ((_a = llmResponse.content) == null ? void 0 : _a.parts) {
|
|
236
236
|
const nonTextParts = [];
|
|
237
237
|
let sawTextPart = false;
|
|
@@ -251,7 +251,8 @@ const _NonProgressiveStrategy = class _NonProgressiveStrategy {
|
|
|
251
251
|
nonTextParts.push(part);
|
|
252
252
|
}
|
|
253
253
|
if (nonTextParts.length > 0) {
|
|
254
|
-
|
|
254
|
+
const startsWithInlineData = !!((_b = llmResponse.content.parts[0]) == null ? void 0 : _b.inlineData);
|
|
255
|
+
if (!startsWithInlineData && (this.thoughtText || this.text)) {
|
|
255
256
|
const parts = [];
|
|
256
257
|
if (this.thoughtText) {
|
|
257
258
|
parts.push({ text: this.thoughtText, thought: true });
|
|
@@ -302,13 +303,12 @@ const _NonProgressiveStrategy = class _NonProgressiveStrategy {
|
|
|
302
303
|
};
|
|
303
304
|
__name(_NonProgressiveStrategy, "NonProgressiveStrategy");
|
|
304
305
|
let NonProgressiveStrategy = _NonProgressiveStrategy;
|
|
305
|
-
const
|
|
306
|
-
constructor(
|
|
307
|
-
import_feature_registry.FeatureName.PROGRESSIVE_SSE_STREAMING
|
|
308
|
-
)
|
|
309
|
-
this.isProgressiveMode = isProgressiveMode;
|
|
306
|
+
const _GeminiStreamingResponseAggregator = class _GeminiStreamingResponseAggregator {
|
|
307
|
+
constructor({
|
|
308
|
+
isProgressiveMode = (0, import_feature_registry.isFeatureEnabled)(import_feature_registry.FeatureName.PROGRESSIVE_SSE_STREAMING)
|
|
309
|
+
} = {}) {
|
|
310
310
|
this.lastThoughtSignature = {};
|
|
311
|
-
this.strategy =
|
|
311
|
+
this.strategy = isProgressiveMode ? new ProgressiveStrategy() : new NonProgressiveStrategy();
|
|
312
312
|
}
|
|
313
313
|
async *processResponse(response) {
|
|
314
314
|
var _a, _b;
|
|
@@ -381,14 +381,14 @@ const _StreamingResponseAggregator = class _StreamingResponseAggregator {
|
|
|
381
381
|
};
|
|
382
382
|
}
|
|
383
383
|
};
|
|
384
|
-
__name(
|
|
385
|
-
let
|
|
384
|
+
__name(_GeminiStreamingResponseAggregator, "GeminiStreamingResponseAggregator");
|
|
385
|
+
let GeminiStreamingResponseAggregator = _GeminiStreamingResponseAggregator;
|
|
386
386
|
function isEmptyContentPart(part) {
|
|
387
387
|
return !part.functionCall && !part.functionResponse && !part.fileData && !part.inlineData && !part.executableCode && !part.codeExecutionResult && (!part.text || part.text === "");
|
|
388
388
|
}
|
|
389
389
|
__name(isEmptyContentPart, "isEmptyContentPart");
|
|
390
390
|
// Annotate the CommonJS export names for ESM import in node:
|
|
391
391
|
0 && (module.exports = {
|
|
392
|
-
|
|
392
|
+
GeminiStreamingResponseAggregator,
|
|
393
393
|
isEmptyContentPart
|
|
394
394
|
});
|
package/dist/cjs/utils/task.js
CHANGED
|
@@ -42,7 +42,7 @@ const _Task = class _Task {
|
|
|
42
42
|
this.isDone = true;
|
|
43
43
|
}, "markDone");
|
|
44
44
|
this.promise = executable(this.abortController.signal);
|
|
45
|
-
this.promise.then(markDone
|
|
45
|
+
this.promise.then(markDone, markDone);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Cancels the task execution.
|
package/dist/cjs/version.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(version_exports);
|
|
|
32
32
|
* Copyright 2025 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: Apache-2.0
|
|
34
34
|
*/
|
|
35
|
-
const version = "2.
|
|
35
|
+
const version = "2.4.0";
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
38
38
|
version
|
|
@@ -43,7 +43,10 @@ const _RemoteA2AAgent = class _RemoteA2AAgent extends BaseAgent {
|
|
|
43
43
|
this.client = this.a2aConfig.client;
|
|
44
44
|
}
|
|
45
45
|
if (this.a2aConfig.agentCard) {
|
|
46
|
-
this.card = await resolveAgentCard(
|
|
46
|
+
this.card = await resolveAgentCard(
|
|
47
|
+
this.a2aConfig.agentCard,
|
|
48
|
+
this.a2aConfig.resolveAgentCardOptions
|
|
49
|
+
);
|
|
47
50
|
if (!this.client) {
|
|
48
51
|
const factory = this.a2aConfig.clientFactory || new ClientFactory();
|
|
49
52
|
this.client = await factory.createFromAgentCard(this.card);
|
|
@@ -22,25 +22,27 @@ import { isBaseTool } from "../tools/base_tool.js";
|
|
|
22
22
|
import { isBaseToolset } from "../tools/base_toolset.js";
|
|
23
23
|
import { logger } from "../utils/logger.js";
|
|
24
24
|
import {
|
|
25
|
-
isHttpUrl,
|
|
26
25
|
isLinkLocalAddress,
|
|
26
|
+
isLocalhostHostname,
|
|
27
27
|
normalizeHost,
|
|
28
28
|
resolveHostAddresses
|
|
29
29
|
} from "../utils/ssrf_guard.js";
|
|
30
30
|
import { isWorkflow } from "../workflow/workflow.js";
|
|
31
|
-
|
|
32
|
-
async function resolveAgentCard(agentCard) {
|
|
31
|
+
async function resolveAgentCard(agentCard, options = {}) {
|
|
33
32
|
if (typeof agentCard === "object") {
|
|
34
33
|
return agentCard;
|
|
35
34
|
}
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
await
|
|
35
|
+
const source = agentCard;
|
|
36
|
+
if (source.startsWith("http://") || source.startsWith("https://")) {
|
|
37
|
+
await refuseLinkLocalHost(source);
|
|
39
38
|
const resolver = new DefaultAgentCardResolver({
|
|
40
|
-
fetchImpl:
|
|
39
|
+
fetchImpl: refuseRedirectFetch
|
|
41
40
|
});
|
|
42
|
-
|
|
41
|
+
const card = await resolver.resolve(source);
|
|
42
|
+
validateCardRpcTargets(card, source, options);
|
|
43
|
+
return card;
|
|
43
44
|
}
|
|
45
|
+
const url = parseCardUrl(source);
|
|
44
46
|
if (url && url.protocol !== "file:") {
|
|
45
47
|
throw new Error(
|
|
46
48
|
`Unsupported agent card URL scheme "${url.protocol}": ${agentCard}. Use http://, https:// or file://, or pass a filesystem path with no scheme.`
|
|
@@ -49,6 +51,31 @@ async function resolveAgentCard(agentCard) {
|
|
|
49
51
|
return readAgentCardFile(agentCard, url);
|
|
50
52
|
}
|
|
51
53
|
__name(resolveAgentCard, "resolveAgentCard");
|
|
54
|
+
const WINDOWS_DRIVE_PROTOCOL = /^[a-z]:$/i;
|
|
55
|
+
async function refuseLinkLocalHost(source) {
|
|
56
|
+
const hostname = normalizeHost(new URL(source).hostname);
|
|
57
|
+
if (isLocalhostHostname(hostname)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const addresses = await resolveHostAddresses(hostname);
|
|
61
|
+
if (addresses.some((address) => isLinkLocalAddress(address))) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Refusing to fetch agent card from a link-local address: ${hostname}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
__name(refuseLinkLocalHost, "refuseLinkLocalHost");
|
|
68
|
+
async function refuseRedirectFetch(url, init) {
|
|
69
|
+
const response = await fetch(url, { ...init, redirect: "manual" });
|
|
70
|
+
if (response.status === 0 || response.status >= 300 && response.status < 400) {
|
|
71
|
+
const location = response.headers.get("location");
|
|
72
|
+
throw new Error(
|
|
73
|
+
`Refusing to follow a redirect from the agent card endpoint (status ${response.status}, location ${location}): ${url}`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return response;
|
|
77
|
+
}
|
|
78
|
+
__name(refuseRedirectFetch, "refuseRedirectFetch");
|
|
52
79
|
function parseCardUrl(source) {
|
|
53
80
|
let url;
|
|
54
81
|
try {
|
|
@@ -71,32 +98,81 @@ async function readAgentCardFile(source, url) {
|
|
|
71
98
|
}
|
|
72
99
|
}
|
|
73
100
|
__name(readAgentCardFile, "readAgentCardFile");
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
101
|
+
function validateCardRpcTargets(card, source, options) {
|
|
102
|
+
var _a;
|
|
103
|
+
let parsedSource;
|
|
104
|
+
try {
|
|
105
|
+
parsedSource = new URL(source);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`Invalid agent card source URL: ${source}: ${err.message}`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
const rpcUrls = [
|
|
112
|
+
card.url,
|
|
113
|
+
...((_a = card.additionalInterfaces) != null ? _a : []).map((i) => i.url)
|
|
114
|
+
];
|
|
115
|
+
for (const rpcUrl of rpcUrls) {
|
|
116
|
+
let parsed;
|
|
117
|
+
try {
|
|
118
|
+
parsed = new URL(rpcUrl);
|
|
119
|
+
} catch (err) {
|
|
78
120
|
throw new Error(
|
|
79
|
-
`
|
|
121
|
+
`Invalid RPC URL in agent card: ${rpcUrl}: ${err.message}`
|
|
80
122
|
);
|
|
81
123
|
}
|
|
82
|
-
|
|
83
|
-
|
|
124
|
+
if (parsed.protocol !== "https:" && !isLoopbackHost(parsed.hostname)) {
|
|
125
|
+
if (options.allowInsecureRpc === true) {
|
|
126
|
+
logger.warn(
|
|
127
|
+
`SECURITY WARNING: accepting a plaintext http RPC URL on a non-loopback host because \`allowInsecureRpc: true\` was set: ${rpcUrl}. This connection can be intercepted or altered by anything on the network path.`
|
|
128
|
+
);
|
|
129
|
+
} else {
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Agent card RPC URL must use https, or http on a loopback host: ${rpcUrl}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (!sameOriginForRpc(parsedSource, parsed)) {
|
|
136
|
+
if (options.allowCrossOriginRpc === true) {
|
|
137
|
+
logger.warn(
|
|
138
|
+
`SECURITY WARNING: accepting an agent card RPC URL whose origin differs from the location the card was fetched from because \`allowCrossOriginRpc: true\` was set (fetched from ${source}): ${rpcUrl}.`
|
|
139
|
+
);
|
|
140
|
+
} else {
|
|
141
|
+
throw new Error(
|
|
142
|
+
`Agent card RPC URL must have the same origin as the location the card was fetched from (${source}): ${rpcUrl}`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
84
147
|
}
|
|
85
|
-
__name(
|
|
86
|
-
function
|
|
87
|
-
|
|
148
|
+
__name(validateCardRpcTargets, "validateCardRpcTargets");
|
|
149
|
+
function sameOriginForRpc(source, rpc) {
|
|
150
|
+
const sourceIsLoopback = isLoopbackHost(source.hostname);
|
|
151
|
+
const rpcIsLoopback = isLoopbackHost(rpc.hostname);
|
|
152
|
+
if (sourceIsLoopback && rpcIsLoopback) {
|
|
153
|
+
return source.protocol === rpc.protocol && effectivePort(source) === effectivePort(rpc);
|
|
154
|
+
}
|
|
155
|
+
return source.origin === rpc.origin;
|
|
88
156
|
}
|
|
89
|
-
__name(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
157
|
+
__name(sameOriginForRpc, "sameOriginForRpc");
|
|
158
|
+
function effectivePort(url) {
|
|
159
|
+
if (url.port) {
|
|
160
|
+
return url.port;
|
|
161
|
+
}
|
|
162
|
+
if (url.protocol === "https:") {
|
|
163
|
+
return "443";
|
|
97
164
|
}
|
|
165
|
+
if (url.protocol === "http:") {
|
|
166
|
+
return "80";
|
|
167
|
+
}
|
|
168
|
+
return url.port;
|
|
169
|
+
}
|
|
170
|
+
__name(effectivePort, "effectivePort");
|
|
171
|
+
function isLoopbackHost(hostname) {
|
|
172
|
+
const bare = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
173
|
+
return bare === "localhost" || bare === "127.0.0.1" || bare === "::1" || bare === "0.0.0.0" || bare === "::" || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(bare);
|
|
98
174
|
}
|
|
99
|
-
__name(
|
|
175
|
+
__name(isLoopbackHost, "isLoopbackHost");
|
|
100
176
|
async function getA2AAgentCard(agent, transports) {
|
|
101
177
|
return {
|
|
102
178
|
name: agent.name,
|
|
@@ -34,7 +34,10 @@ import { StreamingMode } from "../agents/run_config.js";
|
|
|
34
34
|
import { InMemorySessionService } from "../sessions/in_memory_session_service.js";
|
|
35
35
|
import { logger } from "../utils/logger.js";
|
|
36
36
|
import { loadOptionalPeer } from "../utils/optional_peer.js";
|
|
37
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
getA2AAgentCard,
|
|
39
|
+
resolveAgentCard
|
|
40
|
+
} from "./agent_card.js";
|
|
38
41
|
import { A2AAgentExecutor } from "./agent_executor.js";
|
|
39
42
|
import {
|
|
40
43
|
AdkDefaultRequestHandler,
|
|
@@ -73,7 +76,7 @@ async function toA2a(agent, options = {}) {
|
|
|
73
76
|
const protocol = (_c = options.protocol) != null ? _c : "http";
|
|
74
77
|
const basePath = options.basePath || "";
|
|
75
78
|
const rpcUrl = `${protocol}://${host}:${port}${basePath}`;
|
|
76
|
-
const agentCard = options.agentCard ? await resolveAgentCard(options.agentCard) : await getA2AAgentCard(agent, [
|
|
79
|
+
const agentCard = options.agentCard ? await resolveAgentCard(options.agentCard, options.resolveAgentCardOptions) : await getA2AAgentCard(agent, [
|
|
77
80
|
{
|
|
78
81
|
url: `${rpcUrl}/jsonrpc`,
|
|
79
82
|
transport: "JSONRPC"
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
import { helpers, v1 } from "@google-cloud/aiplatform";
|
|
11
|
+
const _AgentExecutionError = class _AgentExecutionError extends Error {
|
|
12
|
+
constructor(message, cause) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.cause = cause;
|
|
15
|
+
this.name = "AgentExecutionError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
__name(_AgentExecutionError, "AgentExecutionError");
|
|
19
|
+
let AgentExecutionError = _AgentExecutionError;
|
|
20
|
+
function buildInputStruct(config) {
|
|
21
|
+
var _a;
|
|
22
|
+
const value = helpers.toValue(config);
|
|
23
|
+
return (_a = value == null ? void 0 : value.structValue) != null ? _a : void 0;
|
|
24
|
+
}
|
|
25
|
+
__name(buildInputStruct, "buildInputStruct");
|
|
26
|
+
function parseOutput(output) {
|
|
27
|
+
return helpers.fromValue(output);
|
|
28
|
+
}
|
|
29
|
+
__name(parseOutput, "parseOutput");
|
|
30
|
+
function parseFragment(line) {
|
|
31
|
+
const trimmed = line.trim();
|
|
32
|
+
if (!trimmed) return void 0;
|
|
33
|
+
const payload = trimmed.startsWith("data:") ? trimmed.slice(5).trim() : trimmed;
|
|
34
|
+
if (payload === "[DONE]") return void 0;
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(payload);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw new AgentExecutionError(
|
|
39
|
+
`Failed to parse stream fragment: ${payload}`,
|
|
40
|
+
e
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
__name(parseFragment, "parseFragment");
|
|
45
|
+
async function* parseStream(stream) {
|
|
46
|
+
let buffer = "";
|
|
47
|
+
for await (const chunk of stream) {
|
|
48
|
+
const chunkData = chunk == null ? void 0 : chunk.data;
|
|
49
|
+
if (chunkData === void 0) {
|
|
50
|
+
if (typeof chunk === "object" && chunk !== null) {
|
|
51
|
+
yield chunk;
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const dataStr = chunkData instanceof Uint8Array ? new TextDecoder().decode(chunkData) : String(chunkData);
|
|
56
|
+
buffer += dataStr;
|
|
57
|
+
const lines = buffer.split("\n");
|
|
58
|
+
buffer = lines.pop() || "";
|
|
59
|
+
for (const line of lines) {
|
|
60
|
+
const fragment = parseFragment(line);
|
|
61
|
+
if (fragment !== void 0) {
|
|
62
|
+
yield fragment;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const last = parseFragment(buffer);
|
|
67
|
+
if (last !== void 0) {
|
|
68
|
+
yield last;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
__name(parseStream, "parseStream");
|
|
72
|
+
const _AgentEngineClient = class _AgentEngineClient {
|
|
73
|
+
constructor(config) {
|
|
74
|
+
this.client = new v1.ReasoningEngineExecutionServiceClient({
|
|
75
|
+
apiEndpoint: `${config.location}-aiplatform.googleapis.com`
|
|
76
|
+
});
|
|
77
|
+
this.reasoningEnginePath = this.client.reasoningEnginePath(
|
|
78
|
+
config.project,
|
|
79
|
+
config.location,
|
|
80
|
+
config.reasoningEngineId
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates a remote session.
|
|
85
|
+
*
|
|
86
|
+
* @returns The `create_session` payload returned by the Agent Engine. When
|
|
87
|
+
* `config.sessionId` is omitted the engine generates one, and this is the
|
|
88
|
+
* only place the caller can read it back from.
|
|
89
|
+
*/
|
|
90
|
+
async createSession(config) {
|
|
91
|
+
try {
|
|
92
|
+
const [response] = await this.client.queryReasoningEngine({
|
|
93
|
+
name: this.reasoningEnginePath,
|
|
94
|
+
classMethod: "create_session",
|
|
95
|
+
input: buildInputStruct(config)
|
|
96
|
+
});
|
|
97
|
+
return response.output ? parseOutput(response.output) : void 0;
|
|
98
|
+
} catch (err) {
|
|
99
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
100
|
+
throw new AgentExecutionError(
|
|
101
|
+
`Failed to create session: ${message}`,
|
|
102
|
+
err
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async query(config) {
|
|
107
|
+
try {
|
|
108
|
+
const [response] = await this.client.queryReasoningEngine({
|
|
109
|
+
name: this.reasoningEnginePath,
|
|
110
|
+
classMethod: "query",
|
|
111
|
+
input: buildInputStruct(config)
|
|
112
|
+
});
|
|
113
|
+
return response.output ? parseOutput(response.output) : void 0;
|
|
114
|
+
} catch (err) {
|
|
115
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
116
|
+
throw new AgentExecutionError(`Failed to execute query: ${message}`, err);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async *streamQuery(config) {
|
|
120
|
+
try {
|
|
121
|
+
const stream = this.client.streamQueryReasoningEngine({
|
|
122
|
+
name: this.reasoningEnginePath,
|
|
123
|
+
classMethod: "query",
|
|
124
|
+
input: buildInputStruct(config)
|
|
125
|
+
});
|
|
126
|
+
yield* parseStream(stream);
|
|
127
|
+
} catch (err) {
|
|
128
|
+
if (err instanceof AgentExecutionError) {
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
131
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
132
|
+
throw new AgentExecutionError(
|
|
133
|
+
`Failed to execute stream query: ${message}`,
|
|
134
|
+
err
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
__name(_AgentEngineClient, "AgentEngineClient");
|
|
140
|
+
let AgentEngineClient = _AgentEngineClient;
|
|
141
|
+
export {
|
|
142
|
+
AgentEngineClient,
|
|
143
|
+
AgentExecutionError
|
|
144
|
+
};
|
|
@@ -235,6 +235,22 @@ const _BaseAgent = class _BaseAgent extends (_b = BaseNode, _a = BASE_AGENT_SIGN
|
|
|
235
235
|
agent: this
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* The resolved beforeAgentCallback field as a list of SingleAgentCallback.
|
|
240
|
+
*
|
|
241
|
+
* This method is only for use by Agent Development Kit.
|
|
242
|
+
*/
|
|
243
|
+
get canonicalBeforeAgentCallbacks() {
|
|
244
|
+
return this.beforeAgentCallback;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The resolved afterAgentCallback field as a list of SingleAgentCallback.
|
|
248
|
+
*
|
|
249
|
+
* This method is only for use by Agent Development Kit.
|
|
250
|
+
*/
|
|
251
|
+
get canonicalAfterAgentCallbacks() {
|
|
252
|
+
return this.afterAgentCallback;
|
|
253
|
+
}
|
|
238
254
|
/**
|
|
239
255
|
* Runs the before agent callback if it exists.
|
|
240
256
|
*
|
|
@@ -244,11 +260,11 @@ const _BaseAgent = class _BaseAgent extends (_b = BaseNode, _a = BASE_AGENT_SIGN
|
|
|
244
260
|
*/
|
|
245
261
|
async handleBeforeAgentCallback(invocationContext) {
|
|
246
262
|
var _a2;
|
|
247
|
-
if (this.
|
|
263
|
+
if (this.canonicalBeforeAgentCallbacks.length === 0) {
|
|
248
264
|
return void 0;
|
|
249
265
|
}
|
|
250
266
|
const callbackContext = new Context({ invocationContext });
|
|
251
|
-
for (const callback of this.
|
|
267
|
+
for (const callback of this.canonicalBeforeAgentCallbacks) {
|
|
252
268
|
const content = await callback(callbackContext);
|
|
253
269
|
if ((_a2 = invocationContext.abortSignal) == null ? void 0 : _a2.aborted) {
|
|
254
270
|
return;
|
|
@@ -283,11 +299,11 @@ const _BaseAgent = class _BaseAgent extends (_b = BaseNode, _a = BASE_AGENT_SIGN
|
|
|
283
299
|
*/
|
|
284
300
|
async handleAfterAgentCallback(invocationContext) {
|
|
285
301
|
var _a2;
|
|
286
|
-
if (this.
|
|
302
|
+
if (this.canonicalAfterAgentCallbacks.length === 0) {
|
|
287
303
|
return void 0;
|
|
288
304
|
}
|
|
289
305
|
const callbackContext = new Context({ invocationContext });
|
|
290
|
-
for (const callback of this.
|
|
306
|
+
for (const callback of this.canonicalAfterAgentCallbacks) {
|
|
291
307
|
const content = await callback(callbackContext);
|
|
292
308
|
if ((_a2 = invocationContext.abortSignal) == null ? void 0 : _a2.aborted) {
|
|
293
309
|
return;
|