@probelabs/probe 0.6.0-rc188 → 0.6.0-rc189

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.
@@ -54730,6 +54730,10 @@ function cleanSchemaResponse(response) {
54730
54730
  return response;
54731
54731
  }
54732
54732
  const trimmed = response.trim();
54733
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
54734
+ if (resultWrapperMatch) {
54735
+ return cleanSchemaResponse(resultWrapperMatch[1]);
54736
+ }
54733
54737
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
54734
54738
  if (jsonBlockMatch) {
54735
54739
  return normalizeJsonQuotes(jsonBlockMatch[1].trim());
@@ -253,6 +253,14 @@ export function cleanSchemaResponse(response) {
253
253
 
254
254
  const trimmed = response.trim();
255
255
 
256
+ // Strip <result>...</result> wrapper if present (legacy XML format from some AI models)
257
+ // Some models like Google Gemini wrap JSON in <result> tags despite instructions not to
258
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
259
+ if (resultWrapperMatch) {
260
+ // Recursively clean the inner content in case there are nested patterns
261
+ return cleanSchemaResponse(resultWrapperMatch[1]);
262
+ }
263
+
256
264
  // First, look for JSON after code block markers - similar to mermaid extraction
257
265
  // Try with json language specifier
258
266
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
@@ -81416,6 +81416,10 @@ function cleanSchemaResponse(response) {
81416
81416
  return response;
81417
81417
  }
81418
81418
  const trimmed = response.trim();
81419
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
81420
+ if (resultWrapperMatch) {
81421
+ return cleanSchemaResponse(resultWrapperMatch[1]);
81422
+ }
81419
81423
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
81420
81424
  if (jsonBlockMatch) {
81421
81425
  return normalizeJsonQuotes(jsonBlockMatch[1].trim());
package/cjs/index.cjs CHANGED
@@ -79038,6 +79038,10 @@ function cleanSchemaResponse(response) {
79038
79038
  return response;
79039
79039
  }
79040
79040
  const trimmed = response.trim();
79041
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
79042
+ if (resultWrapperMatch) {
79043
+ return cleanSchemaResponse(resultWrapperMatch[1]);
79044
+ }
79041
79045
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
79042
79046
  if (jsonBlockMatch) {
79043
79047
  return normalizeJsonQuotes(jsonBlockMatch[1].trim());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc188",
3
+ "version": "0.6.0-rc189",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -253,6 +253,14 @@ export function cleanSchemaResponse(response) {
253
253
 
254
254
  const trimmed = response.trim();
255
255
 
256
+ // Strip <result>...</result> wrapper if present (legacy XML format from some AI models)
257
+ // Some models like Google Gemini wrap JSON in <result> tags despite instructions not to
258
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
259
+ if (resultWrapperMatch) {
260
+ // Recursively clean the inner content in case there are nested patterns
261
+ return cleanSchemaResponse(resultWrapperMatch[1]);
262
+ }
263
+
256
264
  // First, look for JSON after code block markers - similar to mermaid extraction
257
265
  // Try with json language specifier
258
266
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);