@mastra/agent-browser 0.4.0 → 0.4.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 +9 -0
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/agent-browser
|
|
2
2
|
|
|
3
|
+
## 0.4.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed a crash that could occur when using `waitUntil` with `click`, `press`, or `select`. If the page navigation timed out while the action was still running, the whole Node process could crash instead of the tool returning a normal error result. ([#18870](https://github.com/mastra-ai/mastra/pull/18870))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`3ffb8b7`](https://github.com/mastra-ai/mastra/commit/3ffb8b720e90f5e6977129ec1f6707d43c2bebe0), [`5ea76a7`](https://github.com/mastra-ai/mastra/commit/5ea76a723d966c72da9aa3ab30ae20276e049765), [`6445560`](https://github.com/mastra-ai/mastra/commit/6445560327045d20b239585fc63fed72e9ce36ec), [`a2ba369`](https://github.com/mastra-ai/mastra/commit/a2ba369e796dfab610f41c6875965b488272fa55), [`ae51e81`](https://github.com/mastra-ai/mastra/commit/ae51e818825582d42500338dfc1929a082eff0ba), [`6f304ef`](https://github.com/mastra-ai/mastra/commit/6f304ef319e99725e884bdb8d3193c001b6e5964)]:
|
|
10
|
+
- @mastra/core@1.50.0-alpha.1
|
|
11
|
+
|
|
3
12
|
## 0.4.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1141,6 +1141,19 @@ var AgentBrowser = class extends browser.MastraBrowser {
|
|
|
1141
1141
|
return this.createErrorFromException(error, "Screenshot");
|
|
1142
1142
|
}
|
|
1143
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Start a `waitForNavigation` wait (when `waitUntil` is set) and immediately
|
|
1146
|
+
* attach a noop catch handler so a navigation timeout/rejection can't become
|
|
1147
|
+
* an unhandled rejection (crashing the process) while the caller's action is
|
|
1148
|
+
* still pending. Callers should still `await` the returned promise to observe
|
|
1149
|
+
* the original error.
|
|
1150
|
+
*/
|
|
1151
|
+
startNavigationWait(page, waitUntil, timeout) {
|
|
1152
|
+
const navigation = waitUntil ? page.waitForNavigation({ waitUntil, timeout }) : void 0;
|
|
1153
|
+
navigation?.catch(() => {
|
|
1154
|
+
});
|
|
1155
|
+
return navigation;
|
|
1156
|
+
}
|
|
1144
1157
|
// ---------------------------------------------------------------------------
|
|
1145
1158
|
// 3. browser_click - Click on element
|
|
1146
1159
|
// ---------------------------------------------------------------------------
|
|
@@ -1156,7 +1169,7 @@ var AgentBrowser = class extends browser.MastraBrowser {
|
|
|
1156
1169
|
);
|
|
1157
1170
|
}
|
|
1158
1171
|
const timeout = input.timeout ?? this.defaultTimeout;
|
|
1159
|
-
const navigation =
|
|
1172
|
+
const navigation = this.startNavigationWait(page, input.waitUntil, timeout);
|
|
1160
1173
|
await locator.click({
|
|
1161
1174
|
button: input.button ?? "left",
|
|
1162
1175
|
clickCount: input.clickCount ?? 1,
|
|
@@ -1233,7 +1246,7 @@ var AgentBrowser = class extends browser.MastraBrowser {
|
|
|
1233
1246
|
try {
|
|
1234
1247
|
const page = await this.getPage(threadId);
|
|
1235
1248
|
const timeout = input.timeout ?? this.defaultTimeout;
|
|
1236
|
-
const navigation =
|
|
1249
|
+
const navigation = this.startNavigationWait(page, input.waitUntil, timeout);
|
|
1237
1250
|
await page.keyboard.press(input.key);
|
|
1238
1251
|
await navigation;
|
|
1239
1252
|
return {
|
|
@@ -1264,7 +1277,7 @@ var AgentBrowser = class extends browser.MastraBrowser {
|
|
|
1264
1277
|
if (input.label) selectValue.label = input.label;
|
|
1265
1278
|
if (input.index !== void 0) selectValue.index = input.index;
|
|
1266
1279
|
const timeout = input.timeout ?? this.defaultTimeout;
|
|
1267
|
-
const navigation =
|
|
1280
|
+
const navigation = this.startNavigationWait(page, input.waitUntil, timeout);
|
|
1268
1281
|
const selected = await locator.selectOption(selectValue, { timeout });
|
|
1269
1282
|
await navigation;
|
|
1270
1283
|
return {
|