@mastra/agent-browser 0.2.0 → 0.2.1-alpha.1
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/CHANGELOG.md +18 -0
- package/dist/index.cjs +7 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var AgentBrowserThreadManager = class extends ThreadManager {
|
|
|
34
34
|
if (this.scope === "thread") {
|
|
35
35
|
const manager = new BrowserManager();
|
|
36
36
|
const launchOptions = {
|
|
37
|
-
headless: this.browserConfig.headless
|
|
37
|
+
headless: this.browserConfig.headless,
|
|
38
38
|
viewport: this.browserConfig.viewport,
|
|
39
39
|
profile: this.browserConfig.profile,
|
|
40
40
|
executablePath: this.browserConfig.executablePath,
|
|
@@ -219,7 +219,9 @@ var dragInputSchema = z.object({
|
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
221
|
var evaluateInputSchema = z.object({
|
|
222
|
-
script: z.string().describe(
|
|
222
|
+
script: z.string().describe(
|
|
223
|
+
"JavaScript expression to evaluate in the browser and return the result. Do not use `return` \u2014 write a bare expression like `document.title` or `1 + 1`. For async code, wrap in an async IIFE: `(async () => { ... })()`."
|
|
224
|
+
),
|
|
223
225
|
arg: z.unknown().optional().describe("Argument to pass to the script (JSON-serializable)")
|
|
224
226
|
});
|
|
225
227
|
var browserSchemas = {
|
|
@@ -531,7 +533,7 @@ var AgentBrowser = class extends MastraBrowser {
|
|
|
531
533
|
const effectiveScope = config.cdpUrl ? config.scope ?? "shared" : config.scope ?? "thread";
|
|
532
534
|
this.threadManager = new AgentBrowserThreadManager({
|
|
533
535
|
scope: effectiveScope,
|
|
534
|
-
browserConfig: config,
|
|
536
|
+
browserConfig: { ...config, headless: this.headless },
|
|
535
537
|
resolveCdpUrl: this.resolveCdpUrl.bind(this),
|
|
536
538
|
logger: this.logger,
|
|
537
539
|
// When a new thread session is created, notify listeners so screencast can start
|
|
@@ -595,7 +597,7 @@ var AgentBrowser = class extends MastraBrowser {
|
|
|
595
597
|
this.sharedManager = new BrowserManager();
|
|
596
598
|
const localConfig = this.config;
|
|
597
599
|
const launchOptions = {
|
|
598
|
-
headless:
|
|
600
|
+
headless: this.headless,
|
|
599
601
|
viewport: localConfig.viewport,
|
|
600
602
|
profile: localConfig.profile,
|
|
601
603
|
executablePath: localConfig.executablePath,
|
|
@@ -1461,8 +1463,7 @@ var AgentBrowser = class extends MastraBrowser {
|
|
|
1461
1463
|
async evaluate(input, threadId) {
|
|
1462
1464
|
try {
|
|
1463
1465
|
const page = await this.getPage(threadId);
|
|
1464
|
-
const
|
|
1465
|
-
const result = await page.evaluate(wrappedScript);
|
|
1466
|
+
const result = await page.evaluate(input.script);
|
|
1466
1467
|
return {
|
|
1467
1468
|
success: true,
|
|
1468
1469
|
result,
|