open-swarm 0.1.1745275181__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.
- open_swarm-0.1.1748636259.dist-info/METADATA +188 -0
- open_swarm-0.1.1748636259.dist-info/RECORD +82 -0
- {open_swarm-0.1.1745275181.dist-info → open_swarm-0.1.1748636259.dist-info}/WHEEL +2 -1
- open_swarm-0.1.1748636259.dist-info/entry_points.txt +3 -0
- open_swarm-0.1.1748636259.dist-info/top_level.txt +1 -0
- swarm/agent/agent.py +49 -0
- swarm/auth.py +48 -113
- swarm/consumers.py +0 -19
- swarm/extensions/blueprint/__init__.py +16 -30
- swarm/{core → extensions/blueprint}/agent_utils.py +1 -1
- swarm/extensions/blueprint/blueprint_base.py +458 -0
- swarm/extensions/blueprint/blueprint_discovery.py +112 -0
- swarm/extensions/blueprint/output_utils.py +95 -0
- swarm/{core → extensions/blueprint}/spinner.py +21 -30
- swarm/extensions/cli/cli_args.py +0 -6
- swarm/extensions/cli/commands/blueprint_management.py +9 -47
- swarm/extensions/cli/commands/config_management.py +6 -5
- swarm/extensions/cli/commands/edit_config.py +7 -16
- swarm/extensions/cli/commands/list_blueprints.py +1 -1
- swarm/extensions/cli/commands/validate_env.py +4 -11
- swarm/extensions/cli/commands/validate_envvars.py +6 -6
- swarm/extensions/cli/interactive_shell.py +2 -16
- swarm/extensions/config/config_loader.py +201 -107
- swarm/{core → extensions/config}/config_manager.py +38 -50
- swarm/{core → extensions/config}/server_config.py +0 -32
- swarm/extensions/launchers/build_launchers.py +14 -0
- swarm/{core → extensions/launchers}/build_swarm_wrapper.py +0 -0
- swarm/extensions/launchers/swarm_api.py +64 -8
- swarm/extensions/launchers/swarm_cli.py +300 -8
- swarm/llm/chat_completion.py +195 -0
- swarm/serializers.py +5 -96
- swarm/settings.py +111 -99
- swarm/urls.py +74 -57
- swarm/utils/context_utils.py +4 -10
- swarm/utils/general_utils.py +0 -21
- swarm/utils/redact.py +36 -23
- swarm/views/api_views.py +39 -48
- swarm/views/chat_views.py +70 -237
- swarm/views/core_views.py +87 -80
- swarm/views/model_views.py +121 -64
- swarm/views/utils.py +441 -65
- swarm/views/web_views.py +2 -2
- open_swarm-0.1.1745275181.dist-info/METADATA +0 -874
- open_swarm-0.1.1745275181.dist-info/RECORD +0 -319
- open_swarm-0.1.1745275181.dist-info/entry_points.txt +0 -4
- swarm/blueprints/README.md +0 -68
- swarm/blueprints/blueprint_audit_status.json +0 -27
- swarm/blueprints/chatbot/README.md +0 -40
- swarm/blueprints/chatbot/blueprint_chatbot.py +0 -471
- swarm/blueprints/chatbot/metadata.json +0 -23
- swarm/blueprints/chatbot/templates/chatbot/chatbot.html +0 -33
- swarm/blueprints/chucks_angels/README.md +0 -11
- swarm/blueprints/chucks_angels/blueprint_chucks_angels.py +0 -7
- swarm/blueprints/chucks_angels/test_basic.py +0 -3
- swarm/blueprints/codey/CODEY.md +0 -15
- swarm/blueprints/codey/README.md +0 -115
- swarm/blueprints/codey/blueprint_codey.py +0 -1072
- swarm/blueprints/codey/codey_cli.py +0 -373
- swarm/blueprints/codey/instructions.md +0 -17
- swarm/blueprints/codey/metadata.json +0 -23
- swarm/blueprints/common/operation_box_utils.py +0 -83
- swarm/blueprints/digitalbutlers/README.md +0 -11
- swarm/blueprints/digitalbutlers/__init__.py +0 -1
- swarm/blueprints/digitalbutlers/blueprint_digitalbutlers.py +0 -7
- swarm/blueprints/digitalbutlers/test_basic.py +0 -3
- swarm/blueprints/divine_code/README.md +0 -3
- swarm/blueprints/divine_code/__init__.py +0 -10
- swarm/blueprints/divine_code/apps.py +0 -11
- swarm/blueprints/divine_code/blueprint_divine_code.py +0 -270
- swarm/blueprints/django_chat/apps.py +0 -6
- swarm/blueprints/django_chat/blueprint_django_chat.py +0 -268
- swarm/blueprints/django_chat/templates/django_chat/django_chat_webpage.html +0 -37
- swarm/blueprints/django_chat/urls.py +0 -8
- swarm/blueprints/django_chat/views.py +0 -32
- swarm/blueprints/echocraft/blueprint_echocraft.py +0 -384
- swarm/blueprints/flock/README.md +0 -11
- swarm/blueprints/flock/__init__.py +0 -8
- swarm/blueprints/flock/blueprint_flock.py +0 -7
- swarm/blueprints/flock/test_basic.py +0 -3
- swarm/blueprints/geese/README.md +0 -10
- swarm/blueprints/geese/__init__.py +0 -8
- swarm/blueprints/geese/blueprint_geese.py +0 -384
- swarm/blueprints/geese/geese_cli.py +0 -102
- swarm/blueprints/jeeves/README.md +0 -41
- swarm/blueprints/jeeves/blueprint_jeeves.py +0 -722
- swarm/blueprints/jeeves/jeeves_cli.py +0 -55
- swarm/blueprints/jeeves/metadata.json +0 -24
- swarm/blueprints/mcp_demo/blueprint_mcp_demo.py +0 -473
- swarm/blueprints/messenger/templates/messenger/messenger.html +0 -46
- swarm/blueprints/mission_improbable/blueprint_mission_improbable.py +0 -423
- swarm/blueprints/monkai_magic/blueprint_monkai_magic.py +0 -340
- swarm/blueprints/nebula_shellz/blueprint_nebula_shellz.py +0 -265
- swarm/blueprints/omniplex/blueprint_omniplex.py +0 -298
- swarm/blueprints/poets/blueprint_poets.py +0 -546
- swarm/blueprints/poets/poets_cli.py +0 -23
- swarm/blueprints/rue_code/README.md +0 -8
- swarm/blueprints/rue_code/blueprint_rue_code.py +0 -448
- swarm/blueprints/rue_code/rue_code_cli.py +0 -43
- swarm/blueprints/stewie/apps.py +0 -12
- swarm/blueprints/stewie/blueprint_family_ties.py +0 -349
- swarm/blueprints/stewie/models.py +0 -19
- swarm/blueprints/stewie/serializers.py +0 -10
- swarm/blueprints/stewie/settings.py +0 -17
- swarm/blueprints/stewie/urls.py +0 -11
- swarm/blueprints/stewie/views.py +0 -26
- swarm/blueprints/suggestion/blueprint_suggestion.py +0 -222
- swarm/blueprints/whinge_surf/README.md +0 -22
- swarm/blueprints/whinge_surf/__init__.py +0 -1
- swarm/blueprints/whinge_surf/blueprint_whinge_surf.py +0 -565
- swarm/blueprints/whinge_surf/whinge_surf_cli.py +0 -99
- swarm/blueprints/whiskeytango_foxtrot/__init__.py +0 -0
- swarm/blueprints/whiskeytango_foxtrot/apps.py +0 -11
- swarm/blueprints/whiskeytango_foxtrot/blueprint_whiskeytango_foxtrot.py +0 -339
- swarm/blueprints/zeus/__init__.py +0 -2
- swarm/blueprints/zeus/apps.py +0 -4
- swarm/blueprints/zeus/blueprint_zeus.py +0 -270
- swarm/blueprints/zeus/zeus_cli.py +0 -13
- swarm/cli/async_input.py +0 -65
- swarm/cli/async_input_demo.py +0 -32
- swarm/core/blueprint_base.py +0 -769
- swarm/core/blueprint_discovery.py +0 -125
- swarm/core/blueprint_runner.py +0 -59
- swarm/core/blueprint_ux.py +0 -109
- swarm/core/build_launchers.py +0 -15
- swarm/core/cli/__init__.py +0 -1
- swarm/core/cli/commands/__init__.py +0 -1
- swarm/core/cli/commands/blueprint_management.py +0 -7
- swarm/core/cli/interactive_shell.py +0 -14
- swarm/core/cli/main.py +0 -50
- swarm/core/cli/utils/__init__.py +0 -1
- swarm/core/cli/utils/discover_commands.py +0 -18
- swarm/core/config_loader.py +0 -122
- swarm/core/output_utils.py +0 -193
- swarm/core/session_logger.py +0 -42
- swarm/core/slash_commands.py +0 -89
- swarm/core/swarm_api.py +0 -68
- swarm/core/swarm_cli.py +0 -216
- swarm/core/utils/__init__.py +0 -0
- swarm/extensions/blueprint/cli_handler.py +0 -197
- swarm/extensions/blueprint/runnable_blueprint.py +0 -42
- swarm/extensions/cli/utils/__init__.py +0 -1
- swarm/extensions/cli/utils/async_input.py +0 -46
- swarm/extensions/cli/utils/prompt_user.py +0 -3
- swarm/management/__init__.py +0 -0
- swarm/management/commands/__init__.py +0 -0
- swarm/management/commands/runserver.py +0 -58
- swarm/middleware.py +0 -65
- swarm/permissions.py +0 -38
- swarm/static/contrib/fonts/fontawesome-webfont.ttf +0 -7
- swarm/static/contrib/fonts/fontawesome-webfont.woff +0 -7
- swarm/static/contrib/fonts/fontawesome-webfont.woff2 +0 -7
- swarm/static/contrib/markedjs/marked.min.js +0 -6
- swarm/static/contrib/tabler-icons/adjustments-horizontal.svg +0 -27
- swarm/static/contrib/tabler-icons/alert-triangle.svg +0 -21
- swarm/static/contrib/tabler-icons/archive.svg +0 -21
- swarm/static/contrib/tabler-icons/artboard.svg +0 -27
- swarm/static/contrib/tabler-icons/automatic-gearbox.svg +0 -23
- swarm/static/contrib/tabler-icons/box-multiple.svg +0 -19
- swarm/static/contrib/tabler-icons/carambola.svg +0 -19
- swarm/static/contrib/tabler-icons/copy.svg +0 -20
- swarm/static/contrib/tabler-icons/download.svg +0 -21
- swarm/static/contrib/tabler-icons/edit.svg +0 -21
- swarm/static/contrib/tabler-icons/filled/carambola.svg +0 -13
- swarm/static/contrib/tabler-icons/filled/paint.svg +0 -13
- swarm/static/contrib/tabler-icons/headset.svg +0 -22
- swarm/static/contrib/tabler-icons/layout-sidebar-left-collapse.svg +0 -21
- swarm/static/contrib/tabler-icons/layout-sidebar-left-expand.svg +0 -21
- swarm/static/contrib/tabler-icons/layout-sidebar-right-collapse.svg +0 -21
- swarm/static/contrib/tabler-icons/layout-sidebar-right-expand.svg +0 -21
- swarm/static/contrib/tabler-icons/message-chatbot.svg +0 -22
- swarm/static/contrib/tabler-icons/message-star.svg +0 -22
- swarm/static/contrib/tabler-icons/message-x.svg +0 -23
- swarm/static/contrib/tabler-icons/message.svg +0 -21
- swarm/static/contrib/tabler-icons/paperclip.svg +0 -18
- swarm/static/contrib/tabler-icons/playlist-add.svg +0 -22
- swarm/static/contrib/tabler-icons/robot.svg +0 -26
- swarm/static/contrib/tabler-icons/search.svg +0 -19
- swarm/static/contrib/tabler-icons/settings.svg +0 -20
- swarm/static/contrib/tabler-icons/thumb-down.svg +0 -19
- swarm/static/contrib/tabler-icons/thumb-up.svg +0 -19
- swarm/static/css/dropdown.css +0 -22
- swarm/static/htmx/htmx.min.js +0 -0
- swarm/static/js/dropdown.js +0 -23
- swarm/static/rest_mode/css/base.css +0 -470
- swarm/static/rest_mode/css/chat-history.css +0 -286
- swarm/static/rest_mode/css/chat.css +0 -251
- swarm/static/rest_mode/css/chatbot.css +0 -74
- swarm/static/rest_mode/css/chatgpt.css +0 -62
- swarm/static/rest_mode/css/colors/corporate.css +0 -74
- swarm/static/rest_mode/css/colors/pastel.css +0 -81
- swarm/static/rest_mode/css/colors/tropical.css +0 -82
- swarm/static/rest_mode/css/general.css +0 -142
- swarm/static/rest_mode/css/layout.css +0 -167
- swarm/static/rest_mode/css/layouts/messenger-layout.css +0 -17
- swarm/static/rest_mode/css/layouts/minimalist-layout.css +0 -57
- swarm/static/rest_mode/css/layouts/mobile-layout.css +0 -8
- swarm/static/rest_mode/css/messages.css +0 -84
- swarm/static/rest_mode/css/messenger.css +0 -135
- swarm/static/rest_mode/css/settings.css +0 -91
- swarm/static/rest_mode/css/simple.css +0 -44
- swarm/static/rest_mode/css/slack.css +0 -58
- swarm/static/rest_mode/css/style.css +0 -156
- swarm/static/rest_mode/css/theme.css +0 -30
- swarm/static/rest_mode/css/toast.css +0 -40
- swarm/static/rest_mode/js/auth.js +0 -9
- swarm/static/rest_mode/js/blueprint.js +0 -41
- swarm/static/rest_mode/js/blueprintUtils.js +0 -12
- swarm/static/rest_mode/js/chatLogic.js +0 -79
- swarm/static/rest_mode/js/debug.js +0 -63
- swarm/static/rest_mode/js/events.js +0 -98
- swarm/static/rest_mode/js/main.js +0 -19
- swarm/static/rest_mode/js/messages.js +0 -264
- swarm/static/rest_mode/js/messengerLogic.js +0 -355
- swarm/static/rest_mode/js/modules/apiService.js +0 -84
- swarm/static/rest_mode/js/modules/blueprintManager.js +0 -162
- swarm/static/rest_mode/js/modules/chatHistory.js +0 -110
- swarm/static/rest_mode/js/modules/debugLogger.js +0 -14
- swarm/static/rest_mode/js/modules/eventHandlers.js +0 -107
- swarm/static/rest_mode/js/modules/messageProcessor.js +0 -120
- swarm/static/rest_mode/js/modules/state.js +0 -7
- swarm/static/rest_mode/js/modules/userInteractions.js +0 -29
- swarm/static/rest_mode/js/modules/validation.js +0 -23
- swarm/static/rest_mode/js/rendering.js +0 -119
- swarm/static/rest_mode/js/settings.js +0 -130
- swarm/static/rest_mode/js/sidebar.js +0 -94
- swarm/static/rest_mode/js/simpleLogic.js +0 -37
- swarm/static/rest_mode/js/slackLogic.js +0 -66
- swarm/static/rest_mode/js/splash.js +0 -76
- swarm/static/rest_mode/js/theme.js +0 -111
- swarm/static/rest_mode/js/toast.js +0 -36
- swarm/static/rest_mode/js/ui.js +0 -265
- swarm/static/rest_mode/js/validation.js +0 -57
- swarm/static/rest_mode/svg/animated_spinner.svg +0 -12
- swarm/static/rest_mode/svg/arrow_down.svg +0 -5
- swarm/static/rest_mode/svg/arrow_left.svg +0 -5
- swarm/static/rest_mode/svg/arrow_right.svg +0 -5
- swarm/static/rest_mode/svg/arrow_up.svg +0 -5
- swarm/static/rest_mode/svg/attach.svg +0 -8
- swarm/static/rest_mode/svg/avatar.svg +0 -7
- swarm/static/rest_mode/svg/canvas.svg +0 -6
- swarm/static/rest_mode/svg/chat_history.svg +0 -4
- swarm/static/rest_mode/svg/close.svg +0 -5
- swarm/static/rest_mode/svg/copy.svg +0 -4
- swarm/static/rest_mode/svg/dark_mode.svg +0 -3
- swarm/static/rest_mode/svg/edit.svg +0 -5
- swarm/static/rest_mode/svg/layout.svg +0 -9
- swarm/static/rest_mode/svg/logo.svg +0 -29
- swarm/static/rest_mode/svg/logout.svg +0 -5
- swarm/static/rest_mode/svg/mobile.svg +0 -5
- swarm/static/rest_mode/svg/new_chat.svg +0 -4
- swarm/static/rest_mode/svg/not_visible.svg +0 -5
- swarm/static/rest_mode/svg/plus.svg +0 -7
- swarm/static/rest_mode/svg/run_code.svg +0 -6
- swarm/static/rest_mode/svg/save.svg +0 -4
- swarm/static/rest_mode/svg/search.svg +0 -6
- swarm/static/rest_mode/svg/settings.svg +0 -4
- swarm/static/rest_mode/svg/speaker.svg +0 -5
- swarm/static/rest_mode/svg/stop.svg +0 -6
- swarm/static/rest_mode/svg/thumbs_down.svg +0 -3
- swarm/static/rest_mode/svg/thumbs_up.svg +0 -3
- swarm/static/rest_mode/svg/toggle_off.svg +0 -6
- swarm/static/rest_mode/svg/toggle_on.svg +0 -6
- swarm/static/rest_mode/svg/trash.svg +0 -10
- swarm/static/rest_mode/svg/undo.svg +0 -3
- swarm/static/rest_mode/svg/visible.svg +0 -8
- swarm/static/rest_mode/svg/voice.svg +0 -10
- swarm/templates/account/login.html +0 -22
- swarm/templates/account/signup.html +0 -32
- swarm/templates/base.html +0 -30
- swarm/templates/chat.html +0 -43
- swarm/templates/index.html +0 -35
- swarm/templates/rest_mode/components/chat_sidebar.html +0 -55
- swarm/templates/rest_mode/components/header.html +0 -45
- swarm/templates/rest_mode/components/main_chat_pane.html +0 -41
- swarm/templates/rest_mode/components/settings_dialog.html +0 -97
- swarm/templates/rest_mode/components/splash_screen.html +0 -7
- swarm/templates/rest_mode/components/top_bar.html +0 -28
- swarm/templates/rest_mode/message_ui.html +0 -50
- swarm/templates/rest_mode/slackbot.html +0 -30
- swarm/templates/simple_blueprint_page.html +0 -24
- swarm/templates/websocket_partials/final_system_message.html +0 -3
- swarm/templates/websocket_partials/system_message.html +0 -4
- swarm/templates/websocket_partials/user_message.html +0 -5
- swarm/utils/ansi_box.py +0 -34
- swarm/utils/disable_tracing.py +0 -38
- swarm/utils/log_utils.py +0 -63
- swarm/utils/openai_patch.py +0 -33
- swarm/ux/ansi_box.py +0 -43
- swarm/ux/spinner.py +0 -53
- {open_swarm-0.1.1745275181.dist-info → open_swarm-0.1.1748636259.dist-info}/licenses/LICENSE +0 -0
- /swarm/{core → extensions/blueprint}/blueprint_utils.py +0 -0
- /swarm/{core → extensions/blueprint}/common_utils.py +0 -0
- /swarm/{core → extensions/config}/setup_wizard.py +0 -0
- /swarm/{blueprints/rue_code → extensions/config/utils}/__init__.py +0 -0
- /swarm/{core → extensions/config}/utils/logger.py +0 -0
- /swarm/{core → extensions/launchers}/swarm_wrapper.py +0 -0
@@ -1,45 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<!DOCTYPE html>
|
3
|
-
<html lang="en">
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8" />
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
-
<title>Open-Swarm Chat</title>
|
8
|
-
|
9
|
-
<!-- CSRF Token -->
|
10
|
-
<meta name="csrf-token" content="{{ csrf_token }}">
|
11
|
-
|
12
|
-
<!-- Base CSS -->
|
13
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/base.css' %}">
|
14
|
-
<link id="colorThemeLink" rel="stylesheet" href="{% static 'rest_mode/css/colors/corporate.css' %}">
|
15
|
-
<link id="layoutThemeLink" rel="stylesheet" href="{% static 'rest_mode/css/layouts/messenger-layout.css' %}">
|
16
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/style.css' %}">
|
17
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/chat-history.css' %}">
|
18
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/chat.css' %}">
|
19
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/general.css' %}">
|
20
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/messages.css' %}">
|
21
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/settings.css' %}">
|
22
|
-
|
23
|
-
<!-- Inline Script to Apply Settings from localStorage -->
|
24
|
-
<script>
|
25
|
-
(function () {
|
26
|
-
// Default values
|
27
|
-
const defaultSettings = {
|
28
|
-
colorTheme: 'corporate',
|
29
|
-
layoutTheme: 'messenger-layout',
|
30
|
-
darkMode: true,
|
31
|
-
mobileLayout: false
|
32
|
-
};
|
33
|
-
|
34
|
-
// Load settings from localStorage or use defaults
|
35
|
-
const colorTheme = localStorage.getItem('selectedColor') || defaultSettings.colorTheme;
|
36
|
-
const layoutTheme = localStorage.getItem('selectedLayout') || defaultSettings.layoutTheme;
|
37
|
-
const darkMode = localStorage.getItem('darkMode') === 'true' || defaultSettings.darkMode;
|
38
|
-
|
39
|
-
// Apply settings
|
40
|
-
document.documentElement.setAttribute('data-theme-color', colorTheme);
|
41
|
-
document.documentElement.setAttribute('data-theme-layout', layoutTheme);
|
42
|
-
document.documentElement.setAttribute('data-theme-dark', darkMode);
|
43
|
-
})();
|
44
|
-
</script>
|
45
|
-
</head>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<div class="main-pane">
|
3
|
-
<div class="button-row">
|
4
|
-
<button class="input-button-subtle" aria-label="Toggle Chat History" id="chatHistoryToggleButtonVisible" style="display: none;">
|
5
|
-
<img src="{% static 'contrib/tabler-icons/layout-sidebar-left-expand.svg' %}" alt="Chat History">
|
6
|
-
</button>
|
7
|
-
<button class="input-button-subtle" aria-label="Settings" id="settingsButton-main" style="display: none;">
|
8
|
-
<img src="{% static 'contrib/tabler-icons/settings.svg' %}" alt="Settings">
|
9
|
-
</button>
|
10
|
-
<button class="input-button-subtle" aria-label="Search" id="searchButton-main" style="display: none;">
|
11
|
-
<img src="{% static 'contrib/tabler-icons/search.svg' %}" alt="Search">
|
12
|
-
</button>
|
13
|
-
<button class="input-button-subtle" aria-label="New Chat" id="newChatButton-main" style="display: none;">
|
14
|
-
<img src="{% static 'contrib/tabler-icons/message-chatbot.svg' %}" alt="New Chat"> New Chat
|
15
|
-
</button>
|
16
|
-
</div>
|
17
|
-
<div id="quickPromptsContainer" class="quick-prompts-container"></div>
|
18
|
-
<div id="messageHistory" class="message-container"></div>
|
19
|
-
<div id="loadingIndicator" class="loading-indicator"></div>
|
20
|
-
<div class="form-container">
|
21
|
-
<div class="dropdown-buttons-container">
|
22
|
-
<select class="blueprint-dropdown" id="blueprintDropdown" aria-label="Select Blueprint"></select>
|
23
|
-
<button class="input-button upload-button" id="uploadButton" aria-label="Upload">
|
24
|
-
<img src="{% static 'contrib/tabler-icons/paperclip.svg' %}" alt="Upload">
|
25
|
-
</button>
|
26
|
-
<button class="input-button upload-button" id="canvasToggleButton" aria-label="Toggle Canvas">
|
27
|
-
<img src="{% static 'contrib/tabler-icons/artboard.svg' %}" alt="Canvas">
|
28
|
-
</button>
|
29
|
-
<button class="input-button" id="voiceRecordButton" aria-label="Record Voice">
|
30
|
-
<img src="{% static 'contrib/tabler-icons/headset.svg' %}" alt="Record Voice">
|
31
|
-
</button>
|
32
|
-
<button class="input-button upload-button" id="avatarToggleButton" aria-label="Toggle Avatar">
|
33
|
-
<img src="{% static 'contrib/tabler-icons/robot.svg' %}" alt="Avatar">
|
34
|
-
</button>
|
35
|
-
</div>
|
36
|
-
<div class="send-container">
|
37
|
-
<input type="text" id="userInput" class="rounded-input" placeholder="Type your message here...">
|
38
|
-
<button class="half-cut-button">Send</button>
|
39
|
-
</div>
|
40
|
-
</div>
|
41
|
-
</div>
|
@@ -1,97 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<div class="settings-dialog" id="settingsDialog">
|
3
|
-
<button class="dialog-close-btn" id="closeSettingsDialog">
|
4
|
-
<img src="{% static 'rest_mode/svg/close.svg' %}" alt="Close Settings Dialog">
|
5
|
-
</button>
|
6
|
-
<div class="settings-container scrollable-container">
|
7
|
-
<h2>⚙️ Settings</h2>
|
8
|
-
|
9
|
-
<!-- User Interface Section -->
|
10
|
-
<div class="settings-container-section">
|
11
|
-
<h3 id="uiConfigToggle" class="collapsible-toggle">🖌️ User Interface <span>▼</span></h3>
|
12
|
-
<div id="uiConfiguration" class="collapsible-content hidden">
|
13
|
-
<!-- Dark Mode -->
|
14
|
-
<div class="toggle-title">
|
15
|
-
<label for="darkModeToggle">🌙 Dark Mode:</label>
|
16
|
-
<div id="darkModeToggle" class="svg-toggle" data-state="off">
|
17
|
-
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<!-- Colour -->
|
22
|
-
<div class="theme-dropdown">
|
23
|
-
<label for="colorSelect">🎨 Colour:</label><select id="colorSelect">
|
24
|
-
<option value="corporate">Corporate</option>
|
25
|
-
<option value="pastel">Pastel</option>
|
26
|
-
<option value="tropical">Tropical</option>
|
27
|
-
</select>
|
28
|
-
</div>
|
29
|
-
|
30
|
-
<!-- Layout -->
|
31
|
-
<div class="theme-dropdown">
|
32
|
-
<label for="layoutSelect">🖥️ Layout:</label>
|
33
|
-
<select id="layoutSelect">
|
34
|
-
<option value="messenger-layout">Messenger</option>
|
35
|
-
<option value="mobile-layout">Mobile</option>
|
36
|
-
<option value="minimalist-layout">Minimalist</option>
|
37
|
-
</select>
|
38
|
-
</div>
|
39
|
-
|
40
|
-
<!-- Mobile UI Master Toggle -->
|
41
|
-
<div class="settings-container-section">
|
42
|
-
<h4 id="mobileUIToggleTitle" class="collapsible-toggle">📱 Mobile UI <span>▼</span></h4>
|
43
|
-
<div id="mobileUIConfiguration" class="collapsible-content hidden">
|
44
|
-
<!-- Master Toggle -->
|
45
|
-
<div class="toggle-title">
|
46
|
-
<label for="mobileUIToggle">Enable Mobile UI:</label>
|
47
|
-
<div id="mobileUIToggle" class="svg-toggle" data-state="off">
|
48
|
-
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
49
|
-
</div>
|
50
|
-
</div>
|
51
|
-
<!-- Nested Toggles -->
|
52
|
-
<div id="mobileUIOptions" class="nested-container">
|
53
|
-
<div class="nested-toggle">
|
54
|
-
<label for="alwaysVisibleButtonsToggle">Always Visible Buttons:</label>
|
55
|
-
<div id="alwaysVisibleButtonsToggle" class="svg-toggle" data-state="off">
|
56
|
-
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
57
|
-
</div>
|
58
|
-
</div>
|
59
|
-
<div class="nested-toggle">
|
60
|
-
<label for="revealTopBarToggle">Reveal Top Bar When Up Scroll:</label>
|
61
|
-
<div id="revealTopBarToggle" class="svg-toggle" data-state="off">
|
62
|
-
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
63
|
-
</div>
|
64
|
-
</div>
|
65
|
-
<div class="nested-toggle">
|
66
|
-
<label for="swipeLeftSettingsToggle">Swipe Left for Settings:</label>
|
67
|
-
<div id="swipeLeftSettingsToggle" class="svg-toggle" data-state="off">
|
68
|
-
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
69
|
-
</div>
|
70
|
-
</div>
|
71
|
-
<div class="nested-toggle">
|
72
|
-
<label for="swipeRightChatHistoryToggle">Swipe Right for Chat History:</label>
|
73
|
-
<div id="swipeRightChatHistoryToggle" class="svg-toggle" data-state="off">
|
74
|
-
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
75
|
-
</div>
|
76
|
-
</div>
|
77
|
-
<div class="nested-toggle">
|
78
|
-
<label for="swipeDownControlsToggle">Swipe Down for Controls:</label>
|
79
|
-
<div id="swipeDownControlsToggle" class="svg-toggle" data-state="off">
|
80
|
-
<img src="{% static 'rest_mode/svg/toggle_off.svg' %}" alt="Toggle Off">
|
81
|
-
</div>
|
82
|
-
</div>
|
83
|
-
</div>
|
84
|
-
</div>
|
85
|
-
</div>
|
86
|
-
</div>
|
87
|
-
</div>
|
88
|
-
|
89
|
-
<!-- LLM Configuration -->
|
90
|
-
<div class="settings-container-section">
|
91
|
-
<h3 id="llmConfigToggle" class="collapsible-toggle">🧠 LLM Configuration <span>▼</span></h3>
|
92
|
-
<div id="llmConfiguration" class="collapsible-content hidden">
|
93
|
-
<p>Loading LLM configurations...</p>
|
94
|
-
</div>
|
95
|
-
</div>
|
96
|
-
</div>
|
97
|
-
</div>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<div id="splashScreen" class="splash-screen">
|
3
|
-
<div class="splash-content">
|
4
|
-
<h1 id="splashText">Connecting to the AI...</h1>
|
5
|
-
<small>... trouble connecting? Check the <a href="https://github.com/matthewhand/open-swarm/TROUBLESHOOTING.md">Troubleshooting Guide</a></small>
|
6
|
-
</div>
|
7
|
-
</div>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<div class="top-bar">
|
3
|
-
|
4
|
-
|
5
|
-
<!-- Persistent Message Area -->
|
6
|
-
<div id="firstUserMessage" class="first-user-message"></div>
|
7
|
-
|
8
|
-
<!-- Settings (Right) -->
|
9
|
-
<div class="top-bar-right">
|
10
|
-
|
11
|
-
<!-- Blueprint Name and Dropdown -->
|
12
|
-
<div class="blueprint-container">
|
13
|
-
<h2 id="blueprintTitle" class="blueprint-title"></h2>
|
14
|
-
|
15
|
-
<!-- Hidden Blueprint Metadata -->
|
16
|
-
<div id="blueprintMetadata" class="hidden">
|
17
|
-
<h2>Metadata</h2>
|
18
|
-
<p>Metadata content will be dynamically updated...</p>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<!-- Blueprint Dialog -->
|
22
|
-
<div id="blueprintDialog" class="blueprint-dialog hidden">
|
23
|
-
<!-- Blueprint options will be injected dynamically -->
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
|
27
|
-
</div>
|
28
|
-
</div>
|
@@ -1,50 +0,0 @@
|
|
1
|
-
<div class="message-container">
|
2
|
-
<!-- Persistent Message Area -->
|
3
|
-
<div id="persistentMessage" class="persistent-message">
|
4
|
-
<div class="message assistant">
|
5
|
-
<span>Welcome to Open-Swarm Chat!</span>
|
6
|
-
</div>
|
7
|
-
<div id="firstUserMessage">
|
8
|
-
<!-- Placeholder for dynamically updated persistent message -->
|
9
|
-
</div>
|
10
|
-
<div class="message-toolbar">
|
11
|
-
<button class="toolbar-btn" aria-label="Edit Persistent Message" title="Edit">
|
12
|
-
<img src="{% static 'rest_mode/svg/edit.svg' %}" alt="Edit Icon" class="icon-svg" />
|
13
|
-
</button>
|
14
|
-
<button class="toolbar-btn" aria-label="Copy Persistent Message" title="Copy">
|
15
|
-
<img src="{% static 'rest_mode/svg/copy.svg' %}" alt="Copy Icon" class="icon-svg" />
|
16
|
-
</button>
|
17
|
-
<button class="toolbar-btn" aria-label="Delete Persistent Message" title="Delete">
|
18
|
-
<img src="{% static 'rest_mode/svg/trash.svg' %}" alt="Trash Icon" class="icon-svg" />
|
19
|
-
</button>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<!-- Messages -->
|
24
|
-
<div id="messageHistory" class="message-history">
|
25
|
-
<!-- Example of a user message -->
|
26
|
-
<div class="message user">
|
27
|
-
<span>Hello, how are you?</span>
|
28
|
-
<div class="message-toolbar">
|
29
|
-
<button class="toolbar-btn" aria-label="Append to Persistent Message" title="Append">
|
30
|
-
<img src="{% static 'rest_mode/svg/plus.svg' %}" alt="Plus Icon" class="icon-svg" />
|
31
|
-
</button>
|
32
|
-
<button class="toolbar-btn" aria-label="Edit Message" title="Edit">
|
33
|
-
<img src="{% static 'rest_mode/svg/edit.svg' %}" alt="Edit Icon" class="icon-svg" />
|
34
|
-
</button>
|
35
|
-
<button class="toolbar-btn" aria-label="Copy Message" title="Copy">
|
36
|
-
<img src="{% static 'rest_mode/svg/copy.svg' %}" alt="Copy Icon" class="icon-svg" />
|
37
|
-
</button>
|
38
|
-
<button class="toolbar-btn" aria-label="Delete Message" title="Delete">
|
39
|
-
<img src="{% static 'rest_mode/svg/trash.svg' %}" alt="Trash Icon" class="icon-svg" />
|
40
|
-
</button>
|
41
|
-
<button class="toolbar-btn" aria-label="Thumbs Up" title="Thumbs Up">
|
42
|
-
<img src="{% static 'rest_mode/svg/thumbs_up.svg' %}" alt="Thumbs Up Icon" class="icon-svg" />
|
43
|
-
</button>
|
44
|
-
<button class="toolbar-btn" aria-label="Thumbs Down" title="Thumbs Down">
|
45
|
-
<img src="{% static 'rest_mode/svg/thumbs_down.svg' %}" alt="Thumbs Down Icon" class="icon-svg" />
|
46
|
-
</button>
|
47
|
-
</div>
|
48
|
-
</div>
|
49
|
-
</div>
|
50
|
-
</div>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<!DOCTYPE html>
|
3
|
-
<html lang="en">
|
4
|
-
<head>
|
5
|
-
{% include 'rest_mode/components/header.html' %}
|
6
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/slack.css' %}">
|
7
|
-
<script>
|
8
|
-
window.STATIC_URLS = {
|
9
|
-
layoutSidebarLeftExpand: "{% static 'contrib/tabler-icons/layout-sidebar-left-expand.svg' %}",
|
10
|
-
layoutSidebarLeftCollapse: "{% static 'contrib/tabler-icons/layout-sidebar-left-collapse.svg' %}"
|
11
|
-
};
|
12
|
-
</script>
|
13
|
-
</head>
|
14
|
-
<body>
|
15
|
-
{% include 'rest_mode/components/top_bar.html' %}
|
16
|
-
<div class="container" data-theme-color="corporate" data-theme-dark="false" data-theme-layout="slack-layout">
|
17
|
-
<div class="side-panes channel-pane" id="channelPane">
|
18
|
-
<h2>Channels</h2>
|
19
|
-
<ul id="channelList" class="channel-list"></ul>
|
20
|
-
</div>
|
21
|
-
<div class="vertical-divider" id="divider-left"></div>
|
22
|
-
<div class="main-pane">
|
23
|
-
{% include 'rest_mode/components/main_chat_pane.html' %}
|
24
|
-
</div>
|
25
|
-
<div id="toastContainer"></div>
|
26
|
-
</div>
|
27
|
-
<script type="module" src="{% static 'contrib/markedjs/marked.min.js' %}"></script>
|
28
|
-
<script type="module" src="{% static 'rest_mode/js/slackLogic.js' %}" defer></script>
|
29
|
-
</body>
|
30
|
-
</html>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<!DOCTYPE html>
|
3
|
-
<html lang="en">
|
4
|
-
<head>
|
5
|
-
{% include 'rest_mode/components/header.html' %}
|
6
|
-
<title>{{ blueprint_name }} Chat</title>
|
7
|
-
<meta name="csrf-token" content="{{ csrf_token }}">
|
8
|
-
<link rel="stylesheet" href="{% static 'rest_mode/css/style.css' %}">
|
9
|
-
</head>
|
10
|
-
<body>
|
11
|
-
<div class="container" data-theme-color="corporate" data-theme-dark="false" data-theme-layout="minimal-layout">
|
12
|
-
<div class="main-pane">
|
13
|
-
<h2 id="blueprintTitle">{{ blueprint_name }}</h2>
|
14
|
-
<div id="messageHistory" class="message-container"></div>
|
15
|
-
<div class="send-container">
|
16
|
-
<input type="text" id="userInput" class="rounded-input" placeholder="Type your message here...">
|
17
|
-
<button class="half-cut-button" id="sendButton">Send</button>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
<script type="module" src="{% static 'contrib/markedjs/marked.min.js' %}"></script>
|
22
|
-
<script type="module" src="{% static 'rest_mode/js/simpleLogic.js' %}" defer></script>
|
23
|
-
</body>
|
24
|
-
</html>
|
swarm/utils/ansi_box.py
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
import shutil
|
2
|
-
|
3
|
-
ANSI_COLORS = {
|
4
|
-
'cyan': '\033[96m',
|
5
|
-
'green': '\033[92m',
|
6
|
-
'yellow': '\033[93m',
|
7
|
-
'magenta': '\033[95m',
|
8
|
-
'blue': '\033[94m',
|
9
|
-
'red': '\033[91m',
|
10
|
-
'white': '\033[97m',
|
11
|
-
'grey': '\033[90m',
|
12
|
-
'reset': '\033[0m',
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
def ansi_box(text, color='cyan', emoji='🤖', width=None):
|
17
|
-
"""
|
18
|
-
Draw a fancy ANSI box around the given text, with color and emoji.
|
19
|
-
"""
|
20
|
-
lines = [line.rstrip() for line in text.strip('\n').split('\n')]
|
21
|
-
max_len = max(len(line) for line in lines)
|
22
|
-
if width is None:
|
23
|
-
try:
|
24
|
-
width = min(shutil.get_terminal_size((80, 20)).columns, max_len + 6)
|
25
|
-
except Exception:
|
26
|
-
width = max_len + 6
|
27
|
-
box_width = max(width, max_len + 6)
|
28
|
-
color_code = ANSI_COLORS.get(color, ANSI_COLORS['cyan'])
|
29
|
-
reset = ANSI_COLORS['reset']
|
30
|
-
top = f"{color_code}╔{'═' * (box_width-2)}╗{reset}"
|
31
|
-
title = f"{color_code}║ {emoji} {' ' * (box_width-6)}║{reset}"
|
32
|
-
content = [f"{color_code}║ {line.ljust(box_width-4)} ║{reset}" for line in lines]
|
33
|
-
bottom = f"{color_code}╚{'═' * (box_width-2)}╝{reset}"
|
34
|
-
return '\n'.join([top, title] + content + [bottom])
|
swarm/utils/disable_tracing.py
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Utility to disable OpenAI Agents Python tracing by default unless explicitly enabled in config.
|
3
|
-
"""
|
4
|
-
import os
|
5
|
-
import json
|
6
|
-
|
7
|
-
def traces_enabled_from_config(config_path="swarm_config.json"):
|
8
|
-
try:
|
9
|
-
with open(config_path) as f:
|
10
|
-
config = json.load(f)
|
11
|
-
# Look for openai_traces or similar in LLM config
|
12
|
-
llm_config = config.get("llm", {})
|
13
|
-
return llm_config.get("openai_traces", False)
|
14
|
-
except Exception:
|
15
|
-
return False
|
16
|
-
|
17
|
-
def disable_openai_agents_tracing():
|
18
|
-
try:
|
19
|
-
import agents.tracing.create as tracing_create
|
20
|
-
import agents.tracing.setup as tracing_setup
|
21
|
-
# Patch GLOBAL_TRACE_PROVIDER to always return disabled traces
|
22
|
-
class DisabledTrace:
|
23
|
-
def __init__(self, *a, **k): pass
|
24
|
-
def __enter__(self): return self
|
25
|
-
def __exit__(self, *a, **k): pass
|
26
|
-
def start(self): return self
|
27
|
-
def finish(self): return self
|
28
|
-
class DummyProvider:
|
29
|
-
def get_current_trace(self): return DisabledTrace()
|
30
|
-
def new_trace(self, *a, **k): return DisabledTrace()
|
31
|
-
tracing_setup.GLOBAL_TRACE_PROVIDER = DummyProvider()
|
32
|
-
tracing_create.trace = lambda *a, **k: DisabledTrace()
|
33
|
-
except ImportError:
|
34
|
-
pass
|
35
|
-
|
36
|
-
# At import, check config and disable tracing if not enabled
|
37
|
-
if not traces_enabled_from_config():
|
38
|
-
disable_openai_agents_tracing()
|
swarm/utils/log_utils.py
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
import sys
|
3
|
-
from swarm.settings import Settings, LogFormat
|
4
|
-
|
5
|
-
# Cache for initialized loggers to avoid adding handlers multiple times
|
6
|
-
_initialized_loggers = set()
|
7
|
-
|
8
|
-
def setup_logging(logger_name: str | None = None, level: str | int = Settings().log_level, force_reconfigure: bool = False) -> logging.Logger:
|
9
|
-
"""
|
10
|
-
Configures and returns a logger instance. Ensures handlers are not duplicated
|
11
|
-
and prevents propagation to avoid duplicate messages from parent loggers.
|
12
|
-
|
13
|
-
Args:
|
14
|
-
logger_name: Name of the logger. If None, configures the root logger.
|
15
|
-
level: Logging level (e.g., 'DEBUG', 'INFO', logging.DEBUG).
|
16
|
-
force_reconfigure: If True, remove existing handlers before adding new ones.
|
17
|
-
|
18
|
-
Returns:
|
19
|
-
Configured logger instance.
|
20
|
-
"""
|
21
|
-
log_level = logging.getLevelName(level.upper()) if isinstance(level, str) else level
|
22
|
-
|
23
|
-
logger = logging.getLogger(logger_name)
|
24
|
-
logger_id = logger_name if logger_name is not None else "root"
|
25
|
-
|
26
|
-
# Check if logger (by name) is already initialized and reconfiguration is not forced
|
27
|
-
if logger_id in _initialized_loggers and not force_reconfigure:
|
28
|
-
if logger.level != log_level:
|
29
|
-
logger.setLevel(log_level)
|
30
|
-
return logger
|
31
|
-
|
32
|
-
# If forcing reconfigure or first time, remove existing handlers
|
33
|
-
if force_reconfigure or logger_id not in _initialized_loggers:
|
34
|
-
for handler in logger.handlers[:]:
|
35
|
-
logger.removeHandler(handler)
|
36
|
-
if logger_name is None:
|
37
|
-
root_logger = logging.getLogger()
|
38
|
-
for handler in root_logger.handlers[:]:
|
39
|
-
root_logger.removeHandler(handler)
|
40
|
-
|
41
|
-
# Set the desired level on the logger
|
42
|
-
logger.setLevel(log_level)
|
43
|
-
|
44
|
-
# Prevent propagation for non-root loggers
|
45
|
-
if logger_name is not None:
|
46
|
-
logger.propagate = False
|
47
|
-
else:
|
48
|
-
logger.propagate = True # Root logger should propagate if needed by other libraries
|
49
|
-
|
50
|
-
# Add the stream handler if no handlers exist after potential removal
|
51
|
-
if not logger.handlers:
|
52
|
-
handler = logging.StreamHandler(sys.stdout)
|
53
|
-
log_format_enum = Settings().log_format
|
54
|
-
formatter = logging.Formatter(log_format_enum.value)
|
55
|
-
handler.setFormatter(formatter)
|
56
|
-
logger.addHandler(handler)
|
57
|
-
|
58
|
-
_initialized_loggers.add(logger_id)
|
59
|
-
|
60
|
-
# --- Lower level for specific noisy loggers ---
|
61
|
-
logging.getLogger('swarm.extensions.config.config_loader').setLevel(logging.ERROR) # Make config loader quieter by default
|
62
|
-
|
63
|
-
return logger
|
swarm/utils/openai_patch.py
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Monkeypatch OpenAI SDK to prevent telemetry/tracing when using a custom endpoint.
|
3
|
-
This disables any calls to OpenAI's internal tracing/telemetry/reporting subsystems.
|
4
|
-
Should be imported at startup if a custom OpenAI endpoint is used.
|
5
|
-
"""
|
6
|
-
|
7
|
-
def patch_openai_telemetry():
|
8
|
-
try:
|
9
|
-
import openai
|
10
|
-
# Patch telemetry/tracing if present (for openai>=1.0.0)
|
11
|
-
# For openai<1.0.0, there is no tracing, but be defensive.
|
12
|
-
if hasattr(openai, "_telemetry"):
|
13
|
-
openai._telemetry = None
|
14
|
-
# For openai>=1.0.0, tracing is in openai.tracing
|
15
|
-
if hasattr(openai, "tracing"):
|
16
|
-
class DummyTracer:
|
17
|
-
def add_event(self, *a, **k): pass
|
18
|
-
def post(self, *a, **k): pass
|
19
|
-
def record(self, *a, **k): pass
|
20
|
-
openai.tracing.tracer = DummyTracer()
|
21
|
-
# Patch any post/trace/report methods
|
22
|
-
for attr in ("post", "trace", "report", "send_usage", "_post"):
|
23
|
-
if hasattr(openai, attr):
|
24
|
-
setattr(openai, attr, lambda *a, **k: None)
|
25
|
-
# Patch environment variable if supported
|
26
|
-
import os
|
27
|
-
os.environ["OPENAI_TELEMETRY_OPTS"] = "off"
|
28
|
-
except ImportError:
|
29
|
-
pass
|
30
|
-
|
31
|
-
# Optionally, auto-patch if this file is imported as __main__
|
32
|
-
if __name__ == "__main__":
|
33
|
-
patch_openai_telemetry()
|
swarm/ux/ansi_box.py
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
import sys
|
2
|
-
|
3
|
-
def ansi_box(title, content, count=None, params=None, style='default', emoji=None):
|
4
|
-
"""
|
5
|
-
Print a visually distinct ANSI box summarizing search/analysis results.
|
6
|
-
- title: e.g. 'Searched filesystem', 'Analyzed code'
|
7
|
-
- content: main result string or list of strings
|
8
|
-
- count: result count (optional)
|
9
|
-
- params: dict of search parameters (optional)
|
10
|
-
- style: 'default', 'success', 'warning', etc.
|
11
|
-
- emoji: optional emoji prefix
|
12
|
-
"""
|
13
|
-
border = {
|
14
|
-
'default': '━',
|
15
|
-
'success': '━',
|
16
|
-
'warning': '━',
|
17
|
-
}.get(style, '━')
|
18
|
-
color = {
|
19
|
-
'default': '\033[36m', # Cyan
|
20
|
-
'success': '\033[32m', # Green
|
21
|
-
'warning': '\033[33m', # Yellow
|
22
|
-
}.get(style, '\033[36m')
|
23
|
-
reset = '\033[0m'
|
24
|
-
box_width = 80
|
25
|
-
lines = []
|
26
|
-
head = f"{emoji + ' ' if emoji else ''}{title}"
|
27
|
-
if count is not None:
|
28
|
-
head += f" | Results: {count}"
|
29
|
-
if params:
|
30
|
-
head += f" | Params: {params}"
|
31
|
-
lines.append(color + border * box_width + reset)
|
32
|
-
lines.append(color + f"{head[:box_width]:^{box_width}}" + reset)
|
33
|
-
lines.append(color + border * box_width + reset)
|
34
|
-
if isinstance(content, str):
|
35
|
-
content = [content]
|
36
|
-
for line in content:
|
37
|
-
for l in str(line).split('\n'):
|
38
|
-
lines.append(f"{l[:box_width]:<{box_width}}")
|
39
|
-
lines.append(color + border * box_width + reset)
|
40
|
-
print("\n".join(lines))
|
41
|
-
|
42
|
-
# Example usage:
|
43
|
-
# ansi_box('Searched filesystem', 'Found 12 files', count=12, params={'pattern': '*.py'}, style='success', emoji='💾')
|
swarm/ux/spinner.py
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
import sys
|
2
|
-
import threading
|
3
|
-
import time
|
4
|
-
|
5
|
-
class Spinner:
|
6
|
-
"""
|
7
|
-
Displays spinner states: Generating., Generating.., Generating..., Running...,
|
8
|
-
and switches to 'Taking longer than expected' after a timeout.
|
9
|
-
"""
|
10
|
-
def __init__(self, base_message="Generating", long_wait_timeout=8):
|
11
|
-
self.base_message = base_message
|
12
|
-
self.states = [".", "..", "...", "..", "."]
|
13
|
-
self.running = False
|
14
|
-
self.thread = None
|
15
|
-
self.long_wait_timeout = long_wait_timeout
|
16
|
-
self._long_wait = False
|
17
|
-
|
18
|
-
def start(self):
|
19
|
-
self.running = True
|
20
|
-
self.thread = threading.Thread(target=self._spin, daemon=True)
|
21
|
-
self.thread.start()
|
22
|
-
|
23
|
-
def stop(self):
|
24
|
-
self.running = False
|
25
|
-
if self.thread:
|
26
|
-
self.thread.join()
|
27
|
-
sys.stdout.write("\r" + " " * 80 + "\r")
|
28
|
-
sys.stdout.flush()
|
29
|
-
|
30
|
-
def _spin(self):
|
31
|
-
idx = 0
|
32
|
-
start_time = time.time()
|
33
|
-
while self.running:
|
34
|
-
if not self._long_wait and (time.time() - start_time > self.long_wait_timeout):
|
35
|
-
self._long_wait = True
|
36
|
-
if self._long_wait:
|
37
|
-
msg = f"{self.base_message}... Taking longer than expected"
|
38
|
-
else:
|
39
|
-
msg = f"{self.base_message}{self.states[idx % len(self.states)]}"
|
40
|
-
sys.stdout.write(f"\r{msg}")
|
41
|
-
sys.stdout.flush()
|
42
|
-
time.sleep(0.4)
|
43
|
-
idx += 1
|
44
|
-
|
45
|
-
def set_message(self, message):
|
46
|
-
self.base_message = message
|
47
|
-
self._long_wait = False
|
48
|
-
|
49
|
-
# Example usage:
|
50
|
-
# spinner = Spinner()
|
51
|
-
# spinner.start()
|
52
|
-
# ... do work ...
|
53
|
-
# spinner.stop()
|
{open_swarm-0.1.1745275181.dist-info → open_swarm-0.1.1748636259.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|