Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
folder serving
Dillon DuPont7650ae570098
diff --git a/libs/python/bench-ui/examples/folder_example.py b/libs/python/bench-ui/examples/folder_example.pynew file mode 100644index 0000000000..324c2cdb7a--- /dev/null+++ b/libs/python/bench-ui/examples/folder_example.py@@ -0,0 +1,40 @@+from __future__ import annotations+import time+from bench_ui import launch_window, get_element_rect, execute_javascript+from pathlib import Path+import os++def main():+ os.environ["CUA_BENCH_UI_DEBUG"] = "1"++ # Get the path to the gui folder+ gui_folder = Path(__file__).parent / "gui"++ # Launch a window serving the static folder+ pid = launch_window(+ folder=str(gui_folder),+ title="Static Folder Example",+ width=800,+ height=600,+ )+ print(f"Launched window with PID: {pid}")+ print(f"Serving folder: {gui_folder}")++ # Give the window a moment to render+ time.sleep(1.5)++ # Query the client rect of the button element+ rect = get_element_rect(pid, "#testButton", space="window")+ print("Button rect (window space):", rect)++ # Check if button has been clicked+ clicked = execute_javascript(pid, "document.getElementById('testButton').disabled")+ print("Button clicked:", clicked)++ # Get the page title+ title = execute_javascript(pid, "document.title")+ print("Page title:", title)+++if __name__ == "__main__":+ main()diff --git a/libs/python/bench-ui/examples/gui/index.html b/libs/python/bench-ui/examples/gui/index.htmlnew file mode 100644index 0000000000..962994f714--- /dev/null+++ b/libs/python/bench-ui/examples/gui/index.html@@ -0,0 +1,42 @@+<!DOCTYPE html>+<html lang="en">++<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Static Folder Example</title>+ <link rel="stylesheet" href="styles.css">+</head>++<body>+ <div class="container">+ <h1>Static Folder Example</h1>+ <p>This page is served from a static folder using bench-ui!</p>++ <div class="image-container">+ <img src="logo.svg" alt="Example SVG Logo" class="logo">+ </div>++ <div class="info">+ <p>This example demonstrates:</p>+ <ul>+ <li>Serving a static folder with bench-ui</li>+ <li>Loading external CSS files (styles.css)</li>+ <li>Loading SVG images (logo.svg)</li>+ </ul>+ </div>++ <button id="testButton" class="btn">Click Me!</button>+ <p id="status"></p>+ </div>++ <script>+ document.getElementById('testButton').addEventListener('click', function () {+ document.getElementById('status').textContent = 'Button clicked! ✓';+ this.disabled = true;+ this.textContent = 'Clicked!';+ });+ </script>+</body>++</html>\ No newline at end of filediff --git a/libs/python/bench-ui/examples/gui/logo.svg b/libs/python/bench-ui/examples/gui/logo.svgnew file mode 100644index 0000000000..bd22d128c1--- /dev/null+++ b/libs/python/bench-ui/examples/gui/logo.svg@@ -0,0 +1,24 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">+ <defs>+ <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%">+ <stop offset="0%" style="stop-color:#667eea;stop-opacity:1" />+ <stop offset="100%" style="stop-color:#764ba2;stop-opacity:1" />+ </linearGradient>+ </defs>++ <!-- Background circle -->+ <circle cx="100" cy="100" r="95" fill="url(#grad1)" />++ <!-- Window icon -->+ <rect x="50" y="50" width="100" height="100" rx="8" fill="white" opacity="0.9" />++ <!-- Window panes -->+ <line x1="100" y1="50" x2="100" y2="150" stroke="url(#grad1)" stroke-width="4" />+ <line x1="50" y1="100" x2="150" y2="100" stroke="url(#grad1)" stroke-width="4" />++ <!-- Decorative dots -->+ <circle cx="75" cy="75" r="8" fill="url(#grad1)" />+ <circle cx="125" cy="75" r="8" fill="url(#grad1)" />+ <circle cx="75" cy="125" r="8" fill="url(#grad1)" />+ <circle cx="125" cy="125" r="8" fill="url(#grad1)" />+</svg>diff --git a/libs/python/bench-ui/examples/gui/styles.css b/libs/python/bench-ui/examples/gui/styles.cssnew file mode 100644index 0000000000..fe63c6e6c2--- /dev/null+++ b/libs/python/bench-ui/examples/gui/styles.css@@ -0,0 +1,92 @@+body {+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;+ margin: 0;+ padding: 20px;+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);+ min-height: 100vh;+ display: flex;+ justify-content: center;+ align-items: center;+}++.container {+ background: white;+ border-radius: 12px;+ padding: 40px;+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);+ max-width: 600px;+ width: 100%;+}++h1 {+ color: #333;+ margin-top: 0;+ font-size: 2em;+}++p {+ color: #666;+ line-height: 1.6;+}++.image-container {+ display: flex;+ justify-content: center;+ margin: 30px 0;+}++.logo {+ width: 150px;+ height: 150px;+}++.info {+ background: #f8f9fa;+ border-left: 4px solid #667eea;+ padding: 20px;+ margin: 20px 0;+ border-radius: 4px;+}++.info ul {+ margin: 10px 0;+ padding-left: 20px;+}++.info li {+ color: #555;+ margin: 8px 0;+}++.btn {+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);+ color: white;+ border: none;+ padding: 12px 30px;+ font-size: 16px;+ border-radius: 6px;+ cursor: pointer;+ transition: transform 0.2s, box-shadow 0.2s;+ font-weight: 600;+}++.btn:hover:not(:disabled) {+ transform: translateY(-2px);+ box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);+}++.btn:active:not(:disabled) {+ transform: translateY(0);+}++.btn:disabled {+ opacity: 0.6;+ cursor: not-allowed;+}++#status {+ margin-top: 15px;+ font-weight: 600;+ color: #28a745;+ font-size: 18px;+}\ No newline at end of file