yiyan-browser-agent 1.7.5 → 1.7.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/package.json +1 -1
  2. package/src/browser.js +23 -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.7",
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,30 @@ class YiyanBrowser {
344
344
  hasCompletionMarker = true;
345
345
  }
346
346
 
347
- // ── 完成判断:标记出现 + 连续两次稳定 + _isGenerating 确认 ──
347
+ // ── 完成判断:标记出现 + 连续两次稳定 + 思考区域已消失 ──
348
348
  if (hasCompletionMarker && stableCount >= 2) {
349
+ // 检查思考区域是否存在且有内容
350
+ const thinkingStatus = await this.page.evaluate(() => {
351
+ const thinkingEl = document.querySelector('.container__SPpahQHm, [class*="container__SPpah"]');
352
+ if (!thinkingEl) return { exists: false, hasContent: false };
353
+
354
+ const s = window.getComputedStyle(thinkingEl);
355
+ const isVisible = s.display !== 'none' && s.visibility !== 'hidden';
356
+ const text = thinkingEl.innerText || '';
357
+ const hasContent = text.length > 5;
358
+
359
+ return { exists: true, isVisible, hasContent };
360
+ });
361
+
362
+ // 思考区域存在且可见且有内容 → 还在思考,继续等待
363
+ if (thinkingStatus.exists && thinkingStatus.isVisible && thinkingStatus.hasContent) {
364
+ stableCount = 0;
365
+ lastCheckTime = Date.now();
366
+ logger.dim('Thinking in progress, continue waiting...');
367
+ continue;
368
+ }
369
+
370
+ // 思考区域已消失/不可见/无内容 → 检查 _isGenerating
349
371
  if (!await this._isGenerating()) {
350
372
  await this.page.waitForTimeout(500);
351
373
  logger.clearLine();