b4n1-web 0.6.2 → 0.9.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/bin/b4n1web ADDED
Binary file
package/bin/b4n1web-linux CHANGED
Binary file
package/dist/browser.d.ts CHANGED
@@ -1,78 +1,47 @@
1
- /**
2
- * B4n1Web Browser - JavaScript/TypeScript Implementation
3
- */
4
- import { type BrowserOptions, type PageData } from './types';
5
- /**
6
- * Find the b4n1web binary in bundled location or system install
7
- */
1
+ import { BrowserMode, type BrowserOptions, type PageData, type IframeInfo } from './types';
8
2
  export declare function getB4n1webBinary(): string | null;
9
- /**
10
- * Get B4n1Web binary version
11
- */
12
3
  export declare function getB4n1webVersion(): string | null;
13
- /**
14
- * Check version compatibility and warn if mismatch
15
- */
16
4
  export declare function checkVersionCompatibility(): string | null;
17
- /**
18
- * Page data returned by B4n1Web
19
- */
20
5
  export declare class Page implements PageData {
21
6
  url: string;
22
7
  markdown: string;
23
8
  links: string[];
24
9
  screenshot?: string;
10
+ jsOutput?: string;
25
11
  constructor(data: PageData);
26
- /**
27
- * Extract main content from markdown, skipping headers
28
- */
29
12
  getMainContent(): string;
30
- /**
31
- * Find links containing specific text
32
- */
33
13
  findLinksByText(text: string): string[];
34
14
  }
35
- /**
36
- * B4n1Web Agent Browser
37
- *
38
- * A browser instance optimized for AI agent workflows.
39
- * Requires B4n1Web binary to be installed.
40
- *
41
- * @example
42
- * ```typescript
43
- * import { AgentBrowser, BrowserMode } from 'b4n1-web';
44
- *
45
- * const browser = new AgentBrowser({ mode: BrowserMode.LIGHT });
46
- * const page = await browser.goto('https://example.com');
47
- * console.log(page.markdown);
48
- * browser.close();
49
- * ```
50
- */
51
15
  export declare class AgentBrowser {
52
16
  private mode;
53
17
  private timeout;
54
18
  private userAgent;
55
19
  private binaryPath;
20
+ private currentUrl;
21
+ private sessionId;
22
+ private sessionStarted;
23
+ private viewportWidth;
24
+ private viewportHeight;
25
+ private emulatedDevice;
56
26
  constructor(options?: BrowserOptions);
57
- /**
58
- * Navigate to a URL and extract structured content
59
- */
60
- goto(url: string): Promise<Page>;
61
- /**
62
- * Parse text output from the binary
63
- */
27
+ private escapeArg;
28
+ private runSessionCommand;
29
+ private ensureSession;
30
+ goto(url: string, waitFor?: string): Promise<Page>;
64
31
  private parseOutput;
65
- /**
66
- * Close the browser session
67
- */
32
+ click(selector: string): Promise<void>;
33
+ typeText(selector: string, text: string, clearFirst?: boolean): Promise<void>;
34
+ waitForSelector(selector: string, timeoutMs?: number): Promise<boolean>;
35
+ screenshot(url?: string): Promise<string>;
36
+ frames(): Promise<IframeInfo[]>;
37
+ iframeText(index: number): Promise<string>;
38
+ setViewport(width: number, height: number): Promise<void>;
39
+ emulateDevice(device: string): Promise<void>;
40
+ getLinks(): string[];
41
+ static getLinksFromPage(url: string, mode?: BrowserMode): Promise<string[]>;
42
+ static findBinary(): string | null;
68
43
  close(): void;
69
- /**
70
- * Use as async context manager
71
- */
72
44
  [Symbol.asyncDispose](): Promise<void>;
73
45
  }
74
- /**
75
- * Create a browser and navigate in one go
76
- */
77
46
  export declare function createBrowserAndGoto(url: string, options?: BrowserOptions): Promise<Page>;
78
47
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
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,CAA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AAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAezD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAclD,QAAQ,IAAI,MAAM,EAAE;WAmBP,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,WAA+B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAUpG,MAAM,CAAC,UAAU,IAAI,MAAM,GAAG,IAAI;IAIlC,KAAK,IAAI,IAAI;IAUP,CAAC,MAAM,CAAC,YAAY,CAAC;CAG5B;AAED,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAOf"}
package/dist/browser.js CHANGED
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * B4n1Web Browser - JavaScript/TypeScript Implementation
4
- */
5
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
3
  if (k2 === undefined) k2 = k;
7
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -45,13 +42,9 @@ const child_process_1 = require("child_process");
45
42
  const fs = __importStar(require("fs"));
46
43
  const path = __importStar(require("path"));
47
44
  const types_1 = require("./types");
48
- /**
49
- * Find the b4n1web binary in bundled location or system install
50
- */
51
45
  function getB4n1webBinary() {
52
46
  const home = process.env.HOME || process.env.USERPROFILE || '/home/' + process.env.USER;
53
47
  const paths = [];
54
- // 1. Check bundled binary (bundled with npm package)
55
48
  const bundledBinary = path.join(__dirname, '..', 'bin', 'b4n1web-linux');
56
49
  if (fs.existsSync(bundledBinary)) {
57
50
  try {
@@ -59,12 +52,12 @@ function getB4n1webBinary() {
59
52
  return bundledBinary;
60
53
  }
61
54
  catch {
62
- // Not executable, continue searching
63
55
  }
64
56
  }
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
57
+ const envBinary = process.env.B4N1WEB_BINARY;
58
+ if (envBinary)
59
+ paths.push(envBinary);
60
+ paths.push(home + '/.local/bin/b4n1web', home + '/.b4n1web/bin/b4n1web', '/usr/local/bin/b4n1web', '/usr/bin/b4n1web');
68
61
  const pathEnv = process.env.PATH || '';
69
62
  const pathDirs = pathEnv.split(':').filter(p => p);
70
63
  for (const dir of pathDirs) {
@@ -80,14 +73,10 @@ function getB4n1webBinary() {
80
73
  }
81
74
  }
82
75
  catch {
83
- // Path doesn't exist or not executable
84
76
  }
85
77
  }
86
78
  return null;
87
79
  }
88
- /**
89
- * Get B4n1Web binary version
90
- */
91
80
  function getB4n1webVersion() {
92
81
  const binaryPath = getB4n1webBinary();
93
82
  if (!binaryPath) {
@@ -105,70 +94,59 @@ function getB4n1webVersion() {
105
94
  return null;
106
95
  }
107
96
  }
108
- const SDK_VERSION = '0.5.0';
109
- /**
110
- * Check version compatibility and warn if mismatch
111
- */
97
+ const SDK_VERSION = '0.8.0';
112
98
  function checkVersionCompatibility() {
113
99
  const binaryVersion = getB4n1webVersion();
114
100
  if (!binaryVersion) {
115
101
  return null;
116
102
  }
117
103
  if (binaryVersion !== SDK_VERSION) {
118
- console.warn(`⚠️ Version mismatch: SDK v${SDK_VERSION} requires binary v${SDK_VERSION}, ` +
104
+ console.warn(`Warning: Version mismatch: SDK v${SDK_VERSION} requires binary v${SDK_VERSION}, ` +
119
105
  `but found v${binaryVersion}. Some features may not work correctly. ` +
120
106
  `To update: curl -sL https://web.b4n1.com/install | bash`);
121
107
  }
122
108
  return binaryVersion;
123
109
  }
124
- /**
125
- * Page data returned by B4n1Web
126
- */
127
110
  class Page {
111
+ url;
112
+ markdown;
113
+ links;
114
+ screenshot;
115
+ jsOutput;
128
116
  constructor(data) {
129
117
  this.url = data.url;
130
118
  this.markdown = data.markdown;
131
119
  this.links = data.links;
132
120
  this.screenshot = data.screenshot;
121
+ this.jsOutput = data.jsOutput;
133
122
  }
134
- /**
135
- * Extract main content from markdown, skipping headers
136
- */
137
123
  getMainContent() {
138
124
  const lines = this.markdown.split('\n');
139
125
  const contentLines = lines.length > 2 ? lines.slice(2) : lines;
140
126
  return contentLines.join('\n').trim();
141
127
  }
142
- /**
143
- * Find links containing specific text
144
- */
145
128
  findLinksByText(text) {
146
129
  const lowerText = text.toLowerCase();
147
130
  return this.links.filter(link => link.toLowerCase().includes(lowerText));
148
131
  }
149
132
  }
150
133
  exports.Page = Page;
151
- /**
152
- * B4n1Web Agent Browser
153
- *
154
- * A browser instance optimized for AI agent workflows.
155
- * Requires B4n1Web binary to be installed.
156
- *
157
- * @example
158
- * ```typescript
159
- * import { AgentBrowser, BrowserMode } from 'b4n1-web';
160
- *
161
- * const browser = new AgentBrowser({ mode: BrowserMode.LIGHT });
162
- * const page = await browser.goto('https://example.com');
163
- * console.log(page.markdown);
164
- * browser.close();
165
- * ```
166
- */
167
134
  class AgentBrowser {
135
+ mode;
136
+ timeout;
137
+ userAgent;
138
+ binaryPath;
139
+ currentUrl = null;
140
+ sessionId;
141
+ sessionStarted = false;
142
+ viewportWidth = 1280;
143
+ viewportHeight = 720;
144
+ emulatedDevice = null;
168
145
  constructor(options = {}) {
169
146
  this.mode = options.mode ?? types_1.BrowserMode.LIGHT;
170
147
  this.timeout = options.timeout ?? 30;
171
148
  this.userAgent = options.userAgent ?? 'B4n1Web-Agent/1.0';
149
+ this.sessionId = `agent-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
172
150
  const binary = getB4n1webBinary();
173
151
  if (!binary) {
174
152
  const home = process.env.HOME || '';
@@ -183,13 +161,38 @@ class AgentBrowser {
183
161
  }
184
162
  this.binaryPath = binary;
185
163
  }
186
- /**
187
- * Navigate to a URL and extract structured content
188
- */
189
- async goto(url) {
164
+ escapeArg(arg) {
165
+ return JSON.stringify(arg);
166
+ }
167
+ runSessionCommand(subcommand, ...args) {
168
+ try {
169
+ return (0, child_process_1.execSync)(`${this.binaryPath} session ${subcommand} ${this.sessionId} ${args.join(' ')}`, { timeout: this.timeout * 1000 }).toString().trim();
170
+ }
171
+ catch (error) {
172
+ if (error.message?.includes('timed out')) {
173
+ throw new Error(`Session command timed out after ${this.timeout}s`);
174
+ }
175
+ throw new Error(`Session command "${subcommand}" failed: ${error.message}`);
176
+ }
177
+ }
178
+ ensureSession(url) {
179
+ if (!this.sessionStarted) {
180
+ (0, child_process_1.execSync)(`${this.binaryPath} session start ${this.sessionId}`, { timeout: 10000 });
181
+ this.sessionStarted = true;
182
+ }
183
+ if (url) {
184
+ (0, child_process_1.execSync)(`${this.binaryPath} session goto ${this.sessionId} ${this.escapeArg(url)}`, { timeout: this.timeout * 1000 });
185
+ }
186
+ }
187
+ async goto(url, waitFor) {
188
+ this.currentUrl = url;
190
189
  return new Promise((resolve, reject) => {
191
190
  try {
192
- const output = (0, child_process_1.execSync)(`${this.binaryPath} goto ${url} --mode ${this.mode}`, { timeout: this.timeout * 1000 }).toString();
191
+ let cmd = `${this.binaryPath} goto ${url} --mode ${this.mode}`;
192
+ if (waitFor) {
193
+ cmd += ` --wait-for ${JSON.stringify(waitFor)}`;
194
+ }
195
+ const output = (0, child_process_1.execSync)(cmd, { timeout: this.timeout * 1000 }).toString();
193
196
  const page = this.parseOutput(url, output);
194
197
  resolve(page);
195
198
  }
@@ -203,13 +206,11 @@ class AgentBrowser {
203
206
  }
204
207
  });
205
208
  }
206
- /**
207
- * Parse text output from the binary
208
- */
209
209
  parseOutput(url, output) {
210
210
  let markdown = '';
211
211
  let links = [];
212
212
  let screenshot;
213
+ let jsOutput;
213
214
  for (const line of output.split('\n')) {
214
215
  if (line.startsWith('URL:')) {
215
216
  continue;
@@ -219,14 +220,23 @@ class AgentBrowser {
219
220
  }
220
221
  else if (line.startsWith('Links:')) {
221
222
  try {
222
- links = eval(line.slice(6).trim()); // Safe: we control the output format
223
+ links = JSON.parse(line.slice(6).trim());
223
224
  }
224
225
  catch {
225
226
  links = [];
226
227
  }
227
228
  }
228
229
  else if (line.startsWith('Screenshot:')) {
229
- screenshot = line.slice(10).trim() || undefined;
230
+ screenshot = line.slice(11).trim();
231
+ if (screenshot === '') {
232
+ screenshot = undefined;
233
+ }
234
+ }
235
+ else if (line.startsWith('js_output:')) {
236
+ jsOutput = line.slice(10).trim();
237
+ if (jsOutput === '') {
238
+ jsOutput = undefined;
239
+ }
230
240
  }
231
241
  else {
232
242
  markdown += line + '\n';
@@ -237,25 +247,160 @@ class AgentBrowser {
237
247
  markdown: markdown.trim(),
238
248
  links,
239
249
  screenshot,
250
+ jsOutput,
240
251
  });
241
252
  }
242
- /**
243
- * Close the browser session
244
- */
253
+ async click(selector) {
254
+ if (!this.currentUrl) {
255
+ throw new Error('No page loaded. Call goto() first.');
256
+ }
257
+ this.ensureSession(this.currentUrl);
258
+ try {
259
+ (0, child_process_1.execSync)(`${this.binaryPath} session click ${this.sessionId} ${this.escapeArg(selector)}`, { timeout: this.timeout * 1000 });
260
+ }
261
+ catch (error) {
262
+ throw new Error(`Click failed on "${selector}": ${error.message}`);
263
+ }
264
+ }
265
+ async typeText(selector, text, clearFirst = false) {
266
+ if (!this.currentUrl) {
267
+ throw new Error('No page loaded. Call goto() first.');
268
+ }
269
+ this.ensureSession(this.currentUrl);
270
+ try {
271
+ let cmd = `${this.binaryPath} session type ${this.sessionId} ${this.escapeArg(selector)} ${this.escapeArg(text)}`;
272
+ if (clearFirst) {
273
+ cmd += ' --clear-first';
274
+ }
275
+ (0, child_process_1.execSync)(cmd, { timeout: this.timeout * 1000 });
276
+ }
277
+ catch (error) {
278
+ throw new Error(`Type text failed on "${selector}": ${error.message}`);
279
+ }
280
+ }
281
+ async waitForSelector(selector, timeoutMs = 10000) {
282
+ if (!this.currentUrl) {
283
+ throw new Error('No page loaded. Call goto() first.');
284
+ }
285
+ this.ensureSession(this.currentUrl);
286
+ try {
287
+ const output = (0, child_process_1.execSync)(`${this.binaryPath} session wait ${this.sessionId} ${this.escapeArg(selector)} --timeout-ms ${timeoutMs}`, { timeout: Math.ceil(timeoutMs / 1000) + 5 }).toString().trim();
288
+ return output === 'true';
289
+ }
290
+ catch {
291
+ return false;
292
+ }
293
+ }
294
+ async screenshot(url) {
295
+ const targetUrl = url || this.currentUrl;
296
+ if (!targetUrl) {
297
+ throw new Error('No URL provided. Pass a URL or call goto() first.');
298
+ }
299
+ this.ensureSession(targetUrl);
300
+ try {
301
+ const output = (0, child_process_1.execSync)(`${this.binaryPath} session screenshot ${this.sessionId} ${this.escapeArg(targetUrl)}`, { timeout: this.timeout * 1000 }).toString().trim();
302
+ return output;
303
+ }
304
+ catch (error) {
305
+ if (error.message?.includes('timed out')) {
306
+ throw new Error(`Screenshot timed out after ${this.timeout}s`);
307
+ }
308
+ throw new Error(`Screenshot failed: ${error.message}`);
309
+ }
310
+ }
311
+ async frames() {
312
+ if (!this.currentUrl) {
313
+ throw new Error('No page loaded. Call goto() first.');
314
+ }
315
+ this.ensureSession(this.currentUrl);
316
+ try {
317
+ const output = this.runSessionCommand('frames');
318
+ return JSON.parse(output);
319
+ }
320
+ catch (error) {
321
+ throw new Error(`Failed to list frames: ${error.message}`);
322
+ }
323
+ }
324
+ async iframeText(index) {
325
+ if (!this.currentUrl) {
326
+ throw new Error('No page loaded. Call goto() first.');
327
+ }
328
+ this.ensureSession(this.currentUrl);
329
+ try {
330
+ return this.runSessionCommand('iframe-text', String(index));
331
+ }
332
+ catch (error) {
333
+ throw new Error(`Failed to get iframe text at index ${index}: ${error.message}`);
334
+ }
335
+ }
336
+ async setViewport(width, height) {
337
+ this.viewportWidth = width;
338
+ this.viewportHeight = height;
339
+ if (this.sessionStarted && this.currentUrl) {
340
+ try {
341
+ (0, child_process_1.execSync)(`${this.binaryPath} session goto ${this.sessionId} ${this.escapeArg(this.currentUrl)} --viewport-width ${width} --viewport-height ${height}`, { timeout: this.timeout * 1000 });
342
+ }
343
+ catch (error) {
344
+ throw new Error(`setViewport failed: ${error.message}`);
345
+ }
346
+ }
347
+ }
348
+ async emulateDevice(device) {
349
+ this.emulatedDevice = device;
350
+ if (this.sessionStarted && this.currentUrl) {
351
+ try {
352
+ (0, child_process_1.execSync)(`${this.binaryPath} session goto ${this.sessionId} ${this.escapeArg(this.currentUrl)} --emulate ${this.escapeArg(device)}`, { timeout: this.timeout * 1000 });
353
+ }
354
+ catch (error) {
355
+ throw new Error(`emulateDevice failed: ${error.message}`);
356
+ }
357
+ }
358
+ }
359
+ getLinks() {
360
+ if (!this.currentUrl) {
361
+ throw new Error('No page loaded. Call goto() first.');
362
+ }
363
+ try {
364
+ const output = (0, child_process_1.execSync)(`${this.binaryPath} get-links --url ${this.currentUrl} --mode ${this.mode}`, { timeout: this.timeout * 1000 }).toString().trim();
365
+ try {
366
+ return JSON.parse(output);
367
+ }
368
+ catch {
369
+ return [];
370
+ }
371
+ }
372
+ catch {
373
+ return [];
374
+ }
375
+ }
376
+ static async getLinksFromPage(url, mode = types_1.BrowserMode.LIGHT) {
377
+ const browser = new AgentBrowser({ mode });
378
+ try {
379
+ const page = await browser.goto(url);
380
+ return page.links;
381
+ }
382
+ finally {
383
+ browser.close();
384
+ }
385
+ }
386
+ static findBinary() {
387
+ return getB4n1webBinary();
388
+ }
245
389
  close() {
246
- // No persistent session to close in current implementation
390
+ if (this.sessionStarted) {
391
+ try {
392
+ (0, child_process_1.execSync)(`${this.binaryPath} session close ${this.sessionId}`, { timeout: 5000 });
393
+ }
394
+ catch {
395
+ }
396
+ this.sessionStarted = false;
397
+ }
247
398
  }
248
- /**
249
- * Use as async context manager
250
- */
251
399
  async [Symbol.asyncDispose]() {
252
400
  this.close();
253
401
  }
254
402
  }
255
403
  exports.AgentBrowser = AgentBrowser;
256
- /**
257
- * Create a browser and navigate in one go
258
- */
259
404
  async function createBrowserAndGoto(url, options = {}) {
260
405
  const browser = new AgentBrowser(options);
261
406
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;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**
2
- * B4n1Web Errors
3
- */
4
- /**
5
- * Error thrown when B4n1Web binary is not found
6
- */
7
1
  export declare class BinaryNotFoundError extends Error {
8
2
  constructor(message?: string);
9
3
  }
10
- /**
11
- * Error thrown when navigation fails
12
- */
13
4
  export declare class NavigationError extends Error {
14
5
  readonly url: string;
15
6
  constructor(message: string, url: string);
16
7
  }
17
- /**
18
- * Error thrown when binary execution fails
19
- */
20
8
  export declare class BinaryError extends Error {
21
9
  readonly stderr: string;
22
10
  constructor(message: string, stderr: string);
23
11
  }
12
+ export declare class SelectorTimeoutError extends Error {
13
+ constructor(selector: string, timeoutMs: number);
14
+ }
24
15
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,SAAuG;CAK3H;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;aACK,GAAG,EAAE,MAAM;gBAA5C,OAAO,EAAE,MAAM,EAAkB,GAAG,EAAE,MAAM;CAKzD;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;aACS,MAAM,EAAE,MAAM;gBAA/C,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM;CAK5D"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,SAAuG;CAK3H;AAED,qBAAa,eAAgB,SAAQ,KAAK;aACK,GAAG,EAAE,MAAM;gBAA5C,OAAO,EAAE,MAAM,EAAkB,GAAG,EAAE,MAAM;CAKzD;AAED,qBAAa,WAAY,SAAQ,KAAK;aACS,MAAM,EAAE,MAAM;gBAA/C,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM;CAK5D;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAKhD"}
package/dist/errors.js CHANGED
@@ -1,12 +1,6 @@
1
1
  "use strict";
2
- /**
3
- * B4n1Web Errors
4
- */
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BinaryError = exports.NavigationError = exports.BinaryNotFoundError = void 0;
7
- /**
8
- * Error thrown when B4n1Web binary is not found
9
- */
3
+ exports.SelectorTimeoutError = exports.BinaryError = exports.NavigationError = exports.BinaryNotFoundError = void 0;
10
4
  class BinaryNotFoundError extends Error {
11
5
  constructor(message = 'B4n1Web binary not found. Please install it first:\n curl -sL https://web.b4n1.com/install | bash') {
12
6
  super(message);
@@ -15,10 +9,8 @@ class BinaryNotFoundError extends Error {
15
9
  }
16
10
  }
17
11
  exports.BinaryNotFoundError = BinaryNotFoundError;
18
- /**
19
- * Error thrown when navigation fails
20
- */
21
12
  class NavigationError extends Error {
13
+ url;
22
14
  constructor(message, url) {
23
15
  super(message);
24
16
  this.url = url;
@@ -27,10 +19,8 @@ class NavigationError extends Error {
27
19
  }
28
20
  }
29
21
  exports.NavigationError = NavigationError;
30
- /**
31
- * Error thrown when binary execution fails
32
- */
33
22
  class BinaryError extends Error {
23
+ stderr;
34
24
  constructor(message, stderr) {
35
25
  super(message);
36
26
  this.stderr = stderr;
@@ -39,4 +29,12 @@ class BinaryError extends Error {
39
29
  }
40
30
  }
41
31
  exports.BinaryError = BinaryError;
32
+ class SelectorTimeoutError extends Error {
33
+ constructor(selector, timeoutMs) {
34
+ super(`Selector "${selector}" not found within ${timeoutMs}ms`);
35
+ this.name = 'SelectorTimeoutError';
36
+ Error.captureStackTrace(this, SelectorTimeoutError);
37
+ }
38
+ }
39
+ exports.SelectorTimeoutError = SelectorTimeoutError;
42
40
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;GAEG;;;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B,QAAG,GAAH,GAAG,CAAQ;QAEtD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC;CACF;AAND,0CAMC;AAED,MAAa,WAAY,SAAQ,KAAK;IACS;IAA7C,YAAY,OAAe,EAAkB,MAAc;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,WAAM,GAAN,MAAM,CAAQ;QAEzD,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;CACF;AAND,kCAMC;AAED,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,QAAgB,EAAE,SAAiB;QAC7C,KAAK,CAAC,aAAa,QAAQ,sBAAsB,SAAS,IAAI,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACtD,CAAC;CACF;AAND,oDAMC"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,5 @@
1
- /**
2
- * B4n1Web SDK for JavaScript/TypeScript
3
- * Zero-overhead, high-speed web execution for sovereign AI agents.
4
- *
5
- * @module b4n1web
6
- */
7
- export { AgentBrowser, Page, getB4n1webBinary, getB4n1webVersion, checkVersionCompatibility } from './browser';
1
+ export { AgentBrowser, Page, getB4n1webBinary, getB4n1webVersion, checkVersionCompatibility, createBrowserAndGoto } from './browser';
8
2
  export { BrowserMode } from './types';
9
- export { BinaryNotFoundError } from './errors';
3
+ export { BinaryNotFoundError, NavigationError, BinaryError, SelectorTimeoutError } from './errors';
4
+ export { SecurityShield } from './security';
10
5
  //# sourceMappingURL=index.d.ts.map
@@ -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,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrI,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
- /**
3
- * B4n1Web SDK for JavaScript/TypeScript
4
- * Zero-overhead, high-speed web execution for sovereign AI agents.
5
- *
6
- * @module b4n1web
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.BinaryNotFoundError = exports.BrowserMode = exports.checkVersionCompatibility = exports.getB4n1webVersion = exports.getB4n1webBinary = exports.Page = exports.AgentBrowser = void 0;
3
+ exports.SecurityShield = exports.SelectorTimeoutError = exports.BinaryError = exports.NavigationError = exports.BinaryNotFoundError = exports.BrowserMode = exports.createBrowserAndGoto = exports.checkVersionCompatibility = exports.getB4n1webVersion = exports.getB4n1webBinary = exports.Page = exports.AgentBrowser = void 0;
10
4
  var browser_1 = require("./browser");
11
5
  Object.defineProperty(exports, "AgentBrowser", { enumerable: true, get: function () { return browser_1.AgentBrowser; } });
12
6
  Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return browser_1.Page; } });
13
7
  Object.defineProperty(exports, "getB4n1webBinary", { enumerable: true, get: function () { return browser_1.getB4n1webBinary; } });
14
8
  Object.defineProperty(exports, "getB4n1webVersion", { enumerable: true, get: function () { return browser_1.getB4n1webVersion; } });
15
9
  Object.defineProperty(exports, "checkVersionCompatibility", { enumerable: true, get: function () { return browser_1.checkVersionCompatibility; } });
10
+ Object.defineProperty(exports, "createBrowserAndGoto", { enumerable: true, get: function () { return browser_1.createBrowserAndGoto; } });
16
11
  var types_1 = require("./types");
17
12
  Object.defineProperty(exports, "BrowserMode", { enumerable: true, get: function () { return types_1.BrowserMode; } });
18
13
  var errors_1 = require("./errors");
19
14
  Object.defineProperty(exports, "BinaryNotFoundError", { enumerable: true, get: function () { return errors_1.BinaryNotFoundError; } });
15
+ Object.defineProperty(exports, "NavigationError", { enumerable: true, get: function () { return errors_1.NavigationError; } });
16
+ Object.defineProperty(exports, "BinaryError", { enumerable: true, get: function () { return errors_1.BinaryError; } });
17
+ Object.defineProperty(exports, "SelectorTimeoutError", { enumerable: true, get: function () { return errors_1.SelectorTimeoutError; } });
18
+ var security_1 = require("./security");
19
+ Object.defineProperty(exports, "SecurityShield", { enumerable: true, get: function () { return security_1.SecurityShield; } });
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+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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAqI;AAA5H,uGAAA,YAAY,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,4GAAA,iBAAiB,OAAA;AAAE,oHAAA,yBAAyB,OAAA;AAAE,+GAAA,oBAAoB,OAAA;AACjH,iCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,mCAAmG;AAA1F,6GAAA,mBAAmB,OAAA;AAAE,yGAAA,eAAe,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,8GAAA,oBAAoB,OAAA;AAChF,uCAA4C;AAAnC,0GAAA,cAAc,OAAA"}
@@ -1,65 +1,65 @@
1
1
  /**
2
- * B4n1Web SecurityShield - URL Security Validation
2
+ * B4n1Web SecurityShield URL security validation with in-memory cache.
3
3
  *
4
- * Provides URL security validation with caching.
5
- * Fall-safe: returns safe=true if any error occurs.
6
- */
7
- import type { SecurityShieldOptions, SecurityCheckResult } from './types';
8
- /**
9
- * SecurityShield - Domain safety validation with caching
4
+ * SecurityShield provides URL safety checking for agentic browser navigation.
10
5
  *
11
- * @example
12
- * ```typescript
13
- * import { SecurityShield, navigate } from 'b4n1-web';
14
- *
15
- * // Simple usage
16
- * const result = await navigate('https://example.com');
17
- *
18
- * // With custom shield
19
- * const shield = new SecurityShield({ cacheDays: 30 });
20
- * const { isSafe, needsApiCheck } = shield.isUrlSafe('https://example.com');
21
- * ```
6
+ * API:
7
+ * new SecurityShield({ dbPath?, cacheDays? })
8
+ * shield.isUrlSafe(url) → { isSafe: boolean, needsApiCheck: boolean }
9
+ * shield.markDomain(domain, isSafe)
10
+ * shield.clearCache()
22
11
  */
12
+ import type { SecurityShieldOptions, SecurityCheckResult } from './types';
23
13
  export declare class SecurityShield {
24
- private dbPath;
25
14
  private cacheDays;
26
15
  private cache;
27
- constructor(options?: SecurityShieldOptions);
28
16
  /**
29
- * Extract domain from URL
17
+ * Create a SecurityShield instance.
18
+ * @param opts - Optional configuration
19
+ * @param opts.cacheDays - TTL of a cached result in days (default 7)
30
20
  */
31
- private extractDomain;
21
+ constructor(opts?: SecurityShieldOptions);
32
22
  /**
33
- * Check if URL is safe to navigate
23
+ * Check whether a URL is safe to navigate.
24
+ *
25
+ * @param rawURL - The URL to check.
26
+ * @returns `{ isSafe, needsApiCheck }`
27
+ * isSafe — `true` if the domain is not blacklisted.
28
+ * needsApiCheck — `false` when the result was previously cached.
29
+ *
30
+ * @example
31
+ * const { isSafe, needsApiCheck } = shield.isUrlSafe('https://unknown.com');
32
+ * // → isSafe=true, needsApiCheck=true (unknown domain, needs screening)
33
+ *
34
+ * shield.markDomain('evil.com', false);
35
+ * shield.isUrlSafe('https://evil.com');
36
+ * // → isSafe=false, needsApiCheck=false (explicitly blacklisted)
34
37
  */
35
- isUrlSafe(url: string): SecurityCheckResult;
38
+ isUrlSafe(rawURL: string): SecurityCheckResult;
36
39
  /**
37
- * Mark a domain as safe or unsafe
40
+ * Explicitly mark a domain as safe (whitelist) or unsafe (blacklist).
41
+ * Overwrites any previous entry and resets the TTL timer.
42
+ *
43
+ * @param domain - The domain to mark, e.g. `"example.com"`
44
+ * @param isSafe - `true` to whitelist, `false` to blacklist
45
+ *
46
+ * @example
47
+ * shield.markDomain('trusted.com', true); // always allow
48
+ * shield.markDomain('malware.com', false); // always block
38
49
  */
39
50
  markDomain(domain: string, isSafe: boolean): void;
40
51
  /**
41
- * Clear all cached domains
52
+ * Remove all cached domain entries.
53
+ * After clearing, every next `isUrlSafe()` call for a previously-known domain
54
+ * will return `needsApiCheck=true` again.
42
55
  */
43
56
  clearCache(): void;
57
+ /**
58
+ * Extract the hostname from a URL string.
59
+ * Returns `''` for invalid / missing URLs.
60
+ * @internal — exposed for testing as `extractDomain`.
61
+ */
62
+ extractDomain(rawURL: string): string | null;
63
+ private _extractHost;
44
64
  }
45
- /**
46
- * Navigate to URL with optional security check
47
- *
48
- * @example
49
- * ```typescript
50
- * import { navigate } from 'b4n1-web';
51
- *
52
- * const result = await navigate('https://example.com');
53
- * if (result.success) {
54
- * console.log(result.markdown);
55
- * }
56
- * ```
57
- */
58
- export declare function navigate(url: string, ignoreSecurity?: boolean, securityShield?: SecurityShield): Promise<{
59
- url: string;
60
- success: boolean;
61
- markdown?: string;
62
- links?: string[];
63
- error?: string;
64
- }>;
65
65
  //# sourceMappingURL=security.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAoD;gBAErD,OAAO,GAAE,qBAA0B;IAM/C;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB;IAkB3C;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAMjD;;OAEG;IACH,UAAU,IAAI,IAAI;CAGnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,cAAc,GAAE,OAAe,EAC/B,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAkCD"}
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQ1E,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAA0B;IAEvC;;;;OAIG;gBACS,IAAI,GAAE,qBAA0B;IAK5C;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;IAsB9C;;;;;;;;;;OAUG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAMjD;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAMlB;;;;OAIG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAsD5C,OAAO,CAAC,YAAY;CAIrB"}
package/dist/security.js CHANGED
@@ -1,126 +1,160 @@
1
1
  "use strict";
2
2
  /**
3
- * B4n1Web SecurityShield - URL Security Validation
3
+ * B4n1Web SecurityShield URL security validation with in-memory cache.
4
4
  *
5
- * Provides URL security validation with caching.
6
- * Fall-safe: returns safe=true if any error occurs.
5
+ * SecurityShield provides URL safety checking for agentic browser navigation.
6
+ *
7
+ * API:
8
+ * new SecurityShield({ dbPath?, cacheDays? })
9
+ * shield.isUrlSafe(url) → { isSafe: boolean, needsApiCheck: boolean }
10
+ * shield.markDomain(domain, isSafe)
11
+ * shield.clearCache()
7
12
  */
8
13
  Object.defineProperty(exports, "__esModule", { value: true });
9
14
  exports.SecurityShield = void 0;
10
- exports.navigate = navigate;
11
- const browser_1 = require("./browser");
12
- const types_1 = require("./types");
13
- /**
14
- * SecurityShield - Domain safety validation with caching
15
- *
16
- * @example
17
- * ```typescript
18
- * import { SecurityShield, navigate } from 'b4n1-web';
19
- *
20
- * // Simple usage
21
- * const result = await navigate('https://example.com');
22
- *
23
- * // With custom shield
24
- * const shield = new SecurityShield({ cacheDays: 30 });
25
- * const { isSafe, needsApiCheck } = shield.isUrlSafe('https://example.com');
26
- * ```
27
- */
15
+ /** Default cache TTL in days */
16
+ const DEFAULT_CACHE_DAYS = 7;
28
17
  class SecurityShield {
29
- constructor(options = {}) {
30
- this.dbPath = options.dbPath ?? `${process.env.HOME}/.b4n1web/security.db`;
31
- this.cacheDays = options.cacheDays ?? 7;
32
- this.cache = new Map();
33
- }
18
+ cacheDays;
19
+ cache;
34
20
  /**
35
- * Extract domain from URL
21
+ * Create a SecurityShield instance.
22
+ * @param opts - Optional configuration
23
+ * @param opts.cacheDays - TTL of a cached result in days (default 7)
36
24
  */
37
- extractDomain(url) {
38
- try {
39
- const parsed = new URL(url);
40
- return parsed.hostname.toLowerCase();
41
- }
42
- catch {
43
- return null;
44
- }
25
+ constructor(opts = {}) {
26
+ this.cacheDays = opts.cacheDays ?? DEFAULT_CACHE_DAYS;
27
+ this.cache = new Map();
45
28
  }
46
29
  /**
47
- * Check if URL is safe to navigate
30
+ * Check whether a URL is safe to navigate.
31
+ *
32
+ * @param rawURL - The URL to check.
33
+ * @returns `{ isSafe, needsApiCheck }`
34
+ * isSafe — `true` if the domain is not blacklisted.
35
+ * needsApiCheck — `false` when the result was previously cached.
36
+ *
37
+ * @example
38
+ * const { isSafe, needsApiCheck } = shield.isUrlSafe('https://unknown.com');
39
+ * // → isSafe=true, needsApiCheck=true (unknown domain, needs screening)
40
+ *
41
+ * shield.markDomain('evil.com', false);
42
+ * shield.isUrlSafe('https://evil.com');
43
+ * // → isSafe=false, needsApiCheck=false (explicitly blacklisted)
48
44
  */
49
- isUrlSafe(url) {
50
- const domain = this.extractDomain(url);
51
- if (!domain) {
45
+ isUrlSafe(rawURL) {
46
+ const host = this._extractHost(rawURL);
47
+ if (!host) {
48
+ // Invalid URL — safe default, no API check needed
52
49
  return { isSafe: true, needsApiCheck: false };
53
50
  }
54
- const cached = this.cache.get(domain);
55
- if (cached) {
56
- if (Date.now() > cached.expires) {
57
- this.cache.delete(domain);
58
- return { isSafe: true, needsApiCheck: true };
51
+ const now = Date.now();
52
+ const entry = this.cache.get(host);
53
+ if (entry) {
54
+ if (now < entry.expires) {
55
+ // Cached and fresh does not need an external API call
56
+ return { isSafe: entry.isSafe, needsApiCheck: false };
59
57
  }
60
- return { isSafe: cached.isSafe, needsApiCheck: false };
58
+ // Expired re-check
59
+ this.cache.delete(host);
61
60
  }
61
+ // New domain — safe but needs external API verification
62
62
  return { isSafe: true, needsApiCheck: true };
63
63
  }
64
64
  /**
65
- * Mark a domain as safe or unsafe
65
+ * Explicitly mark a domain as safe (whitelist) or unsafe (blacklist).
66
+ * Overwrites any previous entry and resets the TTL timer.
67
+ *
68
+ * @param domain - The domain to mark, e.g. `"example.com"`
69
+ * @param isSafe - `true` to whitelist, `false` to blacklist
70
+ *
71
+ * @example
72
+ * shield.markDomain('trusted.com', true); // always allow
73
+ * shield.markDomain('malware.com', false); // always block
66
74
  */
67
75
  markDomain(domain, isSafe) {
68
- const normalizedDomain = domain.toLowerCase();
69
- const expires = Date.now() + this.cacheDays * 24 * 60 * 60 * 1000;
70
- this.cache.set(normalizedDomain, { isSafe, expires });
76
+ const normalized = domain.toLowerCase().trim();
77
+ const expires = Date.now() + this.cacheDays * 86400_000; // days ms
78
+ this.cache.set(normalized, { isSafe, expires });
71
79
  }
72
80
  /**
73
- * Clear all cached domains
81
+ * Remove all cached domain entries.
82
+ * After clearing, every next `isUrlSafe()` call for a previously-known domain
83
+ * will return `needsApiCheck=true` again.
74
84
  */
75
85
  clearCache() {
76
86
  this.cache.clear();
77
87
  }
78
- }
79
- exports.SecurityShield = SecurityShield;
80
- /**
81
- * Navigate to URL with optional security check
82
- *
83
- * @example
84
- * ```typescript
85
- * import { navigate } from 'b4n1-web';
86
- *
87
- * const result = await navigate('https://example.com');
88
- * if (result.success) {
89
- * console.log(result.markdown);
90
- * }
91
- * ```
92
- */
93
- async function navigate(url, ignoreSecurity = false, securityShield) {
94
- if (!securityShield) {
95
- securityShield = new SecurityShield();
96
- }
97
- if (!ignoreSecurity) {
98
- const { isSafe } = securityShield.isUrlSafe(url);
99
- if (!isSafe) {
100
- return {
101
- url,
102
- success: false,
103
- error: 'URL flagged as unsafe by security check',
104
- };
88
+ // ── helpers ────────────────────────────────────────────────
89
+ /**
90
+ * Extract the hostname from a URL string.
91
+ * Returns `''` for invalid / missing URLs.
92
+ * @internal — exposed for testing as `extractDomain`.
93
+ */
94
+ extractDomain(rawURL) {
95
+ try {
96
+ const url = rawURL?.trim();
97
+ if (!url)
98
+ return null;
99
+ let rest;
100
+ // Check for scheme (handles both :// and : schemes like data:, javascript:)
101
+ const schemeIndex = url.indexOf(':');
102
+ if (schemeIndex === -1) {
103
+ // no scheme
104
+ return null;
105
+ }
106
+ const scheme = url.slice(0, schemeIndex);
107
+ rest = url.slice(schemeIndex + 1);
108
+ // Handle special cases for schemes
109
+ if (scheme === 'data' || scheme === 'javascript') {
110
+ return '';
111
+ }
112
+ // Handle // authority format (like //example.com/path)
113
+ if (rest.startsWith('//')) {
114
+ rest = rest.slice(2);
115
+ }
116
+ // For other schemes like http:, https:, ftp:, etc., we already removed the scheme above
117
+ // Strip userinfo "user:pass@"
118
+ const atIdx = rest.lastIndexOf('@');
119
+ const afterAuth = atIdx >= 0 ? rest.slice(atIdx + 1) : rest;
120
+ // Strip path/query/fragment
121
+ const [rawHost, ..._] = afterAuth.split(/[\/?#]/, 1);
122
+ if (!rawHost)
123
+ return null;
124
+ let host = rawHost.trim();
125
+ if (!host)
126
+ return null;
127
+ // IPv6 in brackets: [::1]:8080 → ::
128
+ if (host.startsWith('[')) {
129
+ const bracketEnd = host.indexOf(']');
130
+ if (bracketEnd === -1)
131
+ return null;
132
+ host = host.slice(1, bracketEnd); // Extract content between brackets
133
+ return host.toLowerCase(); // ::1 is final, no port to strip
134
+ }
135
+ // Strip port after last ':' — works for 'example.com:8080'
136
+ const colonIdx = host.lastIndexOf(':');
137
+ if (colonIdx > 0) {
138
+ host = host.slice(0, colonIdx);
139
+ }
140
+ // Accept localhost / single-label hosts too
141
+ return host.toLowerCase() || null;
142
+ }
143
+ catch {
144
+ return null;
105
145
  }
106
146
  }
107
- try {
108
- const browser = new browser_1.AgentBrowser({ mode: types_1.BrowserMode.LIGHT });
109
- const page = await browser.goto(url);
110
- browser.close();
111
- return {
112
- url: page.url,
113
- success: true,
114
- markdown: page.markdown,
115
- links: page.links,
116
- };
117
- }
118
- catch (error) {
119
- return {
120
- url,
121
- success: false,
122
- error: error.message,
123
- };
147
+ _extractHost(rawURL) {
148
+ const r = this.extractDomain(rawURL);
149
+ return r ?? '';
124
150
  }
125
151
  }
152
+ exports.SecurityShield = SecurityShield;
153
+ function _stripPort(host) {
154
+ const at = host.indexOf('@');
155
+ const colon = host.indexOf(':', at >= 0 ? at + 1 : 0);
156
+ if (colon >= 0)
157
+ return host.slice(0, colon);
158
+ return host;
159
+ }
126
160
  //# sourceMappingURL=security.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"security.js","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA+FH,4BA4CC;AAzID,uCAAoD;AACpD,mCAAsC;AAGtC;;;;;;;;;;;;;;GAcG;AACH,MAAa,cAAc;IAKzB,YAAY,UAAiC,EAAE;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC;QAC3E,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,GAAW;QAC/B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,GAAW;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC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ACd,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * B4n1Web TypeScript Types
3
- */
4
1
  export declare enum BrowserMode {
5
2
  LIGHT = "light",
6
3
  JS = "js",
@@ -16,6 +13,7 @@ export interface PageData {
16
13
  markdown: string;
17
14
  links: string[];
18
15
  screenshot?: string;
16
+ jsOutput?: string;
19
17
  }
20
18
  export interface NavigateResult {
21
19
  url: string;
@@ -32,6 +30,11 @@ export interface SecurityCheckResult {
32
30
  isSafe: boolean;
33
31
  needsApiCheck: boolean;
34
32
  }
33
+ export interface IframeInfo {
34
+ index: number;
35
+ src?: string;
36
+ title?: string;
37
+ }
35
38
  export declare class BinaryNotFoundError extends Error {
36
39
  constructor(message?: string);
37
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,EAAE,OAAO;IACT,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE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SAAuG;CAI3H"}
package/dist/types.js CHANGED
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * B4n1Web TypeScript Types
4
- */
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.BinaryNotFoundError = exports.BrowserMode = void 0;
7
4
  var BrowserMode;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,wBAAS,CAAA;IACT,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAiCD,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,oGAAoG;QACxH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,wBAAS,CAAA;IACT,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAwCD,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,oGAAoG;QACxH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b4n1-web",
3
- "version": "0.6.2",
3
+ "version": "0.9.0",
4
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",
@@ -39,7 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@types/node": "^20.0.0",
41
41
  "typescript": "^5.0.0",
42
- "vitest": "^1.0.0"
42
+ "vitest": "^4.1.7"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=18.0.0"