beswarm 0.1.35__py3-none-any.whl → 0.1.37__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.0.92",
7
+ version="1.0.93",
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,6 +1,7 @@
1
1
  import subprocess
2
2
  from .registry import register_tool
3
3
 
4
+ import re
4
5
  import html
5
6
 
6
7
  def unescape_html(input_string: str) -> str:
@@ -15,6 +16,32 @@ def unescape_html(input_string: str) -> str:
15
16
  """
16
17
  return html.unescape(input_string)
17
18
 
19
+ def get_python_executable(command: str) -> str:
20
+ """
21
+ 获取 Python 可执行文件的路径。
22
+
23
+ Returns:
24
+ str: Python 可执行文件的路径。
25
+ """
26
+ cmd_parts = command.split(None, 1)
27
+ if cmd_parts:
28
+ executable = cmd_parts[0]
29
+ args_str = cmd_parts[1] if len(cmd_parts) > 1 else ""
30
+
31
+ # 检查是否是 python 可执行文件 (如 python, python3, pythonX.Y)
32
+ is_python_exe = False
33
+ if executable == "python" or re.match(r"^python[23]?(\.\d+)?$", executable):
34
+ is_python_exe = True
35
+
36
+ if is_python_exe:
37
+ # 检查参数中是否已经有 -u 选项
38
+ args_list = args_str.split()
39
+ has_u_option = "-u" in args_list
40
+ if not has_u_option:
41
+ if args_str:
42
+ command = f"{executable} -u {args_str}"
43
+ return command
44
+
18
45
  # 执行命令
19
46
  @register_tool()
20
47
  def excute_command(command):
@@ -31,6 +58,9 @@ def excute_command(command):
31
58
  try:
32
59
  command = unescape_html(command) # 保留 HTML 解码
33
60
 
61
+ command = get_python_executable(command)
62
+
63
+
34
64
  # 使用 Popen 以便实时处理输出
35
65
  # bufsize=1 表示行缓冲, universal_newlines=True 与 text=True 效果类似,用于文本模式
36
66
  process = subprocess.Popen(
@@ -106,9 +136,9 @@ if __name__ == "__main__":
106
136
  # print(excute_command(long_running_command_unix))
107
137
 
108
138
 
109
- long_running_command_unix = "pip install torch"
110
- print(f"执行: {long_running_command_unix}")
111
- print(excute_command(long_running_command_unix))
139
+ # long_running_command_unix = "pip install torch"
140
+ # print(f"执行: {long_running_command_unix}")
141
+ # print(excute_command(long_running_command_unix))
112
142
 
113
143
 
114
144
  # python_long_task_command = """
@@ -118,5 +148,5 @@ if __name__ == "__main__":
118
148
  # print(f"执行: {python_long_task_command}")
119
149
  # print(excute_command(python_long_task_command))
120
150
 
121
-
151
+ print(get_python_executable("python -c 'print(123)'"))
122
152
  # python -m beswarm.aient.src.aient.plugins.excute_command
beswarm/tools/UIworker.py CHANGED
@@ -3,7 +3,6 @@ import io
3
3
  import copy
4
4
  import base64
5
5
  import platform
6
- import pyautogui
7
6
  from datetime import datetime
8
7
  from ..aient.src.aient.plugins import register_tool, get_function_call_list
9
8
 
@@ -16,6 +15,7 @@ from ..utils import extract_xml_content
16
15
  async def get_current_screen_image_message(prompt):
17
16
  print("instruction agent 正在截取当前屏幕...")
18
17
  try:
18
+ import pyautogui
19
19
  # 使用 pyautogui 截取屏幕,返回 PIL Image 对象
20
20
  screenshot = pyautogui.screenshot()
21
21
  # img_width, img_height = screenshot.size # 获取截图尺寸
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.1.35
3
+ Version: 0.1.37
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=AdDCcqAIIKQEMl7PfryVgeT9G5sHe7QNsZnrvmTGA8E,283
3
3
  beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
4
- beswarm/aient/setup.py,sha256=LYfkRgq2T63yBlZ2EdqRCqob-B0tJP_RdJWodotCAW4,487
4
+ beswarm/aient/setup.py,sha256=UvQkQk0MwjVxgzgR4-QJxBy2A4et3GTfTnlbiHw6LVQ,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=KnZ5xtb5o41FI2_qvxTEQhssdd3WJc7lIAFNR85INQw,7817
28
- beswarm/aient/src/aient/plugins/excute_command.py,sha256=1DPFXXXbhQAO7tqsxfxisO7I1VbTEzFvYwone4Sw9I4,4422
28
+ beswarm/aient/src/aient/plugins/excute_command.py,sha256=u-JOZ21dDcDx1j3O0KVIHAsa6MNuOxHFBdV3iCnTih0,5413
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=5ubm-mfrj-tanGSDp4M_Tmb6vQb3dx2-XVfQ2yL2G8A,1394
@@ -119,7 +119,7 @@ beswarm/queries/tree-sitter-languages/ruby-tags.scm,sha256=vIidsCeE2A0vdFN18yXKq
119
119
  beswarm/queries/tree-sitter-languages/rust-tags.scm,sha256=9ljM1nzhfPs_ZTRw7cr2P9ToOyhGcKkCoN4_HPXSWi4,1451
120
120
  beswarm/queries/tree-sitter-languages/scala-tags.scm,sha256=UxQjz80JIrrJ7Pm56uUnQyThfmQNvwk7aQzPNypB-Ao,1761
121
121
  beswarm/queries/tree-sitter-languages/typescript-tags.scm,sha256=OMdCeedPiA24ky82DpgTMKXK_l2ySTuF2zrQ2fJAi9E,1253
122
- beswarm/tools/UIworker.py,sha256=9e0iWBIi-ET6OvhRftuMSphixihySlTjvB4pCZvKuAU,6331
122
+ beswarm/tools/UIworker.py,sha256=YRrzW5GxWqA-tcmmm2c6mMbkVI0kHIqosIUz-GcoQOQ,6339
123
123
  beswarm/tools/__init__.py,sha256=-h_zoMEjnLCg9iVgSoor9BI3yK64LdVOQkVB0DgGFmo,1001
124
124
  beswarm/tools/click.py,sha256=vjCN6_00xJw-dcMZEv9sneTBmuKI7lFN4xApZZizd5k,20760
125
125
  beswarm/tools/edit_file.py,sha256=qKOVanfh_79eavRrqqyFirRo07sZ897jUL2PD4GRKJk,6965
@@ -128,7 +128,7 @@ beswarm/tools/repomap.py,sha256=CwvwoN5Swr42EzrORTTeV8MMb7mPviy4a4b0fxBu50k,4082
128
128
  beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0,7937
129
129
  beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
130
130
  beswarm/tools/worker.py,sha256=FfKCx7KFNbMRoAXtjU1_nJQjx9WHny7KBq8OXSYICJs,5334
131
- beswarm-0.1.35.dist-info/METADATA,sha256=2n62NH7Tgpl295Mz2BjjEmh48XRWtUmRYmdH3bWbap8,3197
132
- beswarm-0.1.35.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
133
- beswarm-0.1.35.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
134
- beswarm-0.1.35.dist-info/RECORD,,
131
+ beswarm-0.1.37.dist-info/METADATA,sha256=aBx-kjQIXjn2HYky3L99c2oBOXJRWYNRP7xF0Ndj9h4,3197
132
+ beswarm-0.1.37.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
133
+ beswarm-0.1.37.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
134
+ beswarm-0.1.37.dist-info/RECORD,,