yiyan-browser-agent 1.0.25 → 1.0.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yiyan-browser-agent",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
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": {
@@ -39,8 +39,8 @@ class BrowserManager {
39
39
  userAgent: 'Mozilla/5.0 AppleWebKit/537.36 Chrome/124.0.0.0 Safari/537.36',
40
40
  });
41
41
  const page = await context.newPage();
42
- await page.goto(config.YIYAN_URL, { waitUntil: 'domcontentloaded', timeout: 15000 });
43
- await page.waitForTimeout(500);
42
+ await page.goto(config.YIYAN_URL, { waitUntil: 'networkidle', timeout: 20000 });
43
+ await page.waitForTimeout(1500); // Extra wait for UI to render
44
44
 
45
45
  logger.success('Connected! New tab opened.');
46
46
  return { browser, context, page, isNew: false };
package/src/page-agent.js CHANGED
@@ -27,17 +27,24 @@ class PageAgent {
27
27
  * Send message to Yiyan
28
28
  */
29
29
  async sendMessage(text) {
30
+ // Wait for page to be fully loaded
31
+ await this.page.waitForLoadState('networkidle', { timeout: 10000 }).catch(() => {});
32
+ await this.page.waitForTimeout(1000);
33
+
30
34
  // Find input
31
35
  let inputEl = null;
32
36
  for (const sel of SEL.chatInput) {
33
37
  try {
34
- inputEl = await this.page.waitForSelector(sel, { timeout: 5000, state: 'visible' });
35
- if (inputEl) break;
38
+ inputEl = await this.page.waitForSelector(sel, { timeout: 8000, state: 'visible' });
39
+ if (inputEl) {
40
+ logger.dim('Found input: ' + sel);
41
+ break;
42
+ }
36
43
  } catch {}
37
44
  }
38
45
 
39
46
  if (!inputEl) {
40
- throw new Error('Cannot find input box');
47
+ throw new Error('Cannot find input box. Make sure Yiyan page is loaded.');
41
48
  }
42
49
 
43
50
  // Focus and clear