@proagentstore/cli 0.4.0 → 0.4.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.
|
@@ -767,6 +767,26 @@ export class LocalRunner {
|
|
|
767
767
|
const mcp = await this.getMcp();
|
|
768
768
|
const res = await this.callBrowserTool(mcp, action);
|
|
769
769
|
const text = mcp.textOf(res).trim();
|
|
770
|
+
// A native page dialog (alert/confirm/beforeunload) puts the standard server
|
|
771
|
+
// into a modal state that blocks EVERY other tool until it's handled. The brain
|
|
772
|
+
// has no dialog vocabulary (the old runtime relied on Playwright's default
|
|
773
|
+
// auto-dismiss, which @playwright/mcp overrides), so clear it transparently and
|
|
774
|
+
// report it as a successful, informative step — the brain proceeds on the next
|
|
775
|
+
// snapshot instead of thrashing into a needless human handoff.
|
|
776
|
+
if (res.isError && /modal state/i.test(text) && /dialog/i.test(text)) {
|
|
777
|
+
const dialogMsg = (text.match(/dialog with message "([^"]*)"/)?.[1] || "").slice(0, 160);
|
|
778
|
+
await mcp.callTool("browser_handle_dialog", { accept: true }).catch(() => undefined);
|
|
779
|
+
await page.waitForTimeout(400).catch(() => undefined);
|
|
780
|
+
const settled = await this.getActivePage();
|
|
781
|
+
await settled.waitForLoadState("domcontentloaded", { timeout: 6_000 }).catch(() => undefined);
|
|
782
|
+
return {
|
|
783
|
+
ok: true,
|
|
784
|
+
url: settled.url(),
|
|
785
|
+
title: await settled.title().catch(() => ""),
|
|
786
|
+
challenge: await detectHumanChallenge(settled),
|
|
787
|
+
feedback: dialogMsg ? `a native dialog was accepted: "${dialogMsg}"` : "a native dialog was accepted",
|
|
788
|
+
};
|
|
789
|
+
}
|
|
770
790
|
if (res.isError)
|
|
771
791
|
throw new RunnerInputError(this.conciseFeedback(text) || `${action.action} failed`);
|
|
772
792
|
// A click may trigger SPA navigation or open a new tab/popup. Give it a beat
|