billion-context 0.1.97-pr.667.482 → 0.1.97-pr.667.487
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 +9 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48840,16 +48840,20 @@ function dropCompressReasoning(messages, cfg) {
|
|
|
48840
48840
|
const { drop, threshold } = resolveReasoningDrop(cfg);
|
|
48841
48841
|
if (!drop || messages.length === 0) return messages;
|
|
48842
48842
|
try {
|
|
48843
|
-
|
|
48844
|
-
|
|
48843
|
+
const last = messages.length - 1;
|
|
48844
|
+
const resultAt = /* @__PURE__ */ new Map();
|
|
48845
|
+
for (let i = 0; i <= last; i++) {
|
|
48845
48846
|
const m2 = messages[i];
|
|
48846
|
-
if (m2.
|
|
48847
|
+
if (m2.contentType === "tool-result" && typeof m2.toolCallId === "string" && !resultAt.has(m2.toolCallId)) {
|
|
48848
|
+
resultAt.set(m2.toolCallId, i);
|
|
48849
|
+
}
|
|
48847
48850
|
}
|
|
48848
|
-
if (lastUser < 0) return messages;
|
|
48849
48851
|
const dropIdx = /* @__PURE__ */ new Set();
|
|
48850
|
-
for (let i = 0; i
|
|
48852
|
+
for (let i = 0; i <= last; i++) {
|
|
48851
48853
|
const m2 = messages[i];
|
|
48852
48854
|
if (m2.contentType !== "tool-call" || m2.toolName !== "compress") continue;
|
|
48855
|
+
const ri2 = typeof m2.toolCallId === "string" ? resultAt.get(m2.toolCallId) : void 0;
|
|
48856
|
+
if (ri2 === void 0 || ri2 <= i || ri2 >= last) continue;
|
|
48853
48857
|
let total = 0;
|
|
48854
48858
|
let j2 = i - 1;
|
|
48855
48859
|
while (j2 >= 0 && messages[j2].contentType === "reasoning") {
|