micro-models-agent 0.28.3 → 0.28.4
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/main.js +26 -12
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2231,7 +2231,9 @@ var init_defaults = __esm(() => {
|
|
|
2231
2231
|
ui: {
|
|
2232
2232
|
spinner: true,
|
|
2233
2233
|
toolStyle: "inline",
|
|
2234
|
-
toolComments: true
|
|
2234
|
+
toolComments: true,
|
|
2235
|
+
showContextStats: false,
|
|
2236
|
+
showCompaction: true
|
|
2235
2237
|
},
|
|
2236
2238
|
mcpServers: {
|
|
2237
2239
|
context7: {
|
|
@@ -9703,6 +9705,7 @@ class Agent {
|
|
|
9703
9705
|
systemPromptAdded = false;
|
|
9704
9706
|
shutdownRequested = false;
|
|
9705
9707
|
abortController = null;
|
|
9708
|
+
lastCompactionShown = 0;
|
|
9706
9709
|
constructor(deps) {
|
|
9707
9710
|
this.deps = deps;
|
|
9708
9711
|
}
|
|
@@ -10087,19 +10090,30 @@ ${taskReminder}</system-summary>`
|
|
|
10087
10090
|
content: `<system-summary>${summaries.join(`
|
|
10088
10091
|
`)}</system-summary>`
|
|
10089
10092
|
});
|
|
10090
|
-
const
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10093
|
+
const ui = this.deps.config.ui;
|
|
10094
|
+
if (ui?.showContextStats) {
|
|
10095
|
+
const ctxTokens = contextManager.getEstimatedTokens();
|
|
10096
|
+
const ctxBudget = contextManager.getBudget();
|
|
10097
|
+
const ctxPct = Math.min(100, Math.round(ctxTokens / ctxBudget.history * 100));
|
|
10098
|
+
const barLen = 10;
|
|
10099
|
+
const filled = Math.round(ctxPct / 100 * barLen);
|
|
10100
|
+
const ctxBar = pc2.green("█".repeat(filled)) + pc2.dim("░".repeat(barLen - filled));
|
|
10101
|
+
const pctColor = ctxPct >= 75 ? pc2.yellow : pc2.dim;
|
|
10102
|
+
const compCount = contextManager.getCompactionCount();
|
|
10103
|
+
const quality2 = contextManager.getQuality();
|
|
10104
|
+
const qualityColor = quality2 >= 70 ? pc2.green : quality2 >= 40 ? pc2.yellow : pc2.red;
|
|
10105
|
+
onMeta?.(`
|
|
10101
10106
|
${ctxBar} ${pctColor(`${ctxPct}%`)} ${pc2.dim(`ctx: ${ctxTokens}/${ctxBudget.history}`)} ${pc2.dim(`compactions: ${compCount}`)} ${qualityColor(`quality: ${quality2}%`)}
|
|
10102
10107
|
`);
|
|
10108
|
+
} else if (ui?.showCompaction) {
|
|
10109
|
+
const compCount = contextManager.getCompactionCount();
|
|
10110
|
+
if (compCount > this.lastCompactionShown) {
|
|
10111
|
+
this.lastCompactionShown = compCount;
|
|
10112
|
+
onMeta?.(pc2.dim(`
|
|
10113
|
+
⟳ Context compacted (${compCount})
|
|
10114
|
+
`));
|
|
10115
|
+
}
|
|
10116
|
+
}
|
|
10103
10117
|
continue;
|
|
10104
10118
|
}
|
|
10105
10119
|
hallucinationDetector.getConfidenceCheck().setPreviousResponse(lastText);
|