open-swarm 0.1.1744943015__tar.gz → 0.1.1744943085__tar.gz

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 (317) hide show
  1. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/PKG-INFO +1 -1
  2. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/pyproject.toml +1 -1
  3. open_swarm-0.1.1744943085/src/swarm/core/agent_utils.py +21 -0
  4. open_swarm-0.1.1744943085/src/swarm/core/blueprint_base.py +395 -0
  5. open_swarm-0.1.1744943085/src/swarm/core/blueprint_discovery.py +128 -0
  6. open_swarm-0.1.1744943085/src/swarm/core/blueprint_runner.py +59 -0
  7. open_swarm-0.1.1744943085/src/swarm/core/blueprint_utils.py +17 -0
  8. open_swarm-0.1.1744943085/src/swarm/core/build_launchers.py +14 -0
  9. open_swarm-0.1.1744943085/src/swarm/core/build_swarm_wrapper.py +12 -0
  10. open_swarm-0.1.1744943085/src/swarm/core/common_utils.py +12 -0
  11. open_swarm-0.1.1744943085/src/swarm/core/config_loader.py +122 -0
  12. open_swarm-0.1.1744943085/src/swarm/core/config_manager.py +274 -0
  13. open_swarm-0.1.1744943085/src/swarm/core/output_utils.py +173 -0
  14. open_swarm-0.1.1744943085/src/swarm/core/server_config.py +81 -0
  15. open_swarm-0.1.1744943085/src/swarm/core/setup_wizard.py +103 -0
  16. open_swarm-0.1.1744943085/src/swarm/core/slash_commands.py +17 -0
  17. open_swarm-0.1.1744943085/src/swarm/core/spinner.py +100 -0
  18. open_swarm-0.1.1744943085/src/swarm/core/swarm_api.py +68 -0
  19. open_swarm-0.1.1744943085/src/swarm/core/swarm_cli.py +216 -0
  20. open_swarm-0.1.1744943085/src/swarm/core/swarm_wrapper.py +29 -0
  21. open_swarm-0.1.1744943085/src/swarm/core/utils/logger.py +36 -0
  22. open_swarm-0.1.1744943085/tests/__init__.py +0 -0
  23. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/.gitignore +0 -0
  24. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/LICENSE +0 -0
  25. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/README.md +0 -0
  26. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/__init__.py +0 -0
  27. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/agent/__init__.py +0 -0
  28. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/apps.py +0 -0
  29. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/auth.py +0 -0
  30. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/README.md +0 -0
  31. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/chatbot/blueprint_chatbot.py +0 -0
  32. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/chatbot/templates/chatbot/chatbot.html +0 -0
  33. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/codey/blueprint_codey.py +0 -0
  34. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py +0 -0
  35. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/divine_code/__init__.py +0 -0
  36. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/divine_code/apps.py +0 -0
  37. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/divine_code/blueprint_divine_code.py +0 -0
  38. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/django_chat/apps.py +0 -0
  39. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/django_chat/blueprint_django_chat.py +0 -0
  40. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/django_chat/templates/django_chat/django_chat_webpage.html +0 -0
  41. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/django_chat/urls.py +0 -0
  42. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/django_chat/views.py +0 -0
  43. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/echocraft/blueprint_echocraft.py +0 -0
  44. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/family_ties/apps.py +0 -0
  45. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/family_ties/blueprint_family_ties.py +0 -0
  46. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/family_ties/models.py +0 -0
  47. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/family_ties/serializers.py +0 -0
  48. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/family_ties/settings.py +0 -0
  49. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/family_ties/urls.py +0 -0
  50. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/family_ties/views.py +0 -0
  51. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/flock/__init__.py +0 -0
  52. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/gaggle/blueprint_gaggle.py +0 -0
  53. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/mcp_demo/blueprint_mcp_demo.py +0 -0
  54. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/messenger/templates/messenger/messenger.html +0 -0
  55. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/mission_improbable/blueprint_mission_improbable.py +0 -0
  56. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/monkai_magic/blueprint_monkai_magic.py +0 -0
  57. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py +0 -0
  58. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/omniplex/blueprint_omniplex.py +0 -0
  59. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/rue_code/__init__.py +0 -0
  60. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/rue_code/blueprint_rue_code.py +0 -0
  61. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/suggestion/blueprint_suggestion.py +0 -0
  62. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/unapologetic_press/blueprint_unapologetic_press.py +0 -0
  63. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/whiskeytango_foxtrot/__init__.py +0 -0
  64. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/whiskeytango_foxtrot/apps.py +0 -0
  65. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/blueprints/whiskeytango_foxtrot/blueprint_whiskeytango_foxtrot.py +0 -0
  66. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/consumers.py +0 -0
  67. {open_swarm-0.1.1744943015/src/swarm/extensions/cli → open_swarm-0.1.1744943085/src/swarm/core/utils}/__init__.py +0 -0
  68. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/__init__.py +0 -0
  69. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/blueprint/__init__.py +0 -0
  70. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/blueprint/cli_handler.py +0 -0
  71. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/blueprint/django_utils.py +0 -0
  72. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/blueprint/interactive_mode.py +0 -0
  73. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/blueprint/modes/rest_mode.py +0 -0
  74. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/blueprint/runnable_blueprint.py +0 -0
  75. {open_swarm-0.1.1744943015/src/swarm/extensions/cli/commands → open_swarm-0.1.1744943085/src/swarm/extensions/cli}/__init__.py +0 -0
  76. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/blueprint_runner.py +0 -0
  77. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/cli_args.py +0 -0
  78. {open_swarm-0.1.1744943015/src/swarm/management → open_swarm-0.1.1744943085/src/swarm/extensions/cli/commands}/__init__.py +0 -0
  79. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/commands/blueprint_management.py +0 -0
  80. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/commands/config_management.py +0 -0
  81. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/commands/edit_config.py +0 -0
  82. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/commands/list_blueprints.py +0 -0
  83. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/commands/validate_env.py +0 -0
  84. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/commands/validate_envvars.py +0 -0
  85. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/interactive_shell.py +0 -0
  86. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/main.py +0 -0
  87. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/selection.py +0 -0
  88. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/utils/discover_commands.py +0 -0
  89. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/utils/env_setup.py +0 -0
  90. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/cli/utils.py +0 -0
  91. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/config/__init__.py +0 -0
  92. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/config/config_loader.py +0 -0
  93. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/extensions/launchers/__init__.py +0 -0
  94. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/llm/chat_completion.py +0 -0
  95. {open_swarm-0.1.1744943015/src/swarm/management/commands → open_swarm-0.1.1744943085/src/swarm/management}/__init__.py +0 -0
  96. {open_swarm-0.1.1744943015/src/swarm/migrations → open_swarm-0.1.1744943085/src/swarm/management/commands}/__init__.py +0 -0
  97. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/management/commands/runserver.py +0 -0
  98. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/messages.py +0 -0
  99. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/middleware.py +0 -0
  100. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/migrations/0010_initial_chat_models.py +0 -0
  101. {open_swarm-0.1.1744943015/tests → open_swarm-0.1.1744943085/src/swarm/migrations}/__init__.py +0 -0
  102. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/models.py +0 -0
  103. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/permissions.py +0 -0
  104. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/repl/__init__.py +0 -0
  105. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/repl/repl.py +0 -0
  106. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/serializers.py +0 -0
  107. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/settings.py +0 -0
  108. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/fonts/fontawesome-webfont.ttf +0 -0
  109. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/fonts/fontawesome-webfont.woff +0 -0
  110. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/fonts/fontawesome-webfont.woff2 +0 -0
  111. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/markedjs/marked.min.js +0 -0
  112. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/adjustments-horizontal.svg +0 -0
  113. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/alert-triangle.svg +0 -0
  114. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/archive.svg +0 -0
  115. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/artboard.svg +0 -0
  116. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/automatic-gearbox.svg +0 -0
  117. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/box-multiple.svg +0 -0
  118. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/carambola.svg +0 -0
  119. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/copy.svg +0 -0
  120. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/download.svg +0 -0
  121. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/edit.svg +0 -0
  122. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/filled/carambola.svg +0 -0
  123. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/filled/paint.svg +0 -0
  124. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/headset.svg +0 -0
  125. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/layout-sidebar-left-collapse.svg +0 -0
  126. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/layout-sidebar-left-expand.svg +0 -0
  127. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/layout-sidebar-right-collapse.svg +0 -0
  128. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/layout-sidebar-right-expand.svg +0 -0
  129. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/message-chatbot.svg +0 -0
  130. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/message-star.svg +0 -0
  131. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/message-x.svg +0 -0
  132. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/message.svg +0 -0
  133. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/paperclip.svg +0 -0
  134. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/playlist-add.svg +0 -0
  135. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/robot.svg +0 -0
  136. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/search.svg +0 -0
  137. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/settings.svg +0 -0
  138. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/thumb-down.svg +0 -0
  139. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/contrib/tabler-icons/thumb-up.svg +0 -0
  140. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/css/dropdown.css +0 -0
  141. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/htmx/htmx.min.js +0 -0
  142. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/js/dropdown.js +0 -0
  143. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/base.css +0 -0
  144. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/chat-history.css +0 -0
  145. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/chat.css +0 -0
  146. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/chatbot.css +0 -0
  147. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/chatgpt.css +0 -0
  148. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/colors/corporate.css +0 -0
  149. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/colors/pastel.css +0 -0
  150. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/colors/tropical.css +0 -0
  151. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/general.css +0 -0
  152. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/layout.css +0 -0
  153. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/layouts/messenger-layout.css +0 -0
  154. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/layouts/minimalist-layout.css +0 -0
  155. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/layouts/mobile-layout.css +0 -0
  156. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/messages.css +0 -0
  157. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/messenger.css +0 -0
  158. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/settings.css +0 -0
  159. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/simple.css +0 -0
  160. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/slack.css +0 -0
  161. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/style.css +0 -0
  162. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/theme.css +0 -0
  163. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/css/toast.css +0 -0
  164. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/auth.js +0 -0
  165. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/blueprint.js +0 -0
  166. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/blueprintUtils.js +0 -0
  167. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/chatLogic.js +0 -0
  168. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/debug.js +0 -0
  169. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/events.js +0 -0
  170. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/main.js +0 -0
  171. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/messages.js +0 -0
  172. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/messengerLogic.js +0 -0
  173. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/apiService.js +0 -0
  174. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/blueprintManager.js +0 -0
  175. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/chatHistory.js +0 -0
  176. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/debugLogger.js +0 -0
  177. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/eventHandlers.js +0 -0
  178. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/messageProcessor.js +0 -0
  179. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/state.js +0 -0
  180. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/userInteractions.js +0 -0
  181. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/modules/validation.js +0 -0
  182. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/rendering.js +0 -0
  183. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/settings.js +0 -0
  184. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/sidebar.js +0 -0
  185. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/simpleLogic.js +0 -0
  186. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/slackLogic.js +0 -0
  187. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/splash.js +0 -0
  188. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/theme.js +0 -0
  189. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/toast.js +0 -0
  190. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/ui.js +0 -0
  191. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/js/validation.js +0 -0
  192. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/animated_spinner.svg +0 -0
  193. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/arrow_down.svg +0 -0
  194. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/arrow_left.svg +0 -0
  195. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/arrow_right.svg +0 -0
  196. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/arrow_up.svg +0 -0
  197. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/attach.svg +0 -0
  198. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/avatar.svg +0 -0
  199. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/canvas.svg +0 -0
  200. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/chat_history.svg +0 -0
  201. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/close.svg +0 -0
  202. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/copy.svg +0 -0
  203. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/dark_mode.svg +0 -0
  204. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/edit.svg +0 -0
  205. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/layout.svg +0 -0
  206. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/logo.svg +0 -0
  207. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/logout.svg +0 -0
  208. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/mobile.svg +0 -0
  209. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/new_chat.svg +0 -0
  210. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/not_visible.svg +0 -0
  211. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/plus.svg +0 -0
  212. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/run_code.svg +0 -0
  213. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/save.svg +0 -0
  214. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/search.svg +0 -0
  215. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/settings.svg +0 -0
  216. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/speaker.svg +0 -0
  217. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/stop.svg +0 -0
  218. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/thumbs_down.svg +0 -0
  219. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/thumbs_up.svg +0 -0
  220. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/toggle_off.svg +0 -0
  221. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/toggle_on.svg +0 -0
  222. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/trash.svg +0 -0
  223. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/undo.svg +0 -0
  224. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/visible.svg +0 -0
  225. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/static/rest_mode/svg/voice.svg +0 -0
  226. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/account/login.html +0 -0
  227. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/account/signup.html +0 -0
  228. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/base.html +0 -0
  229. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/chat.html +0 -0
  230. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/index.html +0 -0
  231. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/components/chat_sidebar.html +0 -0
  232. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/components/header.html +0 -0
  233. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/components/main_chat_pane.html +0 -0
  234. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/components/settings_dialog.html +0 -0
  235. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/components/splash_screen.html +0 -0
  236. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/components/top_bar.html +0 -0
  237. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/message_ui.html +0 -0
  238. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/rest_mode/slackbot.html +0 -0
  239. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/simple_blueprint_page.html +0 -0
  240. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/websocket_partials/final_system_message.html +0 -0
  241. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/websocket_partials/system_message.html +0 -0
  242. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/templates/websocket_partials/user_message.html +0 -0
  243. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/tool_executor.py +0 -0
  244. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/urls.py +0 -0
  245. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/util.py +0 -0
  246. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/color_utils.py +0 -0
  247. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/context_utils.py +0 -0
  248. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/general_utils.py +0 -0
  249. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/log_utils.py +0 -0
  250. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/logger.py +0 -0
  251. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/logger_setup.py +0 -0
  252. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/message_sequence.py +0 -0
  253. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/message_utils.py +0 -0
  254. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/utils/redact.py +0 -0
  255. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/__init__.py +0 -0
  256. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/api_views.py +0 -0
  257. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/chat_views.py +0 -0
  258. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/core_views.py +0 -0
  259. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/message_views.py +0 -0
  260. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/model_views.py +0 -0
  261. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/utils.py +0 -0
  262. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/views/web_views.py +0 -0
  263. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/src/swarm/wsgi.py +0 -0
  264. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/api/conftest.py +0 -0
  265. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/api/test_chat_completions_auth_async.py +0 -0
  266. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/api/test_chat_completions_failing_async.py +0 -0
  267. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/api/test_chat_completions_validation_async.py +0 -0
  268. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_chatbot.py +0 -0
  269. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_digitalbutlers.py +0 -0
  270. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_dilbot_universe.py +0 -0
  271. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_divine_code.py +0 -0
  272. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_echocraft.py +0 -0
  273. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_family_ties.py +0 -0
  274. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_gaggle.py +0 -0
  275. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_gotchaman.py +0 -0
  276. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_mcp_demo.py +0 -0
  277. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_mission_improbable.py +0 -0
  278. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_monkai_magic.py +0 -0
  279. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_nebula_shellz.py +0 -0
  280. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_omniplex.py +0 -0
  281. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_suggestion.py +0 -0
  282. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_unapologetic_press.py +0 -0
  283. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/blueprints/test_whiskeytangofoxtrot.py +0 -0
  284. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/cli/test_cli_config.py +0 -0
  285. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/cli/test_launchers.py +0 -0
  286. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/cli/test_list_blueprints.py +0 -0
  287. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/conftest.py +0 -0
  288. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/extensions/launchers/test_swarm_api_launcher.py +0 -0
  289. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/swarm_config.json +0 -0
  290. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_chucks_angels.sh +0 -0
  291. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_digitalbutlers.sh +0 -0
  292. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_dilbot_universe.sh +0 -0
  293. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_divine_code.sh +0 -0
  294. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_django_chat.sh +0 -0
  295. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_echocraft.sh +0 -0
  296. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_family_ties.sh +0 -0
  297. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_flock.sh +0 -0
  298. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_gaggle.sh +0 -0
  299. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_gotchaman.sh +0 -0
  300. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_monkai-magic.sh +0 -0
  301. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_nebula_shellz.sh +0 -0
  302. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_omniplex.sh +0 -0
  303. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_rue-code.sh +0 -0
  304. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_suggestion.sh +0 -0
  305. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_unapologetic_press.sh +0 -0
  306. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_university.sh +0 -0
  307. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/system/test_whiskeytango_foxtrot.sh +0 -0
  308. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_blueprint_loading.py +0 -0
  309. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_cli_mode_selection.py +0 -0
  310. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_core_filter_duplicate_system_messages.py +0 -0
  311. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_core_filter_messages.py +0 -0
  312. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_core_truncate_message_history.py +0 -0
  313. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_core_update_null_content.py +0 -0
  314. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_dummy.py +0 -0
  315. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/test_truncate_message_history.py +0 -0
  316. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/unit/blueprints/rue_code/test_rue_code_tools.py +0 -0
  317. {open_swarm-0.1.1744943015 → open_swarm-0.1.1744943085}/tests/unit/test_blueprint_base_config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: open-swarm
3
- Version: 0.1.1744943015
3
+ Version: 0.1.1744943085
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "open-swarm"
7
- version = "0.1.1744943015"
7
+ version = "0.1.1744943085"
8
8
  description = "Open Swarm: Orchestrating AI Agent Swarms with Django"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -0,0 +1,21 @@
1
+ """
2
+ agent_utils.py
3
+
4
+ Utility functions for agent operations used in blueprints.
5
+ This module has been updated to remove dependency on swarm.types;
6
+ instead, it now imports Agent from the openai-agents SDK.
7
+ """
8
+
9
+ from blueprint_agents.agent import Agent # Updated import
10
+
11
+ def get_agent_name(agent: Agent) -> str:
12
+ """
13
+ Returns the name of the agent.
14
+ """
15
+ return agent.name
16
+
17
+ def initialize_agents(blueprint) -> dict:
18
+ """
19
+ Initializes agents by calling the blueprint's create_agents() method.
20
+ """
21
+ return blueprint.create_agents()
@@ -0,0 +1,395 @@
1
+ # --- REMOVE noisy debug/framework prints unless SWARM_DEBUG=1 ---
2
+ import os
3
+
4
+ def _should_debug():
5
+ return os.environ.get("SWARM_DEBUG") == "1"
6
+
7
+ def _debug_print(*args, **kwargs):
8
+ if _should_debug():
9
+ print(*args, **kwargs)
10
+
11
+ def _framework_print(*args, **kwargs):
12
+ if _should_debug():
13
+ print(*args, **kwargs)
14
+
15
+ # --- Content for src/swarm/extensions/blueprint/blueprint_base.py ---
16
+ import logging
17
+ import json
18
+ from abc import ABC, abstractmethod
19
+ from typing import Dict, Any, Optional, List, AsyncGenerator
20
+ from pathlib import Path
21
+ from django.apps import apps # Import Django apps registry
22
+
23
+ # Keep the function import
24
+ from swarm.core.config_loader import _substitute_env_vars
25
+
26
+ from openai import AsyncOpenAI
27
+ from agents import set_default_openai_client
28
+
29
+ logger = logging.getLogger(__name__)
30
+ from rich.console import Console
31
+ import traceback
32
+
33
+ # --- PATCH: Suppress OpenAI tracing/telemetry errors if using LiteLLM/custom endpoint ---
34
+ import logging
35
+ import os
36
+ if os.environ.get("LITELLM_BASE_URL") or os.environ.get("OPENAI_BASE_URL"):
37
+ # Silence openai.agents tracing/telemetry errors
38
+ logging.getLogger("openai.agents").setLevel(logging.CRITICAL)
39
+ try:
40
+ import openai.agents.tracing
41
+ openai.agents.tracing.TracingClient = lambda *a, **kw: None
42
+ except Exception:
43
+ pass
44
+
45
+ # --- Spinner/Status Message Enhancements ---
46
+ # To be used by all blueprints for consistent UX
47
+ import itertools
48
+ import sys
49
+ import threading
50
+ import time
51
+
52
+ class Spinner:
53
+ def __init__(self, message_sequence=None, interval=0.3, slow_threshold=10):
54
+ self.message_sequence = message_sequence or ['Generating.', 'Generating..', 'Generating...', 'Running...']
55
+ self.interval = interval
56
+ self.slow_threshold = slow_threshold # seconds before 'Taking longer than expected'
57
+ self._stop_event = threading.Event()
58
+ self._thread = None
59
+ self._start_time = None
60
+
61
+ def start(self):
62
+ self._stop_event.clear()
63
+ self._start_time = time.time()
64
+ self._thread = threading.Thread(target=self._spin)
65
+ self._thread.start()
66
+
67
+ def _spin(self):
68
+ for msg in itertools.cycle(self.message_sequence):
69
+ if self._stop_event.is_set():
70
+ break
71
+ elapsed = time.time() - self._start_time
72
+ if elapsed > self.slow_threshold:
73
+ sys.stdout.write('\rGenerating... Taking longer than expected ')
74
+ else:
75
+ sys.stdout.write(f'\r{msg} ')
76
+ sys.stdout.flush()
77
+ time.sleep(self.interval)
78
+ sys.stdout.write('\r')
79
+ sys.stdout.flush()
80
+
81
+ def stop(self, final_message=''):
82
+ self._stop_event.set()
83
+ if self._thread:
84
+ self._thread.join()
85
+ if final_message:
86
+ sys.stdout.write(f'\r{final_message}\n')
87
+ sys.stdout.flush()
88
+
89
+ # Usage Example (to be called in blueprints):
90
+ # spinner = Spinner()
91
+ # spinner.start()
92
+ # ... do work ...
93
+ # spinner.stop('Done!')
94
+
95
+ def configure_openai_client_from_env():
96
+ """
97
+ Framework-level function: Always instantiate and set the default OpenAI client.
98
+ Prints out the config being used for debug.
99
+ """
100
+ import os
101
+ from agents import set_default_openai_client
102
+ from openai import AsyncOpenAI
103
+ base_url = os.environ.get("LITELLM_BASE_URL") or os.environ.get("OPENAI_BASE_URL")
104
+ api_key = os.environ.get("LITELLM_API_KEY") or os.environ.get("OPENAI_API_KEY")
105
+ _debug_print(f"[DEBUG] Using OpenAI client config: base_url={base_url}, api_key={'set' if api_key else 'NOT SET'}")
106
+ if base_url and api_key:
107
+ client = AsyncOpenAI(base_url=base_url, api_key=api_key)
108
+ set_default_openai_client(client)
109
+ _framework_print(f"[FRAMEWORK] Set default OpenAI client: base_url={base_url}, api_key={'set' if api_key else 'NOT SET'}")
110
+ else:
111
+ _framework_print("[FRAMEWORK] WARNING: base_url or api_key missing, OpenAI client not set!")
112
+
113
+ configure_openai_client_from_env()
114
+
115
+ class BlueprintBase(ABC):
116
+ """
117
+ Abstract base class for all Swarm blueprints.
118
+
119
+ Defines the core interface for blueprint initialization and execution.
120
+ """
121
+ enable_terminal_commands: bool = False # By default, terminal command execution is disabled
122
+
123
+ @classmethod
124
+ def main(cls):
125
+ """
126
+ Standard CLI entry point for all blueprints.
127
+ Subclasses can override metadata/config_path if needed.
128
+ """
129
+ from swarm.extensions.blueprint.cli_handler import run_blueprint_cli
130
+ from pathlib import Path
131
+ swarm_version = getattr(cls, "SWARM_VERSION", "1.0.0")
132
+ config_path = getattr(cls, "DEFAULT_CONFIG_PATH", Path(__file__).parent / "swarm_config.json")
133
+ run_blueprint_cli(cls, swarm_version=swarm_version, default_config_path=config_path)
134
+
135
+ def display_splash_screen(self, animated: bool = False):
136
+ """Default splash screen. Subclasses can override for custom CLI/API branding."""
137
+ console = Console()
138
+ console.print(f"[bold cyan]Welcome to {self.__class__.__name__}![/]", style="bold")
139
+
140
+ def __init__(self, blueprint_id: str, config: dict = None, config_path: 'Optional[Path]' = None, enable_terminal_commands: 'Optional[bool]' = None, **kwargs):
141
+ try:
142
+ if not blueprint_id:
143
+ raise ValueError("blueprint_id cannot be empty or None")
144
+ self.blueprint_id = blueprint_id
145
+ self.config_path = config_path # for legacy compatibility
146
+ self._config = config # Allow test injection
147
+ self._llm_profile_name = None
148
+ self._llm_profile_data = None
149
+ self._markdown_output = None
150
+ # Allow per-instance override
151
+ if enable_terminal_commands is not None:
152
+ self.enable_terminal_commands = enable_terminal_commands
153
+ # Else: use class attribute (default False or set by subclass)
154
+
155
+ logger.info(f"Initializing blueprint '{self.blueprint_id}' (Type: {self.__class__.__name__})")
156
+
157
+ # --- Ensure custom OpenAI client for custom LLM providers ---
158
+ import os
159
+
160
+ # Remove monkey patching and envvar hacks. Always pass config values directly.
161
+ # (Retain only explicit AsyncOpenAI client instantiation in blueprints)
162
+ # (No changes needed here for direct client pattern)
163
+
164
+ self._load_and_process_config()
165
+ except AttributeError as e:
166
+ logger.debug(f"[BlueprintBase.__init__] AttributeError: {e}")
167
+ traceback.print_exc()
168
+ raise
169
+
170
+ def _load_and_process_config(self):
171
+ """Loads the main Swarm config and extracts relevant settings. Falls back to empty config if Django unavailable or not found."""
172
+ import os
173
+ import json
174
+ from pathlib import Path
175
+ def redact(val):
176
+ if not isinstance(val, str) or len(val) <= 4:
177
+ return "****"
178
+ return val[:2] + "*" * (len(val)-4) + val[-2:]
179
+ def redact_dict(d):
180
+ if isinstance(d, dict):
181
+ return {k: (redact_dict(v) if not (isinstance(v, str) and ("key" in k.lower() or "token" in k.lower() or "secret" in k.lower())) else redact(v)) for k, v in d.items()}
182
+ elif isinstance(d, list):
183
+ return [redact_dict(item) for item in d]
184
+ return d
185
+ try:
186
+ if self._config is None:
187
+ try:
188
+ # --- Get config from the AppConfig instance (Django) ---
189
+ app_config_instance = apps.get_app_config('swarm')
190
+ if not hasattr(app_config_instance, 'config') or not app_config_instance.config:
191
+ raise ValueError("AppConfig for 'swarm' does not have a valid 'config' attribute.")
192
+ self._config = app_config_instance.config
193
+ logger.debug("Loaded config from Django AppConfig.")
194
+ except Exception as e:
195
+ if _should_debug():
196
+ logger.warning(f"Falling back to CLI/home config due to error: {e}")
197
+ # 1. CLI argument (not handled here, handled in cli_handler)
198
+ # 2. Current working directory
199
+ cwd_config = Path.cwd() / "swarm_config.json"
200
+ if cwd_config.exists():
201
+ with open(cwd_config, 'r') as f:
202
+ self._config = json.load(f)
203
+ # 3. XDG_CONFIG_HOME or ~/.config/swarm/swarm_config.json
204
+ elif os.environ.get("XDG_CONFIG_HOME"):
205
+ xdg_config = Path(os.environ["XDG_CONFIG_HOME"]) / "swarm" / "swarm_config.json"
206
+ if xdg_config.exists():
207
+ with open(xdg_config, 'r') as f:
208
+ self._config = json.load(f)
209
+ elif (Path.home() / ".config/swarm/swarm_config.json").exists():
210
+ with open(Path.home() / ".config/swarm/swarm_config.json", 'r') as f:
211
+ self._config = json.load(f)
212
+ # 4. Legacy fallback: ~/.swarm/swarm_config.json
213
+ elif (Path.home() / ".swarm/swarm_config.json").exists():
214
+ with open(Path.home() / ".swarm/swarm_config.json", 'r') as f:
215
+ self._config = json.load(f)
216
+ # 5. Fallback: OPENAI_API_KEY envvar
217
+ elif os.environ.get("OPENAI_API_KEY"):
218
+ self._config = {
219
+ "llm": {"default": {"provider": "openai", "model": "gpt-3.5-turbo", "api_key": os.environ["OPENAI_API_KEY"]}},
220
+ "settings": {"default_llm_profile": "default", "default_markdown_output": True},
221
+ "blueprints": {},
222
+ "llm_profile": "default",
223
+ "mcpServers": {}
224
+ }
225
+ logger.info("No config file found, using default config with OPENAI_API_KEY for CLI mode.")
226
+ else:
227
+ self._config = {}
228
+ logger.warning("No config file found and OPENAI_API_KEY is not set. Using empty config. CLI blueprints may fail if LLM config is required.")
229
+ if self._config is not None:
230
+ self._config = _substitute_env_vars(self._config)
231
+ # Ensure self._config is always a dict
232
+ if self._config is None:
233
+ self._config = {}
234
+ settings_section = self._config.get("settings", {})
235
+ llm_section = self._config.get("llm", {})
236
+
237
+ # --- After config is loaded, set OpenAI client from config if possible ---
238
+ try:
239
+ llm_profiles = self._config.get("llm", {})
240
+ default_profile = llm_profiles.get("default", {})
241
+ base_url = default_profile.get("base_url")
242
+ api_key = default_profile.get("api_key")
243
+ # Expand env vars if present
244
+ import os
245
+ if base_url and base_url.startswith("${"):
246
+ var = base_url[2:-1]
247
+ base_url = os.environ.get(var, base_url)
248
+ if api_key and api_key.startswith("${"):
249
+ var = api_key[2:-1]
250
+ api_key = os.environ.get(var, api_key)
251
+ if base_url and api_key:
252
+ from openai import AsyncOpenAI
253
+ from agents import set_default_openai_client
254
+ _debug_print(f"[DEBUG] (config) Setting OpenAI client: base_url={base_url}, api_key={'set' if api_key else 'NOT SET'}")
255
+ client = AsyncOpenAI(base_url=base_url, api_key=api_key)
256
+ set_default_openai_client(client)
257
+ except Exception as e:
258
+ _debug_print(f"[DEBUG] Failed to set OpenAI client from config: {e}")
259
+
260
+ # --- Debug: Print and log redacted config ---
261
+ redacted_config = redact_dict(self._config)
262
+ logger.debug(f"Loaded config (redacted): {json.dumps(redacted_config, indent=2)}")
263
+
264
+ # --- Process LLM profile name and data ---
265
+ default_profile = settings_section.get("default_llm_profile") or "default"
266
+ self._llm_profile_name = self._config.get("llm_profile") or default_profile
267
+ if "profiles" in llm_section:
268
+ self._llm_profile_data = llm_section["profiles"].get(self._llm_profile_name, {})
269
+ else:
270
+ self._llm_profile_data = llm_section.get(self._llm_profile_name, {})
271
+
272
+ blueprint_specific_settings = self._config.get("blueprints", {}).get(self.blueprint_id, {})
273
+ global_markdown_setting = settings_section.get("default_markdown_output", True)
274
+ self._markdown_output = blueprint_specific_settings.get("markdown_output", global_markdown_setting)
275
+ logger.debug(f"Markdown output for '{self.blueprint_id}': {self._markdown_output}")
276
+
277
+ except ValueError as e:
278
+ logger.error(f"Configuration error for blueprint '{self.blueprint_id}': {e}", exc_info=True)
279
+ raise
280
+ except Exception as e:
281
+ logger.error(f"Unexpected error loading config for blueprint '{self.blueprint_id}': {e}", exc_info=True)
282
+ raise
283
+
284
+ @property
285
+ def config(self) -> Dict[str, Any]:
286
+ """Returns the loaded and processed Swarm configuration."""
287
+ if self._config is None:
288
+ raise RuntimeError("Configuration accessed before initialization or after failure.")
289
+ return self._config
290
+
291
+ @property
292
+ def llm_profile(self) -> Dict[str, Any]:
293
+ """
294
+ Returns the LLM profile dict for this blueprint.
295
+ Raises a clear error if provider is missing.
296
+ """
297
+ llm_section = self._config.get("llm", {}) if self._config else {}
298
+ profile_name = self.llm_profile_name or "default"
299
+ profile = llm_section.get(profile_name)
300
+ if not profile:
301
+ raise ValueError(f"LLM profile '{profile_name}' not found in config: {llm_section}")
302
+ if "provider" not in profile:
303
+ raise ValueError(f"'provider' missing in LLM profile '{profile_name}': {profile}")
304
+ return profile
305
+
306
+ @property
307
+ def llm_profile_name(self) -> str:
308
+ """Returns the name of the LLM profile being used."""
309
+ if self._llm_profile_name is None:
310
+ raise RuntimeError("LLM profile name accessed before initialization or after failure.")
311
+ return self._llm_profile_name
312
+
313
+ @property
314
+ def slash_commands(self):
315
+ from swarm.core.slash_commands import slash_registry
316
+ return slash_registry
317
+
318
+ def get_llm_profile(self, profile_name: str) -> dict:
319
+ """Returns the LLM profile dict for the given profile name from config, or empty dict if not found.
320
+ Supports both llm.profiles and direct llm keys for backward compatibility."""
321
+ llm_section = self.config.get("llm", {})
322
+ if "profiles" in llm_section:
323
+ return llm_section["profiles"].get(profile_name, {})
324
+ return llm_section.get(profile_name, {})
325
+
326
+ @property
327
+ def should_output_markdown(self) -> bool:
328
+ """
329
+ Determines if markdown output should be used for this blueprint.
330
+ Priority: blueprint config > global config > False
331
+ """
332
+ settings = self._config.get("settings", {}) if self._config else {}
333
+ bp_settings = self._config.get("blueprints", {}).get(self.blueprint_id, {}) if self._config else {}
334
+ if "output_markdown" in bp_settings:
335
+ return bool(bp_settings["output_markdown"])
336
+ if "default_markdown_output" in settings:
337
+ return bool(settings["default_markdown_output"])
338
+ return False
339
+
340
+ def _get_model_instance(self, profile_name: str):
341
+ """Retrieves or creates an LLM Model instance, respecting LITELLM_MODEL/DEFAULT_LLM if set."""
342
+ if not hasattr(self, '_model_instance_cache'):
343
+ self._model_instance_cache = {}
344
+ if not hasattr(self, '_openai_client_cache'):
345
+ self._openai_client_cache = {}
346
+ if profile_name in self._model_instance_cache:
347
+ return self._model_instance_cache[profile_name]
348
+ profile_data = self.get_llm_profile(profile_name)
349
+ import os
350
+ model_name = os.getenv("LITELLM_MODEL") or os.getenv("DEFAULT_LLM") or profile_data.get("model") or "gpt-3.5-turbo"
351
+ openai_kwargs = {}
352
+ if "base_url" in profile_data:
353
+ openai_kwargs["base_url"] = profile_data["base_url"]
354
+ if "api_key" in profile_data:
355
+ openai_kwargs["api_key"] = profile_data["api_key"]
356
+ from openai import AsyncOpenAI
357
+ from agents.models.openai_chatcompletions import OpenAIChatCompletionsModel
358
+ client_cache_key = f"{model_name}:{openai_kwargs.get('base_url','')}:key={bool(openai_kwargs.get('api_key'))}"
359
+ if client_cache_key not in self._openai_client_cache:
360
+ try:
361
+ self._openai_client_cache[client_cache_key] = AsyncOpenAI(**openai_kwargs)
362
+ except Exception as e:
363
+ raise ValueError(f"Failed to init client: {e}") from e
364
+ client = self._openai_client_cache[client_cache_key]
365
+ try:
366
+ model_instance = OpenAIChatCompletionsModel(model=model_name, openai_client=client)
367
+ self._model_instance_cache[profile_name] = model_instance
368
+ return model_instance
369
+ except Exception as e:
370
+ raise ValueError(f"Failed to init LLM: {e}") from e
371
+
372
+ def make_agent(self, name, instructions, tools, mcp_servers=None, **kwargs):
373
+ """Factory for creating an Agent with the correct model instance from framework config."""
374
+ from agents import Agent # Ensure Agent is always in scope
375
+ model_instance = self._get_model_instance(self.config.get("llm_profile", "default"))
376
+ return Agent(
377
+ name=name,
378
+ model=model_instance,
379
+ instructions=instructions,
380
+ tools=tools,
381
+ mcp_servers=mcp_servers or [],
382
+ **kwargs
383
+ )
384
+
385
+ @abstractmethod
386
+ async def run(self, messages: List[Dict[str, Any]], **kwargs: Any) -> AsyncGenerator[Dict[str, Any], None]:
387
+ """
388
+ The main execution method for the blueprint.
389
+ """
390
+ import os
391
+ import pprint
392
+ logger.debug("ENVIRONMENT DUMP BEFORE MODEL CALL:")
393
+ pprint.pprint(dict(os.environ))
394
+ raise NotImplementedError("Subclasses must implement the 'run' method.")
395
+ yield {}
@@ -0,0 +1,128 @@
1
+ import os
2
+ import importlib
3
+ import importlib.util
4
+ import inspect
5
+ import logging # Ensure logging is imported
6
+ import sys
7
+ from typing import Dict, Type, Any
8
+ from pathlib import Path
9
+
10
+ # *** Define logger EARLIER ***
11
+ logger = logging.getLogger(__name__)
12
+
13
+ # *** Import the ACTUAL BlueprintBase from the likely correct path ***
14
+ try:
15
+ # Adjust this path if BlueprintBase lives elsewhere
16
+ from swarm.core.blueprint_base import BlueprintBase
17
+ except ImportError:
18
+ # This logger call is now safe
19
+ logger.error("Failed to import BlueprintBase from swarm.core.blueprint_base. Using placeholder.", exc_info=True)
20
+ class BlueprintBase: # Fallback placeholder
21
+ metadata: Dict[str, Any] = {}
22
+ def __init__(self, *args, **kwargs): pass
23
+ async def run(self, *args, **kwargs): pass
24
+
25
+
26
+ class BlueprintLoadError(Exception):
27
+ """Custom exception for errors during blueprint loading."""
28
+ pass
29
+
30
+ def _get_blueprint_name_from_dir(dir_name: str) -> str:
31
+ """Converts directory name (e.g., 'blueprint_my_agent') to blueprint name (e.g., 'my_agent')."""
32
+ prefix = "blueprint_"
33
+ if dir_name.startswith(prefix):
34
+ return dir_name[len(prefix):]
35
+ return dir_name
36
+
37
+ def discover_blueprints(blueprint_dir: str) -> Dict[str, Type[BlueprintBase]]:
38
+ """
39
+ Discovers blueprints (subclasses of BlueprintBase) by looking for
40
+ 'blueprint_{name}.py' files within subdirectories of the given blueprint directory.
41
+
42
+ Args:
43
+ blueprint_dir: The path to the directory containing blueprint subdirectories.
44
+
45
+ Returns:
46
+ A dictionary mapping blueprint names to their corresponding class objects.
47
+ """
48
+ logger.info(f"Starting blueprint discovery in directory: {blueprint_dir}")
49
+ blueprints: Dict[str, Type[BlueprintBase]] = {}
50
+ base_dir = Path(blueprint_dir).resolve()
51
+
52
+ if not base_dir.is_dir():
53
+ logger.error(f"Blueprint directory not found or is not a directory: {base_dir}")
54
+ return blueprints
55
+
56
+ # Iterate over items inside the base blueprint directory
57
+ for subdir in base_dir.iterdir():
58
+ if not subdir.is_dir():
59
+ continue # Skip files directly under blueprints/
60
+
61
+ # Use directory name as blueprint name (e.g., 'echocraft')
62
+ blueprint_name = subdir.name
63
+ logger.debug(f"Processing potential blueprint '{blueprint_name}' in directory: {subdir.name}")
64
+
65
+ # Look for the specific .py file, e.g., blueprint_echocraft.py
66
+ py_file_name = f"blueprint_{blueprint_name}.py"
67
+ py_file_path = subdir / py_file_name
68
+
69
+ if not py_file_path.is_file():
70
+ # Also check for just {blueprint_name}.py if that's a convention
71
+ alt_py_file_name = f"{blueprint_name}.py"
72
+ alt_py_file_path = subdir / alt_py_file_name
73
+ if alt_py_file_path.is_file():
74
+ py_file_path = alt_py_file_path # Use the alternative path
75
+ py_file_name = alt_py_file_name
76
+ logger.debug(f"Found alternative blueprint file: {py_file_name}")
77
+ else:
78
+ logger.warning(f"Skipping directory '{subdir.name}': Neither '{py_file_name}' nor '{alt_py_file_name}' found.")
79
+ continue
80
+
81
+
82
+ # Construct module import path, e.g., blueprints.echocraft.blueprint_echocraft
83
+ if py_file_path.name.startswith('blueprint_gatcha'):
84
+ module_import_path = f"swarm.blueprints.gatcha.{py_file_path.stem}"
85
+ elif py_file_path.name.startswith('blueprint_'):
86
+ module_import_path = f"swarm.blueprints.{subdir.name}.{py_file_path.stem}"
87
+ else:
88
+ continue
89
+
90
+ try:
91
+ # Ensure parent directory is in path
92
+ parent_dir = str(base_dir.parent)
93
+ if parent_dir not in sys.path:
94
+ logger.debug(f"Adding '{parent_dir}' to sys.path for blueprint discovery.")
95
+ sys.path.insert(0, parent_dir)
96
+
97
+ # Create module spec from file path
98
+ module_spec = importlib.util.spec_from_file_location(module_import_path, py_file_path)
99
+
100
+ if module_spec and module_spec.loader:
101
+ module = importlib.util.module_from_spec(module_spec)
102
+ sys.modules[module_import_path] = module
103
+ module_spec.loader.exec_module(module)
104
+ logger.debug(f"Successfully loaded module: {module_import_path}")
105
+
106
+ found_bp_class = None
107
+ for name, obj in inspect.getmembers(module):
108
+ if inspect.isclass(obj) and obj.__module__ == module_import_path and issubclass(obj, BlueprintBase) and obj is not BlueprintBase:
109
+ if found_bp_class:
110
+ logger.warning(f"Multiple BlueprintBase subclasses found in {py_file_name}. Using the first: {found_bp_class.__name__}.")
111
+ else:
112
+ logger.debug(f"Found Blueprint class '{name}' in module '{module_import_path}'")
113
+ found_bp_class = obj
114
+ blueprints[blueprint_name] = found_bp_class
115
+ # break
116
+
117
+ if not found_bp_class:
118
+ logger.warning(f"No BlueprintBase subclass found directly defined in module: {module_import_path}")
119
+ else:
120
+ logger.warning(f"Could not create module spec for {py_file_path}")
121
+
122
+ except Exception as e:
123
+ logger.error(f"Error processing blueprint file '{py_file_path}': {e}", exc_info=True)
124
+ if module_import_path in sys.modules:
125
+ del sys.modules[module_import_path]
126
+
127
+ logger.info(f"Blueprint discovery complete. Found: {list(blueprints.keys())}")
128
+ return blueprints
@@ -0,0 +1,59 @@
1
+ import sys
2
+ import traceback
3
+ import types
4
+ from typing import AsyncGenerator
5
+ import inspect
6
+
7
+ from .blueprint_base import Spinner
8
+
9
+ class BlueprintRunner:
10
+ @staticmethod
11
+ async def run_agent(agent, instruction, filter_llm_function_calls=True, spinner_enabled=True) -> AsyncGenerator[dict, None]:
12
+ """
13
+ Runs the agent using Runner.run as an async generator or coroutine, with spinner and error handling.
14
+ Filters out LLM function call outputs if requested.
15
+ Handles both coroutine and async generator return types.
16
+ """
17
+ from agents import Runner
18
+ # Only enable spinner if spinner_enabled is True and not in non-interactive mode
19
+ # (i.e., only if show_intermediate is True)
20
+ spinner = None
21
+ if spinner_enabled:
22
+ # Check for a marker in instruction or a kwarg to disable spinner in non-interactive
23
+ frame = inspect.currentframe()
24
+ show_intermediate = False
25
+ while frame:
26
+ if 'kwargs' in frame.f_locals and isinstance(frame.f_locals['kwargs'], dict):
27
+ show_intermediate = frame.f_locals['kwargs'].get('show_intermediate', False)
28
+ break
29
+ frame = frame.f_back
30
+ if show_intermediate:
31
+ spinner = Spinner()
32
+ try:
33
+ if spinner:
34
+ spinner.start()
35
+ result = await Runner.run(agent, instruction)
36
+ # If result is an async generator, iterate over it
37
+ if isinstance(result, types.AsyncGeneratorType):
38
+ async for chunk in result:
39
+ if filter_llm_function_calls:
40
+ content = chunk.get("content")
41
+ if content and ("function call" in content or "args" in content):
42
+ continue
43
+ yield chunk
44
+ elif isinstance(result, (list, dict)):
45
+ # If it's a list of chunks or a single chunk, yield directly
46
+ if isinstance(result, list):
47
+ for chunk in result:
48
+ yield chunk
49
+ else:
50
+ yield result
51
+ elif result is not None:
52
+ # Fallback: yield as a single chunk
53
+ yield {"messages": [{"role": "assistant", "content": str(result)}]}
54
+ except Exception as e:
55
+ tb = traceback.format_exc()
56
+ yield {"messages": [{"role": "assistant", "content": f"Error: {e}\n{tb}"}]}
57
+ finally:
58
+ if spinner:
59
+ spinner.stop()
@@ -0,0 +1,17 @@
1
+ """
2
+ Utility functions for blueprint management.
3
+ """
4
+
5
+ def filter_blueprints(all_blueprints: dict, allowed_blueprints_str: str) -> dict:
6
+ """
7
+ Filters the given blueprints dictionary using a comma-separated string of allowed blueprint keys.
8
+
9
+ Args:
10
+ all_blueprints (dict): A dictionary containing all discovered blueprints.
11
+ allowed_blueprints_str (str): A comma-separated string of allowed blueprint keys.
12
+
13
+ Returns:
14
+ dict: A dictionary containing only the blueprints whose keys are present in the allowed list.
15
+ """
16
+ allowed_list = [bp.strip() for bp in allowed_blueprints_str.split(",")]
17
+ return {k: v for k, v in all_blueprints.items() if k in allowed_list}
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env python3
2
+ import PyInstaller.__main__
3
+
4
+ def build_executable(script, output_name):
5
+ PyInstaller.__main__.run([
6
+ script,
7
+ "--onefile",
8
+ "--name", output_name,
9
+ "--add-data", "swarm_config.json:." # Adjust if additional data is needed
10
+ ])
11
+
12
+ if __name__ == "__main__":
13
+ build_executable("launchers/swarm_cli.py", "swarm-cli")
14
+ build_executable("launchers/swarm_rest.py", "swarm-rest")
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env python3
2
+ import PyInstaller.__main__
3
+
4
+ PyInstaller.__main__.run([
5
+ "swarm_wrapper.py",
6
+ "--onefile",
7
+ "--name", "swarm-wrapper",
8
+ "--distpath", "~/bin",
9
+ "--workpath", "build",
10
+ "--specpath", "."
11
+ ])
12
+