Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

643 B
Raw Blame
"""Clipboard interface, backed by a Transport."""

from __future__ import annotations

from cua_sandbox.transport.base import Transport


class Clipboard:
    """Clipboard read/write."""

    def __init__(self, transport: Transport):
        self._t = transport

    async def get(self) -> str:
        """Return the current clipboard text."""
        result = await self._t.send("copy_to_clipboard")
        if isinstance(result, dict):
            return result.get("content", "")
        return result

    async def set(self, text: str) -> None:
        """Set the clipboard text."""
        await self._t.send("set_clipboard", text=text)