beswarm 0.1.76__py3-none-any.whl → 0.1.77__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.
beswarm/aient/setup.py CHANGED
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
4
4
 
5
5
  setup(
6
6
  name="aient",
7
- version="1.1.26",
7
+ version="1.1.27",
8
8
  description="Aient: The Awakening of Agent.",
9
9
  long_description=Path.open(Path("README.md"), encoding="utf-8").read(),
10
10
  long_description_content_type="text/markdown",
@@ -1,10 +1,9 @@
1
1
  import subprocess
2
2
  from .registry import register_tool
3
- from ..utils.scripts import sandbox
3
+ from ..utils.scripts import sandbox, unescape_html
4
4
 
5
5
  import re
6
6
  import os
7
- import html
8
7
  import select
9
8
 
10
9
  # 检查是否在 Unix-like 系统上 (pty 模块主要用于 Unix)
@@ -39,18 +38,6 @@ def compare_line(line: str) -> bool:
39
38
  # print(f"similarity: {similarity}")
40
39
  return similarity > 0.89
41
40
 
42
- def unescape_html(input_string: str) -> str:
43
- """
44
- 将字符串中的 HTML 实体(例如 &)转换回其原始字符(例如 &)。
45
-
46
- Args:
47
- input_string: 包含 HTML 实体的输入字符串。
48
-
49
- Returns:
50
- 转换后的字符串。
51
- """
52
- return html.unescape(input_string)
53
-
54
41
  def get_python_executable(command: str) -> str:
55
42
  """
56
43
  获取 Python 可执行文件的路径。
@@ -1,19 +1,7 @@
1
1
  from .registry import register_tool
2
+ from ..utils.scripts import unescape_html
2
3
 
3
4
  import os
4
- import html
5
-
6
- def unescape_html(input_string: str) -> str:
7
- """
8
- 将字符串中的 HTML 实体(例如 &)转换回其原始字符(例如 &)。
9
-
10
- Args:
11
- input_string: 包含 HTML 实体的输入字符串。
12
-
13
- Returns:
14
- 转换后的字符串。
15
- """
16
- return html.unescape(input_string)
17
5
 
18
6
  @register_tool()
19
7
  def write_to_file(path, content, mode='w'):
@@ -202,6 +202,19 @@ def parse_tools_from_cursor_prompt(text):
202
202
  print(f"解析 JSON 时出错: {e}")
203
203
  return []
204
204
 
205
+ import html
206
+ def unescape_html(input_string: str) -> str:
207
+ """
208
+ 将字符串中的 HTML 实体(例如 &)转换回其原始字符(例如 &)。
209
+
210
+ Args:
211
+ input_string: 包含 HTML 实体的输入字符串。
212
+
213
+ Returns:
214
+ 转换后的字符串。
215
+ """
216
+ return html.unescape(input_string)
217
+
205
218
  import sys
206
219
  import shlex
207
220
  import builtins
@@ -2,6 +2,7 @@ import os
2
2
  import re
3
3
  import difflib
4
4
  from ..aient.src.aient.plugins import register_tool
5
+ from ..aient.src.aient.utils.scripts import unescape_html
5
6
 
6
7
  @register_tool()
7
8
  def edit_file(file_path, diff_content, match_precision=0.9):
@@ -64,6 +65,8 @@ def edit_file(file_path, diff_content, match_precision=0.9):
64
65
  # 应用每个diff块
65
66
  new_content = content
66
67
  for search_block, replace_block in diff_blocks:
68
+ search_block = unescape_html(search_block)
69
+ replace_block = unescape_html(replace_block)
67
70
  # 检查搜索块是否为空
68
71
  if not search_block.strip():
69
72
  return f"错误: 搜索块不能为空"
@@ -139,7 +142,14 @@ def edit_file(file_path, diff_content, match_precision=0.9):
139
142
  total_original_lines += original_lines
140
143
  total_new_lines += new_lines
141
144
  else:
142
- return f"错误: 在文件中未找到足够匹配的代码块,最佳匹配分数为 {best_match_score:.2f},但要求为 {match_precision:.2f}"
145
+ error_message = f"错误: 在文件中未找到足够匹配的代码块,最佳匹配分数为 {best_match_score:.2f},但要求为 {match_precision:.2f}"
146
+ if best_match_index != -1:
147
+ start_index = max(0, best_match_index - len(search_lines))
148
+ end_index = min(len(content_lines), best_match_index + 2 * len(search_lines))
149
+ context_lines = content_lines[start_index:end_index]
150
+ context_block = '\n'.join(context_lines)
151
+ error_message += f"\n\n文件的最佳匹配范围原文如下 (上下文已扩展):\n<real_file_content>\n{context_block}\n</real_file_content>"
152
+ return error_message
143
153
 
144
154
  # 如果没有进行任何编辑,返回错误
145
155
  if edits_count == 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.1.76
3
+ Version: 0.1.77
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,7 +1,7 @@
1
1
  beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
2
2
  beswarm/utils.py,sha256=Z2Kuus2BLp9EHUC2ZNL9iUsb6NWnPj-MTA7SYzGyg24,1755
3
3
  beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
4
- beswarm/aient/setup.py,sha256=hG7eswVWMMNc-xD67iN6hCTvU9HSIiqwkbkncpEpctA,487
4
+ beswarm/aient/setup.py,sha256=TVFBwEKEXhadb_ESCtRQva9W7btAzbXZUV3sj9vyPj4,487
5
5
  beswarm/aient/src/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
6
6
  beswarm/aient/src/aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
7
7
  beswarm/aient/src/aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
@@ -25,7 +25,7 @@ beswarm/aient/src/aient/models/vertex.py,sha256=qVD5l1Q538xXUPulxG4nmDjXE1VoV4yu
25
25
  beswarm/aient/src/aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
26
26
  beswarm/aient/src/aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
27
27
  beswarm/aient/src/aient/plugins/config.py,sha256=QGyI9LlNaU36GUpY531o7UbTFBB39u7LfS6rrx_RTWw,7103
28
- beswarm/aient/src/aient/plugins/excute_command.py,sha256=-Meu3CcC8U8Oc2lYf4OpaVQQ3YrIjBmpPEJVgONDkyI,10313
28
+ beswarm/aient/src/aient/plugins/excute_command.py,sha256=ybkgoMlrXxfeRLA8gizxNL1KuVda0s9xSKTSzC8CKyU,10021
29
29
  beswarm/aient/src/aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
30
30
  beswarm/aient/src/aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
31
31
  beswarm/aient/src/aient/plugins/list_directory.py,sha256=JZVuImecMSfEv6jLqii-0uQJ1UCsrpMNmYlwW3PEDg4,1374
@@ -35,12 +35,12 @@ beswarm/aient/src/aient/plugins/readonly.py,sha256=qK5-kBM3NDH1b-otFxFHpAjV5BXEY
35
35
  beswarm/aient/src/aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
36
36
  beswarm/aient/src/aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
37
37
  beswarm/aient/src/aient/plugins/websearch.py,sha256=llxy1U0vJiNMiKvamMr4p7IruLb3nnDR4YErz8TYimc,15215
38
- beswarm/aient/src/aient/plugins/write_file.py,sha256=ndMsQhfMuobvgbFuesxb17zIk9cQIYTd9Gdr6yiiZec,3896
38
+ beswarm/aient/src/aient/plugins/write_file.py,sha256=aWOCuKjtpzjl2JiJV9W6YBmPg_WivxyXD509xUHiuCc,3631
39
39
  beswarm/aient/src/aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
40
40
  beswarm/aient/src/aient/prompt/agent.py,sha256=ebHYebxbgL-WEAKUs1NPNwxlUMucF3GNNoy3eNZrtIo,29737
41
41
  beswarm/aient/src/aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  beswarm/aient/src/aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
43
- beswarm/aient/src/aient/utils/scripts.py,sha256=l8_NrwIRYxvzxPFg-vSJz120swdnxxGfgBcQRogJ4nI,36154
43
+ beswarm/aient/src/aient/utils/scripts.py,sha256=JVR6oNxYc9NnfQL0PGsL8QuhG43dwg0-rPS8NR_pyBM,36461
44
44
  beswarm/aient/test/chatgpt.py,sha256=Hvl7FuDt1c74N5TVBmhErOPvJbJJzA7FNp5VoZM4u30,4957
45
45
  beswarm/aient/test/claude.py,sha256=IyB4qI1eJLwlSfDNSnt2FhbQWYyBighHUjJxEXc3osQ,1095
46
46
  beswarm/aient/test/test.py,sha256=rldnoLQdtRR8IKFSIzTti7eIK2MpPMoi9gL5qD8_K44,29
@@ -122,7 +122,7 @@ beswarm/queries/tree-sitter-languages/scala-tags.scm,sha256=UxQjz80JIrrJ7Pm56uUn
122
122
  beswarm/queries/tree-sitter-languages/typescript-tags.scm,sha256=OMdCeedPiA24ky82DpgTMKXK_l2ySTuF2zrQ2fJAi9E,1253
123
123
  beswarm/tools/__init__.py,sha256=YXP65SJFE1dBNRlffapdd7zsB6M6tHZ6QaQykGq7KDU,1198
124
124
  beswarm/tools/click.py,sha256=TygaekCXTmU3fIu6Uom7ZcyzEgYMlCC_GX-5SmWHuLI,20762
125
- beswarm/tools/edit_file.py,sha256=B1rAKxgd9ZksRpZysF4SOglTIp-_k0hnFK5fZ5BBvGk,8039
125
+ beswarm/tools/edit_file.py,sha256=khKKMaet7FJzTY79SYuRmYdJ5sOzoyX6Rl5ChyjvK1g,8806
126
126
  beswarm/tools/planner.py,sha256=lguBCS6kpwNPoXQvqH-WySabVubT82iyWOkJnjt6dXw,1265
127
127
  beswarm/tools/repomap.py,sha256=N09K0UgwjCN7Zjg_5TYlVsulp3n2fztYlS8twalChU8,45003
128
128
  beswarm/tools/screenshot.py,sha256=u6t8FCgW5YHJ_Oc4coo8e0F3wTusWE_-H8dFh1rBq9Q,1011
@@ -130,7 +130,7 @@ beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0
130
130
  beswarm/tools/search_web.py,sha256=B24amOnGHnmdV_6S8bw8O2PdhZRRIDtJjg-wXcfP7dQ,11859
131
131
  beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
132
132
  beswarm/tools/worker.py,sha256=DLYzMgKzpf4UYGNKKJix__DHw6LHtX_T9CLVaexDQMg,12909
133
- beswarm-0.1.76.dist-info/METADATA,sha256=REGvO25NvgVgRw3qBdQf_172ht7ZgBIDfCBYNWnR6Uk,3553
134
- beswarm-0.1.76.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
135
- beswarm-0.1.76.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
136
- beswarm-0.1.76.dist-info/RECORD,,
133
+ beswarm-0.1.77.dist-info/METADATA,sha256=CjEUw07KUrfTxiusTUIk-XDMkBA5h1qqs6LLrLo_L8M,3553
134
+ beswarm-0.1.77.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
135
+ beswarm-0.1.77.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
136
+ beswarm-0.1.77.dist-info/RECORD,,