@rama_nigg/open-cursor 2.3.6 → 2.3.8

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/dist/index.js CHANGED
@@ -17431,18 +17431,20 @@ function createToolLoopGuard(messages, maxRepeat) {
17431
17431
  const successFingerprint = `${toolCall.function.name}|values:${valueSignature}|success`;
17432
17432
  const repeatCount = (counts.get(successFingerprint) ?? 0) + 1;
17433
17433
  counts.set(successFingerprint, repeatCount);
17434
+ const isExplorationTool = EXPLORATION_TOOLS.has(toolCall.function.name.toLowerCase());
17435
+ const effectiveMaxRepeat = isExplorationTool ? maxRepeat * EXPLORATION_LIMIT_MULTIPLIER : maxRepeat;
17434
17436
  const coarseSuccessFingerprint = deriveSuccessCoarseFingerprint(toolCall.function.name, toolCall.function.arguments);
17435
17437
  const coarseRepeatCount = coarseSuccessFingerprint ? (coarseCounts.get(coarseSuccessFingerprint) ?? 0) + 1 : 0;
17436
17438
  if (coarseSuccessFingerprint) {
17437
17439
  coarseCounts.set(coarseSuccessFingerprint, coarseRepeatCount);
17438
17440
  }
17439
- const coarseTriggered = coarseSuccessFingerprint ? coarseRepeatCount > maxRepeat : false;
17441
+ const coarseTriggered = coarseSuccessFingerprint ? coarseRepeatCount > effectiveMaxRepeat : false;
17440
17442
  return {
17441
17443
  fingerprint: coarseTriggered ? coarseSuccessFingerprint : successFingerprint,
17442
17444
  repeatCount: coarseTriggered ? coarseRepeatCount : repeatCount,
17443
- maxRepeat,
17445
+ maxRepeat: effectiveMaxRepeat,
17444
17446
  errorClass,
17445
- triggered: repeatCount > maxRepeat || coarseTriggered,
17447
+ triggered: repeatCount > effectiveMaxRepeat || coarseTriggered,
17446
17448
  tracked: true
17447
17449
  };
17448
17450
  }
@@ -17802,7 +17804,7 @@ function containsAny(text, patterns) {
17802
17804
  function isRecord4(value) {
17803
17805
  return typeof value === "object" && value !== null && !Array.isArray(value);
17804
17806
  }
17805
- var UNKNOWN_AS_SUCCESS_TOOLS, EXPLORATION_TOOLS, COARSE_LIMIT_MULTIPLIER = 3;
17807
+ var UNKNOWN_AS_SUCCESS_TOOLS, EXPLORATION_TOOLS, COARSE_LIMIT_MULTIPLIER = 3, EXPLORATION_LIMIT_MULTIPLIER = 5;
17806
17808
  var init_tool_loop_guard = __esm(() => {
17807
17809
  UNKNOWN_AS_SUCCESS_TOOLS = new Set([
17808
17810
  "bash",
@@ -17431,18 +17431,20 @@ function createToolLoopGuard(messages, maxRepeat) {
17431
17431
  const successFingerprint = `${toolCall.function.name}|values:${valueSignature}|success`;
17432
17432
  const repeatCount = (counts.get(successFingerprint) ?? 0) + 1;
17433
17433
  counts.set(successFingerprint, repeatCount);
17434
+ const isExplorationTool = EXPLORATION_TOOLS.has(toolCall.function.name.toLowerCase());
17435
+ const effectiveMaxRepeat = isExplorationTool ? maxRepeat * EXPLORATION_LIMIT_MULTIPLIER : maxRepeat;
17434
17436
  const coarseSuccessFingerprint = deriveSuccessCoarseFingerprint(toolCall.function.name, toolCall.function.arguments);
17435
17437
  const coarseRepeatCount = coarseSuccessFingerprint ? (coarseCounts.get(coarseSuccessFingerprint) ?? 0) + 1 : 0;
17436
17438
  if (coarseSuccessFingerprint) {
17437
17439
  coarseCounts.set(coarseSuccessFingerprint, coarseRepeatCount);
17438
17440
  }
17439
- const coarseTriggered = coarseSuccessFingerprint ? coarseRepeatCount > maxRepeat : false;
17441
+ const coarseTriggered = coarseSuccessFingerprint ? coarseRepeatCount > effectiveMaxRepeat : false;
17440
17442
  return {
17441
17443
  fingerprint: coarseTriggered ? coarseSuccessFingerprint : successFingerprint,
17442
17444
  repeatCount: coarseTriggered ? coarseRepeatCount : repeatCount,
17443
- maxRepeat,
17445
+ maxRepeat: effectiveMaxRepeat,
17444
17446
  errorClass,
17445
- triggered: repeatCount > maxRepeat || coarseTriggered,
17447
+ triggered: repeatCount > effectiveMaxRepeat || coarseTriggered,
17446
17448
  tracked: true
17447
17449
  };
17448
17450
  }
@@ -17802,7 +17804,7 @@ function containsAny(text, patterns) {
17802
17804
  function isRecord4(value) {
17803
17805
  return typeof value === "object" && value !== null && !Array.isArray(value);
17804
17806
  }
17805
- var UNKNOWN_AS_SUCCESS_TOOLS, EXPLORATION_TOOLS, COARSE_LIMIT_MULTIPLIER = 3;
17807
+ var UNKNOWN_AS_SUCCESS_TOOLS, EXPLORATION_TOOLS, COARSE_LIMIT_MULTIPLIER = 3, EXPLORATION_LIMIT_MULTIPLIER = 5;
17806
17808
  var init_tool_loop_guard = __esm(() => {
17807
17809
  UNKNOWN_AS_SUCCESS_TOOLS = new Set([
17808
17810
  "bash",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rama_nigg/open-cursor",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
4
4
  "description": "No prompt limits. No broken streams. Full thinking + tool support. Your Cursor subscription, properly integrated.",
5
5
  "type": "module",
6
6
  "main": "dist/plugin-entry.js",
@@ -75,6 +75,7 @@ export function parseToolLoopMaxRepeat(
75
75
  // to allow legitimate exploration across different files/targets while still
76
76
  // catching spray-and-pray patterns.
77
77
  const COARSE_LIMIT_MULTIPLIER = 3;
78
+ const EXPLORATION_LIMIT_MULTIPLIER = 5;
78
79
 
79
80
  export function createToolLoopGuard(
80
81
  messages: Array<unknown>,
@@ -113,6 +114,16 @@ export function createToolLoopGuard(
113
114
  const repeatCount = (counts.get(successFingerprint) ?? 0) + 1;
114
115
  counts.set(successFingerprint, repeatCount);
115
116
 
117
+ // Exploration tools (read, grep, glob, etc.) get a higher limit because
118
+ // re-reading the same file across turns is legitimate behavior (verifying
119
+ // edits, checking state, etc.). Use 5x multiplier for these tools.
120
+ const isExplorationTool = EXPLORATION_TOOLS.has(
121
+ toolCall.function.name.toLowerCase(),
122
+ );
123
+ const effectiveMaxRepeat = isExplorationTool
124
+ ? maxRepeat * EXPLORATION_LIMIT_MULTIPLIER
125
+ : maxRepeat;
126
+
116
127
  // Some tools (notably edit/write) can get stuck in "successful" loops where
117
128
  // the model keeps re-issuing the same operation with slightly different
118
129
  // content (e.g. trailing newline differences). Track a coarse signature for
@@ -129,14 +140,14 @@ export function createToolLoopGuard(
129
140
  coarseCounts.set(coarseSuccessFingerprint, coarseRepeatCount);
130
141
  }
131
142
  const coarseTriggered = coarseSuccessFingerprint
132
- ? coarseRepeatCount > maxRepeat
143
+ ? coarseRepeatCount > effectiveMaxRepeat
133
144
  : false;
134
145
  return {
135
146
  fingerprint: coarseTriggered ? coarseSuccessFingerprint! : successFingerprint,
136
147
  repeatCount: coarseTriggered ? coarseRepeatCount : repeatCount,
137
- maxRepeat,
148
+ maxRepeat: effectiveMaxRepeat,
138
149
  errorClass,
139
- triggered: repeatCount > maxRepeat || coarseTriggered,
150
+ triggered: repeatCount > effectiveMaxRepeat || coarseTriggered,
140
151
  tracked: true,
141
152
  };
142
153
  }