wcgw 2.2.0__tar.gz → 2.2.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.
- {wcgw-2.2.0 → wcgw-2.2.1}/PKG-INFO +1 -1
- {wcgw-2.2.0 → wcgw-2.2.1}/pyproject.toml +1 -1
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/anthropic_client.py +2 -1
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/mcp_server/server.py +2 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/tools.py +38 -55
- {wcgw-2.2.0 → wcgw-2.2.1}/.github/workflows/python-publish.yml +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/.github/workflows/python-tests.yml +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/.github/workflows/python-types.yml +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/.gitignore +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/.python-version +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/.vscode/settings.json +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/README.md +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/gpt_action_json_schema.json +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/gpt_instructions.txt +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/openai.md +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/__init__.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/__init__.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/__init__.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/__main__.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/cli.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/common.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/computer_use.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/diff-instructions.txt +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/mcp_server/Readme.md +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/mcp_server/__init__.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/openai_client.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/openai_utils.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/client/sys_utils.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/relay/serve.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/relay/static/privacy.txt +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/src/wcgw/types_.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/static/claude-ss.jpg +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/static/computer-use.jpg +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/static/example.jpg +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/static/rocket-icon.png +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/static/ss1.png +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/tests/test_basic.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/tests/test_tools.py +0 -0
- {wcgw-2.2.0 → wcgw-2.2.1}/uv.lock +0 -0
|
@@ -186,7 +186,7 @@ def loop(
|
|
|
186
186
|
- Only one of send_text, send_specials, send_ascii should be provided.
|
|
187
187
|
- This returns within 5 seconds, for heavy programs keep checking status for upto 10 turns before asking user to continue checking again.
|
|
188
188
|
- Programs don't hang easily, so most likely explanation for no output is usually that the program is still running, and you need to check status again using ["Enter"].
|
|
189
|
-
|
|
189
|
+
- Do not send Ctrl-c before checking for status till 10 minutes or whatever is appropriate for the program to finish.
|
|
190
190
|
""",
|
|
191
191
|
),
|
|
192
192
|
ToolParam(
|
|
@@ -222,6 +222,7 @@ def loop(
|
|
|
222
222
|
description="""
|
|
223
223
|
- Use absolute file path only.
|
|
224
224
|
- Use SEARCH/REPLACE blocks to edit the file.
|
|
225
|
+
- If the edit fails due to block not matching, please retry with correct block till it matches. Re-read the file to ensure you've all the lines correct.
|
|
225
226
|
""",
|
|
226
227
|
),
|
|
227
228
|
]
|
|
@@ -106,6 +106,7 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
|
106
106
|
- Only one of send_text, send_specials, send_ascii should be provided.
|
|
107
107
|
- This returns within 3 seconds, for heavy programs keep checking status for upto 10 turns before asking user to continue checking again.
|
|
108
108
|
- Programs don't hang easily, so most likely explanation for no output is usually that the program is still running, and you need to check status again using ["Enter"].
|
|
109
|
+
- Do not send Ctrl-c before checking for status till 10 minutes or whatever is appropriate for the program to finish.
|
|
109
110
|
""",
|
|
110
111
|
),
|
|
111
112
|
ToolParam(
|
|
@@ -141,6 +142,7 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
|
141
142
|
description="""
|
|
142
143
|
- Use absolute file path only.
|
|
143
144
|
- Use SEARCH/REPLACE blocks to edit the file.
|
|
145
|
+
- If the edit fails due to block not matching, please retry with correct block till it matches. Re-read the file to ensure you've all the lines correct.
|
|
144
146
|
"""
|
|
145
147
|
+ diffinstructions,
|
|
146
148
|
),
|
|
@@ -537,6 +537,15 @@ def write_file(writefile: WriteIfEmpty, error_on_exist: bool) -> str:
|
|
|
537
537
|
else:
|
|
538
538
|
path_ = writefile.file_path
|
|
539
539
|
|
|
540
|
+
error_on_exist = (
|
|
541
|
+
not (
|
|
542
|
+
len(TOOL_CALLS) > 1
|
|
543
|
+
and isinstance(TOOL_CALLS[-2], FileEdit)
|
|
544
|
+
and TOOL_CALLS[-2].file_path == path_
|
|
545
|
+
)
|
|
546
|
+
and error_on_exist
|
|
547
|
+
)
|
|
548
|
+
|
|
540
549
|
if not BASH_STATE.is_in_docker:
|
|
541
550
|
if error_on_exist and os.path.exists(path_):
|
|
542
551
|
file_data = Path(path_).read_text()
|
|
@@ -598,7 +607,7 @@ def find_least_edit_distance_substring(
|
|
|
598
607
|
content_lines = new_content_lines
|
|
599
608
|
find_lines = find_str.split("\n")
|
|
600
609
|
find_lines = [
|
|
601
|
-
line.strip() for line in find_lines
|
|
610
|
+
line.strip() for line in find_lines if line.strip()
|
|
602
611
|
] # Remove trailing and leading space for calculating edit distance
|
|
603
612
|
# Slide window and find one with sum of edit distance least
|
|
604
613
|
min_edit_distance = float("inf")
|
|
@@ -640,7 +649,9 @@ def edit_content(content: str, find_lines: str, replace_with_lines: str) -> str:
|
|
|
640
649
|
raise Exception(
|
|
641
650
|
f"""Error: no match found for the provided search block.
|
|
642
651
|
Requested search block: \n```\n{find_lines}\n```
|
|
643
|
-
Possible relevant section in the file:\n---\n```\n{closest_match}\n```\n---\nFile not edited
|
|
652
|
+
Possible relevant section in the file:\n---\n```\n{closest_match}\n```\n---\nFile not edited
|
|
653
|
+
\nPlease retry with exact search. Re-read the file if unsure.
|
|
654
|
+
"""
|
|
644
655
|
)
|
|
645
656
|
|
|
646
657
|
content = content.replace(find_lines, replace_with_lines, 1)
|
|
@@ -648,6 +659,24 @@ def edit_content(content: str, find_lines: str, replace_with_lines: str) -> str:
|
|
|
648
659
|
|
|
649
660
|
|
|
650
661
|
def do_diff_edit(fedit: FileEdit) -> str:
|
|
662
|
+
try:
|
|
663
|
+
return _do_diff_edit(fedit)
|
|
664
|
+
except Exception as e:
|
|
665
|
+
# Try replacing \"
|
|
666
|
+
try:
|
|
667
|
+
fedit = FileEdit(
|
|
668
|
+
file_path=fedit.file_path,
|
|
669
|
+
file_edit_using_search_replace_blocks=fedit.file_edit_using_search_replace_blocks.replace(
|
|
670
|
+
'\\"', '"'
|
|
671
|
+
),
|
|
672
|
+
)
|
|
673
|
+
return _do_diff_edit(fedit)
|
|
674
|
+
except Exception:
|
|
675
|
+
pass
|
|
676
|
+
raise e
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
def _do_diff_edit(fedit: FileEdit) -> str:
|
|
651
680
|
console.log(f"Editing file: {fedit.file_path}")
|
|
652
681
|
|
|
653
682
|
if not os.path.isabs(fedit.file_path):
|
|
@@ -824,70 +853,24 @@ def which_tool_name(name: str) -> Type[TOOLS]:
|
|
|
824
853
|
raise ValueError(f"Unknown tool name: {name}")
|
|
825
854
|
|
|
826
855
|
|
|
856
|
+
TOOL_CALLS: list[TOOLS] = []
|
|
857
|
+
|
|
858
|
+
|
|
827
859
|
def get_tool_output(
|
|
828
|
-
args: dict[object, object]
|
|
829
|
-
| Confirmation
|
|
830
|
-
| BashCommand
|
|
831
|
-
| BashInteraction
|
|
832
|
-
| ResetShell
|
|
833
|
-
| WriteIfEmpty
|
|
834
|
-
| FileEditFindReplace
|
|
835
|
-
| FileEdit
|
|
836
|
-
| AIAssistant
|
|
837
|
-
| DoneFlag
|
|
838
|
-
| ReadImage
|
|
839
|
-
| Initialize
|
|
840
|
-
| ReadFile
|
|
841
|
-
| Mouse
|
|
842
|
-
| Keyboard
|
|
843
|
-
| ScreenShot
|
|
844
|
-
| GetScreenInfo,
|
|
860
|
+
args: dict[object, object] | TOOLS,
|
|
845
861
|
enc: tiktoken.Encoding,
|
|
846
862
|
limit: float,
|
|
847
863
|
loop_call: Callable[[str, float], tuple[str, float]],
|
|
848
864
|
max_tokens: Optional[int],
|
|
849
865
|
) -> tuple[list[str | ImageData | DoneFlag], float]:
|
|
850
|
-
global IS_IN_DOCKER
|
|
866
|
+
global IS_IN_DOCKER, TOOL_CALLS
|
|
851
867
|
if isinstance(args, dict):
|
|
852
|
-
adapter = TypeAdapter[
|
|
853
|
-
Confirmation
|
|
854
|
-
| BashCommand
|
|
855
|
-
| BashInteraction
|
|
856
|
-
| ResetShell
|
|
857
|
-
| WriteIfEmpty
|
|
858
|
-
| FileEditFindReplace
|
|
859
|
-
| FileEdit
|
|
860
|
-
| AIAssistant
|
|
861
|
-
| DoneFlag
|
|
862
|
-
| ReadImage
|
|
863
|
-
| ReadFile
|
|
864
|
-
| Initialize
|
|
865
|
-
| Mouse
|
|
866
|
-
| Keyboard
|
|
867
|
-
| ScreenShot
|
|
868
|
-
| GetScreenInfo,
|
|
869
|
-
](
|
|
870
|
-
Confirmation
|
|
871
|
-
| BashCommand
|
|
872
|
-
| BashInteraction
|
|
873
|
-
| ResetShell
|
|
874
|
-
| WriteIfEmpty
|
|
875
|
-
| FileEditFindReplace
|
|
876
|
-
| FileEdit
|
|
877
|
-
| AIAssistant
|
|
878
|
-
| DoneFlag
|
|
879
|
-
| ReadImage
|
|
880
|
-
| ReadFile
|
|
881
|
-
| Initialize
|
|
882
|
-
| Mouse
|
|
883
|
-
| Keyboard
|
|
884
|
-
| ScreenShot
|
|
885
|
-
| GetScreenInfo
|
|
886
|
-
)
|
|
868
|
+
adapter = TypeAdapter[TOOLS](TOOLS)
|
|
887
869
|
arg = adapter.validate_python(args)
|
|
888
870
|
else:
|
|
889
871
|
arg = args
|
|
890
872
|
output: tuple[str | DoneFlag | ImageData, float]
|
|
873
|
+
TOOL_CALLS.append(arg)
|
|
891
874
|
if isinstance(arg, Confirmation):
|
|
892
875
|
console.print("Calling ask confirmation tool")
|
|
893
876
|
output = ask_confirmation(arg), 0.0
|
|
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
|
|
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
|