@standardagents/code 0.3.1 → 0.3.2
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 +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4783,10 +4783,14 @@ ${c.bold}why: ${req.requestPermission}${c.reset}` : ""}`,
|
|
|
4783
4783
|
} catch {
|
|
4784
4784
|
}
|
|
4785
4785
|
const COMPACTION_TRIGGER_FRACTION = 0.5;
|
|
4786
|
+
const COMPACTION_TRIGGER_CAP = 5e4;
|
|
4786
4787
|
try {
|
|
4787
4788
|
const cu = await api.kvGet(threadId, "context_usage");
|
|
4788
4789
|
const used = Number(cu?.inputTokens) || 0;
|
|
4789
|
-
const max = (
|
|
4790
|
+
const max = Math.min(
|
|
4791
|
+
(Number(cu?.maxContextTokens) || 0) * COMPACTION_TRIGGER_FRACTION || Infinity,
|
|
4792
|
+
COMPACTION_TRIGGER_CAP
|
|
4793
|
+
);
|
|
4790
4794
|
tui.setContextPct(max > 0 && used > 0 ? used / max * 100 : null);
|
|
4791
4795
|
} catch {
|
|
4792
4796
|
}
|