aient 1.0.82__py3-none-any.whl → 1.0.83__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.
@@ -1,21 +1,26 @@
1
1
  import subprocess
2
2
  from .registry import register_tool
3
3
 
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
+
4
18
  # 执行命令
5
19
  @register_tool()
6
20
  def excute_command(command):
7
21
  """
8
22
  执行命令并返回输出结果
9
23
  禁止用于查看pdf,禁止使用 pdftotext 命令
10
- 请确保生成的命令字符串可以直接在终端执行,特殊字符(例如 &&)必须保持原样,不要进行 HTML 编码或任何形式的转义,禁止使用 &&
11
-
12
- for example:
13
-
14
- correct:
15
- ls -l && echo 'Hello, World!'
16
-
17
- incorrect:
18
- ls -l && echo 'Hello, World!'
19
24
 
20
25
  参数:
21
26
  command: 要执行的命令,可以克隆仓库,安装依赖,运行代码等
@@ -25,6 +30,7 @@ ls -l && echo 'Hello, World!'
25
30
  """
26
31
  try:
27
32
  # 使用subprocess.run捕获命令输出
33
+ command = unescape_html(command)
28
34
  result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
29
35
  # 返回命令的标准输出
30
36
  if "pip install" in command:
@@ -36,4 +42,8 @@ ls -l && echo 'Hello, World!'
36
42
  # 如果命令执行失败,返回错误信息和错误输出
37
43
  return f"执行命令失败 (退出码 {e.returncode}):\n错误: {e.stderr}\n输出: {e.stdout}"
38
44
  except Exception as e:
39
- return f"执行命令时发生异常: {e}"
45
+ return f"执行命令时发生异常: {e}"
46
+
47
+ if __name__ == "__main__":
48
+ print(excute_command("ls -l && echo 'Hello, World!'"))
49
+ print(excute_command("ls -l && echo 'Hello, World!'"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.0.82
3
+ Version: 1.0.83
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -22,7 +22,7 @@ aient/models/vertex.py,sha256=qVD5l1Q538xXUPulxG4nmDjXE1VoV4yuAkTCpIeJVw0,16795
22
22
  aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
23
23
  aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
24
24
  aient/plugins/config.py,sha256=KnZ5xtb5o41FI2_qvxTEQhssdd3WJc7lIAFNR85INQw,7817
25
- aient/plugins/excute_command.py,sha256=ixSN1q2d3JoJK8OipRB9M2XGMnf4R1b1o_E7F5cUSOU,1392
25
+ aient/plugins/excute_command.py,sha256=A5jvmo8DGcluylIooczMHk8t8zs7vq-wQzbF1ETYY2A,1606
26
26
  aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
27
27
  aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
28
28
  aient/plugins/list_directory.py,sha256=5ubm-mfrj-tanGSDp4M_Tmb6vQb3dx2-XVfQ2yL2G8A,1394
@@ -36,8 +36,8 @@ aient/prompt/agent.py,sha256=WLs0KiNZs29FJ5w7N3kQZYLVEeS7K8vxIOUw06LcXVE,23825
36
36
  aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
38
38
  aient/utils/scripts.py,sha256=PPwaJEigPkpciJHUXOag483iq1GjvaLReHDHjkinv6c,26780
39
- aient-1.0.82.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
40
- aient-1.0.82.dist-info/METADATA,sha256=3SFzfABMavQXgBZAn_f9KboguAB1FulPO27UwaQdo3w,5000
41
- aient-1.0.82.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
42
- aient-1.0.82.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
43
- aient-1.0.82.dist-info/RECORD,,
39
+ aient-1.0.83.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
40
+ aient-1.0.83.dist-info/METADATA,sha256=V55ZlLdbDJYqDFKYbafnBIN9_cFrUG1wtfJQHeq2bBQ,5000
41
+ aient-1.0.83.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
42
+ aient-1.0.83.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
43
+ aient-1.0.83.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.1)
2
+ Generator: setuptools (80.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5