@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
|
@@ -38,14 +38,10 @@ function randomUUID() {
|
|
|
38
38
|
__name(randomUUID, "randomUUID");
|
|
39
39
|
function base64Encode(data) {
|
|
40
40
|
if (isBrowser()) {
|
|
41
|
+
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
41
42
|
let strData = "";
|
|
42
|
-
|
|
43
|
-
strData
|
|
44
|
-
} else {
|
|
45
|
-
const len = data.byteLength;
|
|
46
|
-
for (let i = 0; i < len; i++) {
|
|
47
|
-
strData += String.fromCharCode(data[i]);
|
|
48
|
-
}
|
|
43
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
44
|
+
strData += String.fromCharCode(bytes[i]);
|
|
49
45
|
}
|
|
50
46
|
return window.btoa(strData);
|
|
51
47
|
}
|
|
@@ -54,7 +50,9 @@ function base64Encode(data) {
|
|
|
54
50
|
__name(base64Encode, "base64Encode");
|
|
55
51
|
function base64Decode(data) {
|
|
56
52
|
if (isBrowser()) {
|
|
57
|
-
|
|
53
|
+
const binary = window.atob(data);
|
|
54
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
55
|
+
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
58
56
|
}
|
|
59
57
|
return Buffer.from(data, "base64").toString();
|
|
60
58
|
}
|
|
@@ -29,16 +29,14 @@ function truncateBody(body) {
|
|
|
29
29
|
return body.length > MAX_RESPONSE_BODY_LENGTH ? body.slice(0, MAX_RESPONSE_BODY_LENGTH) + TRUNCATION_MARKER : body;
|
|
30
30
|
}
|
|
31
31
|
__name(truncateBody, "truncateBody");
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (typeof err === "string") {
|
|
37
|
-
return err;
|
|
32
|
+
function getErrorMessage(err) {
|
|
33
|
+
const record = asRecord(err);
|
|
34
|
+
if (record !== void 0 && typeof record["message"] === "string") {
|
|
35
|
+
return record["message"];
|
|
38
36
|
}
|
|
39
37
|
return String(err);
|
|
40
38
|
}
|
|
41
|
-
__name(
|
|
39
|
+
__name(getErrorMessage, "getErrorMessage");
|
|
42
40
|
function extractHttpDetails(err) {
|
|
43
41
|
var _a, _b;
|
|
44
42
|
const record = asRecord(err);
|
|
@@ -71,7 +69,7 @@ function formatErrorRecursive(err, seen) {
|
|
|
71
69
|
}
|
|
72
70
|
if (typeof err === "object") {
|
|
73
71
|
if (seen.has(err)) {
|
|
74
|
-
return
|
|
72
|
+
return getErrorMessage(err);
|
|
75
73
|
}
|
|
76
74
|
seen.add(err);
|
|
77
75
|
}
|
|
@@ -79,7 +77,7 @@ function formatErrorRecursive(err, seen) {
|
|
|
79
77
|
return err.errors.map((sub) => formatErrorRecursive(sub, seen)).join(" | ");
|
|
80
78
|
}
|
|
81
79
|
const http = extractHttpDetails(err);
|
|
82
|
-
const base =
|
|
80
|
+
const base = getErrorMessage(err);
|
|
83
81
|
const cause = (_a = asRecord(err)) == null ? void 0 : _a["cause"];
|
|
84
82
|
const causeMessage = cause !== void 0 ? formatErrorRecursive(cause, seen) : void 0;
|
|
85
83
|
let message = base.length > 0 ? base : UNKNOWN_ERROR;
|
|
@@ -97,5 +95,6 @@ function formatError(err) {
|
|
|
97
95
|
}
|
|
98
96
|
__name(formatError, "formatError");
|
|
99
97
|
export {
|
|
100
|
-
formatError
|
|
98
|
+
formatError,
|
|
99
|
+
getErrorMessage
|
|
101
100
|
};
|
|
@@ -21,9 +21,9 @@ async function* runWithRouting(items, context, router, runFn) {
|
|
|
21
21
|
}
|
|
22
22
|
const triedKeys = /* @__PURE__ */ new Set([selectedKey]);
|
|
23
23
|
while (true) {
|
|
24
|
-
const generatorOrPromise = runFn(selectedItem);
|
|
25
24
|
let firstYielded = false;
|
|
26
25
|
try {
|
|
26
|
+
const generatorOrPromise = runFn(selectedItem);
|
|
27
27
|
if (isAsyncGenerator(generatorOrPromise)) {
|
|
28
28
|
for await (const result2 of generatorOrPromise) {
|
|
29
29
|
yield result2;
|
|
@@ -13,7 +13,17 @@ import {
|
|
|
13
13
|
} from "../code_executors/code_execution_utils.js";
|
|
14
14
|
const MIME_TYPE_MAP = {
|
|
15
15
|
".js": { mimeType: "text/javascript", encoding: FileContentEncoding.UTF8 },
|
|
16
|
+
".cjs": { mimeType: "text/javascript", encoding: FileContentEncoding.UTF8 },
|
|
17
|
+
".mjs": { mimeType: "text/javascript", encoding: FileContentEncoding.UTF8 },
|
|
18
|
+
".ts": { mimeType: "text/javascript", encoding: FileContentEncoding.UTF8 },
|
|
19
|
+
".cts": { mimeType: "text/javascript", encoding: FileContentEncoding.UTF8 },
|
|
20
|
+
".mts": { mimeType: "text/javascript", encoding: FileContentEncoding.UTF8 },
|
|
16
21
|
".py": { mimeType: "text/x-python", encoding: FileContentEncoding.UTF8 },
|
|
22
|
+
".sh": { mimeType: "text/x-shellscript", encoding: FileContentEncoding.UTF8 },
|
|
23
|
+
".bash": {
|
|
24
|
+
mimeType: "text/x-shellscript",
|
|
25
|
+
encoding: FileContentEncoding.UTF8
|
|
26
|
+
},
|
|
17
27
|
".md": { mimeType: "text/markdown", encoding: FileContentEncoding.UTF8 },
|
|
18
28
|
".txt": { mimeType: "text/plain", encoding: FileContentEncoding.UTF8 },
|
|
19
29
|
".html": { mimeType: "text/html", encoding: FileContentEncoding.UTF8 },
|
|
@@ -27,6 +37,7 @@ const MIME_TYPE_MAP = {
|
|
|
27
37
|
".png": { mimeType: "image/png", encoding: FileContentEncoding.BASE64 },
|
|
28
38
|
".jpg": { mimeType: "image/jpeg", encoding: FileContentEncoding.BASE64 },
|
|
29
39
|
".jpeg": { mimeType: "image/jpeg", encoding: FileContentEncoding.BASE64 },
|
|
40
|
+
".gif": { mimeType: "image/gif", encoding: FileContentEncoding.BASE64 },
|
|
30
41
|
".pdf": { mimeType: "application/pdf", encoding: FileContentEncoding.BASE64 }
|
|
31
42
|
};
|
|
32
43
|
const EXTENSION_TO_LANGUAGE = {
|
|
@@ -9,6 +9,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
9
9
|
*/
|
|
10
10
|
import * as fs from "node:fs/promises";
|
|
11
11
|
import * as path from "node:path";
|
|
12
|
+
import { getMimeTypeAndEncoding } from "./file_extension_utils.js";
|
|
12
13
|
function isInsideDir(resolvedPath, resolvedBaseDir) {
|
|
13
14
|
return resolvedPath === resolvedBaseDir || resolvedPath.startsWith(resolvedBaseDir + path.sep);
|
|
14
15
|
}
|
|
@@ -59,33 +60,11 @@ async function materializeFiles(files, dir) {
|
|
|
59
60
|
return createdFiles;
|
|
60
61
|
}
|
|
61
62
|
__name(materializeFiles, "materializeFiles");
|
|
62
|
-
const EXTENSION_TO_MIME_TYPE = {
|
|
63
|
-
"pdf": "application/pdf",
|
|
64
|
-
"jpg": "image/jpeg",
|
|
65
|
-
"jpeg": "image/jpeg",
|
|
66
|
-
"png": "image/png",
|
|
67
|
-
"gif": "image/gif",
|
|
68
|
-
"csv": "text/csv",
|
|
69
|
-
"json": "application/json",
|
|
70
|
-
"xml": "application/xml",
|
|
71
|
-
"sh": "text/x-shellscript",
|
|
72
|
-
"bash": "text/x-shellscript",
|
|
73
|
-
"py": "text/x-python",
|
|
74
|
-
"js": "text/javascript",
|
|
75
|
-
"cjs": "text/javascript",
|
|
76
|
-
"mjs": "text/javascript",
|
|
77
|
-
"ts": "text/javascript",
|
|
78
|
-
"cts": "text/javascript",
|
|
79
|
-
"mts": "text/javascript"
|
|
80
|
-
};
|
|
81
63
|
function guessMimeType(filePath) {
|
|
82
|
-
|
|
83
|
-
const ext = ((_a = filePath.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "";
|
|
84
|
-
return EXTENSION_TO_MIME_TYPE[ext] || "application/octet-stream";
|
|
64
|
+
return getMimeTypeAndEncoding(path.extname(filePath)).mimeType;
|
|
85
65
|
}
|
|
86
66
|
__name(guessMimeType, "guessMimeType");
|
|
87
67
|
export {
|
|
88
|
-
EXTENSION_TO_MIME_TYPE,
|
|
89
68
|
guessMimeType,
|
|
90
69
|
materializeFiles
|
|
91
70
|
};
|
|
@@ -45,6 +45,9 @@ function toGeminiSchema(mcpSchema) {
|
|
|
45
45
|
}
|
|
46
46
|
function recursiveConvert(mcp) {
|
|
47
47
|
var _a;
|
|
48
|
+
if (typeof mcp === "boolean") {
|
|
49
|
+
mcp = { type: "object" };
|
|
50
|
+
}
|
|
48
51
|
const sourceType = (_a = mcp.anyOf) != null ? _a : mcp.type;
|
|
49
52
|
let isNullable = false;
|
|
50
53
|
let nonNullTypes;
|
|
@@ -135,7 +138,7 @@ function toGeminiSchema(mcpSchema) {
|
|
|
135
138
|
geminiSchema.required = mcp.required;
|
|
136
139
|
}
|
|
137
140
|
} else if (geminiType === Type.ARRAY) {
|
|
138
|
-
if (mcp.items) {
|
|
141
|
+
if (mcp.items || mcp.items === false) {
|
|
139
142
|
geminiSchema.items = recursiveConvert(mcp.items);
|
|
140
143
|
}
|
|
141
144
|
}
|
|
@@ -174,7 +177,6 @@ const GEMINI_REJECTED_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
|
|
|
174
177
|
"default",
|
|
175
178
|
"format"
|
|
176
179
|
]);
|
|
177
|
-
const EMPTY_OBJECT_PLACEHOLDER = "dummy_DO_NOT_GENERATE";
|
|
178
180
|
function toGeminiSchemaField(key) {
|
|
179
181
|
return toSnakeCaseName(key).replace(
|
|
180
182
|
/_([a-z0-9])/g,
|
|
@@ -186,6 +188,23 @@ function isPlainObject(value) {
|
|
|
186
188
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
187
189
|
}
|
|
188
190
|
__name(isPlainObject, "isPlainObject");
|
|
191
|
+
function normalizeJsonSchemaType(jsonSchemaType) {
|
|
192
|
+
if (typeof jsonSchemaType === "string") {
|
|
193
|
+
if (jsonSchemaType === "null") {
|
|
194
|
+
return [void 0, true];
|
|
195
|
+
}
|
|
196
|
+
return [jsonSchemaType, false];
|
|
197
|
+
}
|
|
198
|
+
if (Array.isArray(jsonSchemaType)) {
|
|
199
|
+
const nullable = jsonSchemaType.includes("null");
|
|
200
|
+
const nonNullTypes = jsonSchemaType.filter(
|
|
201
|
+
(t) => typeof t === "string" && t !== "null"
|
|
202
|
+
);
|
|
203
|
+
return [nonNullTypes[0], nullable];
|
|
204
|
+
}
|
|
205
|
+
return [void 0, false];
|
|
206
|
+
}
|
|
207
|
+
__name(normalizeJsonSchemaType, "normalizeJsonSchemaType");
|
|
189
208
|
function convertSchemaField(field, value) {
|
|
190
209
|
if (field === "type") {
|
|
191
210
|
return toGeminiType(typeof value === "string" ? value : void 0);
|
|
@@ -215,14 +234,14 @@ function openApiSchemaToGeminiSchema(openApiSchema) {
|
|
|
215
234
|
throw new TypeError("openapi_schema must be a dictionary");
|
|
216
235
|
}
|
|
217
236
|
const source = { ...openApiSchema };
|
|
237
|
+
const [schemaType, nullable] = normalizeJsonSchemaType(source["type"]);
|
|
238
|
+
source["type"] = schemaType;
|
|
239
|
+
if (nullable) {
|
|
240
|
+
source["nullable"] = true;
|
|
241
|
+
}
|
|
218
242
|
if (!source["type"]) {
|
|
219
243
|
source["type"] = "object";
|
|
220
244
|
}
|
|
221
|
-
const properties = source["properties"];
|
|
222
|
-
const hasProperties = isPlainObject(properties) && Object.keys(properties).length > 0;
|
|
223
|
-
if (source["type"] === "object" && !hasProperties) {
|
|
224
|
-
source["properties"] = { [EMPTY_OBJECT_PLACEHOLDER]: { type: "string" } };
|
|
225
|
-
}
|
|
226
245
|
const converted = {};
|
|
227
246
|
for (const [key, value] of Object.entries(source)) {
|
|
228
247
|
const field = toGeminiSchemaField(key);
|
|
@@ -235,6 +254,7 @@ function openApiSchemaToGeminiSchema(openApiSchema) {
|
|
|
235
254
|
}
|
|
236
255
|
__name(openApiSchemaToGeminiSchema, "openApiSchemaToGeminiSchema");
|
|
237
256
|
export {
|
|
257
|
+
normalizeJsonSchemaType,
|
|
238
258
|
openApiSchemaToGeminiSchema,
|
|
239
259
|
toGeminiSchema
|
|
240
260
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
function isJsonObject(value) {
|
|
11
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
__name(isJsonObject, "isJsonObject");
|
|
14
|
+
function toJsonObject(value) {
|
|
15
|
+
return isJsonObject(value) ? value : {};
|
|
16
|
+
}
|
|
17
|
+
__name(toJsonObject, "toJsonObject");
|
|
18
|
+
export {
|
|
19
|
+
isJsonObject,
|
|
20
|
+
toJsonObject
|
|
21
|
+
};
|
|
@@ -178,12 +178,11 @@ const _LiveResponseAggregator = class _LiveResponseAggregator {
|
|
|
178
178
|
yield this.buildFullTextResponse(this.text, this.isThought);
|
|
179
179
|
this.text = "";
|
|
180
180
|
this.isThought = false;
|
|
181
|
-
} else {
|
|
182
|
-
yield {
|
|
183
|
-
interrupted: serverContent.interrupted,
|
|
184
|
-
...this.modelVersion ? { modelVersion: this.modelVersion } : {}
|
|
185
|
-
};
|
|
186
181
|
}
|
|
182
|
+
yield {
|
|
183
|
+
interrupted: serverContent.interrupted,
|
|
184
|
+
...this.modelVersion ? { modelVersion: this.modelVersion } : {}
|
|
185
|
+
};
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
if (message.toolCall) {
|
|
@@ -9,6 +9,12 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
9
9
|
*/
|
|
10
10
|
import * as winston from "winston";
|
|
11
11
|
import { LogLevel, setLogger } from "./logger.js";
|
|
12
|
+
const WINSTON_LEVEL_NAMES = {
|
|
13
|
+
[LogLevel.DEBUG]: "debug",
|
|
14
|
+
[LogLevel.INFO]: "info",
|
|
15
|
+
[LogLevel.WARN]: "warn",
|
|
16
|
+
[LogLevel.ERROR]: "error"
|
|
17
|
+
};
|
|
12
18
|
const _WinstonLogger = class _WinstonLogger {
|
|
13
19
|
constructor() {
|
|
14
20
|
this.logLevel = LogLevel.INFO;
|
|
@@ -19,6 +25,10 @@ const _WinstonLogger = class _WinstonLogger {
|
|
|
19
25
|
"warn": LogLevel.WARN,
|
|
20
26
|
"error": LogLevel.ERROR
|
|
21
27
|
},
|
|
28
|
+
// `levels` above inverts winston's npm ordering, so `error` (3) is the
|
|
29
|
+
// most permissive and leaves winston pass-through. Every method already
|
|
30
|
+
// gates on `this.logLevel`; a lower value here would double-gate and
|
|
31
|
+
// drop records.
|
|
22
32
|
level: "error",
|
|
23
33
|
format: winston.format.combine(
|
|
24
34
|
winston.format.label({ label: "ADK" }),
|
|
@@ -42,7 +52,7 @@ const _WinstonLogger = class _WinstonLogger {
|
|
|
42
52
|
if (this.logLevel > level) {
|
|
43
53
|
return;
|
|
44
54
|
}
|
|
45
|
-
this.logger.log(level
|
|
55
|
+
this.logger.log(WINSTON_LEVEL_NAMES[level], messages.join(" "));
|
|
46
56
|
}
|
|
47
57
|
debug(...messages) {
|
|
48
58
|
if (this.logLevel > LogLevel.DEBUG) {
|
|
@@ -19,7 +19,8 @@ const toCamelCaseKey = /* @__PURE__ */ __name((key) => key.replace(
|
|
|
19
19
|
/_([a-z])/g,
|
|
20
20
|
(_match, letter) => letter.toUpperCase()
|
|
21
21
|
), "toCamelCaseKey");
|
|
22
|
-
const
|
|
22
|
+
const CAMEL_BOUNDARY = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g;
|
|
23
|
+
const toSnakeCaseKey = /* @__PURE__ */ __name((key) => key.replace(CAMEL_BOUNDARY, "_").toLowerCase().replace(/-/g, "_"), "toSnakeCaseKey");
|
|
23
24
|
function toNotation(obj, converter, parentKey = "", preserveKeys = []) {
|
|
24
25
|
if (Array.isArray(obj)) {
|
|
25
26
|
return obj.map(
|
|
@@ -50,5 +51,6 @@ function toNotation(obj, converter, parentKey = "", preserveKeys = []) {
|
|
|
50
51
|
__name(toNotation, "toNotation");
|
|
51
52
|
export {
|
|
52
53
|
toCamelCase,
|
|
53
|
-
toSnakeCase
|
|
54
|
+
toSnakeCase,
|
|
55
|
+
toSnakeCaseKey
|
|
54
56
|
};
|
|
@@ -7,10 +7,13 @@ 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 { isGemini } from "../models/google_llm.js";
|
|
10
11
|
import { isGemini2OrAbove } from "./model_name.js";
|
|
11
12
|
import { getGoogleLlmVariant, GoogleLLMVariant } from "./variant_utils.js";
|
|
12
|
-
function canUseOutputSchemaWithTools(
|
|
13
|
-
|
|
13
|
+
function canUseOutputSchemaWithTools(model) {
|
|
14
|
+
const modelString = typeof model === "string" ? model : model.model;
|
|
15
|
+
const variant = isGemini(model) ? model.apiBackend : getGoogleLlmVariant();
|
|
16
|
+
return variant === GoogleLLMVariant.VERTEX_AI && isGemini2OrAbove(modelString);
|
|
14
17
|
}
|
|
15
18
|
__name(canUseOutputSchemaWithTools, "canUseOutputSchemaWithTools");
|
|
16
19
|
export {
|
|
@@ -206,7 +206,7 @@ const _NonProgressiveStrategy = class _NonProgressiveStrategy {
|
|
|
206
206
|
this.thoughtText = "";
|
|
207
207
|
}
|
|
208
208
|
async *processResponse(llmResponse) {
|
|
209
|
-
var _a;
|
|
209
|
+
var _a, _b;
|
|
210
210
|
if ((_a = llmResponse.content) == null ? void 0 : _a.parts) {
|
|
211
211
|
const nonTextParts = [];
|
|
212
212
|
let sawTextPart = false;
|
|
@@ -226,7 +226,8 @@ const _NonProgressiveStrategy = class _NonProgressiveStrategy {
|
|
|
226
226
|
nonTextParts.push(part);
|
|
227
227
|
}
|
|
228
228
|
if (nonTextParts.length > 0) {
|
|
229
|
-
|
|
229
|
+
const startsWithInlineData = !!((_b = llmResponse.content.parts[0]) == null ? void 0 : _b.inlineData);
|
|
230
|
+
if (!startsWithInlineData && (this.thoughtText || this.text)) {
|
|
230
231
|
const parts = [];
|
|
231
232
|
if (this.thoughtText) {
|
|
232
233
|
parts.push({ text: this.thoughtText, thought: true });
|
|
@@ -277,13 +278,12 @@ const _NonProgressiveStrategy = class _NonProgressiveStrategy {
|
|
|
277
278
|
};
|
|
278
279
|
__name(_NonProgressiveStrategy, "NonProgressiveStrategy");
|
|
279
280
|
let NonProgressiveStrategy = _NonProgressiveStrategy;
|
|
280
|
-
const
|
|
281
|
-
constructor(
|
|
282
|
-
FeatureName.PROGRESSIVE_SSE_STREAMING
|
|
283
|
-
)
|
|
284
|
-
this.isProgressiveMode = isProgressiveMode;
|
|
281
|
+
const _GeminiStreamingResponseAggregator = class _GeminiStreamingResponseAggregator {
|
|
282
|
+
constructor({
|
|
283
|
+
isProgressiveMode = isFeatureEnabled(FeatureName.PROGRESSIVE_SSE_STREAMING)
|
|
284
|
+
} = {}) {
|
|
285
285
|
this.lastThoughtSignature = {};
|
|
286
|
-
this.strategy =
|
|
286
|
+
this.strategy = isProgressiveMode ? new ProgressiveStrategy() : new NonProgressiveStrategy();
|
|
287
287
|
}
|
|
288
288
|
async *processResponse(response) {
|
|
289
289
|
var _a, _b;
|
|
@@ -356,13 +356,13 @@ const _StreamingResponseAggregator = class _StreamingResponseAggregator {
|
|
|
356
356
|
};
|
|
357
357
|
}
|
|
358
358
|
};
|
|
359
|
-
__name(
|
|
360
|
-
let
|
|
359
|
+
__name(_GeminiStreamingResponseAggregator, "GeminiStreamingResponseAggregator");
|
|
360
|
+
let GeminiStreamingResponseAggregator = _GeminiStreamingResponseAggregator;
|
|
361
361
|
function isEmptyContentPart(part) {
|
|
362
362
|
return !part.functionCall && !part.functionResponse && !part.fileData && !part.inlineData && !part.executableCode && !part.codeExecutionResult && (!part.text || part.text === "");
|
|
363
363
|
}
|
|
364
364
|
__name(isEmptyContentPart, "isEmptyContentPart");
|
|
365
365
|
export {
|
|
366
|
-
|
|
366
|
+
GeminiStreamingResponseAggregator,
|
|
367
367
|
isEmptyContentPart
|
|
368
368
|
};
|
package/dist/esm/utils/task.js
CHANGED
|
@@ -16,7 +16,7 @@ const _Task = class _Task {
|
|
|
16
16
|
this.isDone = true;
|
|
17
17
|
}, "markDone");
|
|
18
18
|
this.promise = executable(this.abortController.signal);
|
|
19
|
-
this.promise.then(markDone
|
|
19
|
+
this.promise.then(markDone, markDone);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Cancels the task execution.
|
package/dist/esm/version.js
CHANGED
|
@@ -8,6 +8,7 @@ import { Client, ClientFactory } from '@a2a-js/sdk/client';
|
|
|
8
8
|
import { BaseAgent, BaseAgentConfig } from '../agents/base_agent.js';
|
|
9
9
|
import { InvocationContext } from '../agents/invocation_context.js';
|
|
10
10
|
import { Event as AdkEvent } from '../events/event.js';
|
|
11
|
+
import { ResolveAgentCardOptions } from './agent_card.js';
|
|
11
12
|
export { AGENT_CARD_PATH };
|
|
12
13
|
/**
|
|
13
14
|
* Type alias for A2A stream event data.
|
|
@@ -45,6 +46,14 @@ export interface RemoteA2AAgentConfig extends BaseAgentConfig {
|
|
|
45
46
|
* Loaded AgentCard or URL to AgentCard.
|
|
46
47
|
*/
|
|
47
48
|
agentCard?: AgentCard | string;
|
|
49
|
+
/**
|
|
50
|
+
* Controls how a fetched agent card's RPC URL(s) are validated against
|
|
51
|
+
* the location the card was fetched from. Only relevant when
|
|
52
|
+
* {@link RemoteA2AAgentConfig.agentCard} is a URL rather than an
|
|
53
|
+
* already-loaded card object; see {@link ResolveAgentCardOptions} for
|
|
54
|
+
* what each option relaxes and why both default to failing closed.
|
|
55
|
+
*/
|
|
56
|
+
resolveAgentCardOptions?: ResolveAgentCardOptions;
|
|
48
57
|
/**
|
|
49
58
|
* Optional pre-initialized Client for connection pooling.
|
|
50
59
|
*/
|
|
@@ -5,6 +5,49 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { AgentCard, AgentInterface, AgentSkill } from '@a2a-js/sdk';
|
|
7
7
|
import { RunnableRoot } from '../workflow/run_node_as_invocation.js';
|
|
8
|
+
/**
|
|
9
|
+
* Options controlling how a fetched agent card's RPC URL(s) are validated
|
|
10
|
+
* against the location the card was fetched from. See `validateCardRpcTargets`
|
|
11
|
+
* for what each check defends against and why
|
|
12
|
+
* both default to failing closed.
|
|
13
|
+
*/
|
|
14
|
+
export interface ResolveAgentCardOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Explicit escape hatch to accept a plaintext http:// RPC URL on a
|
|
17
|
+
* non-loopback host.
|
|
18
|
+
*
|
|
19
|
+
* This is intentionally insecure: an RPC URL that isn't https and isn't
|
|
20
|
+
* on this machine can be intercepted or altered by anything on the
|
|
21
|
+
* network path, even when its origin matches the card's own. Only set
|
|
22
|
+
* this for a card source you know serves plain http on a host you
|
|
23
|
+
* trust (e.g. a private, internal service reached over a channel
|
|
24
|
+
* that's secured some other way). When set to `true`, a loud warning is
|
|
25
|
+
* logged for each RPC URL this affects.
|
|
26
|
+
*
|
|
27
|
+
* Defaults to `false`: RPC URLs must be https, or http on a loopback
|
|
28
|
+
* host (localhost, 127.0.0.0/8, ::1, 0.0.0.0, or ::).
|
|
29
|
+
*/
|
|
30
|
+
allowInsecureRpc?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Explicit escape hatch to accept an RPC URL whose origin differs from
|
|
33
|
+
* the location the card was fetched from.
|
|
34
|
+
*
|
|
35
|
+
* This is intentionally permissive: it is what lets a compromised or
|
|
36
|
+
* misconfigured card-hosting endpoint redirect all subsequent A2A
|
|
37
|
+
* traffic for this agent, including whatever credential material the
|
|
38
|
+
* request-forwarding path carries, to a different origin than the one
|
|
39
|
+
* that was actually configured and fetched. The A2A spec allows a card
|
|
40
|
+
* to point RPC at a different origin than where the card itself is
|
|
41
|
+
* served from (e.g. static card hosting separate from the API
|
|
42
|
+
* backend), which is the legitimate case this exists for -- only set
|
|
43
|
+
* this when that's a shape you actually expect. When set to `true`, a
|
|
44
|
+
* loud warning is logged for each RPC URL this affects.
|
|
45
|
+
*
|
|
46
|
+
* Defaults to `false`: every RPC URL must share the origin the card
|
|
47
|
+
* was fetched from.
|
|
48
|
+
*/
|
|
49
|
+
allowCrossOriginRpc?: boolean;
|
|
50
|
+
}
|
|
8
51
|
/**
|
|
9
52
|
* Resolves the AgentCard from the provided source.
|
|
10
53
|
*
|
|
@@ -17,7 +60,7 @@ import { RunnableRoot } from '../workflow/run_node_as_invocation.js';
|
|
|
17
60
|
* private addresses stay allowed: they are where a locally served or
|
|
18
61
|
* VPC-internal peer agent lives.
|
|
19
62
|
*/
|
|
20
|
-
export declare function resolveAgentCard(agentCard: AgentCard | string): Promise<AgentCard>;
|
|
63
|
+
export declare function resolveAgentCard(agentCard: AgentCard | string, options?: ResolveAgentCardOptions): Promise<AgentCard>;
|
|
21
64
|
/**
|
|
22
65
|
* Converts an ADK agent to an A2A AgentCard.
|
|
23
66
|
*/
|
|
@@ -11,6 +11,7 @@ import { BaseMemoryService } from '../memory/base_memory_service.js';
|
|
|
11
11
|
import { Runner } from '../runner/runner.js';
|
|
12
12
|
import { BaseSessionService } from '../sessions/base_session_service.js';
|
|
13
13
|
import { RunnableRoot } from '../workflow/run_node_as_invocation.js';
|
|
14
|
+
import { ResolveAgentCardOptions } from './agent_card.js';
|
|
14
15
|
import { AdkDefaultRequestHandler, getA2aRequestMetadata } from './request_metadata.js';
|
|
15
16
|
export { AdkDefaultRequestHandler, getA2aRequestMetadata };
|
|
16
17
|
/**
|
|
@@ -39,6 +40,14 @@ export interface ToA2aOptions {
|
|
|
39
40
|
basePath?: string;
|
|
40
41
|
/** Optional pre-built AgentCard object or path to agent card JSON */
|
|
41
42
|
agentCard?: AgentCard | string;
|
|
43
|
+
/**
|
|
44
|
+
* Controls how a fetched agent card's RPC URL(s) are validated against
|
|
45
|
+
* the location the card was fetched from. Only relevant when
|
|
46
|
+
* {@link ToA2aOptions.agentCard} is a URL rather than an already-loaded
|
|
47
|
+
* card object or file path; see {@link ResolveAgentCardOptions} for
|
|
48
|
+
* what each option relaxes and why both default to failing closed.
|
|
49
|
+
*/
|
|
50
|
+
resolveAgentCardOptions?: ResolveAgentCardOptions;
|
|
42
51
|
/** Optional pre-built Runner object */
|
|
43
52
|
runner?: Runner;
|
|
44
53
|
/** Optional session service */
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
export { AGENT_CARD_PATH, RemoteA2AAgent } from './a2a_remote_agent.js';
|
|
11
11
|
export type { A2AStreamEventData, AfterA2ARequestCallback, BeforeA2ARequestCallback, RemoteA2AAgentConfig, } from './a2a_remote_agent.js';
|
|
12
12
|
export { getA2AAgentCard } from './agent_card.js';
|
|
13
|
+
export type { ResolveAgentCardOptions } from './agent_card.js';
|
|
13
14
|
export { A2AAgentExecutor } from './agent_executor.js';
|
|
14
15
|
export type { AfterEventCallback, AfterExecuteCallback, AgentExecutorConfig, BeforeExecuteCallback, RunnerOrRunnerConfig, } from './agent_executor.js';
|
|
15
16
|
export { AdkDefaultRequestHandler, getA2aRequestMetadata, toA2a, } from './agent_to_a2a.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export interface AgentEngineConfig {
|
|
7
|
+
project: string;
|
|
8
|
+
location: string;
|
|
9
|
+
reasoningEngineId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SessionConfig {
|
|
12
|
+
userId?: string;
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface QueryConfig extends SessionConfig {
|
|
16
|
+
message: unknown;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
export declare class AgentExecutionError extends Error {
|
|
20
|
+
readonly cause?: unknown | undefined;
|
|
21
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
22
|
+
}
|
|
23
|
+
export declare class AgentEngineClient {
|
|
24
|
+
private client;
|
|
25
|
+
private reasoningEnginePath;
|
|
26
|
+
constructor(config: AgentEngineConfig);
|
|
27
|
+
/**
|
|
28
|
+
* Creates a remote session.
|
|
29
|
+
*
|
|
30
|
+
* @returns The `create_session` payload returned by the Agent Engine. When
|
|
31
|
+
* `config.sessionId` is omitted the engine generates one, and this is the
|
|
32
|
+
* only place the caller can read it back from.
|
|
33
|
+
*/
|
|
34
|
+
createSession(config: SessionConfig): Promise<unknown>;
|
|
35
|
+
query(config: QueryConfig): Promise<unknown>;
|
|
36
|
+
streamQuery(config: QueryConfig): AsyncGenerator<unknown, void, unknown>;
|
|
37
|
+
}
|
|
@@ -224,6 +224,18 @@ export declare abstract class BaseAgent<TConfig extends BaseAgentConfig = BaseAg
|
|
|
224
224
|
* @return The invocation context for this agent.
|
|
225
225
|
*/
|
|
226
226
|
protected createInvocationContext(parentContext: InvocationContext): InvocationContext;
|
|
227
|
+
/**
|
|
228
|
+
* The resolved beforeAgentCallback field as a list of SingleAgentCallback.
|
|
229
|
+
*
|
|
230
|
+
* This method is only for use by Agent Development Kit.
|
|
231
|
+
*/
|
|
232
|
+
get canonicalBeforeAgentCallbacks(): SingleAgentCallback[];
|
|
233
|
+
/**
|
|
234
|
+
* The resolved afterAgentCallback field as a list of SingleAgentCallback.
|
|
235
|
+
*
|
|
236
|
+
* This method is only for use by Agent Development Kit.
|
|
237
|
+
*/
|
|
238
|
+
get canonicalAfterAgentCallbacks(): SingleAgentCallback[];
|
|
227
239
|
/**
|
|
228
240
|
* Runs the before agent callback if it exists.
|
|
229
241
|
*
|