mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
feat: add console observation command
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -62,6 +62,8 @@ pub enum Method {
|
||||
ToolGetHtml,
|
||||
#[serde(rename = "tool.screenshot")]
|
||||
ToolScreenshot,
|
||||
#[serde(rename = "tool.console")]
|
||||
ToolConsole,
|
||||
#[serde(rename = "tool.evaluate")]
|
||||
ToolEvaluate,
|
||||
#[serde(rename = "tool.wait_for_navigation")]
|
||||
@@ -124,6 +126,7 @@ impl Method {
|
||||
| Method::ToolSnapshot
|
||||
| Method::ToolGetHtml
|
||||
| Method::ToolScreenshot
|
||||
| Method::ToolConsole
|
||||
| Method::ToolWaitForNavigation
|
||||
| Method::ToolWaitMs
|
||||
| Method::ToolRequestHelp => false,
|
||||
@@ -159,6 +162,13 @@ mod tests {
|
||||
assert_eq!(serde_json::to_value(method).unwrap(), json!("cancel"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn console_method_round_trips() {
|
||||
let method: Method = serde_json::from_value(json!("tool.console")).unwrap();
|
||||
assert_eq!(method, Method::ToolConsole);
|
||||
assert_eq!(serde_json::to_value(method).unwrap(), json!("tool.console"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cancel_params_and_result_round_trip() {
|
||||
let params: CancelParams = serde_json::from_value(json!({ "rpc_id": "wait-1" })).unwrap();
|
||||
@@ -176,6 +186,7 @@ mod tests {
|
||||
assert!(!Method::ToolSnapshot.is_mutating());
|
||||
assert!(!Method::ToolGetHtml.is_mutating());
|
||||
assert!(!Method::ToolScreenshot.is_mutating());
|
||||
assert!(!Method::ToolConsole.is_mutating());
|
||||
assert!(!Method::ToolWaitForNavigation.is_mutating());
|
||||
assert!(!Method::ToolWaitMs.is_mutating());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user