@probelabs/probe 0.6.0-rc132 → 0.6.0-rc133
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/build/agent/index.js +10 -13
- package/build/agent/schemaUtils.js +22 -22
- package/cjs/agent/ProbeAgent.cjs +10 -13
- package/cjs/index.cjs +10 -13
- package/package.json +1 -1
- package/src/agent/schemaUtils.js +22 -22
package/build/agent/index.js
CHANGED
|
@@ -46498,19 +46498,16 @@ function cleanSchemaResponse(response) {
|
|
|
46498
46498
|
return trimmed.substring(startIndex, endIndex);
|
|
46499
46499
|
}
|
|
46500
46500
|
}
|
|
46501
|
-
|
|
46502
|
-
|
|
46503
|
-
|
|
46504
|
-
);
|
|
46505
|
-
const
|
|
46506
|
-
|
|
46507
|
-
|
|
46508
|
-
|
|
46509
|
-
if (
|
|
46510
|
-
|
|
46511
|
-
if (beforeFirstBracket === "" || beforeFirstBracket.match(/^```\w*$/) || beforeFirstBracket.split("\n").length <= 2) {
|
|
46512
|
-
return trimmed.substring(firstBracket, lastBracket + 1);
|
|
46513
|
-
}
|
|
46501
|
+
let cleaned = trimmed;
|
|
46502
|
+
cleaned = cleaned.replace(/^```(?:json)?\s*\n?/i, "");
|
|
46503
|
+
cleaned = cleaned.replace(/\n?```\s*$/, "");
|
|
46504
|
+
cleaned = cleaned.trim();
|
|
46505
|
+
const firstChar = cleaned[0];
|
|
46506
|
+
const lastChar = cleaned[cleaned.length - 1];
|
|
46507
|
+
const isJsonObject = firstChar === "{" && lastChar === "}";
|
|
46508
|
+
const isJsonArray = firstChar === "[" && lastChar === "]";
|
|
46509
|
+
if (isJsonObject || isJsonArray) {
|
|
46510
|
+
return cleaned;
|
|
46514
46511
|
}
|
|
46515
46512
|
return response;
|
|
46516
46513
|
}
|
|
@@ -106,28 +106,28 @@ export function cleanSchemaResponse(response) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// Fallback:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
109
|
+
// Fallback: Check if response is JSON after removing code block markers and whitespace
|
|
110
|
+
// First, remove common code block markers from top and bottom
|
|
111
|
+
let cleaned = trimmed;
|
|
112
|
+
|
|
113
|
+
// Remove opening code block markers (```json, ```, etc.)
|
|
114
|
+
cleaned = cleaned.replace(/^```(?:json)?\s*\n?/i, '');
|
|
115
|
+
|
|
116
|
+
// Remove closing code block markers
|
|
117
|
+
cleaned = cleaned.replace(/\n?```\s*$/, '');
|
|
118
|
+
|
|
119
|
+
// Trim whitespace and newlines
|
|
120
|
+
cleaned = cleaned.trim();
|
|
121
|
+
|
|
122
|
+
// Now check if first and last characters are valid JSON boundaries
|
|
123
|
+
const firstChar = cleaned[0];
|
|
124
|
+
const lastChar = cleaned[cleaned.length - 1];
|
|
125
|
+
|
|
126
|
+
const isJsonObject = firstChar === '{' && lastChar === '}';
|
|
127
|
+
const isJsonArray = firstChar === '[' && lastChar === ']';
|
|
128
|
+
|
|
129
|
+
if (isJsonObject || isJsonArray) {
|
|
130
|
+
return cleaned;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
return response; // Return original if no extractable JSON found
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -71893,19 +71893,16 @@ function cleanSchemaResponse(response) {
|
|
|
71893
71893
|
return trimmed.substring(startIndex, endIndex);
|
|
71894
71894
|
}
|
|
71895
71895
|
}
|
|
71896
|
-
|
|
71897
|
-
|
|
71898
|
-
|
|
71899
|
-
);
|
|
71900
|
-
const
|
|
71901
|
-
|
|
71902
|
-
|
|
71903
|
-
|
|
71904
|
-
if (
|
|
71905
|
-
|
|
71906
|
-
if (beforeFirstBracket === "" || beforeFirstBracket.match(/^```\w*$/) || beforeFirstBracket.split("\n").length <= 2) {
|
|
71907
|
-
return trimmed.substring(firstBracket, lastBracket + 1);
|
|
71908
|
-
}
|
|
71896
|
+
let cleaned = trimmed;
|
|
71897
|
+
cleaned = cleaned.replace(/^```(?:json)?\s*\n?/i, "");
|
|
71898
|
+
cleaned = cleaned.replace(/\n?```\s*$/, "");
|
|
71899
|
+
cleaned = cleaned.trim();
|
|
71900
|
+
const firstChar = cleaned[0];
|
|
71901
|
+
const lastChar = cleaned[cleaned.length - 1];
|
|
71902
|
+
const isJsonObject = firstChar === "{" && lastChar === "}";
|
|
71903
|
+
const isJsonArray = firstChar === "[" && lastChar === "]";
|
|
71904
|
+
if (isJsonObject || isJsonArray) {
|
|
71905
|
+
return cleaned;
|
|
71909
71906
|
}
|
|
71910
71907
|
return response;
|
|
71911
71908
|
}
|
package/cjs/index.cjs
CHANGED
|
@@ -72073,19 +72073,16 @@ function cleanSchemaResponse(response) {
|
|
|
72073
72073
|
return trimmed.substring(startIndex, endIndex);
|
|
72074
72074
|
}
|
|
72075
72075
|
}
|
|
72076
|
-
|
|
72077
|
-
|
|
72078
|
-
|
|
72079
|
-
);
|
|
72080
|
-
const
|
|
72081
|
-
|
|
72082
|
-
|
|
72083
|
-
|
|
72084
|
-
if (
|
|
72085
|
-
|
|
72086
|
-
if (beforeFirstBracket === "" || beforeFirstBracket.match(/^```\w*$/) || beforeFirstBracket.split("\n").length <= 2) {
|
|
72087
|
-
return trimmed.substring(firstBracket, lastBracket + 1);
|
|
72088
|
-
}
|
|
72076
|
+
let cleaned = trimmed;
|
|
72077
|
+
cleaned = cleaned.replace(/^```(?:json)?\s*\n?/i, "");
|
|
72078
|
+
cleaned = cleaned.replace(/\n?```\s*$/, "");
|
|
72079
|
+
cleaned = cleaned.trim();
|
|
72080
|
+
const firstChar = cleaned[0];
|
|
72081
|
+
const lastChar = cleaned[cleaned.length - 1];
|
|
72082
|
+
const isJsonObject = firstChar === "{" && lastChar === "}";
|
|
72083
|
+
const isJsonArray = firstChar === "[" && lastChar === "]";
|
|
72084
|
+
if (isJsonObject || isJsonArray) {
|
|
72085
|
+
return cleaned;
|
|
72089
72086
|
}
|
|
72090
72087
|
return response;
|
|
72091
72088
|
}
|
package/package.json
CHANGED
package/src/agent/schemaUtils.js
CHANGED
|
@@ -106,28 +106,28 @@ export function cleanSchemaResponse(response) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// Fallback:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
109
|
+
// Fallback: Check if response is JSON after removing code block markers and whitespace
|
|
110
|
+
// First, remove common code block markers from top and bottom
|
|
111
|
+
let cleaned = trimmed;
|
|
112
|
+
|
|
113
|
+
// Remove opening code block markers (```json, ```, etc.)
|
|
114
|
+
cleaned = cleaned.replace(/^```(?:json)?\s*\n?/i, '');
|
|
115
|
+
|
|
116
|
+
// Remove closing code block markers
|
|
117
|
+
cleaned = cleaned.replace(/\n?```\s*$/, '');
|
|
118
|
+
|
|
119
|
+
// Trim whitespace and newlines
|
|
120
|
+
cleaned = cleaned.trim();
|
|
121
|
+
|
|
122
|
+
// Now check if first and last characters are valid JSON boundaries
|
|
123
|
+
const firstChar = cleaned[0];
|
|
124
|
+
const lastChar = cleaned[cleaned.length - 1];
|
|
125
|
+
|
|
126
|
+
const isJsonObject = firstChar === '{' && lastChar === '}';
|
|
127
|
+
const isJsonArray = firstChar === '[' && lastChar === ']';
|
|
128
|
+
|
|
129
|
+
if (isJsonObject || isJsonArray) {
|
|
130
|
+
return cleaned;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
return response; // Return original if no extractable JSON found
|