@probelabs/probe 0.6.0-rc133 → 0.6.0-rc134

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.
@@ -1928,7 +1928,7 @@ Convert your previous response content into actual JSON data that follows this s
1928
1928
  }
1929
1929
  } else if (reachedMaxIterations && options.schema && this.debug) {
1930
1930
  console.log('[DEBUG] Skipping schema formatting due to max iterations reached without completion');
1931
- } else if (completionAttempted && options.schema) {
1931
+ } else if (completionAttempted && options.schema && !options._schemaFormatted) {
1932
1932
  // For attempt_completion results with schema, still clean markdown if needed
1933
1933
  try {
1934
1934
  finalResult = cleanSchemaResponse(finalResult);
@@ -2083,7 +2083,7 @@ Convert your previous response content into actual JSON data that follows this s
2083
2083
  }
2084
2084
 
2085
2085
  // Final mermaid validation for all responses (regardless of schema or attempt_completion)
2086
- if (!this.disableMermaidValidation) {
2086
+ if (!this.disableMermaidValidation && !options._schemaFormatted) {
2087
2087
  try {
2088
2088
  if (this.debug) {
2089
2089
  console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
@@ -2119,9 +2119,11 @@ Convert your previous response content into actual JSON data that follows this s
2119
2119
  }
2120
2120
 
2121
2121
  // Remove thinking tags from final result before returning to user
2122
- finalResult = removeThinkingTags(finalResult);
2123
- if (this.debug) {
2124
- console.log(`[DEBUG] Removed thinking tags from final result`);
2122
+ if (!options._schemaFormatted) {
2123
+ finalResult = removeThinkingTags(finalResult);
2124
+ if (this.debug) {
2125
+ console.log(`[DEBUG] Removed thinking tags from final result`);
2126
+ }
2125
2127
  }
2126
2128
 
2127
2129
  return finalResult;
@@ -49895,7 +49895,7 @@ Convert your previous response content into actual JSON data that follows this s
49895
49895
  }
49896
49896
  } else if (reachedMaxIterations && options.schema && this.debug) {
49897
49897
  console.log("[DEBUG] Skipping schema formatting due to max iterations reached without completion");
49898
- } else if (completionAttempted && options.schema) {
49898
+ } else if (completionAttempted && options.schema && !options._schemaFormatted) {
49899
49899
  try {
49900
49900
  finalResult = cleanSchemaResponse(finalResult);
49901
49901
  if (!this.disableMermaidValidation) {
@@ -50022,7 +50022,7 @@ Convert your previous response content into actual JSON data that follows this s
50022
50022
  }
50023
50023
  }
50024
50024
  }
50025
- if (!this.disableMermaidValidation) {
50025
+ if (!this.disableMermaidValidation && !options._schemaFormatted) {
50026
50026
  try {
50027
50027
  if (this.debug) {
50028
50028
  console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
@@ -50053,9 +50053,11 @@ Convert your previous response content into actual JSON data that follows this s
50053
50053
  } else if (this.debug) {
50054
50054
  console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
50055
50055
  }
50056
- finalResult = removeThinkingTags(finalResult);
50057
- if (this.debug) {
50058
- console.log(`[DEBUG] Removed thinking tags from final result`);
50056
+ if (!options._schemaFormatted) {
50057
+ finalResult = removeThinkingTags(finalResult);
50058
+ if (this.debug) {
50059
+ console.log(`[DEBUG] Removed thinking tags from final result`);
50060
+ }
50059
50061
  }
50060
50062
  return finalResult;
50061
50063
  } catch (error) {
@@ -51367,7 +51369,7 @@ Please reformat your previous response to match this schema exactly. Only return
51367
51369
  if (!validation.isValid) {
51368
51370
  const correctionPrompt = createJsonCorrectionPrompt(result, schema, validation.error);
51369
51371
  try {
51370
- result = await agent.answer(correctionPrompt, [], { schema });
51372
+ result = await agent.answer(correctionPrompt, [], { schema, _schemaFormatted: true });
51371
51373
  result = cleanSchemaResponse(result);
51372
51374
  const finalValidation = validateJsonResponse(result);
51373
51375
  if (!finalValidation.isValid && args.debug) {
@@ -51649,11 +51651,11 @@ Please reformat your previous response to match this schema exactly. Only return
51649
51651
  if (appTracer) {
51650
51652
  result = await appTracer.withSpan(
51651
51653
  "agent.json_correction",
51652
- () => agent.answer(correctionPrompt, [], { schema }),
51654
+ () => agent.answer(correctionPrompt, [], { schema, _schemaFormatted: true }),
51653
51655
  { "original_error": validation.error }
51654
51656
  );
51655
51657
  } else {
51656
- result = await agent.answer(correctionPrompt, [], { schema });
51658
+ result = await agent.answer(correctionPrompt, [], { schema, _schemaFormatted: true });
51657
51659
  }
51658
51660
  result = cleanSchemaResponse(result);
51659
51661
  const finalValidation = validateJsonResponse(result);
@@ -75290,7 +75290,7 @@ Convert your previous response content into actual JSON data that follows this s
75290
75290
  }
75291
75291
  } else if (reachedMaxIterations && options.schema && this.debug) {
75292
75292
  console.log("[DEBUG] Skipping schema formatting due to max iterations reached without completion");
75293
- } else if (completionAttempted && options.schema) {
75293
+ } else if (completionAttempted && options.schema && !options._schemaFormatted) {
75294
75294
  try {
75295
75295
  finalResult = cleanSchemaResponse(finalResult);
75296
75296
  if (!this.disableMermaidValidation) {
@@ -75417,7 +75417,7 @@ Convert your previous response content into actual JSON data that follows this s
75417
75417
  }
75418
75418
  }
75419
75419
  }
75420
- if (!this.disableMermaidValidation) {
75420
+ if (!this.disableMermaidValidation && !options._schemaFormatted) {
75421
75421
  try {
75422
75422
  if (this.debug) {
75423
75423
  console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
@@ -75448,9 +75448,11 @@ Convert your previous response content into actual JSON data that follows this s
75448
75448
  } else if (this.debug) {
75449
75449
  console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
75450
75450
  }
75451
- finalResult = removeThinkingTags(finalResult);
75452
- if (this.debug) {
75453
- console.log(`[DEBUG] Removed thinking tags from final result`);
75451
+ if (!options._schemaFormatted) {
75452
+ finalResult = removeThinkingTags(finalResult);
75453
+ if (this.debug) {
75454
+ console.log(`[DEBUG] Removed thinking tags from final result`);
75455
+ }
75454
75456
  }
75455
75457
  return finalResult;
75456
75458
  } catch (error2) {
package/cjs/index.cjs CHANGED
@@ -75470,7 +75470,7 @@ Convert your previous response content into actual JSON data that follows this s
75470
75470
  }
75471
75471
  } else if (reachedMaxIterations && options.schema && this.debug) {
75472
75472
  console.log("[DEBUG] Skipping schema formatting due to max iterations reached without completion");
75473
- } else if (completionAttempted && options.schema) {
75473
+ } else if (completionAttempted && options.schema && !options._schemaFormatted) {
75474
75474
  try {
75475
75475
  finalResult = cleanSchemaResponse(finalResult);
75476
75476
  if (!this.disableMermaidValidation) {
@@ -75597,7 +75597,7 @@ Convert your previous response content into actual JSON data that follows this s
75597
75597
  }
75598
75598
  }
75599
75599
  }
75600
- if (!this.disableMermaidValidation) {
75600
+ if (!this.disableMermaidValidation && !options._schemaFormatted) {
75601
75601
  try {
75602
75602
  if (this.debug) {
75603
75603
  console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
@@ -75628,9 +75628,11 @@ Convert your previous response content into actual JSON data that follows this s
75628
75628
  } else if (this.debug) {
75629
75629
  console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
75630
75630
  }
75631
- finalResult = removeThinkingTags(finalResult);
75632
- if (this.debug) {
75633
- console.log(`[DEBUG] Removed thinking tags from final result`);
75631
+ if (!options._schemaFormatted) {
75632
+ finalResult = removeThinkingTags(finalResult);
75633
+ if (this.debug) {
75634
+ console.log(`[DEBUG] Removed thinking tags from final result`);
75635
+ }
75634
75636
  }
75635
75637
  return finalResult;
75636
75638
  } catch (error2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc133",
3
+ "version": "0.6.0-rc134",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -1928,7 +1928,7 @@ Convert your previous response content into actual JSON data that follows this s
1928
1928
  }
1929
1929
  } else if (reachedMaxIterations && options.schema && this.debug) {
1930
1930
  console.log('[DEBUG] Skipping schema formatting due to max iterations reached without completion');
1931
- } else if (completionAttempted && options.schema) {
1931
+ } else if (completionAttempted && options.schema && !options._schemaFormatted) {
1932
1932
  // For attempt_completion results with schema, still clean markdown if needed
1933
1933
  try {
1934
1934
  finalResult = cleanSchemaResponse(finalResult);
@@ -2083,7 +2083,7 @@ Convert your previous response content into actual JSON data that follows this s
2083
2083
  }
2084
2084
 
2085
2085
  // Final mermaid validation for all responses (regardless of schema or attempt_completion)
2086
- if (!this.disableMermaidValidation) {
2086
+ if (!this.disableMermaidValidation && !options._schemaFormatted) {
2087
2087
  try {
2088
2088
  if (this.debug) {
2089
2089
  console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
@@ -2119,9 +2119,11 @@ Convert your previous response content into actual JSON data that follows this s
2119
2119
  }
2120
2120
 
2121
2121
  // Remove thinking tags from final result before returning to user
2122
- finalResult = removeThinkingTags(finalResult);
2123
- if (this.debug) {
2124
- console.log(`[DEBUG] Removed thinking tags from final result`);
2122
+ if (!options._schemaFormatted) {
2123
+ finalResult = removeThinkingTags(finalResult);
2124
+ if (this.debug) {
2125
+ console.log(`[DEBUG] Removed thinking tags from final result`);
2126
+ }
2125
2127
  }
2126
2128
 
2127
2129
  return finalResult;
@@ -483,7 +483,7 @@ class ProbeAgentMcpServer {
483
483
  // Retry once with correction prompt
484
484
  const correctionPrompt = createJsonCorrectionPrompt(result, schema, validation.error);
485
485
  try {
486
- result = await agent.answer(correctionPrompt, [], { schema });
486
+ result = await agent.answer(correctionPrompt, [], { schema, _schemaFormatted: true });
487
487
  result = cleanSchemaResponse(result);
488
488
 
489
489
  // Validate again after correction
@@ -822,11 +822,11 @@ async function main() {
822
822
  try {
823
823
  if (appTracer) {
824
824
  result = await appTracer.withSpan('agent.json_correction',
825
- () => agent.answer(correctionPrompt, [], { schema }),
825
+ () => agent.answer(correctionPrompt, [], { schema, _schemaFormatted: true }),
826
826
  { 'original_error': validation.error }
827
827
  );
828
828
  } else {
829
- result = await agent.answer(correctionPrompt, [], { schema });
829
+ result = await agent.answer(correctionPrompt, [], { schema, _schemaFormatted: true });
830
830
  }
831
831
  result = cleanSchemaResponse(result);
832
832