zames_pro 2.15.3 → 2.15.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.
@@ -83,8 +83,11 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
83
83
  commands: context?.commands.map((c) => c.name) ?? [],
84
84
  });
85
85
  safeThinking();
86
- // system-prompt is an agent send: throttled (agent: true).
87
- await browser.ask(systemPrompt, { timeout: 60_000, agent: true });
86
+ // system-prompt is the FIRST message of a fresh chat: the rate limit only
87
+ // applies to a rapid back-and-forth, so this send is not throttled
88
+ // (agent: false). Throttling it used to add a useless 15s pause at the
89
+ // start of every new session.
90
+ await browser.ask(systemPrompt, { timeout: 60_000, agent: false });
88
91
  await reportChat();
89
92
  }
90
93
  let message = task;
package/dist/browser.js CHANGED
@@ -144,7 +144,7 @@ export class DeepSeekBrowser {
144
144
  // a generation really begins, not during the pre-send phase (chat open,
145
145
  // throttle wait), which used to show a spinner with no work in flight.
146
146
  onSendStart;
147
- constructor({ headless = false, debug = false, channel = 'chrome', answerTimeoutMs = 180000, askRetries = 3, stabilityChecks = 3, stabilityDelayMs = 1000, minSendIntervalMs = 15000, rateLimitWaitMs = 300000, maxRateLimitRetries = 6, maxServerBusyRetries = 5, serverBusyWaitMs = 3000, } = {}) {
147
+ constructor({ headless = false, debug = false, channel = 'chrome', answerTimeoutMs = 180000, askRetries = 3, stabilityChecks = 2, stabilityDelayMs = 400, minSendIntervalMs = 15000, rateLimitWaitMs = 300000, maxRateLimitRetries = 6, maxServerBusyRetries = 5, serverBusyWaitMs = 3000, } = {}) {
148
148
  this.headless = headless;
149
149
  this.debug = debug;
150
150
  this.channel = channel;
@@ -180,7 +180,10 @@ export class DeepSeekBrowser {
180
180
  async _launchOnce() {
181
181
  const options = {
182
182
  headless: this.headless,
183
- slowMo: 30,
183
+ // 30ms slowMo per Playwright action added up over thousands of DOM
184
+ // actions per run. The waits we need are explicit; keep a small value
185
+ // for stability of clicks/typing.
186
+ slowMo: 10,
184
187
  args: ['--disable-blink-features=AutomationControlled'],
185
188
  };
186
189
  if (this.channel)
@@ -694,7 +697,7 @@ export class DeepSeekBrowser {
694
697
  await this._attachFiles(attachments);
695
698
  }
696
699
  await this._setInputText(input, prompt);
697
- await this.page.waitForTimeout(200);
700
+ await this.page.waitForTimeout(50);
698
701
  let sent = false;
699
702
  for (const sel of SEND_SELECTORS) {
700
703
  const btn = this.page.locator(sel).last();
@@ -867,7 +870,11 @@ export class DeepSeekBrowser {
867
870
  const sameAsBefore = !!cur && !isNew && normText(cur) === normText(beforeText);
868
871
  if (isNew && cur === last) {
869
872
  stable++;
870
- if (stable >= 2) {
873
+ // `stabilityChecks` / `stabilityDelayMs` are the real knobs here.
874
+ // They used to be dead config (hardcoded 2 checks with an 800ms tick),
875
+ // so the FIN-loop always cost ~1.6s per answer. Defaults are now
876
+ // 2 checks x 400ms (~0.8s saved per turn) and the values are honored.
877
+ if (stable >= Math.max(1, this.stabilityChecks - 1)) {
871
878
  if (isNew || !(await this._isGenerating())) {
872
879
  this._askDebug('RETURN stable curLen=' + cur.length);
873
880
  return cur;
@@ -880,7 +887,7 @@ export class DeepSeekBrowser {
880
887
  if (isNew)
881
888
  last = cur;
882
889
  this._askDebug('FIN-loop isNew=' + isNew + ' sameAsBefore=' + sameAsBefore + ' stable=' + stable + ' curLen=' + cur.length + ' lastLen=' + last.length + ' netFresh=' + netFresh);
883
- await this.page.waitForTimeout(800);
890
+ await this.page.waitForTimeout(Math.max(0, this.stabilityDelayMs));
884
891
  }
885
892
  if (last && (normText(last) !== normText(beforeText) || this._netCapture)) {
886
893
  this._askDebug('RETURN last len=' + last.length);
package/dist/config.js CHANGED
@@ -36,8 +36,8 @@ export const DEFAULTS = {
36
36
  browser: {
37
37
  answerTimeoutMs: 180000,
38
38
  askRetries: 3,
39
- stabilityChecks: 3,
40
- stabilityDelayMs: 1000,
39
+ stabilityChecks: 2,
40
+ stabilityDelayMs: 400,
41
41
  minSendIntervalMs: 15000,
42
42
  rateLimitWaitMs: 300000,
43
43
  maxRateLimitRetries: 6,
@@ -133,7 +133,12 @@ export function extractAnswer(body) {
133
133
  }
134
134
  // Saves the DeepSeek network response body to disk for post-mortem analysis.
135
135
  // The files live in ~/.zames/net-log — from them the real answer format is visible.
136
+ // DEBUG ONLY: disabled unless ZAMES_NET_DEBUG=1. It writes a file per network
137
+ // response (thousands of files / tens of MB) and is not needed for the agent
138
+ // to work — the answer is taken from extractAnswer() in memory.
136
139
  export async function dumpNetBody(url, body) {
140
+ if (!process.env.ZAMES_NET_DEBUG)
141
+ return;
137
142
  try {
138
143
  const dir = path.join(os.homedir(), '.zames', 'net-log');
139
144
  await fs.mkdir(dir, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.15.3",
3
+ "version": "2.15.4",
4
4
  "description": "Terminal coding agent over chat.deepseek.com via Playwright",
5
5
  "type": "module",
6
6
  "bin": {