open-swarm 0.1.1745274976__py3-none-any.whl → 0.1.1748636259__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.
Files changed (295) hide show
  1. open_swarm-0.1.1748636259.dist-info/METADATA +188 -0
  2. open_swarm-0.1.1748636259.dist-info/RECORD +82 -0
  3. {open_swarm-0.1.1745274976.dist-info → open_swarm-0.1.1748636259.dist-info}/WHEEL +2 -1
  4. open_swarm-0.1.1748636259.dist-info/entry_points.txt +3 -0
  5. open_swarm-0.1.1748636259.dist-info/top_level.txt +1 -0
  6. swarm/agent/agent.py +49 -0
  7. swarm/auth.py +48 -113
  8. swarm/consumers.py +0 -19
  9. swarm/extensions/blueprint/__init__.py +16 -30
  10. swarm/{core → extensions/blueprint}/agent_utils.py +1 -1
  11. swarm/extensions/blueprint/blueprint_base.py +458 -0
  12. swarm/extensions/blueprint/blueprint_discovery.py +112 -0
  13. swarm/extensions/blueprint/output_utils.py +95 -0
  14. swarm/{core → extensions/blueprint}/spinner.py +21 -30
  15. swarm/extensions/cli/cli_args.py +0 -6
  16. swarm/extensions/cli/commands/blueprint_management.py +9 -47
  17. swarm/extensions/cli/commands/config_management.py +6 -5
  18. swarm/extensions/cli/commands/edit_config.py +7 -16
  19. swarm/extensions/cli/commands/list_blueprints.py +1 -1
  20. swarm/extensions/cli/commands/validate_env.py +4 -11
  21. swarm/extensions/cli/commands/validate_envvars.py +6 -6
  22. swarm/extensions/cli/interactive_shell.py +2 -16
  23. swarm/extensions/config/config_loader.py +201 -107
  24. swarm/{core → extensions/config}/config_manager.py +38 -50
  25. swarm/{core → extensions/config}/server_config.py +0 -32
  26. swarm/extensions/launchers/build_launchers.py +14 -0
  27. swarm/{core → extensions/launchers}/build_swarm_wrapper.py +0 -0
  28. swarm/extensions/launchers/swarm_api.py +64 -8
  29. swarm/extensions/launchers/swarm_cli.py +300 -8
  30. swarm/llm/chat_completion.py +195 -0
  31. swarm/serializers.py +5 -96
  32. swarm/settings.py +111 -99
  33. swarm/urls.py +74 -57
  34. swarm/utils/context_utils.py +4 -10
  35. swarm/utils/general_utils.py +0 -21
  36. swarm/utils/redact.py +36 -23
  37. swarm/views/api_views.py +39 -48
  38. swarm/views/chat_views.py +70 -237
  39. swarm/views/core_views.py +87 -80
  40. swarm/views/model_views.py +121 -64
  41. swarm/views/utils.py +441 -65
  42. swarm/views/web_views.py +2 -2
  43. open_swarm-0.1.1745274976.dist-info/METADATA +0 -874
  44. open_swarm-0.1.1745274976.dist-info/RECORD +0 -318
  45. open_swarm-0.1.1745274976.dist-info/entry_points.txt +0 -4
  46. swarm/blueprints/README.md +0 -68
  47. swarm/blueprints/blueprint_audit_status.json +0 -27
  48. swarm/blueprints/chatbot/README.md +0 -40
  49. swarm/blueprints/chatbot/blueprint_chatbot.py +0 -471
  50. swarm/blueprints/chatbot/metadata.json +0 -23
  51. swarm/blueprints/chatbot/templates/chatbot/chatbot.html +0 -33
  52. swarm/blueprints/chucks_angels/README.md +0 -11
  53. swarm/blueprints/chucks_angels/blueprint_chucks_angels.py +0 -7
  54. swarm/blueprints/chucks_angels/test_basic.py +0 -3
  55. swarm/blueprints/codey/CODEY.md +0 -15
  56. swarm/blueprints/codey/README.md +0 -115
  57. swarm/blueprints/codey/blueprint_codey.py +0 -1072
  58. swarm/blueprints/codey/codey_cli.py +0 -373
  59. swarm/blueprints/codey/instructions.md +0 -17
  60. swarm/blueprints/codey/metadata.json +0 -23
  61. swarm/blueprints/common/operation_box_utils.py +0 -83
  62. swarm/blueprints/digitalbutlers/README.md +0 -11
  63. swarm/blueprints/digitalbutlers/__init__.py +0 -1
  64. swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py +0 -7
  65. swarm/blueprints/digitalbutlers/test_basic.py +0 -3
  66. swarm/blueprints/divine_code/README.md +0 -3
  67. swarm/blueprints/divine_code/__init__.py +0 -10
  68. swarm/blueprints/divine_code/apps.py +0 -11
  69. swarm/blueprints/divine_code/blueprint_divine_code.py +0 -270
  70. swarm/blueprints/django_chat/apps.py +0 -6
  71. swarm/blueprints/django_chat/blueprint_django_chat.py +0 -268
  72. swarm/blueprints/django_chat/templates/django_chat/django_chat_webpage.html +0 -37
  73. swarm/blueprints/django_chat/urls.py +0 -8
  74. swarm/blueprints/django_chat/views.py +0 -32
  75. swarm/blueprints/echocraft/blueprint_echocraft.py +0 -384
  76. swarm/blueprints/flock/README.md +0 -11
  77. swarm/blueprints/flock/__init__.py +0 -8
  78. swarm/blueprints/flock/blueprint_flock.py +0 -7
  79. swarm/blueprints/flock/test_basic.py +0 -3
  80. swarm/blueprints/geese/README.md +0 -97
  81. swarm/blueprints/geese/blueprint_geese.py +0 -803
  82. swarm/blueprints/geese/geese_cli.py +0 -102
  83. swarm/blueprints/jeeves/README.md +0 -41
  84. swarm/blueprints/jeeves/blueprint_jeeves.py +0 -722
  85. swarm/blueprints/jeeves/jeeves_cli.py +0 -55
  86. swarm/blueprints/jeeves/metadata.json +0 -24
  87. swarm/blueprints/mcp_demo/blueprint_mcp_demo.py +0 -473
  88. swarm/blueprints/messenger/templates/messenger/messenger.html +0 -46
  89. swarm/blueprints/mission_improbable/blueprint_mission_improbable.py +0 -423
  90. swarm/blueprints/monkai_magic/blueprint_monkai_magic.py +0 -340
  91. swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py +0 -265
  92. swarm/blueprints/omniplex/blueprint_omniplex.py +0 -298
  93. swarm/blueprints/poets/blueprint_poets.py +0 -546
  94. swarm/blueprints/poets/poets_cli.py +0 -23
  95. swarm/blueprints/rue_code/README.md +0 -8
  96. swarm/blueprints/rue_code/blueprint_rue_code.py +0 -448
  97. swarm/blueprints/rue_code/rue_code_cli.py +0 -43
  98. swarm/blueprints/stewie/apps.py +0 -12
  99. swarm/blueprints/stewie/blueprint_family_ties.py +0 -349
  100. swarm/blueprints/stewie/models.py +0 -19
  101. swarm/blueprints/stewie/serializers.py +0 -10
  102. swarm/blueprints/stewie/settings.py +0 -17
  103. swarm/blueprints/stewie/urls.py +0 -11
  104. swarm/blueprints/stewie/views.py +0 -26
  105. swarm/blueprints/suggestion/blueprint_suggestion.py +0 -222
  106. swarm/blueprints/whinge_surf/README.md +0 -22
  107. swarm/blueprints/whinge_surf/__init__.py +0 -1
  108. swarm/blueprints/whinge_surf/blueprint_whinge_surf.py +0 -565
  109. swarm/blueprints/whinge_surf/whinge_surf_cli.py +0 -99
  110. swarm/blueprints/whiskeytango_foxtrot/__init__.py +0 -0
  111. swarm/blueprints/whiskeytango_foxtrot/apps.py +0 -11
  112. swarm/blueprints/whiskeytango_foxtrot/blueprint_whiskeytango_foxtrot.py +0 -339
  113. swarm/blueprints/zeus/__init__.py +0 -2
  114. swarm/blueprints/zeus/apps.py +0 -4
  115. swarm/blueprints/zeus/blueprint_zeus.py +0 -270
  116. swarm/blueprints/zeus/zeus_cli.py +0 -13
  117. swarm/cli/async_input.py +0 -65
  118. swarm/cli/async_input_demo.py +0 -32
  119. swarm/core/blueprint_base.py +0 -769
  120. swarm/core/blueprint_discovery.py +0 -125
  121. swarm/core/blueprint_runner.py +0 -59
  122. swarm/core/blueprint_ux.py +0 -109
  123. swarm/core/build_launchers.py +0 -15
  124. swarm/core/cli/__init__.py +0 -1
  125. swarm/core/cli/commands/__init__.py +0 -1
  126. swarm/core/cli/commands/blueprint_management.py +0 -7
  127. swarm/core/cli/interactive_shell.py +0 -14
  128. swarm/core/cli/main.py +0 -50
  129. swarm/core/cli/utils/__init__.py +0 -1
  130. swarm/core/cli/utils/discover_commands.py +0 -18
  131. swarm/core/config_loader.py +0 -122
  132. swarm/core/output_utils.py +0 -193
  133. swarm/core/session_logger.py +0 -42
  134. swarm/core/slash_commands.py +0 -89
  135. swarm/core/swarm_api.py +0 -68
  136. swarm/core/swarm_cli.py +0 -216
  137. swarm/core/utils/__init__.py +0 -0
  138. swarm/extensions/blueprint/cli_handler.py +0 -197
  139. swarm/extensions/blueprint/runnable_blueprint.py +0 -42
  140. swarm/extensions/cli/utils/__init__.py +0 -1
  141. swarm/extensions/cli/utils/async_input.py +0 -46
  142. swarm/extensions/cli/utils/prompt_user.py +0 -3
  143. swarm/management/__init__.py +0 -0
  144. swarm/management/commands/__init__.py +0 -0
  145. swarm/management/commands/runserver.py +0 -58
  146. swarm/middleware.py +0 -65
  147. swarm/permissions.py +0 -38
  148. swarm/static/contrib/fonts/fontawesome-webfont.ttf +0 -7
  149. swarm/static/contrib/fonts/fontawesome-webfont.woff +0 -7
  150. swarm/static/contrib/fonts/fontawesome-webfont.woff2 +0 -7
  151. swarm/static/contrib/markedjs/marked.min.js +0 -6
  152. swarm/static/contrib/tabler-icons/adjustments-horizontal.svg +0 -27
  153. swarm/static/contrib/tabler-icons/alert-triangle.svg +0 -21
  154. swarm/static/contrib/tabler-icons/archive.svg +0 -21
  155. swarm/static/contrib/tabler-icons/artboard.svg +0 -27
  156. swarm/static/contrib/tabler-icons/automatic-gearbox.svg +0 -23
  157. swarm/static/contrib/tabler-icons/box-multiple.svg +0 -19
  158. swarm/static/contrib/tabler-icons/carambola.svg +0 -19
  159. swarm/static/contrib/tabler-icons/copy.svg +0 -20
  160. swarm/static/contrib/tabler-icons/download.svg +0 -21
  161. swarm/static/contrib/tabler-icons/edit.svg +0 -21
  162. swarm/static/contrib/tabler-icons/filled/carambola.svg +0 -13
  163. swarm/static/contrib/tabler-icons/filled/paint.svg +0 -13
  164. swarm/static/contrib/tabler-icons/headset.svg +0 -22
  165. swarm/static/contrib/tabler-icons/layout-sidebar-left-collapse.svg +0 -21
  166. swarm/static/contrib/tabler-icons/layout-sidebar-left-expand.svg +0 -21
  167. swarm/static/contrib/tabler-icons/layout-sidebar-right-collapse.svg +0 -21
  168. swarm/static/contrib/tabler-icons/layout-sidebar-right-expand.svg +0 -21
  169. swarm/static/contrib/tabler-icons/message-chatbot.svg +0 -22
  170. swarm/static/contrib/tabler-icons/message-star.svg +0 -22
  171. swarm/static/contrib/tabler-icons/message-x.svg +0 -23
  172. swarm/static/contrib/tabler-icons/message.svg +0 -21
  173. swarm/static/contrib/tabler-icons/paperclip.svg +0 -18
  174. swarm/static/contrib/tabler-icons/playlist-add.svg +0 -22
  175. swarm/static/contrib/tabler-icons/robot.svg +0 -26
  176. swarm/static/contrib/tabler-icons/search.svg +0 -19
  177. swarm/static/contrib/tabler-icons/settings.svg +0 -20
  178. swarm/static/contrib/tabler-icons/thumb-down.svg +0 -19
  179. swarm/static/contrib/tabler-icons/thumb-up.svg +0 -19
  180. swarm/static/css/dropdown.css +0 -22
  181. swarm/static/htmx/htmx.min.js +0 -0
  182. swarm/static/js/dropdown.js +0 -23
  183. swarm/static/rest_mode/css/base.css +0 -470
  184. swarm/static/rest_mode/css/chat-history.css +0 -286
  185. swarm/static/rest_mode/css/chat.css +0 -251
  186. swarm/static/rest_mode/css/chatbot.css +0 -74
  187. swarm/static/rest_mode/css/chatgpt.css +0 -62
  188. swarm/static/rest_mode/css/colors/corporate.css +0 -74
  189. swarm/static/rest_mode/css/colors/pastel.css +0 -81
  190. swarm/static/rest_mode/css/colors/tropical.css +0 -82
  191. swarm/static/rest_mode/css/general.css +0 -142
  192. swarm/static/rest_mode/css/layout.css +0 -167
  193. swarm/static/rest_mode/css/layouts/messenger-layout.css +0 -17
  194. swarm/static/rest_mode/css/layouts/minimalist-layout.css +0 -57
  195. swarm/static/rest_mode/css/layouts/mobile-layout.css +0 -8
  196. swarm/static/rest_mode/css/messages.css +0 -84
  197. swarm/static/rest_mode/css/messenger.css +0 -135
  198. swarm/static/rest_mode/css/settings.css +0 -91
  199. swarm/static/rest_mode/css/simple.css +0 -44
  200. swarm/static/rest_mode/css/slack.css +0 -58
  201. swarm/static/rest_mode/css/style.css +0 -156
  202. swarm/static/rest_mode/css/theme.css +0 -30
  203. swarm/static/rest_mode/css/toast.css +0 -40
  204. swarm/static/rest_mode/js/auth.js +0 -9
  205. swarm/static/rest_mode/js/blueprint.js +0 -41
  206. swarm/static/rest_mode/js/blueprintUtils.js +0 -12
  207. swarm/static/rest_mode/js/chatLogic.js +0 -79
  208. swarm/static/rest_mode/js/debug.js +0 -63
  209. swarm/static/rest_mode/js/events.js +0 -98
  210. swarm/static/rest_mode/js/main.js +0 -19
  211. swarm/static/rest_mode/js/messages.js +0 -264
  212. swarm/static/rest_mode/js/messengerLogic.js +0 -355
  213. swarm/static/rest_mode/js/modules/apiService.js +0 -84
  214. swarm/static/rest_mode/js/modules/blueprintManager.js +0 -162
  215. swarm/static/rest_mode/js/modules/chatHistory.js +0 -110
  216. swarm/static/rest_mode/js/modules/debugLogger.js +0 -14
  217. swarm/static/rest_mode/js/modules/eventHandlers.js +0 -107
  218. swarm/static/rest_mode/js/modules/messageProcessor.js +0 -120
  219. swarm/static/rest_mode/js/modules/state.js +0 -7
  220. swarm/static/rest_mode/js/modules/userInteractions.js +0 -29
  221. swarm/static/rest_mode/js/modules/validation.js +0 -23
  222. swarm/static/rest_mode/js/rendering.js +0 -119
  223. swarm/static/rest_mode/js/settings.js +0 -130
  224. swarm/static/rest_mode/js/sidebar.js +0 -94
  225. swarm/static/rest_mode/js/simpleLogic.js +0 -37
  226. swarm/static/rest_mode/js/slackLogic.js +0 -66
  227. swarm/static/rest_mode/js/splash.js +0 -76
  228. swarm/static/rest_mode/js/theme.js +0 -111
  229. swarm/static/rest_mode/js/toast.js +0 -36
  230. swarm/static/rest_mode/js/ui.js +0 -265
  231. swarm/static/rest_mode/js/validation.js +0 -57
  232. swarm/static/rest_mode/svg/animated_spinner.svg +0 -12
  233. swarm/static/rest_mode/svg/arrow_down.svg +0 -5
  234. swarm/static/rest_mode/svg/arrow_left.svg +0 -5
  235. swarm/static/rest_mode/svg/arrow_right.svg +0 -5
  236. swarm/static/rest_mode/svg/arrow_up.svg +0 -5
  237. swarm/static/rest_mode/svg/attach.svg +0 -8
  238. swarm/static/rest_mode/svg/avatar.svg +0 -7
  239. swarm/static/rest_mode/svg/canvas.svg +0 -6
  240. swarm/static/rest_mode/svg/chat_history.svg +0 -4
  241. swarm/static/rest_mode/svg/close.svg +0 -5
  242. swarm/static/rest_mode/svg/copy.svg +0 -4
  243. swarm/static/rest_mode/svg/dark_mode.svg +0 -3
  244. swarm/static/rest_mode/svg/edit.svg +0 -5
  245. swarm/static/rest_mode/svg/layout.svg +0 -9
  246. swarm/static/rest_mode/svg/logo.svg +0 -29
  247. swarm/static/rest_mode/svg/logout.svg +0 -5
  248. swarm/static/rest_mode/svg/mobile.svg +0 -5
  249. swarm/static/rest_mode/svg/new_chat.svg +0 -4
  250. swarm/static/rest_mode/svg/not_visible.svg +0 -5
  251. swarm/static/rest_mode/svg/plus.svg +0 -7
  252. swarm/static/rest_mode/svg/run_code.svg +0 -6
  253. swarm/static/rest_mode/svg/save.svg +0 -4
  254. swarm/static/rest_mode/svg/search.svg +0 -6
  255. swarm/static/rest_mode/svg/settings.svg +0 -4
  256. swarm/static/rest_mode/svg/speaker.svg +0 -5
  257. swarm/static/rest_mode/svg/stop.svg +0 -6
  258. swarm/static/rest_mode/svg/thumbs_down.svg +0 -3
  259. swarm/static/rest_mode/svg/thumbs_up.svg +0 -3
  260. swarm/static/rest_mode/svg/toggle_off.svg +0 -6
  261. swarm/static/rest_mode/svg/toggle_on.svg +0 -6
  262. swarm/static/rest_mode/svg/trash.svg +0 -10
  263. swarm/static/rest_mode/svg/undo.svg +0 -3
  264. swarm/static/rest_mode/svg/visible.svg +0 -8
  265. swarm/static/rest_mode/svg/voice.svg +0 -10
  266. swarm/templates/account/login.html +0 -22
  267. swarm/templates/account/signup.html +0 -32
  268. swarm/templates/base.html +0 -30
  269. swarm/templates/chat.html +0 -43
  270. swarm/templates/index.html +0 -35
  271. swarm/templates/rest_mode/components/chat_sidebar.html +0 -55
  272. swarm/templates/rest_mode/components/header.html +0 -45
  273. swarm/templates/rest_mode/components/main_chat_pane.html +0 -41
  274. swarm/templates/rest_mode/components/settings_dialog.html +0 -97
  275. swarm/templates/rest_mode/components/splash_screen.html +0 -7
  276. swarm/templates/rest_mode/components/top_bar.html +0 -28
  277. swarm/templates/rest_mode/message_ui.html +0 -50
  278. swarm/templates/rest_mode/slackbot.html +0 -30
  279. swarm/templates/simple_blueprint_page.html +0 -24
  280. swarm/templates/websocket_partials/final_system_message.html +0 -3
  281. swarm/templates/websocket_partials/system_message.html +0 -4
  282. swarm/templates/websocket_partials/user_message.html +0 -5
  283. swarm/utils/ansi_box.py +0 -34
  284. swarm/utils/disable_tracing.py +0 -38
  285. swarm/utils/log_utils.py +0 -63
  286. swarm/utils/openai_patch.py +0 -33
  287. swarm/ux/ansi_box.py +0 -43
  288. swarm/ux/spinner.py +0 -53
  289. {open_swarm-0.1.1745274976.dist-info → open_swarm-0.1.1748636259.dist-info}/licenses/LICENSE +0 -0
  290. /swarm/{core → extensions/blueprint}/blueprint_utils.py +0 -0
  291. /swarm/{core → extensions/blueprint}/common_utils.py +0 -0
  292. /swarm/{core → extensions/config}/setup_wizard.py +0 -0
  293. /swarm/{blueprints/rue_code → extensions/config/utils}/__init__.py +0 -0
  294. /swarm/{core → extensions/config}/utils/logger.py +0 -0
  295. /swarm/{core → extensions/launchers}/swarm_wrapper.py +0 -0
@@ -6,36 +6,29 @@ import os
6
6
  import sys
7
7
  import threading
8
8
  import time
9
- from typing import Optional
10
9
 
11
10
  class Spinner:
12
11
  """Simple terminal spinner for interactive feedback."""
13
12
  # Define spinner characters (can be customized)
14
13
  SPINNER_CHARS = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
15
- # Custom status sequences for special cases
16
- STATUS_SEQUENCES = {
17
- 'generating': ['Generating.', 'Generating..', 'Generating...'],
18
- 'running': ['Running...']
19
- }
14
+ # SPINNER_CHARS = ['|', '/', '-', '\\'] # Simpler alternative
20
15
 
21
- def __init__(self, interactive: bool, custom_sequence: str = None):
16
+ def __init__(self, interactive: bool):
22
17
  """
23
18
  Initialize the spinner.
24
19
 
25
20
  Args:
26
21
  interactive (bool): Hint whether the environment is interactive.
27
22
  Spinner is disabled if False or if output is not a TTY.
28
- custom_sequence (str): Optional name for a custom status sequence (e.g., 'generating', 'running').
29
23
  """
30
24
  self.interactive = interactive
25
+ # Check if output is a TTY (terminal) and interactive flag is True
31
26
  self.is_tty = sys.stdout.isatty()
32
27
  self.enabled = self.interactive and self.is_tty
33
28
  self.running = False
34
29
  self.thread: Optional[threading.Thread] = None
35
30
  self.status = ""
36
31
  self.index = 0
37
- self.custom_sequence = custom_sequence
38
- self.sequence_idx = 0
39
32
 
40
33
  def start(self, status: str = "Processing..."):
41
34
  """Start the spinner with an optional status message."""
@@ -43,7 +36,7 @@ class Spinner:
43
36
  return # Do nothing if disabled or already running
44
37
  self.status = status
45
38
  self.running = True
46
- self.sequence_idx = 0
39
+ # Run the spinner animation in a separate daemon thread
47
40
  self.thread = threading.Thread(target=self._spin, daemon=True)
48
41
  self.thread.start()
49
42
 
@@ -54,33 +47,30 @@ class Spinner:
54
47
  self.running = False
55
48
  if self.thread is not None:
56
49
  self.thread.join() # Wait for the thread to finish
50
+ # Clear the spinner line using ANSI escape codes
51
+ # \r: Carriage return (move cursor to beginning of line)
52
+ # \033[K: Clear line from cursor to end
57
53
  sys.stdout.write("\r\033[K")
58
54
  sys.stdout.flush()
59
- self.thread = None
55
+ self.thread = None # Reset thread
60
56
 
61
57
  def _spin(self):
62
58
  """Internal method running in the spinner thread to animate."""
63
- start_time = time.time()
64
- warned = False
65
59
  while self.running:
66
- elapsed = time.time() - start_time
67
- if self.custom_sequence and self.custom_sequence in self.STATUS_SEQUENCES:
68
- seq = self.STATUS_SEQUENCES[self.custom_sequence]
69
- # If taking longer than 10s, show special message
70
- if elapsed > 10 and not warned:
71
- msg = f"{seq[-1]} Taking longer than expected"
72
- warned = True
73
- else:
74
- msg = seq[self.sequence_idx % len(seq)]
75
- sys.stdout.write(f"\r{msg}\033[K")
76
- sys.stdout.flush()
77
- self.sequence_idx += 1
78
- else:
79
- char = self.SPINNER_CHARS[self.index % len(self.SPINNER_CHARS)]
60
+ # Get the next spinner character
61
+ char = self.SPINNER_CHARS[self.index % len(self.SPINNER_CHARS)]
62
+ # Write spinner char and status, overwrite previous line content
63
+ try:
64
+ # \r moves cursor to beginning, \033[K clears the rest of the line
80
65
  sys.stdout.write(f"\r{char} {self.status}\033[K")
81
66
  sys.stdout.flush()
82
- self.index += 1
83
- time.sleep(0.4 if self.custom_sequence else 0.1)
67
+ except BlockingIOError:
68
+ # Handle potential issues if stdout is blocked (less likely for TTY)
69
+ time.sleep(0.1)
70
+ continue
71
+ self.index += 1
72
+ # Pause for animation effect
73
+ time.sleep(0.1)
84
74
 
85
75
  # Example usage (if run directly)
86
76
  if __name__ == "__main__":
@@ -98,3 +88,4 @@ if __name__ == "__main__":
98
88
  finally:
99
89
  s.stop() # Ensure spinner stops on exit/error
100
90
  print("Test finished.")
91
+
@@ -1,14 +1,8 @@
1
1
  # src/swarm/extensions/blueprint/modes/cli_mode/cli_args.py
2
2
 
3
3
  import argparse
4
- import os
5
- import sys
6
4
  from typing import Namespace
7
5
 
8
- # --- DEBUG PRINTS REMOVED BY CASCADE ---
9
- # print(f"[DEBUG] cli_args.py startup: sys.argv={sys.argv}")
10
- # print(f"[DEBUG] cli_args.py startup: LITELLM_MODEL={os.environ.get('LITELLM_MODEL')}, DEFAULT_LLM={os.environ.get('DEFAULT_LLM')}")
11
-
12
6
  def parse_arguments() -> Namespace:
13
7
  """
14
8
  Parse command-line arguments for dynamic LLM configuration, MCP server management, and other overrides.
@@ -1,7 +1,7 @@
1
1
  # Handles blueprint discovery and validation for the CLI
2
2
 
3
- from swarm.core.blueprint_discovery import discover_blueprints
4
- # from swarm.core.config_loader import load_server_config # Removed: function does not exist
3
+ from swarm.extensions.blueprint.discovery import discover_blueprints
4
+ from swarm.extensions.config.config_loader import load_server_config
5
5
 
6
6
  def list_blueprints():
7
7
  """List available blueprints and their metadata."""
@@ -13,57 +13,19 @@ def list_blueprints():
13
13
  for name, metadata in blueprints.items():
14
14
  print(f"- {name}: {metadata.get('description', 'No description available.')}")
15
15
 
16
- def enable_blueprint(blueprint_name):
17
- """
18
- Enable a blueprint by adding it to config and creating a CLI symlink.
19
- """
20
- import json
21
- import os
22
- from pathlib import Path
23
- CONFIG_PATH = os.path.expanduser("~/.config/swarm/swarm_config.json")
24
- BIN_DIR = os.path.expanduser("~/.local/bin")
25
- BP_RUNNER = os.path.join(os.path.dirname(__file__), "../../../../src/swarm/blueprints/{}/blueprint_{}.py".format(blueprint_name, blueprint_name))
26
- CLI_SYMLINK = os.path.join(BIN_DIR, blueprint_name)
27
-
28
- # Load config
29
- with open(CONFIG_PATH, "r") as f:
30
- config = json.load(f)
31
- enabled = config.get("blueprints", {}).get("enabled", [])
32
- if blueprint_name in enabled:
33
- print(f"Blueprint '{blueprint_name}' is already enabled.")
34
- return
35
- # Add to config
36
- enabled.append(blueprint_name)
37
- if "blueprints" not in config:
38
- config["blueprints"] = {}
39
- config["blueprints"]["enabled"] = enabled
40
- with open(CONFIG_PATH, "w") as f:
41
- json.dump(config, f, indent=2)
42
- # Ensure bin dir exists
43
- os.makedirs(BIN_DIR, exist_ok=True)
44
- # Create symlink (Python runner)
45
- if not os.path.isfile(BP_RUNNER):
46
- print(f"Blueprint runner not found: {BP_RUNNER}")
47
- return
48
- # Write a .sh launcher wrapper for .py if not present
49
- CLI_WRAPPER = CLI_SYMLINK
50
- with open(CLI_WRAPPER, "w") as f:
51
- f.write(f"#!/usr/bin/env bash\nexec python3 '{os.path.abspath(BP_RUNNER)}' \"$@\"")
52
- os.chmod(CLI_WRAPPER, 0o755)
53
- print(f"Enabled blueprint '{blueprint_name}'. CLI utility installed at {CLI_WRAPPER}.")
54
-
16
+ cat > src/swarm/extensions/cli/commands/config_management.py << 'EOF'
55
17
  # Handles configuration management workflows (e.g., LLM, MCP servers)
56
18
 
57
- # from swarm.core.config_loader import (
58
- # load_server_config,
59
- # save_server_config,
60
- # )
19
+ from swarm.extensions.config.config_loader import (
20
+ load_server_config,
21
+ save_server_config,
22
+ )
61
23
 
62
24
  def add_llm(model_name, api_key):
63
25
  """Add a new LLM configuration."""
64
- config = {} # load_server_config()
26
+ config = load_server_config()
65
27
  if "llms" not in config:
66
28
  config["llms"] = {}
67
29
  config["llms"][model_name] = {"api_key": api_key}
68
- # save_server_config(config)
30
+ save_server_config(config)
69
31
  print(f"Added LLM '{model_name}' to configuration.")
@@ -1,14 +1,15 @@
1
1
  # Handles configuration management workflows (e.g., LLM, MCP servers)
2
2
 
3
- from swarm.core import config_loader
4
- from swarm.core import config_manager
5
- from swarm.core import server_config
3
+ from swarm.extensions.config.config_loader import (
4
+ load_server_config,
5
+ save_server_config,
6
+ )
6
7
 
7
8
  def add_llm(model_name, api_key):
8
9
  """Add a new LLM configuration."""
9
- config = config_loader.load_server_config()
10
+ config = load_server_config()
10
11
  if "llms" not in config:
11
12
  config["llms"] = {}
12
13
  config["llms"][model_name] = {"api_key": api_key}
13
- config_manager.save_server_config(config)
14
+ save_server_config(config)
14
15
  print(f"Added LLM '{model_name}' to configuration.")
@@ -1,21 +1,12 @@
1
1
  import argparse
2
2
  import json
3
- from swarm.core import (
4
- config_loader,
5
- config_manager,
6
- server_config,
7
- setup_wizard,
3
+ from swarm.extensions.config.config_loader import (
4
+ load_server_config,
5
+ save_server_config,
8
6
  )
9
7
  from pathlib import Path
10
- import os
11
8
 
12
- def get_xdg_config_path():
13
- config_home = os.environ.get("XDG_CONFIG_HOME", str(Path.home() / ".config"))
14
- config_dir = Path(config_home) / "swarm"
15
- config_dir.mkdir(parents=True, exist_ok=True)
16
- return config_dir / "swarm_config.json"
17
-
18
- CONFIG_PATH = get_xdg_config_path()
9
+ CONFIG_PATH = Path("swarm_config.json").resolve()
19
10
 
20
11
  def list_config(config):
21
12
  """
@@ -69,7 +60,7 @@ def main():
69
60
  args = parser.parse_args()
70
61
 
71
62
  try:
72
- config = config_loader.load_server_config(str(CONFIG_PATH))
63
+ config = load_server_config(str(CONFIG_PATH))
73
64
  except FileNotFoundError as e:
74
65
  print(f"Error: {e}")
75
66
  return
@@ -78,9 +69,9 @@ def main():
78
69
  list_config(config)
79
70
  elif args.interactive:
80
71
  edit_config_interactive(config)
81
- config_loader.save_server_config(str(CONFIG_PATH), config)
72
+ save_server_config(str(CONFIG_PATH), config)
82
73
  elif args.field and args.value:
83
74
  edit_config_field(config, args.field, args.value)
84
- config_loader.save_server_config(str(CONFIG_PATH), config)
75
+ save_server_config(str(CONFIG_PATH), config)
85
76
  else:
86
77
  parser.print_help()
@@ -4,7 +4,7 @@ Description: Lists all blueprints available in the system.
4
4
  """
5
5
 
6
6
  from pathlib import Path
7
- from swarm.core.blueprint_discovery import discover_blueprints
7
+ from swarm.extensions.blueprint.blueprint_discovery import discover_blueprints
8
8
 
9
9
  # Metadata for dynamic registration
10
10
  description = "Lists all blueprints available in the system."
@@ -1,16 +1,9 @@
1
1
  import os
2
2
  import argparse
3
- from pathlib import Path
4
- from swarm.core import config_loader, config_manager, server_config
5
- from swarm.core.blueprint_base import BlueprintBase
3
+ from swarm.extensions.config.config_loader import load_server_config
4
+ from swarm.extensions.blueprint.blueprint_base import BlueprintBase
6
5
 
7
- def get_xdg_config_path():
8
- config_home = os.environ.get("XDG_CONFIG_HOME", str(Path.home() / ".config"))
9
- config_dir = Path(config_home) / "swarm"
10
- config_dir.mkdir(parents=True, exist_ok=True)
11
- return config_dir / "swarm_config.json"
12
-
13
- CONFIG_PATH = str(get_xdg_config_path())
6
+ CONFIG_PATH = "swarm_config.json"
14
7
 
15
8
  def validate_all_env_vars(config):
16
9
  """
@@ -50,7 +43,7 @@ def main():
50
43
  args = parser.parse_args()
51
44
 
52
45
  try:
53
- config = server_config.load_server_config(CONFIG_PATH)
46
+ config = load_server_config(CONFIG_PATH)
54
47
  except FileNotFoundError as e:
55
48
  print(f"Error: {e}")
56
49
  return
@@ -1,5 +1,5 @@
1
- from swarm.core.blueprint_discovery import discover_blueprints
2
- from swarm.core import config_loader, config_manager, server_config
1
+ from swarm.extensions.blueprint.blueprint_discovery import discover_blueprints
2
+ from swarm.extensions.config.config_loader import load_env_config, validate_env_vars
3
3
  import argparse
4
4
 
5
5
  def validate_envvars(blueprint_name=None):
@@ -19,16 +19,16 @@ def validate_envvars(blueprint_name=None):
19
19
  print(f"Blueprint '{blueprint_name}' not found.")
20
20
  return
21
21
  required_vars = blueprint.get("env_vars", [])
22
- env_vars = config_loader.load_env_config()
23
- validation = config_manager.validate_env_vars(env_vars, required_vars)
22
+ env_vars = load_env_config()
23
+ validation = validate_env_vars(env_vars, required_vars)
24
24
  print(f"Validation for '{blueprint_name}': {validation}")
25
25
  else:
26
26
  # Global validation
27
- env_vars = config_loader.load_env_config()
27
+ env_vars = load_env_config()
28
28
  print("Global Environment Validation:")
29
29
  for blueprint_name, blueprint_data in blueprints.items():
30
30
  required_vars = blueprint_data.get("env_vars", [])
31
- validation = config_manager.validate_env_vars(env_vars, required_vars)
31
+ validation = validate_env_vars(env_vars, required_vars)
32
32
  print(f"Validation for '{blueprint_name}': {validation}")
33
33
 
34
34
  def main():
@@ -35,21 +35,7 @@ def interactive_shell():
35
35
  break
36
36
 
37
37
  def show_help(commands):
38
- """Display available commands with helpful context and usage."""
39
- print("\n\033[1;36mSwarm CLI Help\033[0m")
40
- print("Type the command name to run it, or 'exit' to quit.")
41
- print("Commands can be used to manage your Swarm config, blueprints, LLMs, MCP servers, and more.\n")
38
+ """Display available commands."""
42
39
  print("Available commands:")
43
40
  for cmd, metadata in commands.items():
44
- desc = metadata.get('description', 'No description provided.')
45
- usage = metadata.get('usage', None)
46
- print(f" \033[1;33m{cmd}\033[0m: {desc}")
47
- if usage:
48
- print(f" Usage: {usage}")
49
- print("\nExamples:")
50
- print(" validate_envvars # Check required environment variables")
51
- print(" edit_config # Edit your Swarm config interactively")
52
- print(" list_blueprints # List all available blueprints")
53
- print(" blueprint_management # Advanced blueprint management")
54
- print(" config_management # Manage LLMs, MCP servers, blueprints")
55
- print("\nType 'exit' to leave the shell.\n")
41
+ print(f" - {cmd}: {metadata['description']}")