@radaros/browser 0.3.12 → 0.3.13
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/README.md +33 -0
- package/dist/index.js +10 -5
- package/package.json +17 -2
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @radaros/browser
|
|
2
|
+
|
|
3
|
+
Browser automation agent for RadarOS using Playwright.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @radaros/browser playwright
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { BrowserAgent } from "@radaros/browser";
|
|
15
|
+
import { openai } from "@radaros/core";
|
|
16
|
+
|
|
17
|
+
const agent = new BrowserAgent({
|
|
18
|
+
name: "browser-bot",
|
|
19
|
+
model: openai("gpt-4o"),
|
|
20
|
+
instructions: "Navigate websites and extract information.",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const result = await agent.run("Go to example.com and get the page title");
|
|
24
|
+
console.log(result.text);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
Full docs at [radaros.mintlify.dev](https://radaros.mintlify.dev)
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -321,7 +321,8 @@ var BrowserProvider = class {
|
|
|
321
321
|
let title = "";
|
|
322
322
|
try {
|
|
323
323
|
title = await this.page.title();
|
|
324
|
-
} catch {
|
|
324
|
+
} catch (err) {
|
|
325
|
+
console.warn("[radaros/browser] Error getting page title:", err instanceof Error ? err.message : err);
|
|
325
326
|
}
|
|
326
327
|
return { url, title, viewportSize: this._viewport };
|
|
327
328
|
}
|
|
@@ -330,7 +331,8 @@ var BrowserProvider = class {
|
|
|
330
331
|
await this.sleep(minWait);
|
|
331
332
|
try {
|
|
332
333
|
await this.page.waitForLoadState("networkidle", { timeout: 5e3 });
|
|
333
|
-
} catch {
|
|
334
|
+
} catch (err) {
|
|
335
|
+
console.warn("[radaros/browser] Error waiting for stable:", err instanceof Error ? err.message : err);
|
|
334
336
|
}
|
|
335
337
|
}
|
|
336
338
|
// ── Multi-Tab / Parallel Browsing ────────────────────────────────────
|
|
@@ -384,7 +386,8 @@ var BrowserProvider = class {
|
|
|
384
386
|
const video = targetPage.video();
|
|
385
387
|
if (!video) return null;
|
|
386
388
|
return await video.path();
|
|
387
|
-
} catch {
|
|
389
|
+
} catch (err) {
|
|
390
|
+
console.warn("[radaros/browser] Error getting video path:", err instanceof Error ? err.message : err);
|
|
388
391
|
return null;
|
|
389
392
|
}
|
|
390
393
|
}
|
|
@@ -395,11 +398,13 @@ var BrowserProvider = class {
|
|
|
395
398
|
async close() {
|
|
396
399
|
try {
|
|
397
400
|
if (this.context) await this.context.close();
|
|
398
|
-
} catch {
|
|
401
|
+
} catch (err) {
|
|
402
|
+
console.warn("[radaros/browser] Error closing context:", err instanceof Error ? err.message : err);
|
|
399
403
|
}
|
|
400
404
|
try {
|
|
401
405
|
if (this.browser) await this.browser.close();
|
|
402
|
-
} catch {
|
|
406
|
+
} catch (err) {
|
|
407
|
+
console.warn("[radaros/browser] Error closing browser:", err instanceof Error ? err.message : err);
|
|
403
408
|
}
|
|
404
409
|
this.page = null;
|
|
405
410
|
this.context = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radaros/browser",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
|
+
"description": "Browser automation agent for RadarOS using Playwright",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/xhipment/agentOs.git",
|
|
9
|
+
"directory": "packages/browser"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ai",
|
|
13
|
+
"agents",
|
|
14
|
+
"browser",
|
|
15
|
+
"automation",
|
|
16
|
+
"playwright",
|
|
17
|
+
"scraping"
|
|
18
|
+
],
|
|
4
19
|
"type": "module",
|
|
5
20
|
"main": "./dist/index.js",
|
|
6
21
|
"types": "./dist/index.d.ts",
|
|
@@ -28,7 +43,7 @@
|
|
|
28
43
|
"typescript": "^5.6.0"
|
|
29
44
|
},
|
|
30
45
|
"peerDependencies": {
|
|
31
|
-
"@radaros/core": "^0.3.
|
|
46
|
+
"@radaros/core": "^0.3.13",
|
|
32
47
|
"playwright": ">=1.40.0"
|
|
33
48
|
},
|
|
34
49
|
"peerDependenciesMeta": {
|