textweb 0.1.0 → 0.1.1

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": "textweb",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A text-grid web renderer for AI agents — see the web without screenshots",
5
5
  "main": "src/browser.js",
6
6
  "bin": {
package/src/browser.js CHANGED
@@ -34,7 +34,13 @@ class AgentBrowser {
34
34
  async navigate(url) {
35
35
  if (!this.page) await this.launch();
36
36
  this.scrollY = 0;
37
- await this.page.goto(url, { waitUntil: 'networkidle', timeout: 30000 });
37
+ // Use domcontentloaded + a short settle, not networkidle (SPAs never go idle)
38
+ await this.page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
39
+ // Wait for network to settle or 3s max — whichever comes first
40
+ await Promise.race([
41
+ this.page.waitForLoadState('networkidle').catch(() => {}),
42
+ new Promise(r => setTimeout(r, 3000)),
43
+ ]);
38
44
  return await this.snapshot();
39
45
  }
40
46
 
package/src/cli.js CHANGED
@@ -139,7 +139,7 @@ async function render(url, options) {
139
139
  if (elCount > 0) {
140
140
  console.error(`\\nInteractive elements:`);
141
141
  for (const [ref, element] of Object.entries(result.elements || {})) {
142
- console.error(`[${ref}] ${element.tagName}: ${element.textContent || '(no text)'}`);
142
+ console.error(`[${ref}] ${element.semantic || element.tag}: ${element.text || '(no text)'}`);
143
143
  }
144
144
  }
145
145
  }
@@ -312,7 +312,7 @@ Interactive Commands:
312
312
  if (result && Object.keys(result.elements || {}).length > 0) {
313
313
  console.log(`Interactive elements (${Object.keys(result.elements || {}).length}):`);
314
314
  for (const [ref, element] of Object.entries(result.elements || {})) {
315
- console.log(`[${ref}] ${element.tagName}: ${element.textContent || '(no text)'}`);
315
+ console.log(`[${ref}] ${element.semantic || element.tag}: ${element.text || '(no text)'}`);
316
316
  }
317
317
  } else {
318
318
  console.log('No interactive elements found');