@mastra/agent-browser 0.2.0-alpha.0 → 0.2.1-alpha.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/dist/index.js CHANGED
@@ -219,7 +219,9 @@ var dragInputSchema = z.object({
219
219
  }
220
220
  });
221
221
  var evaluateInputSchema = z.object({
222
- script: z.string().describe("JavaScript code to execute"),
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 = {
@@ -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 wrappedScript = `(async () => { ${input.script} })()`;
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,