@mastra/agent-browser 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/agent-browser
2
2
 
3
+ ## 0.2.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed `browser_evaluate` so expression scripts now return their computed value instead of `undefined` (for example, `document.querySelectorAll('a').length`). ([#15689](https://github.com/mastra-ai/mastra/pull/15689))
8
+
9
+ - Updated dependencies [[`733bf53`](https://github.com/mastra-ai/mastra/commit/733bf53d9352aedd3ef38c3d501edb275b65b43c), [`5405b3b`](https://github.com/mastra-ai/mastra/commit/5405b3b35325c5b8fb34fc7ac109bd2feb7bb6fe), [`c321127`](https://github.com/mastra-ai/mastra/commit/c3211275fc195de9ad1ead2746b354beb8eae6e8), [`a07bcef`](https://github.com/mastra-ai/mastra/commit/a07bcefea77c03d6d322caad973dca49b4b15fa1), [`b084a80`](https://github.com/mastra-ai/mastra/commit/b084a800db0f82d62e1fc3d6e3e3480da1ba5a53), [`82b7a96`](https://github.com/mastra-ai/mastra/commit/82b7a964169636c1d1e0c694fc892a213b0179d5), [`df97812`](https://github.com/mastra-ai/mastra/commit/df97812bd949dcafeb074b80ecab501724b49c3b), [`8bbe360`](https://github.com/mastra-ai/mastra/commit/8bbe36042af7fc4be0244dffd8913f6795179421), [`f6b8ba8`](https://github.com/mastra-ai/mastra/commit/f6b8ba8dbf533b7a8db90c72b6805ddc804a3a72), [`a07bcef`](https://github.com/mastra-ai/mastra/commit/a07bcefea77c03d6d322caad973dca49b4b15fa1)]:
10
+ - @mastra/core@1.28.0-alpha.0
11
+
3
12
  ## 0.2.0
4
13
 
5
14
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -221,7 +221,9 @@ var dragInputSchema = zod.z.object({
221
221
  }
222
222
  });
223
223
  var evaluateInputSchema = zod.z.object({
224
- script: zod.z.string().describe("JavaScript code to execute"),
224
+ script: zod.z.string().describe(
225
+ "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 () => { ... })()`."
226
+ ),
225
227
  arg: zod.z.unknown().optional().describe("Argument to pass to the script (JSON-serializable)")
226
228
  });
227
229
  var browserSchemas = {
@@ -1463,8 +1465,7 @@ var AgentBrowser = class extends browser.MastraBrowser {
1463
1465
  async evaluate(input, threadId) {
1464
1466
  try {
1465
1467
  const page = await this.getPage(threadId);
1466
- const wrappedScript = `(async () => { ${input.script} })()`;
1467
- const result = await page.evaluate(wrappedScript);
1468
+ const result = await page.evaluate(input.script);
1468
1469
  return {
1469
1470
  success: true,
1470
1471
  result,