wcgw 2.1.0__py3-none-any.whl → 2.1.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
@@ -7,6 +7,7 @@ import json
7
7
  import mimetypes
8
8
  from pathlib import Path
9
9
  import re
10
+ import shlex
10
11
  import sys
11
12
  import threading
12
13
  import importlib.metadata
@@ -518,7 +519,7 @@ def read_image_from_shell(file_path: str) -> ImageData:
518
519
  else:
519
520
  with TemporaryDirectory() as tmpdir:
520
521
  rcode = os.system(
521
- f"docker cp {BASH_STATE.is_in_docker}:{file_path} {tmpdir}"
522
+ f"docker cp {BASH_STATE.is_in_docker}:{shlex.quote(file_path)} {tmpdir}"
522
523
  )
523
524
  if rcode != 0:
524
525
  raise Exception(f"Error: Read failed with code {rcode}")
@@ -553,7 +554,7 @@ def write_file(writefile: CreateFileNew, error_on_exist: bool) -> str:
553
554
  else:
554
555
  if error_on_exist:
555
556
  # Check if it exists using os.system
556
- cmd = f"test -f {path_}"
557
+ cmd = f"test -f {shlex.quote(path_)}"
557
558
  status = os.system(f'docker exec {BASH_STATE.is_in_docker} bash -c "{cmd}"')
558
559
  if status == 0:
559
560
  return f"Error: can't write to existing file {path_}, use other functions to edit the file"
@@ -570,7 +571,9 @@ def write_file(writefile: CreateFileNew, error_on_exist: bool) -> str:
570
571
  if rcode != 0:
571
572
  return f"Error: Write failed with code while creating dirs {rcode}"
572
573
 
573
- rcode = os.system(f"docker cp {tmppath} {BASH_STATE.is_in_docker}:{path_}")
574
+ rcode = os.system(
575
+ f"docker cp {shlex.quote(tmppath)} {BASH_STATE.is_in_docker}:{shlex.quote(path_)}"
576
+ )
574
577
  if rcode != 0:
575
578
  return f"Error: Write failed with code {rcode}"
576
579
 
@@ -661,7 +664,9 @@ def do_diff_edit(fedit: FileEdit) -> str:
661
664
  else:
662
665
  # Copy from docker
663
666
  with TemporaryDirectory() as tmpdir:
664
- rcode = os.system(f"docker cp {BASH_STATE.is_in_docker}:{path_} {tmpdir}")
667
+ rcode = os.system(
668
+ f"docker cp {BASH_STATE.is_in_docker}:{shlex.quote(path_)} {tmpdir}"
669
+ )
665
670
  if rcode != 0:
666
671
  raise Exception(f"Error: Read failed with code {rcode}")
667
672
  path_tmp = os.path.join(tmpdir, os.path.basename(path_))
@@ -724,7 +729,9 @@ def do_diff_edit(fedit: FileEdit) -> str:
724
729
  f.write(apply_diff_to)
725
730
  os.chmod(path_tmp, 0o777)
726
731
  # Copy to docker using docker cp
727
- rcode = os.system(f"docker cp {path_tmp} {BASH_STATE.is_in_docker}:{path_}")
732
+ rcode = os.system(
733
+ f"docker cp {shlex.quote(path_tmp)} {BASH_STATE.is_in_docker}:{shlex.quote(path_)}"
734
+ )
728
735
  if rcode != 0:
729
736
  raise Exception(f"Error: Write failed with code {rcode}")
730
737
 
@@ -1061,7 +1068,8 @@ def read_file(readfile: ReadFile, max_tokens: Optional[int]) -> str:
1061
1068
 
1062
1069
  else:
1063
1070
  return_code, content, stderr = command_run(
1064
- f"cat {readfile.file_path}", timeout=TIMEOUT
1071
+ f"docker exec {BASH_STATE.is_in_docker} cat {shlex.quote(readfile.file_path)}",
1072
+ timeout=TIMEOUT,
1065
1073
  )
1066
1074
  if return_code != 0:
1067
1075
  raise Exception(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wcgw
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: Shell and coding agent on claude and chatgpt
5
5
  Project-URL: Homepage, https://github.com/rusiaaman/wcgw
6
6
  Author-email: Aman Rusia <gapypi@arcfu.com>
@@ -10,13 +10,13 @@ wcgw/client/diff-instructions.txt,sha256=s5AJKG23JsjwRYhFZFQVvwDpF67vElawrmdXwvu
10
10
  wcgw/client/openai_client.py,sha256=qhntpGZANTyI2-vAWaI1pyiJsiOwEjhXc4lCvPpebiM,17752
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=QO_IkOugFrdz1pnX4VBvFvxAjpIDL0wmYmGjU_CkjRc,35504
13
+ wcgw/client/tools.py,sha256=kokbgxxBikIK39moSeg5uGvtBUzLXHnP5-d4jywZYRQ,35762
14
14
  wcgw/client/mcp_server/Readme.md,sha256=I8N4dHkTUVGNQ63BQkBMBhCCBTgqGOSF_pUR6iOEiUk,2495
15
15
  wcgw/client/mcp_server/__init__.py,sha256=hyPPwO9cabAJsOMWhKyat9yl7OlSmIobaoAZKHu3DMc,381
16
16
  wcgw/client/mcp_server/server.py,sha256=XWZCMlL5HOpvRQjY1qoZnmFAe9x_rpRb_udZz9k8ks4,10815
17
17
  wcgw/relay/serve.py,sha256=RUcUeyL4Xt0EEo12Ul6VQjb4tRle4uIdsa85v7XXxEw,8771
18
18
  wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
19
- wcgw-2.1.0.dist-info/METADATA,sha256=43N0-Y_Ab6UhhwcLqM5UWaW1gmjo-BuBiZYLn-kDhC4,7421
20
- wcgw-2.1.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
21
- wcgw-2.1.0.dist-info/entry_points.txt,sha256=eKo1omwbAggWlQ0l7GKoR7uV1-j16nk9tK0BhC2Oz_E,120
22
- wcgw-2.1.0.dist-info/RECORD,,
19
+ wcgw-2.1.1.dist-info/METADATA,sha256=T6tzEXw6jTT0KpDoJmYa6QQkRl1xRB2E4VJg0YwITv4,7421
20
+ wcgw-2.1.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
21
+ wcgw-2.1.1.dist-info/entry_points.txt,sha256=eKo1omwbAggWlQ0l7GKoR7uV1-j16nk9tK0BhC2Oz_E,120
22
+ wcgw-2.1.1.dist-info/RECORD,,
File without changes