wcgw 1.5.3__py3-none-any.whl → 1.5.4__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 wcgw might be problematic. Click here for more details.

@@ -131,6 +131,7 @@ def loop(
131
131
  first_message: Optional[str] = None,
132
132
  limit: Optional[float] = None,
133
133
  resume: Optional[str] = None,
134
+ computer_use: bool = False,
134
135
  ) -> tuple[str, float]:
135
136
  load_dotenv()
136
137
 
@@ -222,10 +223,14 @@ def loop(
222
223
  - Use SEARCH/REPLACE blocks to edit the file.
223
224
  """,
224
225
  ),
225
- ToolParam(
226
- input_schema=GetScreenInfo.model_json_schema(),
227
- name="GetScreenInfo",
228
- description="""
226
+ ]
227
+
228
+ if computer_use:
229
+ tools += [
230
+ ToolParam(
231
+ input_schema=GetScreenInfo.model_json_schema(),
232
+ name="GetScreenInfo",
233
+ description="""
229
234
  - Important: call this first in the conversation before ScreenShot, Mouse, and Keyboard tools.
230
235
  - Get display information of a linux os running on docker using image "ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest"
231
236
  - If user hasn't provided docker image id, check using `docker ps` and provide the id.
@@ -233,11 +238,11 @@ def loop(
233
238
  - Connects shell to the docker environment.
234
239
  - Note: once this is called, the shell enters the docker environment. All bash commands will run over there.
235
240
  """,
236
- ),
237
- ToolParam(
238
- input_schema=ScreenShot.model_json_schema(),
239
- name="ScreenShot",
240
- description="""
241
+ ),
242
+ ToolParam(
243
+ input_schema=ScreenShot.model_json_schema(),
244
+ name="ScreenShot",
245
+ description="""
241
246
  - Capture screenshot of the linux os on docker.
242
247
  - All actions on UI using mouse and keyboard return within 0.5 seconds.
243
248
  * So if you're doing something that takes longer for UI to update like heavy page loading, keep checking UI for update usign ScreenShot upto 10 turns.
@@ -246,27 +251,27 @@ def loop(
246
251
  * If you don't notice even slightest of the change, it's likely you clicked on the wrong place.
247
252
 
248
253
  """,
249
- ),
250
- ToolParam(
251
- input_schema=Mouse.model_json_schema(),
252
- name="Mouse",
253
- description="""
254
+ ),
255
+ ToolParam(
256
+ input_schema=Mouse.model_json_schema(),
257
+ name="Mouse",
258
+ description="""
254
259
  - Interact with the linux os on docker using mouse.
255
260
  - Uses xdotool
256
261
  - About left_click_drag: the current mouse position will be used as the starting point, click and drag to the given x, y coordinates. Useful in things like sliders, moving things around, etc.
257
262
  """,
258
- ),
259
- ToolParam(
260
- input_schema=Keyboard.model_json_schema(),
261
- name="Keyboard",
262
- description="""
263
+ ),
264
+ ToolParam(
265
+ input_schema=Keyboard.model_json_schema(),
266
+ name="Keyboard",
267
+ description="""
263
268
  - Interact with the linux os on docker using keyboard.
264
269
  - Emulate keyboard input to the screen
265
270
  - Uses xdootool to send keyboard input, keys like Return, BackSpace, Escape, Page_Up, etc. can be used.
266
271
  - Do not use it to interact with Bash tool.
267
272
  """,
268
- ),
269
- ]
273
+ ),
274
+ ]
270
275
  uname_sysname = os.uname().sysname
271
276
  uname_machine = os.uname().machine
272
277
 
wcgw/client/cli.py CHANGED
@@ -16,6 +16,7 @@ def loop(
16
16
  first_message: Optional[str] = None,
17
17
  limit: Optional[float] = None,
18
18
  resume: Optional[str] = None,
19
+ computer_use: bool = False,
19
20
  version: bool = typer.Option(False, "--version", "-v"),
20
21
  ) -> tuple[str, float]:
21
22
  if version:
@@ -27,6 +28,7 @@ def loop(
27
28
  first_message=first_message,
28
29
  limit=limit,
29
30
  resume=resume,
31
+ computer_use=computer_use,
30
32
  )
31
33
  else:
32
34
  return openai_loop(
@@ -31,15 +31,39 @@ Then restart claude app.
31
31
 
32
32
  ### [Optional] Computer use support using desktop on docker
33
33
 
34
- Computer use is enabled by default. Claude will be able to connect to any docker container with linux environment. Native system control isn't supported outside docker.
34
+ Computer use is disabled by default. Add `--computer-use` to enable it. This will add necessary tools to Claude including ScreenShot, Mouse and Keyboard control.
35
35
 
36
- First run a sample docker image with desktop and optionally VNC connection:
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "wcgw": {
40
+ "command": "uv",
41
+ "args": [
42
+ "tool",
43
+ "run",
44
+ "--from",
45
+ "wcgw@latest",
46
+ "--python",
47
+ "3.12",
48
+ "wcgw_mcp",
49
+ "--computer-use"
50
+ ]
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ Claude will be able to connect to any docker container with linux environment. Native system control isn't supported outside docker.
57
+
58
+ You'll need to run a docker image with desktop and optional VNC connection. Here's a demo image:
37
59
 
38
60
  ```sh
39
61
  docker run -p 6080:6080 ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest
40
62
  ```
41
63
 
42
- Connect to `http://localhost:6080/vnc.html` for desktop view (VNC) of the system running in the docker. Then ask claude desktop app to control the docker os.
64
+ Then ask claude desktop app to control the docker os. It'll connect to the docker container and control it.
65
+
66
+ Connect to `http://localhost:6080/vnc.html` for desktop view (VNC) of the system running in the docker.
43
67
 
44
68
  ## Usage
45
69
 
@@ -1,10 +1,14 @@
1
1
  from wcgw.client.mcp_server import server
2
2
  import asyncio
3
+ from typer import Typer
3
4
 
5
+ main = Typer()
4
6
 
5
- def main():
7
+
8
+ @main.command()
9
+ def app(computer_use: bool = False) -> None:
6
10
  """Main entry point for the package."""
7
- asyncio.run(server.main())
11
+ asyncio.run(server.main(computer_use))
8
12
 
9
13
 
10
14
  # Optionally expose other important items at package level
@@ -32,6 +32,8 @@ from ..computer_use import SLEEP_TIME_MAX_S
32
32
 
33
33
  tools.TIMEOUT = SLEEP_TIME_MAX_S
34
34
 
35
+ COMPUTER_USE_ON_DOCKER_ENABLED = False
36
+
35
37
  server = Server("wcgw")
36
38
 
37
39
 
@@ -71,7 +73,7 @@ async def handle_list_tools() -> list[types.Tool]:
71
73
  ) as f:
72
74
  diffinstructions = f.read()
73
75
 
74
- return [
76
+ tools = [
75
77
  ToolParam(
76
78
  inputSchema=Initialize.model_json_schema(),
77
79
  name="Initialize",
@@ -142,17 +144,13 @@ async def handle_list_tools() -> list[types.Tool]:
142
144
  """
143
145
  + diffinstructions,
144
146
  ),
145
- ToolParam(
146
- inputSchema=ReadImage.model_json_schema(),
147
- name="ReadImage",
148
- description="""
149
- - Read an image from the shell.
150
- """,
151
- ),
152
- ToolParam(
153
- inputSchema=GetScreenInfo.model_json_schema(),
154
- name="GetScreenInfo",
155
- description="""
147
+ ]
148
+ if COMPUTER_USE_ON_DOCKER_ENABLED:
149
+ tools += [
150
+ ToolParam(
151
+ inputSchema=GetScreenInfo.model_json_schema(),
152
+ name="GetScreenInfo",
153
+ description="""
156
154
  - Important: call this first in the conversation before ScreenShot, Mouse, and Keyboard tools.
157
155
  - Get display information of a linux os running on docker using image "ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest"
158
156
  - If user hasn't provided docker image id, check using `docker ps` and provide the id.
@@ -160,11 +158,11 @@ async def handle_list_tools() -> list[types.Tool]:
160
158
  - Connects shell to the docker environment.
161
159
  - Note: once this is called, the shell enters the docker environment. All bash commands will run over there.
162
160
  """,
163
- ),
164
- ToolParam(
165
- inputSchema=ScreenShot.model_json_schema(),
166
- name="ScreenShot",
167
- description="""
161
+ ),
162
+ ToolParam(
163
+ inputSchema=ScreenShot.model_json_schema(),
164
+ name="ScreenShot",
165
+ description="""
168
166
  - Capture screenshot of the linux os on docker.
169
167
  - All actions on UI using mouse and keyboard return within 0.5 seconds.
170
168
  * So if you're doing something that takes longer for UI to update like heavy page loading, keep checking UI for update usign ScreenShot upto 10 turns.
@@ -172,28 +170,30 @@ async def handle_list_tools() -> list[types.Tool]:
172
170
  * After 10 turns of no change, ask user for permission to keep checking.
173
171
  * If you don't notice even slightest of the change, it's likely you clicked on the wrong place.
174
172
  """,
175
- ),
176
- ToolParam(
177
- inputSchema=Mouse.model_json_schema(),
178
- name="Mouse",
179
- description="""
173
+ ),
174
+ ToolParam(
175
+ inputSchema=Mouse.model_json_schema(),
176
+ name="Mouse",
177
+ description="""
180
178
  - Interact with the linux os on docker using mouse.
181
179
  - Uses xdotool
182
180
  - About left_click_drag: the current mouse position will be used as the starting point, click and drag to the given x, y coordinates. Useful in things like sliders, moving things around, etc.
183
181
  """,
184
- ),
185
- ToolParam(
186
- inputSchema=Keyboard.model_json_schema(),
187
- name="Keyboard",
188
- description="""
182
+ ),
183
+ ToolParam(
184
+ inputSchema=Keyboard.model_json_schema(),
185
+ name="Keyboard",
186
+ description="""
189
187
  - Interact with the linux os on docker using keyboard.
190
188
  - Emulate keyboard input to the screen
191
189
  - Uses xdootool to send keyboard input, keys like Return, BackSpace, Escape, Page_Up, etc. can be used.
192
190
  - Do not use it to interact with Bash tool.
193
191
  - Make sure you've selected a text area or an editable element before sending text.
194
192
  """,
195
- ),
196
- ]
193
+ ),
194
+ ]
195
+
196
+ return tools
197
197
 
198
198
 
199
199
  @server.call_tool() # type: ignore
@@ -263,7 +263,11 @@ async def handle_call_tool(
263
263
  return content
264
264
 
265
265
 
266
- async def main() -> None:
266
+ async def main(computer_use: bool) -> None:
267
+ global COMPUTER_USE_ON_DOCKER_ENABLED
268
+ if computer_use:
269
+ COMPUTER_USE_ON_DOCKER_ENABLED = True
270
+
267
271
  version = importlib.metadata.version("wcgw")
268
272
  # Run the server using stdin/stdout streams
269
273
  async with mcp.server.stdio.stdio_server() as (read_stream, write_stream):
@@ -123,6 +123,7 @@ def loop(
123
123
  first_message: Optional[str] = None,
124
124
  limit: Optional[float] = None,
125
125
  resume: Optional[str] = None,
126
+ computer_use: bool = False,
126
127
  ) -> tuple[str, float]:
127
128
  load_dotenv()
128
129
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wcgw
3
- Version: 1.5.3
3
+ Version: 1.5.4
4
4
  Summary: What could go wrong giving full shell access to chatgpt?
5
5
  Project-URL: Homepage, https://github.com/rusiaaman/wcgw
6
6
  Author-email: Aman Rusia <gapypi@arcfu.com>
@@ -2,21 +2,21 @@ wcgw/__init__.py,sha256=9K2QW7QuSLhMTVbKbBYd9UUp-ZyrfBrxcjuD_xk458k,118
2
2
  wcgw/types_.py,sha256=rDz4olJS2zvYC13jzeOppA2tci-tVDyWAqeA5BesAaU,1773
3
3
  wcgw/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  wcgw/client/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
5
- wcgw/client/anthropic_client.py,sha256=c6nNNojsWLFWjMJcEsEp7g31Ps9SIgCqMk4dhrOn9V4,18314
6
- wcgw/client/cli.py,sha256=Oja42CHkVO8puqOXflko9NeephYCMa85aBmQTEjBZtI,932
5
+ wcgw/client/anthropic_client.py,sha256=r-8uv1qmORmqCWCeCrWS14589kn1qz7cq4r2TI3SgFQ,18477
6
+ wcgw/client/cli.py,sha256=-z0kpDAW3mzfQrQeZfaVJhBCAQY3HXnt9GdgQ8s-u0Y,1003
7
7
  wcgw/client/common.py,sha256=grH-yV_4tnTQZ29xExn4YicGLxEq98z-HkEZwH0ReSg,1410
8
8
  wcgw/client/computer_use.py,sha256=eGiINKfgY8WWT-NDUa6vUKd1MTWE7dTjSlvjZHPCWzc,14870
9
9
  wcgw/client/diff-instructions.txt,sha256=s5AJKG23JsjwRYhFZFQVvwDpF67vElawrmdXwvukR1A,1683
10
- wcgw/client/openai_client.py,sha256=L61ajFVQW2QPS3C0n1YsjgF4vQKfMIZHmp6iFBHutX8,17748
10
+ wcgw/client/openai_client.py,sha256=F5TEv5DhU9twsywSZGtuVkPo6xVaaoaEjvIh88FnIUQ,17780
11
11
  wcgw/client/openai_utils.py,sha256=YNwCsA-Wqq7jWrxP0rfQmBTb1dI0s7dWXzQqyTzOZT4,2629
12
12
  wcgw/client/sys_utils.py,sha256=GajPntKhaTUMn6EOmopENWZNR2G_BJyuVbuot0x6veI,1376
13
13
  wcgw/client/tools.py,sha256=d7Fni7JU3aOh2vXBAw5k5rsxkdQVcxoxc5vipvEsA2g,32680
14
- wcgw/client/mcp_server/Readme.md,sha256=1hNZtqltsORug7OzUjjoK5O8q5s9-Y3S0_rlzT-Wfg4,2033
15
- wcgw/client/mcp_server/__init__.py,sha256=cQ7PUrEmXUpio8x0SEoGWP5hCRPd7z2bAkNCbYbtTys,236
16
- wcgw/client/mcp_server/server.py,sha256=i1nn16LSsbySm3LCt_T_D2G33nPtGNDJakp5FzKV6vQ,10416
14
+ wcgw/client/mcp_server/Readme.md,sha256=I8N4dHkTUVGNQ63BQkBMBhCCBTgqGOSF_pUR6iOEiUk,2495
15
+ wcgw/client/mcp_server/__init__.py,sha256=ucevqn5nkVG4ReENdXr_4ErpcTxj_4ZQ5H27VlCJzmI,337
16
+ wcgw/client/mcp_server/server.py,sha256=M9pJ3DktGsxf6cufXbZ0xxs0HIKNLGc75O_biV2UKYA,10571
17
17
  wcgw/relay/serve.py,sha256=RUcUeyL4Xt0EEo12Ul6VQjb4tRle4uIdsa85v7XXxEw,8771
18
18
  wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
19
- wcgw-1.5.3.dist-info/METADATA,sha256=9raP3OP6KWq5bzIEuwJ41_04g5fS5m1HVSNm-YI8Dkw,6508
20
- wcgw-1.5.3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
21
- wcgw-1.5.3.dist-info/entry_points.txt,sha256=eKo1omwbAggWlQ0l7GKoR7uV1-j16nk9tK0BhC2Oz_E,120
22
- wcgw-1.5.3.dist-info/RECORD,,
19
+ wcgw-1.5.4.dist-info/METADATA,sha256=qui2vxPVk00UvBUgtJayNuOP4USMTIivTJ2gdwe4Qps,6508
20
+ wcgw-1.5.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
21
+ wcgw-1.5.4.dist-info/entry_points.txt,sha256=eKo1omwbAggWlQ0l7GKoR7uV1-j16nk9tK0BhC2Oz_E,120
22
+ wcgw-1.5.4.dist-info/RECORD,,
File without changes