@ai-sdk-tool/parser 4.0.0 → 4.0.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/{chunk-CXWS24JX.js → chunk-76E6H46R.js} +2 -2
- package/dist/{chunk-2KK5BDZF.js → chunk-DJB4DAZO.js} +23 -6
- package/dist/chunk-DJB4DAZO.js.map +1 -0
- package/dist/{chunk-ERJKQKCR.js → chunk-DPGORNPB.js} +17 -7
- package/dist/chunk-DPGORNPB.js.map +1 -0
- package/dist/community.cjs +36 -9
- package/dist/community.cjs.map +1 -1
- package/dist/community.js +3 -3
- package/dist/index.cjs +36 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/rxml.cjs +22 -5
- package/dist/rxml.cjs.map +1 -1
- package/dist/rxml.js +2 -2
- package/dist/schema-coerce.cjs +22 -5
- package/dist/schema-coerce.cjs.map +1 -1
- package/dist/schema-coerce.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2KK5BDZF.js.map +0 -1
- package/dist/chunk-ERJKQKCR.js.map +0 -1
- /package/dist/{chunk-CXWS24JX.js.map → chunk-76E6H46R.js.map} +0 -0
package/dist/community.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createToolMiddleware,
|
|
3
3
|
xmlProtocol
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-DPGORNPB.js";
|
|
5
|
+
import "./chunk-76E6H46R.js";
|
|
6
6
|
import "./chunk-IX4FJELL.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-DJB4DAZO.js";
|
|
8
8
|
|
|
9
9
|
// src/community/sijawara.ts
|
|
10
10
|
var sijawaraDetailedXmlToolMiddleware = createToolMiddleware({
|
package/dist/index.cjs
CHANGED
|
@@ -894,9 +894,19 @@ function getPotentialStartIndex(text, searchedText) {
|
|
|
894
894
|
if (directIndex !== -1) {
|
|
895
895
|
return directIndex;
|
|
896
896
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
897
|
+
const textLength = text.length;
|
|
898
|
+
const searchedTextLength = searchedText.length;
|
|
899
|
+
const startAt = Math.max(0, textLength - searchedTextLength + 1);
|
|
900
|
+
for (let i = startAt; i < textLength; i++) {
|
|
901
|
+
let match = true;
|
|
902
|
+
const currentSuffixLength = textLength - i;
|
|
903
|
+
for (let j = 0; j < currentSuffixLength; j++) {
|
|
904
|
+
if (text[i + j] !== searchedText[j]) {
|
|
905
|
+
match = false;
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
if (match) {
|
|
900
910
|
return i;
|
|
901
911
|
}
|
|
902
912
|
}
|
|
@@ -2184,13 +2194,20 @@ function coerceStringWithoutSchema(value) {
|
|
|
2184
2194
|
}
|
|
2185
2195
|
function coerceStringToObject(s, unwrapped) {
|
|
2186
2196
|
try {
|
|
2187
|
-
|
|
2188
|
-
normalized = normalized.replace(EMPTY_OBJECT_REGEX, "{}");
|
|
2189
|
-
const obj = JSON.parse(normalized);
|
|
2197
|
+
const obj = JSON.parse(s);
|
|
2190
2198
|
if (obj && typeof obj === "object" && !Array.isArray(obj)) {
|
|
2191
2199
|
return coerceObjectToObject(obj, unwrapped);
|
|
2192
2200
|
}
|
|
2193
2201
|
} catch (e) {
|
|
2202
|
+
try {
|
|
2203
|
+
let normalized = s.replace(/'/g, '"');
|
|
2204
|
+
normalized = normalized.replace(EMPTY_OBJECT_REGEX, "{}");
|
|
2205
|
+
const obj = JSON.parse(normalized);
|
|
2206
|
+
if (obj && typeof obj === "object" && !Array.isArray(obj)) {
|
|
2207
|
+
return coerceObjectToObject(obj, unwrapped);
|
|
2208
|
+
}
|
|
2209
|
+
} catch (e2) {
|
|
2210
|
+
}
|
|
2194
2211
|
}
|
|
2195
2212
|
return null;
|
|
2196
2213
|
}
|
|
@@ -2198,8 +2215,7 @@ function coerceStringToArray(s, unwrapped) {
|
|
|
2198
2215
|
const prefixItems = Array.isArray(unwrapped.prefixItems) ? unwrapped.prefixItems : void 0;
|
|
2199
2216
|
const itemsSchema = unwrapped.items;
|
|
2200
2217
|
try {
|
|
2201
|
-
const
|
|
2202
|
-
const arr = JSON.parse(normalized);
|
|
2218
|
+
const arr = JSON.parse(s);
|
|
2203
2219
|
if (Array.isArray(arr)) {
|
|
2204
2220
|
if (prefixItems && arr.length === prefixItems.length) {
|
|
2205
2221
|
return arr.map((v, i) => coerceBySchema(v, prefixItems[i]));
|
|
@@ -2207,6 +2223,17 @@ function coerceStringToArray(s, unwrapped) {
|
|
|
2207
2223
|
return arr.map((v) => coerceBySchema(v, itemsSchema));
|
|
2208
2224
|
}
|
|
2209
2225
|
} catch (e) {
|
|
2226
|
+
try {
|
|
2227
|
+
const normalized = s.replace(/'/g, '"');
|
|
2228
|
+
const arr = JSON.parse(normalized);
|
|
2229
|
+
if (Array.isArray(arr)) {
|
|
2230
|
+
if (prefixItems && arr.length === prefixItems.length) {
|
|
2231
|
+
return arr.map((v, i) => coerceBySchema(v, prefixItems[i]));
|
|
2232
|
+
}
|
|
2233
|
+
return arr.map((v) => coerceBySchema(v, itemsSchema));
|
|
2234
|
+
}
|
|
2235
|
+
} catch (e2) {
|
|
2236
|
+
}
|
|
2210
2237
|
const csv = s.includes("\n") ? s.split(NEWLINE_SPLIT_REGEX) : s.split(COMMA_SPLIT_REGEX);
|
|
2211
2238
|
const trimmed = csv.map((x) => x.trim()).filter((x) => x.length > 0);
|
|
2212
2239
|
if (prefixItems && trimmed.length === prefixItems.length) {
|
|
@@ -6186,9 +6213,9 @@ function findEarliestTagPosition(openIdx, selfIdx) {
|
|
|
6186
6213
|
function collectToolCallsForName(text, toolName) {
|
|
6187
6214
|
const toolCalls = [];
|
|
6188
6215
|
let searchIndex = 0;
|
|
6216
|
+
const startTag = `<${toolName}>`;
|
|
6189
6217
|
const selfTagRegex = getSelfClosingTagPattern2(toolName);
|
|
6190
6218
|
while (searchIndex < text.length) {
|
|
6191
|
-
const startTag = `<${toolName}>`;
|
|
6192
6219
|
const openIdx = text.indexOf(startTag, searchIndex);
|
|
6193
6220
|
selfTagRegex.lastIndex = searchIndex;
|
|
6194
6221
|
const selfMatch = selfTagRegex.exec(text);
|