wcgw 1.0.0__py3-none-any.whl → 1.0.1__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.

wcgw/client/tools.py CHANGED
@@ -2,6 +2,7 @@ import asyncio
2
2
  import base64
3
3
  import json
4
4
  import mimetypes
5
+ from pathlib import Path
5
6
  import re
6
7
  import sys
7
8
  import threading
@@ -404,11 +405,15 @@ def read_image_from_shell(file_path: str) -> ImageData:
404
405
 
405
406
  def write_file(writefile: Writefile) -> str:
406
407
  if not os.path.isabs(writefile.file_path):
407
- path_ = os.path.join(CWD, writefile.file_path)
408
+ return "Failure: file_path should be absolute path"
408
409
  else:
409
410
  path_ = writefile.file_path
411
+
412
+ path = Path(path_)
413
+ path.parent.mkdir(parents=True, exist_ok=True)
414
+
410
415
  try:
411
- with open(path_, "w") as f:
416
+ with path.open("w") as f:
412
417
  f.write(writefile.file_content)
413
418
  except OSError as e:
414
419
  return f"Error: {e}"
wcgw/relay/serve.py CHANGED
@@ -132,9 +132,7 @@ class WritefileWithUUID(Writefile):
132
132
  async def write_file(write_file_data: WritefileWithUUID) -> str:
133
133
  user_id = write_file_data.user_id
134
134
  if user_id not in clients:
135
- raise fastapi.HTTPException(
136
- status_code=404, detail="User with the provided id not found"
137
- )
135
+ return "Failure: id not found, ask the user to check it."
138
136
 
139
137
  results: Optional[str] = None
140
138
 
@@ -165,9 +163,7 @@ async def file_edit_find_replace(
165
163
  ) -> str:
166
164
  user_id = file_edit_find_replace.user_id
167
165
  if user_id not in clients:
168
- raise fastapi.HTTPException(
169
- status_code=404, detail="User with the provided id not found"
170
- )
166
+ return "Failure: id not found, ask the user to check it."
171
167
 
172
168
  results: Optional[str] = None
173
169
 
@@ -201,9 +197,7 @@ class ResetShellWithUUID(ResetShell):
201
197
  async def reset_shell(reset_shell: ResetShellWithUUID) -> str:
202
198
  user_id = reset_shell.user_id
203
199
  if user_id not in clients:
204
- raise fastapi.HTTPException(
205
- status_code=404, detail="User with the provided id not found"
206
- )
200
+ return "Failure: id not found, ask the user to check it."
207
201
 
208
202
  results: Optional[str] = None
209
203
 
@@ -241,9 +235,7 @@ class CommandWithUUID(BaseModel):
241
235
  async def bash_command(command: CommandWithUUID) -> str:
242
236
  user_id = command.user_id
243
237
  if user_id not in clients:
244
- raise fastapi.HTTPException(
245
- status_code=404, detail="User with the provided id not found"
246
- )
238
+ return "Failure: id not found, ask the user to check it."
247
239
 
248
240
  results: Optional[str] = None
249
241
 
@@ -274,9 +266,7 @@ class BashInteractionWithUUID(BashInteraction):
274
266
  async def bash_interaction(bash_interaction: BashInteractionWithUUID) -> str:
275
267
  user_id = bash_interaction.user_id
276
268
  if user_id not in clients:
277
- raise fastapi.HTTPException(
278
- status_code=404, detail="User with the provided id not found"
279
- )
269
+ return "Failure: id not found, ask the user to check it."
280
270
 
281
271
  results: Optional[str] = None
282
272
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wcgw
3
- Version: 1.0.0
3
+ Version: 1.0.1
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>
@@ -101,7 +101,7 @@ https://github.com/rusiaaman/wcgw/blob/main/gpt_instructions.txt
101
101
  https://github.com/rusiaaman/wcgw/blob/main/gpt_action_json_schema.json
102
102
 
103
103
  Run the server
104
- `gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
104
+ `gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.wcgw.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
105
105
 
106
106
  If you don't have public ip and domain name, you can use `ngrok` or similar services to get a https address to the api.
107
107
 
@@ -6,10 +6,10 @@ wcgw/client/claude.py,sha256=Bp45-UMBIJd-4tzX618nu-SpRbVtkTb1Es6c_gW6xy0,14861
6
6
  wcgw/client/common.py,sha256=grH-yV_4tnTQZ29xExn4YicGLxEq98z-HkEZwH0ReSg,1410
7
7
  wcgw/client/openai_adapters.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  wcgw/client/openai_utils.py,sha256=YNwCsA-Wqq7jWrxP0rfQmBTb1dI0s7dWXzQqyTzOZT4,2629
9
- wcgw/client/tools.py,sha256=UHPbpaQ70sFzE5_TYYyhV2FAE6BcbEgyRrTexaIpT6Y,21108
10
- wcgw/relay/serve.py,sha256=y2jGbZ0vKKONOD8TkJjSAaH8N6qGLa-rFtj5DxjUFIw,8916
9
+ wcgw/client/tools.py,sha256=Ggm5QrSQiyv3Bnme-O9eo_8dXFwS1srCAoow-pODDSE,21212
10
+ wcgw/relay/serve.py,sha256=e3oo4trAWmEKJWcLOsdZCICyEXUCqrI-71DaFnPKI70,8641
11
11
  wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
12
- wcgw-1.0.0.dist-info/METADATA,sha256=8OScNwT6aecVULmjuk2oEPNIYGrhhMaAdybsdm57kYM,5217
13
- wcgw-1.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
14
- wcgw-1.0.0.dist-info/entry_points.txt,sha256=WlIB825-Vm9ZtNzgENQsbHj4DRMkbpVR7uSkQyBlaPA,93
15
- wcgw-1.0.0.dist-info/RECORD,,
12
+ wcgw-1.0.1.dist-info/METADATA,sha256=O2BPohrX_Eo6RRuWfY18Cz8MX6qTlgSnExa52Nd8Ggg,5222
13
+ wcgw-1.0.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
14
+ wcgw-1.0.1.dist-info/entry_points.txt,sha256=WlIB825-Vm9ZtNzgENQsbHj4DRMkbpVR7uSkQyBlaPA,93
15
+ wcgw-1.0.1.dist-info/RECORD,,
File without changes