# VM Guest Agent

This folder contains the guest-side agent that should be installed inside the base VM `Quark-Win10-Base`.

## Purpose

The guest agent runs inside the Windows VM and handles:

- screenshot capture inside the guest desktop
- mouse clicks inside the guest
- text input inside the guest
- key sending inside the guest
- UIAutomation node snapshot for the foreground app / desktop
- UIAutomation node search
- UIAutomation node click

The host `vmware_api/server.py` forwards `/vm/screenshot`, `/vm/click`, `/vm/type-text`, `/vm/send-keys`, `/vm/ui-nodes`, `/vm/find-ui-node`, and `/vm/click-ui-node` to this guest agent.

## Files

- `guest_agent.ps1`: agent service
- `install_guest_agent.ps1`: install script
- `install_guest_agent.cmd`: one-click launcher for the install script

## Install inside `Quark-Win10-Base`

1. Boot `Quark-Win10-Base` and log in.
2. Copy this whole folder into the guest.
3. Right-click `install_guest_agent.ps1` or `install_guest_agent.cmd` and run as Administrator.
4. Reboot the VM once.
5. From the host, call `/vm/status` and check:
   - `running = true`
   - `guest_ip` has a value
   - `guest_agent_ok = true`

## Default port

- `18766`

If you need another port, edit the install command and keep the host env var `VM_GUEST_AGENT_PORT` in sync.
