feat: add dialog detection and document dialog commands (#999)
Fixes #992 When a JavaScript dialog (alert/confirm/prompt) blocks the page, agents had no way to detect it — all commands just timed out with generic errors. - Add `dialog status` command to check for pending dialogs - Track dialog state via CDP Page.javascriptDialogOpening/Closed events - Auto-inject `warning` field into all command responses when a dialog is pending, so agents can distinguish dialog-blocked timeouts from other issues - Document dialog commands in SKILL.md (was missing entirely), README.md, docs site, and --help output Co-authored-by: ctate <366502+ctate@users.noreply.github.com>
This commit is contained in:
+3
-2
@@ -987,7 +987,7 @@ pub fn parse_command(args: &[String], flags: &Flags) -> Result<Value, ParseError
|
||||
|
||||
// === Dialog ===
|
||||
"dialog" => {
|
||||
const VALID: &[&str] = &["accept", "dismiss"];
|
||||
const VALID: &[&str] = &["accept", "dismiss", "status"];
|
||||
match rest.first().copied() {
|
||||
Some("accept") => {
|
||||
let mut cmd = json!({ "id": id, "action": "dialog", "response": "accept" });
|
||||
@@ -1003,13 +1003,14 @@ pub fn parse_command(args: &[String], flags: &Flags) -> Result<Value, ParseError
|
||||
}
|
||||
Ok(cmd)
|
||||
}
|
||||
Some("status") => Ok(json!({ "id": id, "action": "dialog", "response": "status" })),
|
||||
Some(sub) => Err(ParseError::UnknownSubcommand {
|
||||
subcommand: sub.to_string(),
|
||||
valid_options: VALID,
|
||||
}),
|
||||
None => Err(ParseError::MissingArguments {
|
||||
context: "dialog".to_string(),
|
||||
usage: "dialog <accept|dismiss> [text]",
|
||||
usage: "dialog <accept|dismiss|status> [text]",
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user