zames_pro 2.29.10 → 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/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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.29.10",
3
+ "version": "2.29.11",
4
4
  "description": "Terminal coding agent over chat.deepseek.com via Playwright",
5
5
  "type": "module",
6
6
  "bin": {