@probelabs/probe 0.6.0-rc72 → 0.6.0-rc73

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.
@@ -762,7 +762,9 @@ When troubleshooting:
762
762
 
763
763
  // Schema handling - format response according to provided schema
764
764
  // Skip schema processing if result came from attempt_completion tool
765
- if (options.schema && !options._schemaFormatted && !completionAttempted) {
765
+ // Don't apply schema formatting if we failed due to max iterations
766
+ const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
767
+ if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
766
768
  if (this.debug) {
767
769
  console.log('[DEBUG] Schema provided, applying automatic formatting...');
768
770
  }
@@ -976,6 +978,8 @@ Convert your previous response content into actual JSON data that follows this s
976
978
  console.error('[ERROR] Schema formatting failed:', error);
977
979
  // Return the original result if schema formatting fails
978
980
  }
981
+ } else if (reachedMaxIterations && options.schema && this.debug) {
982
+ console.log('[DEBUG] Skipping schema formatting due to max iterations reached without completion');
979
983
  } else if (completionAttempted && options.schema) {
980
984
  // For attempt_completion results with schema, still clean markdown if needed
981
985
  try {
@@ -4077,7 +4077,8 @@ Error: Unknown tool '${toolName}'. Available tools: ${Object.keys(this.toolImple
4077
4077
  }
4078
4078
  }
4079
4079
  this.tokenCounter.updateHistory(this.history);
4080
- if (options.schema && !options._schemaFormatted && !completionAttempted) {
4080
+ const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
4081
+ if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
4081
4082
  if (this.debug) {
4082
4083
  console.log("[DEBUG] Schema provided, applying automatic formatting...");
4083
4084
  }
@@ -4255,6 +4256,8 @@ Convert your previous response content into actual JSON data that follows this s
4255
4256
  } catch (error) {
4256
4257
  console.error("[ERROR] Schema formatting failed:", error);
4257
4258
  }
4259
+ } else if (reachedMaxIterations && options.schema && this.debug) {
4260
+ console.log("[DEBUG] Skipping schema formatting due to max iterations reached without completion");
4258
4261
  } else if (completionAttempted && options.schema) {
4259
4262
  try {
4260
4263
  finalResult = cleanSchemaResponse(finalResult);
@@ -4040,7 +4040,8 @@ Error: Unknown tool '${toolName}'. Available tools: ${Object.keys(this.toolImple
4040
4040
  }
4041
4041
  }
4042
4042
  this.tokenCounter.updateHistory(this.history);
4043
- if (options.schema && !options._schemaFormatted && !completionAttempted) {
4043
+ const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
4044
+ if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
4044
4045
  if (this.debug) {
4045
4046
  console.log("[DEBUG] Schema provided, applying automatic formatting...");
4046
4047
  }
@@ -4218,6 +4219,8 @@ Convert your previous response content into actual JSON data that follows this s
4218
4219
  } catch (error) {
4219
4220
  console.error("[ERROR] Schema formatting failed:", error);
4220
4221
  }
4222
+ } else if (reachedMaxIterations && options.schema && this.debug) {
4223
+ console.log("[DEBUG] Skipping schema formatting due to max iterations reached without completion");
4221
4224
  } else if (completionAttempted && options.schema) {
4222
4225
  try {
4223
4226
  finalResult = cleanSchemaResponse(finalResult);
package/cjs/index.cjs CHANGED
@@ -4137,7 +4137,8 @@ Error: Unknown tool '${toolName}'. Available tools: ${Object.keys(this.toolImple
4137
4137
  }
4138
4138
  }
4139
4139
  this.tokenCounter.updateHistory(this.history);
4140
- if (options.schema && !options._schemaFormatted && !completionAttempted) {
4140
+ const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
4141
+ if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
4141
4142
  if (this.debug) {
4142
4143
  console.log("[DEBUG] Schema provided, applying automatic formatting...");
4143
4144
  }
@@ -4315,6 +4316,8 @@ Convert your previous response content into actual JSON data that follows this s
4315
4316
  } catch (error) {
4316
4317
  console.error("[ERROR] Schema formatting failed:", error);
4317
4318
  }
4319
+ } else if (reachedMaxIterations && options.schema && this.debug) {
4320
+ console.log("[DEBUG] Skipping schema formatting due to max iterations reached without completion");
4318
4321
  } else if (completionAttempted && options.schema) {
4319
4322
  try {
4320
4323
  finalResult = cleanSchemaResponse(finalResult);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc72",
3
+ "version": "0.6.0-rc73",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -762,7 +762,9 @@ When troubleshooting:
762
762
 
763
763
  // Schema handling - format response according to provided schema
764
764
  // Skip schema processing if result came from attempt_completion tool
765
- if (options.schema && !options._schemaFormatted && !completionAttempted) {
765
+ // Don't apply schema formatting if we failed due to max iterations
766
+ const reachedMaxIterations = currentIteration >= maxIterations && !completionAttempted;
767
+ if (options.schema && !options._schemaFormatted && !completionAttempted && !reachedMaxIterations) {
766
768
  if (this.debug) {
767
769
  console.log('[DEBUG] Schema provided, applying automatic formatting...');
768
770
  }
@@ -976,6 +978,8 @@ Convert your previous response content into actual JSON data that follows this s
976
978
  console.error('[ERROR] Schema formatting failed:', error);
977
979
  // Return the original result if schema formatting fails
978
980
  }
981
+ } else if (reachedMaxIterations && options.schema && this.debug) {
982
+ console.log('[DEBUG] Skipping schema formatting due to max iterations reached without completion');
979
983
  } else if (completionAttempted && options.schema) {
980
984
  // For attempt_completion results with schema, still clean markdown if needed
981
985
  try {