open-agents-ai 0.187.135 → 0.187.136
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 +13 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -262049,7 +262049,7 @@ ${body}`;
|
|
|
262049
262049
|
* Hannover reference: services/compact/apiMicrocompact.ts
|
|
262050
262050
|
* Research: arXiv:2307.03172 (Lost in the Middle — recent context matters most)
|
|
262051
262051
|
*/
|
|
262052
|
-
microcompact(messages2) {
|
|
262052
|
+
microcompact(messages2, recentToolResults) {
|
|
262053
262053
|
const tier = this.options.modelTier ?? "large";
|
|
262054
262054
|
const keepResults = tier === "small" ? 6 : tier === "medium" ? 10 : 20;
|
|
262055
262055
|
const toolResultIndices = [];
|
|
@@ -262075,6 +262075,8 @@ ${body}`;
|
|
|
262075
262075
|
cleared++;
|
|
262076
262076
|
}
|
|
262077
262077
|
if (cleared > 0) {
|
|
262078
|
+
if (recentToolResults)
|
|
262079
|
+
recentToolResults.clear();
|
|
262078
262080
|
this.emit({
|
|
262079
262081
|
type: "status",
|
|
262080
262082
|
content: `Microcompact: cleared ${cleared} old tool result(s), keeping ${keepResults} recent`,
|
|
@@ -262599,8 +262601,12 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
|
|
|
262599
262601
|
const strategy = this._pendingCompaction;
|
|
262600
262602
|
this._pendingCompaction = null;
|
|
262601
262603
|
compacted = await this.compactMessages(messages2, strategy, true);
|
|
262604
|
+
recentToolResults.clear();
|
|
262602
262605
|
} else {
|
|
262606
|
+
const prevLen = messages2.length;
|
|
262603
262607
|
compacted = await this.compactMessages(messages2);
|
|
262608
|
+
if (compacted.length < prevLen)
|
|
262609
|
+
recentToolResults.clear();
|
|
262604
262610
|
}
|
|
262605
262611
|
if (this.options.environmentProvider) {
|
|
262606
262612
|
try {
|
|
@@ -262611,7 +262617,7 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
|
|
|
262611
262617
|
} catch {
|
|
262612
262618
|
}
|
|
262613
262619
|
}
|
|
262614
|
-
this.microcompact(compacted);
|
|
262620
|
+
this.microcompact(compacted, recentToolResults);
|
|
262615
262621
|
const { maxOutputTokens: effectiveMaxTokens } = this.contextLimits();
|
|
262616
262622
|
const chatRequest = {
|
|
262617
262623
|
messages: compacted,
|
|
@@ -288615,7 +288621,9 @@ function extractSubAgentTopic(args) {
|
|
|
288615
288621
|
const cut = text.lastIndexOf(" ", 80);
|
|
288616
288622
|
text = text.slice(0, cut > 20 ? cut : 80);
|
|
288617
288623
|
}
|
|
288618
|
-
if (text.length > 0
|
|
288624
|
+
if (text.length > 0 && !(text.length > 1 && text[0] === text[0].toUpperCase() && text[1] === text[1].toUpperCase())) {
|
|
288625
|
+
text = text.charAt(0).toLowerCase() + text.slice(1);
|
|
288626
|
+
}
|
|
288619
288627
|
return text;
|
|
288620
288628
|
}
|
|
288621
288629
|
function extractShellEssence(cmd) {
|
|
@@ -288824,10 +288832,10 @@ function extractContentSummary(text, toolName) {
|
|
|
288824
288832
|
const cut = summary.lastIndexOf(" ", 80);
|
|
288825
288833
|
summary = summary.slice(0, cut > 20 ? cut : 80);
|
|
288826
288834
|
}
|
|
288827
|
-
if (summary.length > 0) {
|
|
288835
|
+
if (summary.length > 0 && !(summary.length > 1 && summary[0] === summary[0].toUpperCase() && summary[1] === summary[1].toUpperCase())) {
|
|
288828
288836
|
summary = summary.charAt(0).toLowerCase() + summary.slice(1);
|
|
288829
|
-
summary = summary.replace(/[.,;:!?]+$/, "");
|
|
288830
288837
|
}
|
|
288838
|
+
if (summary.length > 0) summary = summary.replace(/[.,;:!?]+$/, "");
|
|
288831
288839
|
return summary;
|
|
288832
288840
|
}
|
|
288833
288841
|
if (toolName === "sub_agent") {
|
package/package.json
CHANGED