open-agents-ai 0.187.152 → 0.187.153
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 +23 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -268574,6 +268574,29 @@ ${description}`
|
|
|
268574
268574
|
thinkingContent += fragment;
|
|
268575
268575
|
}
|
|
268576
268576
|
const buf = kind === "content" ? content : thinkingContent;
|
|
268577
|
+
if (buf.length > 200 && buf.length % 100 < fragment.length) {
|
|
268578
|
+
const tail = buf.slice(-600);
|
|
268579
|
+
let loopDetected = false;
|
|
268580
|
+
for (let period = 20; period <= Math.min(200, Math.floor(tail.length / 3)); period++) {
|
|
268581
|
+
if (tail.length < period * 3)
|
|
268582
|
+
continue;
|
|
268583
|
+
const seg1 = tail.slice(-period);
|
|
268584
|
+
const seg2 = tail.slice(-2 * period, -period);
|
|
268585
|
+
const seg3 = tail.slice(-3 * period, -2 * period);
|
|
268586
|
+
if (seg1 === seg2 && seg2 === seg3) {
|
|
268587
|
+
loopDetected = true;
|
|
268588
|
+
break;
|
|
268589
|
+
}
|
|
268590
|
+
}
|
|
268591
|
+
if (loopDetected) {
|
|
268592
|
+
this.emit({
|
|
268593
|
+
type: "status",
|
|
268594
|
+
content: `Aborting generation \u2014 repetition detected in ${kind} (same text repeated 3+ times)`,
|
|
268595
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
268596
|
+
});
|
|
268597
|
+
break;
|
|
268598
|
+
}
|
|
268599
|
+
}
|
|
268577
268600
|
if (buf.length > 400 && buf.length % 200 < fragment.length) {
|
|
268578
268601
|
const half = Math.floor(buf.length / 2);
|
|
268579
268602
|
const firstHalf = buf.slice(half - 150, half);
|
package/package.json
CHANGED