yiyan-browser-agent 1.7.5 → 1.7.6

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/package.json +1 -1
  2. package/src/browser.js +22 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yiyan-browser-agent",
3
- "version": "1.7.5",
3
+ "version": "1.7.6",
4
4
  "description": "AI coding agent powered by Yiyan (文心一言) via browser automation — no API key needed",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/browser.js CHANGED
@@ -344,8 +344,29 @@ class YiyanBrowser {
344
344
  hasCompletionMarker = true;
345
345
  }
346
346
 
347
- // ── 完成判断:标记出现 + 连续两次稳定 + _isGenerating 确认 ──
347
+ // ── 完成判断:标记出现 + 连续两次稳定 + _isGenerating 确认 + 思考区域检查 ──
348
348
  if (hasCompletionMarker && stableCount >= 2) {
349
+ // 检查思考区域是否有内容
350
+ const hasThinkingContent = await this.page.evaluate(() => {
351
+ const thinkingEl = document.querySelector('.container__SPpahQHm, [class*="container__SPpah"]');
352
+ if (thinkingEl) {
353
+ const s = window.getComputedStyle(thinkingEl);
354
+ if (s.display !== 'none' && s.visibility !== 'hidden') {
355
+ const text = thinkingEl.innerText || '';
356
+ return text.length > 5; // 思考区域有内容
357
+ }
358
+ }
359
+ return false;
360
+ });
361
+
362
+ if (hasThinkingContent) {
363
+ // 思考区域有内容,还没完成
364
+ stableCount = 0;
365
+ lastCheckTime = Date.now();
366
+ logger.dim('Thinking in progress, continue waiting...');
367
+ continue;
368
+ }
369
+
349
370
  if (!await this._isGenerating()) {
350
371
  await this.page.waitForTimeout(500);
351
372
  logger.clearLine();