wcgw 2.2.1__py3-none-any.whl → 2.2.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/anthropic_client.py +1 -1
- wcgw/client/mcp_server/server.py +1 -1
- wcgw/client/openai_client.py +1 -1
- wcgw/client/tools.py +18 -9
- {wcgw-2.2.1.dist-info → wcgw-2.2.2.dist-info}/METADATA +2 -2
- {wcgw-2.2.1.dist-info → wcgw-2.2.2.dist-info}/RECORD +8 -8
- {wcgw-2.2.1.dist-info → wcgw-2.2.2.dist-info}/WHEEL +1 -1
- {wcgw-2.2.1.dist-info → wcgw-2.2.2.dist-info}/entry_points.txt +0 -0
wcgw/client/anthropic_client.py
CHANGED
|
@@ -169,7 +169,7 @@ def loop(
|
|
|
169
169
|
- Do not use interactive commands like nano. Prefer writing simpler commands.
|
|
170
170
|
- Status of the command and the current working directory will always be returned at the end.
|
|
171
171
|
- Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
|
|
172
|
-
- The first line might be `(...truncated)` if the output is too long.
|
|
172
|
+
- The first or the last line might be `(...truncated)` if the output is too long.
|
|
173
173
|
- Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
|
|
174
174
|
- The control will return to you in 5 seconds regardless of the status. For heavy commands, keep checking status using BashInteraction till they are finished.
|
|
175
175
|
- Run long running commands in background using screen instead of "&".
|
wcgw/client/mcp_server/server.py
CHANGED
|
@@ -89,7 +89,7 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
|
89
89
|
- Do not use interactive commands like nano. Prefer writing simpler commands.
|
|
90
90
|
- Status of the command and the current working directory will always be returned at the end.
|
|
91
91
|
- Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
|
|
92
|
-
- The first line might be `(...truncated)` if the output is too long.
|
|
92
|
+
- The first or the last line might be `(...truncated)` if the output is too long.
|
|
93
93
|
- Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
|
|
94
94
|
- The control will return to you in 5 seconds regardless of the status. For heavy commands, keep checking status using BashInteraction till they are finished.
|
|
95
95
|
- Run long running commands in background using screen instead of "&".
|
wcgw/client/openai_client.py
CHANGED
|
@@ -172,7 +172,7 @@ def loop(
|
|
|
172
172
|
- Do not use interactive commands like nano. Prefer writing simpler commands.
|
|
173
173
|
- Status of the command and the current working directory will always be returned at the end.
|
|
174
174
|
- Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
|
|
175
|
-
- The first line might be `(...truncated)` if the output is too long.
|
|
175
|
+
- The first or the last line might be `(...truncated)` if the output is too long.
|
|
176
176
|
- Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
|
|
177
177
|
- The control will return to you in 5 seconds regardless of the status. For heavy commands, keep checking status using BashInteraction till they are finished.
|
|
178
178
|
- Run long running commands in background using screen instead of "&".
|
wcgw/client/tools.py
CHANGED
|
@@ -13,7 +13,7 @@ import threading
|
|
|
13
13
|
import importlib.metadata
|
|
14
14
|
import time
|
|
15
15
|
import traceback
|
|
16
|
-
from tempfile import TemporaryDirectory
|
|
16
|
+
from tempfile import NamedTemporaryFile, TemporaryDirectory
|
|
17
17
|
from typing import (
|
|
18
18
|
Callable,
|
|
19
19
|
Literal,
|
|
@@ -412,7 +412,7 @@ def execute_bash(
|
|
|
412
412
|
tokens = enc.encode(text)
|
|
413
413
|
|
|
414
414
|
if max_tokens and len(tokens) >= max_tokens:
|
|
415
|
-
text = "...
|
|
415
|
+
text = "(...truncated)\n" + enc.decode(tokens[-(max_tokens - 1) :])
|
|
416
416
|
|
|
417
417
|
if is_interrupt:
|
|
418
418
|
text = (
|
|
@@ -441,7 +441,7 @@ Otherwise, you may want to try Ctrl-c again or program specific exit interactive
|
|
|
441
441
|
|
|
442
442
|
tokens = enc.encode(output)
|
|
443
443
|
if max_tokens and len(tokens) >= max_tokens:
|
|
444
|
-
output = "...
|
|
444
|
+
output = "(...truncated)\n" + enc.decode(tokens[-(max_tokens - 1) :])
|
|
445
445
|
|
|
446
446
|
try:
|
|
447
447
|
exit_status = get_status()
|
|
@@ -592,7 +592,7 @@ def write_file(writefile: WriteIfEmpty, error_on_exist: bool) -> str:
|
|
|
592
592
|
|
|
593
593
|
def find_least_edit_distance_substring(
|
|
594
594
|
content: str, find_str: str
|
|
595
|
-
) -> tuple[str, float]:
|
|
595
|
+
) -> tuple[str, str, float]:
|
|
596
596
|
orig_content_lines = content.split("\n")
|
|
597
597
|
content_lines = [
|
|
598
598
|
line.strip() for line in orig_content_lines
|
|
@@ -612,6 +612,7 @@ def find_least_edit_distance_substring(
|
|
|
612
612
|
# Slide window and find one with sum of edit distance least
|
|
613
613
|
min_edit_distance = float("inf")
|
|
614
614
|
min_edit_distance_lines = []
|
|
615
|
+
context_lines = []
|
|
615
616
|
for i in range(max(1, len(content_lines) - len(find_lines) + 1)):
|
|
616
617
|
edit_distance_sum = 0
|
|
617
618
|
for j in range(len(find_lines)):
|
|
@@ -629,19 +630,27 @@ def find_least_edit_distance_substring(
|
|
|
629
630
|
+ 1
|
|
630
631
|
)
|
|
631
632
|
min_edit_distance_lines = orig_content_lines[
|
|
633
|
+
orig_start_index:orig_end_index
|
|
634
|
+
]
|
|
635
|
+
|
|
636
|
+
context_lines = orig_content_lines[
|
|
632
637
|
max(0, orig_start_index - 10) : (orig_end_index + 10)
|
|
633
638
|
]
|
|
634
|
-
return
|
|
639
|
+
return (
|
|
640
|
+
"\n".join(min_edit_distance_lines),
|
|
641
|
+
"\n".join(context_lines),
|
|
642
|
+
min_edit_distance,
|
|
643
|
+
)
|
|
635
644
|
|
|
636
645
|
|
|
637
646
|
def edit_content(content: str, find_lines: str, replace_with_lines: str) -> str:
|
|
638
647
|
count = content.count(find_lines)
|
|
639
648
|
if count == 0:
|
|
640
|
-
closest_match, min_edit_distance =
|
|
641
|
-
content, find_lines
|
|
649
|
+
closest_match, context_lines, min_edit_distance = (
|
|
650
|
+
find_least_edit_distance_substring(content, find_lines)
|
|
642
651
|
)
|
|
643
652
|
if min_edit_distance == 0:
|
|
644
|
-
return
|
|
653
|
+
return content.replace(closest_match, replace_with_lines, 1)
|
|
645
654
|
else:
|
|
646
655
|
print(
|
|
647
656
|
f"Exact match not found, found with whitespace removed edit distance: {min_edit_distance}"
|
|
@@ -649,7 +658,7 @@ def edit_content(content: str, find_lines: str, replace_with_lines: str) -> str:
|
|
|
649
658
|
raise Exception(
|
|
650
659
|
f"""Error: no match found for the provided search block.
|
|
651
660
|
Requested search block: \n```\n{find_lines}\n```
|
|
652
|
-
Possible relevant section in the file:\n---\n```\n{
|
|
661
|
+
Possible relevant section in the file:\n---\n```\n{context_lines}\n```\n---\nFile not edited
|
|
653
662
|
\nPlease retry with exact search. Re-read the file if unsure.
|
|
654
663
|
"""
|
|
655
664
|
)
|
|
@@ -2,21 +2,21 @@ wcgw/__init__.py,sha256=9K2QW7QuSLhMTVbKbBYd9UUp-ZyrfBrxcjuD_xk458k,118
|
|
|
2
2
|
wcgw/types_.py,sha256=5QM97K3kOJ7vNBgZ1NYmKPqwSe9WfzDImAIvjbRcClo,1772
|
|
3
3
|
wcgw/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
wcgw/client/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
|
|
5
|
-
wcgw/client/anthropic_client.py,sha256=
|
|
5
|
+
wcgw/client/anthropic_client.py,sha256=qa8oLztqOCOQTrQcE1DYMwkXEkLwUdD4FD4DN9GCYTk,20950
|
|
6
6
|
wcgw/client/cli.py,sha256=-z0kpDAW3mzfQrQeZfaVJhBCAQY3HXnt9GdgQ8s-u0Y,1003
|
|
7
7
|
wcgw/client/common.py,sha256=grH-yV_4tnTQZ29xExn4YicGLxEq98z-HkEZwH0ReSg,1410
|
|
8
8
|
wcgw/client/computer_use.py,sha256=35NKAlMrxwD0TBlMMRnbCwz4g8TBRGOlcy-cmS-yJ_A,15247
|
|
9
9
|
wcgw/client/diff-instructions.txt,sha256=s5AJKG23JsjwRYhFZFQVvwDpF67vElawrmdXwvukR1A,1683
|
|
10
|
-
wcgw/client/openai_client.py,sha256=
|
|
10
|
+
wcgw/client/openai_client.py,sha256=ByAVGFb1MmBbdMep0vHxH1hypf1WrowAyqlWrvEZq5E,17897
|
|
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=kv0ovpulWLq0WIWkEnuHoIQLY3iSk-X3anB2Dy7z0WY,35956
|
|
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=gp4xXprqZ6X9u5uYmVq2uHOiOIukQGDkgxVsZf_aXmo,11238
|
|
17
17
|
wcgw/relay/serve.py,sha256=KLYjTvM9CfqdxgFOfHM8LUkFGZ9kKyyJunpNdEIFQUk,8766
|
|
18
18
|
wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
|
|
19
|
-
wcgw-2.2.
|
|
20
|
-
wcgw-2.2.
|
|
21
|
-
wcgw-2.2.
|
|
22
|
-
wcgw-2.2.
|
|
19
|
+
wcgw-2.2.2.dist-info/METADATA,sha256=eqZjrD6d3ifTIKW7HuOyHdhyARP-LyEeHMFtJCbqE9s,7939
|
|
20
|
+
wcgw-2.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
21
|
+
wcgw-2.2.2.dist-info/entry_points.txt,sha256=eKo1omwbAggWlQ0l7GKoR7uV1-j16nk9tK0BhC2Oz_E,120
|
|
22
|
+
wcgw-2.2.2.dist-info/RECORD,,
|
|
File without changes
|