beswarm 0.2.98__py3-none-any.whl → 0.3.0__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/cli.py +68 -0
- beswarm/prompt.py +2 -0
- {beswarm-0.2.98.dist-info → beswarm-0.3.0.dist-info}/METADATA +1 -1
- {beswarm-0.2.98.dist-info → beswarm-0.3.0.dist-info}/RECORD +7 -5
- beswarm-0.3.0.dist-info/entry_points.txt +2 -0
- {beswarm-0.2.98.dist-info → beswarm-0.3.0.dist-info}/WHEEL +0 -0
- {beswarm-0.2.98.dist-info → beswarm-0.3.0.dist-info}/top_level.txt +0 -0
beswarm/cli.py
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
import os
|
2
|
+
import zipfile
|
3
|
+
import argparse
|
4
|
+
from tqdm import tqdm
|
5
|
+
|
6
|
+
def zip_beswarm_folders(source_dir, zip_filename):
|
7
|
+
"""
|
8
|
+
Traverses the source directory, finds all files within any .beswarm folder,
|
9
|
+
and adds them to a zip file, preserving the directory structure.
|
10
|
+
|
11
|
+
:param source_dir: The directory to search for .beswarm folders.
|
12
|
+
:param zip_filename: The name of the output zip file.
|
13
|
+
"""
|
14
|
+
if not os.path.isdir(source_dir):
|
15
|
+
print(f"Error: Source directory '{source_dir}' not found.")
|
16
|
+
return
|
17
|
+
|
18
|
+
source_dir = os.path.abspath(source_dir)
|
19
|
+
|
20
|
+
files_to_add = []
|
21
|
+
# Walk the entire directory tree to find all files.
|
22
|
+
for root, dirs, files in os.walk(source_dir):
|
23
|
+
for file in files:
|
24
|
+
file_path = os.path.join(root, file)
|
25
|
+
# A file should be added if its path contains a '.beswarm' directory component.
|
26
|
+
if '.beswarm' in file_path.split(os.sep):
|
27
|
+
files_to_add.append(file_path)
|
28
|
+
|
29
|
+
if not files_to_add:
|
30
|
+
print("No files found within any .beswarm directories.")
|
31
|
+
return
|
32
|
+
|
33
|
+
print(f"Found {len(files_to_add)} files in .beswarm directories to zip.")
|
34
|
+
|
35
|
+
# Create the zip file and add all the collected files.
|
36
|
+
with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
37
|
+
for file_path in tqdm(files_to_add, desc="Zipping files", unit="file"):
|
38
|
+
# arcname is the path inside the zip file.
|
39
|
+
arcname = os.path.relpath(file_path, source_dir)
|
40
|
+
zipf.write(file_path, arcname)
|
41
|
+
|
42
|
+
print(f"\nSuccessfully created '{zip_filename}'")
|
43
|
+
|
44
|
+
def main():
|
45
|
+
parser = argparse.ArgumentParser(description="Beswarm main command line interface.")
|
46
|
+
subparsers = parser.add_subparsers(dest='command', help='Available commands', required=True)
|
47
|
+
|
48
|
+
# Create the parser for the "debug" command
|
49
|
+
parser_debug = subparsers.add_parser('debug', help='Package all .beswarm folders from a directory into a zip file.')
|
50
|
+
parser_debug.add_argument(
|
51
|
+
"source_directory",
|
52
|
+
help="The source directory to search for .beswarm folders."
|
53
|
+
)
|
54
|
+
parser_debug.add_argument(
|
55
|
+
"-o", "--output",
|
56
|
+
default="beswarm_debug.zip",
|
57
|
+
help="The name of the output zip file (default: beswarm_debug.zip)."
|
58
|
+
)
|
59
|
+
|
60
|
+
args = parser.parse_args()
|
61
|
+
|
62
|
+
if args.command == 'debug':
|
63
|
+
zip_beswarm_folders(args.source_directory, args.output)
|
64
|
+
else:
|
65
|
+
parser.print_help()
|
66
|
+
|
67
|
+
if __name__ == "__main__":
|
68
|
+
main()
|
beswarm/prompt.py
CHANGED
@@ -68,6 +68,7 @@ The user's OS version is {Texts(lambda: platform.platform())}. The absolute path
|
|
68
68
|
请在指令中使用绝对路径。所有操作必须基于工作目录。禁止在工作目录之外进行任何操作。你当前运行目录不一定就是工作目录。禁止默认你当前就在工作目录。
|
69
69
|
|
70
70
|
当前时间:{Texts(lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"))}
|
71
|
+
当前目录:{Texts(lambda: os.getcwd())}
|
71
72
|
</user_info>
|
72
73
|
|
73
74
|
<instructions for tool use>
|
@@ -143,6 +144,7 @@ instruction_system_prompt = SystemMessage(f"""
|
|
143
144
|
除了任务目标里面明确提到的目录,禁止在工作目录之外进行任何操作。你当前运行目录不一定就是工作目录。禁止默认你当前就在工作目录。
|
144
145
|
|
145
146
|
当前时间:{Texts(lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"))}
|
147
|
+
当前目录:{Texts(lambda: os.getcwd())}
|
146
148
|
|
147
149
|
你的输出必须符合以下步骤,以生成最终指令:
|
148
150
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
|
2
2
|
beswarm/broker.py,sha256=64Y-djrKYaZfBQ8obwHOmr921QgZeu9BtScZWaYLfDo,9887
|
3
|
+
beswarm/cli.py,sha256=m8fcEYznUq--iLULB6nGNecUGeT-wuuSRqiooINYDpY,2472
|
3
4
|
beswarm/core.py,sha256=jKStpTTOu6Ojond_i-okTZLrvSAJ4yUoTZwtDfFTiRs,553
|
4
5
|
beswarm/knowledge_graph.py,sha256=oiOMknAJzGrOHc2AyQgvrCcZAkGLhFnsnvSBdfFBWMw,14831
|
5
|
-
beswarm/prompt.py,sha256=
|
6
|
+
beswarm/prompt.py,sha256=45onnyoY9plKM86KQefbPw5z9QJMn-mVnjlFQZcrjz0,34373
|
6
7
|
beswarm/taskmanager.py,sha256=2Uz_cthW9rWkQMJdzgsXAMlfN8Ni2Qj_DOq_L-p6XZc,12662
|
7
8
|
beswarm/utils.py,sha256=0J-b38P5QGT-A_38co7FjzaUNJykaskI7mbbcQ4w_68,8215
|
8
9
|
beswarm/agents/chatgroup.py,sha256=PzrmRcDKAbB7cxL16nMod_CzPosDV6bfTmXxQVuv-AQ,12012
|
@@ -122,7 +123,8 @@ beswarm/tools/search_web.py,sha256=0fTeczXiOX_LJQGaLEGbuJtIPzofeuquGWEt3yDMtVw,1
|
|
122
123
|
beswarm/tools/subtasks.py,sha256=NHDnmUhUPgDQKBACnpgErpFJRcsH0w_Q9VsyQjNvNHA,12658
|
123
124
|
beswarm/tools/worker.py,sha256=mQ1qdrQ8MgL99byAbTvxfEByFFGN9mty3UHqHjARMQ8,2331
|
124
125
|
beswarm/tools/write_csv.py,sha256=u0Hq18Ksfheb52MVtyLNCnSDHibITpsYBPs2ub7USYA,1466
|
125
|
-
beswarm-0.
|
126
|
-
beswarm-0.
|
127
|
-
beswarm-0.
|
128
|
-
beswarm-0.
|
126
|
+
beswarm-0.3.0.dist-info/METADATA,sha256=-qDG_Ienu_busk_vfxWkoOSQLjvgPXQGB8g0wYQlkao,3877
|
127
|
+
beswarm-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
128
|
+
beswarm-0.3.0.dist-info/entry_points.txt,sha256=URK7Y4PDzBgxIecQnxsWTu4O-eaFa1CoAcNTWh5R7LM,45
|
129
|
+
beswarm-0.3.0.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
130
|
+
beswarm-0.3.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|