zames_pro 2.29.9 → 2.29.11
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 +40 -1
- package/dist/i18n.js +4 -0
- package/dist/index.js +35 -1
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -309,6 +309,11 @@ export class DeepSeekBrowser {
|
|
|
309
309
|
// credentials into the user config (the browser does not write config).
|
|
310
310
|
onAuthSave;
|
|
311
311
|
_lastSentAt;
|
|
312
|
+
// Timestamp of the last Continue click. Clicks send a `chat/continue`
|
|
313
|
+
// request and used to bypass `_waitForSendSlot()` entirely — a run that
|
|
314
|
+
// keeps getting truncated could fire them back-to-back and hammer the
|
|
315
|
+
// rate limit. The click path now respects `minSendIntervalMs` like a send.
|
|
316
|
+
_lastContinueAt;
|
|
312
317
|
_abort;
|
|
313
318
|
// The user pressed Esc/Ctrl+C — a "stop" for the WHOLE current batch of
|
|
314
319
|
// tasks (including the queue). Unlike _abort (reset on every send), this
|
|
@@ -388,6 +393,7 @@ export class DeepSeekBrowser {
|
|
|
388
393
|
this.locale = locale || DEFAULT_LOCALE;
|
|
389
394
|
this.onAuthSave = onAuthSave || null;
|
|
390
395
|
this._lastSentAt = 0;
|
|
396
|
+
this._lastContinueAt = 0;
|
|
391
397
|
this._abort = false;
|
|
392
398
|
this._stopped = false;
|
|
393
399
|
this._netCapture = '';
|
|
@@ -1155,6 +1161,11 @@ export class DeepSeekBrowser {
|
|
|
1155
1161
|
// event and reliably triggers React handlers. The old in-page
|
|
1156
1162
|
// dispatchEvent/click often did nothing, which is exactly why the
|
|
1157
1163
|
// operator saw the button and the "жму Continue" message but no resume.
|
|
1164
|
+
//
|
|
1165
|
+
// We LOOK for the button first and only then wait out the send slot:
|
|
1166
|
+
// probing this every tick must stay cheap, and there is no point
|
|
1167
|
+
// throttling a click that will not happen.
|
|
1168
|
+
let found = null;
|
|
1158
1169
|
for (const name of CONTINUE_NAMES) {
|
|
1159
1170
|
try {
|
|
1160
1171
|
const loc = this.page.getByRole('button', { name }).first();
|
|
@@ -1162,7 +1173,35 @@ export class DeepSeekBrowser {
|
|
|
1162
1173
|
continue;
|
|
1163
1174
|
if (!(await loc.isVisible().catch(() => false)))
|
|
1164
1175
|
continue;
|
|
1165
|
-
|
|
1176
|
+
found = loc;
|
|
1177
|
+
break;
|
|
1178
|
+
}
|
|
1179
|
+
catch { }
|
|
1180
|
+
}
|
|
1181
|
+
if (found) {
|
|
1182
|
+
// One Continue click per `minSendIntervalMs`: a `chat/continue` request
|
|
1183
|
+
// hits the rate limit like a send, and a run that keeps getting
|
|
1184
|
+
// truncated could otherwise fire clicks back-to-back. The gap counts
|
|
1185
|
+
// from the LATEST of the last send and the last Continue click.
|
|
1186
|
+
const since = Math.max(this._lastSentAt, this._lastContinueAt);
|
|
1187
|
+
if (since) {
|
|
1188
|
+
const gap = this.minSendIntervalMs - (Date.now() - since);
|
|
1189
|
+
if (gap > 0) {
|
|
1190
|
+
const aborted = await this._sleepInterruptible(gap, (leftMs) => {
|
|
1191
|
+
if (this.onSendPause) {
|
|
1192
|
+
try {
|
|
1193
|
+
this.onSendPause(Math.max(0, Math.ceil(leftMs / 1000)));
|
|
1194
|
+
}
|
|
1195
|
+
catch { }
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
if (aborted)
|
|
1199
|
+
return false;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
try {
|
|
1203
|
+
await found.click({ timeout: 2000 });
|
|
1204
|
+
this._lastContinueAt = Date.now();
|
|
1166
1205
|
return true;
|
|
1167
1206
|
}
|
|
1168
1207
|
catch { }
|
package/dist/i18n.js
CHANGED
|
@@ -755,6 +755,10 @@ const CATALOG = {
|
|
|
755
755
|
ru: '⚠ авто-reload: часть модулей не загрузилась, работаю на прежней версии:',
|
|
756
756
|
en: '⚠ auto-reload: some modules failed, using previous version:',
|
|
757
757
|
},
|
|
758
|
+
'reload.browser_restart': {
|
|
759
|
+
ru: '⚠ browser.ts изменился, но он НЕ перезагружается на лету (в нём Playwright-контекст). Перезапусти zames, иначе изменения не применятся.',
|
|
760
|
+
en: '⚠ browser.ts changed, but it is NOT hot-reloaded (it owns the Playwright context). Restart zames or the change will not apply.',
|
|
761
|
+
},
|
|
758
762
|
// ---------- MCP ----------
|
|
759
763
|
'help.cmd.mcp': {
|
|
760
764
|
ru: '/mcp показать MCP-серверы и их инструменты',
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'fs/promises';
|
|
4
|
-
import { existsSync } from 'fs';
|
|
4
|
+
import { existsSync, statSync } from 'fs';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { theme } from './theme.js';
|
|
7
7
|
import { DeepSeekBrowser } from './browser.js';
|
|
@@ -191,6 +191,40 @@ async function autoReload() {
|
|
|
191
191
|
for (const e of errors)
|
|
192
192
|
console.error(theme.warn(' ' + e));
|
|
193
193
|
}
|
|
194
|
+
warnIfBrowserChanged();
|
|
195
|
+
}
|
|
196
|
+
// `browser.ts` is NOT in RELOADABLE: it is imported statically (once) and the
|
|
197
|
+
// live DeepSeekBrowser instance owns the Playwright context/page/timers, so a
|
|
198
|
+
// hot swap is unsafe. In dev mode (`npm run dev` = tsx over src/) the operator
|
|
199
|
+
// therefore keeps running the OLD browser code after editing it, and a fix
|
|
200
|
+
// "does not work" until the process is restarted. We detect the mtime change
|
|
201
|
+
// and print a ONE-TIME hint so this is never a silent trap again.
|
|
202
|
+
let browserMtime = 0;
|
|
203
|
+
let browserChangedWarned = false;
|
|
204
|
+
function browserSourcePath() {
|
|
205
|
+
// In dev the running file is src/index.ts; in the built dist — dist/index.js
|
|
206
|
+
// with the sources next to it (../src). Either way we look for browser.ts.
|
|
207
|
+
const srcDir = /[.]ts$/.test(new URL(import.meta.url).pathname)
|
|
208
|
+
? path.dirname(fileURLToPath(import.meta.url))
|
|
209
|
+
: path.join(__dirname, '..', 'src');
|
|
210
|
+
return path.join(srcDir, 'browser.ts');
|
|
211
|
+
}
|
|
212
|
+
function warnIfBrowserChanged() {
|
|
213
|
+
if (!devMode)
|
|
214
|
+
return;
|
|
215
|
+
try {
|
|
216
|
+
const p = browserSourcePath();
|
|
217
|
+
const st = statSync(p);
|
|
218
|
+
if (!browserMtime) {
|
|
219
|
+
browserMtime = st.mtimeMs;
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (st.mtimeMs !== browserMtime && !browserChangedWarned) {
|
|
223
|
+
browserChangedWarned = true;
|
|
224
|
+
console.error(theme.warn(t('reload.browser_restart')));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch { }
|
|
194
228
|
}
|
|
195
229
|
// ---------- helpers ----------
|
|
196
230
|
function printHelp() {
|