agentcrew-ai 0.8.13__py3-none-any.whl → 0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. AgentCrew/__init__.py +1 -1
  2. AgentCrew/app.py +34 -633
  3. AgentCrew/main_docker.py +1 -30
  4. AgentCrew/modules/agents/local_agent.py +2 -2
  5. AgentCrew/modules/chat/message/command_processor.py +33 -8
  6. AgentCrew/modules/chat/message/handler.py +5 -1
  7. AgentCrew/modules/console/completers.py +1 -1
  8. AgentCrew/modules/console/console_ui.py +6 -11
  9. AgentCrew/modules/console/conversation_browser/__init__.py +9 -0
  10. AgentCrew/modules/console/conversation_browser/browser.py +84 -0
  11. AgentCrew/modules/console/conversation_browser/browser_input_handler.py +279 -0
  12. AgentCrew/modules/console/{conversation_browser.py → conversation_browser/browser_ui.py} +249 -163
  13. AgentCrew/modules/console/conversation_handler.py +34 -1
  14. AgentCrew/modules/console/display_handlers.py +123 -7
  15. AgentCrew/modules/gui/components/command_handler.py +137 -29
  16. AgentCrew/modules/gui/themes/README.md +30 -14
  17. AgentCrew/modules/gui/themes/__init__.py +2 -1
  18. AgentCrew/modules/gui/themes/atom_light.yaml +1287 -0
  19. AgentCrew/modules/gui/themes/catppuccin.yaml +1276 -0
  20. AgentCrew/modules/gui/themes/dracula.yaml +1262 -0
  21. AgentCrew/modules/gui/themes/nord.yaml +1267 -0
  22. AgentCrew/modules/gui/themes/saigontech.yaml +1268 -0
  23. AgentCrew/modules/gui/themes/style_provider.py +76 -264
  24. AgentCrew/modules/gui/themes/theme_loader.py +379 -0
  25. AgentCrew/modules/gui/themes/unicorn.yaml +1276 -0
  26. AgentCrew/modules/gui/widgets/configs/global_settings.py +3 -4
  27. AgentCrew/modules/llm/constants.py +13 -4
  28. AgentCrew/setup.py +470 -0
  29. {agentcrew_ai-0.8.13.dist-info → agentcrew_ai-0.9.0.dist-info}/METADATA +1 -1
  30. {agentcrew_ai-0.8.13.dist-info → agentcrew_ai-0.9.0.dist-info}/RECORD +34 -29
  31. {agentcrew_ai-0.8.13.dist-info → agentcrew_ai-0.9.0.dist-info}/WHEEL +1 -1
  32. AgentCrew/modules/gui/themes/atom_light.py +0 -1365
  33. AgentCrew/modules/gui/themes/catppuccin.py +0 -1404
  34. AgentCrew/modules/gui/themes/dracula.py +0 -1372
  35. AgentCrew/modules/gui/themes/nord.py +0 -1365
  36. AgentCrew/modules/gui/themes/saigontech.py +0 -1359
  37. AgentCrew/modules/gui/themes/unicorn.py +0 -1372
  38. {agentcrew_ai-0.8.13.dist-info → agentcrew_ai-0.9.0.dist-info}/entry_points.txt +0 -0
  39. {agentcrew_ai-0.8.13.dist-info → agentcrew_ai-0.9.0.dist-info}/licenses/LICENSE +0 -0
  40. {agentcrew_ai-0.8.13.dist-info → agentcrew_ai-0.9.0.dist-info}/top_level.txt +0 -0
@@ -1,422 +1,234 @@
1
- from .catppuccin import CatppuccinTheme
2
- from .atom_light import AtomLightTheme
3
- from .nord import NordTheme
4
- from .dracula import DraculaTheme
5
- from .unicorn import UnicornTheme
6
- from .saigontech import SaigonTechTheme
1
+ from .theme_loader import ThemeLoader, ThemeData
7
2
  from AgentCrew.modules.config import ConfigManagement
8
3
  from PySide6.QtCore import Signal, QObject
9
4
 
10
5
 
11
6
  class StyleProvider(QObject):
12
- """Provides styling for the chat window and components."""
13
-
14
- # Signal emitted when theme changes
15
7
  theme_changed = Signal(str)
16
-
17
8
  _instance = None
18
9
 
19
10
  def __new__(cls):
20
- """Singleton pattern to ensure only one instance exists."""
21
11
  if cls._instance is None:
22
12
  cls._instance = super(StyleProvider, cls).__new__(cls)
23
13
  cls._instance._initialized = False
24
14
  return cls._instance
25
15
 
26
16
  def __init__(self):
27
- """Initialize the style provider by reading theme from global config."""
28
17
  if self._initialized:
29
18
  return
30
19
 
31
20
  super().__init__()
32
21
  self._initialized = True
33
22
 
34
- # Read theme from global config
35
23
  self.config_manager = ConfigManagement()
36
24
  global_config = self.config_manager.read_global_config_data()
37
- self.theme = global_config.get("global_settings", {}).get("theme", "saigontech")
25
+ self.theme = global_config.get("global_settings", {}).get("theme", "catppuccin")
38
26
 
39
27
  self._set_theme_class()
40
28
 
41
29
  def _set_theme_class(self):
42
- """Set the theme class based on the current theme setting."""
43
- if self.theme == "light":
44
- self.theme_class = AtomLightTheme
45
- elif self.theme == "nord":
46
- self.theme_class = NordTheme
47
- elif self.theme == "dracula":
48
- self.theme_class = DraculaTheme
49
- elif self.theme == "unicorn":
50
- self.theme_class = UnicornTheme
51
- elif self.theme == "dark":
52
- self.theme_class = CatppuccinTheme
53
- else:
54
- self.theme_class = SaigonTechTheme # Default to Catppuccin for "dark"
30
+ self.theme_class: ThemeData = ThemeLoader.load_theme(self.theme)
55
31
 
56
32
  def update_theme(self, reload=True):
57
- """
58
- Update the theme based on the current configuration.
59
-
60
- Args:
61
- reload (bool): If True, reload the theme from the configuration.
62
- If False, use the currently set theme.
63
-
64
- Returns:
65
- bool: True if the theme changed, False otherwise.
66
- """
67
33
  if reload:
68
- # Re-read from config
69
34
  global_config = self.config_manager.read_global_config_data()
70
- new_theme = global_config.get("global_settings", {}).get("theme", "dark")
35
+ new_theme = global_config.get("global_settings", {}).get("theme", "catppuccin")
71
36
 
72
- # Check if theme changed
73
37
  if new_theme != self.theme:
74
38
  self.theme = new_theme
39
+ ThemeLoader.clear_cache()
75
40
  self._set_theme_class()
76
41
  self.theme_changed.emit(self.theme)
77
42
  return True
78
43
  return False
79
44
 
45
+ def _get_attr(self, name: str, default: str = "") -> str:
46
+ return getattr(self.theme_class, name, default)
47
+
80
48
  def get_main_style(self):
81
- """Get the main style for the chat window."""
82
- return self.theme_class.MAIN_STYLE
49
+ return self._get_attr("MAIN_STYLE")
83
50
 
84
51
  def get_config_window_style(self):
85
- return self.theme_class.CONFIG_DIALOG
52
+ return self._get_attr("CONFIG_DIALOG")
86
53
 
87
54
  def get_button_style(self, button_type="primary"):
88
- """Get style for buttons based on type."""
89
- if button_type == "primary":
90
- return self.theme_class.PRIMARY_BUTTON
91
- elif button_type == "secondary":
92
- return self.theme_class.SECONDARY_BUTTON
93
- elif button_type == "stop":
94
- return self.theme_class.STOP_BUTTON
95
- elif button_type == "disabled":
96
- return self.theme_class.DISABLED_BUTTON
97
- elif button_type == "stop_stopping":
98
- return self.theme_class.STOP_BUTTON_STOPPING
99
- elif button_type == "red":
100
- return self.theme_class.RED_BUTTON
101
- elif button_type == "green":
102
- return self.theme_class.GREEN_BUTTON
103
- elif button_type == "agent_menu":
104
- return self.theme_class.AGENT_MENU_BUTTON
105
- else:
106
- return ""
55
+ button_map = {
56
+ "primary": "PRIMARY_BUTTON",
57
+ "secondary": "SECONDARY_BUTTON",
58
+ "stop": "STOP_BUTTON",
59
+ "disabled": "DISABLED_BUTTON",
60
+ "stop_stopping": "STOP_BUTTON_STOPPING",
61
+ "red": "RED_BUTTON",
62
+ "green": "GREEN_BUTTON",
63
+ "agent_menu": "AGENT_MENU_BUTTON",
64
+ }
65
+ attr_name = button_map.get(button_type, "")
66
+ return self._get_attr(attr_name) if attr_name else ""
107
67
 
108
68
  def get_input_style(self):
109
- """Get style for text input."""
110
- return self.theme_class.TEXT_INPUT
69
+ return self._get_attr("TEXT_INPUT")
111
70
 
112
71
  def get_menu_style(self):
113
- """Get style for menus."""
114
- return self.theme_class.MENU_BAR
72
+ return self._get_attr("MENU_BAR")
115
73
 
116
74
  def get_status_indicator_style(self):
117
- """Get style for status indicator."""
118
- return self.theme_class.STATUS_INDICATOR
75
+ return self._get_attr("STATUS_INDICATOR")
119
76
 
120
77
  def get_version_label_style(self):
121
- """Get style for version label."""
122
- return self.theme_class.VERSION_LABEL
78
+ return self._get_attr("VERSION_LABEL")
123
79
 
124
80
  def get_tool_dialog_text_edit_style(self):
125
- """Get style for tool dialog text edit."""
126
- return self.theme_class.TOOL_DIALOG_TEXT_EDIT
81
+ return self._get_attr("TOOL_DIALOG_TEXT_EDIT")
127
82
 
128
83
  def get_tool_dialog_yes_button_style(self):
129
- """Get style for tool dialog yes button."""
130
- return self.theme_class.TOOL_DIALOG_YES_BUTTON
84
+ return self._get_attr("TOOL_DIALOG_YES_BUTTON")
131
85
 
132
86
  def get_tool_dialog_all_button_style(self):
133
- """Get style for tool dialog all button."""
134
- return self.theme_class.TOOL_DIALOG_ALL_BUTTON
87
+ return self._get_attr("TOOL_DIALOG_ALL_BUTTON")
135
88
 
136
89
  def get_tool_dialog_no_button_style(self):
137
- """Get style for tool dialog no button."""
138
- return self.theme_class.TOOL_DIALOG_NO_BUTTON
90
+ return self._get_attr("TOOL_DIALOG_NO_BUTTON")
139
91
 
140
92
  def get_system_message_label_style(self):
141
- """Get style for system message labels."""
142
- return self.theme_class.SYSTEM_MESSAGE_LABEL
93
+ return self._get_attr("SYSTEM_MESSAGE_LABEL")
143
94
 
144
95
  def get_system_message_toggle_style(self):
145
- """Get style for system message toggle buttons."""
146
- return self.theme_class.SYSTEM_MESSAGE_TOGGLE
96
+ return self._get_attr("SYSTEM_MESSAGE_TOGGLE")
147
97
 
148
98
  def get_sidebar_style(self):
149
- """Get style for sidebar widgets."""
150
- return self.theme_class.SIDEBAR
99
+ return self._get_attr("SIDEBAR")
151
100
 
152
101
  def get_conversation_list_style(self):
153
- """Get style for conversation list."""
154
- return self.theme_class.CONVERSATION_LIST
102
+ return self._get_attr("CONVERSATION_LIST")
155
103
 
156
104
  def get_search_box_style(self):
157
- """Get style for search boxes."""
158
- return self.theme_class.SEARCH_BOX
105
+ return self._get_attr("SEARCH_BOX")
159
106
 
160
107
  def get_token_usage_style(self):
161
- """Get style for token usage widgets."""
162
- return self.theme_class.TOKEN_USAGE
108
+ return self._get_attr("TOKEN_USAGE")
163
109
 
164
110
  def get_token_usage_widget_style(self):
165
- """Get style for token usage widget background."""
166
- return self.theme_class.TOKEN_USAGE_WIDGET
111
+ return self._get_attr("TOKEN_USAGE_WIDGET")
167
112
 
168
113
  def get_context_menu_style(self):
169
- """Get style for context menus."""
170
- return self.theme_class.CONTEXT_MENU
114
+ return self._get_attr("CONTEXT_MENU")
171
115
 
172
116
  def get_agent_menu_style(self):
173
- """Get style for agent menus."""
174
- return self.theme_class.AGENT_MENU
117
+ return self._get_attr("AGENT_MENU")
175
118
 
176
119
  def get_user_bubble_style(self):
177
- """Get style for user message bubbles."""
178
- return self.theme_class.USER_BUBBLE
120
+ return self._get_attr("USER_BUBBLE")
179
121
 
180
122
  def get_assistant_bubble_style(self):
181
- """Get style for assistant message bubbles."""
182
- return self.theme_class.ASSISTANT_BUBBLE
123
+ return self._get_attr("ASSISTANT_BUBBLE")
183
124
 
184
125
  def get_thinking_bubble_style(self):
185
- """Get style for thinking message bubbles."""
186
- return self.theme_class.THINKING_BUBBLE
126
+ return self._get_attr("THINKING_BUBBLE")
187
127
 
188
128
  def get_consolidated_bubble_style(self):
189
- """Get style for consolidated message bubbles."""
190
- return self.theme_class.CONSOLIDATED_BUBBLE
129
+ return self._get_attr("CONSOLIDATED_BUBBLE")
191
130
 
192
131
  def get_splitter_style(self):
193
- return self.theme_class.SPLITTER_COLOR
132
+ return self._get_attr("SPLITTER_COLOR")
194
133
 
195
134
  def get_code_color_style(self):
196
- return self.theme_class.CODE_CSS
135
+ return self._get_attr("CODE_CSS")
197
136
 
198
137
  def get_rollback_button_style(self):
199
- """Get style for rollback buttons."""
200
- return self.theme_class.ROLLBACK_BUTTON
138
+ return self._get_attr("ROLLBACK_BUTTON")
201
139
 
202
140
  def get_consolidated_button_style(self):
203
- """Get style for consolidated buttons."""
204
- return self.theme_class.CONSOLIDATED_BUTTON
141
+ return self._get_attr("CONSOLIDATED_BUTTON")
205
142
 
206
143
  def get_unconsolidate_button_style(self):
207
- """Get style for unconsolidate buttons."""
208
- return self.theme_class.UNCONSOLIDATE_BUTTON
144
+ return self._get_attr("UNCONSOLIDATE_BUTTON")
209
145
 
210
146
  def get_user_message_label_style(self):
211
- """Get style for user message labels."""
212
- return self.theme_class.USER_MESSAGE_LABEL
147
+ return self._get_attr("USER_MESSAGE_LABEL")
213
148
 
214
149
  def get_assistant_message_label_style(self):
215
- """Get style for assistant message labels."""
216
- return self.theme_class.ASSISTANT_MESSAGE_LABEL
150
+ return self._get_attr("ASSISTANT_MESSAGE_LABEL")
217
151
 
218
152
  def get_thinking_message_label_style(self):
219
- """Get style for thinking message labels."""
220
- return self.theme_class.THINKING_MESSAGE_LABEL
153
+ return self._get_attr("THINKING_MESSAGE_LABEL")
221
154
 
222
155
  def get_user_sender_label_style(self):
223
- """Get style for user sender labels."""
224
- return self.theme_class.USER_SENDER_LABEL
156
+ return self._get_attr("USER_SENDER_LABEL")
225
157
 
226
158
  def get_assistant_sender_label_style(self):
227
- """Get style for assistant sender labels."""
228
- return self.theme_class.ASSISTANT_SENDER_LABEL
159
+ return self._get_attr("ASSISTANT_SENDER_LABEL")
229
160
 
230
161
  def get_thinking_sender_label_style(self):
231
- """Get style for thinking sender labels."""
232
- return self.theme_class.THINKING_SENDER_LABEL
162
+ return self._get_attr("THINKING_SENDER_LABEL")
233
163
 
234
164
  def get_metadata_header_label_style(self):
235
- """Get style for metadata header labels."""
236
- return self.theme_class.METADATA_HEADER_LABEL
165
+ return self._get_attr("METADATA_HEADER_LABEL")
237
166
 
238
167
  def get_user_file_name_label_style(self):
239
- """Get style for user file name labels."""
240
- return self.theme_class.USER_FILE_NAME_LABEL
168
+ return self._get_attr("USER_FILE_NAME_LABEL")
241
169
 
242
170
  def get_assistant_file_name_label_style(self):
243
- """Get style for assistant file name labels."""
244
- return self.theme_class.ASSISTANT_FILE_NAME_LABEL
171
+ return self._get_attr("ASSISTANT_FILE_NAME_LABEL")
245
172
 
246
173
  def get_user_file_info_label_style(self):
247
- """Get style for user file info labels."""
248
- return self.theme_class.USER_FILE_INFO_LABEL
174
+ return self._get_attr("USER_FILE_INFO_LABEL")
249
175
 
250
176
  def get_assistant_file_info_label_style(self):
251
- """Get style for assistant file info labels."""
252
- return self.theme_class.ASSISTANT_FILE_INFO_LABEL
177
+ return self._get_attr("ASSISTANT_FILE_INFO_LABEL")
253
178
 
254
179
  def get_api_keys_group_style(self):
255
- """Get style for API keys group boxes."""
256
- return self.theme_class.API_KEYS_GROUP
180
+ return self._get_attr("API_KEYS_GROUP")
257
181
 
258
182
  def get_editor_container_widget_style(self):
259
- """Get style for editor container widgets."""
260
- return self.theme_class.EDITOR_CONTAINER_WIDGET
183
+ return self._get_attr("EDITOR_CONTAINER_WIDGET")
261
184
 
262
185
  def get_combo_box_style(self):
263
- """Get style for combo boxes."""
264
- return self.theme_class.COMBO_BOX
186
+ return self._get_attr("COMBO_BOX")
265
187
 
266
188
  def get_checkbox_style(self):
267
- """Get style for checkboxes with enhanced tristate support."""
268
- return getattr(self.theme_class, "CHECKBOX_STYLE", "")
189
+ return self._get_attr("CHECKBOX_STYLE", "")
269
190
 
270
191
  def get_tool_widget_style(self):
271
- """Get style for tool widgets."""
272
- return (
273
- self.theme_class.TOOL_WIDGET
274
- if hasattr(self.theme_class, "TOOL_WIDGET")
275
- else ""
276
- )
192
+ return self._get_attr("TOOL_WIDGET", "")
277
193
 
278
194
  def get_tool_card_style(self):
279
- """Get style for tool widget cards."""
280
- return (
281
- self.theme_class.TOOL_CARD if hasattr(self.theme_class, "TOOL_CARD") else ""
282
- )
195
+ return self._get_attr("TOOL_CARD", "")
283
196
 
284
197
  def get_tool_card_error_style(self):
285
- """Get style for tool widget cards in error state."""
286
- return (
287
- self.theme_class.TOOL_CARD_ERROR
288
- if hasattr(self.theme_class, "TOOL_CARD_ERROR")
289
- else ""
290
- )
198
+ return self._get_attr("TOOL_CARD_ERROR", "")
291
199
 
292
200
  def get_tool_header_style(self):
293
- """Get style for tool widget headers."""
294
- return (
295
- self.theme_class.TOOL_HEADER
296
- if hasattr(self.theme_class, "TOOL_HEADER")
297
- else ""
298
- )
201
+ return self._get_attr("TOOL_HEADER", "")
299
202
 
300
203
  def get_tool_toggle_button_style(self):
301
- """Get style for tool widget toggle buttons."""
302
- return (
303
- self.theme_class.TOOL_TOGGLE_BUTTON
304
- if hasattr(self.theme_class, "TOOL_TOGGLE_BUTTON")
305
- else ""
306
- )
204
+ return self._get_attr("TOOL_TOGGLE_BUTTON", "")
307
205
 
308
206
  def get_tool_status_style(self):
309
- """Get style for tool widget status indicators."""
310
- return (
311
- self.theme_class.TOOL_STATUS
312
- if hasattr(self.theme_class, "TOOL_STATUS")
313
- else ""
314
- )
207
+ return self._get_attr("TOOL_STATUS", "")
315
208
 
316
209
  def get_tool_content_style(self):
317
- """Get style for tool widget content."""
318
- return (
319
- self.theme_class.TOOL_CONTENT
320
- if hasattr(self.theme_class, "TOOL_CONTENT")
321
- else ""
322
- )
210
+ return self._get_attr("TOOL_CONTENT", "")
323
211
 
324
212
  def get_tool_progress_style(self):
325
- """Get style for tool widget progress bars."""
326
- return (
327
- self.theme_class.TOOL_PROGRESS
328
- if hasattr(self.theme_class, "TOOL_PROGRESS")
329
- else ""
330
- )
213
+ return self._get_attr("TOOL_PROGRESS", "")
331
214
 
332
215
  def get_tool_separator_style(self):
333
- """Get style for tool widget separators."""
334
- return (
335
- self.theme_class.TOOL_SEPARATOR
336
- if hasattr(self.theme_class, "TOOL_SEPARATOR")
337
- else ""
338
- )
216
+ return self._get_attr("TOOL_SEPARATOR", "")
339
217
 
340
218
  def get_tool_icon(self, tool_name):
341
- """Get icon for a specific tool."""
342
- icons = getattr(self.theme_class, "TOOL_ICONS", {})
343
- return icons.get(tool_name, icons.get("default", "🔧"))
219
+ return self.theme_class.get_icon(tool_name, "\U0001f527")
344
220
 
345
221
  def get_json_editor_colors(self):
346
- """Get color scheme for JSON editor from current theme."""
347
222
  return self.theme_class.JSON_EDITOR_COLORS
348
223
 
349
224
  def get_json_editor_style(self):
350
- """Get complete stylesheet for JSON editor."""
351
225
  return self.theme_class.JSON_EDITOR_STYLE
352
226
 
353
227
  def get_markdown_editor_colors(self):
354
- """Get color scheme for Markdown editor from current theme."""
355
- return getattr(
356
- self.theme_class,
357
- "MARKDOWN_EDITOR_COLORS",
358
- {
359
- "background": "#313244",
360
- "text": "#cdd6f4",
361
- "border": "#45475a",
362
- "header": "#89b4fa",
363
- "bold": "#fab387",
364
- "italic": "#a6e3a1",
365
- "code": "#f5c2e7",
366
- "code_background": "#45475a",
367
- "link": "#74c7ec",
368
- "image": "#cba6f7",
369
- "list": "#f9e2af",
370
- "blockquote": "#94e2d5",
371
- "hr": "#6c7086",
372
- "strikethrough": "#eba0ac",
373
- "error": "#f38ba8",
374
- },
375
- )
228
+ return self.theme_class.MARKDOWN_EDITOR_COLORS
376
229
 
377
230
  def get_markdown_editor_style(self):
378
- """Get complete stylesheet for Markdown editor."""
379
- return getattr(
380
- self.theme_class,
381
- "MARKDOWN_EDITOR_STYLE",
382
- """
383
- QPlainTextEdit {
384
- background-color: #313244;
385
- color: #cdd6f4;
386
- border: 1px solid #45475a;
387
- border-radius: 4px;
388
- padding: 8px;
389
- font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
390
- font-size: 12px;
391
- line-height: 1.4;
392
- }
393
- QPlainTextEdit:focus {
394
- border: 1px solid #89b4fa;
395
- }
396
- """,
397
- )
231
+ return self.theme_class.MARKDOWN_EDITOR_STYLE
398
232
 
399
233
  def get_diff_colors(self):
400
- """Get color scheme for diff widget from current theme."""
401
- return getattr(
402
- self.theme_class,
403
- "DIFF_COLORS",
404
- {
405
- "background": "#1e1e2e",
406
- "panel_bg": "#313244",
407
- "header_bg": "#45475a",
408
- "header_text": "#cdd6f4",
409
- "line_number_bg": "#181825",
410
- "line_number_text": "#6c7086",
411
- "removed_bg": "#3b2d33",
412
- "removed_text": "#f38ba8",
413
- "removed_highlight": "#f38ba8",
414
- "added_bg": "#2d3b33",
415
- "added_text": "#a6e3a1",
416
- "added_highlight": "#a6e3a1",
417
- "unchanged_text": "#6c7086",
418
- "border": "#45475a",
419
- "block_header_bg": "#585b70",
420
- "block_header_text": "#b4befe",
421
- },
422
- )
234
+ return self.theme_class.DIFF_COLORS