open-swarm 0.1.1745125895__py3-none-any.whl → 0.1.1745125904__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: open-swarm
3
- Version: 0.1.1745125895
3
+ Version: 0.1.1745125904
4
4
  Summary: Open Swarm: Orchestrating AI Agent Swarms with Django
5
5
  Project-URL: Homepage, https://github.com/yourusername/open-swarm
6
6
  Project-URL: Documentation, https://github.com/yourusername/open-swarm/blob/main/README.md
@@ -257,6 +257,7 @@ swarm/templates/rest_mode/components/top_bar.html,sha256=I-J0Bmmcr0c6_KXEEmM6mwT
257
257
  swarm/templates/websocket_partials/final_system_message.html,sha256=hZeOez70ZvYsDrmq965kFzV6wh5dBkKkP2FTiXS0FWo,128
258
258
  swarm/templates/websocket_partials/system_message.html,sha256=0eBzz9dJBmnwDwnh-X_7wDefSatbS1LepaLhXxN-qI4,171
259
259
  swarm/templates/websocket_partials/user_message.html,sha256=-TjdT4-FKFVXeYsPglG3VayDYg1A2beE5gV6AQWu-00,149
260
+ swarm/utils/ansi_box.py,sha256=VatZxyCR83Z-taNE361vMhrm8rD-8htic5gI96V2HPg,1172
260
261
  swarm/utils/color_utils.py,sha256=utIfZ6ptGEdpHxIZiZ4gtfo5lLqZKQL5g0F8mEwMhTo,1184
261
262
  swarm/utils/context_utils.py,sha256=CsoyFALq88pcMYU8Fw1joHrssnjDuisaroEkGiDwX_8,19551
262
263
  swarm/utils/disable_tracing.py,sha256=IWe60GGs3l_pZA_OLV6qJDcAHOM2tQkMzg0Xj_x5hRE,1400
@@ -268,6 +269,8 @@ swarm/utils/message_sequence.py,sha256=7Xa7YwGPgojfkrGcl-SbeR_BWwzXGDYNqAxq8F6Xh
268
269
  swarm/utils/message_utils.py,sha256=oNTD7pfmnnu_Br24pR2VEX9afIZwFLwg2HJBLXs1blY,4074
269
270
  swarm/utils/openai_patch.py,sha256=Qogheuyh2_MTR6gO-uKgf3lu2jQc7cS72Vctc7vyXtI,1330
270
271
  swarm/utils/redact.py,sha256=vtqTztsxyBg-2qHMgAPi1lI5mJgZEb8Fqi1KKFk3bZM,2042
272
+ swarm/ux/ansi_box.py,sha256=6mG8MpqrvDXGYU87eKqtky-ib83yt_qk2wiwf9DU5rs,1558
273
+ swarm/ux/spinner.py,sha256=UouAin377z8sKfvgrIF8klp_bKbwsSCxd2jgelndn5Y,1613
271
274
  swarm/views/__init__.py,sha256=AcLk0R7Y69FhIVgJK2hZs8M_gCR-h_5iqUywz89yuHM,1223
272
275
  swarm/views/api_views.py,sha256=BbDEgI6Ftg-c-mMkE9DvRGZHIZ-WAZSfwqAB7j98WxM,1937
273
276
  swarm/views/chat_views.py,sha256=6UUtEJKrM2k_wi9A6AfhbbvMYunjzpY22M6hOIXASjA,15695
@@ -276,8 +279,8 @@ swarm/views/message_views.py,sha256=sDUnXyqKXC8WwIIMAlWf00s2_a2T9c75Na5FvYMJwBM,
276
279
  swarm/views/model_views.py,sha256=aAbU4AZmrOTaPeKMWtoKK7FPYHdaN3Zbx55JfKzYTRY,2937
277
280
  swarm/views/utils.py,sha256=8Usc0g0L0NPegNAyY20tJBNBy-JLwODf4VmxV0yUtpw,3627
278
281
  swarm/views/web_views.py,sha256=T1CKe-Nyv1C8aDt6QFTGWo_dkH7ojWAvS_QW9mZnZp0,7371
279
- open_swarm-0.1.1745125895.dist-info/METADATA,sha256=I7a_r1VuUiL-pnT0wXIbKYYQiArCmQMMmRDXaOa-y2o,26977
280
- open_swarm-0.1.1745125895.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
281
- open_swarm-0.1.1745125895.dist-info/entry_points.txt,sha256=fo28d0_zJrytRsh8QqkdlWQT_9lyAwYUx1WuSTDI3HM,177
282
- open_swarm-0.1.1745125895.dist-info/licenses/LICENSE,sha256=BU9bwRlnOt_JDIb6OT55Q4leLZx9RArDLTFnlDIrBEI,1062
283
- open_swarm-0.1.1745125895.dist-info/RECORD,,
282
+ open_swarm-0.1.1745125904.dist-info/METADATA,sha256=q8jtZKzgtpfD5DLbBjdCbEdzi3jwsKfx3Nn-WwJfJV8,26977
283
+ open_swarm-0.1.1745125904.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
284
+ open_swarm-0.1.1745125904.dist-info/entry_points.txt,sha256=fo28d0_zJrytRsh8QqkdlWQT_9lyAwYUx1WuSTDI3HM,177
285
+ open_swarm-0.1.1745125904.dist-info/licenses/LICENSE,sha256=BU9bwRlnOt_JDIb6OT55Q4leLZx9RArDLTFnlDIrBEI,1062
286
+ open_swarm-0.1.1745125904.dist-info/RECORD,,
@@ -0,0 +1,34 @@
1
+ import shutil
2
+
3
+ ANSI_COLORS = {
4
+ 'cyan': '\033[96m',
5
+ 'green': '\033[92m',
6
+ 'yellow': '\033[93m',
7
+ 'magenta': '\033[95m',
8
+ 'blue': '\033[94m',
9
+ 'red': '\033[91m',
10
+ 'white': '\033[97m',
11
+ 'grey': '\033[90m',
12
+ 'reset': '\033[0m',
13
+ }
14
+
15
+
16
+ def ansi_box(text, color='cyan', emoji='🤖', width=None):
17
+ """
18
+ Draw a fancy ANSI box around the given text, with color and emoji.
19
+ """
20
+ lines = [line.rstrip() for line in text.strip('\n').split('\n')]
21
+ max_len = max(len(line) for line in lines)
22
+ if width is None:
23
+ try:
24
+ width = min(shutil.get_terminal_size((80, 20)).columns, max_len + 6)
25
+ except Exception:
26
+ width = max_len + 6
27
+ box_width = max(width, max_len + 6)
28
+ color_code = ANSI_COLORS.get(color, ANSI_COLORS['cyan'])
29
+ reset = ANSI_COLORS['reset']
30
+ top = f"{color_code}╔{'═' * (box_width-2)}╗{reset}"
31
+ title = f"{color_code}║ {emoji} {' ' * (box_width-6)}║{reset}"
32
+ content = [f"{color_code}║ {line.ljust(box_width-4)} ║{reset}" for line in lines]
33
+ bottom = f"{color_code}╚{'═' * (box_width-2)}╝{reset}"
34
+ return '\n'.join([top, title] + content + [bottom])
swarm/ux/ansi_box.py ADDED
@@ -0,0 +1,43 @@
1
+ import sys
2
+
3
+ def ansi_box(title, content, count=None, params=None, style='default', emoji=None):
4
+ """
5
+ Print a visually distinct ANSI box summarizing search/analysis results.
6
+ - title: e.g. 'Searched filesystem', 'Analyzed code'
7
+ - content: main result string or list of strings
8
+ - count: result count (optional)
9
+ - params: dict of search parameters (optional)
10
+ - style: 'default', 'success', 'warning', etc.
11
+ - emoji: optional emoji prefix
12
+ """
13
+ border = {
14
+ 'default': '━',
15
+ 'success': '━',
16
+ 'warning': '━',
17
+ }.get(style, '━')
18
+ color = {
19
+ 'default': '\033[36m', # Cyan
20
+ 'success': '\033[32m', # Green
21
+ 'warning': '\033[33m', # Yellow
22
+ }.get(style, '\033[36m')
23
+ reset = '\033[0m'
24
+ box_width = 80
25
+ lines = []
26
+ head = f"{emoji + ' ' if emoji else ''}{title}"
27
+ if count is not None:
28
+ head += f" | Results: {count}"
29
+ if params:
30
+ head += f" | Params: {params}"
31
+ lines.append(color + border * box_width + reset)
32
+ lines.append(color + f"{head[:box_width]:^{box_width}}" + reset)
33
+ lines.append(color + border * box_width + reset)
34
+ if isinstance(content, str):
35
+ content = [content]
36
+ for line in content:
37
+ for l in str(line).split('\n'):
38
+ lines.append(f"{l[:box_width]:<{box_width}}")
39
+ lines.append(color + border * box_width + reset)
40
+ print("\n".join(lines))
41
+
42
+ # Example usage:
43
+ # ansi_box('Searched filesystem', 'Found 12 files', count=12, params={'pattern': '*.py'}, style='success', emoji='💾')
swarm/ux/spinner.py ADDED
@@ -0,0 +1,53 @@
1
+ import sys
2
+ import threading
3
+ import time
4
+
5
+ class Spinner:
6
+ """
7
+ Displays spinner states: Generating., Generating.., Generating..., Running...,
8
+ and switches to 'Taking longer than expected' after a timeout.
9
+ """
10
+ def __init__(self, base_message="Generating", long_wait_timeout=8):
11
+ self.base_message = base_message
12
+ self.states = [".", "..", "...", "..", "."]
13
+ self.running = False
14
+ self.thread = None
15
+ self.long_wait_timeout = long_wait_timeout
16
+ self._long_wait = False
17
+
18
+ def start(self):
19
+ self.running = True
20
+ self.thread = threading.Thread(target=self._spin, daemon=True)
21
+ self.thread.start()
22
+
23
+ def stop(self):
24
+ self.running = False
25
+ if self.thread:
26
+ self.thread.join()
27
+ sys.stdout.write("\r" + " " * 80 + "\r")
28
+ sys.stdout.flush()
29
+
30
+ def _spin(self):
31
+ idx = 0
32
+ start_time = time.time()
33
+ while self.running:
34
+ if not self._long_wait and (time.time() - start_time > self.long_wait_timeout):
35
+ self._long_wait = True
36
+ if self._long_wait:
37
+ msg = f"{self.base_message}... Taking longer than expected"
38
+ else:
39
+ msg = f"{self.base_message}{self.states[idx % len(self.states)]}"
40
+ sys.stdout.write(f"\r{msg}")
41
+ sys.stdout.flush()
42
+ time.sleep(0.4)
43
+ idx += 1
44
+
45
+ def set_message(self, message):
46
+ self.base_message = message
47
+ self._long_wait = False
48
+
49
+ # Example usage:
50
+ # spinner = Spinner()
51
+ # spinner.start()
52
+ # ... do work ...
53
+ # spinner.stop()