chore(cli): save screenshots to tmp dir when no path provided (#247)
* fix(cli): save screenshots to tmp dir when no path provided Instead of outputting base64 to stdout (which is not useful for most CLI use cases), screenshots without a path now save to ~/.agent-browser/tmp/screenshots/ with a generated filename and return the path. This makes the behavior more ergonomic for AI agents and CLI users alike. * cleanup * cleanup * just revert the cargo.lock version for now * refactor: extract getAppDir() from getSocketDir() * docs: improve screenshot help text consistency
This commit is contained in:
+1
-6
@@ -280,11 +280,6 @@ pub fn print_response(resp: &Response, json_mode: bool, action: Option<&str>) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Screenshot base64
|
||||
if let Some(base64) = data.get("base64").and_then(|v| v.as_str()) {
|
||||
println!("{}", base64);
|
||||
return;
|
||||
}
|
||||
// Path-based operations (screenshot/pdf/trace/har/download/state/video)
|
||||
if let Some(path) = data.get("path").and_then(|v| v.as_str()) {
|
||||
match action.unwrap_or("") {
|
||||
@@ -817,7 +812,7 @@ agent-browser screenshot - Take a screenshot
|
||||
Usage: agent-browser screenshot [path]
|
||||
|
||||
Captures a screenshot of the current page. If no path is provided,
|
||||
outputs base64-encoded image data.
|
||||
saves to a temporary directory with a generated filename.
|
||||
|
||||
Options:
|
||||
--full, -f Capture full page (not just viewport)
|
||||
|
||||
Reference in New Issue
Block a user