cua-computer 0.2.10__py3-none-any.whl → 0.2.11__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.
computer/ui/gradio/app.py CHANGED
@@ -528,13 +528,15 @@ async def execute(name, action, arguments):
528
528
 
529
529
  return results
530
530
 
531
- async def handle_init_computer(os_choice: str, app_list=None, provider="lume"):
532
- """Initialize the computer instance and tools for macOS or Ubuntu
531
+ async def handle_init_computer(os_choice: str, app_list=None, provider="lume", container_name=None, api_key=None):
532
+ """Initialize the computer instance and tools for macOS or Ubuntu or Windows
533
533
 
534
534
  Args:
535
- os_choice: The OS to use ("macOS" or "Ubuntu")
535
+ os_choice: The OS to use ("macOS" or "Ubuntu" or "Windows")
536
536
  app_list: Optional list of apps to focus on using the app-use experiment
537
- provider: The provider to use ("lume" or "self")
537
+ provider: The provider to use ("lume" or "self" or "cloud")
538
+ container_name: The container name to use for cloud provider
539
+ api_key: The API key to use for cloud provider
538
540
  """
539
541
  global computer, tool_call_logs, tools
540
542
 
@@ -548,6 +550,9 @@ async def handle_init_computer(os_choice: str, app_list=None, provider="lume"):
548
550
  if os_choice == "Ubuntu":
549
551
  os_type_str = "linux"
550
552
  image_str = "ubuntu-noble-vanilla:latest"
553
+ elif os_choice == "Windows":
554
+ os_type_str = "windows"
555
+ image_str = "windows-11-vanilla:latest"
551
556
  else:
552
557
  os_type_str = "macos"
553
558
  image_str = "macos-sequoia-cua:latest"
@@ -559,6 +564,22 @@ async def handle_init_computer(os_choice: str, app_list=None, provider="lume"):
559
564
  use_host_computer_server=True,
560
565
  experiments=experiments
561
566
  )
567
+ elif provider == "cloud":
568
+ # Use API key from environment variable or field input
569
+ cloud_api_key = os.environ.get("CUA_API_KEY") or api_key
570
+ computer = Computer(
571
+ os_type=os_type_str,
572
+ provider_type=VMProviderType.CLOUD,
573
+ name=container_name,
574
+ api_key=cloud_api_key,
575
+ experiments=experiments
576
+ )
577
+ elif provider == "winsandbox":
578
+ computer = Computer(
579
+ os_type="windows",
580
+ provider_type=VMProviderType.WINSANDBOX,
581
+ experiments=experiments
582
+ )
562
583
  else:
563
584
  computer = Computer(
564
585
  image=image_str,
@@ -596,6 +617,10 @@ async def handle_init_computer(os_choice: str, app_list=None, provider="lume"):
596
617
  init_params["apps"] = app_list
597
618
  init_params["experiments"] = ["app-use"]
598
619
 
620
+ # Add container name to the log if using cloud provider
621
+ if provider == "cloud":
622
+ init_params["container_name"] = container_name
623
+
599
624
  result = await execute("computer", "initialize", init_params)
600
625
 
601
626
  return result["screenshot"], json.dumps(tool_call_logs, indent=2)
@@ -1065,19 +1090,38 @@ def create_gradio_ui():
1065
1090
  with gr.Row():
1066
1091
  os_choice = gr.Radio(
1067
1092
  label="OS",
1068
- choices=["macOS", "Ubuntu"],
1093
+ choices=["macOS", "Ubuntu", "Windows"],
1069
1094
  value="macOS",
1070
- interactive=False # disable until the ubuntu image is ready
1071
1095
  )
1072
1096
 
1073
1097
  # Provider selection radio
1074
1098
  provider_choice = gr.Radio(
1075
1099
  label="Provider",
1076
- choices=["lume", "self"],
1100
+ choices=["lume", "self", "cloud", "winsandbox"],
1077
1101
  value="lume",
1078
- info="'lume' uses a VM, 'self' uses the host computer server"
1102
+ info="'lume' uses a VM, 'self' uses the host computer server, 'cloud' uses a cloud container"
1079
1103
  )
1080
1104
 
1105
+ # Container name field for cloud provider (initially hidden)
1106
+ container_name = gr.Textbox(
1107
+ label="Container Name",
1108
+ placeholder="Enter your container name",
1109
+ visible=False,
1110
+ info="Get your container from [trycua.com](https://trycua.com/)"
1111
+ )
1112
+
1113
+ # Check if CUA_API_KEY is set in environment
1114
+ has_cua_key = os.environ.get("CUA_API_KEY") is not None
1115
+
1116
+ # API key field for cloud provider (visible only if no env key and cloud selected)
1117
+ api_key_field = gr.Textbox(
1118
+ label="CUA API Key",
1119
+ placeholder="Enter your CUA API key",
1120
+ type="password",
1121
+ visible=False,
1122
+ info="Required for cloud provider. Set CUA_API_KEY environment variable to hide this field."
1123
+ )
1124
+
1081
1125
  # App filtering dropdown for app-use experiment
1082
1126
  app_filter = gr.Dropdown(
1083
1127
  label="Filter by apps (App-Use)",
@@ -1085,6 +1129,22 @@ def create_gradio_ui():
1085
1129
  allow_custom_value=True,
1086
1130
  info="When apps are selected, the computer will focus on those apps using the app-use experiment"
1087
1131
  )
1132
+
1133
+ # Function to show/hide container name and API key fields based on provider selection
1134
+ def update_cloud_fields_visibility(provider):
1135
+ show_container = provider == "cloud"
1136
+ show_api_key = provider == "cloud" and not has_cua_key
1137
+ return (
1138
+ gr.update(visible=show_container),
1139
+ gr.update(visible=show_api_key)
1140
+ )
1141
+
1142
+ # Connect provider choice to field visibility
1143
+ provider_choice.change(
1144
+ update_cloud_fields_visibility,
1145
+ inputs=provider_choice,
1146
+ outputs=[container_name, api_key_field]
1147
+ )
1088
1148
 
1089
1149
  start_btn = gr.Button("Initialize Computer")
1090
1150
 
@@ -1149,7 +1209,7 @@ def create_gradio_ui():
1149
1209
  value=False
1150
1210
  )
1151
1211
  message_submit_btn = gr.Button("Submit Message")
1152
- message_status = gr.Textbox(label="Status", value="")
1212
+ message_status = gr.Textbox(label="Status")
1153
1213
 
1154
1214
  with gr.Accordion("Clipboard Operations", open=False):
1155
1215
  clipboard_content = gr.Textbox(label="Clipboard Content")
@@ -1250,7 +1310,7 @@ def create_gradio_ui():
1250
1310
  )
1251
1311
 
1252
1312
  img.select(handle_click, inputs=[img, click_type], outputs=[img, action_log])
1253
- start_btn.click(handle_init_computer, inputs=[os_choice, app_filter, provider_choice], outputs=[img, action_log])
1313
+ start_btn.click(handle_init_computer, inputs=[os_choice, app_filter, provider_choice, container_name, api_key_field], outputs=[img, action_log])
1254
1314
  wait_btn.click(handle_wait, outputs=[img, action_log])
1255
1315
 
1256
1316
  # DONE and FAIL buttons just do a placeholder action
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cua-computer
3
- Version: 0.2.10
3
+ Version: 0.2.11
4
4
  Summary: Computer-Use Interface (CUI) framework powering Cua
5
5
  Author-Email: TryCua <gh@trycua.com>
6
6
  Requires-Python: >=3.11
@@ -1,31 +1,36 @@
1
1
  computer/__init__.py,sha256=QOxNrrJAuLRnsUC2zIFgRfzVSuDSXiYHlEF-9vkhV0o,1241
2
- computer/computer.py,sha256=vFJEyMkvTlT49SEO1QgLe8yMX6DbvdI9eDWjSd3CwCQ,40555
2
+ computer/computer.py,sha256=fwB5ZdyZqUopWSPunHIo_r3iECVAIm0ICmRcapF9UlI,41379
3
3
  computer/diorama_computer.py,sha256=jOP7_eXxxU6SMIoE25ni0YXPK0E7p5sZeLKmkYLh6G8,3871
4
4
  computer/helpers.py,sha256=0ob9d9ynVGi0JRxhHCgXTuHPHFpa8AVKldn6k0hvxOo,1766
5
5
  computer/interface/__init__.py,sha256=xQvYjq5PMn9ZJOmRR5mWtONTl_0HVd8ACvW6AQnzDdw,262
6
6
  computer/interface/base.py,sha256=Uc3pp-8_9YJpawAwt1ixaVN3N0_MtY6nAOSvuKy0Mpc,7863
7
- computer/interface/factory.py,sha256=RjAZAB_jFuS8JierYjLbapRX6RqFE0qE3BiIyP5UDOE,1441
7
+ computer/interface/factory.py,sha256=Eas5u9sOZ8FegwX51dP9M37oZBjy2EiVcmhTPc98L3Y,1639
8
8
  computer/interface/linux.py,sha256=40SXd-xqYWFUaTnx3Tf7lIDEtluNwYoDkCZaESkIvRE,30468
9
9
  computer/interface/macos.py,sha256=uFU9bmPJqPPxlUBw9u1TG3ksqXqB4azJ0pYYx9cRM6w,30848
10
10
  computer/interface/models.py,sha256=CYbX3PLlWqjFuDiLWMiBzPmmXB8_g9VNLfBFBC6RtvI,3317
11
+ computer/interface/windows.py,sha256=fy1sNATU3vq9pp9AhDR3BW3afmKJr6ff0e-odMfy1Ds,30442
11
12
  computer/logger.py,sha256=UVvnmZGOWVF9TCsixEbeQnDZ3wBPAJ2anW3Zp-MoJ8Y,2896
12
13
  computer/models.py,sha256=iFNM1QfZArD8uf66XJXb2EDIREsfrxqqA5_liLBMfrE,1188
13
14
  computer/providers/__init__.py,sha256=hS9lLxmmHa1u82XJJ_xuqSKipClsYUEPx-8OK9ogtVg,194
14
- computer/providers/base.py,sha256=J_9r6pJsvGAFDRl56jog_atN7e8uzrvlCQEdRRqye_U,3624
15
+ computer/providers/base.py,sha256=BKYp61EheHoBua7JYHvxj8q-7BZQ_vdIsemBpPOLddA,3654
15
16
  computer/providers/cloud/__init__.py,sha256=SDAcfhI2BlmVBrBZOHxQd3i1bJZjMIfl7QgmqjXa4z8,144
16
17
  computer/providers/cloud/provider.py,sha256=XEdCrnZzRwvvkPHIwfhfJl3xB6W7tZKdBI0duKEXLw4,2930
17
- computer/providers/factory.py,sha256=9qVdt-fIovSNOokGMZ_2B1VPCLSZeDky4edcXyelZy4,4616
18
+ computer/providers/factory.py,sha256=T0G9lhFUofCXzQGf6C-pdHlquFXMiuy_IbQaOgIOgRQ,5677
18
19
  computer/providers/lume/__init__.py,sha256=E6hTbVQF5lLZD8JyG4rTwUnCBO4q9K8UkYNQ31R0h7c,193
19
20
  computer/providers/lume/provider.py,sha256=grLZeXd4Y8iYsNq2gfNGcQq1bnTcNYNepEv-mxmROG4,20562
20
21
  computer/providers/lume_api.py,sha256=qLYFYdWtWVxWjMq8baiqlIW2EUaen4Gl2Tc1Qr_QEig,20196
21
22
  computer/providers/lumier/__init__.py,sha256=qz8coMA2K5MVoqNC12SDXJe6lI7z2pn6RHssUOMY5Ug,212
22
23
  computer/providers/lumier/provider.py,sha256=CXwAKwJfR9ALFGM5u7UIZ-YrFwPvew_01wTe7dVmVbQ,46751
24
+ computer/providers/winsandbox/__init__.py,sha256=WsMVBBa_qFfqVHPQzg6j4PegQwLiIudkzUedpYkrfXU,244
25
+ computer/providers/winsandbox/provider.py,sha256=4D5C6VGmxyNdsDqojzO4O9Nn2GCOVmN6BT78euF-OSU,18374
26
+ computer/providers/winsandbox/setup_script.ps1,sha256=8aGwR7PEvqnYzCNyXTDKIwJ6pYrwyWYLRjmNT_jYIwQ,4623
23
27
  computer/telemetry.py,sha256=FvNFpxgeRuCMdNpREuSL7bOMZy9gSzY4J0rLeNDw0CU,3746
24
28
  computer/ui/__init__.py,sha256=pmo05ek9qiB_x7DPeE6Vf_8RsIOqTD0w1dBLMHfoOnY,45
29
+ computer/ui/__main__.py,sha256=Jwy2oC_mGZLN0fX7WLqpjaQkbXMeM3ISrUc8WSRUG0c,284
25
30
  computer/ui/gradio/__init__.py,sha256=5_KimixM48-X74FCsLw7LbSt39MQfUMEL8-M9amK3Cw,117
26
- computer/ui/gradio/app.py,sha256=pLMoMpxyKsGhg9wlsiqyKiRujd-lzubs0nGWAtkleL0,67316
31
+ computer/ui/gradio/app.py,sha256=5_AG2dQR9RtFrGQNonScAw64rlswclKW26tYlFBdXtM,70396
27
32
  computer/utils.py,sha256=zY50NXB7r51GNLQ6l7lhG_qv0_ufpQ8n0-SDhCei8m4,2838
28
- cua_computer-0.2.10.dist-info/METADATA,sha256=dC5av4YtGJH20X77m7FPpn8J1bUFmU1p1J7qJX32HGs,5845
29
- cua_computer-0.2.10.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
30
- cua_computer-0.2.10.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
31
- cua_computer-0.2.10.dist-info/RECORD,,
33
+ cua_computer-0.2.11.dist-info/METADATA,sha256=-0kqb0i_9GyyhM3I1-FnHh_Ajt7E8ujHurdJNGeNq7E,5845
34
+ cua_computer-0.2.11.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
35
+ cua_computer-0.2.11.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
36
+ cua_computer-0.2.11.dist-info/RECORD,,