zames_pro 2.10.5 → 2.10.7

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.
Files changed (2) hide show
  1. package/dist/browser.js +35 -11
  2. package/package.json +1 -1
package/dist/browser.js CHANGED
@@ -669,7 +669,7 @@ export class DeepSeekBrowser {
669
669
  // Wait for the start: either Stop appeared, or the answer text changed,
670
670
  // or the total amount of text on the page grew. In parallel we catch
671
671
  // the rate-limit toast (only toasts, not the whole body).
672
- const startDeadline = Date.now() + 15_000;
672
+ const startDeadline = Date.now() + 30_000;
673
673
  const startBodyLen = await this.page
674
674
  .evaluate(() => document.body.innerText.length)
675
675
  .catch(() => 0);
@@ -749,10 +749,36 @@ export class DeepSeekBrowser {
749
749
  if (fresh) {
750
750
  return this._netCapture;
751
751
  }
752
- // We NO LONGER check the limit over the whole page text — that caused
753
- // false positives and 5-minute waits. We just report that
754
- // generation did not start.
755
- throw new Error('Ответ не начал генерироваться за 15с. Возможно, сообщение не отправилось.');
752
+ // The send did not start generation within 15s. The most common cause is
753
+ // that the message did not actually go out (Enter lost, button not
754
+ // clicked). Instead of throwing (which made ask() retry for minutes and
755
+ // looked like a stall), press Enter once more and give it another
756
+ // window. Only if that also fails do we throw.
757
+ this._askDebug('START-failed, resending');
758
+ await this.page.keyboard.press('Enter');
759
+ this._lastSentAt = Date.now();
760
+ const retryDeadline = Date.now() + 20_000;
761
+ while (Date.now() < retryDeadline) {
762
+ if (this._abort)
763
+ return '(прервано пользователем)';
764
+ const cur2 = await this._readLastAnswerTextClean().catch(() => '');
765
+ const net2 = !!this._netCapture && this._netCaptureAt >= this._lastSentAt;
766
+ const grew2 = (await this.page
767
+ .evaluate(() => document.body.innerText.length)
768
+ .catch(() => 0)) > startBodyLen;
769
+ if (net2 ||
770
+ grew2 ||
771
+ (!!cur2 && normText(cur2) !== normText(beforeText))) {
772
+ started = true;
773
+ this._askDebug('STARTED-after-resend');
774
+ break;
775
+ }
776
+ await this.page.waitForTimeout(300);
777
+ }
778
+ }
779
+ if (!started) {
780
+ throw new Error('Ответ не начал генерироваться за 35с даже после повторной отправки. ' +
781
+ 'Проверьте чат DeepSeek вручную.');
756
782
  }
757
783
  // Wait until the answer stops changing. We check the "not generating"
758
784
  // condition via text growth, NOT via _isGenerating().
@@ -791,7 +817,7 @@ export class DeepSeekBrowser {
791
817
  // tool call" hang. If generation has clearly ENDED (no Stop button) and
792
818
  // the text is stable, accept it (even when it repeats the previous one).
793
819
  const sameAsBefore = !!cur && !isNew && normText(cur) === normText(beforeText);
794
- if ((isNew || sameAsBefore) && cur === last) {
820
+ if (isNew && cur === last) {
795
821
  stable++;
796
822
  if (stable >= 2) {
797
823
  if (isNew || !(await this._isGenerating())) {
@@ -803,7 +829,7 @@ export class DeepSeekBrowser {
803
829
  else {
804
830
  stable = 0;
805
831
  }
806
- if (isNew || sameAsBefore)
832
+ if (isNew)
807
833
  last = cur;
808
834
  this._askDebug('FIN-loop isNew=' + isNew + ' sameAsBefore=' + sameAsBefore + ' stable=' + stable + ' curLen=' + cur.length + ' lastLen=' + last.length + ' netFresh=' + netFresh);
809
835
  await this.page.waitForTimeout(800);
@@ -812,10 +838,8 @@ export class DeepSeekBrowser {
812
838
  this._askDebug('RETURN last len=' + last.length);
813
839
  return last;
814
840
  }
815
- // Fallback: the turn settled on a text identical to the previous answer.
816
- if (last && !(await this._isGenerating())) {
817
- return last;
818
- }
841
+ // No fallback on a text equal to beforeText: returning it would re-run
842
+ // the previous tool call. Only a fresh network capture is accepted below.
819
843
  if (this._netCapture && this._netCaptureAt >= this._lastSentAt) {
820
844
  return this._netCapture;
821
845
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.10.5",
3
+ "version": "2.10.7",
4
4
  "description": "Terminal coding agent over chat.deepseek.com via Playwright",
5
5
  "type": "module",
6
6
  "bin": {