@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
|
@@ -25,7 +25,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var base_retrieval_tool_exports = {};
|
|
27
27
|
__export(base_retrieval_tool_exports, {
|
|
28
|
-
BaseRetrievalTool: () => BaseRetrievalTool
|
|
28
|
+
BaseRetrievalTool: () => BaseRetrievalTool,
|
|
29
|
+
isBaseRetrievalTool: () => isBaseRetrievalTool
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(base_retrieval_tool_exports);
|
|
31
32
|
var import_genai = require("@google/genai");
|
|
@@ -35,7 +36,20 @@ var import_base_tool = require("../base_tool.js");
|
|
|
35
36
|
* Copyright 2026 Google LLC
|
|
36
37
|
* SPDX-License-Identifier: Apache-2.0
|
|
37
38
|
*/
|
|
38
|
-
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
41
|
+
"google.adk.baseRetrievalTool"
|
|
42
|
+
);
|
|
43
|
+
function isBaseRetrievalTool(obj) {
|
|
44
|
+
return typeof obj === "object" && obj !== null && BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL in obj && obj[BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL] === true;
|
|
45
|
+
}
|
|
46
|
+
__name(isBaseRetrievalTool, "isBaseRetrievalTool");
|
|
47
|
+
const _BaseRetrievalTool = class _BaseRetrievalTool extends (_b = import_base_tool.BaseTool, _a = BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL, _b) {
|
|
48
|
+
constructor() {
|
|
49
|
+
super(...arguments);
|
|
50
|
+
/** Unique symbol to identify `BaseRetrievalTool` class. */
|
|
51
|
+
this[_a] = true;
|
|
52
|
+
}
|
|
39
53
|
_getDeclaration() {
|
|
40
54
|
return {
|
|
41
55
|
name: this.name,
|
|
@@ -56,5 +70,6 @@ __name(_BaseRetrievalTool, "BaseRetrievalTool");
|
|
|
56
70
|
let BaseRetrievalTool = _BaseRetrievalTool;
|
|
57
71
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
72
|
0 && (module.exports = {
|
|
59
|
-
BaseRetrievalTool
|
|
73
|
+
BaseRetrievalTool,
|
|
74
|
+
isBaseRetrievalTool
|
|
60
75
|
});
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var toolbox_toolset_exports = {};
|
|
27
|
+
__export(toolbox_toolset_exports, {
|
|
28
|
+
ToolboxToolset: () => ToolboxToolset,
|
|
29
|
+
isToolboxToolset: () => isToolboxToolset
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(toolbox_toolset_exports);
|
|
32
|
+
var import_base_tool = require("./base_tool.js");
|
|
33
|
+
var import_base_toolset = require("./base_toolset.js");
|
|
34
|
+
var import_function_tool = require("./function_tool.js");
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2026 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
39
|
+
*/
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const TOOLBOX_TOOLSET_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
42
|
+
"google.adk.toolboxToolset"
|
|
43
|
+
);
|
|
44
|
+
function isToolboxToolset(obj) {
|
|
45
|
+
return typeof obj === "object" && obj !== null && TOOLBOX_TOOLSET_SIGNATURE_SYMBOL in obj && obj[TOOLBOX_TOOLSET_SIGNATURE_SYMBOL] === true;
|
|
46
|
+
}
|
|
47
|
+
__name(isToolboxToolset, "isToolboxToolset");
|
|
48
|
+
function createUnconfiguredToolboxToolsetClient(serverUrl) {
|
|
49
|
+
const throwMissingClient = /* @__PURE__ */ __name(() => {
|
|
50
|
+
throw new Error(
|
|
51
|
+
`ToolboxToolset requires a ToolboxToolsetClientLike instance (for endpoint "${serverUrl}"). Pass {serverUrl, client} to the ToolboxToolset constructor.`
|
|
52
|
+
);
|
|
53
|
+
}, "throwMissingClient");
|
|
54
|
+
return {
|
|
55
|
+
loadTool: throwMissingClient,
|
|
56
|
+
loadToolset: throwMissingClient,
|
|
57
|
+
close: /* @__PURE__ */ __name(() => {
|
|
58
|
+
}, "close")
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
__name(createUnconfiguredToolboxToolsetClient, "createUnconfiguredToolboxToolsetClient");
|
|
62
|
+
function isToolOptionsObject(value) {
|
|
63
|
+
return typeof value === "object" && value !== null && "execute" in value && typeof value.execute === "function";
|
|
64
|
+
}
|
|
65
|
+
__name(isToolOptionsObject, "isToolOptionsObject");
|
|
66
|
+
function wrapLoadedTool(rawTool, prefix) {
|
|
67
|
+
var _a2;
|
|
68
|
+
if ((0, import_base_tool.isBaseTool)(rawTool)) {
|
|
69
|
+
if (!prefix) {
|
|
70
|
+
return rawTool;
|
|
71
|
+
}
|
|
72
|
+
return Object.assign(
|
|
73
|
+
Object.create(Object.getPrototypeOf(rawTool)),
|
|
74
|
+
rawTool,
|
|
75
|
+
{ name: `${prefix}_${rawTool.name}` }
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (typeof rawTool === "function") {
|
|
79
|
+
const fn = rawTool;
|
|
80
|
+
const baseName = fn.name || "toolbox_tool";
|
|
81
|
+
const name = prefix ? `${prefix}_${baseName}` : baseName;
|
|
82
|
+
const description = (_a2 = fn.description) != null ? _a2 : "";
|
|
83
|
+
return new import_function_tool.FunctionTool({
|
|
84
|
+
name,
|
|
85
|
+
description,
|
|
86
|
+
execute: fn
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (isToolOptionsObject(rawTool)) {
|
|
90
|
+
const baseTool = new import_function_tool.FunctionTool(rawTool);
|
|
91
|
+
if (!prefix) {
|
|
92
|
+
return baseTool;
|
|
93
|
+
}
|
|
94
|
+
return new import_function_tool.FunctionTool({
|
|
95
|
+
...rawTool,
|
|
96
|
+
name: `${prefix}_${baseTool.name}`
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
throw new TypeError(
|
|
100
|
+
"Unsupported Toolbox tool shape: expected a BaseTool, ToolOptions object, or function."
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
__name(wrapLoadedTool, "wrapLoadedTool");
|
|
104
|
+
const _ToolboxToolset = class _ToolboxToolset extends (_b = import_base_toolset.BaseToolset, _a = TOOLBOX_TOOLSET_SIGNATURE_SYMBOL, _b) {
|
|
105
|
+
constructor(serverUrlOrOptions, extraOptions) {
|
|
106
|
+
var _a2, _b2, _c, _d;
|
|
107
|
+
const options = typeof serverUrlOrOptions === "string" ? { serverUrl: serverUrlOrOptions, ...extraOptions } : serverUrlOrOptions;
|
|
108
|
+
if ((!options.toolNames || options.toolNames.length === 0) && !options.toolsetName) {
|
|
109
|
+
throw new Error("toolNames and toolsetName cannot both be undefined.");
|
|
110
|
+
}
|
|
111
|
+
super((_a2 = options.toolFilter) != null ? _a2 : [], options.prefix);
|
|
112
|
+
/** A unique symbol to identify ADK ToolboxToolset class. */
|
|
113
|
+
this[_a] = true;
|
|
114
|
+
this.serverUrl = options.serverUrl;
|
|
115
|
+
this.toolsetName = options.toolsetName;
|
|
116
|
+
this.toolNames = options.toolNames;
|
|
117
|
+
this.authTokenGetters = (_b2 = options.authTokenGetters) != null ? _b2 : {};
|
|
118
|
+
this.boundParams = (_c = options.boundParams) != null ? _c : {};
|
|
119
|
+
this.toolboxClient = (_d = options.client) != null ? _d : createUnconfiguredToolboxToolsetClient(this.serverUrl);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Loads the configured toolset and/or individual tools from the Toolbox
|
|
123
|
+
* client and returns the selected {@link BaseTool} instances.
|
|
124
|
+
*/
|
|
125
|
+
async getTools(context) {
|
|
126
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
127
|
+
const loadOptions = {
|
|
128
|
+
authTokenGetters: this.authTokenGetters,
|
|
129
|
+
boundParams: this.boundParams
|
|
130
|
+
};
|
|
131
|
+
const tools = [];
|
|
132
|
+
if (this.toolsetName) {
|
|
133
|
+
const loader = (_c = (_a2 = this.toolboxClient.loadToolset) == null ? void 0 : _a2.bind(this.toolboxClient)) != null ? _c : (_b2 = this.toolboxClient.load_toolset) == null ? void 0 : _b2.bind(this.toolboxClient);
|
|
134
|
+
if (!loader) {
|
|
135
|
+
throw new Error(
|
|
136
|
+
"ToolboxClient does not implement loadToolset or load_toolset."
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
const loadedToolset = await loader(this.toolsetName, loadOptions);
|
|
140
|
+
for (const rawTool of loadedToolset) {
|
|
141
|
+
tools.push(wrapLoadedTool(rawTool, this.prefix));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (this.toolNames && this.toolNames.length > 0) {
|
|
145
|
+
const loader = (_f = (_d = this.toolboxClient.loadTool) == null ? void 0 : _d.bind(this.toolboxClient)) != null ? _f : (_e = this.toolboxClient.load_tool) == null ? void 0 : _e.bind(this.toolboxClient);
|
|
146
|
+
if (!loader) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
"ToolboxClient does not implement loadTool or load_tool."
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
const loadedSingleTools = await Promise.all(
|
|
152
|
+
this.toolNames.map((toolName) => loader(toolName, loadOptions))
|
|
153
|
+
);
|
|
154
|
+
for (const rawTool of loadedSingleTools) {
|
|
155
|
+
tools.push(wrapLoadedTool(rawTool, this.prefix));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return tools.filter((tool) => this.isToolSelected(tool, context));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Closes the underlying Toolbox client.
|
|
162
|
+
*/
|
|
163
|
+
async close() {
|
|
164
|
+
var _a2, _b2;
|
|
165
|
+
await ((_b2 = (_a2 = this.toolboxClient).close) == null ? void 0 : _b2.call(_a2));
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
__name(_ToolboxToolset, "ToolboxToolset");
|
|
169
|
+
let ToolboxToolset = _ToolboxToolset;
|
|
170
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
171
|
+
0 && (module.exports = {
|
|
172
|
+
ToolboxToolset,
|
|
173
|
+
isToolboxToolset
|
|
174
|
+
});
|
|
@@ -67,20 +67,7 @@ const _WebMCPToolset = class _WebMCPToolset extends import_base_toolset.BaseTool
|
|
|
67
67
|
document: this.doc
|
|
68
68
|
})
|
|
69
69
|
);
|
|
70
|
-
|
|
71
|
-
if (!filter || Array.isArray(filter) && filter.length === 0) {
|
|
72
|
-
return tools;
|
|
73
|
-
}
|
|
74
|
-
if (Array.isArray(filter)) {
|
|
75
|
-
return tools.filter((tool) => filter.includes(tool.name));
|
|
76
|
-
}
|
|
77
|
-
if (context) {
|
|
78
|
-
return tools.filter((tool) => filter(tool, context));
|
|
79
|
-
}
|
|
80
|
-
import_logger.logger.warn(
|
|
81
|
-
"WebMCPToolset: a ToolPredicate toolFilter was provided but getTools() was called without a ReadonlyContext. The filter will not be applied."
|
|
82
|
-
);
|
|
83
|
-
return tools;
|
|
70
|
+
return tools.filter((tool) => this.isToolSelected(tool, context));
|
|
84
71
|
}
|
|
85
72
|
/**
|
|
86
73
|
* Subscribes to the WebMCP `toolchange` event, which fires when the page
|
|
@@ -129,7 +129,8 @@ function headerEntries(headers) {
|
|
|
129
129
|
__name(headerEntries, "headerEntries");
|
|
130
130
|
function mergeTrackingHeaders(headers) {
|
|
131
131
|
var _a, _b;
|
|
132
|
-
const
|
|
132
|
+
const otherHeaders = new Headers();
|
|
133
|
+
const originalNames = /* @__PURE__ */ new Map();
|
|
133
134
|
const callerValues = /* @__PURE__ */ new Map();
|
|
134
135
|
for (const [name, value] of headerEntries(headers)) {
|
|
135
136
|
const lowerName = name.toLowerCase();
|
|
@@ -139,9 +140,25 @@ function mergeTrackingHeaders(headers) {
|
|
|
139
140
|
value
|
|
140
141
|
]);
|
|
141
142
|
} else {
|
|
142
|
-
|
|
143
|
+
if (!originalNames.has(lowerName)) {
|
|
144
|
+
originalNames.set(lowerName, name);
|
|
145
|
+
}
|
|
146
|
+
otherHeaders.append(name, value);
|
|
143
147
|
}
|
|
144
148
|
}
|
|
149
|
+
const normalizedEntries = [];
|
|
150
|
+
otherHeaders.forEach((value, name) => {
|
|
151
|
+
normalizedEntries.push([name, value]);
|
|
152
|
+
});
|
|
153
|
+
const merged = Object.fromEntries(
|
|
154
|
+
normalizedEntries.map(([name, value]) => {
|
|
155
|
+
var _a2;
|
|
156
|
+
return [
|
|
157
|
+
(_a2 = originalNames.get(name)) != null ? _a2 : name,
|
|
158
|
+
value
|
|
159
|
+
];
|
|
160
|
+
})
|
|
161
|
+
);
|
|
145
162
|
for (const [name, trackingValue] of Object.entries(getTrackingHeaders())) {
|
|
146
163
|
const tokens = trackingValue.split(" ");
|
|
147
164
|
for (const value of (_b = callerValues.get(name)) != null ? _b : []) {
|
|
@@ -70,14 +70,10 @@ function randomUUID() {
|
|
|
70
70
|
__name(randomUUID, "randomUUID");
|
|
71
71
|
function base64Encode(data) {
|
|
72
72
|
if (isBrowser()) {
|
|
73
|
+
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
73
74
|
let strData = "";
|
|
74
|
-
|
|
75
|
-
strData
|
|
76
|
-
} else {
|
|
77
|
-
const len = data.byteLength;
|
|
78
|
-
for (let i = 0; i < len; i++) {
|
|
79
|
-
strData += String.fromCharCode(data[i]);
|
|
80
|
-
}
|
|
75
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
76
|
+
strData += String.fromCharCode(bytes[i]);
|
|
81
77
|
}
|
|
82
78
|
return window.btoa(strData);
|
|
83
79
|
}
|
|
@@ -86,7 +82,9 @@ function base64Encode(data) {
|
|
|
86
82
|
__name(base64Encode, "base64Encode");
|
|
87
83
|
function base64Decode(data) {
|
|
88
84
|
if (isBrowser()) {
|
|
89
|
-
|
|
85
|
+
const binary = window.atob(data);
|
|
86
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
87
|
+
return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
|
|
90
88
|
}
|
|
91
89
|
return Buffer.from(data, "base64").toString();
|
|
92
90
|
}
|
|
@@ -25,7 +25,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var error_utils_exports = {};
|
|
27
27
|
__export(error_utils_exports, {
|
|
28
|
-
formatError: () => formatError
|
|
28
|
+
formatError: () => formatError,
|
|
29
|
+
getErrorMessage: () => getErrorMessage
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(error_utils_exports);
|
|
31
32
|
/**
|
|
@@ -55,16 +56,14 @@ function truncateBody(body) {
|
|
|
55
56
|
return body.length > MAX_RESPONSE_BODY_LENGTH ? body.slice(0, MAX_RESPONSE_BODY_LENGTH) + TRUNCATION_MARKER : body;
|
|
56
57
|
}
|
|
57
58
|
__name(truncateBody, "truncateBody");
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (typeof err === "string") {
|
|
63
|
-
return err;
|
|
59
|
+
function getErrorMessage(err) {
|
|
60
|
+
const record = asRecord(err);
|
|
61
|
+
if (record !== void 0 && typeof record["message"] === "string") {
|
|
62
|
+
return record["message"];
|
|
64
63
|
}
|
|
65
64
|
return String(err);
|
|
66
65
|
}
|
|
67
|
-
__name(
|
|
66
|
+
__name(getErrorMessage, "getErrorMessage");
|
|
68
67
|
function extractHttpDetails(err) {
|
|
69
68
|
var _a, _b;
|
|
70
69
|
const record = asRecord(err);
|
|
@@ -97,7 +96,7 @@ function formatErrorRecursive(err, seen) {
|
|
|
97
96
|
}
|
|
98
97
|
if (typeof err === "object") {
|
|
99
98
|
if (seen.has(err)) {
|
|
100
|
-
return
|
|
99
|
+
return getErrorMessage(err);
|
|
101
100
|
}
|
|
102
101
|
seen.add(err);
|
|
103
102
|
}
|
|
@@ -105,7 +104,7 @@ function formatErrorRecursive(err, seen) {
|
|
|
105
104
|
return err.errors.map((sub) => formatErrorRecursive(sub, seen)).join(" | ");
|
|
106
105
|
}
|
|
107
106
|
const http = extractHttpDetails(err);
|
|
108
|
-
const base =
|
|
107
|
+
const base = getErrorMessage(err);
|
|
109
108
|
const cause = (_a = asRecord(err)) == null ? void 0 : _a["cause"];
|
|
110
109
|
const causeMessage = cause !== void 0 ? formatErrorRecursive(cause, seen) : void 0;
|
|
111
110
|
let message = base.length > 0 ? base : UNKNOWN_ERROR;
|
|
@@ -124,5 +123,6 @@ function formatError(err) {
|
|
|
124
123
|
__name(formatError, "formatError");
|
|
125
124
|
// Annotate the CommonJS export names for ESM import in node:
|
|
126
125
|
0 && (module.exports = {
|
|
127
|
-
formatError
|
|
126
|
+
formatError,
|
|
127
|
+
getErrorMessage
|
|
128
128
|
});
|
|
@@ -47,9 +47,9 @@ async function* runWithRouting(items, context, router, runFn) {
|
|
|
47
47
|
}
|
|
48
48
|
const triedKeys = /* @__PURE__ */ new Set([selectedKey]);
|
|
49
49
|
while (true) {
|
|
50
|
-
const generatorOrPromise = runFn(selectedItem);
|
|
51
50
|
let firstYielded = false;
|
|
52
51
|
try {
|
|
52
|
+
const generatorOrPromise = runFn(selectedItem);
|
|
53
53
|
if (isAsyncGenerator(generatorOrPromise)) {
|
|
54
54
|
for await (const result2 of generatorOrPromise) {
|
|
55
55
|
yield result2;
|
|
@@ -37,7 +37,17 @@ var import_code_execution_utils = require("../code_executors/code_execution_util
|
|
|
37
37
|
*/
|
|
38
38
|
const MIME_TYPE_MAP = {
|
|
39
39
|
".js": { mimeType: "text/javascript", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
40
|
+
".cjs": { mimeType: "text/javascript", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
41
|
+
".mjs": { mimeType: "text/javascript", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
42
|
+
".ts": { mimeType: "text/javascript", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
43
|
+
".cts": { mimeType: "text/javascript", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
44
|
+
".mts": { mimeType: "text/javascript", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
40
45
|
".py": { mimeType: "text/x-python", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
46
|
+
".sh": { mimeType: "text/x-shellscript", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
47
|
+
".bash": {
|
|
48
|
+
mimeType: "text/x-shellscript",
|
|
49
|
+
encoding: import_code_execution_utils.FileContentEncoding.UTF8
|
|
50
|
+
},
|
|
41
51
|
".md": { mimeType: "text/markdown", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
42
52
|
".txt": { mimeType: "text/plain", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
43
53
|
".html": { mimeType: "text/html", encoding: import_code_execution_utils.FileContentEncoding.UTF8 },
|
|
@@ -51,6 +61,7 @@ const MIME_TYPE_MAP = {
|
|
|
51
61
|
".png": { mimeType: "image/png", encoding: import_code_execution_utils.FileContentEncoding.BASE64 },
|
|
52
62
|
".jpg": { mimeType: "image/jpeg", encoding: import_code_execution_utils.FileContentEncoding.BASE64 },
|
|
53
63
|
".jpeg": { mimeType: "image/jpeg", encoding: import_code_execution_utils.FileContentEncoding.BASE64 },
|
|
64
|
+
".gif": { mimeType: "image/gif", encoding: import_code_execution_utils.FileContentEncoding.BASE64 },
|
|
54
65
|
".pdf": { mimeType: "application/pdf", encoding: import_code_execution_utils.FileContentEncoding.BASE64 }
|
|
55
66
|
};
|
|
56
67
|
const EXTENSION_TO_LANGUAGE = {
|
|
@@ -35,13 +35,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
36
|
var file_utils_exports = {};
|
|
37
37
|
__export(file_utils_exports, {
|
|
38
|
-
EXTENSION_TO_MIME_TYPE: () => EXTENSION_TO_MIME_TYPE,
|
|
39
38
|
guessMimeType: () => guessMimeType,
|
|
40
39
|
materializeFiles: () => materializeFiles
|
|
41
40
|
});
|
|
42
41
|
module.exports = __toCommonJS(file_utils_exports);
|
|
43
42
|
var fs = __toESM(require("node:fs/promises"), 1);
|
|
44
43
|
var path = __toESM(require("node:path"), 1);
|
|
44
|
+
var import_file_extension_utils = require("./file_extension_utils.js");
|
|
45
45
|
/**
|
|
46
46
|
* @license
|
|
47
47
|
* Copyright 2026 Google LLC
|
|
@@ -97,34 +97,12 @@ async function materializeFiles(files, dir) {
|
|
|
97
97
|
return createdFiles;
|
|
98
98
|
}
|
|
99
99
|
__name(materializeFiles, "materializeFiles");
|
|
100
|
-
const EXTENSION_TO_MIME_TYPE = {
|
|
101
|
-
"pdf": "application/pdf",
|
|
102
|
-
"jpg": "image/jpeg",
|
|
103
|
-
"jpeg": "image/jpeg",
|
|
104
|
-
"png": "image/png",
|
|
105
|
-
"gif": "image/gif",
|
|
106
|
-
"csv": "text/csv",
|
|
107
|
-
"json": "application/json",
|
|
108
|
-
"xml": "application/xml",
|
|
109
|
-
"sh": "text/x-shellscript",
|
|
110
|
-
"bash": "text/x-shellscript",
|
|
111
|
-
"py": "text/x-python",
|
|
112
|
-
"js": "text/javascript",
|
|
113
|
-
"cjs": "text/javascript",
|
|
114
|
-
"mjs": "text/javascript",
|
|
115
|
-
"ts": "text/javascript",
|
|
116
|
-
"cts": "text/javascript",
|
|
117
|
-
"mts": "text/javascript"
|
|
118
|
-
};
|
|
119
100
|
function guessMimeType(filePath) {
|
|
120
|
-
|
|
121
|
-
const ext = ((_a = filePath.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "";
|
|
122
|
-
return EXTENSION_TO_MIME_TYPE[ext] || "application/octet-stream";
|
|
101
|
+
return (0, import_file_extension_utils.getMimeTypeAndEncoding)(path.extname(filePath)).mimeType;
|
|
123
102
|
}
|
|
124
103
|
__name(guessMimeType, "guessMimeType");
|
|
125
104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
126
105
|
0 && (module.exports = {
|
|
127
|
-
EXTENSION_TO_MIME_TYPE,
|
|
128
106
|
guessMimeType,
|
|
129
107
|
materializeFiles
|
|
130
108
|
});
|
|
@@ -25,6 +25,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var gemini_schema_util_exports = {};
|
|
27
27
|
__export(gemini_schema_util_exports, {
|
|
28
|
+
normalizeJsonSchemaType: () => normalizeJsonSchemaType,
|
|
28
29
|
openApiSchemaToGeminiSchema: () => openApiSchemaToGeminiSchema,
|
|
29
30
|
toGeminiSchema: () => toGeminiSchema
|
|
30
31
|
});
|
|
@@ -72,6 +73,9 @@ function toGeminiSchema(mcpSchema) {
|
|
|
72
73
|
}
|
|
73
74
|
function recursiveConvert(mcp) {
|
|
74
75
|
var _a;
|
|
76
|
+
if (typeof mcp === "boolean") {
|
|
77
|
+
mcp = { type: "object" };
|
|
78
|
+
}
|
|
75
79
|
const sourceType = (_a = mcp.anyOf) != null ? _a : mcp.type;
|
|
76
80
|
let isNullable = false;
|
|
77
81
|
let nonNullTypes;
|
|
@@ -162,7 +166,7 @@ function toGeminiSchema(mcpSchema) {
|
|
|
162
166
|
geminiSchema.required = mcp.required;
|
|
163
167
|
}
|
|
164
168
|
} else if (geminiType === import_genai.Type.ARRAY) {
|
|
165
|
-
if (mcp.items) {
|
|
169
|
+
if (mcp.items || mcp.items === false) {
|
|
166
170
|
geminiSchema.items = recursiveConvert(mcp.items);
|
|
167
171
|
}
|
|
168
172
|
}
|
|
@@ -201,7 +205,6 @@ const GEMINI_REJECTED_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
|
|
|
201
205
|
"default",
|
|
202
206
|
"format"
|
|
203
207
|
]);
|
|
204
|
-
const EMPTY_OBJECT_PLACEHOLDER = "dummy_DO_NOT_GENERATE";
|
|
205
208
|
function toGeminiSchemaField(key) {
|
|
206
209
|
return (0, import_case_utils.toSnakeCaseName)(key).replace(
|
|
207
210
|
/_([a-z0-9])/g,
|
|
@@ -213,6 +216,23 @@ function isPlainObject(value) {
|
|
|
213
216
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
214
217
|
}
|
|
215
218
|
__name(isPlainObject, "isPlainObject");
|
|
219
|
+
function normalizeJsonSchemaType(jsonSchemaType) {
|
|
220
|
+
if (typeof jsonSchemaType === "string") {
|
|
221
|
+
if (jsonSchemaType === "null") {
|
|
222
|
+
return [void 0, true];
|
|
223
|
+
}
|
|
224
|
+
return [jsonSchemaType, false];
|
|
225
|
+
}
|
|
226
|
+
if (Array.isArray(jsonSchemaType)) {
|
|
227
|
+
const nullable = jsonSchemaType.includes("null");
|
|
228
|
+
const nonNullTypes = jsonSchemaType.filter(
|
|
229
|
+
(t) => typeof t === "string" && t !== "null"
|
|
230
|
+
);
|
|
231
|
+
return [nonNullTypes[0], nullable];
|
|
232
|
+
}
|
|
233
|
+
return [void 0, false];
|
|
234
|
+
}
|
|
235
|
+
__name(normalizeJsonSchemaType, "normalizeJsonSchemaType");
|
|
216
236
|
function convertSchemaField(field, value) {
|
|
217
237
|
if (field === "type") {
|
|
218
238
|
return toGeminiType(typeof value === "string" ? value : void 0);
|
|
@@ -242,14 +262,14 @@ function openApiSchemaToGeminiSchema(openApiSchema) {
|
|
|
242
262
|
throw new TypeError("openapi_schema must be a dictionary");
|
|
243
263
|
}
|
|
244
264
|
const source = { ...openApiSchema };
|
|
265
|
+
const [schemaType, nullable] = normalizeJsonSchemaType(source["type"]);
|
|
266
|
+
source["type"] = schemaType;
|
|
267
|
+
if (nullable) {
|
|
268
|
+
source["nullable"] = true;
|
|
269
|
+
}
|
|
245
270
|
if (!source["type"]) {
|
|
246
271
|
source["type"] = "object";
|
|
247
272
|
}
|
|
248
|
-
const properties = source["properties"];
|
|
249
|
-
const hasProperties = isPlainObject(properties) && Object.keys(properties).length > 0;
|
|
250
|
-
if (source["type"] === "object" && !hasProperties) {
|
|
251
|
-
source["properties"] = { [EMPTY_OBJECT_PLACEHOLDER]: { type: "string" } };
|
|
252
|
-
}
|
|
253
273
|
const converted = {};
|
|
254
274
|
for (const [key, value] of Object.entries(source)) {
|
|
255
275
|
const field = toGeminiSchemaField(key);
|
|
@@ -263,6 +283,7 @@ function openApiSchemaToGeminiSchema(openApiSchema) {
|
|
|
263
283
|
__name(openApiSchemaToGeminiSchema, "openApiSchemaToGeminiSchema");
|
|
264
284
|
// Annotate the CommonJS export names for ESM import in node:
|
|
265
285
|
0 && (module.exports = {
|
|
286
|
+
normalizeJsonSchemaType,
|
|
266
287
|
openApiSchemaToGeminiSchema,
|
|
267
288
|
toGeminiSchema
|
|
268
289
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var json_utils_exports = {};
|
|
27
|
+
__export(json_utils_exports, {
|
|
28
|
+
isJsonObject: () => isJsonObject,
|
|
29
|
+
toJsonObject: () => toJsonObject
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(json_utils_exports);
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2026 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
36
|
+
*/
|
|
37
|
+
function isJsonObject(value) {
|
|
38
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
39
|
+
}
|
|
40
|
+
__name(isJsonObject, "isJsonObject");
|
|
41
|
+
function toJsonObject(value) {
|
|
42
|
+
return isJsonObject(value) ? value : {};
|
|
43
|
+
}
|
|
44
|
+
__name(toJsonObject, "toJsonObject");
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
isJsonObject,
|
|
48
|
+
toJsonObject
|
|
49
|
+
});
|
|
@@ -204,12 +204,11 @@ const _LiveResponseAggregator = class _LiveResponseAggregator {
|
|
|
204
204
|
yield this.buildFullTextResponse(this.text, this.isThought);
|
|
205
205
|
this.text = "";
|
|
206
206
|
this.isThought = false;
|
|
207
|
-
} else {
|
|
208
|
-
yield {
|
|
209
|
-
interrupted: serverContent.interrupted,
|
|
210
|
-
...this.modelVersion ? { modelVersion: this.modelVersion } : {}
|
|
211
|
-
};
|
|
212
207
|
}
|
|
208
|
+
yield {
|
|
209
|
+
interrupted: serverContent.interrupted,
|
|
210
|
+
...this.modelVersion ? { modelVersion: this.modelVersion } : {}
|
|
211
|
+
};
|
|
213
212
|
}
|
|
214
213
|
}
|
|
215
214
|
if (message.toolCall) {
|
|
@@ -46,6 +46,12 @@ var import_logger = require("./logger.js");
|
|
|
46
46
|
* Copyright 2026 Google LLC
|
|
47
47
|
* SPDX-License-Identifier: Apache-2.0
|
|
48
48
|
*/
|
|
49
|
+
const WINSTON_LEVEL_NAMES = {
|
|
50
|
+
[import_logger.LogLevel.DEBUG]: "debug",
|
|
51
|
+
[import_logger.LogLevel.INFO]: "info",
|
|
52
|
+
[import_logger.LogLevel.WARN]: "warn",
|
|
53
|
+
[import_logger.LogLevel.ERROR]: "error"
|
|
54
|
+
};
|
|
49
55
|
const _WinstonLogger = class _WinstonLogger {
|
|
50
56
|
constructor() {
|
|
51
57
|
this.logLevel = import_logger.LogLevel.INFO;
|
|
@@ -56,6 +62,10 @@ const _WinstonLogger = class _WinstonLogger {
|
|
|
56
62
|
"warn": import_logger.LogLevel.WARN,
|
|
57
63
|
"error": import_logger.LogLevel.ERROR
|
|
58
64
|
},
|
|
65
|
+
// `levels` above inverts winston's npm ordering, so `error` (3) is the
|
|
66
|
+
// most permissive and leaves winston pass-through. Every method already
|
|
67
|
+
// gates on `this.logLevel`; a lower value here would double-gate and
|
|
68
|
+
// drop records.
|
|
59
69
|
level: "error",
|
|
60
70
|
format: winston.format.combine(
|
|
61
71
|
winston.format.label({ label: "ADK" }),
|
|
@@ -79,7 +89,7 @@ const _WinstonLogger = class _WinstonLogger {
|
|
|
79
89
|
if (this.logLevel > level) {
|
|
80
90
|
return;
|
|
81
91
|
}
|
|
82
|
-
this.logger.log(level
|
|
92
|
+
this.logger.log(WINSTON_LEVEL_NAMES[level], messages.join(" "));
|
|
83
93
|
}
|
|
84
94
|
debug(...messages) {
|
|
85
95
|
if (this.logLevel > import_logger.LogLevel.DEBUG) {
|
|
@@ -26,7 +26,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
26
|
var object_notation_utils_exports = {};
|
|
27
27
|
__export(object_notation_utils_exports, {
|
|
28
28
|
toCamelCase: () => toCamelCase,
|
|
29
|
-
toSnakeCase: () => toSnakeCase
|
|
29
|
+
toSnakeCase: () => toSnakeCase,
|
|
30
|
+
toSnakeCaseKey: () => toSnakeCaseKey
|
|
30
31
|
});
|
|
31
32
|
module.exports = __toCommonJS(object_notation_utils_exports);
|
|
32
33
|
/**
|
|
@@ -46,7 +47,8 @@ const toCamelCaseKey = /* @__PURE__ */ __name((key) => key.replace(
|
|
|
46
47
|
/_([a-z])/g,
|
|
47
48
|
(_match, letter) => letter.toUpperCase()
|
|
48
49
|
), "toCamelCaseKey");
|
|
49
|
-
const
|
|
50
|
+
const CAMEL_BOUNDARY = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g;
|
|
51
|
+
const toSnakeCaseKey = /* @__PURE__ */ __name((key) => key.replace(CAMEL_BOUNDARY, "_").toLowerCase().replace(/-/g, "_"), "toSnakeCaseKey");
|
|
50
52
|
function toNotation(obj, converter, parentKey = "", preserveKeys = []) {
|
|
51
53
|
if (Array.isArray(obj)) {
|
|
52
54
|
return obj.map(
|
|
@@ -78,5 +80,6 @@ __name(toNotation, "toNotation");
|
|
|
78
80
|
// Annotate the CommonJS export names for ESM import in node:
|
|
79
81
|
0 && (module.exports = {
|
|
80
82
|
toCamelCase,
|
|
81
|
-
toSnakeCase
|
|
83
|
+
toSnakeCase,
|
|
84
|
+
toSnakeCaseKey
|
|
82
85
|
});
|