cua-agent 0.2.5__py3-none-any.whl → 0.2.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cua-agent might be problematic. Click here for more details.
- agent/core/tools.py +2 -2
- agent/core/types.py +7 -7
- agent/providers/anthropic/prompts.py +4 -1
- agent/providers/anthropic/tools/computer.py +2 -8
- agent/ui/gradio/app.py +17 -7
- {cua_agent-0.2.5.dist-info → cua_agent-0.2.7.dist-info}/METADATA +2 -2
- {cua_agent-0.2.5.dist-info → cua_agent-0.2.7.dist-info}/RECORD +9 -9
- {cua_agent-0.2.5.dist-info → cua_agent-0.2.7.dist-info}/WHEEL +0 -0
- {cua_agent-0.2.5.dist-info → cua_agent-0.2.7.dist-info}/entry_points.txt +0 -0
agent/core/tools.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""Tool-related type definitions."""
|
|
2
2
|
|
|
3
|
-
from enum import
|
|
3
|
+
from enum import StrEnum
|
|
4
4
|
from typing import Dict, Any, Optional
|
|
5
5
|
from pydantic import BaseModel, ConfigDict
|
|
6
6
|
|
|
7
|
-
class ToolInvocationState(
|
|
7
|
+
class ToolInvocationState(StrEnum):
|
|
8
8
|
"""States for tool invocation."""
|
|
9
9
|
CALL = 'call'
|
|
10
10
|
PARTIAL_CALL = 'partial-call'
|
agent/core/types.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"""Core type definitions."""
|
|
2
2
|
|
|
3
3
|
from typing import Any, Dict, List, Optional, TypedDict, Union
|
|
4
|
-
from enum import
|
|
4
|
+
from enum import StrEnum
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class AgentLoop(
|
|
8
|
+
class AgentLoop(StrEnum):
|
|
9
9
|
"""Enumeration of available loop types."""
|
|
10
10
|
|
|
11
|
-
ANTHROPIC =
|
|
12
|
-
OMNI =
|
|
13
|
-
OPENAI =
|
|
14
|
-
OLLAMA =
|
|
15
|
-
UITARS =
|
|
11
|
+
ANTHROPIC = "anthropic" # Anthropic implementation
|
|
12
|
+
OMNI = "omni" # OmniLoop implementation
|
|
13
|
+
OPENAI = "openai" # OpenAI implementation
|
|
14
|
+
OLLAMA = "ollama" # OLLAMA implementation
|
|
15
|
+
UITARS = "uitars" # UI-TARS implementation
|
|
16
16
|
# Add more loop types as needed
|
|
17
17
|
|
|
18
18
|
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
import platform
|
|
5
5
|
|
|
6
|
+
today = datetime.today()
|
|
7
|
+
today = f"{today.strftime('%A, %B')} {today.day}, {today.year}"
|
|
8
|
+
|
|
6
9
|
SYSTEM_PROMPT = f"""<SYSTEM_CAPABILITY>
|
|
7
10
|
* You are utilising a macOS virtual machine using ARM architecture with internet access and Safari as default browser.
|
|
8
11
|
* You can feel free to install macOS applications with your bash tool. Use curl instead of wget.
|
|
@@ -10,7 +13,7 @@ SYSTEM_PROMPT = f"""<SYSTEM_CAPABILITY>
|
|
|
10
13
|
* When using your bash tool with commands that are expected to output very large quantities of text, redirect into a tmp file and use str_replace_editor or `grep -n -B <lines before> -A <lines after> <query> <filename>` to confirm output.
|
|
11
14
|
* When viewing a page it can be helpful to zoom out so that you can see everything on the page. Either that, or make sure you scroll down to see everything before deciding something isn't available.
|
|
12
15
|
* When using your computer function calls, they take a while to run and send back to you. Where possible/feasible, try to chain multiple of these calls all into one function calls request.
|
|
13
|
-
* The current date is {
|
|
16
|
+
* The current date is {today}.
|
|
14
17
|
</SYSTEM_CAPABILITY>
|
|
15
18
|
|
|
16
19
|
<IMPORTANT>
|
|
@@ -478,17 +478,11 @@ class ComputerTool(BaseComputerTool, BaseAnthropicTool):
|
|
|
478
478
|
if direction == "down":
|
|
479
479
|
# Scroll down (Page Down on macOS)
|
|
480
480
|
self.logger.info(f"Scrolling down, amount: {amount}")
|
|
481
|
-
|
|
482
|
-
for _ in range(amount):
|
|
483
|
-
await self.computer.interface.hotkey("fn", "down")
|
|
484
|
-
await asyncio.sleep(0.1)
|
|
481
|
+
await self.computer.interface.scroll_down(amount)
|
|
485
482
|
else:
|
|
486
483
|
# Scroll up (Page Up on macOS)
|
|
487
484
|
self.logger.info(f"Scrolling up, amount: {amount}")
|
|
488
|
-
|
|
489
|
-
for _ in range(amount):
|
|
490
|
-
await self.computer.interface.hotkey("fn", "up")
|
|
491
|
-
await asyncio.sleep(0.1)
|
|
485
|
+
await self.computer.interface.scroll_up(amount)
|
|
492
486
|
|
|
493
487
|
# Wait briefly for UI changes
|
|
494
488
|
await asyncio.sleep(0.5)
|
agent/ui/gradio/app.py
CHANGED
|
@@ -22,7 +22,7 @@ Supported Agent Loops and Models:
|
|
|
22
22
|
Requirements:
|
|
23
23
|
- Mac with Apple Silicon (M1/M2/M3/M4)
|
|
24
24
|
- macOS 14 (Sonoma) or newer
|
|
25
|
-
- Python 3.
|
|
25
|
+
- Python 3.11+
|
|
26
26
|
- Lume CLI installed (https://github.com/trycua/cua)
|
|
27
27
|
- OpenAI or Anthropic API key
|
|
28
28
|
"""
|
|
@@ -31,6 +31,7 @@ import os
|
|
|
31
31
|
import asyncio
|
|
32
32
|
import logging
|
|
33
33
|
import json
|
|
34
|
+
import platform
|
|
34
35
|
from pathlib import Path
|
|
35
36
|
from typing import Dict, List, Optional, AsyncGenerator, Any, Tuple, Union
|
|
36
37
|
import gradio as gr
|
|
@@ -129,6 +130,9 @@ class GradioChatScreenshotHandler(DefaultCallbackHandler):
|
|
|
129
130
|
)
|
|
130
131
|
|
|
131
132
|
|
|
133
|
+
# Detect if current device is MacOS
|
|
134
|
+
is_mac = platform.system().lower() == "darwin"
|
|
135
|
+
|
|
132
136
|
# Map model names to specific provider model names
|
|
133
137
|
MODEL_MAPPINGS = {
|
|
134
138
|
"openai": {
|
|
@@ -165,7 +169,7 @@ MODEL_MAPPINGS = {
|
|
|
165
169
|
},
|
|
166
170
|
"uitars": {
|
|
167
171
|
# UI-TARS models using MLXVLM provider
|
|
168
|
-
"default": "mlx-community/UI-TARS-1.5-7B-4bit",
|
|
172
|
+
"default": "mlx-community/UI-TARS-1.5-7B-4bit" if is_mac else "tgi",
|
|
169
173
|
"mlx-community/UI-TARS-1.5-7B-4bit": "mlx-community/UI-TARS-1.5-7B-4bit",
|
|
170
174
|
"mlx-community/UI-TARS-1.5-7B-6bit": "mlx-community/UI-TARS-1.5-7B-6bit"
|
|
171
175
|
},
|
|
@@ -475,16 +479,18 @@ def create_gradio_ui(
|
|
|
475
479
|
if ollama_models:
|
|
476
480
|
omni_models += ollama_models
|
|
477
481
|
|
|
482
|
+
# Detect if current device is MacOS
|
|
483
|
+
is_mac = platform.system().lower() == "darwin"
|
|
484
|
+
|
|
478
485
|
# Format model choices
|
|
479
486
|
provider_to_models = {
|
|
480
487
|
"OPENAI": openai_models,
|
|
481
488
|
"ANTHROPIC": anthropic_models,
|
|
482
489
|
"OMNI": omni_models + ["Custom model (OpenAI compatible API)", "Custom model (ollama)"], # Add custom model options
|
|
483
|
-
"UITARS": [
|
|
490
|
+
"UITARS": ([
|
|
484
491
|
"mlx-community/UI-TARS-1.5-7B-4bit",
|
|
485
492
|
"mlx-community/UI-TARS-1.5-7B-6bit",
|
|
486
|
-
|
|
487
|
-
], # UI-TARS options with MLX models
|
|
493
|
+
] if is_mac else []) + ["Custom model (OpenAI compatible API)"], # UI-TARS options with MLX models
|
|
488
494
|
}
|
|
489
495
|
|
|
490
496
|
# --- Apply Saved Settings (override defaults if available) ---
|
|
@@ -730,10 +736,14 @@ if __name__ == "__main__":
|
|
|
730
736
|
info="Select the operating system for the computer",
|
|
731
737
|
)
|
|
732
738
|
|
|
739
|
+
# Detect if current device is MacOS
|
|
740
|
+
is_mac = platform.system().lower() == "darwin"
|
|
741
|
+
|
|
733
742
|
computer_provider = gr.Radio(
|
|
734
743
|
choices=["cloud", "lume"],
|
|
735
744
|
label="Provider",
|
|
736
|
-
value="lume",
|
|
745
|
+
value="lume" if is_mac else "cloud",
|
|
746
|
+
visible=is_mac,
|
|
737
747
|
info="Select the computer provider",
|
|
738
748
|
)
|
|
739
749
|
|
|
@@ -1445,7 +1455,7 @@ if __name__ == "__main__":
|
|
|
1445
1455
|
def test_cua():
|
|
1446
1456
|
"""Standalone function to launch the Gradio app."""
|
|
1447
1457
|
demo = create_gradio_ui()
|
|
1448
|
-
demo.launch(share=False) # Don't create a public link
|
|
1458
|
+
demo.launch(share=False, inbrowser=True) # Don't create a public link
|
|
1449
1459
|
|
|
1450
1460
|
|
|
1451
1461
|
if __name__ == "__main__":
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cua-agent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: CUA (Computer Use) Agent for AI-driven computer interaction
|
|
5
5
|
Author-Email: TryCua <gh@trycua.com>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
7
|
Requires-Dist: httpx<0.29.0,>=0.27.0
|
|
8
8
|
Requires-Dist: aiohttp<4.0.0,>=3.9.3
|
|
9
9
|
Requires-Dist: asyncio
|
|
@@ -8,7 +8,7 @@ agent/core/factory.py,sha256=zzlCdibctqhf8Uta-SrvE-G7h59wAw-7SGhHiGvS9GY,4608
|
|
|
8
8
|
agent/core/messages.py,sha256=-OVMDqcxK5MUHPEkHliK29XFJYMRAc1keFvzrUyrOmM,16231
|
|
9
9
|
agent/core/provider_config.py,sha256=jB3fLsEsf806HQZ8jtzfSq4bCYGYONBeuCOoog_Nv_Y,768
|
|
10
10
|
agent/core/telemetry.py,sha256=HElPd32k_w2SJ6t-Cc3j_2-AKdLbFwh2YlM8QViDgRw,4790
|
|
11
|
-
agent/core/tools.py,sha256=
|
|
11
|
+
agent/core/tools.py,sha256=53aPme3O8U91n122Smu3TGbyGjQQe2zDimaZgKkFNi0,878
|
|
12
12
|
agent/core/tools/__init__.py,sha256=xZen-PqUp2dUaMEHJowXCQm33_5Sxhsx9PSoD0rq6tI,489
|
|
13
13
|
agent/core/tools/base.py,sha256=CdzRFNuOjNfzgyTUN4ZoCGkUDR5HI0ECQVpvrUdEij8,2295
|
|
14
14
|
agent/core/tools/bash.py,sha256=jnJKVlHn8np8e0gWd8EO0_qqjMkfQzutSugA_Iol4jE,1585
|
|
@@ -16,7 +16,7 @@ agent/core/tools/collection.py,sha256=NuwTn6dXSyznxWodfmFDQwUlxxaGb4oBPym4AEJABS
|
|
|
16
16
|
agent/core/tools/computer.py,sha256=lT_aW3huoYpcM8kffuokELupSz_WZG_qkaW1gITRC58,3892
|
|
17
17
|
agent/core/tools/edit.py,sha256=kv4jTKCM0VXrnoNErf7mT-xlr81-7T8v49_VA9y_L4Y,2005
|
|
18
18
|
agent/core/tools/manager.py,sha256=IRsCXjGc076nncQuyIjODoafnHTDhrf9sP5B4q5Pcdo,1742
|
|
19
|
-
agent/core/types.py,sha256=
|
|
19
|
+
agent/core/types.py,sha256=8DBbj2v9EYZ7e4NKbYHnZuWRsGV6tuij7FRSLRrg89I,2444
|
|
20
20
|
agent/core/visualization.py,sha256=1DuFF5sSeSf5BRSevBMDxml9-ajl7BQLFm5KBUwMbI8,6573
|
|
21
21
|
agent/providers/__init__.py,sha256=b4tIBAaIB1V7p8V0BWipHVnMhfHH_OuVgP4OWGSHdD8,194
|
|
22
22
|
agent/providers/anthropic/__init__.py,sha256=Mj11IZnVshZ2iHkvg4Z5-jrQIaD1WvzDz2Zk_pMwqIA,149
|
|
@@ -26,13 +26,13 @@ agent/providers/anthropic/api_handler.py,sha256=pWXcqDs0ruviDhRNRrz5Ac9ZH4yDv6Zl
|
|
|
26
26
|
agent/providers/anthropic/callbacks/__init__.py,sha256=PciBb6Z6MKSwfXqDjU3pV_0FS4MOn_Np_A7_skD-6dA,104
|
|
27
27
|
agent/providers/anthropic/callbacks/manager.py,sha256=euIah5yiM8nhisN-RWXewo6v0WQr0c-FbMBO04r6dJk,1865
|
|
28
28
|
agent/providers/anthropic/loop.py,sha256=Sepfo0b0oQT98xd3Sv2S7Xc81bfU7L4_Zv3VTiapKkg,21661
|
|
29
|
-
agent/providers/anthropic/prompts.py,sha256=
|
|
29
|
+
agent/providers/anthropic/prompts.py,sha256=EaqyvUb90yybv75VsBYzu4sroga7eMACys0uH9mIVWM,1993
|
|
30
30
|
agent/providers/anthropic/response_handler.py,sha256=ZTprV4NTP9Eb9jQ7QgEKZBX0L6rMj5nqBRiE3Zfws8I,8008
|
|
31
31
|
agent/providers/anthropic/tools/__init__.py,sha256=JyZwuVtPUnZwRSZBSCdQv9yxbLCsygm3l8Ywjjt9qTQ,661
|
|
32
32
|
agent/providers/anthropic/tools/base.py,sha256=WnRDbqO25tQzLpS2RU2ZXTLF5wd5IqU7SiyRAglQat4,2752
|
|
33
33
|
agent/providers/anthropic/tools/bash.py,sha256=QODuFjWuHM4GgGTqK2HizSyYqGqQwX70AdwrFiGSp2Q,2218
|
|
34
34
|
agent/providers/anthropic/tools/collection.py,sha256=RBK_6hxfHExR-EOxadiLl0OznmFj07nyIUjFgaYZ6Eo,960
|
|
35
|
-
agent/providers/anthropic/tools/computer.py,sha256=
|
|
35
|
+
agent/providers/anthropic/tools/computer.py,sha256=3MWMGOy_xDXOg5B7CvQDVNts2WQ9NcAyfzsLEMxt5ME,25627
|
|
36
36
|
agent/providers/anthropic/tools/edit.py,sha256=EGRP61MDA4Oue1D7Q-_vLpd6LdGbdBA1Z4HSZ66DbmI,13465
|
|
37
37
|
agent/providers/anthropic/tools/manager.py,sha256=yNvgTkfEqnOz5isDF0RxvmBMZB0uh2PipFEH-PUXpoY,2020
|
|
38
38
|
agent/providers/anthropic/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
|
|
@@ -79,8 +79,8 @@ agent/providers/uitars/utils.py,sha256=493STTEEJcVhVbQgR0e8rNTI1DjkxUx8IgIv3wkJ1
|
|
|
79
79
|
agent/telemetry.py,sha256=pVGxbj0ewnvq4EGj28CydN4a1iOfvZR_XKL3vIOqhOM,390
|
|
80
80
|
agent/ui/__init__.py,sha256=ohhxJLBin6k1hl5sKcmBST8mgh23WXgAXz3pN4f470E,45
|
|
81
81
|
agent/ui/gradio/__init__.py,sha256=ANKZhv1HqsLheWbLVBlyRQ7Q5qGeXuPi5jDs8vu-ZMo,579
|
|
82
|
-
agent/ui/gradio/app.py,sha256=
|
|
83
|
-
cua_agent-0.2.
|
|
84
|
-
cua_agent-0.2.
|
|
85
|
-
cua_agent-0.2.
|
|
86
|
-
cua_agent-0.2.
|
|
82
|
+
agent/ui/gradio/app.py,sha256=StBehGfPJhE6ywnxU3CHDPkZrOm_2XMT1Npepf89G5c,70675
|
|
83
|
+
cua_agent-0.2.7.dist-info/METADATA,sha256=Jdz7v8P_JvHbN1vEcIyDzf2a51FUJQ5D4WJqL9cLbyA,12688
|
|
84
|
+
cua_agent-0.2.7.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
|
85
|
+
cua_agent-0.2.7.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
86
|
+
cua_agent-0.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|