wcgw 1.0.0__tar.gz → 1.0.1__tar.gz

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.

@@ -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
 
@@ -74,7 +74,7 @@ https://github.com/rusiaaman/wcgw/blob/main/gpt_instructions.txt
74
74
  https://github.com/rusiaaman/wcgw/blob/main/gpt_action_json_schema.json
75
75
 
76
76
  Run the server
77
- `gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
77
+ `gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.wcgw.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
78
78
 
79
79
  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.
80
80
 
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "servers": [
8
8
  {
9
- "url": "https://604f-2401-4900-1c8e-e61d-40fc-eab7-f5c2-c8ad.ngrok-free.app"
9
+ "url": "https://bf94-103-212-152-58.ngrok-free.app"
10
10
  }
11
11
  ],
12
12
  "paths": {
@@ -324,24 +324,6 @@
324
324
  ],
325
325
  "title": "ValidationError"
326
326
  },
327
- "Writefile": {
328
- "properties": {
329
- "file_path": {
330
- "type": "string",
331
- "title": "File Path"
332
- },
333
- "file_content": {
334
- "type": "string",
335
- "title": "File Content"
336
- }
337
- },
338
- "type": "object",
339
- "required": [
340
- "file_path",
341
- "file_content"
342
- ],
343
- "title": "Writefile"
344
- },
345
327
  "WritefileWithUUID": {
346
328
  "properties": {
347
329
  "file_path": {
@@ -7,7 +7,7 @@ Instructions:
7
7
  - Ask user for confirmation before running anything major
8
8
 
9
9
 
10
- To execute bash commands OR write files use the provided api `wcgw.arcfu.com`
10
+ To execute bash commands OR write files use the provided api.
11
11
 
12
12
  Instructions for `BashCommand`:
13
13
  - Execute a bash command. This is stateful (beware with subsequent calls).
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  authors = [{ name = "Aman Rusia", email = "gapypi@arcfu.com" }]
3
3
  name = "wcgw"
4
- version = "1.0.0"
4
+ version = "1.0.1"
5
5
  description = "What could go wrong giving full shell access to chatgpt?"
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.10, <3.13"
@@ -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}"
@@ -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
  import unittest
2
2
  from unittest.mock import patch, mock_open
3
- from src.wcgw.basic import text_from_editor, save_history, parse_user_message_special, Config
3
+ from src.wcgw.client.basic import text_from_editor, save_history, parse_user_message_special, Config
4
4
  import os
5
5
  import tempfile
6
6
  import json
@@ -1,7 +1,7 @@
1
1
  import unittest
2
2
  from unittest.mock import patch
3
- from src.wcgw.tools import render_terminal_output, ask_confirmation, Confirmation
4
- from types_ import Writefile
3
+ from src.wcgw.client.tools import render_terminal_output, ask_confirmation, Confirmation
4
+ from src.wcgw.types_ import Writefile
5
5
 
6
6
 
7
7
  class TestTools(unittest.TestCase):
@@ -930,7 +930,7 @@ wheels = [
930
930
 
931
931
  [[package]]
932
932
  name = "wcgw"
933
- version = "1.0.0"
933
+ version = "1.0.1"
934
934
  source = { editable = "." }
935
935
  dependencies = [
936
936
  { name = "fastapi" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes