wcgw 1.1.0__tar.gz → 1.1.2__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.
- {wcgw-1.1.0 → wcgw-1.1.2}/PKG-INFO +1 -1
- {wcgw-1.1.0 → wcgw-1.1.2}/pyproject.toml +1 -1
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/tools.py +18 -13
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/relay/serve.py +6 -2
- {wcgw-1.1.0 → wcgw-1.1.2}/.github/workflows/python-publish.yml +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/.github/workflows/python-tests.yml +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/.gitignore +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/.python-version +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/.vscode/settings.json +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/README.md +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/config.toml +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/gpt_action_json_schema.json +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/gpt_instructions.txt +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/__init__.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/__init__.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/__init__.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/__main__.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/anthropic_client.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/cli.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/common.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/diff-instructions.txt +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/openai_client.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/client/openai_utils.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/relay/static/privacy.txt +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/src/wcgw/types_.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/static/ss1.png +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/tests/test_basic.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/tests/test_tools.py +0 -0
- {wcgw-1.1.0 → wcgw-1.1.2}/uv.lock +0 -0
|
@@ -9,6 +9,7 @@ import re
|
|
|
9
9
|
import sys
|
|
10
10
|
import threading
|
|
11
11
|
import importlib.metadata
|
|
12
|
+
import time
|
|
12
13
|
import traceback
|
|
13
14
|
from typing import (
|
|
14
15
|
Callable,
|
|
@@ -744,6 +745,7 @@ class Mdata(BaseModel):
|
|
|
744
745
|
| ResetShell
|
|
745
746
|
| FileEditFindReplace
|
|
746
747
|
| FullFileEdit
|
|
748
|
+
| str
|
|
747
749
|
)
|
|
748
750
|
|
|
749
751
|
|
|
@@ -754,20 +756,22 @@ def register_client(server_url: str, client_uuid: str = "") -> None:
|
|
|
754
756
|
client_uuid = str(uuid.uuid4())
|
|
755
757
|
|
|
756
758
|
# Create the WebSocket connection
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
759
|
+
try:
|
|
760
|
+
with syncconnect(f"{server_url}/{client_uuid}") as websocket:
|
|
761
|
+
server_version = str(websocket.recv())
|
|
762
|
+
print(f"Server version: {server_version}")
|
|
763
|
+
client_version = importlib.metadata.version("wcgw")
|
|
764
|
+
websocket.send(client_version)
|
|
765
|
+
|
|
766
|
+
print(
|
|
767
|
+
f"Connected. Share this user id with the chatbot: {client_uuid} \nLink: https://chatgpt.com/g/g-Us0AAXkRh-wcgw-giving-shell-access"
|
|
768
|
+
)
|
|
767
769
|
while True:
|
|
768
770
|
# Wait to receive data from the server
|
|
769
771
|
message = websocket.recv()
|
|
770
772
|
mdata = Mdata.model_validate_json(message)
|
|
773
|
+
if isinstance(mdata.data, str):
|
|
774
|
+
raise Exception(mdata)
|
|
771
775
|
try:
|
|
772
776
|
output, cost = get_tool_output(
|
|
773
777
|
mdata.data, default_enc, 0.0, lambda x, y: ("", 0), None
|
|
@@ -780,9 +784,10 @@ def register_client(server_url: str, client_uuid: str = "") -> None:
|
|
|
780
784
|
assert isinstance(output, str)
|
|
781
785
|
websocket.send(output)
|
|
782
786
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
787
|
+
except (websockets.ConnectionClosed, ConnectionError, OSError):
|
|
788
|
+
print(f"Connection closed for UUID: {client_uuid}, retrying")
|
|
789
|
+
time.sleep(0.5)
|
|
790
|
+
register_client(server_url, client_uuid)
|
|
786
791
|
|
|
787
792
|
|
|
788
793
|
run = Typer(pretty_exceptions_show_locals=False, no_args_is_help=True)
|
|
@@ -35,6 +35,7 @@ class Mdata(BaseModel):
|
|
|
35
35
|
| ResetShell
|
|
36
36
|
| FileEditFindReplace
|
|
37
37
|
| FullFileEdit
|
|
38
|
+
| str
|
|
38
39
|
)
|
|
39
40
|
user_id: UUID
|
|
40
41
|
|
|
@@ -48,7 +49,7 @@ gpts: dict[UUID, Callable[[str], None]] = {}
|
|
|
48
49
|
images: DefaultDict[UUID, dict[str, dict[str, Any]]] = DefaultDict(dict)
|
|
49
50
|
|
|
50
51
|
|
|
51
|
-
CLIENT_VERSION_MINIMUM = "1.
|
|
52
|
+
CLIENT_VERSION_MINIMUM = "1.1.0"
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
@app.websocket("/v1/register/{uuid}")
|
|
@@ -65,7 +66,10 @@ async def register_websocket(websocket: WebSocket, uuid: UUID) -> None:
|
|
|
65
66
|
sem_version_server = semantic_version.Version.coerce(CLIENT_VERSION_MINIMUM)
|
|
66
67
|
if sem_version_client < sem_version_server:
|
|
67
68
|
await websocket.send_text(
|
|
68
|
-
|
|
69
|
+
Mdata(
|
|
70
|
+
user_id=uuid,
|
|
71
|
+
data=f"Client version {client_version} is outdated. Please upgrade to {CLIENT_VERSION_MINIMUM} or higher.",
|
|
72
|
+
).model_dump_json()
|
|
69
73
|
)
|
|
70
74
|
await websocket.close(
|
|
71
75
|
reason="Client version outdated. Please upgrade to the latest version.",
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|