wcgw 1.2.0__py3-none-any.whl → 1.2.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.

@@ -185,6 +185,7 @@ def loop(
185
185
  - Interact with running program using this tool
186
186
  - Special keys like arrows, interrupts, enter, etc.
187
187
  - Send text input to the running program.
188
+ - Send send_specials=["Enter"] to recheck status of a running program.
188
189
  - Only one of send_text, send_specials, send_ascii should be provided.""",
189
190
  ),
190
191
  openai.pydantic_function_tool(
wcgw/client/tools.py CHANGED
@@ -453,6 +453,14 @@ def find_least_edit_distance_substring(
453
453
  content_lines = [
454
454
  line.strip() for line in orig_content_lines
455
455
  ] # Remove trailing and leading space for calculating edit distance
456
+ new_to_original_indices = {}
457
+ new_content_lines = []
458
+ for i in range(len(content_lines)):
459
+ if not content_lines[i]:
460
+ continue
461
+ new_content_lines.append(content_lines[i])
462
+ new_to_original_indices[len(new_content_lines) - 1] = i
463
+ content_lines = new_content_lines
456
464
  find_lines = find_str.split("\n")
457
465
  find_lines = [
458
466
  line.strip() for line in find_lines
@@ -470,8 +478,9 @@ def find_least_edit_distance_substring(
470
478
  edit_distance_sum += len(find_lines[j])
471
479
  if edit_distance_sum < min_edit_distance:
472
480
  min_edit_distance = edit_distance_sum
473
- min_edit_distance_lines = orig_content_lines[i: i + len(
474
- find_lines)]
481
+ orig_start_index = new_to_original_indices[i]
482
+ orig_end_index = new_to_original_indices.get(i + len(find_lines) - 1, len(orig_content_lines) - 1) + 1
483
+ min_edit_distance_lines = orig_content_lines[orig_start_index:orig_end_index]
475
484
  return "\n".join(min_edit_distance_lines), min_edit_distance
476
485
 
477
486
 
@@ -481,12 +490,12 @@ def edit_content(content: str, find_lines: str, replace_with_lines: str) -> str:
481
490
  closest_match, min_edit_distance = find_least_edit_distance_substring(
482
491
  content, find_lines
483
492
  )
484
- print(
485
- f"Exact match not found, found with whitespace removed edit distance: {min_edit_distance}"
486
- )
487
- if min_edit_distance / len(find_lines) < 1 / 100:
488
- print("Editing file with closest match")
493
+ if min_edit_distance == 0:
489
494
  return edit_content(content, closest_match, replace_with_lines)
495
+ else:
496
+ print(
497
+ f"Exact match not found, found with whitespace removed edit distance: {min_edit_distance}"
498
+ )
490
499
  raise Exception(
491
500
  f"Error: no match found for the provided `find_lines` in the file. Closest match:\n---\n{closest_match}\n---\nFile not edited"
492
501
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wcgw
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: What could go wrong giving full shell access to chatgpt?
5
5
  Project-URL: Homepage, https://github.com/rusiaaman/wcgw
6
6
  Author-email: Aman Rusia <gapypi@arcfu.com>
@@ -6,12 +6,12 @@ wcgw/client/anthropic_client.py,sha256=g5dj7tP_wkLMjQawil4PxhrEemlrIKYttWUXBI5SZ
6
6
  wcgw/client/cli.py,sha256=Oja42CHkVO8puqOXflko9NeephYCMa85aBmQTEjBZtI,932
7
7
  wcgw/client/common.py,sha256=grH-yV_4tnTQZ29xExn4YicGLxEq98z-HkEZwH0ReSg,1410
8
8
  wcgw/client/diff-instructions.txt,sha256=I_qroE6_aMpWtOeywPSDCTxmz-P6VPopdp1kR2r0D8w,1375
9
- wcgw/client/openai_client.py,sha256=Vsj8TzYj22fawU1LagAU7bn21Va50KXwpYZpGZ0BUZ0,17310
9
+ wcgw/client/openai_client.py,sha256=Pg72I4UfUQ-xrOkKlr4w1F1rc4KRvG0gePDO6E25-FM,17381
10
10
  wcgw/client/openai_utils.py,sha256=YNwCsA-Wqq7jWrxP0rfQmBTb1dI0s7dWXzQqyTzOZT4,2629
11
- wcgw/client/tools.py,sha256=NeGIZ8AJ9-XAiW6gUXf7GWs1UJjw8f7ecxUBBEAtyEI,25994
11
+ wcgw/client/tools.py,sha256=zAWK0qAhVyVtWsW_v4fq2aU-l1I4c9i819VhFBAQ6-8,26416
12
12
  wcgw/relay/serve.py,sha256=sMbERQTM1GhpnPWLzdtpcb23TIsgbP-ZuqVj-vjp5Rw,8186
13
13
  wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
14
- wcgw-1.2.0.dist-info/METADATA,sha256=1AJa0M-m_tvHNpANqak4-q7bKTgg07_qgjddGwQaOhs,5255
15
- wcgw-1.2.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
16
- wcgw-1.2.0.dist-info/entry_points.txt,sha256=WlIB825-Vm9ZtNzgENQsbHj4DRMkbpVR7uSkQyBlaPA,93
17
- wcgw-1.2.0.dist-info/RECORD,,
14
+ wcgw-1.2.1.dist-info/METADATA,sha256=CxTKyE6VJqJAlvnWY6RmxgrYmd__UVc3ciRfnd4-oSw,5255
15
+ wcgw-1.2.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
16
+ wcgw-1.2.1.dist-info/entry_points.txt,sha256=WlIB825-Vm9ZtNzgENQsbHj4DRMkbpVR7uSkQyBlaPA,93
17
+ wcgw-1.2.1.dist-info/RECORD,,
File without changes