beswarm 0.2.99__py3-none-any.whl → 0.3.1__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/agents/planact.py CHANGED
@@ -164,9 +164,12 @@ class WorkerAgent(BaseAgent):
164
164
  def __init__(self, goal: str, tools_json: List, agent_config: Dict, work_dir: str, cache_messages: Union[bool, List[Dict]], broker: MessageBroker, listen_topic: str, publish_topic: str, status_topic: str):
165
165
  super().__init__(goal, tools_json, agent_config, work_dir, cache_messages, broker, listen_topic, publish_topic, status_topic)
166
166
 
167
- if self.cache_messages and isinstance(self.cache_messages, list) and len(self.cache_messages) > 1:
168
- first_user_message = replace_xml_content(self.cache_messages[1]["content"], "goal", goal)
169
- self.config["cache_messages"] = self.cache_messages[0:1] + [{"role": "user", "content": first_user_message}] + self.cache_messages[2:]
167
+ if self.cache_messages and isinstance(self.cache_messages, Messages) and len(self.cache_messages) > 1:
168
+ if self.cache_messages.provider("goal"):
169
+ self.cache_messages.provider("goal").update(goal)
170
+ else:
171
+ self.cache_messages[1].insert(0, Goal(goal))
172
+ self.config["cache_messages"] = self.cache_messages
170
173
 
171
174
  self.agent = chatgpt(**self.config)
172
175
 
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.2.99
3
+ Version: 0.3.1
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,12 +1,13 @@
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
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
9
- beswarm/agents/planact.py,sha256=OjxnYNu-LkxF2zIf7o75QB25d-yVtD4-FgDllTV_nZM,18456
10
+ beswarm/agents/planact.py,sha256=QuhdpF3mVABdZ_IgXVGiMRHtAnDG4bHRMj8nTMjgq6g,18473
10
11
  beswarm/aient/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
11
12
  beswarm/aient/aient/architext/architext/__init__.py,sha256=79Ih1151rfcqZdr7F8HSZSTs_iT2SKd1xCkehMsXeXs,19
12
13
  beswarm/aient/aient/architext/architext/core.py,sha256=_o5gI5XF6e4kQo4L4x8Q1Tb7C1U0GANm24gJmvAgoXE,30546
@@ -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.2.99.dist-info/METADATA,sha256=sVKJHsH5_LbfXDOEtrGcrKTpa2NQEAMyTh3ZA84ffCI,3878
126
- beswarm-0.2.99.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
127
- beswarm-0.2.99.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
128
- beswarm-0.2.99.dist-info/RECORD,,
126
+ beswarm-0.3.1.dist-info/METADATA,sha256=gtgcjZIH2wvnqO27bdwVPiXesgsGupjr1wrArKzPOeY,3877
127
+ beswarm-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
128
+ beswarm-0.3.1.dist-info/entry_points.txt,sha256=URK7Y4PDzBgxIecQnxsWTu4O-eaFa1CoAcNTWh5R7LM,45
129
+ beswarm-0.3.1.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
130
+ beswarm-0.3.1.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ beswarm = beswarm.cli:main