Skip to content
This repository was archived by the owner on Aug 19, 2026. It is now read-only.
This repository was archived by the owner on Aug 19, 2026. It is now read-only.

[AGENT-2143] RDP agent tool — keyboard/mouse injection via Guacamole protocol commands #581

Description

@dnviti

Code: AGENT-2143
Priority: LOW
Section: Orchestration — Agent Orchestration Gateway (Phase 5: Advanced — RDP/VNC Vision Agents)
Dependencies: AGENT-2142

Description

Implement the second half of the RDP agent tool: keyboard and mouse input injection via the Guacamole protocol. Combined with the screenshot/vision capability (AGENT-2142), this enables complete vision-based RDP automation — agents can see the screen, decide where to click or what to type, and execute those actions programmatically through the Guacamole protocol.

Technical Details

Server — Input Injection Service (server/src/services/agentTools/rdpInput.service.ts)

  • sendKeyPress(sessionId, key: string | number): Promise<void>
    • Send Guacamole key instruction (keycode + pressed/released events)
    • Support named keys: 'Enter', 'Tab', 'Escape', 'Backspace', 'Delete', arrow keys, modifier keys
    • Support key combinations: Ctrl+C, Alt+Tab, Ctrl+Alt+Delete
  • sendText(sessionId, text: string): Promise<void>
    • Send text as sequence of key press/release events
    • Handle special characters and Unicode
    • Configurable inter-key delay (default 50ms) for realistic typing
  • sendMouseClick(sessionId, x: number, y: number, button?: 'left' | 'right' | 'middle'): Promise<void>
    • Send Guacamole mouse instruction with coordinates and button mask
    • Sequence: move → button down → brief delay → button up
  • sendMouseDoubleClick(sessionId, x: number, y: number): Promise<void>
    • Two click sequences with standard double-click interval
  • sendMouseDrag(sessionId, startX, startY, endX, endY): Promise<void>
    • Mouse down at start, move to end, mouse up
  • sendMouseScroll(sessionId, x: number, y: number, direction: 'up' | 'down', amount?: number): Promise<void>
    • Scroll wheel instruction at coordinates

Server — RDP Interaction Tool (server/src/services/agentTools/rdpInteractionTool.service.ts)

  • rdp_click tool:
    • Input: { connectionId, x, y, button?, doubleClick? }
    • Permission: 'write' capability required
    • Sends click, waits briefly, captures screenshot, returns visual confirmation
  • rdp_type tool:
    • Input: { connectionId, text, pressEnter? }
    • Permission: 'write' capability required
    • Types text, optionally presses Enter
    • DLP check: if disablePaste is true, this simulates typing (not paste), so allowed
  • rdp_key tool:
    • Input: { connectionId, key, modifiers?: string[] }
    • Permission: 'execute' capability required (for key combos like Ctrl+Alt+Delete)
    • Sends key combination
  • rdp_scroll tool:
    • Input: { connectionId, x, y, direction, amount? }
    • Permission: 'read' capability sufficient

Server — Safety Controls

  • Keystroke inspection: agent keyboard input piped through keystroke inspection (if enabled for connection)
  • Rate limiting: max input events per second (default 20) to prevent accidental input storms
  • Dangerous key combo protection: Ctrl+Alt+Delete, Alt+F4, Windows key sequences require 'execute' permission
  • DLP: clipboard operations (Ctrl+C/V) respect DLP policy

Server — Coordinate System

  • Screenshot coordinates match Guacamole's coordinate system (0,0 = top-left)
  • LLM vision analysis returns approximate element locations from screenshot
  • Agent uses these coordinates for click targets
  • Allow small coordinate offsets for retry on missed clicks

Files Involved

  • CREATE server/src/services/agentTools/rdpInput.service.ts — Guacamole input injection
  • CREATE server/src/services/agentTools/rdpInteractionTool.service.ts — RDP interaction tools
  • MODIFY server/src/services/agentToolRegistry.service.ts — Register rdp_click, rdp_type, rdp_key, rdp_scroll tools

Reference: Agent Orchestration Gateway — Phase 5.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions