open-agents-ai 0.187.355 → 0.187.356
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 +30 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -270030,6 +270030,10 @@ var init_agenticRunner = __esm({
|
|
|
270030
270030
|
// sliding window of last 8 tool calls
|
|
270031
270031
|
_microcompactHintEmitted = false;
|
|
270032
270032
|
// WO-LL-02: one memory hint per session
|
|
270033
|
+
/** Timestamp of last assistant message — for idle-time microcompaction (Qwen pattern) */
|
|
270034
|
+
_lastAssistantTimestamp = Date.now();
|
|
270035
|
+
/** Track thinking block accumulation — strips after idle (Qwen thinkingClearLatched) */
|
|
270036
|
+
_thinkingClearLatched = false;
|
|
270033
270037
|
_hookDenyHintCount = 0;
|
|
270034
270038
|
// WO-LL-02: cap hint injection at 3 per session
|
|
270035
270039
|
_selfConsistencyVotes = 0;
|
|
@@ -270536,19 +270540,10 @@ ${body}`;
|
|
|
270536
270540
|
microcompact(messages2, recentToolResults) {
|
|
270537
270541
|
const tier = this.options.modelTier ?? "large";
|
|
270538
270542
|
let keepResults = tier === "small" ? 6 : tier === "medium" ? 10 : 20;
|
|
270539
|
-
|
|
270540
|
-
|
|
270541
|
-
|
|
270542
|
-
|
|
270543
|
-
break;
|
|
270544
|
-
}
|
|
270545
|
-
}
|
|
270546
|
-
if (lastAssistant && typeof lastAssistant._timestamp === "number") {
|
|
270547
|
-
const gapMs = Date.now() - lastAssistant._timestamp;
|
|
270548
|
-
const IDLE_THRESHOLD_MS = 5 * 6e4;
|
|
270549
|
-
if (gapMs > IDLE_THRESHOLD_MS) {
|
|
270550
|
-
keepResults = Math.min(keepResults, 3);
|
|
270551
|
-
}
|
|
270543
|
+
const idleGapMs = Date.now() - this._lastAssistantTimestamp;
|
|
270544
|
+
const IDLE_THRESHOLD_MS = 5 * 6e4;
|
|
270545
|
+
if (idleGapMs > IDLE_THRESHOLD_MS) {
|
|
270546
|
+
keepResults = Math.min(keepResults, 3);
|
|
270552
270547
|
}
|
|
270553
270548
|
const toolResultIndices = [];
|
|
270554
270549
|
for (let i2 = 0; i2 < messages2.length; i2++) {
|
|
@@ -270572,6 +270567,27 @@ ${body}`;
|
|
|
270572
270567
|
};
|
|
270573
270568
|
cleared++;
|
|
270574
270569
|
}
|
|
270570
|
+
if (idleGapMs > IDLE_THRESHOLD_MS && !this._thinkingClearLatched) {
|
|
270571
|
+
this._thinkingClearLatched = true;
|
|
270572
|
+
let thinkStripped = 0;
|
|
270573
|
+
for (let i2 = 0; i2 < messages2.length - keepResults; i2++) {
|
|
270574
|
+
const msg = messages2[i2];
|
|
270575
|
+
if (msg.role === "assistant" && typeof msg.content === "string" && msg.content.length > 200) {
|
|
270576
|
+
const stripped = msg.content.replace(/<think>[\s\S]*?<\/think>/gi, "").replace(/<reasoning>[\s\S]*?<\/reasoning>/gi, "").replace(/\[THINKING\][\s\S]*?\[\/THINKING\]/gi, "").trim();
|
|
270577
|
+
if (stripped.length < msg.content.length * 0.8) {
|
|
270578
|
+
messages2[i2] = { ...msg, content: stripped || "[thinking stripped]" };
|
|
270579
|
+
thinkStripped++;
|
|
270580
|
+
}
|
|
270581
|
+
}
|
|
270582
|
+
}
|
|
270583
|
+
if (thinkStripped > 0) {
|
|
270584
|
+
this.emit({
|
|
270585
|
+
type: "status",
|
|
270586
|
+
content: `Idle thinking strip: cleared thinking blocks from ${thinkStripped} old assistant message(s)`,
|
|
270587
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
270588
|
+
});
|
|
270589
|
+
}
|
|
270590
|
+
}
|
|
270575
270591
|
if (cleared > 0) {
|
|
270576
270592
|
if (recentToolResults) {
|
|
270577
270593
|
for (const entry of recentToolResults.values())
|
|
@@ -271346,6 +271362,7 @@ ${memoryLines.join("\n")}`
|
|
|
271346
271362
|
} catch {
|
|
271347
271363
|
}
|
|
271348
271364
|
}
|
|
271365
|
+
this._lastAssistantTimestamp = Date.now();
|
|
271349
271366
|
this.microcompact(compacted, recentToolResults);
|
|
271350
271367
|
const { maxOutputTokens: effectiveMaxTokens } = this.contextLimits();
|
|
271351
271368
|
const chatRequest = {
|
package/package.json
CHANGED