zames_pro 2.4.3 → 2.4.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/browser.js +12 -2
- package/dist/config.js +1 -1
- package/dist/index.js +9 -0
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -101,6 +101,10 @@ export class DeepSeekBrowser {
|
|
|
101
101
|
maxRateLimitRetries;
|
|
102
102
|
_lastSentAt;
|
|
103
103
|
_abort;
|
|
104
|
+
// Пользователь нажал Esc/Ctrl+C — «стоп» для ВСЕЙ текущей пачки задач
|
|
105
|
+
// (включая очередь). В отличие от _abort (сбрасывается на каждую
|
|
106
|
+
// отправку), этот флаг живёт до явного запуска новой задачи с промпта.
|
|
107
|
+
_stopped;
|
|
104
108
|
context;
|
|
105
109
|
page;
|
|
106
110
|
_netCapture;
|
|
@@ -109,7 +113,7 @@ export class DeepSeekBrowser {
|
|
|
109
113
|
_netSniff;
|
|
110
114
|
_netSniffLimit;
|
|
111
115
|
_netHookInstalled;
|
|
112
|
-
constructor({ headless = false, debug = false, channel = 'chrome', answerTimeoutMs = 180000, askRetries = 3, stabilityChecks = 3, stabilityDelayMs = 1000, minSendIntervalMs =
|
|
116
|
+
constructor({ headless = false, debug = false, channel = 'chrome', answerTimeoutMs = 180000, askRetries = 3, stabilityChecks = 3, stabilityDelayMs = 1000, minSendIntervalMs = 2000, rateLimitWaitMs = 300000, maxRateLimitRetries = 6, } = {}) {
|
|
113
117
|
this.headless = headless;
|
|
114
118
|
this.debug = debug;
|
|
115
119
|
this.channel = channel;
|
|
@@ -122,6 +126,7 @@ export class DeepSeekBrowser {
|
|
|
122
126
|
this.maxRateLimitRetries = maxRateLimitRetries;
|
|
123
127
|
this._lastSentAt = 0;
|
|
124
128
|
this._abort = false;
|
|
129
|
+
this._stopped = false;
|
|
125
130
|
this._netCapture = '';
|
|
126
131
|
this._netCaptureAt = 0;
|
|
127
132
|
this._netChatId = null;
|
|
@@ -354,6 +359,7 @@ export class DeepSeekBrowser {
|
|
|
354
359
|
}
|
|
355
360
|
async stopGeneration() {
|
|
356
361
|
this._abort = true;
|
|
362
|
+
this._stopped = true;
|
|
357
363
|
// 1) Пробуем явные селекторы Stop.
|
|
358
364
|
const btn = await this._findVisible(STOP_SELECTORS, 500);
|
|
359
365
|
if (btn) {
|
|
@@ -478,13 +484,17 @@ export class DeepSeekBrowser {
|
|
|
478
484
|
await this.page.keyboard.insertText(text);
|
|
479
485
|
}
|
|
480
486
|
}
|
|
487
|
+
// Небольшая пауза между отправками, чтобы случайно не отправить два
|
|
488
|
+
// сообщения подряд. Основная защита от лимита частоты — обработка
|
|
489
|
+
// RateLimitError в ask() (ждём rateLimitWaitMs и повторяем), поэтому
|
|
490
|
+
// здесь интервал маленький и не мешает живому вводу.
|
|
481
491
|
async _waitForSendSlot() {
|
|
482
492
|
if (!this._lastSentAt)
|
|
483
493
|
return;
|
|
484
494
|
const gap = this.minSendIntervalMs - (Date.now() - this._lastSentAt);
|
|
485
495
|
if (gap <= 0)
|
|
486
496
|
return;
|
|
487
|
-
console.error(theme.warn(`⏳ пауза ${Math.ceil(gap / 1000)}с перед
|
|
497
|
+
console.error(theme.warn(`⏳ пауза ${Math.ceil(gap / 1000)}с перед отправкой...`));
|
|
488
498
|
await this.page.waitForTimeout(gap);
|
|
489
499
|
}
|
|
490
500
|
async _askOnce(prompt, { timeout }) {
|
package/dist/config.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -626,6 +626,9 @@ async function runTask(browser, tools, taskText, workdir, opts) {
|
|
|
626
626
|
// В TTY-режиме UI — это LineEditor: он владеет вводом (очередь, Esc,
|
|
627
627
|
// Ctrl+C) и рисует статус НАД постоянной строкой ввода. В не-TTY режиме
|
|
628
628
|
// (пайпы) — обычный спиннер + watchInput.
|
|
629
|
+
// Новая задача с промпта — сбрасываем «стоп» от прошлого прерывания.
|
|
630
|
+
browser._stopped = false;
|
|
631
|
+
browser._abort = false;
|
|
629
632
|
const ui = editor || mod.createSpinner();
|
|
630
633
|
const stopWatching = editor
|
|
631
634
|
? () => { }
|
|
@@ -667,6 +670,12 @@ async function runTask(browser, tools, taskText, workdir, opts) {
|
|
|
667
670
|
onChatReady,
|
|
668
671
|
debugLog: debug,
|
|
669
672
|
});
|
|
673
|
+
// Прервали (Esc/Ctrl+C) — не запускаем следующие задачи из очереди
|
|
674
|
+
// и очищаем её, чтобы «стоп» действительно останавливал всё.
|
|
675
|
+
if (browser._stopped) {
|
|
676
|
+
queue.length = 0;
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
670
679
|
if (!queue.length)
|
|
671
680
|
break;
|
|
672
681
|
const queued = queue.shift() ?? '';
|