Skip to content

feat(dialog): let agents accept, dismiss and fill JavaScript dialogs - #378

Open
ArcueidMP wants to merge 2 commits into
Tencent:mainfrom
ArcueidMP:codex/issue-359-js-dialogs
Open

ArcueidMP wants to merge 2 commits into
Tencent:mainfrom
ArcueidMP:codex/issue-359-js-dialogs

Conversation

@ArcueidMP

@ArcueidMP ArcueidMP commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Native confirm() and prompt() dialogs are currently accepted automatically, so agents cannot cancel a confirmation or supply prompt input. This change leaves those dialogs pending and adds explicit status, accept and dismiss commands.

Fixes #359.

  • Add bsk dialog status, bsk dialog accept [text] and bsk dialog dismiss, with optional tab selection and a dialog ID to reject stale decisions. Omitted prompt text preserves the default; an empty string clears it.
  • Keep automatic handling for alert and beforeunload by default. session start --no-auto-dialog leaves all four types pending, including a beforeunload choice to stay on the page.
  • Return dialog_pending promptly when a dialog blocks a tool, including lifecycle waits. Dialog control can run while the session is busy and still enforces ownership and user interruption. Track the actual native command until it settles, preserve cleanup without replaying input, and handle manual closure, consecutive dialogs and debugger detach.
  • Advertise protocol 1.4, reject unsupported opt-out requests on older components, and add matching DSH actions, schemas, skill guidance and regressions picked up by the existing browser-input CI command.

The pending response ends the original CLI wait, not execution inside Chrome. Handling the dialog may resume the already-sent native operation; it is never replayed. The original evaluation return value is not recovered. Callers inspect the page afterwards and wait while execution_pending is true.

Validation on the rebased branch:

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo test --workspace --locked
  • pnpm lint
  • pnpm --filter @browser-skill/extension compile
  • pnpm ext:test and pnpm ext:build
  • node --test scripts/*.test.mjs, including LF/CRLF skill budget checks
  • node scripts/check-skill-bundles.mjs and node scripts/check-crate-skill.mjs
  • DSH plugin build and node scripts/check-dsh-package.mjs against an actual npm archive
  • 8 isolated Chrome regressions across click-dialogs.browser.test.ts and click.browser.test.ts. The dialog cases are included by the existing CI glob.
  • Isolated CLI → daemon → unpacked extension → Chrome smoke test covering confirm cancellation, empty prompt text, alert opt-out and beforeunload Stay.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Give agents control over JS dialogs (confirm/prompt/beforeunload): dismiss/text/status instead of forced auto-accept

1 participant