wcgw 2.3.0__py3-none-any.whl → 2.3.2__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/mcp_server/server.py +5 -2
- wcgw/client/tools.py +19 -8
- {wcgw-2.3.0.dist-info → wcgw-2.3.2.dist-info}/METADATA +1 -1
- {wcgw-2.3.0.dist-info → wcgw-2.3.2.dist-info}/RECORD +6 -6
- {wcgw-2.3.0.dist-info → wcgw-2.3.2.dist-info}/WHEEL +0 -0
- {wcgw-2.3.0.dist-info → wcgw-2.3.2.dist-info}/entry_points.txt +0 -0
wcgw/client/mcp_server/server.py
CHANGED
|
@@ -30,8 +30,6 @@ from ...types_ import (
|
|
|
30
30
|
)
|
|
31
31
|
from ..computer_use import SLEEP_TIME_MAX_S
|
|
32
32
|
|
|
33
|
-
tools.TIMEOUT = SLEEP_TIME_MAX_S
|
|
34
|
-
|
|
35
33
|
COMPUTER_USE_ON_DOCKER_ENABLED = False
|
|
36
34
|
|
|
37
35
|
server = Server("wcgw")
|
|
@@ -275,6 +273,11 @@ async def handle_call_tool(
|
|
|
275
273
|
|
|
276
274
|
async def main(computer_use: bool) -> None:
|
|
277
275
|
global COMPUTER_USE_ON_DOCKER_ENABLED
|
|
276
|
+
|
|
277
|
+
tools.TIMEOUT = SLEEP_TIME_MAX_S
|
|
278
|
+
|
|
279
|
+
tools.console = tools.DisableConsole()
|
|
280
|
+
|
|
278
281
|
if computer_use:
|
|
279
282
|
COMPUTER_USE_ON_DOCKER_ENABLED = True
|
|
280
283
|
|
wcgw/client/tools.py
CHANGED
|
@@ -72,7 +72,18 @@ from .common import CostData, Models, discard_input
|
|
|
72
72
|
from .sys_utils import command_run
|
|
73
73
|
from .openai_utils import get_input_cost, get_output_cost
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
|
|
76
|
+
class DisableConsole:
|
|
77
|
+
def print(self, *args, **kwargs): # type: ignore
|
|
78
|
+
pass
|
|
79
|
+
|
|
80
|
+
def log(self, *args, **kwargs): # type: ignore
|
|
81
|
+
pass
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
console: rich.console.Console | DisableConsole = rich.console.Console(
|
|
85
|
+
style="magenta", highlight=False, markup=False
|
|
86
|
+
)
|
|
76
87
|
|
|
77
88
|
TIMEOUT = 5
|
|
78
89
|
|
|
@@ -119,7 +130,7 @@ def start_shell() -> pexpect.spawn: # type: ignore
|
|
|
119
130
|
)
|
|
120
131
|
shell.sendline(f"export PS1={PROMPT}")
|
|
121
132
|
except Exception as e:
|
|
122
|
-
traceback.
|
|
133
|
+
console.print(traceback.format_exc())
|
|
123
134
|
console.log(f"Error starting shell: {e}. Retrying without rc ...")
|
|
124
135
|
|
|
125
136
|
shell = pexpect.spawn(
|
|
@@ -159,7 +170,7 @@ def _get_exit_code(shell: pexpect.spawn) -> int: # type: ignore
|
|
|
159
170
|
try:
|
|
160
171
|
shell.expect(PROMPT, timeout=0.2)
|
|
161
172
|
except pexpect.TIMEOUT:
|
|
162
|
-
print(f"Couldn't get exit code, before: {before}")
|
|
173
|
+
console.print(f"Couldn't get exit code, before: {before}")
|
|
163
174
|
raise
|
|
164
175
|
assert isinstance(shell.before, str)
|
|
165
176
|
# Render because there could be some anscii escape sequences still set like in google colab env
|
|
@@ -283,12 +294,12 @@ def update_repl_prompt(command: str) -> bool:
|
|
|
283
294
|
PROMPT = before.split("\n")[-1].strip()
|
|
284
295
|
# Escape all regex
|
|
285
296
|
PROMPT = re.escape(PROMPT)
|
|
286
|
-
print(f"Trying to update prompt to: {PROMPT.encode()!r}")
|
|
297
|
+
console.print(f"Trying to update prompt to: {PROMPT.encode()!r}")
|
|
287
298
|
index = 0
|
|
288
299
|
while index == 0:
|
|
289
300
|
# Consume all REPL prompts till now
|
|
290
301
|
index = BASH_STATE.shell.expect([PROMPT, pexpect.TIMEOUT], timeout=0.2)
|
|
291
|
-
print(f"Prompt updated to: {PROMPT}")
|
|
302
|
+
console.print(f"Prompt updated to: {PROMPT}")
|
|
292
303
|
return True
|
|
293
304
|
return False
|
|
294
305
|
|
|
@@ -484,7 +495,7 @@ Otherwise, you may want to try Ctrl-c again or program specific exit interactive
|
|
|
484
495
|
output += exit_status
|
|
485
496
|
except ValueError as e:
|
|
486
497
|
console.print(output)
|
|
487
|
-
traceback.
|
|
498
|
+
console.print(traceback.format_exc())
|
|
488
499
|
console.print("Malformed output, restarting shell", style="red")
|
|
489
500
|
# Malformed output, restart shell
|
|
490
501
|
BASH_STATE.reset()
|
|
@@ -508,7 +519,7 @@ def serve_image_in_bg(file_path: str, client_uuid: str, name: str) -> None:
|
|
|
508
519
|
try:
|
|
509
520
|
websocket.send(json.dumps(uu))
|
|
510
521
|
except websockets.ConnectionClosed:
|
|
511
|
-
print(f"Connection closed for UUID: {client_uuid}, retrying")
|
|
522
|
+
console.print(f"Connection closed for UUID: {client_uuid}, retrying")
|
|
512
523
|
serve_image_in_bg(file_path, client_uuid, name)
|
|
513
524
|
|
|
514
525
|
|
|
@@ -1139,7 +1150,7 @@ def register_client(server_url: str, client_uuid: str = "") -> None:
|
|
|
1139
1150
|
print(f"{curr_cost=}")
|
|
1140
1151
|
except Exception as e:
|
|
1141
1152
|
output = f"GOT EXCEPTION while calling tool. Error: {e}"
|
|
1142
|
-
traceback.
|
|
1153
|
+
console.print(traceback.format_exc())
|
|
1143
1154
|
assert isinstance(output, str)
|
|
1144
1155
|
websocket.send(output)
|
|
1145
1156
|
|
|
@@ -10,13 +10,13 @@ wcgw/client/diff-instructions.txt,sha256=s5AJKG23JsjwRYhFZFQVvwDpF67vElawrmdXwvu
|
|
|
10
10
|
wcgw/client/openai_client.py,sha256=uJ2l9NXsZuipUcJYR_bFcNNmNlfnCvPm6-M-LiVSVts,17942
|
|
11
11
|
wcgw/client/openai_utils.py,sha256=YNwCsA-Wqq7jWrxP0rfQmBTb1dI0s7dWXzQqyTzOZT4,2629
|
|
12
12
|
wcgw/client/sys_utils.py,sha256=GajPntKhaTUMn6EOmopENWZNR2G_BJyuVbuot0x6veI,1376
|
|
13
|
-
wcgw/client/tools.py,sha256=
|
|
13
|
+
wcgw/client/tools.py,sha256=99v3uZyTU5MDiPHm1GZ3Atpl9UZ8Ju4rAn2TCbFOjZk,40975
|
|
14
14
|
wcgw/client/mcp_server/Readme.md,sha256=I8N4dHkTUVGNQ63BQkBMBhCCBTgqGOSF_pUR6iOEiUk,2495
|
|
15
15
|
wcgw/client/mcp_server/__init__.py,sha256=hyPPwO9cabAJsOMWhKyat9yl7OlSmIobaoAZKHu3DMc,381
|
|
16
|
-
wcgw/client/mcp_server/server.py,sha256=
|
|
16
|
+
wcgw/client/mcp_server/server.py,sha256=y9oYFLrURxGySvbxcfiMiQMNvLpSMWuURi_UPxdM61k,11907
|
|
17
17
|
wcgw/relay/serve.py,sha256=KLYjTvM9CfqdxgFOfHM8LUkFGZ9kKyyJunpNdEIFQUk,8766
|
|
18
18
|
wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
|
|
19
|
-
wcgw-2.3.
|
|
20
|
-
wcgw-2.3.
|
|
21
|
-
wcgw-2.3.
|
|
22
|
-
wcgw-2.3.
|
|
19
|
+
wcgw-2.3.2.dist-info/METADATA,sha256=JmrhbMAmsmgCF4aF_fsSwRol-CQ_gDSx6-c5wFhbzRc,7950
|
|
20
|
+
wcgw-2.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
21
|
+
wcgw-2.3.2.dist-info/entry_points.txt,sha256=eKo1omwbAggWlQ0l7GKoR7uV1-j16nk9tK0BhC2Oz_E,120
|
|
22
|
+
wcgw-2.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|