@axlsdk/axl 0.13.2 → 0.13.3
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.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2111,8 +2111,11 @@ function estimateTokens(text) {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
function extractJson(content) {
|
|
2113
2113
|
const trimmed = content.trim();
|
|
2114
|
-
if (trimmed.startsWith("{")
|
|
2115
|
-
return trimmed;
|
|
2114
|
+
if (trimmed.startsWith("{")) {
|
|
2115
|
+
return extractBalanced(trimmed, 0, "{", "}") ?? trimmed;
|
|
2116
|
+
}
|
|
2117
|
+
if (trimmed.startsWith("[")) {
|
|
2118
|
+
return extractBalanced(trimmed, 0, "[", "]") ?? trimmed;
|
|
2116
2119
|
}
|
|
2117
2120
|
const fenceMatch = trimmed.match(/```(?:json)?\s*\n?([\s\S]*?)\n?\s*```/);
|
|
2118
2121
|
if (fenceMatch) {
|