@anthonyhaussman/opencode-agy-auth 1.4.11-alpha.0 → 1.4.11-alpha.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/index.js +34 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19728,20 +19728,45 @@ function normalizeToolSchemaTypes(tools, toolMapper) {
|
|
|
19728
19728
|
obj.forEach(sanitizeSchema);
|
|
19729
19729
|
return;
|
|
19730
19730
|
}
|
|
19731
|
-
if (
|
|
19731
|
+
if (Array.isArray(obj.anyOf) || Array.isArray(obj.oneOf)) {
|
|
19732
19732
|
const arr = obj.anyOf || obj.oneOf;
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
|
|
19733
|
+
const hasNullBranch = arr.some(
|
|
19734
|
+
(branch) => branch && (branch.type === "null" || branch.nullable === true || Array.isArray(branch.type) && branch.type.includes("null"))
|
|
19735
|
+
);
|
|
19736
|
+
if (hasNullBranch) {
|
|
19737
|
+
obj.nullable = true;
|
|
19738
|
+
}
|
|
19739
|
+
if (!obj.type) {
|
|
19740
|
+
const candidate = arr.find(
|
|
19741
|
+
(b) => b && (typeof b.type === "string" ? b.type.toLowerCase().trim() !== "null" : Array.isArray(b.type))
|
|
19742
|
+
);
|
|
19743
|
+
if (candidate) {
|
|
19744
|
+
obj.type = candidate.type;
|
|
19745
|
+
if (candidate.items) {
|
|
19746
|
+
obj.items = candidate.items;
|
|
19747
|
+
}
|
|
19748
|
+
} else {
|
|
19749
|
+
obj.type = "STRING";
|
|
19737
19750
|
}
|
|
19751
|
+
}
|
|
19752
|
+
}
|
|
19753
|
+
if (Array.isArray(obj.type)) {
|
|
19754
|
+
const rawTypes = obj.type.map((t) => typeof t === "string" ? t.toLowerCase().trim() : "").filter(Boolean);
|
|
19755
|
+
if (rawTypes.includes("null")) {
|
|
19756
|
+
obj.nullable = true;
|
|
19757
|
+
}
|
|
19758
|
+
const nonNullType = rawTypes.find((t) => t !== "null");
|
|
19759
|
+
if (nonNullType && ["string", "number", "integer", "boolean", "array", "object"].includes(nonNullType)) {
|
|
19760
|
+
obj.type = nonNullType.toUpperCase();
|
|
19738
19761
|
} else {
|
|
19739
19762
|
obj.type = "STRING";
|
|
19740
19763
|
}
|
|
19741
|
-
}
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
|
|
19764
|
+
} else if (typeof obj.type === "string") {
|
|
19765
|
+
const t = obj.type.toLowerCase().trim();
|
|
19766
|
+
if (t === "null") {
|
|
19767
|
+
obj.type = "STRING";
|
|
19768
|
+
obj.nullable = true;
|
|
19769
|
+
} else if (["string", "number", "integer", "boolean", "array", "object"].includes(t)) {
|
|
19745
19770
|
obj.type = t.toUpperCase();
|
|
19746
19771
|
}
|
|
19747
19772
|
}
|