@browserbasehq/sdk 1.1.8 → 1.1.9
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/dist/index.d.ts +1 -1
- package/dist/index.js +15 -7
- package/dist/integrations/ai-sdk.js +9 -5
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BrowserbaseAISDK = exports.Browserbase = void 0;
|
|
7
|
+
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
8
|
+
const ai_sdk_js_1 = __importDefault(require("./integrations/ai-sdk.js"));
|
|
9
|
+
exports.BrowserbaseAISDK = ai_sdk_js_1.default;
|
|
10
|
+
class Browserbase {
|
|
4
11
|
apiKey;
|
|
5
12
|
projectId;
|
|
6
13
|
baseAPIURL;
|
|
@@ -112,7 +119,7 @@ export default class Browserbase {
|
|
|
112
119
|
if (!url) {
|
|
113
120
|
throw new Error('Page URL was not provided');
|
|
114
121
|
}
|
|
115
|
-
const browser = await
|
|
122
|
+
const browser = await puppeteer_core_1.default.connect({
|
|
116
123
|
browserWSEndpoint: this.getConnectURL({
|
|
117
124
|
sessionId: options.sessionId,
|
|
118
125
|
proxy: options.proxy,
|
|
@@ -138,7 +145,7 @@ export default class Browserbase {
|
|
|
138
145
|
if (!urls.length) {
|
|
139
146
|
throw new Error('Page URLs were not provided');
|
|
140
147
|
}
|
|
141
|
-
const browser = await
|
|
148
|
+
const browser = await puppeteer_core_1.default.connect({
|
|
142
149
|
browserWSEndpoint: this.getConnectURL({
|
|
143
150
|
sessionId: options.sessionId,
|
|
144
151
|
proxy: options.proxy,
|
|
@@ -166,7 +173,7 @@ export default class Browserbase {
|
|
|
166
173
|
if (!url) {
|
|
167
174
|
throw new Error('Page URL was not provided');
|
|
168
175
|
}
|
|
169
|
-
const browser = await
|
|
176
|
+
const browser = await puppeteer_core_1.default.connect({
|
|
170
177
|
browserWSEndpoint: this.getConnectURL({
|
|
171
178
|
sessionId: options.sessionId,
|
|
172
179
|
proxy: options.proxy,
|
|
@@ -180,4 +187,5 @@ export default class Browserbase {
|
|
|
180
187
|
return screenshot;
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
|
-
|
|
190
|
+
exports.default = Browserbase;
|
|
191
|
+
exports.Browserbase = Browserbase;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserbaseAISDK = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
function BrowserbaseAISDK(b, options = {}) {
|
|
3
6
|
return {
|
|
4
7
|
description: 'Load a webpage in a browser hosted by Browserbase and return its contents',
|
|
5
|
-
parameters: z.object({
|
|
6
|
-
url: z.string().describe('Page URL to be loaded'),
|
|
8
|
+
parameters: zod_1.z.object({
|
|
9
|
+
url: zod_1.z.string().describe('Page URL to be loaded'),
|
|
7
10
|
}),
|
|
8
11
|
execute: async ({ url }) => {
|
|
9
12
|
const page = await b.loadURL(url, options);
|
|
@@ -11,4 +14,5 @@ export default function BrowserbaseAISDK(b, options = {}) {
|
|
|
11
14
|
},
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
exports.default = BrowserbaseAISDK;
|
|
18
|
+
exports.BrowserbaseAISDK = BrowserbaseAISDK;
|