@probelabs/probe 0.6.0-rc77 → 0.6.0-rc78

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.
@@ -506,6 +506,13 @@ When troubleshooting:
506
506
  if (this.debug) {
507
507
  console.log(`\n[DEBUG] --- Tool Loop Iteration ${currentIteration}/${maxIterations} ---`);
508
508
  console.log(`[DEBUG] Current messages count for AI call: ${currentMessages.length}`);
509
+
510
+ // Log first 200 characters of the latest user message (helpful for debugging loops)
511
+ const lastUserMessage = [...currentMessages].reverse().find(msg => msg.role === 'user');
512
+ if (lastUserMessage && lastUserMessage.content) {
513
+ const userPreview = lastUserMessage.content.substring(0, 200);
514
+ console.log(`[DEBUG] Latest user message (200 chars): ${userPreview}${lastUserMessage.content.length > 200 ? '...' : ''}`);
515
+ }
509
516
  }
510
517
 
511
518
  // Add iteration tracing event
@@ -589,6 +596,12 @@ When troubleshooting:
589
596
  throw new Error(finalResult);
590
597
  }
591
598
 
599
+ // Log first 200 characters of assistant response for debugging loops
600
+ if (this.debug && assistantResponseContent) {
601
+ const assistantPreview = assistantResponseContent.substring(0, 200);
602
+ console.log(`[DEBUG] Assistant response (200 chars): ${assistantPreview}${assistantResponseContent.length > 200 ? '...' : ''}`);
603
+ }
604
+
592
605
  // Parse tool call from response with valid tools list
593
606
  const validTools = [
594
607
  'search', 'query', 'extract', 'listFiles', 'searchFiles', 'attempt_completion'
@@ -4109,6 +4109,11 @@ You are working with a repository located at: ${searchDirectory}
4109
4109
  console.log(`
4110
4110
  [DEBUG] --- Tool Loop Iteration ${currentIteration}/${maxIterations} ---`);
4111
4111
  console.log(`[DEBUG] Current messages count for AI call: ${currentMessages.length}`);
4112
+ const lastUserMessage = [...currentMessages].reverse().find((msg) => msg.role === "user");
4113
+ if (lastUserMessage && lastUserMessage.content) {
4114
+ const userPreview = lastUserMessage.content.substring(0, 200);
4115
+ console.log(`[DEBUG] Latest user message (200 chars): ${userPreview}${lastUserMessage.content.length > 200 ? "..." : ""}`);
4116
+ }
4112
4117
  }
4113
4118
  if (this.tracer) {
4114
4119
  this.tracer.addEvent("iteration.start", {
@@ -4172,6 +4177,10 @@ You are working with a repository located at: ${searchDirectory}
4172
4177
  finalResult = `Error: Failed to get response from AI model during iteration ${currentIteration}. ${error.message}`;
4173
4178
  throw new Error(finalResult);
4174
4179
  }
4180
+ if (this.debug && assistantResponseContent) {
4181
+ const assistantPreview = assistantResponseContent.substring(0, 200);
4182
+ console.log(`[DEBUG] Assistant response (200 chars): ${assistantPreview}${assistantResponseContent.length > 200 ? "..." : ""}`);
4183
+ }
4175
4184
  const validTools = [
4176
4185
  "search",
4177
4186
  "query",
@@ -3857,6 +3857,11 @@ You are working with a repository located at: ${searchDirectory}
3857
3857
  console.log(`
3858
3858
  [DEBUG] --- Tool Loop Iteration ${currentIteration}/${maxIterations} ---`);
3859
3859
  console.log(`[DEBUG] Current messages count for AI call: ${currentMessages.length}`);
3860
+ const lastUserMessage = [...currentMessages].reverse().find((msg) => msg.role === "user");
3861
+ if (lastUserMessage && lastUserMessage.content) {
3862
+ const userPreview = lastUserMessage.content.substring(0, 200);
3863
+ console.log(`[DEBUG] Latest user message (200 chars): ${userPreview}${lastUserMessage.content.length > 200 ? "..." : ""}`);
3864
+ }
3860
3865
  }
3861
3866
  if (this.tracer) {
3862
3867
  this.tracer.addEvent("iteration.start", {
@@ -3920,6 +3925,10 @@ You are working with a repository located at: ${searchDirectory}
3920
3925
  finalResult = `Error: Failed to get response from AI model during iteration ${currentIteration}. ${error.message}`;
3921
3926
  throw new Error(finalResult);
3922
3927
  }
3928
+ if (this.debug && assistantResponseContent) {
3929
+ const assistantPreview = assistantResponseContent.substring(0, 200);
3930
+ console.log(`[DEBUG] Assistant response (200 chars): ${assistantPreview}${assistantResponseContent.length > 200 ? "..." : ""}`);
3931
+ }
3923
3932
  const validTools = [
3924
3933
  "search",
3925
3934
  "query",
package/cjs/index.cjs CHANGED
@@ -3943,6 +3943,11 @@ You are working with a repository located at: ${searchDirectory}
3943
3943
  console.log(`
3944
3944
  [DEBUG] --- Tool Loop Iteration ${currentIteration}/${maxIterations} ---`);
3945
3945
  console.log(`[DEBUG] Current messages count for AI call: ${currentMessages.length}`);
3946
+ const lastUserMessage = [...currentMessages].reverse().find((msg) => msg.role === "user");
3947
+ if (lastUserMessage && lastUserMessage.content) {
3948
+ const userPreview = lastUserMessage.content.substring(0, 200);
3949
+ console.log(`[DEBUG] Latest user message (200 chars): ${userPreview}${lastUserMessage.content.length > 200 ? "..." : ""}`);
3950
+ }
3946
3951
  }
3947
3952
  if (this.tracer) {
3948
3953
  this.tracer.addEvent("iteration.start", {
@@ -4006,6 +4011,10 @@ You are working with a repository located at: ${searchDirectory}
4006
4011
  finalResult = `Error: Failed to get response from AI model during iteration ${currentIteration}. ${error.message}`;
4007
4012
  throw new Error(finalResult);
4008
4013
  }
4014
+ if (this.debug && assistantResponseContent) {
4015
+ const assistantPreview = assistantResponseContent.substring(0, 200);
4016
+ console.log(`[DEBUG] Assistant response (200 chars): ${assistantPreview}${assistantResponseContent.length > 200 ? "..." : ""}`);
4017
+ }
4009
4018
  const validTools = [
4010
4019
  "search",
4011
4020
  "query",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc77",
3
+ "version": "0.6.0-rc78",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -506,6 +506,13 @@ When troubleshooting:
506
506
  if (this.debug) {
507
507
  console.log(`\n[DEBUG] --- Tool Loop Iteration ${currentIteration}/${maxIterations} ---`);
508
508
  console.log(`[DEBUG] Current messages count for AI call: ${currentMessages.length}`);
509
+
510
+ // Log first 200 characters of the latest user message (helpful for debugging loops)
511
+ const lastUserMessage = [...currentMessages].reverse().find(msg => msg.role === 'user');
512
+ if (lastUserMessage && lastUserMessage.content) {
513
+ const userPreview = lastUserMessage.content.substring(0, 200);
514
+ console.log(`[DEBUG] Latest user message (200 chars): ${userPreview}${lastUserMessage.content.length > 200 ? '...' : ''}`);
515
+ }
509
516
  }
510
517
 
511
518
  // Add iteration tracing event
@@ -589,6 +596,12 @@ When troubleshooting:
589
596
  throw new Error(finalResult);
590
597
  }
591
598
 
599
+ // Log first 200 characters of assistant response for debugging loops
600
+ if (this.debug && assistantResponseContent) {
601
+ const assistantPreview = assistantResponseContent.substring(0, 200);
602
+ console.log(`[DEBUG] Assistant response (200 chars): ${assistantPreview}${assistantResponseContent.length > 200 ? '...' : ''}`);
603
+ }
604
+
592
605
  // Parse tool call from response with valid tools list
593
606
  const validTools = [
594
607
  'search', 'query', 'extract', 'listFiles', 'searchFiles', 'attempt_completion'