b4n1-web 0.7.0 → 0.9.3
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 +0 -0
- package/bin/b4n1web-linux +0 -0
- package/dist/binary.d.ts +4 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +108 -0
- package/dist/binary.js.map +1 -0
- package/dist/browser.d.ts +20 -22
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +124 -174
- package/dist/browser.js.map +1 -1
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/page.d.ts +12 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +28 -0
- package/dist/page.js.map +1 -0
- package/dist/security.d.ts +46 -46
- package/dist/security.d.ts.map +1 -1
- package/dist/security.js +128 -94
- package/dist/security.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
package/dist/browser.js
CHANGED
|
@@ -33,105 +33,38 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.AgentBrowser = exports.Page = void 0;
|
|
37
|
-
exports.getB4n1webBinary = getB4n1webBinary;
|
|
38
|
-
exports.getB4n1webVersion = getB4n1webVersion;
|
|
39
|
-
exports.checkVersionCompatibility = checkVersionCompatibility;
|
|
36
|
+
exports.AgentBrowser = exports.Page = exports.checkVersionCompatibility = exports.getB4n1webVersion = exports.getB4n1webBinary = void 0;
|
|
40
37
|
exports.createBrowserAndGoto = createBrowserAndGoto;
|
|
38
|
+
const os = __importStar(require("os"));
|
|
41
39
|
const child_process_1 = require("child_process");
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const path = __importStar(require("path"));
|
|
44
40
|
const types_1 = require("./types");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
paths.push('/usr/local/bin/b4n1web', '/usr/bin/b4n1web', home + '/.local/bin/b4n1web', home + '/.b4n1web/bin/b4n1web');
|
|
58
|
-
const pathEnv = process.env.PATH || '';
|
|
59
|
-
const pathDirs = pathEnv.split(':').filter(p => p);
|
|
60
|
-
for (const dir of pathDirs) {
|
|
61
|
-
paths.push(dir + '/b4n1web');
|
|
62
|
-
}
|
|
63
|
-
for (const filePath of paths) {
|
|
64
|
-
try {
|
|
65
|
-
if (fs.existsSync(filePath)) {
|
|
66
|
-
const stats = fs.statSync(filePath);
|
|
67
|
-
if (stats.isFile() && (stats.mode & 0o111) !== 0) {
|
|
68
|
-
return filePath;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
function getB4n1webVersion() {
|
|
78
|
-
const binaryPath = getB4n1webBinary();
|
|
79
|
-
if (!binaryPath) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
try {
|
|
83
|
-
const version = (0, child_process_1.execSync)(`${binaryPath} --version`, { timeout: 5000 }).toString().trim();
|
|
84
|
-
const parts = version.split(' ');
|
|
85
|
-
if (parts.length >= 2 && parts[0] === 'b4n1web') {
|
|
86
|
-
return parts[1];
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const SDK_VERSION = '0.5.0';
|
|
95
|
-
function checkVersionCompatibility() {
|
|
96
|
-
const binaryVersion = getB4n1webVersion();
|
|
97
|
-
if (!binaryVersion) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
if (binaryVersion !== SDK_VERSION) {
|
|
101
|
-
console.warn(`Warning: Version mismatch: SDK v${SDK_VERSION} requires binary v${SDK_VERSION}, ` +
|
|
102
|
-
`but found v${binaryVersion}. Some features may not work correctly. ` +
|
|
103
|
-
`To update: curl -sL https://web.b4n1.com/install | bash`);
|
|
104
|
-
}
|
|
105
|
-
return binaryVersion;
|
|
106
|
-
}
|
|
107
|
-
class Page {
|
|
108
|
-
constructor(data) {
|
|
109
|
-
this.url = data.url;
|
|
110
|
-
this.markdown = data.markdown;
|
|
111
|
-
this.links = data.links;
|
|
112
|
-
this.screenshot = data.screenshot;
|
|
113
|
-
this.jsOutput = data.jsOutput;
|
|
114
|
-
}
|
|
115
|
-
getMainContent() {
|
|
116
|
-
const lines = this.markdown.split('\n');
|
|
117
|
-
const contentLines = lines.length > 2 ? lines.slice(2) : lines;
|
|
118
|
-
return contentLines.join('\n').trim();
|
|
119
|
-
}
|
|
120
|
-
findLinksByText(text) {
|
|
121
|
-
const lowerText = text.toLowerCase();
|
|
122
|
-
return this.links.filter(link => link.toLowerCase().includes(lowerText));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.Page = Page;
|
|
41
|
+
const page_1 = require("./page");
|
|
42
|
+
const binary_1 = require("./binary");
|
|
43
|
+
var binary_2 = require("./binary");
|
|
44
|
+
Object.defineProperty(exports, "getB4n1webBinary", { enumerable: true, get: function () { return binary_2.getB4n1webBinary; } });
|
|
45
|
+
Object.defineProperty(exports, "getB4n1webVersion", { enumerable: true, get: function () { return binary_2.getB4n1webVersion; } });
|
|
46
|
+
Object.defineProperty(exports, "checkVersionCompatibility", { enumerable: true, get: function () { return binary_2.checkVersionCompatibility; } });
|
|
47
|
+
var page_2 = require("./page");
|
|
48
|
+
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return page_2.Page; } });
|
|
126
49
|
class AgentBrowser {
|
|
50
|
+
mode;
|
|
51
|
+
timeout;
|
|
52
|
+
userAgent;
|
|
53
|
+
binaryPath;
|
|
54
|
+
currentUrl = null;
|
|
55
|
+
sessionId;
|
|
56
|
+
sessionStarted = false;
|
|
57
|
+
viewportWidth = 1280;
|
|
58
|
+
viewportHeight = 720;
|
|
59
|
+
emulatedDevice = null;
|
|
127
60
|
constructor(options = {}) {
|
|
128
|
-
this.currentUrl = null;
|
|
129
61
|
this.mode = options.mode ?? types_1.BrowserMode.LIGHT;
|
|
130
62
|
this.timeout = options.timeout ?? 30;
|
|
131
63
|
this.userAgent = options.userAgent ?? 'B4n1Web-Agent/1.0';
|
|
132
|
-
|
|
64
|
+
this.sessionId = `agent-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
65
|
+
const binary = (0, binary_1.getB4n1webBinary)();
|
|
133
66
|
if (!binary) {
|
|
134
|
-
const home =
|
|
67
|
+
const home = os.homedir();
|
|
135
68
|
const pathDirs = (process.env.PATH || '').split(':').filter(p => p);
|
|
136
69
|
throw new types_1.BinaryNotFoundError(`b4n1web binary not found.\nChecked paths:\n` +
|
|
137
70
|
`- /usr/local/bin/b4n1web\n` +
|
|
@@ -143,6 +76,29 @@ class AgentBrowser {
|
|
|
143
76
|
}
|
|
144
77
|
this.binaryPath = binary;
|
|
145
78
|
}
|
|
79
|
+
escapeArg(arg) {
|
|
80
|
+
return JSON.stringify(arg);
|
|
81
|
+
}
|
|
82
|
+
runSessionCommand(subcommand, ...args) {
|
|
83
|
+
try {
|
|
84
|
+
return (0, child_process_1.execSync)(`${this.binaryPath} session ${subcommand} ${this.sessionId} ${args.join(' ')}`, { timeout: this.timeout * 1000 }).toString().trim();
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (error.message?.includes('timed out')) {
|
|
88
|
+
throw new Error(`Session command timed out after ${this.timeout}s`);
|
|
89
|
+
}
|
|
90
|
+
throw new Error(`Session command "${subcommand}" failed: ${error.message}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
ensureSession(url) {
|
|
94
|
+
if (!this.sessionStarted) {
|
|
95
|
+
(0, child_process_1.execSync)(`${this.binaryPath} session start ${this.sessionId}`, { timeout: 10000 });
|
|
96
|
+
this.sessionStarted = true;
|
|
97
|
+
}
|
|
98
|
+
if (url) {
|
|
99
|
+
(0, child_process_1.execSync)(`${this.binaryPath} session goto ${this.sessionId} ${this.escapeArg(url)}`, { timeout: this.timeout * 1000 });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
146
102
|
async goto(url, waitFor) {
|
|
147
103
|
this.currentUrl = url;
|
|
148
104
|
return new Promise((resolve, reject) => {
|
|
@@ -170,126 +126,120 @@ class AgentBrowser {
|
|
|
170
126
|
let links = [];
|
|
171
127
|
let screenshot;
|
|
172
128
|
let jsOutput;
|
|
129
|
+
let inMarkdown = false;
|
|
130
|
+
let inJsOutput = false;
|
|
131
|
+
let hasStructuredData = false;
|
|
173
132
|
for (const line of output.split('\n')) {
|
|
174
133
|
if (line.startsWith('URL:')) {
|
|
175
|
-
|
|
134
|
+
hasStructuredData = true;
|
|
135
|
+
inMarkdown = false;
|
|
136
|
+
inJsOutput = false;
|
|
176
137
|
}
|
|
177
138
|
else if (line.startsWith('Markdown:')) {
|
|
178
|
-
|
|
139
|
+
hasStructuredData = true;
|
|
140
|
+
inMarkdown = true;
|
|
141
|
+
inJsOutput = false;
|
|
142
|
+
const content = line.substring(9).trim();
|
|
143
|
+
if (content)
|
|
144
|
+
markdown += content + '\n';
|
|
179
145
|
}
|
|
180
146
|
else if (line.startsWith('Links:')) {
|
|
147
|
+
hasStructuredData = true;
|
|
148
|
+
inMarkdown = false;
|
|
149
|
+
inJsOutput = false;
|
|
181
150
|
try {
|
|
182
|
-
links = JSON.parse(line.
|
|
151
|
+
links = JSON.parse(line.substring(6).trim());
|
|
183
152
|
}
|
|
184
153
|
catch {
|
|
185
154
|
links = [];
|
|
186
155
|
}
|
|
187
156
|
}
|
|
188
157
|
else if (line.startsWith('Screenshot:')) {
|
|
189
|
-
|
|
158
|
+
hasStructuredData = true;
|
|
159
|
+
inMarkdown = false;
|
|
160
|
+
inJsOutput = false;
|
|
161
|
+
const s = line.substring(11).trim();
|
|
162
|
+
if (s)
|
|
163
|
+
screenshot = s;
|
|
190
164
|
}
|
|
191
|
-
else if (line.startsWith('
|
|
192
|
-
|
|
165
|
+
else if (line.startsWith('JS Output:')) {
|
|
166
|
+
hasStructuredData = true;
|
|
167
|
+
inMarkdown = false;
|
|
168
|
+
inJsOutput = true;
|
|
169
|
+
const content = line.substring(10).trim();
|
|
170
|
+
if (content)
|
|
171
|
+
jsOutput = (jsOutput || '') + content + '\n';
|
|
193
172
|
}
|
|
194
173
|
else {
|
|
195
|
-
|
|
174
|
+
if (inMarkdown) {
|
|
175
|
+
markdown += line + '\n';
|
|
176
|
+
}
|
|
177
|
+
else if (inJsOutput) {
|
|
178
|
+
jsOutput = (jsOutput || '') + line + '\n';
|
|
179
|
+
}
|
|
196
180
|
}
|
|
197
181
|
}
|
|
198
|
-
|
|
182
|
+
if (!hasStructuredData && output.trim()) {
|
|
183
|
+
markdown = output.trim();
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
markdown = markdown.trim();
|
|
187
|
+
if (jsOutput)
|
|
188
|
+
jsOutput = jsOutput.trim();
|
|
189
|
+
}
|
|
190
|
+
return new page_1.Page({
|
|
199
191
|
url,
|
|
200
|
-
markdown
|
|
192
|
+
markdown,
|
|
201
193
|
links,
|
|
202
194
|
screenshot,
|
|
203
195
|
jsOutput,
|
|
204
196
|
});
|
|
205
197
|
}
|
|
206
|
-
close() {
|
|
207
|
-
}
|
|
208
198
|
async [Symbol.asyncDispose]() {
|
|
209
199
|
this.close();
|
|
210
200
|
}
|
|
211
|
-
screenshot(width = 1280, height = 720) {
|
|
212
|
-
if (!this.currentUrl) {
|
|
213
|
-
throw new Error('No page loaded. Call goto() first.');
|
|
214
|
-
}
|
|
215
|
-
try {
|
|
216
|
-
const output = (0, child_process_1.execSync)(`${this.binaryPath} screenshot --url ${this.currentUrl} --mode ${this.mode} --width ${width} --height ${height}`, { timeout: this.timeout * 1000 }).toString().trim();
|
|
217
|
-
return output;
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
if (error.message?.includes('timed out')) {
|
|
221
|
-
throw new Error(`Screenshot timed out after ${this.timeout}s`);
|
|
222
|
-
}
|
|
223
|
-
throw new Error(`Screenshot failed: ${error.message}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
async waitForSelector(selector, timeoutMs = 10000) {
|
|
227
|
-
if (!this.currentUrl) {
|
|
228
|
-
throw new Error('No page loaded. Call goto() first.');
|
|
229
|
-
}
|
|
230
|
-
try {
|
|
231
|
-
const output = (0, child_process_1.execSync)(`${this.binaryPath} wait-for-selector --url ${this.currentUrl} --selector ${JSON.stringify(selector)} --timeout ${timeoutMs}`, { timeout: Math.ceil(timeoutMs / 1000) + 5 }).toString().trim();
|
|
232
|
-
return output === 'true';
|
|
233
|
-
}
|
|
234
|
-
catch {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
201
|
async click(selector) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
try {
|
|
243
|
-
(0, child_process_1.execSync)(`${this.binaryPath} click --url ${this.currentUrl} --mode ${this.mode} --selector ${JSON.stringify(selector)}`, { timeout: this.timeout * 1000 });
|
|
244
|
-
}
|
|
245
|
-
catch (error) {
|
|
246
|
-
throw new Error(`Click failed on "${selector}": ${error.message}`);
|
|
247
|
-
}
|
|
202
|
+
this.ensureSession(this.currentUrl || undefined);
|
|
203
|
+
return this.runSessionCommand('click', this.escapeArg(selector));
|
|
248
204
|
}
|
|
249
205
|
async typeText(selector, text, clearFirst = false) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
let cmd = `${this.binaryPath} type-text --url ${this.currentUrl} --mode ${this.mode} --selector ${JSON.stringify(selector)} --text ${JSON.stringify(text)}`;
|
|
255
|
-
if (clearFirst) {
|
|
256
|
-
cmd += ' --clear-first';
|
|
257
|
-
}
|
|
258
|
-
(0, child_process_1.execSync)(cmd, { timeout: this.timeout * 1000 });
|
|
259
|
-
}
|
|
260
|
-
catch (error) {
|
|
261
|
-
throw new Error(`Type text failed on "${selector}": ${error.message}`);
|
|
262
|
-
}
|
|
206
|
+
this.ensureSession(this.currentUrl || undefined);
|
|
207
|
+
return this.runSessionCommand('type-text', this.escapeArg(selector), this.escapeArg(text), clearFirst ? '--clear' : '');
|
|
263
208
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
209
|
+
async waitForSelector(selector, timeoutMs = 5000) {
|
|
210
|
+
this.ensureSession(this.currentUrl || undefined);
|
|
211
|
+
return this.runSessionCommand('wait-for', this.escapeArg(selector), timeoutMs.toString());
|
|
212
|
+
}
|
|
213
|
+
async screenshot(url, fullPage = false) {
|
|
214
|
+
this.ensureSession(url);
|
|
215
|
+
return this.runSessionCommand('screenshot', fullPage ? '--full-page' : '');
|
|
216
|
+
}
|
|
217
|
+
async setViewport(width, height) {
|
|
218
|
+
this.viewportWidth = width;
|
|
219
|
+
this.viewportHeight = height;
|
|
220
|
+
this.ensureSession();
|
|
221
|
+
this.runSessionCommand('set-viewport', width.toString(), height.toString());
|
|
222
|
+
}
|
|
223
|
+
async setUserAgent(ua) {
|
|
224
|
+
this.userAgent = ua;
|
|
225
|
+
this.ensureSession();
|
|
226
|
+
this.runSessionCommand('set-user-agent', this.escapeArg(ua));
|
|
227
|
+
}
|
|
228
|
+
async emulateDevice(device) {
|
|
229
|
+
this.emulatedDevice = device;
|
|
230
|
+
this.ensureSession();
|
|
231
|
+
this.runSessionCommand('emulate-device', this.escapeArg(device));
|
|
232
|
+
}
|
|
233
|
+
close() {
|
|
234
|
+
if (this.sessionStarted) {
|
|
270
235
|
try {
|
|
271
|
-
|
|
236
|
+
(0, child_process_1.execSync)(`${this.binaryPath} session close ${this.sessionId}`, { timeout: 5000 });
|
|
272
237
|
}
|
|
273
238
|
catch {
|
|
274
|
-
|
|
239
|
+
// Ignore errors on close
|
|
275
240
|
}
|
|
241
|
+
this.sessionStarted = false;
|
|
276
242
|
}
|
|
277
|
-
catch {
|
|
278
|
-
return [];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
static async getLinksFromPage(url, mode = types_1.BrowserMode.LIGHT) {
|
|
282
|
-
const browser = new AgentBrowser({ mode });
|
|
283
|
-
try {
|
|
284
|
-
const page = await browser.goto(url);
|
|
285
|
-
return page.links;
|
|
286
|
-
}
|
|
287
|
-
finally {
|
|
288
|
-
browser.close();
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
static findBinary() {
|
|
292
|
-
return getB4n1webBinary();
|
|
293
243
|
}
|
|
294
244
|
}
|
|
295
245
|
exports.AgentBrowser = AgentBrowser;
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8NA,oDAUC;AAxOD,uCAAyB;AACzB,iDAAyC;AACzC,mCAAgF;AAChF,iCAA8B;AAC9B,qCAA4C;AAE5C,mCAA0F;AAAjF,0GAAA,gBAAgB,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,mHAAA,yBAAyB,OAAA;AACvE,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,MAAa,YAAY;IACf,IAAI,CAAc;IAClB,OAAO,CAAS;IAChB,SAAS,CAAS;IAClB,UAAU,CAAU;IACpB,UAAU,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|
class NavigationError extends Error {
|
|
13
|
+
url;
|
|
13
14
|
constructor(message, url) {
|
|
14
15
|
super(message);
|
|
15
16
|
this.url = url;
|
|
@@ -19,6 +20,7 @@ class NavigationError extends Error {
|
|
|
19
20
|
}
|
|
20
21
|
exports.NavigationError = NavigationError;
|
|
21
22
|
class BinaryError extends Error {
|
|
23
|
+
stderr;
|
|
22
24
|
constructor(message, stderr) {
|
|
23
25
|
super(message);
|
|
24
26
|
this.stderr = stderr;
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,oGAAoG;QACxH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;CACF;AAND,kDAMC;AAED,MAAa,eAAgB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,oGAAoG;QACxH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;CACF;AAND,kDAMC;AAED,MAAa,eAAgB,SAAQ,KAAK;IACK;IAA7C,YAAY,OAAe,EAAkB,GAAW;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,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,4 +1,5 @@
|
|
|
1
1
|
export { AgentBrowser, Page, getB4n1webBinary, getB4n1webVersion, checkVersionCompatibility, createBrowserAndGoto } from './browser';
|
|
2
2
|
export { BrowserMode } from './types';
|
|
3
3
|
export { BinaryNotFoundError, NavigationError, BinaryError, SelectorTimeoutError } from './errors';
|
|
4
|
+
export { SecurityShield } from './security';
|
|
4
5
|
//# 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,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"}
|
|
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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectorTimeoutError = exports.BinaryError = exports.NavigationError = exports.BinaryNotFoundError = exports.BrowserMode = exports.createBrowserAndGoto = 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;
|
|
4
4
|
var browser_1 = require("./browser");
|
|
5
5
|
Object.defineProperty(exports, "AgentBrowser", { enumerable: true, get: function () { return browser_1.AgentBrowser; } });
|
|
6
6
|
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return browser_1.Page; } });
|
|
@@ -15,4 +15,6 @@ Object.defineProperty(exports, "BinaryNotFoundError", { enumerable: true, get: f
|
|
|
15
15
|
Object.defineProperty(exports, "NavigationError", { enumerable: true, get: function () { return errors_1.NavigationError; } });
|
|
16
16
|
Object.defineProperty(exports, "BinaryError", { enumerable: true, get: function () { return errors_1.BinaryError; } });
|
|
17
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; } });
|
|
18
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,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"}
|
|
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"}
|
package/dist/page.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PageData } from './types';
|
|
2
|
+
export declare class Page implements PageData {
|
|
3
|
+
url: string;
|
|
4
|
+
markdown: string;
|
|
5
|
+
links: string[];
|
|
6
|
+
screenshot?: string;
|
|
7
|
+
jsOutput?: string;
|
|
8
|
+
constructor(data: PageData);
|
|
9
|
+
getMainContent(): string;
|
|
10
|
+
findLinksByText(text: string): string[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,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;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAEN,IAAI,EAAE,QAAQ;IAQ1B,cAAc,IAAI,MAAM;IAMxB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CAIxC"}
|
package/dist/page.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Page = void 0;
|
|
4
|
+
class Page {
|
|
5
|
+
url;
|
|
6
|
+
markdown;
|
|
7
|
+
links;
|
|
8
|
+
screenshot;
|
|
9
|
+
jsOutput;
|
|
10
|
+
constructor(data) {
|
|
11
|
+
this.url = data.url;
|
|
12
|
+
this.markdown = data.markdown;
|
|
13
|
+
this.links = data.links;
|
|
14
|
+
this.screenshot = data.screenshot;
|
|
15
|
+
this.jsOutput = data.jsOutput;
|
|
16
|
+
}
|
|
17
|
+
getMainContent() {
|
|
18
|
+
const lines = this.markdown.split('\n');
|
|
19
|
+
const contentLines = lines.length > 2 ? lines.slice(2) : lines;
|
|
20
|
+
return contentLines.join('\n').trim();
|
|
21
|
+
}
|
|
22
|
+
findLinksByText(text) {
|
|
23
|
+
const lowerText = text.toLowerCase();
|
|
24
|
+
return this.links.filter(link => link.toLowerCase().includes(lowerText));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Page = Page;
|
|
28
|
+
//# sourceMappingURL=page.js.map
|
package/dist/page.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../src/page.ts"],"names":[],"mappings":";;;AAEA,MAAa,IAAI;IACf,GAAG,CAAS;IACZ,QAAQ,CAAS;IACjB,KAAK,CAAW;IAChB,UAAU,CAAU;IACpB,QAAQ,CAAU;IAElB,YAAY,IAAc;QACxB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;IAED,cAAc;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/D,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,CAAC;IAED,eAAe,CAAC,IAAY;QAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3E,CAAC;CACF;AAzBD,oBAyBC"}
|