@google/adk 0.6.0 → 0.6.1
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 +18 -13
- package/dist/cjs/a2a/a2a_remote_agent_run_processor.js +7 -0
- package/dist/cjs/index.js +16 -16
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/utils/gemini_schema_util.js +54 -12
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_remote_agent.js +18 -13
- package/dist/esm/a2a/a2a_remote_agent_run_processor.js +7 -0
- package/dist/esm/index.js +15 -15
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/utils/gemini_schema_util.js +54 -12
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +7 -3
- package/dist/types/version.d.ts +1 -1
- package/dist/web/a2a/a2a_remote_agent.js +15 -24
- package/dist/web/a2a/a2a_remote_agent_run_processor.js +7 -0
- package/dist/web/index.js +1 -1
- package/dist/web/index.js.map +1 -1
- package/dist/web/utils/gemini_schema_util.js +85 -12
- package/dist/web/version.js +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
1
32
|
/**
|
|
2
33
|
* @license
|
|
3
34
|
* Copyright 2025 Google LLC
|
|
@@ -26,22 +57,50 @@ function toGeminiType(mcpType) {
|
|
|
26
57
|
return Type.ARRAY;
|
|
27
58
|
case "object":
|
|
28
59
|
return Type.OBJECT;
|
|
60
|
+
case "null":
|
|
61
|
+
return Type.NULL;
|
|
29
62
|
default:
|
|
30
63
|
return Type.TYPE_UNSPECIFIED;
|
|
31
64
|
}
|
|
32
65
|
}
|
|
66
|
+
const getTypeFromArrayItem = (mcpType) => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
if (typeof mcpType === "string") {
|
|
69
|
+
return mcpType.toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
return (_b = (_a = mcpType == null ? void 0 : mcpType.type) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a);
|
|
72
|
+
};
|
|
33
73
|
function toGeminiSchema(mcpSchema) {
|
|
34
74
|
if (!mcpSchema) {
|
|
35
75
|
return void 0;
|
|
36
76
|
}
|
|
37
77
|
function recursiveConvert(mcp) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
78
|
+
var _a;
|
|
79
|
+
const sourceType = (_a = mcp.anyOf) != null ? _a : mcp.type;
|
|
80
|
+
let isNullable = false;
|
|
81
|
+
let nonNullTypes;
|
|
82
|
+
if (Array.isArray(sourceType)) {
|
|
83
|
+
nonNullTypes = sourceType.filter(
|
|
84
|
+
(t) => getTypeFromArrayItem(t) !== "null"
|
|
85
|
+
);
|
|
86
|
+
isNullable = sourceType.some(
|
|
87
|
+
(t) => getTypeFromArrayItem(t) === "null"
|
|
88
|
+
);
|
|
89
|
+
if (nonNullTypes.length === 1) {
|
|
90
|
+
const nonNullType = nonNullTypes[0];
|
|
91
|
+
if (typeof nonNullType === "object") {
|
|
92
|
+
mcp = nonNullType;
|
|
93
|
+
} else {
|
|
94
|
+
const _b = mcp, { type: _removed, anyOf: _removedAnyOf } = _b, rest = __objRest(_b, ["type", "anyOf"]);
|
|
95
|
+
mcp = __spreadProps(__spreadValues({}, rest), { type: nonNullType });
|
|
96
|
+
}
|
|
97
|
+
} else if (nonNullTypes.length === 0 && isNullable) {
|
|
98
|
+
const _c = mcp, { type: _removed, anyOf: _removedAnyOf } = _c, rest = __objRest(_c, ["type", "anyOf"]);
|
|
99
|
+
mcp = __spreadProps(__spreadValues({}, rest), { type: "null" });
|
|
100
|
+
} else if (typeof mcp.anyOf === "undefined") {
|
|
101
|
+
const anyOfItems = mcp.type.map((t) => ({ type: t }));
|
|
102
|
+
const _d = mcp, { type: _removed } = _d, rest = __objRest(_d, ["type"]);
|
|
103
|
+
mcp = __spreadProps(__spreadValues({}, rest), { anyOf: anyOfItems });
|
|
45
104
|
}
|
|
46
105
|
}
|
|
47
106
|
if (!mcp.type) {
|
|
@@ -49,13 +108,25 @@ function toGeminiSchema(mcpSchema) {
|
|
|
49
108
|
mcp.type = "object";
|
|
50
109
|
} else if (mcp.items) {
|
|
51
110
|
mcp.type = "array";
|
|
111
|
+
} else if (isNullable) {
|
|
112
|
+
mcp.type = "null";
|
|
52
113
|
}
|
|
53
114
|
}
|
|
54
115
|
const geminiType = toGeminiType(mcp.type);
|
|
55
|
-
const geminiSchema = {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
116
|
+
const geminiSchema = {};
|
|
117
|
+
if (mcp.anyOf) {
|
|
118
|
+
geminiSchema.anyOf = mcp.anyOf.map(
|
|
119
|
+
(item) => recursiveConvert(item)
|
|
120
|
+
);
|
|
121
|
+
} else {
|
|
122
|
+
geminiSchema.type = geminiType;
|
|
123
|
+
}
|
|
124
|
+
if (mcp.description) {
|
|
125
|
+
geminiSchema.description = mcp.description;
|
|
126
|
+
}
|
|
127
|
+
if (isNullable && mcp.type !== "null") {
|
|
128
|
+
geminiSchema.nullable = true;
|
|
129
|
+
}
|
|
59
130
|
if (geminiType === Type.OBJECT) {
|
|
60
131
|
geminiSchema.properties = {};
|
|
61
132
|
if (mcp.properties) {
|
|
@@ -65,7 +136,9 @@ function toGeminiSchema(mcpSchema) {
|
|
|
65
136
|
);
|
|
66
137
|
}
|
|
67
138
|
}
|
|
68
|
-
|
|
139
|
+
if (mcp.required) {
|
|
140
|
+
geminiSchema.required = mcp.required;
|
|
141
|
+
}
|
|
69
142
|
} else if (geminiType === Type.ARRAY) {
|
|
70
143
|
if (mcp.items) {
|
|
71
144
|
geminiSchema.items = recursiveConvert(mcp.items);
|
package/dist/web/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/adk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Google ADK JS",
|
|
5
5
|
"author": "Google",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@a2a-js/sdk": "^0.3.10",
|
|
44
44
|
"@google/genai": "^1.37.0",
|
|
45
|
-
"@mikro-orm/core": "^6.6.
|
|
45
|
+
"@mikro-orm/core": "^6.6.10",
|
|
46
46
|
"@mikro-orm/reflection": "^6.6.6",
|
|
47
47
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
48
48
|
"express": "^4.22.1",
|