Skip to main content

codetether_agent/tool/computer_use/
mod.rs

1//! Computer use tool for OS-level GUI automation
2//!
3//! Provides native desktop automation capabilities including app discovery,
4//! screen capture, and input simulation. Currently supports Windows only.
5
6pub mod input;
7pub mod response;
8pub mod schema;
9
10mod platform;
11
12use super::{Tool, ToolResult};
13use anyhow::{Context, Result};
14use async_trait::async_trait;
15use serde_json::Value;
16
17pub struct ComputerUseTool;
18
19impl ComputerUseTool {
20    pub fn new() -> Self {
21        Self
22    }
23}
24
25impl Default for ComputerUseTool {
26    fn default() -> Self {
27        Self::new()
28    }
29}
30
31#[async_trait]
32impl Tool for ComputerUseTool {
33    fn id(&self) -> &str {
34        "computer_use"
35    }
36
37    fn name(&self) -> &str {
38        "Computer Use"
39    }
40
41    fn description(&self) -> &str {
42        "Native Windows desktop automation using the real OS cursor and keyboard. Start with snapshot or list_apps; snapshots return physical screen pixel bounds and cursor position. Use those coordinates for click, right_click, double_click, drag, and scroll. Use bring_to_front before interacting with a window."
43    }
44
45    fn parameters(&self) -> Value {
46        schema::parameters_schema()
47    }
48
49    async fn execute(&self, args: Value) -> Result<ToolResult> {
50        let input: input::ComputerUseInput =
51            serde_json::from_value(args).context("Invalid computer_use args")?;
52
53        platform::dispatch(&input).await
54    }
55}