codetether-agent 4.7.0-a-002.4

A2A-native AI coding agent for the CodeTether ecosystem
Documentation
//! Computer use tool for OS-level GUI automation
//!
//! Provides native desktop automation capabilities including app discovery,
//! screen capture, and input simulation. Currently supports Windows only.

pub mod input;
pub mod response;
pub mod schema;

mod platform;

use super::{Tool, ToolResult};
use anyhow::{Context, Result};
use async_trait::async_trait;
use serde_json::Value;

pub struct ComputerUseTool;

impl ComputerUseTool {
    pub fn new() -> Self {
        Self
    }
}

impl Default for ComputerUseTool {
    fn default() -> Self {
        Self::new()
    }
}

#[async_trait]
impl Tool for ComputerUseTool {
    fn id(&self) -> &str {
        "computer_use"
    }

    fn name(&self) -> &str {
        "Computer Use"
    }

    fn description(&self) -> &str {
        "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."
    }

    fn parameters(&self) -> Value {
        schema::parameters_schema()
    }

    async fn execute(&self, args: Value) -> Result<ToolResult> {
        let input: input::ComputerUseInput =
            serde_json::from_value(args).context("Invalid computer_use args")?;

        platform::dispatch(&input).await
    }
}