micro-models-agent 0.18.2 → 0.18.3
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/core/agent.js +11 -1
- package/package.json +1 -1
package/dist/core/agent.js
CHANGED
|
@@ -305,7 +305,9 @@ export class Agent {
|
|
|
305
305
|
consecutiveToolFailures = 0;
|
|
306
306
|
}
|
|
307
307
|
if (consecutiveToolFailures >= MAX_CONSECUTIVE_TOOL_FAILURES) {
|
|
308
|
-
const recoveryMsg = t("exec.consecutive_failures_recovery", {
|
|
308
|
+
const recoveryMsg = t("exec.consecutive_failures_recovery", {
|
|
309
|
+
count: consecutiveToolFailures,
|
|
310
|
+
});
|
|
309
311
|
logger.warn(`Consecutive tool failures: ${consecutiveToolFailures}`);
|
|
310
312
|
const taskSnippet = input.length > 200 ? input.slice(0, 200) + "..." : input;
|
|
311
313
|
const taskReminder = t("exec.task_reminder", { task: taskSnippet });
|
|
@@ -318,6 +320,14 @@ export class Agent {
|
|
|
318
320
|
role: "user",
|
|
319
321
|
content: `<system-summary>${summaries.join("\n")}</system-summary>`,
|
|
320
322
|
});
|
|
323
|
+
const ctxTokens = contextManager.getEstimatedTokens();
|
|
324
|
+
const ctxBudget = contextManager.getBudget();
|
|
325
|
+
const ctxPct = Math.min(100, Math.round((ctxTokens / ctxBudget.history) * 100));
|
|
326
|
+
const barLen = 10;
|
|
327
|
+
const filled = Math.round((ctxPct / 100) * barLen);
|
|
328
|
+
const ctxBar = pc.green("█".repeat(filled)) + pc.dim("░".repeat(barLen - filled));
|
|
329
|
+
const pctColor = ctxPct >= 75 ? pc.yellow : pc.dim;
|
|
330
|
+
onMeta?.(`\n ${ctxBar} ${pctColor(`${ctxPct}%`)} ${pc.dim(`ctx: ${ctxTokens}/${ctxBudget.history}`)}\n`);
|
|
321
331
|
continue;
|
|
322
332
|
}
|
|
323
333
|
const hallucinationResult = hallucinationDetector.validate(textContent);
|