b4n1-web 0.4.0 → 0.6.0
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 +69 -107
- package/bin/b4n1web-linux +0 -0
- package/dist/browser.d.ts +4 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +58 -15
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -1,146 +1,108 @@
|
|
|
1
1
|
# B4n1Web JavaScript/TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<a href="https://github.com/B4N1-com/b4n1-web"><img src="https://img.shields.io/github/stars/B4N1-com/b4n1web?style=flat" alt="GitHub stars"></a>
|
|
7
|
-
</p>
|
|
3
|
+
[](https://www.npmjs.com/package/b4n1-web)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://nodejs.org/)
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
> Ultra-lightweight agentic browser engine with bundled binary.
|
|
10
8
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
### 1. Install the B4n1Web Binary
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
curl -sL https://web.b4n1.com/install | bash
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### 2. Install the JavaScript SDK
|
|
9
|
+
## Install
|
|
20
10
|
|
|
21
11
|
```bash
|
|
22
12
|
npm install b4n1-web
|
|
23
13
|
```
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
yarn add b4n1-web
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Or with pnpm:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
pnpm add b4n1-web
|
|
35
|
-
```
|
|
15
|
+
Binary is bundled — no separate installation needed.
|
|
36
16
|
|
|
37
17
|
## Quick Start
|
|
38
18
|
|
|
39
19
|
```typescript
|
|
40
|
-
import { AgentBrowser, BrowserMode
|
|
20
|
+
import { AgentBrowser, BrowserMode } from 'b4n1-web';
|
|
41
21
|
|
|
42
|
-
// Create a browser instance
|
|
43
22
|
const browser = new AgentBrowser({ mode: BrowserMode.LIGHT });
|
|
44
|
-
|
|
45
|
-
// Navigate to a page
|
|
46
23
|
const page = await browser.goto('https://example.com');
|
|
24
|
+
console.log(page.markdown);
|
|
25
|
+
console.log(`${page.links.length} links found`);
|
|
26
|
+
browser.close();
|
|
27
|
+
```
|
|
47
28
|
|
|
48
|
-
|
|
49
|
-
console.log('Page content:', page.markdown);
|
|
50
|
-
console.log('Found', page.links.length, 'links');
|
|
51
|
-
|
|
52
|
-
// Extract main content
|
|
53
|
-
const mainContent = page.getMainContent();
|
|
54
|
-
console.log('Main content:', mainContent.substring(0, 200) + '...');
|
|
29
|
+
## Page API
|
|
55
30
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
31
|
+
```typescript
|
|
32
|
+
page.url // string
|
|
33
|
+
page.markdown // string
|
|
34
|
+
page.links // string[]
|
|
35
|
+
page.screenshot // string | undefined
|
|
59
36
|
|
|
60
|
-
//
|
|
61
|
-
|
|
37
|
+
page.getMainContent() // string: content without headers
|
|
38
|
+
page.findLinksByText("more") // string[]: matching links
|
|
62
39
|
```
|
|
63
40
|
|
|
64
41
|
## Browser Modes
|
|
65
42
|
|
|
66
|
-
|
|
43
|
+
| Mode | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `BrowserMode.LIGHT` | HTTP + HTML parsing |
|
|
46
|
+
| `BrowserMode.JS` | Light + script extraction |
|
|
47
|
+
| `BrowserMode.RENDER` | Full Chromium + screenshots |
|
|
67
48
|
|
|
68
|
-
|
|
69
|
-
- **Performance**: < 15MB RAM, instant startup
|
|
70
|
-
- **Capabilities**: HTML parsing, markdown conversion, link extraction
|
|
71
|
-
- **Limitations**: No JavaScript execution
|
|
49
|
+
## Security
|
|
72
50
|
|
|
73
51
|
```typescript
|
|
74
|
-
|
|
75
|
-
```
|
|
52
|
+
import { SecurityShield } from 'b4n1-web';
|
|
76
53
|
|
|
77
|
-
|
|
54
|
+
const shield = new SecurityShield();
|
|
55
|
+
shield.markDomain('evil.com', false);
|
|
56
|
+
const { isSafe, needsApiCheck } = shield.isUrlSafe('https://evil.com');
|
|
57
|
+
```
|
|
78
58
|
|
|
79
|
-
|
|
80
|
-
- **Performance**: Same as Light, instant startup
|
|
81
|
-
- **Capabilities**: HTML parsing + JavaScript tag extraction
|
|
59
|
+
## Error Handling
|
|
82
60
|
|
|
83
61
|
```typescript
|
|
84
|
-
|
|
62
|
+
import { BinaryNotFoundError } from 'b4n1-web';
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const browser = new AgentBrowser();
|
|
66
|
+
} catch (e) {
|
|
67
|
+
if (e instanceof BinaryNotFoundError) {
|
|
68
|
+
console.error('Install binary: curl -sL https://web.b4n1.com/install | bash');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
85
71
|
```
|
|
86
72
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- **Use case**: SPAs, form filling, visual verification, E2E testing
|
|
90
|
-
- **Status**: Coming in v0.3.0
|
|
91
|
-
|
|
92
|
-
## API Reference
|
|
93
|
-
|
|
94
|
-
### AgentBrowser
|
|
95
|
-
|
|
96
|
-
Main browser class for web automation.
|
|
97
|
-
|
|
98
|
-
#### Constructor Options
|
|
99
|
-
|
|
100
|
-
- `mode`: BrowserMode.LIGHT, BrowserMode.JS, or BrowserMode.RENDER
|
|
101
|
-
- `timeout`: Request timeout in seconds (default: 30)
|
|
102
|
-
- `userAgent`: Custom user agent string
|
|
103
|
-
|
|
104
|
-
#### Methods
|
|
105
|
-
|
|
106
|
-
- `goto(url: string)`: Navigate to URL and return structured page data
|
|
107
|
-
- `close()`: Close the browser session
|
|
108
|
-
|
|
109
|
-
### Page
|
|
110
|
-
|
|
111
|
-
Structured data from a web page.
|
|
112
|
-
|
|
113
|
-
#### Properties
|
|
114
|
-
|
|
115
|
-
- `url: string`: The page URL
|
|
116
|
-
- `markdown: string`: Clean markdown content
|
|
117
|
-
- `links: string[]`: Extracted links
|
|
118
|
-
- `screenshot?: string`: Base64-encoded screenshot (render mode only)
|
|
119
|
-
|
|
120
|
-
#### Methods
|
|
121
|
-
|
|
122
|
-
- `getMainContent()`: Extract main content, skipping headers/footers
|
|
123
|
-
- `findLinksByText(text: string)`: Find links containing specific text
|
|
124
|
-
|
|
125
|
-
## SecurityShield
|
|
126
|
-
|
|
127
|
-
Optional security validation with caching:
|
|
73
|
+
## Context Manager
|
|
128
74
|
|
|
129
75
|
```typescript
|
|
130
|
-
import {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
76
|
+
import { AgentBrowser } from 'b4n1-web';
|
|
77
|
+
|
|
78
|
+
async function main() {
|
|
79
|
+
const browser = new AgentBrowser();
|
|
80
|
+
try {
|
|
81
|
+
const page = await browser.goto('https://example.com');
|
|
82
|
+
console.log(page.markdown);
|
|
83
|
+
} finally {
|
|
84
|
+
browser.close();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Or with async dispose:
|
|
89
|
+
const browser = new AgentBrowser();
|
|
90
|
+
try {
|
|
91
|
+
await browser.goto('https://example.com');
|
|
92
|
+
} finally {
|
|
93
|
+
await browser[Symbol.asyncDispose]();
|
|
94
|
+
}
|
|
138
95
|
```
|
|
139
96
|
|
|
140
|
-
##
|
|
97
|
+
## Version
|
|
98
|
+
|
|
99
|
+
SDK: **0.4.0** | Binary: **0.4.0** (bundled)
|
|
141
100
|
|
|
142
|
-
|
|
101
|
+
## Links
|
|
143
102
|
|
|
144
|
-
|
|
103
|
+
- [npm](https://www.npmjs.com/package/b4n1-web)
|
|
104
|
+
- [GitHub](https://github.com/B4N1-com/b4n1web)
|
|
105
|
+
- [Website](https://web.b4n1.com)
|
|
145
106
|
|
|
146
|
-
|
|
107
|
+
---
|
|
108
|
+
*Built by B4N1 with ❤️ · All rights reserved.*
|
|
Binary file
|
package/dist/browser.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* B4n1Web Browser - JavaScript/TypeScript Implementation
|
|
3
3
|
*/
|
|
4
4
|
import { type BrowserOptions, type PageData } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Find the b4n1web binary in bundled location or system install
|
|
7
|
+
*/
|
|
8
|
+
export declare function getB4n1webBinary(): string | null;
|
|
5
9
|
/**
|
|
6
10
|
* Get B4n1Web binary version
|
|
7
11
|
*/
|
package/dist/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAe,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAuB,MAAM,SAAS,CAAC;AAE/F;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CA2ChD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAejD;AAID;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAczD;AAED;;GAEG;AACH,qBAAa,IAAK,YAAW,QAAQ;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAER,IAAI,EAAE,QAAQ;IAO1B;;OAEG;IACH,cAAc,IAAI,MAAM;IAMxB;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CAIxC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAU;gBAEhB,OAAO,GAAE,cAAmB;IAsBxC;;OAEG;IACG,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBtC;;OAEG;IACH,OAAO,CAAC,WAAW;IA+BnB;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACG,CAAC,MAAM,CAAC,YAAY,CAAC;CAG5B;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
package/dist/browser.js
CHANGED
|
@@ -2,37 +2,80 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* B4n1Web Browser - JavaScript/TypeScript Implementation
|
|
4
4
|
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.AgentBrowser = exports.Page = void 0;
|
|
40
|
+
exports.getB4n1webBinary = getB4n1webBinary;
|
|
7
41
|
exports.getB4n1webVersion = getB4n1webVersion;
|
|
8
42
|
exports.checkVersionCompatibility = checkVersionCompatibility;
|
|
9
43
|
exports.createBrowserAndGoto = createBrowserAndGoto;
|
|
10
44
|
const child_process_1 = require("child_process");
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
11
47
|
const types_1 = require("./types");
|
|
12
48
|
/**
|
|
13
|
-
* Find the b4n1web binary in
|
|
49
|
+
* Find the b4n1web binary in bundled location or system install
|
|
14
50
|
*/
|
|
15
51
|
function getB4n1webBinary() {
|
|
16
52
|
const home = process.env.HOME || process.env.USERPROFILE || '/home/' + process.env.USER;
|
|
17
|
-
const paths = [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
53
|
+
const paths = [];
|
|
54
|
+
// 1. Check bundled binary (bundled with npm package)
|
|
55
|
+
const bundledBinary = path.join(__dirname, '..', 'bin', 'b4n1web-linux');
|
|
56
|
+
if (fs.existsSync(bundledBinary)) {
|
|
57
|
+
try {
|
|
58
|
+
fs.accessSync(bundledBinary, fs.constants.X_OK);
|
|
59
|
+
return bundledBinary;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Not executable, continue searching
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// 2. Check system install locations
|
|
66
|
+
paths.push('/usr/local/bin/b4n1web', '/usr/bin/b4n1web', home + '/.local/bin/b4n1web', home + '/.b4n1web/bin/b4n1web');
|
|
67
|
+
// 3. Also check PATH
|
|
24
68
|
const pathEnv = process.env.PATH || '';
|
|
25
69
|
const pathDirs = pathEnv.split(':').filter(p => p);
|
|
26
70
|
for (const dir of pathDirs) {
|
|
27
71
|
paths.push(dir + '/b4n1web');
|
|
28
72
|
}
|
|
29
|
-
for (const
|
|
73
|
+
for (const filePath of paths) {
|
|
30
74
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const stats = fs.statSync(path);
|
|
75
|
+
if (fs.existsSync(filePath)) {
|
|
76
|
+
const stats = fs.statSync(filePath);
|
|
34
77
|
if (stats.isFile() && (stats.mode & 0o111) !== 0) {
|
|
35
|
-
return
|
|
78
|
+
return filePath;
|
|
36
79
|
}
|
|
37
80
|
}
|
|
38
81
|
}
|
|
@@ -62,7 +105,7 @@ function getB4n1webVersion() {
|
|
|
62
105
|
return null;
|
|
63
106
|
}
|
|
64
107
|
}
|
|
65
|
-
const SDK_VERSION = '0.
|
|
108
|
+
const SDK_VERSION = '0.5.0';
|
|
66
109
|
/**
|
|
67
110
|
* Check version compatibility and warn if mismatch
|
|
68
111
|
*/
|
|
@@ -136,7 +179,7 @@ class AgentBrowser {
|
|
|
136
179
|
`- ${home}/.local/bin/b4n1web\n` +
|
|
137
180
|
`- ${home}/.b4n1web/bin/b4n1web\n` +
|
|
138
181
|
`- PATH: ${pathDirs.join(', ')}\n\n` +
|
|
139
|
-
`
|
|
182
|
+
`For MCP server: curl -sL https://web.b4n1.com/install | bash`);
|
|
140
183
|
}
|
|
141
184
|
this.binaryPath = binary;
|
|
142
185
|
}
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUH,4CA2CC;AAKD,8CAeC;AAOD,8DAcC;AA2JD,oDAUC;AAjQD,iDAAyC;AACzC,uCAAyB;AACzB,2CAA6B;AAC7B,mCAA+F;AAE/F;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;IACxF,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,qDAAqD;IACrD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;IACzE,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChD,OAAO,aAAa,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,qCAAqC;QACvC,CAAC;IACH,CAAC;IAED,oCAAoC;IACpC,KAAK,CAAC,IAAI,CACR,wBAAwB,EACxB,kBAAkB,EAClB,IAAI,GAAG,qBAAqB,EAC5B,IAAI,GAAG,uBAAuB,CAC/B,CAAC;IAEF,qBAAqB;IACrB,MAAM,OAAO,GAAG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,CAAC,CAAC,qCAAqC;gBAC3E,CAAC;gBAAC,MAAM,CAAC;oBACP,KAAK,GAAG,EAAE,CAAC;gBACb,CAAC;YACH,CAAC;iBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;gBAC1C,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;YAClD,CAAC;iBAAM,CAAC;gBACN,QAAQ,IAAI,IAAI,GAAG,IAAI,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO,IAAI,IAAI,CAAC;YACd,GAAG;YACH,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE;YACzB,KAAK;YACL,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACH,2DAA2D;IAC7D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF;AAlGD,oCAkGC;AAED;;GAEG;AACI,KAAK,UAAU,oBAAoB,CACxC,GAAW,EACX,UAA0B,EAAE;IAE5B,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @module b4n1web
|
|
6
6
|
*/
|
|
7
|
-
export { AgentBrowser, Page } from './browser';
|
|
7
|
+
export { AgentBrowser, Page, getB4n1webBinary, getB4n1webVersion, checkVersionCompatibility } from './browser';
|
|
8
8
|
export { BrowserMode } from './types';
|
|
9
9
|
export { BinaryNotFoundError } from './errors';
|
|
10
|
-
export { SecurityShield, navigate } from './security';
|
|
11
|
-
export type { BrowserOptions, PageData, NavigateResult, SecurityShieldOptions } from './types';
|
|
12
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* @module b4n1web
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.BinaryNotFoundError = exports.BrowserMode = exports.checkVersionCompatibility = exports.getB4n1webVersion = exports.getB4n1webBinary = exports.Page = exports.AgentBrowser = void 0;
|
|
10
10
|
var browser_1 = require("./browser");
|
|
11
11
|
Object.defineProperty(exports, "AgentBrowser", { enumerable: true, get: function () { return browser_1.AgentBrowser; } });
|
|
12
12
|
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return browser_1.Page; } });
|
|
13
|
+
Object.defineProperty(exports, "getB4n1webBinary", { enumerable: true, get: function () { return browser_1.getB4n1webBinary; } });
|
|
14
|
+
Object.defineProperty(exports, "getB4n1webVersion", { enumerable: true, get: function () { return browser_1.getB4n1webVersion; } });
|
|
15
|
+
Object.defineProperty(exports, "checkVersionCompatibility", { enumerable: true, get: function () { return browser_1.checkVersionCompatibility; } });
|
|
13
16
|
var types_1 = require("./types");
|
|
14
17
|
Object.defineProperty(exports, "BrowserMode", { enumerable: true, get: function () { return types_1.BrowserMode; } });
|
|
15
18
|
var errors_1 = require("./errors");
|
|
16
19
|
Object.defineProperty(exports, "BinaryNotFoundError", { enumerable: true, get: function () { return errors_1.BinaryNotFoundError; } });
|
|
17
|
-
var security_1 = require("./security");
|
|
18
|
-
Object.defineProperty(exports, "SecurityShield", { enumerable: true, get: function () { return security_1.SecurityShield; } });
|
|
19
|
-
Object.defineProperty(exports, "navigate", { enumerable: true, get: function () { return security_1.navigate; } });
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,qCAA+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,qCAA+G;AAAtG,uGAAA,YAAY,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,4GAAA,iBAAiB,OAAA;AAAE,oHAAA,yBAAyB,OAAA;AAC3F,iCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "b4n1-web",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "B4n1Web SDK for JavaScript/TypeScript - Agentic Browser Engine",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "B4n1Web SDK for JavaScript/TypeScript - Agentic Browser Engine with bundled binary",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"dist"
|
|
14
|
+
"dist",
|
|
15
|
+
"bin"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "tsc",
|
|
18
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"postinstall": "node scripts/postinstall.js"
|
|
19
21
|
},
|
|
20
22
|
"keywords": [
|
|
21
23
|
"browser",
|
|
@@ -29,14 +31,15 @@
|
|
|
29
31
|
"homepage": "https://web.b4n1.com",
|
|
30
32
|
"repository": {
|
|
31
33
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/B4N1-com/
|
|
34
|
+
"url": "https://github.com/B4N1-com/b4n1web.git"
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"undici": "^6.0.0"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"@types/node": "^20.0.0",
|
|
39
|
-
"typescript": "^5.0.0"
|
|
41
|
+
"typescript": "^5.0.0",
|
|
42
|
+
"vitest": "^1.0.0"
|
|
40
43
|
},
|
|
41
44
|
"engines": {
|
|
42
45
|
"node": ">=18.0.0"
|