@axlsdk/axl 0.13.2 → 0.13.4

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 CHANGED
@@ -2258,8 +2258,11 @@ function estimateTokens(text) {
2258
2258
  }
2259
2259
  function extractJson(content) {
2260
2260
  const trimmed = content.trim();
2261
- if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
2262
- return trimmed;
2261
+ if (trimmed.startsWith("{")) {
2262
+ return extractBalanced(trimmed, 0, "{", "}") ?? trimmed;
2263
+ }
2264
+ if (trimmed.startsWith("[")) {
2265
+ return extractBalanced(trimmed, 0, "[", "]") ?? trimmed;
2263
2266
  }
2264
2267
  const fenceMatch = trimmed.match(/```(?:json)?\s*\n?([\s\S]*?)\n?\s*```/);
2265
2268
  if (fenceMatch) {