@google/adk 1.0.0 → 1.2.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/agents/functions.js +4 -0
- package/dist/cjs/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +305 -0
- package/dist/cjs/code_executors/code_execution_utils.js +1 -1
- package/dist/cjs/common.js +19 -0
- package/dist/cjs/events/event.js +3 -1
- package/dist/cjs/index.js +97 -125
- package/dist/cjs/integrations/agent_registry/agent_registry.js +362 -0
- package/dist/cjs/integrations/agent_registry/agent_registry_mcp_toolset.js +103 -0
- package/dist/cjs/integrations/agent_registry/helpers.js +57 -0
- package/dist/cjs/integrations/agent_registry/types.js +50 -0
- package/dist/cjs/memory/vertex_ai_memory_bank_service.js +496 -0
- package/dist/cjs/runner/in_memory_runner.js +10 -5
- package/dist/cjs/runner/runner.js +32 -2
- package/dist/cjs/sessions/database_session_service.js +49 -3
- package/dist/cjs/sessions/in_memory_session_service.js +70 -14
- package/dist/cjs/sessions/registry.js +4 -0
- package/dist/cjs/sessions/vertex_ai_session_service.js +428 -0
- package/dist/cjs/tools/agent_tool.js +11 -6
- package/dist/cjs/tools/exit_loop_tool.js +9 -0
- package/dist/cjs/tools/function_tool.js +7 -2
- package/dist/cjs/tools/google_maps_grounding_tool.js +80 -0
- package/dist/cjs/tools/long_running_tool.js +2 -1
- package/dist/cjs/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/cjs/tools/mcp/mcp_tool.js +12 -7
- package/dist/cjs/tools/mcp/mcp_toolset.js +27 -4
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +78 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +84 -0
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +133 -0
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +2 -25
- package/dist/cjs/tools/url_context_tool.js +73 -0
- package/dist/cjs/tools/vertex_ai_search_tool.js +127 -0
- package/dist/cjs/tools/vertex_rag_retrieval_tool.js +64 -0
- package/dist/cjs/utils/file_utils.js +28 -0
- package/dist/cjs/utils/gemini_schema_util.js +18 -0
- package/dist/cjs/utils/model_name.js +8 -2
- package/dist/cjs/utils/partial_copy.js +51 -0
- package/dist/cjs/utils/streaming_utils.js +167 -121
- package/dist/cjs/utils/vertex_ai_utils.js +50 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/functions.js +4 -0
- package/dist/esm/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +281 -0
- package/dist/esm/code_executors/code_execution_utils.js +1 -1
- package/dist/esm/common.js +15 -0
- package/dist/esm/events/event.js +3 -1
- package/dist/esm/index.js +54 -130
- package/dist/esm/integrations/agent_registry/agent_registry.js +333 -0
- package/dist/esm/integrations/agent_registry/agent_registry_mcp_toolset.js +77 -0
- package/dist/esm/integrations/agent_registry/helpers.js +28 -0
- package/dist/esm/integrations/agent_registry/types.js +20 -0
- package/dist/esm/memory/vertex_ai_memory_bank_service.js +468 -0
- package/dist/esm/runner/in_memory_runner.js +10 -5
- package/dist/esm/runner/runner.js +32 -2
- package/dist/esm/sessions/database_session_service.js +49 -3
- package/dist/esm/sessions/in_memory_session_service.js +70 -14
- package/dist/esm/sessions/registry.js +7 -0
- package/dist/esm/sessions/vertex_ai_session_service.js +403 -0
- package/dist/esm/tools/agent_tool.js +11 -6
- package/dist/esm/tools/exit_loop_tool.js +9 -0
- package/dist/esm/tools/function_tool.js +7 -2
- package/dist/esm/tools/google_maps_grounding_tool.js +54 -0
- package/dist/esm/tools/long_running_tool.js +2 -1
- package/dist/esm/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/esm/tools/mcp/mcp_tool.js +12 -7
- package/dist/esm/tools/mcp/mcp_toolset.js +27 -4
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +48 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +60 -0
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +111 -0
- package/dist/esm/tools/skill/load_skill_resource_tool.js +1 -24
- package/dist/esm/tools/url_context_tool.js +44 -0
- package/dist/esm/tools/vertex_ai_search_tool.js +103 -0
- package/dist/esm/tools/vertex_rag_retrieval_tool.js +36 -0
- package/dist/esm/utils/file_utils.js +26 -0
- package/dist/esm/utils/gemini_schema_util.js +18 -0
- package/dist/esm/utils/model_name.js +6 -1
- package/dist/esm/utils/partial_copy.js +23 -0
- package/dist/esm/utils/streaming_utils.js +165 -120
- package/dist/esm/utils/vertex_ai_utils.js +22 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +14 -0
- package/dist/types/agents/processors/base_llm_processor.d.ts +12 -4
- package/dist/types/agents/processors/basic_llm_request_processor.d.ts +5 -0
- package/dist/types/agents/processors/identity_llm_request_processor.d.ts +4 -0
- package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +5 -0
- package/dist/types/agents/run_config.d.ts +15 -0
- package/dist/types/code_executors/agent_engine_sandbox_code_executor.d.ts +51 -0
- package/dist/types/common.d.ts +7 -0
- package/dist/types/events/event_actions.d.ts +24 -6
- package/dist/types/events/structured_events.d.ts +13 -0
- package/dist/types/examples/example_util.d.ts +25 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/integrations/agent_registry/agent_registry.d.ts +94 -0
- package/dist/types/integrations/agent_registry/agent_registry_mcp_toolset.d.ts +43 -0
- package/dist/types/integrations/agent_registry/helpers.d.ts +7 -0
- package/dist/types/integrations/agent_registry/types.d.ts +101 -0
- package/dist/types/memory/vertex_ai_memory_bank_service.d.ts +52 -0
- package/dist/types/runner/in_memory_runner.d.ts +28 -1
- package/dist/types/runner/runner.d.ts +47 -0
- package/dist/types/sessions/base_session_service.d.ts +18 -0
- package/dist/types/sessions/database_session_service.d.ts +1 -1
- package/dist/types/sessions/in_memory_session_service.d.ts +1 -1
- package/dist/types/sessions/vertex_ai_session_service.d.ts +37 -0
- package/dist/types/tools/exit_loop_tool.d.ts +9 -0
- package/dist/types/tools/function_tool.d.ts +22 -2
- package/dist/types/tools/google_maps_grounding_tool.d.ts +22 -0
- package/dist/types/tools/long_running_tool.d.ts +11 -1
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +3 -0
- package/dist/types/tools/mcp/mcp_tool.d.ts +7 -1
- package/dist/types/tools/mcp/mcp_toolset.d.ts +7 -1
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +25 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +20 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.d.ts +20 -0
- package/dist/types/tools/url_context_tool.d.ts +17 -0
- package/dist/types/tools/vertex_ai_search_tool.d.ts +55 -0
- package/dist/types/tools/vertex_rag_retrieval_tool.d.ts +42 -0
- package/dist/types/utils/file_utils.d.ts +2 -0
- package/dist/types/utils/model_name.d.ts +4 -0
- package/dist/types/utils/partial_copy.d.ts +13 -0
- package/dist/types/utils/streaming_utils.d.ts +8 -17
- package/dist/types/utils/vertex_ai_utils.d.ts +14 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/agents/functions.js +4 -0
- package/dist/web/auth/oauth2/oauth2_discovery.js +26 -2
- package/dist/web/code_executors/agent_engine_sandbox_code_executor.js +281 -0
- package/dist/web/code_executors/code_execution_utils.js +1 -1
- package/dist/web/common.js +15 -0
- package/dist/web/events/event.js +3 -1
- package/dist/web/index.js +54 -12
- package/dist/web/integrations/agent_registry/agent_registry.js +333 -0
- package/dist/web/integrations/agent_registry/agent_registry_mcp_toolset.js +90 -0
- package/dist/web/integrations/agent_registry/helpers.js +28 -0
- package/dist/web/integrations/agent_registry/types.js +20 -0
- package/dist/web/memory/vertex_ai_memory_bank_service.js +475 -0
- package/dist/web/runner/in_memory_runner.js +10 -5
- package/dist/web/runner/runner.js +32 -2
- package/dist/web/sessions/database_session_service.js +49 -3
- package/dist/web/sessions/in_memory_session_service.js +70 -14
- package/dist/web/sessions/registry.js +7 -0
- package/dist/web/sessions/vertex_ai_session_service.js +414 -0
- package/dist/web/tools/agent_tool.js +11 -6
- package/dist/web/tools/exit_loop_tool.js +9 -0
- package/dist/web/tools/function_tool.js +7 -2
- package/dist/web/tools/google_maps_grounding_tool.js +54 -0
- package/dist/web/tools/long_running_tool.js +2 -1
- package/dist/web/tools/mcp/mcp_session_manager.js +11 -0
- package/dist/web/tools/mcp/mcp_tool.js +12 -7
- package/dist/web/tools/mcp/mcp_toolset.js +27 -4
- package/dist/web/tools/openapi_tool/auth/auth_helpers.js +48 -0
- package/dist/web/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +60 -0
- package/dist/web/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +111 -0
- package/dist/web/tools/skill/load_skill_resource_tool.js +1 -24
- package/dist/web/tools/url_context_tool.js +44 -0
- package/dist/web/tools/vertex_ai_search_tool.js +103 -0
- package/dist/web/tools/vertex_rag_retrieval_tool.js +36 -0
- package/dist/web/utils/file_utils.js +26 -0
- package/dist/web/utils/gemini_schema_util.js +18 -0
- package/dist/web/utils/model_name.js +6 -1
- package/dist/web/utils/partial_copy.js +23 -0
- package/dist/web/utils/streaming_utils.js +219 -121
- package/dist/web/utils/vertex_ai_utils.js +22 -0
- package/dist/web/version.js +1 -1
- package/package.json +3 -2
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/web/index.js.map +0 -7
|
@@ -0,0 +1,127 @@
|
|
|
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 __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var vertex_ai_search_tool_exports = {};
|
|
26
|
+
__export(vertex_ai_search_tool_exports, {
|
|
27
|
+
VertexAiSearchTool: () => VertexAiSearchTool
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(vertex_ai_search_tool_exports);
|
|
30
|
+
var import_logger = require("../utils/logger.js");
|
|
31
|
+
var import_model_name = require("../utils/model_name.js");
|
|
32
|
+
var import_base_tool = require("./base_tool.js");
|
|
33
|
+
/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2026 Google LLC
|
|
36
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
37
|
+
*/
|
|
38
|
+
const logger = (0, import_logger.getLogger)();
|
|
39
|
+
class VertexAiSearchTool extends import_base_tool.BaseTool {
|
|
40
|
+
constructor(params) {
|
|
41
|
+
super({ name: "vertex_ai_search", description: "vertex_ai_search" });
|
|
42
|
+
const {
|
|
43
|
+
dataStoreId,
|
|
44
|
+
dataStoreSpecs,
|
|
45
|
+
searchEngineId,
|
|
46
|
+
filter,
|
|
47
|
+
maxResults,
|
|
48
|
+
bypassMultiToolsLimit = false
|
|
49
|
+
} = params;
|
|
50
|
+
if (dataStoreId === void 0 && searchEngineId === void 0 || dataStoreId !== void 0 && searchEngineId !== void 0) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
"Either dataStoreId or searchEngineId must be specified."
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (dataStoreSpecs !== void 0 && searchEngineId === void 0) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
"searchEngineId must be specified if dataStoreSpecs is specified."
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
this.dataStoreId = dataStoreId;
|
|
61
|
+
this.dataStoreSpecs = dataStoreSpecs;
|
|
62
|
+
this.searchEngineId = searchEngineId;
|
|
63
|
+
this.filter = filter;
|
|
64
|
+
this.maxResults = maxResults;
|
|
65
|
+
this.bypassMultiToolsLimit = bypassMultiToolsLimit;
|
|
66
|
+
}
|
|
67
|
+
runAsync() {
|
|
68
|
+
return Promise.resolve();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Builds the VertexAISearch configuration.
|
|
72
|
+
*
|
|
73
|
+
* Override this method in a subclass to dynamically customize the search
|
|
74
|
+
* configuration based on the context (e.g., set filter based on session
|
|
75
|
+
* state).
|
|
76
|
+
*/
|
|
77
|
+
buildVertexAiSearchConfig(_readonlyContext) {
|
|
78
|
+
return {
|
|
79
|
+
datastore: this.dataStoreId,
|
|
80
|
+
dataStoreSpecs: this.dataStoreSpecs,
|
|
81
|
+
engine: this.searchEngineId,
|
|
82
|
+
filter: this.filter,
|
|
83
|
+
maxResults: this.maxResults
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async processLlmRequest({
|
|
87
|
+
toolContext,
|
|
88
|
+
llmRequest
|
|
89
|
+
}) {
|
|
90
|
+
if (!llmRequest.model) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const modelCheckDisabled = (0, import_model_name.isGeminiModelIdCheckDisabled)();
|
|
94
|
+
llmRequest.config = llmRequest.config || {};
|
|
95
|
+
llmRequest.config.tools = llmRequest.config.tools || [];
|
|
96
|
+
if (!(0, import_model_name.isGeminiModel)(llmRequest.model) && !modelCheckDisabled) {
|
|
97
|
+
throw new Error(
|
|
98
|
+
`Vertex AI search tool is not supported for model ${llmRequest.model}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if ((0, import_model_name.isGemini1Model)(llmRequest.model) && llmRequest.config.tools.length > 0 && !this.bypassMultiToolsLimit) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
"Vertex AI search tool cannot be used with other tools in Gemini 1.x."
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
const vertexAiSearchConfig = this.buildVertexAiSearchConfig(toolContext);
|
|
107
|
+
let specsInfo;
|
|
108
|
+
if (vertexAiSearchConfig.dataStoreSpecs) {
|
|
109
|
+
const specIds = vertexAiSearchConfig.dataStoreSpecs.map(
|
|
110
|
+
(spec) => spec.dataStore ? spec.dataStore.split("/").pop() : "unnamed"
|
|
111
|
+
);
|
|
112
|
+
specsInfo = `${vertexAiSearchConfig.dataStoreSpecs.length} spec(s): [${specIds.join(", ")}]`;
|
|
113
|
+
}
|
|
114
|
+
logger.debug(
|
|
115
|
+
`Adding Vertex AI Search tool config to LLM request: datastore=${vertexAiSearchConfig.datastore}, engine=${vertexAiSearchConfig.engine}, filter=${vertexAiSearchConfig.filter}, maxResults=${vertexAiSearchConfig.maxResults}, dataStoreSpecs=${specsInfo}`
|
|
116
|
+
);
|
|
117
|
+
llmRequest.config.tools.push({
|
|
118
|
+
retrieval: {
|
|
119
|
+
vertexAiSearch: vertexAiSearchConfig
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
VertexAiSearchTool
|
|
127
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
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 __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var vertex_rag_retrieval_tool_exports = {};
|
|
26
|
+
__export(vertex_rag_retrieval_tool_exports, {
|
|
27
|
+
VertexRagRetrievalTool: () => VertexRagRetrievalTool
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(vertex_rag_retrieval_tool_exports);
|
|
30
|
+
var import_base_tool = require("./base_tool.js");
|
|
31
|
+
/**
|
|
32
|
+
* @license
|
|
33
|
+
* Copyright 2026 Google LLC
|
|
34
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
35
|
+
*/
|
|
36
|
+
class VertexRagRetrievalTool extends import_base_tool.BaseTool {
|
|
37
|
+
constructor(config) {
|
|
38
|
+
super({
|
|
39
|
+
name: "vertex_rag_retrieval",
|
|
40
|
+
description: "Vertex AI RAG Retrieval Tool"
|
|
41
|
+
});
|
|
42
|
+
this.vertexRagStore = config;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This tool is executed server-side by the Vertex AI RAG Engine.
|
|
46
|
+
* Local execution is not required.
|
|
47
|
+
*/
|
|
48
|
+
runAsync() {
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
}
|
|
51
|
+
async processLlmRequest({
|
|
52
|
+
llmRequest
|
|
53
|
+
}) {
|
|
54
|
+
llmRequest.config = llmRequest.config || {};
|
|
55
|
+
llmRequest.config.tools = llmRequest.config.tools || [];
|
|
56
|
+
llmRequest.config.tools.push({
|
|
57
|
+
retrieval: { vertexRagStore: this.vertexRagStore }
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
VertexRagRetrievalTool
|
|
64
|
+
});
|
|
@@ -34,6 +34,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
var file_utils_exports = {};
|
|
36
36
|
__export(file_utils_exports, {
|
|
37
|
+
EXTENSION_TO_MIME_TYPE: () => EXTENSION_TO_MIME_TYPE,
|
|
38
|
+
guessMimeType: () => guessMimeType,
|
|
37
39
|
materializeFiles: () => materializeFiles
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(file_utils_exports);
|
|
@@ -88,7 +90,33 @@ async function materializeFiles(files, dir = process.cwd()) {
|
|
|
88
90
|
}
|
|
89
91
|
return createdFiles;
|
|
90
92
|
}
|
|
93
|
+
const EXTENSION_TO_MIME_TYPE = {
|
|
94
|
+
"pdf": "application/pdf",
|
|
95
|
+
"jpg": "image/jpeg",
|
|
96
|
+
"jpeg": "image/jpeg",
|
|
97
|
+
"png": "image/png",
|
|
98
|
+
"gif": "image/gif",
|
|
99
|
+
"csv": "text/csv",
|
|
100
|
+
"json": "application/json",
|
|
101
|
+
"xml": "application/xml",
|
|
102
|
+
"sh": "text/x-shellscript",
|
|
103
|
+
"bash": "text/x-shellscript",
|
|
104
|
+
"py": "text/x-python",
|
|
105
|
+
"js": "text/javascript",
|
|
106
|
+
"cjs": "text/javascript",
|
|
107
|
+
"mjs": "text/javascript",
|
|
108
|
+
"ts": "text/javascript",
|
|
109
|
+
"cts": "text/javascript",
|
|
110
|
+
"mts": "text/javascript"
|
|
111
|
+
};
|
|
112
|
+
function guessMimeType(filePath) {
|
|
113
|
+
var _a;
|
|
114
|
+
const ext = ((_a = filePath.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "";
|
|
115
|
+
return EXTENSION_TO_MIME_TYPE[ext] || "application/octet-stream";
|
|
116
|
+
}
|
|
91
117
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
118
|
0 && (module.exports = {
|
|
119
|
+
EXTENSION_TO_MIME_TYPE,
|
|
120
|
+
guessMimeType,
|
|
93
121
|
materializeFiles
|
|
94
122
|
});
|
|
@@ -108,6 +108,21 @@ function toGeminiSchema(mcpSchema) {
|
|
|
108
108
|
mcp.type = "array";
|
|
109
109
|
} else if (isNullable) {
|
|
110
110
|
mcp.type = "null";
|
|
111
|
+
} else if (mcp.enum) {
|
|
112
|
+
const enumTypes = new Set(mcp.enum.map((v) => typeof v));
|
|
113
|
+
if (enumTypes.size === 1) {
|
|
114
|
+
const jsType = [...enumTypes][0];
|
|
115
|
+
if (jsType === "string") mcp.type = "string";
|
|
116
|
+
else if (jsType === "number") mcp.type = "number";
|
|
117
|
+
else if (jsType === "boolean") mcp.type = "boolean";
|
|
118
|
+
}
|
|
119
|
+
} else if (mcp.const !== void 0) {
|
|
120
|
+
const jsType = typeof mcp.const;
|
|
121
|
+
let inferredType;
|
|
122
|
+
if (jsType === "string") inferredType = "string";
|
|
123
|
+
else if (jsType === "number") inferredType = "number";
|
|
124
|
+
else if (jsType === "boolean") inferredType = "boolean";
|
|
125
|
+
mcp = { ...mcp, type: inferredType, enum: [mcp.const] };
|
|
111
126
|
}
|
|
112
127
|
}
|
|
113
128
|
const geminiType = toGeminiType(mcp.type);
|
|
@@ -122,6 +137,9 @@ function toGeminiSchema(mcpSchema) {
|
|
|
122
137
|
if (mcp.description) {
|
|
123
138
|
geminiSchema.description = mcp.description;
|
|
124
139
|
}
|
|
140
|
+
if (mcp.enum) {
|
|
141
|
+
geminiSchema.enum = mcp.enum.map(String);
|
|
142
|
+
}
|
|
125
143
|
if (isNullable && mcp.type !== "null") {
|
|
126
144
|
geminiSchema.nullable = true;
|
|
127
145
|
}
|
|
@@ -27,9 +27,11 @@ __export(model_name_exports, {
|
|
|
27
27
|
extractModelName: () => extractModelName,
|
|
28
28
|
isGemini1Model: () => isGemini1Model,
|
|
29
29
|
isGemini2OrAbove: () => isGemini2OrAbove,
|
|
30
|
-
isGeminiModel: () => isGeminiModel
|
|
30
|
+
isGeminiModel: () => isGeminiModel,
|
|
31
|
+
isGeminiModelIdCheckDisabled: () => isGeminiModelIdCheckDisabled
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(model_name_exports);
|
|
34
|
+
var import_env_aware_utils = require("./env_aware_utils.js");
|
|
33
35
|
/**
|
|
34
36
|
* @license
|
|
35
37
|
* Copyright 2025 Google LLC
|
|
@@ -75,10 +77,14 @@ function isGemini2OrAbove(modelString) {
|
|
|
75
77
|
const parsedVersion = parseVersion(versionString);
|
|
76
78
|
return parsedVersion.valid && parsedVersion.major >= 2;
|
|
77
79
|
}
|
|
80
|
+
function isGeminiModelIdCheckDisabled() {
|
|
81
|
+
return (0, import_env_aware_utils.getBooleanEnvVar)("ADK_DISABLE_GEMINI_MODEL_ID_CHECK");
|
|
82
|
+
}
|
|
78
83
|
// Annotate the CommonJS export names for ESM import in node:
|
|
79
84
|
0 && (module.exports = {
|
|
80
85
|
extractModelName,
|
|
81
86
|
isGemini1Model,
|
|
82
87
|
isGemini2OrAbove,
|
|
83
|
-
isGeminiModel
|
|
88
|
+
isGeminiModel,
|
|
89
|
+
isGeminiModelIdCheckDisabled
|
|
84
90
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
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 __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var partial_copy_exports = {};
|
|
26
|
+
__export(partial_copy_exports, {
|
|
27
|
+
partialCopy: () => partialCopy
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(partial_copy_exports);
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright 2026 Google LLC
|
|
33
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
34
|
+
*/
|
|
35
|
+
function partialCopy(source, targetKeys) {
|
|
36
|
+
const result = {};
|
|
37
|
+
const sourceAsUnknown = source;
|
|
38
|
+
targetKeys.forEach((key) => {
|
|
39
|
+
const keyStr = key;
|
|
40
|
+
if (keyStr in source) {
|
|
41
|
+
result[key] = sourceAsUnknown[keyStr];
|
|
42
|
+
} else {
|
|
43
|
+
result[key] = void 0;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
partialCopy
|
|
51
|
+
});
|