zames_pro 2.49.0 → 2.49.1
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/agent-loop.js +22 -2
- package/dist/i18n.js +4 -0
- package/package.json +1 -1
package/dist/agent-loop.js
CHANGED
|
@@ -201,6 +201,12 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
|
|
|
201
201
|
// the (fresh) chat grows past this plus a margin, so a chat that starts
|
|
202
202
|
// above the threshold does not compact on every tool call.
|
|
203
203
|
let lastAutoCompactTokens = -1;
|
|
204
|
+
// Set when an auto-compact returned the SAME chat id it started in — i.e.
|
|
205
|
+
// the "fresh chat" never opened and the compaction did nothing. Without this
|
|
206
|
+
// guard a broken newChat() (see B2) made the loop compact on EVERY tool call
|
|
207
|
+
// while the context kept growing. Defense in depth: the root cause is fixed,
|
|
208
|
+
// but a future regression must not turn into an endless "compacting" loop.
|
|
209
|
+
let autoCompactDisabled = false;
|
|
204
210
|
// The message of a respond that arrived TOGETHER with real tool calls.
|
|
205
211
|
// It is not delivered immediately (the tools must run first), but if the
|
|
206
212
|
// model then stops without calling respond again, this is the best final
|
|
@@ -735,7 +741,7 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
|
|
|
735
741
|
// (plus a small margin), so a fresh chat does not compact again on
|
|
736
742
|
// every tool call.
|
|
737
743
|
const armed = !firedRecently || tokens > lastAutoCompactTokens + 1;
|
|
738
|
-
if (pct >= autoCompactPct && armed) {
|
|
744
|
+
if (pct >= autoCompactPct && armed && !autoCompactDisabled) {
|
|
739
745
|
lastAutoCompactTokens = tokens;
|
|
740
746
|
safeWarning(translate(locale)('compact.auto_trigger', {
|
|
741
747
|
pct: String(Math.round(pct)),
|
|
@@ -743,9 +749,23 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
|
|
|
743
749
|
}));
|
|
744
750
|
transcript?.log('auto_compact_trigger', { tokens, pct });
|
|
745
751
|
try {
|
|
752
|
+
const beforeChat = await browser
|
|
753
|
+
.getCurrentChatId()
|
|
754
|
+
.catch(() => null);
|
|
746
755
|
const newChat = await onAutoCompact();
|
|
747
756
|
if (newChat) {
|
|
748
|
-
|
|
757
|
+
if (beforeChat && newChat === beforeChat) {
|
|
758
|
+
// The chat did NOT change: the summary was posted back into
|
|
759
|
+
// the old chat and the context was not reset. Warn once and
|
|
760
|
+
// stop auto-compacting for the rest of the task instead of
|
|
761
|
+
// looping on every tool call.
|
|
762
|
+
autoCompactDisabled = true;
|
|
763
|
+
safeWarning(translate(locale)('compact.auto_same_chat'));
|
|
764
|
+
transcript?.log('auto_compact_same_chat', { chatId: newChat });
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
transcript?.log('auto_compact_done', { chatId: newChat });
|
|
768
|
+
}
|
|
749
769
|
// Continue in the fresh chat. The next send is a tool-result
|
|
750
770
|
// (agent: true), which is fine: the new chat already holds the
|
|
751
771
|
// system prompt + carryover. `lastAutoCompactTokens` stays at the
|
package/dist/i18n.js
CHANGED
|
@@ -289,6 +289,10 @@ const CATALOG = {
|
|
|
289
289
|
ru: '🗜️ Контекст заполнен на {pct}% ({tokens} токенов) — сжимаю историю и открываю новый чат...',
|
|
290
290
|
en: '🗜️ Context at {pct}% ({tokens} tokens) — compacting the history and opening a fresh chat...',
|
|
291
291
|
},
|
|
292
|
+
'compact.auto_same_chat': {
|
|
293
|
+
ru: '🗜️ Сжатие не открыло новый чат (тот же id) — отключаю авто-сжатие до конца задачи, чтобы не зациклиться.',
|
|
294
|
+
en: '🗜️ Compaction did not open a fresh chat (same id) — disabling auto-compact for the rest of the task to avoid a loop.',
|
|
295
|
+
},
|
|
292
296
|
'compact.start': {
|
|
293
297
|
ru: '🗜️ Сжимаю историю чата (DeepSeek)...',
|
|
294
298
|
en: '🗜️ Compacting the chat history (DeepSeek)...',
|