yiyan-browser-agent 1.6.4 → 1.6.5

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 +7 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yiyan-browser-agent",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
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
@@ -498,7 +498,7 @@ class YiyanBrowser {
498
498
  '[class*="stop-gen"]',
499
499
  '[class*="stopGen"]',
500
500
  '[class*="generating"]',
501
- '[class*=" Generating"]', // Yiyan 可能的 class
501
+ '[class*=" Generating"]',
502
502
  ];
503
503
  for (const sel of stopSelectors) {
504
504
  const el = document.querySelector(sel);
@@ -519,7 +519,6 @@ class YiyanBrowser {
519
519
  '[class*="thinking"]',
520
520
  'svg[class*="loading"]',
521
521
  'svg[class*="spinner"]',
522
- // Yiyan 特有的加载指示
523
522
  '.loading-indicator',
524
523
  '.generating-indicator',
525
524
  ];
@@ -531,39 +530,18 @@ class YiyanBrowser {
531
530
  }
532
531
  }
533
532
 
534
- // ── 3. 检测输入框状态(生成时通常禁用)──
535
- const inputSelectors = [
536
- '[contenteditable="true"]',
537
- 'textarea',
538
- '[role="textbox"]',
539
- '.editable',
540
- ];
541
- for (const sel of inputSelectors) {
542
- const input = document.querySelector(sel);
543
- if (input) {
544
- // 检查是否禁用
545
- if (input.disabled) return true;
546
- if (input.getAttribute('aria-disabled') === 'true') return true;
547
- if (input.getAttribute('disabled') !== null) return true;
548
-
549
- // 检查是否只读(有时会用 readonly 表示生成中)
550
- if (input.readOnly || input.getAttribute('readonly') !== null) {
551
- // 但要排除本来就是 readonly 的输入框
552
- // 这里暂时不返回 true,需要更多测试
553
- }
554
- }
555
- }
556
-
557
- // ── 4. 检测是否缺少完成标记元素 ──
558
- // 如果没有复制按钮/重新生成按钮,可能还在生成
533
+ // ── 3. 检测是否缺少完成标记元素 ──
534
+ // dialogCardBottom Yiyan 响应完成后的底部操作区域
559
535
  const completionMarkers = [
536
+ '[class*="dialogCardBottom"]', // Yiyan 对话卡片底部
537
+ '.dialogCardBottom__qoXjps3z', // Yiyan 特定 class
560
538
  '[class*="copy-btn"]',
561
539
  '[class*="copyBtn"]',
562
540
  '[aria-label*="Copy" i]',
563
541
  '[aria-label*="复制"]',
564
542
  '[class*="regenerate"]',
565
543
  '[class*="retry"]',
566
- '[class*="action-btn"]', // Yiyan 的操作按钮区域
544
+ '[class*="action-btn"]',
567
545
  ];
568
546
  let hasCompletionMarker = false;
569
547
  for (const sel of completionMarkers) {
@@ -573,12 +551,10 @@ class YiyanBrowser {
573
551
  }
574
552
  }
575
553
 
576
- // 如果有响应内容但没有完成标记 → 可能还在生成
577
- // 这个检测放在后面,避免误判空响应
554
+ // 如果有响应内容但没有完成标记 → 还在生成
578
555
  const answerArea = document.querySelector('[class*="answer"], [class*="response"], [class*="markdown"]');
579
556
  if (answerArea && answerArea.innerText && answerArea.innerText.length > 50) {
580
557
  if (!hasCompletionMarker) {
581
- // 有内容但没有完成按钮,可能还在生成
582
558
  return true;
583
559
  }
584
560
  }