beswarm 0.1.74__py3-none-any.whl → 0.1.75__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.25",
7
+ version="1.1.26",
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",
@@ -241,17 +241,46 @@ def _sandboxed_open(file, mode='r', *args, **kwargs):
241
241
 
242
242
  builtins.open = _sandboxed_open
243
243
 
244
- # 2. 智能判断原始命令是脚本还是模块,并执行
244
+ # 2. 智能判断原始命令是脚本、模块还是代码字符串,并执行
245
245
  original_argv = sys.argv[1:]
246
- if original_argv and original_argv[0] == '-m':
247
- sys.argv = original_argv[1:]
248
- runpy.run_module(sys.argv[0], run_name='__main__')
249
- elif original_argv:
250
- target_path = original_argv[0]
251
- sys.argv = original_argv
246
+
247
+ action = None
248
+ action_arg = None
249
+ passthrough_args = []
250
+ i = 0
251
+ while i < len(original_argv):
252
+ arg = original_argv[i]
253
+ if arg == '-m':
254
+ action = 'module'
255
+ if i + 1 < len(original_argv):
256
+ action_arg = original_argv[i+1]
257
+ passthrough_args = original_argv[i+2:]
258
+ break
259
+ elif arg == '-c':
260
+ action = 'command'
261
+ if i + 1 < len(original_argv):
262
+ action_arg = original_argv[i+1]
263
+ passthrough_args = original_argv[i+2:]
264
+ break
265
+ elif arg.startswith('-'):
266
+ i += 1
267
+ else:
268
+ action = 'file'
269
+ action_arg = arg
270
+ passthrough_args = original_argv[i+1:]
271
+ break
272
+
273
+ if action == 'module' and action_arg:
274
+ sys.argv = [action_arg] + passthrough_args
275
+ runpy.run_module(action_arg, run_name='__main__')
276
+ elif action == 'command' and action_arg:
277
+ sys.argv = ['-c'] + passthrough_args
278
+ exec(action_arg, {'__name__': '__main__'})
279
+ elif action == 'file' and action_arg:
280
+ sys.argv = [action_arg] + passthrough_args
252
281
  # 使用原始的 open 来读取要执行的脚本,因为它本身不应受沙箱限制
253
- with original_open(target_path, 'r') as f:
254
- code = compile(f.read(), target_path, 'exec')
282
+ with original_open(action_arg, 'r') as f:
283
+ code = compile(f.read(), action_arg, 'exec')
255
284
  exec(code, {'__name__': '__main__'})
256
285
  else:
257
286
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.1.74
3
+ Version: 0.1.75
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=BVwdyKZMbLYVowqki3LmD_JbicxGSgjOImjkUKUD0bU,487
4
+ beswarm/aient/setup.py,sha256=hG7eswVWMMNc-xD67iN6hCTvU9HSIiqwkbkncpEpctA,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
@@ -40,7 +40,7 @@ beswarm/aient/src/aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p
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=9ihTL2W3z5q6Qh6ZqCYplTEoonL4oSj8MBzpRbvc5IE,35329
43
+ beswarm/aient/src/aient/utils/scripts.py,sha256=l8_NrwIRYxvzxPFg-vSJz120swdnxxGfgBcQRogJ4nI,36154
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
@@ -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.74.dist-info/METADATA,sha256=aEPi6UrjdSG0TaoH93wr2nBWK1QIxzp-5NjN_mrk5S0,3553
134
- beswarm-0.1.74.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
135
- beswarm-0.1.74.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
136
- beswarm-0.1.74.dist-info/RECORD,,
133
+ beswarm-0.1.75.dist-info/METADATA,sha256=cBw1e9pd4J_L77sYBtm4eyQlu3CMJbBGbG_YZljayaY,3553
134
+ beswarm-0.1.75.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
135
+ beswarm-0.1.75.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
136
+ beswarm-0.1.75.dist-info/RECORD,,